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 |
|---|---|---|---|---|---|---|
Support functions Run the jekyll command, with arguments (symbols are long options, hashes are long options with arguments)
|
def jekyll(*directives)
directives.map! do |x|
case x
when Symbol
"--#{x}"
when Hash
x.map { |k, v| "--#{k}=#{v}" }.join(' ')
else x
end
end
sh "jekyll #{directives.join(' ')}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def jekyll(options = '')\n system(\"bin/jekyll #{options}\")\nend",
"def jekyll(opts = '')\n if ENV['dev']=='on'\n dev = ' --plugins=_plugins,_plugins-dev'\n else\n dev = ''\n end\n sh \"bundle exec jekyll #{opts}#{dev} --trace\"\nend",
"def build_site\n sh \"bundle exec jekyll build\"\nend",
"def hmd _args\n \"hmd _args;\" \n end",
"def jekyll_serve build\n # Locally serve Jekyll as per the primary Jekyll config file\n @logger.debug \"Attempting Jekyll serve operation.\"\n config_file = build.props['files'][0]\n if build.props['arguments']\n opts_args = build.props['arguments'].to_opts_args\n end\n command = \"bundle exec jekyll serve --config #{config_file} #{opts_args} --no-watch --skip-initial-build\"\n system command\nend",
"def init_options\n @since = \"\"\n @format = :markdown\n ARGV.each do |arg|\n if arg.start_with?(\"--since=\")\n @since = arg.dup\n elsif arg == \"--html\"\n @format = :html\n end\n end\nend",
"def build(options={})\n if options[:octopress_config]\n FileUtils.cp options[:octopress_config], '_octopress.yml'\n end\n\n config = ['_config.yml'] << options[:config]\n cmd = \"rm -rf site && bundle exec jekyll build --config #{config.join(',')}\"\n\n `#{cmd}`\n `rm _octopress.yml` if options[:octopress_config]\nend",
"def build_site_command(destination=nil)\n staging_config_file = '_config.staging.yml'\n args = []\n args.concat ['--destination', destination] unless destination.nil?\n\n if File.exists? staging_config_file\n args.concat ['--config', \"_config.yml,#{staging_config_file}\"]\n end\n\n ['bundle', 'exec', 'jekyll', 'build', *args]\nend",
"def start_jekyll preview\n path = get_dest_path preview\n Dir.chdir path\n Bundler.with_clean_env do\n ActiveSupport::Dependencies.interlock.permit_concurrent_loads do\n begin\n continue = true\n # Test if bundle was previously updated\n out, status = Open3.capture2e(\"bundle check\")\n continue = status.success?\n #unless continue\n # raise \"Bundle check failed\"\n #end\n bundle_updated = BUNDLE_CHECK_REGEX =~ out\n # Update the bundle\n if bundle_updated.nil?\n Open3.popen2e(\"bundle update jekyll\") do |i, oe, t|\n terminal_add preview, terminal_info(I18n.t('preview.message.bundle.start'))\n oe.each {|line|\n #puts line\n terminal_add preview, terminal_cmd(line)\n #error = /warning/ =~ line\n }\n continue = t.value.success?\n if continue\n terminal_add preview, terminal_info(I18n.t('preview.message.bundle.end'))\n else\n terminal_add preview, terminal_info(I18n.t('preview.message.bundle.error'))\n end\n end\n unless continue\n return\n end\n end\n # Start Jekyll server \n Open3.popen2e(\"bundle exec jekyll serve --config _config_local.yml\") do |i, oe, t|\n terminal_add preview, terminal_trigger(I18n.t('preview.trigger.start'), '')\n terminal_add preview, terminal_info(I18n.t('preview.message.jekyll.start'))\n preview.set_starting t.pid\n oe.each {|line|\n #puts line\n #error = /warning/ =~ line\n terminal_add preview, terminal_cmd(line)\n if JEKYLL_URL_REGEX =~ line\n address = line.scan JEKYLL_URL_REGEX\n preview.url = address[0][0]\n preview.save\n elsif JEKYLL_START_REGEX=~ line\n preview.set_started\n # Trigger started\n terminal_add preview, terminal_trigger(I18n.t('preview.trigger.run'), '')\n terminal_add preview, terminal_info(I18n.t('preview.message.jekyll.started'))\n elsif JEKYLL_UPDATE_REGEX =~ line\n duration = line.scan JEKYLL_UPDATE_REGEX\n # Trigger updated\n terminal_add preview, terminal_trigger(I18n.t('preview.trigger.update'), \"#{duration[0][0]}\")\n end\n }\n rescue Exception => exception\n pp exception.backtrace\n terminal_add preview, terminal_trigger(I18n.t('preview.trigger.error'), exception.backtrace)\n terminal_add preview, terminal_info(I18n.t('preview.message.jekyll.error')) \n end\n end\n preview.stop\n # Trigger stopped\n terminal_add preview, terminal_trigger(I18n.t('preview.trigger.stop'), '')\n terminal_add preview, terminal_info(I18n.t('preview.message.jekyll.end'))\n end\n end\n end",
"def build_site_command(destination=nil, staging_url='')\n config = '_config.staging.yml'\n generate_staging_config(staging_url, config) unless staging_url.empty?\n\n args = []\n args.concat ['--destination', destination] unless destination.nil?\n\n if File.exists? config\n args.concat ['--config', \"_config.yml,#{config}\"]\n end\n\n ['bundle', 'exec', 'jekyll', 'build', *args]\nend",
"def render_md(site, readme)\n begin\n mkconverter = site.getConverterImpl(Jekyll::Converters::Markdown)\n readme.gsub! \"```\",\"\\n```\"\n readme.gsub! '```shell','```bash'\n return mkconverter.convert(readme)\n rescue\n return 'Could not convert readme.'\n end\nend",
"def cleanup\n jekyll('clean')\nend",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def shell_commands(cmd, args); end",
"def execute(*args)\n set_config('gist.api-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.api-url')\n set_config('gist.default-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.default-url')\n\n begin\n option_parser.parse!(args)\n\n if $stdin.tty? && options.setup_credentials\n api_url # make sure API URL selection happens, if need be\n setup_credentials\n exit 1\n end\n\n if $stdin.tty? && args[0] != '-'\n # Run without stdin.\n usage if args.empty?\n\n files = args.inject([]) { |list, file|\n # Check if arg is a file. If so, grab the content.\n abort \"Can't find #{file}\" unless File.exists?(file)\n\n list.push({\n :input => File.read(file),\n :filename => file,\n :extension => file.include?('.') ? File.extname(file) : options.gist_extension\n })\n }\n else\n # Read from standard input.\n input = $stdin.read\n files = [{:input => input, :extension => options.gist_extension}]\n end\n\n url = write(files, options.private_gist, options.description)\n browse(url) if options.browse_enabled\n $stdout.puts copy(to_embed(url)) if options.embed_enabled\n $stdout.puts copy(url) unless options.embed_enabled\n rescue Interrupt\n $stderr.puts \"\\nQuit.\"\n exit 1\n rescue OptionParser::InvalidOption => e\n warn e; puts\n usage\n exit 1\n rescue StandardError => e\n options.debug ? warn(e) : raise(e)\n end\n end",
"def shell_commands(cmd, *args); end",
"def parse_args\n doc = <<DOCOPT\nschwifty saves and downloads objects from ipfs, keeping track of their hashes in a garbage collection file in ~/.ipfs/ipfs_pinned_objects.yaml and an objects file in ./ipfs_objects.yaml\n\nUsage:\n schwifty add <files>...\n schwifty bootstrap (--clear | <nodes>... | --file=<bootstrap_list_yaml>)\n schwifty get <files_or_hashes>...\n schwifty gc\n schwifty -h | --help\n schwifty --version\n\nOptions:\n -h --help Show this screen.\n --version Show version.\nDOCOPT\n begin\n Docopt.docopt(doc)\n rescue Docopt::Exit => e\n puts e.message\n exit\n end\n end",
"def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: webby-gen [options] template site'\n\n opts.separator ''\n opts.separator 'The webby-gen command is used to generate a site from a standard template.'\n opts.separator 'A new site can be created, or an existing site can be added to or updated.'\n\n opts.separator ''\n opts.on('-f', '--force',\n 'overwrite files that already exist') {options[:collision] = :force}\n opts.on('-s', '--skip',\n 'skip files that already exist') {options[:collision] = :skip}\n opts.on('-u', '--update',\n 'update rake tasks for the site') {options[:update] = true}\n opts.on('-p', '--pretend',\n 'run but do not make any changes') {options[:pretend] = true}\n\n opts.separator ''\n opts.on('-t', '--templates', 'list available templates') {\n ary = templates.map {|t| ::File.basename(t)}\n ary.delete 'webby'\n puts \"\\nAvailable Templates\"\n puts \" #{ary.join(', ')}\"\n puts\n exit\n }\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on( '-h', '--help', 'show this message' ) {puts opts; exit}\n opts.on( '--version', 'show version' ) do\n puts \"Webby #{::Webby::VERSION}\"\n exit\n end\n\n # parse the command line arguments\n opts.parse! args\n tmpl, @site = args\n\n # if no site was given, see if there is a Sitefile in the current\n # directory\n if site.nil?\n self.site = '.' if test(?f, 'Sitefile')\n end\n\n # exit if comand line args are missing\n if site.nil? or tmpl.nil?\n puts opts\n exit 1\n end\n\n templates.each {|t| self.template = t if t =~ %r/\\/#{tmpl}$/}\n if template.nil?\n puts opts\n abort \"Could not find template '#{tmpl}'\"\n end\n\n nil\n end",
"def convertHtmlToMarkdown\n root = pathExports\n n = 1\n Pathname.glob(pathExports() + \"**/*.html\").each do |p|\n puts \"File \" + n.to_s + \": \" + p.to_s\n n = n + 1\n infile = p.to_s\n outfile = p.sub_ext(\".md\").to_s\n command = \"pandoc -f html -t markdown -o #{outfile} #{infile}\"\n puts command\n sh(command)\n end\nend",
"def run( args )\n dir_str = args.shift\n case dir_str\n when '-h', '--help'\n help\n when '-v', '--version'\n @out.puts \"QuickGitHelp #{::QuickGitHelp::VERSION}\"\n nil\n when nil\n QuickGitHelp::Tutorial.new(Dir.pwd).create\n else\n QuickGitHelp::Tutorial.new(File.expand_path(dir_str)).create\n end\n\n rescue StandardError => err\n @err.puts \"ERROR: While executing quickgithelp ... (#{err.class})\"\n @err.puts \" #{err.to_s}\"\n exit 1\n end",
"def execute(*args)\n private_gist = defaults[\"private\"]\n gist_filename = nil\n gist_extension = defaults[\"extension\"]\n browse_enabled = defaults[\"browse\"]\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: gist [options] [filename or stdin]\"\n\n opts.on('-p', '--[no-]private', 'Make the gist private') do |priv|\n private_gist = priv\n end\n\n t_desc = 'Set syntax highlighting of the Gist by file extension'\n opts.on('-t', '--type [EXTENSION]', t_desc) do |extension|\n gist_extension = '.' + extension\n end\n\n opts.on('-o','--[no-]open', 'Open gist in browser') do |o|\n browse_enabled = o\n end\n\n opts.on('-m', '--man', 'Print manual') do\n Gist::Manpage.display(\"gist\")\n end\n\n opts.on('-v', '--version', 'Print version') do\n puts Gist::Version\n exit\n end\n\n opts.on('-h', '--help', 'Display this screen') do\n puts opts\n exit\n end\n end\n\n opts.parse!(args)\n\n begin\n if $stdin.tty?\n # Run without stdin.\n\n # No args, print help.\n if args.empty?\n puts opts\n exit\n end\n\n # Check if arg is a file. If so, grab the content.\n if File.exists?(file = args[0])\n input = File.read(file)\n gist_filename = file\n gist_extension = File.extname(file) if file.include?('.')\n else\n abort \"Can't find #{file}\"\n end\n else\n # Read from standard input.\n input = $stdin.read\n end\n\n url = write(input, private_gist, gist_extension, gist_filename)\n browse(url) if browse_enabled\n puts copy(url)\n rescue => e\n warn e\n puts opts\n end\n end",
"def usage\n puts \"usage: jstags.rb [-e] [-i] [-h] [-u] directory_name\"\n\n puts \"args :\\n\"\n puts \" -e exclude path(s) matching regex argument\\n\"\n puts \" -i include path(s) matching regex argument\\n\"\n puts \" -h output a standard set of ctags headers\\n\"\n puts \" -u produce this output; override other flags\\n\"\n puts \" directory_name - name of directory to scan\\n\"\n\n puts \"\\nOutput is written to stdout so you can redirect/filter as needed.\\n\"\n puts \"\\nSupported source code patterns for locating tag symbols include:\\n\"\n puts \" sym=function, sym=new Function, sym:function, and function sym().\\n\\n\"\n\n exit(0)\nend",
"def run(args) #:nodoc:\n rdoc = RDocCommand.new\n commands[:rdoc] = rdoc if !commands[:rdoc]\n commands[:help] = DefaultHelpCommand.new(@@version,rdoc) if !commands[:help]\n exit_code = 0\n begin\n config = parse_config\n override_defaults_based_on_config(config)\n global_options,command,options,arguments = parse_options(args)\n copy_options_to_aliased_versions(global_options,command,options)\n global_options = convert_to_openstruct?(global_options)\n options = convert_to_openstruct?(options)\n if proceed?(global_options,command,options,arguments)\n command = commands[@@default_command] if !command\n command.execute(global_options,options,arguments)\n if !command.skips_post && @@post_block\n @@post_block.call(global_options,command,options,arguments)\n end\n end\n rescue Exception => ex\n\n @@stderr.puts error_message(ex) if regular_error_handling?(ex)\n\n exit_code = if ex.respond_to? :exit_code\n ex.exit_code\n else\n -2\n end\n raise ex if ENV['GLI_DEBUG'] == 'true'\n end\n exit_code\n end",
"def command_help\n @colour.help '--- Welcome to ForGen, the home of custom image creation ---'\n @colour.help 'ForGen command line structure'\n @colour.help 'ruby forgen.rb command [options]'\n @colour.help ''\n\n @colour.help '[command: main]'\n @colour.help \"r, run\\t\\t\\t\\t Run all aspects of ForGen\"\n @colour.help \"make-configuration\\t\\t Make configuration files for a new project\"\n @colour.help \"make-vagrant-basebox\\t\\t Make a vagrant basebox\"\n @colour.help \"make-virtual-machine\\t\\t Make a virtual machine\"\n @colour.help \"make-forensic-image\\t\\t Make a forensic image\"\n @colour.help ''\n\n @colour.help '[command: information]'\n @colour.help \"-h, --help\\t\\t\\t Display this help screen\"\n @colour.help \"--version\\t\\t\\t Displays the current ForGen version\"\n @colour.help \"--list-cases\\t\\t\\t List all case files currently in ForGen\"\n @colour.help \"--list-modules <type>\\t\\t List <type> modules that are in ForGen\"\n @colour.help ''\n\n @colour.help '[command: projects]'\n @colour.help \"--delete-all-projects\\t\\t Deletes ALL projects in the projects directory\"\n @colour.help ''\n\n @colour.help '[options: stdout]'\n @colour.help \"--disable-colours\\t\\t Disable all std output colour formatting\"\n @colour.help ''\n\n @colour.help '[options: cases]'\n @colour.help \"--case-path\\t\\t\\t The path to the case file to use\"\n @colour.help ''\n\n @colour.help '[options: forensic images]'\n @colour.help \"--forensic-image-output-dir\\t Output image output directory\"\n @colour.help \"--create-raw-image\\t\\t Create a RAW image of all VM drives\"\n @colour.help \"--create-ewf-image\\t\\t Create an EWF image of all VM drives\"\n @colour.help \"--delete-vm-after-image-creation\\b\\t Delete the VM after image generation\"\n @colour.help ''\n\n @colour.help '[options: modules]'\n @colour.help \"--basebox-url\\t\\t\\t URL to the basebox (overwrites basebox modules)\"\n @colour.help ''\n\n @colour.help '[options: vm]'\n @colour.help \"--no-vm-shutdown\\t\\t Stops vm shutdown (will stop forensic image generation)\"\n @colour.help \"--gui-output\\t\\t\\t Instructs ForGen to create vms in background\"\n @colour.help \"--max-processor-cap\\t\\t Sets processor execution cap\"\n @colour.help \"--max-memory-usage\\t\\t Sets max vm memory [RAM]\"\n @colour.help \"--number-of-processors\\t\\t Sets number of vm processing cores\"\n @colour.help ''\n\n @colour.help '[options: debug]'\n @colour.help \"--verbose\\t\\t\\t Run all ForGen elements in verbose mode\"\n @colour.help \"--debug\\t\\t\\t\\t Run all ForGen elements in debug mode\"\n @colour.help ''\n\nend",
"def to_shellwords\n argv = []\n argv << %[--autopath] if autopath?\n argv << %[--verbose] if verbose?\n argv << %[--format=\"#{format}\"] if format\n argv << %[--chdir=\"#{chdir}\"] if chdir\n argv << %[--tags=\"#{tags.join(';')}\"] unless tags.empty?\n argv << %[--match=\"#{match.join(';')}\"] unless match.empty?\n argv << %[--units=\"#{units.join(';')}\"] unless units.empty?\n argv << %[--loadpath=\"#{loadpath.join(';')}\"] unless loadpath.empty?\n argv << %[--requires=\"#{requires.join(';')}\"] unless requires.empty?\n argv << files.join(' ') unless files.empty?\n argv\n end",
"def main\n ARGV.each do |arg|\n make_pdf arg\n end\nend",
"def parse argv\n ignore_invalid = true\n\n argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']\n\n opts = OptionParser.new do |opt|\n @option_parser = opt\n opt.program_name = File.basename $0\n opt.version = RDoc::VERSION\n opt.release = nil\n opt.summary_indent = ' ' * 4\n opt.banner = <<-EOF\nUsage: #{opt.program_name} [options] [names...]\n\n Files are parsed, and the information they contain collected, before any\n output is produced. This allows cross references between all files to be\n resolved. If a name is a directory, it is traversed. If no names are\n specified, all Ruby files in the current directory (and subdirectories) are\n processed.\n\n How RDoc generates output depends on the output formatter being used, and on\n the options you give.\n\n Options can be specified via the RDOCOPT environment variable, which\n functions similar to the RUBYOPT environment variable for ruby.\n\n $ export RDOCOPT=\"--show-hash\"\n\n will make rdoc show hashes in method links by default. Command-line options\n always will override those in RDOCOPT.\n\n Available formatters:\n\n#{generator_descriptions}\n\n RDoc understands the following file formats:\n\n EOF\n\n parsers = Hash.new { |h,parser| h[parser] = [] }\n\n RDoc::Parser.parsers.each do |regexp, parser|\n parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source\n end\n\n parsers.sort.each do |parser, regexp|\n opt.banner += \" - #{parser}: #{regexp.join ', '}\\n\"\n end\n opt.banner += \" - TomDoc: Only in ruby files\\n\"\n\n opt.banner += \"\\n The following options are deprecated:\\n\\n\"\n\n name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length\n\n DEPRECATED.sort_by { |k,| k }.each do |name, reason|\n opt.banner += \" %*1$2$s %3$s\\n\" % [-name_length, name, reason]\n end\n\n opt.accept Template do |template|\n template_dir = template_dir_for template\n\n unless template_dir then\n $stderr.puts \"could not find template #{template}\"\n nil\n else\n [template, template_dir]\n end\n end\n\n opt.accept Directory do |directory|\n directory = File.expand_path directory\n\n raise OptionParser::InvalidArgument unless File.directory? directory\n\n directory\n end\n\n opt.accept Path do |path|\n path = File.expand_path path\n\n raise OptionParser::InvalidArgument unless File.exist? path\n\n path\n end\n\n opt.accept PathArray do |paths,|\n paths = if paths then\n paths.split(',').map { |d| d unless d.empty? }\n end\n\n paths.map do |path|\n path = File.expand_path path\n\n raise OptionParser::InvalidArgument unless File.exist? path\n\n path\n end\n end\n\n opt.separator nil\n opt.separator \"Parsing options:\"\n opt.separator nil\n\n opt.on(\"--encoding=ENCODING\", \"-e\", Encoding.list.map { |e| e.name },\n \"Specifies the output encoding. All files\",\n \"read will be converted to this encoding.\",\n \"The default encoding is UTF-8.\",\n \"--encoding is preferred over --charset\") do |value|\n @encoding = Encoding.find value\n @charset = @encoding.name # may not be valid value\n end\n\n opt.separator nil\n\n opt.on(\"--locale=NAME\",\n \"Specifies the output locale.\") do |value|\n @locale_name = value\n end\n\n opt.on(\"--locale-data-dir=DIR\",\n \"Specifies the directory where locale data live.\") do |value|\n @locale_dir = value\n end\n\n opt.separator nil\n\n opt.on(\"--all\", \"-a\",\n \"Synonym for --visibility=private.\") do |value|\n @visibility = :private\n end\n\n opt.separator nil\n\n opt.on(\"--exclude=PATTERN\", \"-x\", Regexp,\n \"Do not process files or directories\",\n \"matching PATTERN.\") do |value|\n @exclude << value\n end\n\n opt.separator nil\n\n opt.on(\"--extension=NEW=OLD\", \"-E\",\n \"Treat files ending with .new as if they\",\n \"ended with .old. Using '-E cgi=rb' will\",\n \"cause xxx.cgi to be parsed as a Ruby file.\") do |value|\n new, old = value.split(/=/, 2)\n\n unless new and old then\n raise OptionParser::InvalidArgument, \"Invalid parameter to '-E'\"\n end\n\n unless RDoc::Parser.alias_extension old, new then\n raise OptionParser::InvalidArgument, \"Unknown extension .#{old} to -E\"\n end\n end\n\n opt.separator nil\n\n opt.on(\"--[no-]force-update\", \"-U\",\n \"Forces rdoc to scan all sources even if\",\n \"no files are newer than the flag file.\") do |value|\n @force_update = value\n end\n\n opt.separator nil\n\n opt.on(\"--pipe\", \"-p\",\n \"Convert RDoc on stdin to HTML\") do\n @pipe = true\n end\n\n opt.separator nil\n\n opt.on(\"--tab-width=WIDTH\", \"-w\", Integer,\n \"Set the width of tab characters.\") do |value|\n raise OptionParser::InvalidArgument,\n \"#{value} is an invalid tab width\" if value <= 0\n @tab_width = value\n end\n\n opt.separator nil\n\n opt.on(\"--visibility=VISIBILITY\", \"-V\", RDoc::VISIBILITIES + [:nodoc],\n \"Minimum visibility to document a method.\",\n \"One of 'public', 'protected' (the default),\",\n \"'private' or 'nodoc' (show everything)\") do |value|\n @visibility = value\n end\n\n opt.separator nil\n\n markup_formats = RDoc::Text::MARKUP_FORMAT.keys.sort\n\n opt.on(\"--markup=MARKUP\", markup_formats,\n \"The markup format for the named files.\",\n \"The default is rdoc. Valid values are:\",\n markup_formats.join(', ')) do |value|\n @markup = value\n end\n\n opt.separator nil\n\n opt.on(\"--root=ROOT\", Directory,\n \"Root of the source tree documentation\",\n \"will be generated for. Set this when\",\n \"building documentation outside the\",\n \"source directory. Default is the\",\n \"current directory.\") do |root|\n @root = Pathname(root)\n end\n\n opt.separator nil\n\n opt.on(\"--page-dir=DIR\", Directory,\n \"Directory where guides, your FAQ or\",\n \"other pages not associated with a class\",\n \"live. Set this when you don't store\",\n \"such files at your project root.\",\n \"NOTE: Do not use the same file name in\",\n \"the page dir and the root of your project\") do |page_dir|\n @page_dir = page_dir\n end\n\n opt.separator nil\n opt.separator \"Common generator options:\"\n opt.separator nil\n\n opt.on(\"--force-output\", \"-O\",\n \"Forces rdoc to write the output files,\",\n \"even if the output directory exists\",\n \"and does not seem to have been created\",\n \"by rdoc.\") do |value|\n @force_output = value\n end\n\n opt.separator nil\n\n generator_text = @generators.keys.map { |name| \" #{name}\" }.sort\n\n opt.on(\"-f\", \"--fmt=FORMAT\", \"--format=FORMAT\", @generators.keys,\n \"Set the output formatter. One of:\", *generator_text) do |value|\n check_generator\n\n @generator_name = value.downcase\n setup_generator\n end\n\n opt.separator nil\n\n opt.on(\"--include=DIRECTORIES\", \"-i\", PathArray,\n \"Set (or add to) the list of directories to\",\n \"be searched when satisfying :include:\",\n \"requests. Can be used more than once.\") do |value|\n @rdoc_include.concat value.map { |dir| dir.strip }\n end\n\n opt.separator nil\n\n opt.on(\"--[no-]coverage-report=[LEVEL]\", \"--[no-]dcov\", \"-C\", Integer,\n \"Prints a report on undocumented items.\",\n \"Does not generate files.\") do |value|\n value = 0 if value.nil? # Integer converts -C to nil\n\n @coverage_report = value\n @force_update = true if value\n end\n\n opt.separator nil\n\n opt.on(\"--output=DIR\", \"--op\", \"-o\",\n \"Set the output directory.\") do |value|\n @op_dir = value\n end\n\n opt.separator nil\n\n opt.on(\"-d\",\n \"Deprecated --diagram option.\",\n \"Prevents firing debug mode\",\n \"with legacy invocation.\") do |value|\n end\n\n opt.separator nil\n opt.separator 'HTML generator options:'\n opt.separator nil\n\n opt.on(\"--charset=CHARSET\", \"-c\",\n \"Specifies the output HTML character-set.\",\n \"Use --encoding instead of --charset if\",\n \"available.\") do |value|\n @charset = value\n end\n\n opt.separator nil\n\n opt.on(\"--hyperlink-all\", \"-A\",\n \"Generate hyperlinks for all words that\",\n \"correspond to known methods, even if they\",\n \"do not start with '#' or '::' (legacy\",\n \"behavior).\") do |value|\n @hyperlink_all = value\n end\n\n opt.separator nil\n\n opt.on(\"--main=NAME\", \"-m\",\n \"NAME will be the initial page displayed.\") do |value|\n @main_page = value\n end\n\n opt.separator nil\n\n opt.on(\"--[no-]line-numbers\", \"-N\",\n \"Include line numbers in the source code.\",\n \"By default, only the number of the first\",\n \"line is displayed, in a leading comment.\") do |value|\n @line_numbers = value\n end\n\n opt.separator nil\n\n opt.on(\"--show-hash\", \"-H\",\n \"A name of the form #name in a comment is a\",\n \"possible hyperlink to an instance method\",\n \"name. When displayed, the '#' is removed\",\n \"unless this option is specified.\") do |value|\n @show_hash = value\n end\n\n opt.separator nil\n\n opt.on(\"--template=NAME\", \"-T\", Template,\n \"Set the template used when generating\",\n \"output. The default depends on the\",\n \"formatter used.\") do |(template, template_dir)|\n @template = template\n @template_dir = template_dir\n end\n\n opt.separator nil\n\n opt.on(\"--template-stylesheets=FILES\", PathArray,\n \"Set (or add to) the list of files to\",\n \"include with the html template.\") do |value|\n @template_stylesheets.concat value\n end\n\n opt.separator nil\n\n opt.on(\"--title=TITLE\", \"-t\",\n \"Set TITLE as the title for HTML output.\") do |value|\n @title = value\n end\n\n opt.separator nil\n\n opt.on(\"--copy-files=PATH\", Path,\n \"Specify a file or directory to copy static\",\n \"files from.\",\n \"If a file is given it will be copied into\",\n \"the output dir. If a directory is given the\",\n \"entire directory will be copied.\",\n \"You can use this multiple times\") do |value|\n @static_path << value\n end\n\n opt.separator nil\n\n opt.on(\"--webcvs=URL\", \"-W\",\n \"Specify a URL for linking to a web frontend\",\n \"to CVS. If the URL contains a '\\%s', the\",\n \"name of the current file will be\",\n \"substituted; if the URL doesn't contain a\",\n \"'\\%s', the filename will be appended to it.\") do |value|\n @webcvs = value\n end\n\n opt.separator nil\n opt.separator \"ri generator options:\"\n opt.separator nil\n\n opt.on(\"--ri\", \"-r\",\n \"Generate output for use by `ri`. The files\",\n \"are stored in the '.rdoc' directory under\",\n \"your home directory unless overridden by a\",\n \"subsequent --op parameter, so no special\",\n \"privileges are needed.\") do |value|\n check_generator\n\n @generator_name = \"ri\"\n @op_dir ||= RDoc::RI::Paths::HOMEDIR\n setup_generator\n end\n\n opt.separator nil\n\n opt.on(\"--ri-site\", \"-R\",\n \"Generate output for use by `ri`. The files\",\n \"are stored in a site-wide directory,\",\n \"making them accessible to others, so\",\n \"special privileges are needed.\") do |value|\n check_generator\n\n @generator_name = \"ri\"\n @op_dir = RDoc::RI::Paths.site_dir\n setup_generator\n end\n\n opt.separator nil\n opt.separator \"Generic options:\"\n opt.separator nil\n\n opt.on(\"--write-options\",\n \"Write .rdoc_options to the current\",\n \"directory with the given options. Not all\",\n \"options will be used. See RDoc::Options\",\n \"for details.\") do |value|\n @write_options = true\n end\n\n opt.separator nil\n\n opt.on(\"--[no-]dry-run\",\n \"Don't write any files\") do |value|\n @dry_run = value\n end\n\n opt.separator nil\n\n opt.on(\"-D\", \"--[no-]debug\",\n \"Displays lots on internal stuff.\") do |value|\n $DEBUG_RDOC = value\n end\n\n opt.separator nil\n\n opt.on(\"--[no-]ignore-invalid\",\n \"Ignore invalid options and continue\",\n \"(default true).\") do |value|\n ignore_invalid = value\n end\n\n opt.separator nil\n\n opt.on(\"--quiet\", \"-q\",\n \"Don't show progress as we parse.\") do |value|\n @verbosity = 0\n end\n\n opt.separator nil\n\n opt.on(\"--verbose\", \"-V\",\n \"Display extra progress as RDoc parses\") do |value|\n @verbosity = 2\n end\n\n opt.separator nil\n\n opt.on(\"--version\", \"-v\", \"print the version\") do\n puts opt.version\n exit\n end\n\n opt.separator nil\n\n opt.on(\"--help\", \"-h\", \"Display this help\") do\n RDoc::RDoc::GENERATORS.each_key do |generator|\n setup_generator generator\n end\n\n puts opt.help\n exit\n end\n\n opt.separator nil\n end\n\n setup_generator 'darkfish' if\n argv.grep(/\\A(-f|--fmt|--format|-r|-R|--ri|--ri-site)\\b/).empty?\n\n deprecated = []\n invalid = []\n\n begin\n opts.parse! argv\n rescue OptionParser::ParseError => e\n if DEPRECATED[e.args.first] then\n deprecated << e.args.first\n elsif %w[--format --ri -r --ri-site -R].include? e.args.first then\n raise\n else\n invalid << e.args.join(' ')\n end\n\n retry\n end\n\n unless @generator then\n @generator = RDoc::Generator::Darkfish\n @generator_name = 'darkfish'\n end\n\n if @pipe and not argv.empty? then\n @pipe = false\n invalid << '-p (with files)'\n end\n\n unless quiet then\n deprecated.each do |opt|\n $stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt]\n end\n end\n\n unless invalid.empty? then\n invalid = \"invalid options: #{invalid.join ', '}\"\n\n if ignore_invalid then\n unless quiet then\n $stderr.puts invalid\n $stderr.puts '(invalid options are ignored)'\n end\n else\n unless quiet then\n $stderr.puts opts\n end\n $stderr.puts invalid\n exit 1\n end\n end\n\n @files = argv.dup\n\n self\n end",
"def execute(input: $stdin, output: $stdout)\n markdown = <<~MARKDOWN\n Just some words\n\n # Heading 1\n\n ## Heading 2\n\n ### Heading 3\n\n #### Heading 4\n\n ##### Heading 5\n\n ***\n\n Just some words\n\n #### Link could go here\n\n [I'm an inline-style link](https://www.google.com)\n\n ## Or a block quote\n\n > Blockquotes are very handy in email to emulate reply text.\n > This line is part of the same quote.\n > *Oh*, you can put **Markdown** into a blockquote.\n\n MARKDOWN\n parsed = TTY::Markdown.parse(markdown)\n puts parsed\n\n :gui\n end",
"def configuration_from_options(options)\n Jekyll.configuration(options)\n end",
"def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end",
"def cmd(options={})\n arguments\n end",
"def run(*args)\n args += support_rdoc_document_file!\n optparse(*yardopts)\n optparse(*args)\n \n if use_cache\n Registry.load\n checksums = Registry.checksums.dup\n end\n YARD.parse(files, excluded)\n Registry.save(use_cache)\n \n if generate\n if incremental\n generate_with_cache(checksums)\n else\n Registry.load_all if use_cache\n Templates::Engine.generate(all_objects, options)\n end\n end\n \n true\n end",
"def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end",
"def launch_man query, *argv\n env = query ? {'LESS' => [ENV['LESS'], \"+/#{query}\"].compact.join(' '),\n 'MORE' => [ENV['MORE'], \"+/#{query}\"].compact.join(' ')} : {}\n system env, 'man', *argv\n end",
"def MarkdownUsage(options = nil)\n MarkdownUsage.print(options)\nend",
"def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nmiddleman-pagegroups version #{Middleman::MiddlemanPageGroups::VERSION}\n\nThis gem adds functionality to Middleman and is not executable on its own,\nother than for generating the documentation sample project and sample partial\nfiles. Instead, you must add this gem to your Middleman project's `Gemfile` \nand then activate it in your `config.rb` file. \n\nHEREDOC\n end\n super\n end",
"def build_mdlinks\n return unless options.Build_Markdown_Links\n\n puts_cyan \"Middlemac is creating `#{options.File_Markdown_Links}`.\"\n\n files_array = []\n out_array = []\n longest_shortcut = 0\n longest_path = 0\n\n Dir.glob(\"#{app.source}/Resources/**/*.erb\").each do |fileName|\n\n # Remove all file extensions and make a shortcut\n base_name = fileName\n while File.extname(base_name) != '' do\n base_name = File.basename( base_name, '.*' )\n end\n next if base_name.start_with?('_') # || base_name == 'index'\n\n if base_name == 'index'\n shortcut = \"[#{File.split(File.split(fileName)[0])[1]}_index]:\"\n\n else\n shortcut = \"[#{base_name}]:\"\n end\n\n # Make a fake absolute path\n path = Pathname.new(fileName).relative_path_from(Pathname.new(app.source))\n path = File::SEPARATOR + File.join(File.dirname(path), base_name) + '.html'\n\n # Get the title, if any\n metadata = YAML.load_file(fileName)\n title = (metadata.is_a?(Hash) && metadata.key?('title')) ? metadata['title'] : ''\n\n files_array << { :shortcut => shortcut, :path => path, :title => title }\n\n longest_shortcut = shortcut.length if shortcut.length > longest_shortcut\n longest_path = path.length if path.length > longest_path\n\n end\n\n files_array = files_array.sort_by { |key| [File.split(key[:path])[0], key[:path]] }\n files_array.uniq.each do |item|\n item[:shortcut] = \"%-#{longest_shortcut}.#{longest_shortcut}s\" % item[:shortcut]\n\n if item[:title].length == 0\n out_array << \"#{item[:shortcut]} #{item[:path]}\"\n else\n item[:path] = \"%-#{longest_path}.#{longest_path}s\" % item[:path]\n out_array << \"#{item[:shortcut]} #{item[:path]} \\\"#{item[:title]}\\\"\"\n end\n end\n\n File.open(options.File_Markdown_Links, 'w') { |f| out_array.each { |line| f.puts(line) } }\n\n end",
"def git command, *args\n run 'git', command.to_s, *args\nend",
"def render\n STDERR.puts(\"render to #{self.output}\")\n if self.output and File.directory? self.output\n Dir.chdir(self.base)\n command = [\"jekyll\", \".\", self.output].join(\" \")\n STDERR.puts(\"running [[ #{command} ]]\")\n IO.popen(command) { |io|\n while (line = io.gets) do\n STDERR.puts line\n end\n } \n \n end\n STDERR.puts(\"render complete\")\n end",
"def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: webby [options] target [target args]'\n\n opts.separator ''\n\n desired_opts = %[--describe --prereqs --tasks --trace]\n app.standard_rake_options.each do |options|\n next unless desired_opts.include?(options.first)\n opts.on(*options)\n end\n opts.on('-o', '--options [PATTERN]',\n 'Show configuration options (matching optional pattern), then exit.') { |value|\n @command = [:show_options, value]\n }\n\n opts.separator ''\n opts.separator 'autobuild options:'\n\n opts.on('--web-server', 'Start a local web server') {\n cmd_line_options[:use_web_server] = true\n }\n opts.on('--no-web-server', 'Do not start a local web server') {\n cmd_line_options[:use_web_server] = false\n }\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) do\n @stdout.puts opts\n exit\n end\n opts.on_tail( '--version', 'show version' ) do\n @stdout.puts \"Webby #{::Webby::VERSION}\"\n exit\n end\n\n opts.parse! args\n\n ARGV.replace Array(args.shift)\n args.delete_if do |arg|\n if %r/^[A-Z_]+=/ =~ arg\n ARGV << arg\n next true\n end\n false\n end\n\n args\n end",
"def add_build_options(c)\n c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'\n c.option 'future', '--future', 'Publishes posts with a future date'\n c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'\n c.option 'watch', '-w', '--watch', 'Watch for changes and rebuild'\n c.option 'force_polling', '--force_polling', 'Force watch to use polling'\n c.option 'lsi', '--lsi', 'Use LSI for improved related posts'\n c.option 'show_drafts', '-D', '--drafts', 'Render posts in the _drafts folder'\n c.option 'unpublished', '--unpublished', 'Render posts that were marked as unpublished'\n c.option 'quiet', '-q', '--quiet', 'Silence output.'\n c.option 'verbose', '-V', '--verbose', 'Print verbose output.'\n end",
"def program_options\n [\n ['--format', '-f FORMAT', 'Format as html or text(default)',\n lambda { |value| options.format = value }\n ],\n ['--coffee', '-c', 'Show code as coffeescript',\n lambda { |value| options.coffee = true }\n ]\n ]\nend",
"def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end",
"def parse_yardopts_options(*args); end",
"def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend",
"def help(args)\n if args.size > 1\n if (PROXY_UNMODIFIED_TO_COMPOSE.include?(args[1]) or PROXY_MODIFIED.include?(args[1]))\n args.unshift(\"docker-compose\")\n system(args.join(\" \"))\n elsif OTHER_COMMANDS.include?(args[1])\n puts(\"This is a gdev custom command and not part of docker-compose. See wiki for explanation.\")\n end\n else\n puts MAIN_HELP_BANNER\n end\n end",
"def cmd_poortego_run_help(*args)\n print_line \"Usage: run <transform>\"\n print_line\n end",
"def run_help(cmds = [\"help\"])\n folder = 'help'\n file = cmds[1] || \"index\"\n begin\n s = template_content(folder, file)\n rescue\n s = \"-bash: help: no help topics match '#{ file }'. Try 'help help'\"\n end\n s\n end",
"def help\n puts <<-help\nUsage:\n $ uglifyjs < file.js\n $ uglifyjs file1.js file2.js\nhelp\nend",
"def citation(args, options)\n bibtex =\n \"\"\"\n @misc{Kra2015,\n title = {A distributed HTTP-based and REST-like ping-pong system for test and benchmarking purposes.},\n author = {{Nane Kratzke}},\n organization = {L\\\\\\\"ubeck University of Applied Sciences},\n address = {L\\\\\\\"ubeck, Germany},\n year = {2015},\n howpublished = {\\\\url{https://github.com/nkratzke/pingpong}}\n }\n \"\"\"\n\n return bibtex if options.bibtex\n\n \"\"\"\n To cite ppbench in publications use:\n\n Kratzke, Nane (2015). A distributed HTTP-based and REST-like ping-pong system for test and benchmarking purposes.\n Lübeck University of Applied Sciences, Lübeck, Germany. URL https://github.com/nkratzke/pingpong.\n\n A BibTeX entry for LaTeX users is: #{bibtex}\n\n \"\"\"\nend",
"def parse(argv)\n opts = OptionParser.new do |opt|\n opt.program_name = File.basename $0\n opt.version = RDoc::VERSION\n opt.release = nil\n opt.summary_indent = ' ' * 4\n opt.banner = <<-EOF\nUsage: #{opt.program_name} [options] [names...]\n\n Files are parsed, and the information they contain collected, before any\n output is produced. This allows cross references between all files to be\n resolved. If a name is a directory, it is traversed. If no names are\n specified, all Ruby files in the current directory (and subdirectories) are\n processed.\n\n How RDoc generates output depends on the output formatter being used, and on\n the options you give.\n\n - Darkfish creates frameless HTML output by Michael Granger.\n\n - ri creates ri data files\n EOF\n\n opt.separator nil\n opt.separator \"Parsing Options:\"\n opt.separator nil\n\n opt.on(\"--all\", \"-a\",\n \"Include all methods (not just public) in\",\n \"the output.\") do |value|\n @show_all = value\n end\n\n opt.separator nil\n\n opt.on(\"--exclude=PATTERN\", \"-x\", Regexp,\n \"Do not process files or directories\",\n \"matching PATTERN.\") do |value|\n @exclude << value\n end\n\n opt.separator nil\n\n opt.on(\"--extension=NEW=OLD\", \"-E\",\n \"Treat files ending with .new as if they\",\n \"ended with .old. Using '-E cgi=rb' will\",\n \"cause xxx.cgi to be parsed as a Ruby file.\") do |value|\n new, old = value.split(/=/, 2)\n\n unless new and old then\n raise OptionParser::InvalidArgument, \"Invalid parameter to '-E'\"\n end\n\n unless RDoc::ParserFactory.alias_extension old, new then\n raise OptionParser::InvalidArgument, \"Unknown extension .#{old} to -E\"\n end\n end\n\n opt.separator nil\n\n opt.on(\"--force-update\", \"-U\",\n \"Forces rdoc to scan all sources even if\",\n \"newer than the flag file.\") do |value|\n @force_update = value\n end\n\n opt.separator nil\n\n opt.on(\"--pipe\",\n \"Convert RDoc on stdin to HTML\") do\n @pipe = true\n end\n\n opt.separator nil\n\n opt.on(\"--threads=THREADS\", Integer,\n \"Number of threads to parse with.\") do |threads|\n @threads = threads\n end\n\n opt.separator nil\n opt.separator \"Generator Options:\"\n opt.separator nil\n\n opt.on(\"--charset=CHARSET\", \"-c\",\n \"Specifies the output HTML character-set.\") do |value|\n @charset = value\n end\n\n opt.separator nil\n\n generator_text = @generators.keys.map { |name| \" #{name}\" }.sort\n\n opt.on(\"--fmt=FORMAT\", \"--format=FORMAT\", \"-f\", @generators.keys,\n \"Set the output formatter. One of:\", *generator_text) do |value|\n @generator_name = value.downcase\n setup_generator\n end\n\n opt.separator nil\n\n opt.on(\"--include=DIRECTORIES\", \"-i\", Array,\n \"Set (or add to) the list of directories to\",\n \"be searched when satisfying :include:\",\n \"requests. Can be used more than once.\") do |value|\n @rdoc_include.concat value.map { |dir| dir.strip }\n end\n\n opt.separator nil\n\n opt.on(\"--line-numbers\", \"-N\",\n \"Include line numbers in the source code.\") do |value|\n @include_line_numbers = value\n end\n\n opt.separator nil\n\n opt.on(\"--main=NAME\", \"-m\",\n \"NAME will be the initial page displayed.\") do |value|\n @main_page = value\n end\n\n opt.separator nil\n\n opt.on(\"--output=DIR\", \"--op\", \"-o\",\n \"Set the output directory.\") do |value|\n @op_dir = value\n end\n\n opt.separator nil\n\n opt.on(\"--show-hash\", \"-H\",\n \"A name of the form #name in a comment is a\",\n \"possible hyperlink to an instance method\",\n \"name. When displayed, the '#' is removed\",\n \"unless this option is specified.\") do |value|\n @show_hash = value\n end\n\n opt.separator nil\n\n opt.on(\"--open-source\", \"-s\",\n \"Include source code to your documentation\") do |value|\n @open_source = value\n end\n\n opt.separator nil\n\n opt.on(\"--tab-width=WIDTH\", \"-w\", OptionParser::DecimalInteger,\n \"Set the width of tab characters.\") do |value|\n @tab_width = value\n end\n\n opt.separator nil\n\n opt.on(\"--template=NAME\", \"-T\",\n \"Set the template used when generating\",\n \"output.\") do |value|\n @template = value\n end\n\n opt.separator nil\n\n opt.on(\"--title=TITLE\", \"-t\",\n \"Set TITLE as the title for HTML output.\") do |value|\n @title = value\n end\n\n opt.separator nil\n\n opt.on(\"--webcvs=URL\", \"-W\",\n \"Specify a URL for linking to a web frontend\",\n \"to CVS. If the URL contains a '\\%s', the\",\n \"name of the current file will be\",\n \"substituted; if the URL doesn't contain a\",\n \"'\\%s', the filename will be appended to it.\") do |value|\n @webcvs = value\n end\n\n opt.separator nil\n opt.separator \"Diagram Options:\"\n opt.separator nil\n\n image_formats = %w[gif png jpg jpeg]\n opt.on(\"--image-format=FORMAT\", \"-I\", image_formats,\n \"Sets output image format for diagrams. Can\",\n \"be #{image_formats.join ', '}. If this option\",\n \"is omitted, png is used. Requires\",\n \"diagrams.\") do |value|\n @image_format = value\n end\n\n opt.separator nil\n\n opt.on(\"--diagram\", \"-d\",\n \"Generate diagrams showing modules and\",\n \"classes. You need dot V1.8.6 or later to\",\n \"use the --diagram option correctly. Dot is\",\n \"available from http://graphviz.org\") do |value|\n check_diagram\n @diagram = true\n end\n\n opt.separator nil\n\n opt.on(\"--fileboxes\", \"-F\",\n \"Classes are put in boxes which represents\",\n \"files, where these classes reside. Classes\",\n \"shared between more than one file are\",\n \"shown with list of files that are sharing\",\n \"them. Silently discarded if --diagram is\",\n \"not given.\") do |value|\n @fileboxes = value\n end\n\n opt.separator nil\n opt.separator \"ri Generator Options:\"\n opt.separator nil\n\n opt.on(\"--ri\", \"-r\",\n \"Generate output for use by `ri`. The files\",\n \"are stored in the '.rdoc' directory under\",\n \"your home directory unless overridden by a\",\n \"subsequent --op parameter, so no special\",\n \"privileges are needed.\") do |value|\n @generator_name = \"ri\"\n @op_dir = RDoc::RI::Paths::HOMEDIR\n setup_generator\n end\n\n opt.separator nil\n\n opt.on(\"--ri-site\", \"-R\",\n \"Generate output for use by `ri`. The files\",\n \"are stored in a site-wide directory,\",\n \"making them accessible to others, so\",\n \"special privileges are needed.\") do |value|\n @generator_name = \"ri\"\n @op_dir = RDoc::RI::Paths::SITEDIR\n setup_generator\n end\n\n opt.separator nil\n\n opt.on(\"--merge\", \"-M\",\n \"When creating ri output, merge previously\",\n \"processed classes into previously\",\n \"documented classes of the same name.\") do |value|\n @merge = value\n end\n\n opt.separator nil\n opt.separator \"Generic Options:\"\n opt.separator nil\n\n opt.on(\"--debug\", \"-D\",\n \"Displays lots on internal stuff.\") do |value|\n $DEBUG_RDOC = value\n end\n\n opt.on(\"--quiet\", \"-q\",\n \"Don't show progress as we parse.\") do |value|\n @verbosity = 0\n end\n\n opt.on(\"--verbose\", \"-v\",\n \"Display extra progress as we parse.\") do |value|\n @verbosity = 2\n end\n\n opt.separator nil\n opt.separator 'Deprecated options - these warn when set'\n opt.separator nil\n\n opt.on(\"--inline-source\", \"-S\") do |value|\n warn \"--inline-source will be removed from RDoc on or after August 2009\"\n end\n\n opt.on(\"--promiscuous\", \"-p\") do |value|\n warn \"--promiscuous will be removed from RDoc on or after August 2009\"\n end\n\n opt.separator nil\n end\n\n argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']\n\n opts.parse! argv\n\n @files = argv.dup\n\n @rdoc_include << \".\" if @rdoc_include.empty?\n\n if @exclude.empty? then\n @exclude = nil\n else\n @exclude = Regexp.new(@exclude.join(\"|\"))\n end\n\n check_files\n\n # If no template was specified, use the default template for the output\n # formatter\n\n @template ||= @generator_name\n\n rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e\n puts opts\n puts\n puts e\n exit 1\n end",
"def help(arguments=nil)\n #this currently looks horrible in code, but nice in output.\n #would be good to make it both\n\n text = %{\n #{r \"BOOM snippets\"} ___________________________________________________\n\n boom display high-level overview\n boom #{y \"all\"} show all items in all lists\n boom #{y \"edit\"} edit the boom JSON file in $EDITOR\n boom #{y \"help\"} this help text\n boom #{y \"storage\"} shows which storage backend you're using\n boom #{y \"switch\"} #{c \"<storage>\"} switches to a different storage backend\n\n boom #{c \"<list>\"} create a new list\n boom #{c \"<list>\"} show items for a list\n boom #{c \"<list>\"} #{y \"delete\"} deletes a list\n\n boom #{c \"<list> <name> <value>\"} create a new list item\n boom #{c \"<name>\"} copy item's value to clipboard\n boom #{c \"<list> <name>\"} copy item's value to clipboard\n boom #{y \"open\"} #{c \"<name>\"} open item's url in browser\n boom #{y \"open\"} #{c \"<list> <name>\"} open all item's url in browser for a list\n boom #{y \"random\"} open a random item's url in browser\n boom #{y \"random\"} #{c \"<list>\"} open a random item's url for a list in browser\n boom #{y \"echo\"} #{c \"<name>\"} echo the item's value without copying\n boom #{y \"echo\"} #{c \"<list> <name>\"} echo the item's value without copying\n boom #{c \"<list> <name>\"} #{y \"delete\"} deletes an item\n\n #{red \"KABOOM sharing\"} ___________________________________________________\n\n boom remote #{y \"<any command above>\"} using the #{y \"~/.boom.remote.conf\"} it\n kaboom #{y \"<any command above>\"} connects to an alternative backend\n meaning you can pipe to a remote\n backend storage\n\n e.g. to pipe config from a local boom to a remote boom do:\n\n kaboom #{c(\"config ackrc\")} < boom #{c \"config ackrc\"}\n\n ___________________________________________________________________\n all other documentation is located at:\n https://github.com/markburns/kaboom\n }.gsub(/^ {8}/, '') # strip the first eight spaces of every line\n\n output text\n end",
"def generate_yaml_index(options=\"\")\n shell = Session::Shell.new\n command = \"#{Gem.ruby} #{@ruby_options} #{@gyi_path} #{options}\"\n puts \"\\n\\nCOMMAND: [#{command}]\" if @verbose\n @out, @err = shell.execute command\n @status = shell.exit_status\n puts \"STATUS: [#{@status}]\" if @verbose\n puts \"OUTPUT: [#{@out}]\" if @verbose\n puts \"ERROR: [#{@err}]\" if @verbose\n puts \"PWD: [#{Dir.pwd}]\" if @verbose\n shell.close\n end",
"def run_app(command, arguments)\nend",
"def command_for(args)\n [vite_env].tap do |cmd|\n cmd.append('node', '--inspect-brk') if args.include?('--debug')\n cmd.append('node', '--trace-deprecation') if args.delete('--trace-deprecation')\n cmd.append(*vite_executable(cmd))\n cmd.append(*args)\n cmd.append('--mode', ViteRuby.mode) unless args.include?('--mode') || args.include?('-m')\n end\n end",
"def run_llmk *args, interactive: false\n if args.size > 0\n arg_str = \" \" + args.join(\" \") \n else\n arg_str = \"\"\n end\n\n run_command \"texlua #{BASE_DIR}/llmk.lua #{arg_str}\"\n\n stop_all_commands if !interactive\n end",
"def program_options\n [\n # The values of the array are,\n # [long_option, short_option and parameter, description, code to execute]\n ['--google', '-g', \"Format for Google blogger.\",\n lambda { |value| options.google = true }\n ],\n ['--jayway', '-j', \"Format for Jayway blog.\",\n lambda { |value| options.jayway = true }\n ],\n ['--utf', '-u', \"Include meta charset utf8\",\n lambda { |value| options.utf = true }\n ],\n ['--stylesheet', '-s', \"Add a stylesheet, md.css\",\n lambda { |value| options.stylesheet = true }\n ],\n ['--verbose', '-v', \"Log to standard output.\",\n lambda { |value| options.verbose = true }\n ],\n ['--version', '-V', \"Display the program version.\",\n lambda { |value|\n puts \"#{program_name}, version #{PROGRAM_VERSION}\"\n exit\n }\n ]\n ]\nend",
"def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) converts back and forth between GNU gettext\nPO files preferred by localizers and Tidy's language header H files which\nensure that Tidy stays small and cross-platform.\n\nAll output files are placed into the current working directory using a file name\nappropriate to the operation being performed.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end",
"def call(*args)\n puts parser.help\n exit 1\n end",
"def traject_command_line(args = {})\n # Horizon and Solr connection details are looked\n # up by the actual traject config files that we invoke, based on RAILS_ENV.\n # We dont' need to look them up here or include them in command line. \n\n str = \"\"\n if `ruby -v` =~ /jruby/\n puts \"current ruby is jruby, executing with current ruby...\"\n elsif system(\"chruby-exec jruby -- echo\")\n str << \"chruby-exec jruby -- \"\n else\n warn \"No jruby detected, and `chruby-exec jruby` not available either. We need jruby to run traject. Try installing chruby with jruby?\"\n exit 1\n end\n \n str << \" BUNDLE_GEMFILE='./Gemfile' bundle exec \"\n \n str << \"traject -c conf/horizon_source.rb -c conf/horizon_index.rb \"\n\n if args[:mode].to_s == \"solr\"\n str << \" -c conf/solr_connect.rb \"\n else # args[:mode] == marcout\n str << \" -x marcout\"\n\n output_file = args[:output_file] || auto_marcout_filename\n str << \" -o \\\"#{output_file}\\\" \"\n end\n\n # Only it's a normal kind of indexing, do the\n # shelfbrowse side channel index too\n unless ENV['ONLY'] || ENV['FIRST'] || ENV['LAST'] || (args[:mode] != :solr)\n str = \"SHELFBROWSE_TMP_TABLE_SWAP=1 #{str}\"\n str << \" -c conf/shelf_browse_index.rb\"\n end\n\n\n str << \" -s horizon.only_bib=#{ENV['ONLY']} \" if ENV['ONLY']\n str << \" -s horizon.first_bib=#{ENV['FIRST']} \" if ENV['FIRST']\n str << \" -s horizon.last_bib=#{ENV['LAST']} \" if ENV['LAST']\n \n \n return str\nend",
"def main project_symbol, *trollop_args, &trollop_config\n program_file = first_caller_file\n program_name = File.basename(program_file)\n program_home = File.dirname(File.dirname(program_file))\n\n # load the project module\n require File.join(program_home, 'lib', program_name)\n project_module = fetch_project_module(project_symbol)\n\n # parse command-line options\n require 'trollop'\n\n options = Trollop.options(*trollop_args) do\n\n # show project description\n text \"#{project_module::PROJECT} - #{project_module::TAGLINE}\"\n text ''\n\n # show program description\n text File.read(program_file)[/\\A.*?^$\\n/m]. # grab the header\n gsub(/^# ?/, ''). # strip the comment markers\n sub(/\\A!.*?\\n/, '').lstrip # omit the shebang line\n text ''\n\n instance_eval(&trollop_config) if trollop_config\n\n # show version information\n version %w[PROJECT VERSION RELEASE WEBSITE INSTALL].map {|c|\n \"#{c.downcase}: #{project_module.const_get c}\"\n }.join(\"\\n\")\n\n opt :manual, 'Show the user manual'\n end\n\n if options[:manual]\n require 'launchy'\n Launchy::Browser.run \"#{project_module::INSTALL}/doc/index.xhtml\"\n exit\n end\n\n options\n end",
"def usage\n <<~EOS\n\n Keep and search engineering notes by project. Notes are\n stored in text files with the name \"_notes.txt\" Project\n names associated to each note file are maintained in the\n home directory in the file \"_notes_project_db.json\"\n\n Usage:\n\n alias _=#{__FILE__}\n\n _ [-h|--help] Prints this usage text\n\n _ Open the _notes.txt file that is closes to pwd\n The search is up the directory tree\n _ <any text> Adds <any text> and the clipboard to the closest project\n\n _ + Sets the current directory as a project in the ~/_notes_project_db.json file\n _ +project Opens the _notes.txt file for the \"project\"\n _ +project <any text> Add the text to the _notes.txt file for \"project\"\n\n _ [-s|--search] Will search all '_notes.txt' files using the 'agrep' command\n\n NOTE:\n\n Every time a new note is added, the _notes.txt file is copied to\n a backup file in the $HOME/_notes_backup directory. The name of\n the backup file indicates the directory from whihc it came.\n\n EOS\nend",
"def liquidize_markdown(content, arguments)\n # doc = BlueCloth.new(Liquid::Template.parse(content).render(arguments, :filters => [LiquidFilters], \n # :registers => {:controller => controller, :view => self, :account_site_assets => account_site_assets, :current_user => current_user}))\n doc = ::Kramdown::Document.new(Liquid::Template.parse(content).render(arguments, :filters => [LiquidFilters], \n :registers => {:controller => controller, :view => self, :account_site_assets => account_site_assets, :current_user => current_user}),\n :parse_block_html => true)\n return doc.to_html.html_safe\n end",
"def commander _args\n \"commander _args;\" \n end",
"def main(argv)\n options = parse_args(argv)\n\n mediawikiClient = Mediawiki.getClient(options.mediawiki)\n Mediawiki.login(mediawikiClient, options.login, options.password)\n\n # Template creation\n puts \"Reading templates from Templates directory...\"\n templateList = Dir[\"Templates/**\"]\n templateList.each do |template|\n content = \"\"\n templateFile = File.open(template, \"r\")\n templateFile.each_line do |line|\n content << line\n end\n templateFile.close\n template.sub! \"Templates/\", \"\"\n template.sub! \".txt\", \"\"\n Mediawiki.editPage(mediawikiClient, template, content)\n end\n\n # Page creation\n puts \"Reading pages from Pages directory...\"\n pageList = Dir[\"Pages/**\"]\n pageList.each do |page|\n content = \"\"\n pageFile = File.open(page, \"r\")\n pageFile.each_line do |line|\n content << line\n end\n pageFile.close\n page.sub! \"Pages/\", \"\"\n page.sub! \".txt\", \"\"\n Mediawiki.editPage(mediawikiClient, page, content)\n end\n\nend",
"def help # defines the helptext to be printed when option \"-h\" is used\nputs <<HELPTEXT\n\nNAME\n txt2pdf\n\nSYNOPSIS\n txt2pdf [-h] (filename)\n\nDESCRIPTION\n Reads a text file (if supplied as the first argument) and creates\n a pdf file with the same name but with .pdf as extension in the\n current directory via the program pdflatex (the only requirement\n besides ruby itself). If \"-h\" is the first argument, then the program\n displays the helptext and exits.\n\n The program can also read the input text from STDIN (STanDard IN) and\n create the pdf file in the user's home directory. When this method is\n used, no argument is given to the program and the text is simply piped\n directly into the program like this:\n\n $ echo \"Hello\" | txt2pdf\n\n This would create a pdf file with only \"Hello\" and the page number\n at the bottom of the resulting pdf page.\n\n With this, you could map a key binding in your window manager to\n create a pdf file from the text you selected in any program, be it the\n terminal, your browser or your text editor. In my wm of choice, i3,\n I have added the following to my i3 config:\n\n bindsym $mod+p exec xclip -o | txt2pdf\n \n This would create a pdf file from the text I have selected as I hit\n the \"Window button\" and \"p\".\n\nOPTIONS\n -h Show this help text\n\nCOPYRIGHT:\n By Geir Isene (https://isene.org) 2019. No rights reserved.\n\nHELPTEXT\nend",
"def convert(*args)\n @options += args if args\n outputfile = @options.map{ |x| x[:output] }.compact\n tmp_file = Tempfile.new('pandoc-conversion')\n @options += [{ output: tmp_file.path }] if outputfile.empty?\n @option_string = prepare_options(@options)\n begin\n run_pandoc\n IO.binread(tmp_file)\n ensure\n tmp_file.close\n tmp_file.unlink\n end\n end",
"def help\n print <<END\n Usage:\n convert.rb [options] <html-directory>\n\n -c, --per-chapter\n file-per-chapter mode -- generates one HTML file chapxxx.htm for each\n chapter sections are level 2 headings and anchors chapxxx.htm#SECTxxx.\n This is intended for local browsing, especially under MS-DOS\n \n -s, --silent silent running. Conversational messages are suppressed.\n\n <html-directory> defaults to the current directory\nEND\nend",
"def build_files_command\n \"middleman build\"\n end",
"def ruby(*args)\n run \"#{RUBY} #{args.join(' ')}\"\n end",
"def ruby(*args)\n run \"#{RUBY} #{args.join(' ')}\"\n end",
"def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Github pages..'\n puts %x[git push origin HEAD:gh-pages --force]\nend",
"def git(command={})\n if command.is_a?(Symbol)\n run \"git #{command}\"\n else\n command.each do |command, options|\n run \"git #{command} #{options}\"\n end\n end\n end",
"def cmd_help argv\n help\n end",
"def cmd_help argv\n help\n end",
"def my_aide(_args)\n system(\"less #{__dir__}/../docs/aide\")\n end",
"def git(*args)\n system \"git \" + args.join(\" \")\nend",
"def jekyll_thread preview\n terminal_add preview, terminal_info(I18n.t('preview.message.start'))\n Rails.application.executor.wrap do\n Thread.new do\n Rails.application.reloader.wrap do\n Rails.application.executor.wrap do\n start_jekyll preview\n end\n end\n end\n end\n end",
"def to_args\n args = [\n \"--name \\\"#{name}\\\"\",\n \"--version \\\"#{version}\\\"\",\n \"--user \\\"#{user}\\\"\",\n \"--group \\\"#{group}\\\"\",\n \"--iteration \\\"#{iteration}\\\"\",\n \"--homepage \\\"#{homepage}\\\"\",\n \"--home \\\"#{home}\\\"\",\n \"--architecture \\\"#{architecture}\\\"\",\n \"--description \\\"#{description}\\\"\",\n \"--maintainer \\\"#{maintainer}\\\"\",\n \"--vendor \\\"#{vendor}\\\"\"\n ]\n args.push \"--dependencies #{dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless dependencies.nil? || dependencies.empty?\n args.push \"--build-dependencies #{build_dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless build_dependencies.nil? || build_dependencies.empty?\n args.push \"--compile-cache-dir \\\"#{compile_cache_dir}\\\"\" unless compile_cache_dir.nil? || compile_cache_dir.empty?\n args.push \"--before-precompile \\\"#{before_precompile}\\\"\" unless before_precompile.nil? || before_precompile.empty?\n args.push \"--after-precompile \\\"#{after_precompile}\\\"\" unless after_precompile.nil? || after_precompile.empty?\n args.push \"--before-install \\\"#{before_install}\\\"\" unless before_install.nil? || before_install.empty?\n args.push \"--after-install \\\"#{after_install}\\\"\" unless after_install.nil? || after_install.empty?\n args.push \"--before-remove \\\"#{before_remove}\\\"\" unless before_remove.nil? || before_remove.empty?\n args.push \"--after-remove \\\"#{after_remove}\\\"\" unless after_remove.nil? || after_remove.empty?\n\n args.push \"--license \\\"#{license}\\\"\" unless license.nil? || license.empty?\n args.push \"--buildpack \\\"#{buildpack}\\\"\" unless buildpack.nil? || buildpack.empty?\n args.push \"--buildpack_list \\\"#{buildpack_list}\\\"\" unless buildpack_list.nil? || buildpack_list.empty?\n args.push \"--force-os \\\"#{force_os}\\\"\" unless force_os.nil? || force_os.empty?\n args.push \"--runner \\\"#{runner}\\\"\" unless runner.nil? || runner.empty?\n args.push \"--logrotate-frequency \\\"#{logrotate_frequency}\\\"\" unless logrotate_frequency.nil? || logrotate_frequency.empty?\n args.push \"--logrotate-backlog \\\"#{logrotate_backlog}\\\"\" unless logrotate_backlog.nil?\n args.push \"--env #{env.variables.map{|v| \"\\\"#{v}\\\"\"}.join(\" \")}\" if env.present?\n args.push \"--auto\" if auto\n args.push \"--verbose\" if verbose\n args.push \"--store-cache\" if store_cache\n args.push \"--debug\" if debug\n args.push \"--verify\" if verify\n args.push \"--no-clean\" if !clean\n args.push \"--no-edge\" if !edge\n args.push \"--tmpdir\" if !tmpdir\n args\n end",
"def usage()\n puts \"you can use it wih the following options\"\n puts \"-w <a word> search sentences containing this word\"\n puts \"-i <id> search sentences with this id\"\n puts \"-l <lang> search sentences from this lang (lang is its iso 639 alpha 3 code\"\nend",
"def my_aide(_args)\n system(\"less #{__dir__}/../docs/aide_admin\")\n end",
"def parse\n # The options specified on the command line will be collected in *options*.\n # We set default values here.\n options.task = :build\n options.work_dir = find_work_dir\n options.check_mandatory_arguments = true\n options.load_local_libs = true\n options.contents_dir = Texas.contents_subdir_name\n options.contents_template = find_contents_file(\"contents\")\n options.backtrace = false\n options.colors = true\n options.merge_config = nil\n options.verbose = false\n options.warnings = true\n options.open_pdf = true\n\n lookup_and_execute_require_option(args)\n \n opts = ::OptionParser.new do |opts|\n opts.banner = \"Usage: texas [options]\"\n\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n opts.on(\"-d\", \"--dry-run\", \"Run without pdf generation\") do |contents_template|\n options.task = :dry\n end\n\n opts.on(\"-m\", \"--merge-config [CONFIG]\",\n \"Merge config with key from .texasrc\") do |key|\n options.merge_config = key\n end\n\n opts.on(\"-n\", \"--new [NAME]\",\n \"Create new texas project directory\") do |name|\n options.task = :new_project\n options.check_mandatory_arguments = false\n options.load_local_libs = false\n options.new_project_name = name\n end\n\n opts.on(\"-r\", \"--require [LIBRARY]\", \"Require library before running texas\") do |lib|\n # this block does nothing\n # require was already performed by lookup_and_execute_require_option\n # this option is here to ensure the -r switch is listed in the help option\n end\n\n opts.on(\"--watch\", \"Watch the given template\") do |contents_template|\n options.task = :watch\n options.open_pdf = false\n end\n\n parse_additional_options(opts)\n\n opts.separator \"\"\n opts.separator \"Common options:\"\n\n opts.on(\"--[no-]backtrace\", \"Switch backtrace\") do |v|\n options.backtrace = v\n end\n\n opts.on(\"-c\", \"--[no-]color\", \"Switch colors\") do |v|\n options.colors = v\n end\n\n opts.on(\"-v\", \"--[no-]verbose\", \"Run verbosely\") do |v|\n options.verbose = v\n end\n\n opts.on(\"-w\", \"--[no-]warnings\", \"Switch warnings\") do |v|\n options.warnings = v\n end\n\n # No argument, shows at tail. This will print an options summary.\n # Try it and see!\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n # Another typical switch to print the version.\n opts.on_tail(\"--version\", \"Show version\") do\n puts Texas::VERSION::STRING\n exit\n end\n end\n\n opts.parse!(args)\n\n unless args.empty?\n f = args.shift\n options.contents_template = find_contents_file(f)\n options.contents_dir = find_contents_dir(f)\n end\n if options.check_mandatory_arguments\n check_mandatory! options\n end\n options\n end",
"def option_list\n result = @options.dup\n result << \"-o\" << @rdoc_dir\n result << \"--main\" << main if main\n result << \"--markup\" << markup if markup\n result << \"--title\" << title if title\n result << \"-T\" << template if template\n result << '-f' << generator if generator\n result\n end",
"def run( args )\n parse args\n create_site\n end",
"def optional_pull\n if ARGV.include?(\"--pull\")\n puts %x(feature pull)\n end\nend",
"def setup_help(opts)\n opts.separator ''\n opts.separator <<-USAGE\nUsage:\n travis repositories|repos|rep|r {options}\n travis status|stat|s {options}\n USAGE\n opts.separator ''\n opts.separator <<-FURTHER_HELP\nFurhter Help:\n travis {command} --help\n FURTHER_HELP\n\n yield(opts)\n end",
"def parse( args )\n self.data = File.join(::Webby::PATH, 'data')\n self.update = false\n\n opts = OptionParser.new\n opts.banner << ' site'\n\n opts.separator ''\n opts.on('-u', '--update',\n 'update the rake tasks for the site') {self.update = true}\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) {puts opts; exit}\n opts.on_tail( '--version', 'show version' ) do\n puts \"Webby #{::Webby::VERSION}\"\n exit\n end\n\n # parse the command line arguments\n opts.parse! args\n self.site = args.shift\n\n if site.nil?\n puts opts\n ::Kernel.abort\n end\n nil\n end",
"def generate_yardoc(includes, yardoc_db)\n system(\"yardoc --db #{yardoc_db} --no-output --no-api --no-private #{includes.join(' ')}\")\nend",
"def build_shell_step(b, command)\n b.tag! \"hudson.tasks.Shell\" do\n b.command command.to_xs.gsub(\"&\", '&').gsub(\">\", '>') #.gsub(%r{\"}, '"').gsub(%r{'}, ''')\n end\n end",
"def long_opt_symbol(args); end",
"def files\n cli_arguments.each_with_index do |filename, index|\n if Dir.exist?(filename)\n cli_arguments[index] = Dir[\"#{filename}/**/*.md\"]\n end\n end\n cli_arguments.flatten!\n cli_arguments\n end",
"def parse_options\n options[:markdown] = false\n o = OptionParser.new do |opts|\n opts.on('-m', '--markdown', 'Use Markdown Syntax') do\n options[:markdown] = true\n end\n opts.on('-l', '--html', 'Use HTML Syntax') do\n options[:html] = true\n end\n opts.on('-s', '--size PERCENTAGE', 'Image Size') do |value|\n options[:size] = value\n end\n opts.on('-t', '--title TITLE', 'Image Title') do |value|\n options[:title] = value\n end\n opts.on('-d', '--desc DESC', 'Image Title') do |value|\n options[:desc] = value\n end\n opts.on('-v', '--version', 'Print Version') do\n version\n quit\n end\n opts.on('-h', '--help', 'Print Help') do\n help\n quit\n end\n end\n begin\n o.parse!\n rescue OptionParser::MissingArgument => e\n puts \"Error: #{e.message}\"\n quit\n rescue OptionParser::InvalidOption => e\n puts \"Error: #{e.message}\"\n quit\n end\n end",
"def run(args)\n ret = DEFAULTS.merge({})\n\n # create option parser\n o = ::OptionParser.new do |o|\n o.banner = \"Usage: #@app [options]\"\n o.separator \" \"\n\n # add command-line options\n o.separator \"Options:\"\n\n o.on('-A', '--allow USER', 'Allow Jabber subscription from USER.') do |v|\n add_allowed(ret, v)\n end\n\n o.on('-c', '--config FILE', 'Use configuration file FILE.') do |v|\n Joggle::ConfigParser.run(v) do |key, val|\n if key == 'engine.allow'\n add_allowed(ret, val)\n elsif key == 'engine.update.range'\n add_update_range(ret, val)\n else\n ret[key] = val\n end\n end\n end\n\n o.on('-D', '--daemon', 'Run as daemon (in background).') do |v|\n ret['cli.daemon'] = true\n end\n\n o.on('--foreground', 'Run in foreground (the default).') do |v|\n ret['cli.daemon'] = false\n end\n\n o.on('-L', '--log-level LEVEL', 'Set log level to LEVEL.') do |v|\n ret['runner.log.level'] = v\n end\n\n o.on('-l', '--log FILE', 'Log to FILE.') do |v|\n ret['runner.log.path'] = v\n end\n\n o.on('-p', '--password PASS', 'Jabber password (INSECURE!).') do |v|\n ret['jabber.pass'] = v\n end\n\n o.on('-s', '--store FILE', 'Use FILE as backing store.') do |v|\n ret['runner.store.path'] = v\n end\n\n o.on('-u', '--username USER', 'Jabber username.') do |v|\n ret['jabber.user'] = v\n end\n\n o.separator ' '\n\n o.on_tail('-v', '--version', 'Print version string.') do\n puts \"Joggle %s, by %s\" % [\n Joggle::VERSION,\n 'Paul Duncan <pabs@pablotron.org>',\n ]\n exit\n end\n\n o.on_tail('-h', '--help', 'Print help information.') do\n puts o\n exit\n end\n end\n\n # parse arguments\n o.parse(args)\n\n # return results\n ret\n end",
"def execute\n src = read_dsl\n dsl = Markun::Dsl.new\n dsl.instance_eval src\n convert_markdown_to_html dsl.markun.have_menu\n end",
"def do_as_i_said\n if ARGV.length == 0\n puts $usage\n exit\n elsif ARGV[0] == \"-h\"\n\n arguments = ARGV.dup\n \n if arguments.length > 2\n arguments.slice!(2..(arguments.length - 1))\n end\n \n parse_command_line(arguments)\n \n else\n arguments = ARGV.dup\n command = split_arguments! arguments\n \n # Prevent space character from being considered as a separator.\n arguments.map! do |arg|\n if arg == \" \"\n '\" \"'\n else\n arg\n end\n end\n \n exec(\"#{$current_directory}/gimmicode-#{command} #{arguments.join(\" \")}\")\n end\nend",
"def parse_cli\n require 'getoptlong'\n require 'rdoc/usage'\n \n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ \"--quote-terms\", '-q', GetoptLong::NO_ARGUMENT ]\n )\n \nend",
"def main(args)\n cli_options = parse_args(args)\n if cli_options[:filepath] == nil\n puts \"must include a file path\"\n exit 1\n end\n\n parsed = nil\n\n begin\n parsed = parse_tm(File.read(cli_options[:filepath]))\n rescue Errno::ENOENT => e\n $stderr.puts \"File '#{cli_options[:filepath]}' not found: #{e}\"\n end\n\n options = { :output => 'tex', :expand_aliases => true, :duration => 500, :filepath => nil, :template => nil }\n .merge(parsed[:options].delete_if { |k, v| v.nil? })\n .merge(cli_options.delete_if { |k, v| v.nil? })\n\n puts \"options: \" + options.inspect\n\n parsed[:description] = transform(parsed[:description], options)\n\n if options[:template] != nil\n output = output_begin(parsed, options)\n run(parsed) do |state|\n output = output_stream(output, parsed, options, state)\n end\n output_end(output, parsed, options)\n else\n File.write(\n options.filepath + '.tex',\n generate_template(parsed[:description], options)\n )\n end\n\nend",
"def preview(argv)\n parser.banner = \"Usage: smeagol-preview [OPTIONS]\\n\"\n\n parser.on('--port [PORT]', 'Bind port (default 4567).') do |port|\n options[:port] = port.to_i\n end\n\n parser.on('--[no-]cache', 'Enables page caching.') do |flag|\n options[:cache] = flag\n end\n\n parser.on('--mount-path', 'Serve website from this base path.') do |path|\n options[:mount_path] = path\n end\n\n #parser.on('--auto-update', 'Updates the repository on a daily basis.') do |flag|\n # options[:auto_update] = flag\n #end\n\n #parser.on('--secret [KEY]', 'Specifies the secret key used to update.') do |str|\n # options[:secret] = str\n #end\n\n $stderr.puts \"Starting preview...\"\n\n Console.preview(*parse(argv))\n end",
"def templated_build(name, opts={})\r\n short = name.downcase\r\n source = File.join(\"wrappers\", short)\r\n dependencies = [\"mustache.js\"] + Dir.glob(\"#{source}/*.tpl.*\")\r\n target_js = opts[:location] ? \"mustache.js\" : \"#{short}.mustache.js\"\r\n\r\n CLEAN.include(opts[:location] ? opts[:location] : target_js)\r\n\r\n desc \"Package for #{name}\"\r\n task short.to_sym => dependencies do\r\n puts \"Packaging for #{name}\"\r\n\r\n mkdir_p opts[:location] if opts[:location]\r\n\r\n files = [\r\n \"#{source}/mustache.js.pre\",\r\n 'mustache.js',\r\n \"#{source}/mustache.js.post\"\r\n ]\r\n\r\n open(\"#{opts[:location] || '.'}/#{target_js}\", 'w') do |f|\r\n files.each {|file| f << File.read(file) }\r\n end\r\n\r\n puts \"Done, see #{opts[:location] || '.'}/#{target_js}\"\r\n end\r\nend",
"def process_command(*args, pre: nil, post: nil, wrap: nil, **opts)\n\t\t\tspawn_opts={}\n\t\t\tif args.last.kind_of?(Hash)\n\t\t\t\t#we may have no symbol keywords\n\t\t\t\t*args,spawn_opts=*args\n\t\t\tend\n\t\t\tsudo=opts.delete(:sudo)\n\t\t\tenv={}\n\t\t\tif args.first.kind_of?(Hash)\n\t\t\t\tenv,*args=*args\n\t\t\tend\n\t\t\tenv.merge!(opts.delete(:env)||{})\n\t\t\targs=args.map.with_index {|arg, i| i == 0 && arg.is_a?(Array) ? arg : arg.to_s} if args.length > 1\n\t\t\tspawn_opts.merge!(opts)\n\t\t\tif pre\n\t\t\t\tif args.length > 1\n\t\t\t\t\targs=args.unshift(*pre)\n\t\t\t\telse\n\t\t\t\t args=[\"#{pre.is_a?(Enumerable) ? pre.shelljoin : pre} #{args.first}\"]\n\t\t\t\tend\n\t\t\tend\n\t\t\tif post\n\t\t\t\tif args.length > 1\n\t\t\t\t\targs=args.push(*post)\n\t\t\t\telse\n\t\t\t\t args=[\"#{args.first} #{post.is_a?(Enumerable) ? post.shelljoin : post}\"]\n\t\t\t\tend\n\t\t\tend\n\t\t\tif wrap\n\t\t\t args=wrap.call(*args)\n\t\t\tend\n\t\t\tif sudo\n\t\t\t\tif args.length > 1\n\t\t\t\t\targs.unshift(*Run.sudo_args(sudo))\n\t\t\t\telse\n\t\t\t\t\targs=[\"#{Run.sudo_args(sudo).shelljoin} #{args.first}\"]\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn env, args, spawn_opts\n\t\tend"
] |
[
"0.80927277",
"0.7410157",
"0.6836247",
"0.6233287",
"0.6165086",
"0.6102838",
"0.60718995",
"0.5725411",
"0.566027",
"0.55965084",
"0.55664337",
"0.55242765",
"0.5434422",
"0.5385596",
"0.53424096",
"0.53060234",
"0.52977204",
"0.5263145",
"0.5238425",
"0.52285326",
"0.5206367",
"0.5192063",
"0.5172727",
"0.51681435",
"0.5160692",
"0.51395935",
"0.513388",
"0.50733876",
"0.50719124",
"0.50703585",
"0.5070022",
"0.5068177",
"0.50573343",
"0.5039299",
"0.5037375",
"0.5031149",
"0.5003893",
"0.49945357",
"0.497895",
"0.49767417",
"0.49753514",
"0.49638388",
"0.49608642",
"0.49546283",
"0.49524647",
"0.49388155",
"0.4919074",
"0.49053806",
"0.49016055",
"0.48987022",
"0.4882837",
"0.48768193",
"0.48765364",
"0.48734272",
"0.4859404",
"0.4840318",
"0.48402396",
"0.48400593",
"0.4838386",
"0.48377088",
"0.4831814",
"0.48262566",
"0.4820867",
"0.4820064",
"0.48193112",
"0.4814926",
"0.48136294",
"0.48133382",
"0.4812933",
"0.48114035",
"0.48114035",
"0.48038837",
"0.48016757",
"0.47990134",
"0.47990134",
"0.47904053",
"0.47901294",
"0.4785423",
"0.47813815",
"0.4774135",
"0.47676426",
"0.47670546",
"0.4757295",
"0.47569117",
"0.47555938",
"0.47500536",
"0.47433597",
"0.47428262",
"0.47424358",
"0.47296387",
"0.47206584",
"0.4715544",
"0.47150335",
"0.47143963",
"0.47137883",
"0.4707526",
"0.47044447",
"0.47019958",
"0.46997747",
"0.46996516"
] |
0.7589127
|
1
|
has to be called after refresh, or with hash_values passed in
|
def associate hash_values=nil
@rally_hash = hash_values if hash_values
if @rally_hash.has_key?("Project")
project = Project.find_or_create_by(:rally_uri => @rally_hash["Project"]["_ref"])
project.iterations << self
end
self.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _refresh_set_values(hash)\n @deserialized_values.clear if @deserialized_values\n super\n end",
"def _refresh_set_values(h)\n @values = h\n end",
"def _refresh_set_values(h)\n @values = h\n end",
"def _refresh_set_values(hash)\n reset_initial_values\n super\n end",
"def _save_refresh\n super\n recalculate_values_hashes\n end",
"def _refresh_set_values(hash)\n @associations.clear if @associations\n super\n end",
"def refresh\n @deserialized_values = {}\n super\n end",
"def _refresh(dataset)\n super\n recalculate_values_hashes\n end",
"def params=(hash); end",
"def params=(hash); end",
"def update\n # don't need to update; hash is shared\n end",
"def refresh; end",
"def after_refresh(_options = {}); end",
"def update(hash); end",
"def update(hash)\n super(hash.to_hash)\n end",
"def _save_set_values(h)\n @values = h\n end",
"def _save_set_values(h)\n @values = h\n end",
"def update_values\n end",
"def update_values\n end",
"def change(hash); end",
"def refresh!; end",
"def hash_more_data_state\n super\n end",
"def values_hash\n @_values.dup\n end",
"def set_update_values(link_hash)\n\thash = CreateHash.read_hash_file(link_hash[\"asset\"])\n\tnew_hash = {}\n\tnew_hash.store(\"Asset Number\", hash[\"fields\"][\"Asset Number\"])\n\tnew_hash.store(\"Purchase Date\", hash[\"fields\"][\"Purchase Date\"])\n\tnew_hash.store(\"Purchase Cost\", hash[\"fields\"][\"Purchase Cost\"])\n\tnew_hash.store(\"Supplier\", hash[\"fields\"][\"Supplier\"])\n\tnew_hash.store(\"Order Number\", hash[\"fields\"][\"Order Number\"])\n\treturn new_hash\nend",
"def initialize()\n @hash = {}\n @values = []\n end",
"def refresh\r\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def hash\n @hash\n end",
"def hashes=(value)\n @hashes = value\n end",
"def call_hash\n raise NotImplementedException.new(\"Must implement call_hash\")\n end",
"def initialize\n @h = new_hash\n end",
"def calculate_values_hashes\n @values_hashes || recalculate_values_hashes\n end",
"def values(reload = T.unsafe(nil)); end",
"def update_values(*args)\n cache_delete\n super\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize\n @_values = {}\n end",
"def rehash() end",
"def refresh\n end",
"def refresh\n end",
"def refresh\n end",
"def refresh\n # FIXME\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hvals(key); end",
"def hvals(key); end",
"def hash\n @hash.hash\n end",
"def updated_data; end",
"def recalculate_values_hashes\n vh = {}\n @values.each do |k,v|\n vh[k] = v.hash\n end\n @values_hashes = vh.freeze\n end",
"def hash\n values.hash ^ known_data.hash\n end",
"def hash\n if @_hash.nil?\n @_hash = {}\n run\n end\n @_hash\n end",
"def save_hash_field_order; end",
"def after_hash_token_authentication\n end",
"def reload\n clear_memoizations!\n remove = data.keys.find_all do |k|\n ![:id, :name].include?(k.to_sym)\n end\n remove.each do |k|\n data.delete(k)\n end\n super\n end",
"def hash_method\n super\n end",
"def get\n\t\t\t@hash\n\t\tend",
"def refresh!\n @buckets = init_buckets\n @full_buckets = Hash.new\n end",
"def initialize hash\n @hash = hash\n end",
"def save_hashes_for_write\n \n end",
"def hash\n\t\tvalue.hash\n\tend",
"def __hash\n @hash\n end",
"def hash\n hash_args.hash\n end",
"def refresh_from(values, partial = false)\n removed = partial ? Set.new : Set.new(@values.keys - [:auth_token] - values.keys)\n added = Set.new(values.keys - @values.keys)\n\n instance_eval do\n remove_accessors removed\n add_accessors added\n end\n removed.each do |k|\n @values.delete k\n end\n values.each do |k, v|\n # Stripe apparently allows you to have nested object types (e.g.\n # InvoiceList of Charges). We don't and this was breaking our code\n # @values[k] = Util.convert_to_clever_object(v)\n @values[k] = v\n end\n end",
"def __finalize__\n\t\t@__hash__.each { |k,v|\n\t\t\t@__hash__[k] = v.call if v.respond_to?(:call)\n\t\t}\n\tend",
"def original_values\n @original_values ||= {}\n end",
"def initialize\n @hash_dict = {}\n end",
"def update\n @p.transaction do\n @p['hash'] = @hash\n end\n end",
"def shared(other_hash)\n end",
"def site_data_hash; end",
"def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end",
"def initialize(*args)\n super\n # hash = {}\n end",
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash_dup\n save\n end",
"def follow_meta_refresh_self=(_arg0); end",
"def finalize!\n super\n keys.each { |key| set(key, resolve_value(key)) }\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def reload;end",
"def hash\n @__hash || @__hash = keys.empty? ? super : keys.hash\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def modify_values\n each_with_object self.class.new do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end",
"def hash\n value.hash\n end",
"def _refresh_set_values(values)\n ret = super\n load_typecast\n ret\n end",
"def headers=(hash); end",
"def headers=(hash); end",
"def render_hash\n Motion.serializer.weak_digest(self)\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end",
"def each_hash(result) # :nodoc:\n raise NotImplementedError\n end"
] |
[
"0.71478915",
"0.70189935",
"0.70189935",
"0.6993846",
"0.68671066",
"0.6440674",
"0.63669115",
"0.630551",
"0.62919927",
"0.62919927",
"0.62773556",
"0.61513376",
"0.6142",
"0.61366457",
"0.6125929",
"0.6044741",
"0.6044741",
"0.60333294",
"0.60333294",
"0.60152805",
"0.5949125",
"0.5920245",
"0.5913759",
"0.5881603",
"0.58782333",
"0.58306736",
"0.58215004",
"0.5800095",
"0.57959163",
"0.57928944",
"0.5791361",
"0.57659465",
"0.5749379",
"0.5747543",
"0.57148474",
"0.56916046",
"0.56654656",
"0.56605786",
"0.56568605",
"0.56568605",
"0.56471723",
"0.5607883",
"0.5607883",
"0.5607883",
"0.56065995",
"0.5603711",
"0.5603711",
"0.5602082",
"0.558852",
"0.5576373",
"0.5567898",
"0.5567275",
"0.5558399",
"0.55558854",
"0.5549883",
"0.55237955",
"0.5509531",
"0.5507008",
"0.549735",
"0.5497087",
"0.54897654",
"0.5486325",
"0.5484625",
"0.5481127",
"0.547325",
"0.5469667",
"0.5469177",
"0.5463585",
"0.54569083",
"0.5455394",
"0.5447674",
"0.54343617",
"0.5433973",
"0.5433973",
"0.5431725",
"0.54302096",
"0.54279315",
"0.54165995",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.54087347",
"0.53868306",
"0.5385973",
"0.5378318",
"0.5378318",
"0.53773654",
"0.537735",
"0.5371078",
"0.53681",
"0.53681",
"0.5367935",
"0.53647196",
"0.53575575",
"0.5354569"
] |
0.0
|
-1
|
Automatically shorten URL's found in messages Using the tinyURL API
|
def create_bot(opts)
Cinch::Bot.new do
configure do |c|
c.server = opts[:server]
c.channels = opts[:channels]
c.nick = opts[:name]
c.plugins.plugins = [Seen, Hello, TopicHistory, Memo]
end
helpers do
def shorten(url)
url = open("http://tinyurl.com/api-create.php?url=#{URI.escape(url)}").read
url == "Error" ? nil : url
rescue OpenURI::HTTPError
nil
end
end
on :channel do |m|
return if m =~ /\A!/
urls = URI.extract(m.message, "http").reject { |url| url.length < 70 }
if urls.any?
short_urls = urls.map {|url| shorten(url) }.compact
unless short_urls.empty?
m.reply short_urls.join(", ")
end
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shorten_urls\n @status = (@status.split(\" \").collect do |word|\n if word =~ URI::regexp and word.length > 30 then\n # using tinyurl\n # NOTE: look into retwt.me, they have a simple api (w/o auth) and provide analysis\n (Net::HTTP.post_form URI.parse('http://tinyurl.com/api-create.php'),{\"url\" => word}).body\n else\n word\n end\n end).join(\" \")\n end",
"def short_url\n @short_url ||= client.shorten(long_url: url).link\n rescue => e\n Rails.logger.warn(\"Could not shorten bit.ly url #{e.message}\")\n url\n end",
"def shorten\n\t\tcharacters = [*\"0\"..\"9\", *\"A\"..\"Z\", *\"a\"..\"z\"]\n\n\t\t@short_url = (0..6).map{characters.sample}.join\n\t\tself.short_url = @short_url\n\tend",
"def shorten(opts, url)\n request(\n :get,\n \"#{opts['a']}#{SHORTEN_URL}?action=shorten&url=#{URI.escape(url)}&key=#{opts['t']}\"\n ).sub(/awau\\.moe/, opts['u'])\n end",
"def shorten(url)\n query = { :'link[url]' => url }\n self.class.post(\"/links\", :query => query)\n end",
"def short_link\n UrlShort::IsGd.shorten @link\n end",
"def shorten_url(url)\n pattern = /<a.*>(\\S*)<\\/a>/um\n url =~ pattern\n (url = url.sub(/>.*#{$1}.*</um, \">les mer<\")) unless $1 == nil\n\n # Some line-broken or complex urls don't work. For now we just null them to \"\" and\n # hope people check the NAF calendar.\n if(url =~ /les mer/)\n return url\n else\n return \"\"\n end\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def shorten\n request = {\n body: { longUrl: url }.to_json,\n headers: { 'Content-Type' => 'application/json' },\n query: { key: api_key, \n access_token: access_token }\n }\n\n request.merge!({ http_proxyaddr: proxy.host, \n http_proxyport: proxy.port, \n http_proxyuser: proxy.user, \n http_proxypass: proxy.password }) if proxy\n\n Timeout::timeout(timeout) do\n # submit the url to Goo.gl\n result = self.class.post(\"/urlshortener/v1/url\", request)\n # return the response id or the url\n result.parsed_response[\"id\"] || url\n end\n # if a problem occurs\n rescue Timeout::Error, JSON::ParserError => e\n # just return the original url\n url\n end",
"def shorten\n\t\trange = [*'0'..'9',*'A'..'Z',*'a'..'z']\n self.short_url = Array.new(7){range.sample}.join\n self.save\n\tend",
"def shorten(url)\n xml = SimpleHttp.get(\"#{API_URL}/shorten?url=#{CGI::escape(url)}&service=#{key}&format=xml\")\n doc = REXML::Document.new(xml)\n\n result = doc.elements[\"result\"]\n\n if result.elements[\"status\"].text == \"ok\"\n result.elements[\"url\"].text\n else\n raise result.elements[\"description\"].text\n end\n end",
"def shorten_url\n\t\t# generate 7 random numbers from 0-9 and a-z\n\t\tself.short_url = rand(36**7).to_s(36) # [0,6] # use this to ensure 7 characters\n\n\t\t# to include A-Z\n\t\t# require 'base62'\n\t\t# self.short_url = rand(36**7).base62_encode\n\n\t\t# self.short_url = SecureRandom.hex(10)\n\tend",
"def shorten_link(url)\n uri = URI.parse(\"http://localhost:3000/shorten\")\n params = {\"url\": url}\n uri.query = URI.encode_www_form(params)\n JSON.parse(Net::HTTP.get(uri))\nend",
"def shorten\n result = url\n \n begin \n if url.size > 18 && !/http:\\/\\/snipr.com.*/.match(url)\n using(rdr = StreamReader.new(request.get_response.get_response_stream)) { \n result = rdr.read_to_end.to_s\n } \n end\n rescue Exception => e\n #catch all errors and just return the regular url\n end\n \n res = ((result.size >= url.size || result.empty?) ? url.ensure_http : result).to_s\n logger.debug(\"*** SniprUrl: Shortened url from: #{url} to #{res}\")\n res\n end",
"def get_short_url(link)\n client = Bitly.client\n shortened_url = client.shorten(link)\n return shortened_url.short_url \n end",
"def shortener\n\t\tcharacters = [*\"0\"..\"9\", *\"A\"..\"Z\", *\"a\"..\"z\"]\n\n\t\t@short_url = (0..6).map{characters.sample}.join\n\t\tself.short_url = @short_url\n\tend",
"def shorten\n\tself.short_url = SecureRandom.hex(3)\n\tend",
"def short\n alexa_rank = alexa_rank params[:url]\n host = get_domain params[:url]\n host = host.split \".\"\n domain = host.count >= 3 ? host[host.count - 3] : host[host.count - 2]\n @url = @user.url.create url: params[:url], alexa_rank: alexa_rank, domain: domain\n @url.save!\n render json: {url_short: @url.url_short}\n end",
"def shorten(url)\n bitly_url = \"http://api.bit.ly/shorten?version=2.0.1&login=#{BITLY_LOGIN}&apiKey=#{BITLY_API_KEY}&longUrl=#{CGI::escape(url)}\"\n resp = open(bitly_url).read\n JSON.parse(resp)['results'][url]['shortUrl']\n rescue\n logger.debug(\"Unable to generate Bit.ly url for #{url}\")\n nil\n end",
"def shorten\n\t\t self.short_url = SecureRandom.hex(3)\n\tend",
"def shorten(url)\n if @access_token.nil?\n login { shorten(url) } \n return self\n end\n\n params = get_request_parameters(url)\n request = EM::HttpRequest.new(API_SHORTEN_URL).get(params)\n request.callback(&method(:on_success))\n request.errback(&method(:on_error))\n self\n end",
"def shorten_url(url)\n res = http_post(\"http://crash.io\", :url => url)\n if res.status == 201\n res.headers['location']\n else\n url\n end\n rescue TimeoutError\n url\n end",
"def url_shortener(full_uri)\n mapper = UrlMapper.find_by_original_url(full_uri)\n \n if mapper\n string = mapper.short_url\n else\n string = \"/\"\n 5.times { string << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n begin\n UrlMapper.create!({:short_url => string, :original_url => full_uri})\n rescue\n end\n end\n \"#{APP_CONFIG['url_shortener']}#{string}\"\n end",
"def shorten(long_url, opts={})\n query = { :longUrl => long_url }.merge(opts)\n response = get('/shorten', :query => query)\n return Bitly::V3::Url.new(self, response['data'])\n end",
"def shorten(url)\n params = { :query => { :url => url } }\n request = EM::HttpRequest.new(API_URL).post(params)\n request.callback(&method(:on_success))\n request.errback(&method(:on_error))\n self\n end",
"def shorten\n\t\n\t\tself.short_url = SecureRandom.urlsafe_base64(4)\n\tend",
"def tinyfyurl\n self.tinyurl = Tools.tinyfy(url)\n end",
"def shorten!(url, key=nil)\n begin\n key ? named_url(url, key) : autoname_url(url)\n rescue => e\n @error = e and raise\n end\n end",
"def shorten(long_url, options={})\n response = get(:shorten, { :longUrl => long_url }.merge(options))\n return Bitlyr::Url.new(self, response)\n end",
"def shorten_link\n # http://stackoverflow.com/questions/88311/how-best-to-generate-a-random-string-in-ruby\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n string = (0...6).map { o[rand(o.length)] }.join\n self.short_url = \"http://www.sho.rt/#{string}\"\n end",
"def shorten_link\n \t\tinput_link = params[:link][:given_link]\n \t\trender json: shorten_my_link(input_link)\n \tend",
"def create_short_url\n rand_url = ('a'..'z').to_a.shuffle[0..5].join\n self.short_url = \"#{rand_url}\"\n end",
"def shorten(long_url)\n http_response = @httpclient.get_content(build_url(\"shorten\", \"longUrl=#{CGI::escape(long_url)}\"))\n data = JSON.parse(http_response)\n raise BitlyError.new(data[\"errorMessage\"]) unless data[\"statusCode\"] == \"OK\"\n data[\"results\"][long_url]\n end",
"def putShortenurl( url)\n params = Hash.new\n params['url'] = url\n return doCurl(\"put\",\"/shortenurl\",params)\n end",
"def short_url\n \"#{HOST_URL}/#{short_code}\"\n end",
"def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end",
"def convert_long_url_to_short_url\n if params[:long_url] == \"\"\n flash[:Error] = \"Please Enter all Details\"\n redirect_to urls_long_url_to_short_url_path\n else\n params[:long_url] = params[:long_url].strip\n @result = shorten_url(url_params)\n render '/urls/show'\n end\n end",
"def shorten(url, key=nil)\n begin\n shorten!(url, key)\n rescue => e\n nil\n end\n end",
"def shorten(url, full = true)\n self.class.get_and_parse_shorten(url, full)\n end",
"def generate_short_url\n url = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond).to_s(36)\n old_url = Link.where(short_url: url).last\n if old_url.present? \n self.generate_short_url\n else\n self.short_url = url\n end\n end",
"def create_short_url(url_params) \n url = Url.new(url_params)\n url.suffix= url.create_suffix(url_params[:longurl],0)\n while url.unique(url.suffix) == false\n url.suffix = url.create_suffix(url_params[:longurl],1)\n end\n domain = Domainatrix.parse(url_params[:longurl]).domain + '.' + Domainatrix.parse(url_params[:longurl]).public_suffix\n short_domain = ShortDomain.where(domain: domain).first[:prefix]\n url.shorturl = \"http://\" + short_domain +'/'+ url.suffix\n if url.save\n return url\n else\n return nil\n end\n end",
"def shorten_url\n if @url.save\n headers 'Location' => url(@url.path)\n halt 201, \"Created #{url(@url.path)}\"\n else\n halt 406, \"#{@url.errors.full_messages.join(\".\\n\")}\"\n end\n end",
"def shorter_url\n\t\tself.short_url = SecureRandom.base64(10)\n\tend",
"def getShortenurl( id)\n params = Hash.new\n params['id'] = id\n return doCurl(\"get\",\"/shortenurl\",params)\n end",
"def generate_short_url(url_id)\n # Base62 alphabet to be used\n alphabet_array = [*'a'..'z', *'A'..'Z', *'0'..'9']\n shorturl = []\n while url_id.to_i.positive?\n shorturl.push(alphabet_array[url_id % 62])\n url_id /= 62\n end\n new_url = shorturl.reverse.join\n\n # Check short_url doesn't exist in the database. If short_url exists, we generate a new url\n url_exist = UrlShortener.find_by_short_url(new_url)\n return new_url if url_exist.blank?\n\n generate_short_url(url_id)\n end",
"def generate_short_url\n self.update_attribute :short_url, self.class.convert_to_base62(self.id)\n end",
"def create_shortened_url\n key = self.id - 1\n\n if key == 0\n shortened = ALPHABET[0]\n else\n shortened = ''\n baseLength = ALPHABET.length\n\n until key < 1\n place = key % baseLength\n shortened += ALPHABET[place]\n\n key /= baseLength\n end\n end\n self.shortened = shortened\n self.save\n end",
"def easy\n url = params[:url]\n\n # Well, this would be super slow for mainstream processors, but\n # might be good enough for Mom's & Dad's shop\n link = Link.find_by_url(url)\n\n # Oops, we don't have this Url in tables yet\n if link.nil?\n link = Link.new\n link.url = url\n link.save\n end\n\n render :text => SHORT_URL + \"/\" + Base32::Crockford.encode(link.id)\n end",
"def link_check\n\t\tif self.message.include? \"https://\"\n\t\t\tarr = self.message.split\n\t\t\t# find me the index where the curly bracket area is equal to true, and set that index equal to indx\n\t\t\tindx = arr.map { |x| x.include? \"https://\"}.index(true)\n\t\t\t# take what is in the array at index # and assign it as a link attribute to the curent instance of tweet (self) \n\t\t\tself.link= arr[indx]\n\n\t\t\t# check and see if the item at array indx length is greater than 23? if so , we havfe to shorten it.\n\t\t\tif arr[indx].length > 23\n\t\t\t\tarr[indx]=\"#{arr[indx][0..20]}...\"\n\t\t\tend\n\n\t\t\tself.message= arr.join(\" \")\n\t\tend\t\n\tend",
"def compose(link)\n s = shortener.shorten(link.url)\n \"#{link.title}\\n#{s.short_url}\"\n end",
"def update_short_url\n uniq_key = Digest::MD5.hexdigest(\"#{self.id()}\").slice(0..6) \n update_column(:short_url, BASE_SHORT_URL + uniq_key)\n true\n end",
"def short_url_algorithm()\n \n unique_id_length = 3\n base64 = Base64.encode64(self.original_url)\n join_url = (base64.split('')).sample(unique_id_length).join()\n safe_url = join_url.gsub(\"+\", \"-\").gsub(\"/\",\"_\")\n \n loop do \n self.short_url = @@URL + safe_url\n \n if Url.find_by_short_url(self.short_url).nil?\n break\n else\n unique_id_length = unique_id_length + 1\n end\n \n end\n \n end",
"def trunc_em\n self.the_url = self.the_url.truncate 200\n end",
"def shorten(long_url, ops={})\n\t\t\treturn nil unless long_url\n return execute_post('shorten', :link) do |params|\n params[:long_url] = long_url\n params.merge!(ops)\n end\n\t\tend",
"def small_url(host=Smurl.host)\n custom_url = CustomUrl.last(smurl_id: id)\n link = custom_url.link if custom_url\n path = link || SmallUrl.encode62(id)\n\n relative = '/' + path\n if host\n host + relative\n else \n relative\n end\n end",
"def link_check\n check = false\n if self.message.include? \"http://\"\n check = true\n elsif self.message.include? \"https://\"\n check = true\n else\n check = false\n end\n\n if check == true\n arr = self.message.split\n\n index = arr.map{ |x| x.include? \"http\"}.index(true)\n # map is a function that takes a block and returns an array with the result of each element mapped to the return value of that block - this line is breaking the message into an array of words and checking to see if any item/word in the array starts with http\n self.link = arr[index]\n # saving that http to the variable self\n if arr[index].length > 23\n arr[index] = \"#{arr[index][0..20]}...\"\n end\n # if longer than 23 characters, it gets shortened to the first 21 characters with ...\n\n self.message = arr.join(\" \")\n end\n\n def apply_link\n arr = self.message.split\n index = arr.map { |x| x.include? \"http://\" }.index(true)\n if index\n url = arr[index]\n # finds the index of the http link and saves it as url\n arr[index] = \"<a href='#{self.link}' target='_blank'>#{url}</a>\"\n # target='_blank' opens a new tab for the link\n\t end\n self.message = arr.join(\" \")\n end\n\n end",
"def generate_short_url(clash_count=0)\n raise \"Too many short URL clashes. Please increase the short url length\" if clash_count == 10\n url = self.sanitize_url\n shortened_url = Digest::MD5.hexdigest(url)[(0+clash_count)..(SHORT_URL_LENGTH+clash_count)]\n url_present = Url.find_by_short_url(shortened_url)\n if(url_present)\n generate_short_url(clash_count+1)\n else\n self.short_url = shortened_url\n end\n end",
"def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end",
"def get_longurl\n\t\turl_id = get_id_from_short_url params[:short_url]\n\t\turl = Url.find(url_id)\n\t\tjson_response({long_url: \"Long URL for the given Short URL: www.tinyurl/#{params[:short_url]} is: #{url[:long_url]}\"})\n\tend",
"def full_shortened_url(base)\n base + '/' + short_url\n end",
"def shorten_with_bitly(long_url)\n # long URL will be sth like:\n # http://springerquotes.heroku.com/article/doi:10.1186/1477-7819-1-29#h[AtmWaa,7,AraRwg,13,IatDaw,1,GcoNwm,4]\n\n # generate the quote URL like this:\n # http://springerquotes.heroku.com/quotes/doi:10.1186/1471-2105-7-126?quotes=h[TmeWta,2,5,6,witFas,2]\n # [\"http\",\n # nil,\n # \"localhost\",\n # \"9292\",\n # nil,\n # \"/article/doi:10.1186/1471-2105-7-126\",\n # nil,\n # nil,\n # \"h[TmeWta,2,5,6,witFas,2]\"]\n uri_elements = URI.split(long_url)\n quote_url = \"http://springerquotes.heroku.com/#{uri_elements[5].gsub(/^\\/article/,\"quotes\")}?quotes=#{uri_elements[8]}\"\n\n puts \"Creating bit.ly URL for #{quote_url}\"\n\n # shorten URL\n yql_query = \"\n SET login = '#{Bitly_username}' ON bit.ly;\n SET apiKey = '#{Bitly_apikey}' ON bit.ly;\n SELECT data FROM bit.ly.shorten WHERE longUrl='#{quote_url}';\n \"\n yql_query = YqlSimple.query(yql_query)\n\n begin\n short_url = yql_query[\"query\"][\"results\"][\"response\"][\"data\"][\"url\"]\n rescue Exception => ex\n short_url = nil\n end\n\n return short_url\n end",
"def create_short_url(original_url = nil)\n params = {body: {originalURL: original_url, domain: @short_domain}.to_json, headers: {\"Authorization\" => @short_api_key}}\n response = self.class.post(\"/links\", params)\n @short_url = JSON.parse(response.body)[\"shortURL\"]\n response\n end",
"def generate_short_url\n new_short = \"/\" + Faker::Lorem.characters(7)\n until short_url_unique?(new_short)\n new_short = \"/\" + Faker::Lorem.characters(7)\n end\n self.short_url = new_short\n end",
"def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end",
"def unshorten(url, opts= {})\n options = {\n max_level: opts.fetch(:max_level, 10),\n timeout: opts.fetch(:timeout, 2),\n use_cache: opts.fetch(:use_cache, true)\n }\n url = (url =~ /^https?:/i) ? url : \"http://#{url}\"\n __unshorten__(url, options)\n end",
"def sanitize\n \tself.original_url.strip!\n \tself.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n \tself.sanitize_url = \"http://#{self.sanitize_url}\"\n\n \n start = 8\n final = self.sanitize_url.length\n\n while start <= final do\n sanitize_url[start] == ' ' ? sanitize_url[start] = '-' : sanitize_url[start] = sanitize_url[start] #change spaces for '-'\n break if sanitize_url[start] == '/' #break if '/' is found\n start +=1\n end\n\n self.sanitize_url = sanitize_url[0..start] #cut the string for creating the shortened_url\n self.short_url = sanitize_url + short_url #save the final shortened_url on the short_url's field\n end",
"def generate_short_url(base_url)\n build_shorten_url.update( uniq_id: shorten, expired_at: Time.now.utc + 1.year ) unless shorten_url\n shorten_url.link(base_url)\n end",
"def link_check\n check = false\n if self.message.include? \"http://\"\n check = true\n elsif self.message.include? \"https://\"\n check = true\n else\n check = false\n end\n\n if check == true\n arr = self.message.split\n index = arr.map{ |x| x.include? \"http\"}.index(true)\n self.link = arr[index]\n if arr[index].length > 23\n arr[index] = \"#{arr[index][0..20]}...\"\n end\n\n self.message = arr.join(\" \")\n end\n end",
"def short\n Rails.application.routes.url_helpers.short_url(short_url: self.short_url)\n end",
"def translate\n # pull the link out of the Database\n @url = Url.where(:unique_key => params[:unique_key]).first\n\n if @url\n @url.hit_count_increament\n # do a 301 redirect to the destination url\n head :moved_permanently, :location => @url.url\n else\n # if shortened link is not found, redirect to the root\n # make this configurable in future versions\n head :moved_permanently, :location => root_url\n end\n end",
"def retrieve_short_url_to_long_url\n if params[:short_url]==\"\"\n flash[:Error] = \"Please Enter all Details\"\n redirect_to urls_short_url_to_long_url_path\n else\n params[:short_url] = params[:short_url].strip\n @result = short_url(url_params)\n render '/urls/show'\n end\n end",
"def shorten\n\t\t# range_alpha = [*\"A\"..\"Z\",*\"a\"..\"z\"]\n\t\t# range_int = [*\"0\"..\"9\"]\n\t\t# short_url = (0...3).map{ range_alpha.sample }.join('') \n\t\t# short_url2 = (0...4).map{range_int.sample}.join('')\n\n\t\t# return short_url + short_url2\n\t\treturn SecureRandom.hex(3)\n\tend",
"def tweet_format message\n\n # We begin the hunt for links. The good news is that Slack marks them out for us!\n # Links look like:\n # <http://google.com>\n # or\n # <http://google.com|Google!>\n # We want to ignore the label, and just get the URL\n\n links = []\n message['text'].scan(/<(https?:\\/\\/.+?)>/).each do |m|\n url = m[0].split('|')[0]\n links.append url #URI.encode url\n end\n\n return nil if links.length == 0 #return nil if no links found\n\n # Just take the first link.\n\n response = Faraday.get links[0]\n\n # We are now in our own thread, operating asynchronously. We can take our time here.\n\n # First, we use Nokogiri to extract the page title.\n page = Nokogiri::HTML(response.body)\n page.css('script, link, style').each {|node| node.remove}\n title = page.css('title').text\n\n # Now craft a tweet message; remember max is 140 chars!\n\n # First, check the current max length of a t.co link wrapper\n # TODO\n t_co = 20\n length = title.length + t_co + 1 # 1 for the space.\n delta = length - 140\n if delta > 0\n title = title[0..-delta-2] + '…'\n end\n\n title + ' ' + links[0]\n end",
"def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n i /= base\n end\n update_attributes(short_url: s.reverse)\n end",
"def display_link\n link.sub(SCHEME_PATTERN, '').truncate(48) if link\n end",
"def shorten(*urls)\n urls = urls.flatten\n raise OwO::Err::NoContent, 'There is a empty string in your arguments!' if urls.include? ''\n raise OwO::Err::NoContent, 'Theres no URLs provided!' if urls.empty?\n result = urls.flatten.map { |x| OwO::API.shorten(opts, x) }\n result[0] if urls.length == 1 || !urls.first.is_a?(Array)\n end",
"def generate_short_url\n short_url = unique_url\n\n # check if this is a duplicate\n if ShortenUrl.where(short_url: short_url).exists?\n # try again\n generate_short_url\n else\n self.short_url = short_url\n end\n end",
"def short_url\n self.minified_url = ShortUrlsHelper.url_encode(id.to_i)\n\n if save\n update_title(self.id)\n return true\n end\n\n false\n end",
"def url(size)\n size = case size\n when :small_square, :small, :s\n 's'\n when :large_thumbnail, :large, :l\n 'l'\n else\n ''\n end\n\n splitted_link = link.split('.')\n splitted_link[splitted_link.size - 2] << size\n splitted_link.join '.'\n end",
"def url_to_txt\n gsub(/\\*\\*/, '\"').tr('*', \"'\").tr('_', ' ').humanize\n end",
"def urlify(str, len)\n\nend",
"def sanitize( message )\n urls = URI.extract(message)\n\n # Return early no URLs are foudnd.\n return message if urls.length.zero?\n\n urls.each do |url|\n next if URI.parse(url).class != URI::HTTP # Ignore URI::General etc\n\n host = URI.parse(url).host\n host = host.start_with?('www.') ? host[4..-1] : host\n message = message.gsub(url, host)\n end\n\n message\n end",
"def generate_short_url(long_url)\n\t @shortcode = random_string 5\n\t \n\t su = ShortURL.first_or_create(\n\t { :url => long_url }, \n\t {\n\t :short_url => @shortcode,\n\t :created_at => Time.now,\n\t :updated_at => Time.now\n\t })\n\t \n\t @shortenedURL = get_site_url(su.short_url)\n\tend",
"def view_url(url='', max_size=30)\n rexp = /(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*/ix\n\n if rexp.match(url)\n link_to h(url.etc max_size), url, :title => \"Go to #{url}\", :popup => true\n else\n content_tag :span, :title => \"#{url}\" do\n url.etc max_size\n end\n end\n end",
"def create_short_url\n return if short_url\n # Check if the required parameters are present\n unless upload_image || long_url\n logger.info \"url : #{url_info.inspect} self : #{inspect}\"\n raise 'Missing long_url or upload_image'\n end\n\n self.long_url = url_info.id if long_url.blank?\n\n to_hash = long_url.to_s\n\n # Custom hash if the user is logged in\n to_hash = user.pseudo + 'pw3t' + long_url if user_id\n\n # And we keep only the 10 first characters\n self._id = hash_and_truncate(to_hash)\n end",
"def long_url\n @client.redirect_ok = false\n page = @client.get @short #Get the Long URL\n long = page.header['location']\n puts \"#{@short} => #{long}\"\n long\n end",
"def build_tiny_url\n self.tiny_url = Token.generate_url\n end",
"def create\n \n url_match = params[:url][:url] =~ /\\Ahttp(s?):\\/\\//i\n params[:url][:url] = \"http://\" << params[:url][:url] if url_match.nil?\n \n # find existing url\n @existing_url = Url.find_by_url(params[:url][:url])\n \n if @existing_url.nil?\n @url = Url.new(params[:url])\n id = Url.last.id unless Url.last.nil?\n @url.short_url = Shorten::Base62.to_s(id.nil? ? 1 : id+1)\n p @url\n else\n @url = @existing_url\n end\n\n respond_to do |format|\n if !@existing_url.nil? or @url.save\n format.html { redirect_to @url, notice: 'Url was successfully shortened.' }\n format.json { render json: @url, status: :created, location: @url }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def get_short_url\n\n long_url = params[:long_url]\n\n if long_url.blank? || !long_url.is_valid_url?\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Long URL must be in the format http://www.decisiv.com' }\n format.json { render :json => {:error => \"Long URL must be in the format http://www.decisiv.com\"}.to_json, :status => 400 }\n end\n return\n end\n\n short_url = nil\n\n if Url.where(:long_url => long_url).exists?\n\n @url = Url.where(:long_url => long_url).first\n \n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'URL already exists' }\n format.json { render :json => @url.to_json, :status => 400 }\n end\n return\n \n end\n\n\n for i in 0..20 \n\n # generate a random text\n short_url = [*('a'..'z'),*('0'..'9')].shuffle[0,10].join\n\n if RestrictedWord.find_by_fuzzy_word(short_url).count > 0\n next\n end\n\n if Url.find_by_fuzzy_short_url(short_url).count > 0\n next\n end\n\n \n # add it to the database\n @url = Url.new\n @url.long_url = long_url\n @url.short_url = short_url\n \n if @url.save\n\n Url.bulk_update_fuzzy_short_url\n\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Short URL created' }\n format.json { render :json => @url.to_json, :status => 200 }\n end\n return\n\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n return\n\n end\n\n end\n\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Error trying to create short URL.' }\n format.json { render :json => {:error => \"Error trying to create short URL.\"}.to_json, :status => 400 }\n end\n\n end",
"def generate_short_url\n random_chars = ['0'..'9','A'..'Z','a'..'z'].map{|range| range.to_a}.flatten\n self.assign_attributes(short_url: 6.times.map{ random_chars.sample }.join.prepend(\"http://\")) until self.short_url.present? && Link.find_by_short_url(short_url).nil?\n end",
"def get_short_url_from_id n\n # Map to store 62 possible characters \n map = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"; \n \tshorturl = \"\"\n\n # Convert given integer id to a base 62 number \n while n!=0 do\n # use above map to store actual character in short url \n shorturl += map[n%62]; \n n = n/62; \n \t\tend\n # Reverse shortURL to complete base conversion \n shorturl.reverse!\n end",
"def shorten_url_params\n params.require(:shorten_url).permit(:original_url)\n end",
"def urlshortner_params\n params.require(:urlshortner).permit(:url, :alter_url)\n end",
"def generate_short_url\n short_url = SecureRandom.urlsafe_base64[0..6]\n short_url\n end",
"def shorturl\n return nil if self.new_record?\n return self.surl unless self.surl.nil?\n\n self.surl = encode_url\n\n self.save\n return surl\n end",
"def slow\n 'http://parley.rubyrogues.com/'.gsub(%r{\\Ahttp://}, 'https://')\nend",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def generate_short_url\r\n url = rand(36**8).to_s(36)\r\n\r\n # If generated token already exists, execute again\r\n if Shortcut.where(short_url: url).count > 0\r\n generate_short_url\r\n return\r\n end\r\n\r\n # Generated short url\r\n self.short_url = url\r\n end",
"def formatted_link\n host = ENV['HEROKU_APP_NAME'] ? \"#{ENV['HEROKU_APP_NAME']}.herokuapp.com\" : 'localhost:3000'\n \"<#{Rails.application.routes.url_helpers.thread_url(id, host: host, format: :json)}|this thread>\"\n end"
] |
[
"0.7836109",
"0.72094464",
"0.6987298",
"0.6972863",
"0.69470274",
"0.68740964",
"0.686972",
"0.6858323",
"0.6858323",
"0.68049747",
"0.67434156",
"0.6733004",
"0.6725587",
"0.6721919",
"0.6721696",
"0.67162895",
"0.66990507",
"0.66531676",
"0.6649935",
"0.6630715",
"0.6604536",
"0.65711063",
"0.65629",
"0.65201074",
"0.65179825",
"0.65160465",
"0.64977896",
"0.64949757",
"0.64479357",
"0.64456147",
"0.64422196",
"0.644053",
"0.6432415",
"0.64315414",
"0.6430644",
"0.6418959",
"0.63839155",
"0.63747764",
"0.6348486",
"0.6328507",
"0.62992126",
"0.62834984",
"0.6280276",
"0.6252729",
"0.6238697",
"0.62251437",
"0.6211196",
"0.6207615",
"0.6199666",
"0.6198054",
"0.61896175",
"0.61889046",
"0.61851925",
"0.61836827",
"0.61775374",
"0.61740613",
"0.6172561",
"0.61599445",
"0.6131458",
"0.61306226",
"0.6129403",
"0.6127953",
"0.6101717",
"0.60847944",
"0.6074207",
"0.6069228",
"0.6058215",
"0.6031728",
"0.6031121",
"0.6018062",
"0.59927064",
"0.5977188",
"0.5960084",
"0.5944837",
"0.5929395",
"0.592926",
"0.592289",
"0.59170175",
"0.5899919",
"0.58962697",
"0.5895067",
"0.5864211",
"0.5863918",
"0.58558506",
"0.5835709",
"0.5821503",
"0.5805289",
"0.57913864",
"0.57780135",
"0.57712805",
"0.5767522",
"0.5760895",
"0.5760693",
"0.5752214",
"0.57521826",
"0.57226175",
"0.56925756",
"0.56786263",
"0.56786263",
"0.56734514",
"0.5668075"
] |
0.0
|
-1
|
Returns true if the format is compatible with the request.
|
def match?(_request)
fail NotImplementedError
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_request?\n request.format.json? || request.format.js? || request.format.xml? || request.format.fbtab?\n end",
"def valid?\n valid_format? @format\n end",
"def supported?\n if is_simple_format?\n return true\n elsif is_advanced_format?\n return is_supported_advanced_format?\n else\n return false\n end\n end",
"def check_format\n # This allows us to support content negotiation\n if request.headers['HTTP_ACCEPT'].nil? || request.format == '*/*'\n request.format = 'xml'\n end\n\n request_format = request.format.symbol\n if request_format != :xml && request_format != :json\n # 406 is the default status code when the format is not support\n head :not_acceptable\n end\n end",
"def handable_format?\n @request.format.symbol.nil? || (@request.format.symbol == :html)\n end",
"def known_format?(f)\n FORMAT_TO_CONTENT_TYPE[f]\n end",
"def unsupported_format?\n case @format\n when *UNSUPPORTED_FORMATS then true\n else false\n end\n end",
"def verify_requested_format!\n mimes = collect_mimes_from_class_level\n collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)\n\n unless collector.negotiate_format(request)\n raise ActionController::UnknownFormat\n end\n end",
"def is_supported_format\n if zip? || csv?\n true\n else\n errors.add(:input, :unsupported_file_format)\n end\n end",
"def valid_file_format?\n VALID_FILE_FORMAT. include? uri_extension\n end",
"def matches?(request)\n request.headers.fetch(:accept).include?(\"application/vnd.pieforproviders.v#{version}+json\")\n end",
"def accept_header?\n return request.headers['Accept']&.include?('application/fhir+json') if params.permit(:_format)[:_format].nil?\n\n ['json', 'application/json', 'application/fhir+json'].include?(params.permit(:_format)[:_format]&.downcase)\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end",
"def valid?\n formats.count > 0\n end",
"def valid_readers_format?\n VALID_READER_FORMAT.include? uri_extension\n end",
"def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end",
"def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"def json_request?()\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def valid?\n image_resource? && supported_format?\n end",
"def api_version_match?\n ! api_version_negotiated.nil?\n end",
"def matches?(request)\n @default || request.headers['Accept'].include?(\"application/vnd.medexprimereemr.v#{@version}\")\n end",
"def format?\n # if :custom\n if self.conventional?\n :conventional\n elsif self.relaxed?\n :relax\n elsif self.redacted?\n :redacted\n elsif self.standard?\n :standard\n else\n :invalid\n end\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end",
"def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end",
"def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end",
"def valid?(format=@config[:local_format]||:conventional)\n if @config[:mailbox_validator].is_a?(Proc)\n @config[:mailbox_validator].call(self.mailbox, self.tag)\n elsif format.is_a?(Proc)\n format.call(self)\n elsif format == :conventional\n self.conventional?\n elsif format == :relaxed\n self.relaxed?\n elsif format == :redacted\n self.redacted?\n elsif format == :standard\n self.standard?\n elsif format == :none\n true\n else\n raise \"Unknown format #{format}\"\n end\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def compatible_with?(sub_request)\n CompatibilityEngine.compute_compatibility(self, sub_request)\n end",
"def check_request_format\n unless request.content_type == 'application/json'\n error = ErrorSerializer.serialize({ format: \"Invalid request format. Only JSON requests are supported.\" })\n render json: error, status: :unsupported_media_type\n end\n end",
"def valid_format?(fmt)\n format_string_has_v_or_d?(fmt)\n format_string_does_not_have_v_and_d?(fmt)\n format_string_is_all_valid_chars?(fmt)\n format_string_has_unique_chars?(fmt)\n format_string_has_big_t_only_at_the_end?(fmt)\n end",
"def valid?\n return false if @format.nil?\n format_validator = EnumAttributeValidator.new('String', [\"mp4\", \"gif\", \"mp3\", \"jpg\", \"png\", \"bmp\"])\n return false unless format_validator.valid?(@format)\n resolution_validator = EnumAttributeValidator.new('String', [\"preview\", \"mobile\", \"sd\", \"hd\", \"1080\"])\n return false unless resolution_validator.valid?(@resolution)\n aspect_ratio_validator = EnumAttributeValidator.new('String', [\"16:9\", \"9:16\", \"1:1\", \"4:5\", \"4:3\"])\n return false unless aspect_ratio_validator.valid?(@aspect_ratio)\n fps_validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])\n return false unless fps_validator.valid?(@fps)\n scale_to_validator = EnumAttributeValidator.new('String', [\"preview\", \"mobile\", \"sd\", \"hd\", \"1080\"])\n return false unless scale_to_validator.valid?(@scale_to)\n quality_validator = EnumAttributeValidator.new('String', [\"low\", \"medium\", \"high\"])\n return false unless quality_validator.valid?(@quality)\n true\n end",
"def compatible?(other)\n false\n end",
"def compatible?(subject, schema, version = 'latest')\n response = post \"/compatibility/subjects/#{subject}/versions/#{version}\",\n expects: [200, 404],\n body: { schema: schema.to_s }\n data = response.to_json\n data.fetch('is_compatible', false) unless data.key?('error_code')\n end",
"def match?(request)\n request.content_type =~ %r{^application/json.*}\n end",
"def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"DOCUMENT\", \"FAX\", \"RECORDING\"]\n if @system_type && !allowed_values.include?(@system_type)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"SINGLE_PUT\", \"MULTIPART_POST\"]\n if @upload_method && !allowed_values.include?(@upload_method)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"NONE\", \"LIMITED\", \"PUBLIC\"]\n if @sharing_status && !allowed_values.include?(@sharing_status)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def json_supported?\n version_supported?('10.5.0', '5.7.22')\n end",
"def has_mime_version?\n header.has_mime_version?\n end",
"def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def standard?\n self.syntax = :invalid\n self.valid_size? or return false\n self.valid_encoding? or return false\n if self.local =~ STANDARD_LOCAL_REGEX\n self.syntax = :standard\n true\n else\n false\n end\n end",
"def has_file_format?\n @file_format\n end",
"def json_input?\n return request.content_type == 'application/json'\n end",
"def content_type_header?\n request.headers['Content-Type']&.include?('application/fhir+json')\n end",
"def valid?\n html_version_validator = EnumAttributeValidator.new('String', [\"Xhtml\", \"Html5\"])\n return false unless html_version_validator.valid?(@html_version)\n metafile_format_validator = EnumAttributeValidator.new('String', [\"Png\", \"Svg\", \"EmfOrWmf\"])\n return false unless metafile_format_validator.valid?(@metafile_format)\n office_math_output_mode_validator = EnumAttributeValidator.new('String', [\"Image\", \"MathML\", \"Text\"])\n return false unless office_math_output_mode_validator.valid?(@office_math_output_mode)\n return true\n end",
"def invalid_format?(format)\n return true unless FORMATS.include?(format)\n end",
"def versionable?\n !respond_to?(:is_standard?) || !is_standard?\n end",
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def has_mime_version?\n !fields.select { |f| f.responsible_for?('Mime-Version') }.empty?\n end",
"def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@url.nil? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if !@description.nil? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end",
"def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end",
"def version_requested?\n @version_requested\n end",
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def all_formats_encoded?\n self.status=='Convertido' ? true : false\n end",
"def matches?(request)\n highest_mime = request.accepts.first\n if accept_allstar\n highest_mime ? mime_types.any? { |m| highest_mime == m } : true\n else\n mime_types.any? { |m| highest_mime == m }\n end\n end",
"def valid?\n @method == \"GET\" &&\n !@request_uri.empty? &&\n @http_version >= 1.1 &&\n @header[\"Upgrade\"] == \"websocket\" &&\n @header[\"Connection\"].include?(\"Upgrade\") &&\n Base64.decode64(@header[\"Sec-WebSocket-Key\"]).length == 16 &&\n @header[\"Sec-WebSocket-Version\"].to_i == 13\n end",
"def legacy_request?\n AedLegacy.legacy_year?(params[:year])\n end",
"def valid?\n return false if preservation_file.nil?\n (parent.try(:recording?) || parent.try(:image_resource?)) && supported_format?\n end",
"def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"def signatures_match?\n expected_signature == api_signature\n end",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def json?\n raw_options[:format] == :json\n end",
"def json?\n @gapi.source_format == \"NEWLINE_DELIMITED_JSON\"\n end",
"def has_valid_format?(record)\n return (is_date?(record.start_at) and is_date?(record.end_at))\n end",
"def content_type_is_json_but_invalid_json_provided?\n content_type_json? && ((request_body_required? || any_request_body?) && invalid_json?)\n end",
"def valid?\n return false if !@date_from.nil? && @date_from.to_s.length > 10\n return false if !@date_from.nil? && @date_from.to_s.length < 10\n return false if !@date_to.nil? && @date_to.to_s.length > 10\n return false if !@date_to.nil? && @date_to.to_s.length < 10\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length > 24\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length < 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length > 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length < 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length > 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length < 1\n return false if !@next_item_key.nil? && @next_item_key.to_s.length > 24\n return false if !@next_item_key.nil? && @next_item_key.to_s.length < 1\n true\n end",
"def errors?(supported_formats)\n # Verify that formats are specified\n if self[:format].nil? || self[:format].empty?\n return \"No formats specified\"\n end\n\n # Verify that the parser for each format exists\n self[:format].each do |format|\n return \"Format #{format} does not exist.\" unless supported_formats[format]\n end\n\n # Verify that tags exist\n return \"No tags specified\" if self[:rp_tags].nil?\n\n # Verify that arc names are in the proper format\n if self[:arc_name] && !self[:arc_name].respond_to?(\"each\")\n return \"arc_name must be blank or a YAML list\"\n end\n\n false\n end",
"def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end",
"def semantic_frame? f\n f.type == FrameTypes::DATA || f.type == FrameTypes::HEADERS || f.type == FrameTypes::CONTINUATION || f.type == FrameTypes::GZIPPED_DATA\n end",
"def html_format?()\n self.response_format == :html\n end",
"def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end",
"def is_iphone_format?\n request.format.to_sym == :iphone\n end",
"def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end",
"def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end",
"def formattable? format\n Hash.instance_methods.collect(&:to_sym).include? to_format(format)\n end",
"def binary?\n @format == 1\n end",
"def valid?(params)\n true\n end",
"def supports?\n !@version.nil?\n end",
"def valid?\n errors, _warnings = valid\n errors.empty? && unsupported.empty?\n end",
"def yadis_request?(request)\n (request.env['HTTP_ACCEPT'] && request.env['HTTP_ACCEPT'].include?('application/xrds+xml'))\n end",
"def human_format?\n @format == :human\n end",
"def valid?\n return false unless given_signature\n Relax::Query.unescape_value(correct_signature) == given_signature\n end",
"def compatible?(opts)\n opts == @options\n end",
"def valid?\n mode_validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n return false unless mode_validator.valid?(@mode)\n callback_method_validator = EnumAttributeValidator.new('String', [\"POST\", \"GET\"])\n return false unless callback_method_validator.valid?(@callback_method)\n fallback_method_validator = EnumAttributeValidator.new('String', [\"POST\", \"GET\"])\n return false unless fallback_method_validator.valid?(@fallback_method)\n true\n end",
"def valid?\n mp4_support_validator = EnumAttributeValidator.new('String', [\"none\", \"standard\"])\n return false unless mp4_support_validator.valid?(@mp4_support)\n master_access_validator = EnumAttributeValidator.new('String', [\"none\", \"temporary\"])\n return false unless master_access_validator.valid?(@master_access)\n true\n end",
"def matchers?(req)\n @default || req.headers['Accept'].include?(\"application/vnd.glass.v#{@version}\")\n end",
"def binary?\n %w[pdf epub epub3 odt docx].include? @format\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if !@description.nil? && @description.to_s.length > 255\n true\n end",
"def avro?\n @gapi.source_format == \"AVRO\"\n end",
"def valid?\n protocol_validator = EnumAttributeValidator.new('String', ['ip', 'icmp', 'igmp', 'ggp', 'tcp', 'pup', 'udp', 'idp', 'esp', 'nd', 'raw'])\n return false unless protocol_validator.valid?(@protocol)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['unknown', 'not-vulnerable', 'vulnerable', 'vulnerable-version', 'vulnerable-potential', 'vulnerable-with-exception-applied', 'vulnerable-version-with-exception-applied', 'vulnerable-potential-with-exception-applied'])\n return false unless status_validator.valid?(@status)\n true\n end",
"def mobile?\n return params[:format] == 'm'\n end"
] |
[
"0.740956",
"0.72072196",
"0.71073836",
"0.7099259",
"0.70763385",
"0.70394677",
"0.6995136",
"0.6861017",
"0.67506844",
"0.6710312",
"0.6658473",
"0.66120905",
"0.6594572",
"0.65910286",
"0.6570716",
"0.65319556",
"0.64721066",
"0.645837",
"0.6455793",
"0.6454077",
"0.64507806",
"0.6447109",
"0.64119583",
"0.64099514",
"0.64072865",
"0.64039725",
"0.64039725",
"0.64035326",
"0.63943434",
"0.63943434",
"0.63943434",
"0.63943434",
"0.63943434",
"0.6384396",
"0.63469714",
"0.6344927",
"0.63384587",
"0.63382965",
"0.63256025",
"0.63208747",
"0.6296388",
"0.62872875",
"0.62872875",
"0.6268297",
"0.62348205",
"0.62336355",
"0.6230867",
"0.62212247",
"0.6194671",
"0.6194671",
"0.61810863",
"0.61782503",
"0.6156604",
"0.6140483",
"0.612417",
"0.6120713",
"0.6114176",
"0.6107025",
"0.6104823",
"0.6102872",
"0.6086458",
"0.6085414",
"0.6084949",
"0.6082661",
"0.6081062",
"0.6074725",
"0.6073542",
"0.6072249",
"0.60628337",
"0.606126",
"0.6058224",
"0.60548717",
"0.6038258",
"0.60342115",
"0.6032614",
"0.60209405",
"0.60147464",
"0.59961444",
"0.5990781",
"0.5967282",
"0.59619415",
"0.5957341",
"0.5948818",
"0.5948818",
"0.5946296",
"0.59304893",
"0.5930037",
"0.59127086",
"0.59125143",
"0.5910188",
"0.59091437",
"0.5908578",
"0.59065735",
"0.5903602",
"0.590022",
"0.58887273",
"0.58814687",
"0.58808005",
"0.5861377",
"0.5859034",
"0.58567476"
] |
0.0
|
-1
|
Returns true if the format is compatible with the request.
|
def match?(request)
request.content_type =~ %r{^application/json.*}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_request?\n request.format.json? || request.format.js? || request.format.xml? || request.format.fbtab?\n end",
"def valid?\n valid_format? @format\n end",
"def supported?\n if is_simple_format?\n return true\n elsif is_advanced_format?\n return is_supported_advanced_format?\n else\n return false\n end\n end",
"def check_format\n # This allows us to support content negotiation\n if request.headers['HTTP_ACCEPT'].nil? || request.format == '*/*'\n request.format = 'xml'\n end\n\n request_format = request.format.symbol\n if request_format != :xml && request_format != :json\n # 406 is the default status code when the format is not support\n head :not_acceptable\n end\n end",
"def handable_format?\n @request.format.symbol.nil? || (@request.format.symbol == :html)\n end",
"def known_format?(f)\n FORMAT_TO_CONTENT_TYPE[f]\n end",
"def unsupported_format?\n case @format\n when *UNSUPPORTED_FORMATS then true\n else false\n end\n end",
"def verify_requested_format!\n mimes = collect_mimes_from_class_level\n collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)\n\n unless collector.negotiate_format(request)\n raise ActionController::UnknownFormat\n end\n end",
"def is_supported_format\n if zip? || csv?\n true\n else\n errors.add(:input, :unsupported_file_format)\n end\n end",
"def valid_file_format?\n VALID_FILE_FORMAT. include? uri_extension\n end",
"def matches?(request)\n request.headers.fetch(:accept).include?(\"application/vnd.pieforproviders.v#{version}+json\")\n end",
"def accept_header?\n return request.headers['Accept']&.include?('application/fhir+json') if params.permit(:_format)[:_format].nil?\n\n ['json', 'application/json', 'application/fhir+json'].include?(params.permit(:_format)[:_format]&.downcase)\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end",
"def valid?\n formats.count > 0\n end",
"def valid_readers_format?\n VALID_READER_FORMAT.include? uri_extension\n end",
"def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end",
"def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"def json_request?()\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def valid?\n image_resource? && supported_format?\n end",
"def api_version_match?\n ! api_version_negotiated.nil?\n end",
"def matches?(request)\n @default || request.headers['Accept'].include?(\"application/vnd.medexprimereemr.v#{@version}\")\n end",
"def format?\n # if :custom\n if self.conventional?\n :conventional\n elsif self.relaxed?\n :relax\n elsif self.redacted?\n :redacted\n elsif self.standard?\n :standard\n else\n :invalid\n end\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end",
"def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end",
"def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end",
"def valid?(format=@config[:local_format]||:conventional)\n if @config[:mailbox_validator].is_a?(Proc)\n @config[:mailbox_validator].call(self.mailbox, self.tag)\n elsif format.is_a?(Proc)\n format.call(self)\n elsif format == :conventional\n self.conventional?\n elsif format == :relaxed\n self.relaxed?\n elsif format == :redacted\n self.redacted?\n elsif format == :standard\n self.standard?\n elsif format == :none\n true\n else\n raise \"Unknown format #{format}\"\n end\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def compatible_with?(sub_request)\n CompatibilityEngine.compute_compatibility(self, sub_request)\n end",
"def check_request_format\n unless request.content_type == 'application/json'\n error = ErrorSerializer.serialize({ format: \"Invalid request format. Only JSON requests are supported.\" })\n render json: error, status: :unsupported_media_type\n end\n end",
"def valid_format?(fmt)\n format_string_has_v_or_d?(fmt)\n format_string_does_not_have_v_and_d?(fmt)\n format_string_is_all_valid_chars?(fmt)\n format_string_has_unique_chars?(fmt)\n format_string_has_big_t_only_at_the_end?(fmt)\n end",
"def valid?\n return false if @format.nil?\n format_validator = EnumAttributeValidator.new('String', [\"mp4\", \"gif\", \"mp3\", \"jpg\", \"png\", \"bmp\"])\n return false unless format_validator.valid?(@format)\n resolution_validator = EnumAttributeValidator.new('String', [\"preview\", \"mobile\", \"sd\", \"hd\", \"1080\"])\n return false unless resolution_validator.valid?(@resolution)\n aspect_ratio_validator = EnumAttributeValidator.new('String', [\"16:9\", \"9:16\", \"1:1\", \"4:5\", \"4:3\"])\n return false unless aspect_ratio_validator.valid?(@aspect_ratio)\n fps_validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])\n return false unless fps_validator.valid?(@fps)\n scale_to_validator = EnumAttributeValidator.new('String', [\"preview\", \"mobile\", \"sd\", \"hd\", \"1080\"])\n return false unless scale_to_validator.valid?(@scale_to)\n quality_validator = EnumAttributeValidator.new('String', [\"low\", \"medium\", \"high\"])\n return false unless quality_validator.valid?(@quality)\n true\n end",
"def compatible?(other)\n false\n end",
"def compatible?(subject, schema, version = 'latest')\n response = post \"/compatibility/subjects/#{subject}/versions/#{version}\",\n expects: [200, 404],\n body: { schema: schema.to_s }\n data = response.to_json\n data.fetch('is_compatible', false) unless data.key?('error_code')\n end",
"def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"DOCUMENT\", \"FAX\", \"RECORDING\"]\n if @system_type && !allowed_values.include?(@system_type)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"SINGLE_PUT\", \"MULTIPART_POST\"]\n if @upload_method && !allowed_values.include?(@upload_method)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"NONE\", \"LIMITED\", \"PUBLIC\"]\n if @sharing_status && !allowed_values.include?(@sharing_status)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def json_supported?\n version_supported?('10.5.0', '5.7.22')\n end",
"def has_mime_version?\n header.has_mime_version?\n end",
"def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def standard?\n self.syntax = :invalid\n self.valid_size? or return false\n self.valid_encoding? or return false\n if self.local =~ STANDARD_LOCAL_REGEX\n self.syntax = :standard\n true\n else\n false\n end\n end",
"def has_file_format?\n @file_format\n end",
"def json_input?\n return request.content_type == 'application/json'\n end",
"def content_type_header?\n request.headers['Content-Type']&.include?('application/fhir+json')\n end",
"def valid?\n html_version_validator = EnumAttributeValidator.new('String', [\"Xhtml\", \"Html5\"])\n return false unless html_version_validator.valid?(@html_version)\n metafile_format_validator = EnumAttributeValidator.new('String', [\"Png\", \"Svg\", \"EmfOrWmf\"])\n return false unless metafile_format_validator.valid?(@metafile_format)\n office_math_output_mode_validator = EnumAttributeValidator.new('String', [\"Image\", \"MathML\", \"Text\"])\n return false unless office_math_output_mode_validator.valid?(@office_math_output_mode)\n return true\n end",
"def invalid_format?(format)\n return true unless FORMATS.include?(format)\n end",
"def versionable?\n !respond_to?(:is_standard?) || !is_standard?\n end",
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def has_mime_version?\n !fields.select { |f| f.responsible_for?('Mime-Version') }.empty?\n end",
"def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@url.nil? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if !@description.nil? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end",
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def version_requested?\n @version_requested\n end",
"def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end",
"def all_formats_encoded?\n self.status=='Convertido' ? true : false\n end",
"def matches?(request)\n highest_mime = request.accepts.first\n if accept_allstar\n highest_mime ? mime_types.any? { |m| highest_mime == m } : true\n else\n mime_types.any? { |m| highest_mime == m }\n end\n end",
"def valid?\n @method == \"GET\" &&\n !@request_uri.empty? &&\n @http_version >= 1.1 &&\n @header[\"Upgrade\"] == \"websocket\" &&\n @header[\"Connection\"].include?(\"Upgrade\") &&\n Base64.decode64(@header[\"Sec-WebSocket-Key\"]).length == 16 &&\n @header[\"Sec-WebSocket-Version\"].to_i == 13\n end",
"def legacy_request?\n AedLegacy.legacy_year?(params[:year])\n end",
"def valid?\n return false if preservation_file.nil?\n (parent.try(:recording?) || parent.try(:image_resource?)) && supported_format?\n end",
"def signatures_match?\n expected_signature == api_signature\n end",
"def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def json?\n raw_options[:format] == :json\n end",
"def json?\n @gapi.source_format == \"NEWLINE_DELIMITED_JSON\"\n end",
"def has_valid_format?(record)\n return (is_date?(record.start_at) and is_date?(record.end_at))\n end",
"def content_type_is_json_but_invalid_json_provided?\n content_type_json? && ((request_body_required? || any_request_body?) && invalid_json?)\n end",
"def valid?\n return false if !@date_from.nil? && @date_from.to_s.length > 10\n return false if !@date_from.nil? && @date_from.to_s.length < 10\n return false if !@date_to.nil? && @date_to.to_s.length > 10\n return false if !@date_to.nil? && @date_to.to_s.length < 10\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length > 24\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length < 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length > 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length < 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length > 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length < 1\n return false if !@next_item_key.nil? && @next_item_key.to_s.length > 24\n return false if !@next_item_key.nil? && @next_item_key.to_s.length < 1\n true\n end",
"def errors?(supported_formats)\n # Verify that formats are specified\n if self[:format].nil? || self[:format].empty?\n return \"No formats specified\"\n end\n\n # Verify that the parser for each format exists\n self[:format].each do |format|\n return \"Format #{format} does not exist.\" unless supported_formats[format]\n end\n\n # Verify that tags exist\n return \"No tags specified\" if self[:rp_tags].nil?\n\n # Verify that arc names are in the proper format\n if self[:arc_name] && !self[:arc_name].respond_to?(\"each\")\n return \"arc_name must be blank or a YAML list\"\n end\n\n false\n end",
"def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end",
"def semantic_frame? f\n f.type == FrameTypes::DATA || f.type == FrameTypes::HEADERS || f.type == FrameTypes::CONTINUATION || f.type == FrameTypes::GZIPPED_DATA\n end",
"def html_format?()\n self.response_format == :html\n end",
"def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end",
"def is_iphone_format?\n request.format.to_sym == :iphone\n end",
"def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end",
"def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end",
"def formattable? format\n Hash.instance_methods.collect(&:to_sym).include? to_format(format)\n end",
"def binary?\n @format == 1\n end",
"def valid?(params)\n true\n end",
"def supports?\n !@version.nil?\n end",
"def valid?\n errors, _warnings = valid\n errors.empty? && unsupported.empty?\n end",
"def yadis_request?(request)\n (request.env['HTTP_ACCEPT'] && request.env['HTTP_ACCEPT'].include?('application/xrds+xml'))\n end",
"def valid?\n return false unless given_signature\n Relax::Query.unescape_value(correct_signature) == given_signature\n end",
"def human_format?\n @format == :human\n end",
"def compatible?(opts)\n opts == @options\n end",
"def valid?\n mode_validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n return false unless mode_validator.valid?(@mode)\n callback_method_validator = EnumAttributeValidator.new('String', [\"POST\", \"GET\"])\n return false unless callback_method_validator.valid?(@callback_method)\n fallback_method_validator = EnumAttributeValidator.new('String', [\"POST\", \"GET\"])\n return false unless fallback_method_validator.valid?(@fallback_method)\n true\n end",
"def valid?\n mp4_support_validator = EnumAttributeValidator.new('String', [\"none\", \"standard\"])\n return false unless mp4_support_validator.valid?(@mp4_support)\n master_access_validator = EnumAttributeValidator.new('String', [\"none\", \"temporary\"])\n return false unless master_access_validator.valid?(@master_access)\n true\n end",
"def matchers?(req)\n @default || req.headers['Accept'].include?(\"application/vnd.glass.v#{@version}\")\n end",
"def binary?\n %w[pdf epub epub3 odt docx].include? @format\n end",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if !@description.nil? && @description.to_s.length > 255\n true\n end",
"def avro?\n @gapi.source_format == \"AVRO\"\n end",
"def valid?\n protocol_validator = EnumAttributeValidator.new('String', ['ip', 'icmp', 'igmp', 'ggp', 'tcp', 'pup', 'udp', 'idp', 'esp', 'nd', 'raw'])\n return false unless protocol_validator.valid?(@protocol)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['unknown', 'not-vulnerable', 'vulnerable', 'vulnerable-version', 'vulnerable-potential', 'vulnerable-with-exception-applied', 'vulnerable-version-with-exception-applied', 'vulnerable-potential-with-exception-applied'])\n return false unless status_validator.valid?(@status)\n true\n end",
"def mobile?\n return params[:format] == 'm'\n end"
] |
[
"0.74071974",
"0.7205271",
"0.7106237",
"0.7098738",
"0.70754445",
"0.7038768",
"0.6993981",
"0.68613726",
"0.6749574",
"0.6709443",
"0.6658076",
"0.6611499",
"0.6593686",
"0.65888673",
"0.65700245",
"0.65303874",
"0.64698374",
"0.6455498",
"0.645291",
"0.64527124",
"0.64496416",
"0.64454496",
"0.6411397",
"0.6409953",
"0.64069015",
"0.640248",
"0.640248",
"0.64021075",
"0.639159",
"0.639159",
"0.639159",
"0.639159",
"0.639159",
"0.6382935",
"0.63459533",
"0.6343456",
"0.6338065",
"0.6338021",
"0.632646",
"0.629527",
"0.628494",
"0.628494",
"0.6267186",
"0.6232599",
"0.6232367",
"0.6230297",
"0.6219295",
"0.6192257",
"0.6192257",
"0.6179937",
"0.61766595",
"0.6154147",
"0.61389893",
"0.61233336",
"0.6118504",
"0.61135006",
"0.61042166",
"0.6103772",
"0.6101468",
"0.6084003",
"0.608366",
"0.6083556",
"0.60817564",
"0.6080728",
"0.6072703",
"0.6071978",
"0.60706294",
"0.6060389",
"0.60600203",
"0.60580134",
"0.6052764",
"0.6035833",
"0.60324085",
"0.60305387",
"0.60179615",
"0.6012551",
"0.5993997",
"0.5988721",
"0.59657407",
"0.5959587",
"0.59564763",
"0.594843",
"0.594843",
"0.594479",
"0.59290695",
"0.5927876",
"0.59115094",
"0.59103",
"0.5909172",
"0.59082824",
"0.59079397",
"0.59049577",
"0.5901288",
"0.5899035",
"0.5888224",
"0.5880385",
"0.58798176",
"0.586071",
"0.58573323",
"0.5856184"
] |
0.6319554
|
39
|
Always matches. This is why this format needs to be the last to be registered so more specific formats are before it.
|
def match?(_request)
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _process_format(format); end",
"def _process_format(format); end",
"def format_regex\n callback.options[:live_validator] || callback.options[:with]\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def _process_format(format) # :nodoc:\n end",
"def formats; end",
"def formats; end",
"def match(pattern); end",
"def format?\n # if :custom\n if self.conventional?\n :conventional\n elsif self.relaxed?\n :relax\n elsif self.redacted?\n :redacted\n elsif self.standard?\n :standard\n else\n :invalid\n end\n end",
"def parse_format(format)\n format = format.to_s\n format.chomp! # remove carriage return\n format.strip! # remove leading and trailing space\n format.gsub!(/[ \\t]+/, ' ') # replace tabulations or spaces with a space\n\n pattern = format.split(' ').map do |element|\n has_quotes = element =~ /^\\\\\"/\n element = element.gsub(/^\\\\\"/, '').gsub(/\\\\\"$/, '') if has_quotes\n\n self.names << rename_this_name(element)\n\n case\n when has_quotes\n if element == '%r' || element =~ /^%{Referer}/ || element =~ /^%{User-agent}/\n /\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"/\n else\n '\\\"([^\\\"]*)\\\"'\n end\n when element =~ /^%.*t$/\n '(\\[[^\\]]+\\])'\n when element == '%U'\n '(.+?)'\n else\n '(\\S*)'\n end\n end.join(' ')\n\n @regexp = Regexp.new(\"^#{pattern}$\")\n format\n end",
"def detect(content)\n @@registered_formats.detect do |format|\n format.valid?(content)\n end\n end",
"def page_formats_contraint\n Regexp.new page_formats * '|'\n end",
"def pre_match() end",
"def fullmatch(re)\n format(:color => false).match(re)\n end",
"def allow_matcher; end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def registered_formats\n @@registered_formats\n end",
"def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end",
"def matched\n match.to_s if matched?\n end",
"def fm_date_to_regexp(fm_format)\n @date_regexp[fm_format] ||= \n Regexp.new('\\A' + fm_format.gsub(FM_DATETIME_FORMAT_MATCHER, FM_DATE_TO_REGEXP_SUBSTITUTIONS) + '\\Z').freeze\n end",
"def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end",
"def validates_format_of(*attr_names)\n configuration = {:on => :publish,:message=>\"has invalid format\"}\n configuration.update(attr_names.extract_options!)\n \n format_errors = []\n \n datastream_name, fields = attr_names\n\n raise(ArgumentError, \"A regular expression must be supplied as the :with option of the configuration hash\") unless configuration[:with].is_a?(Regexp)\n\n values = self.datastreams[datastream_name].get_values(fields)\n if !values.empty? && !values.first.empty?\n values.each_with_index do |val,index|\n match = val.match(configuration[:with])\n next if match\n format_errors << construct_message(datastream_name,fields,configuration[:message])\n end\n end\n format_errors.each {|e| self.errors << e }\n\n format_errors.empty?\n end",
"def formats_idx; end",
"def whitelist_print_format(candidate)\n WHITELISTED_PRINT_FORMATS.find{ |format| format == candidate }\n end",
"def matches\n parse\n end",
"def on_format?(str)\n str.start_with?('on_')\n end",
"def format\n @spec[:format]\n end",
"def format_format(raw)\n raw ||= \"N/A\"\n\n if raw.include? \"Taschenbuch\"\n result = \"Paperback\"\n elsif result == \"N/A\"\n result = raw\n else\n result = \"Something else\"\n end\nend",
"def matches(_ext)\n true\n end",
"def parse_format(format)\n format = format.to_s\n format.chomp! # remove carriage return\n format.strip! # remove leading and trailing space\n format.gsub!(/[ \\t]+/, ' ') # replace tabulations or spaces with a space\n\n strip_quotes = proc { |string| string.gsub(/^\\\\\"/, '').gsub(/\\\\\"$/, '') }\n find_quotes = proc { |string| string =~ /^\\\\\"/ } \n find_percent = proc { |string| string =~ /^%.*t$/ }\n find_referrer_or_useragent = proc { |string| string =~ /Referer|User-Agent/ }\n \n pattern = format.split(' ').map do |element|\n has_quotes = !!find_quotes.call(element)\n element = strip_quotes.call(element) if has_quotes\n \n self.names << rename_this_name(element)\n\n case\n when has_quotes\n if element == '%r' or find_referrer_or_useragent.call(element)\n /\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"/\n else\n '\\\"([^\\\"]*)\\\"'\n end\n when find_percent.call(element)\n '(\\[[^\\]]+\\])'\n when element == '%U'\n '(.+?)'\n else\n '(\\S*)'\n end\n end.join(' ')\n\n @regexp = Regexp.new(\"^#{pattern}$\")\n format\n end",
"def invalid_format?(format)\n return true unless FORMATS.include?(format)\n end",
"def matches(_ext); end",
"def matches(_ext); end",
"def matches?(pattern); end",
"def matcher_name; end",
"def matcher_name; end",
"def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end",
"def pre_match\n end",
"def match; end",
"def match; end",
"def matcher; end",
"def matcher; end",
"def post_match() end",
"def valid_format?(fmt)\n format_string_has_v_or_d?(fmt)\n format_string_does_not_have_v_and_d?(fmt)\n format_string_is_all_valid_chars?(fmt)\n format_string_has_unique_chars?(fmt)\n format_string_has_big_t_only_at_the_end?(fmt)\n end",
"def known_format?(f)\n FORMAT_TO_CONTENT_TYPE[f]\n end",
"def start_re; end",
"def regexp\n pattern = '(?:' + Regexp.union([@name] + @aliases).source + ')'\n\n @arguments.each_value do |format|\n arg_regexp = case format\n when Array then Regexp.union(format)\n when Regexp then format\n when Symbol then ARG_FORMATS.fetch(format)\n else Regexp.escape(format.to_s)\n end\n\n pattern << ' (' << arg_regexp.source << ')'\n end\n\n # match the full message\n pattern << '$'\n\n return Regexp.new(pattern)\n end",
"def match(regexp)\n return regexp.match(pickle_format)\n end",
"def define_format_helpers global_formats, strict_formats\n (all_formats = (global_formats + strict_formats.map {|s| s.last}.flatten).uniq)\n (all_formats = Hash[all_formats.zip(all_formats)]).each_key do |f|\n method_name = '%s?' % f.sub('.', '')\n define_method method_name do\n # Hash searching is a lot faster than String comparison\n all_formats[format]\n end\n private method_name\n end\n end",
"def test_match_resolution\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\")\n assert_equal(false, new_str)\n \n exc_handler.add_human_result_for_string(\"foobar\",\"ParseException\",\"FOOBAR\")\n assert_equal(\"FOOBAR\",exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\"))\n end",
"def load_format(format)\n case format.to_s\n when /(md|mkdn?|mdown|markdown)$/i\n :markdown\n when /(textile)$/i\n :textile\n when /(rdoc)$/i\n :rdoc\n when /(org)$/i\n :org\n when /(creole)$/i\n :creole\n when /(re?st(\\.txt)?)$/i\n :rest\n when /(asciidoc)$/i\n :asciidoc\n when /(pod)$/i\n :pod\n when /(\\d)$/i\n :roff\n when /(media)?wiki$/i\n :mediawiki\n else\n nil\n end\n end",
"def register(format)\n @@registered_formats << format\n end",
"def valid?\n formats.count > 0\n end",
"def formats\n @formats ||= mapping.keys.sort\n end",
"def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end",
"def match_captures; end",
"def whitelist_email_format(candidate)\n WHITELISTED_EMAIL_FORMATS.find{ |format| format == candidate }\n end",
"def matches(ext); end",
"def match()\n end",
"def test_registration\n DocTemplate.register_format Object, 'ext1', 'ext2'\n assert_equal Object, DocTemplate::FORMATS['ext1']\n assert_equal Object, DocTemplate::FORMATS['ext2']\n end",
"def add_format format\n if format && !@formats_set[format]\n @formats_set[format] = true\n @formats.push(format)\n end\n format\n end",
"def exactize pattern\r\n pattern.include?(':') ? \"exact:#{pattern}\" : pattern\r\n end",
"def formats\n format\n end",
"def check_acceptable_format\n raise ActiveRecord::RecordNotFound if [\"txt\", \"png\"].include?(params[:format] )\n end",
"def formats=(extensions); end",
"def check_acceptable_format\n if [\"txt\", \"png\"].include?(params[:format])\n params[:format] = nil\n raise ActiveRecord::RecordNotFound.new\n end\n end",
"def initialize(format)\n @regexp = nil\n @names = []\n @format = parse_format(format)\n end",
"def add_format(format)\n\n unless Mime::Type.lookup_by_extension format\n\n raise ArgumentError, \"Please register the #{format} mime type with `Mime::Type.register`\"\n\n end\n\n @formats << format unless formats.include? format\n\n formats\n\n end",
"def normalize_matching(default = :pattern)\n case self\n when /^f/i\n :fuzzy\n when /^p/i\n :pattern\n when /^e/i\n :exact\n else\n default.is_a?(Symbol) ? default : default.normalize_matching\n end\n end",
"def validates_format_of(*args)\n validates_with(FormatValidator, _merge_attributes(args))\n end",
"def guess_date_format\n begin\n line = @data.gets\n break if line.nil?\n\n date = line[1..-1]\n guessed_format = Qif::DateFormat::SUPPORTED_DATEFORMAT.find { |format_string, format|\n test_date_with_format?(date, format_string, format)\n }\n end until guessed_format\n\n @data.rewind\n\n guessed_format ? guessed_format.first : @fallback_format\n end",
"def validate_format(attribute_name, format, message = nil)\n value = attributes[attribute_name]\n if value && !(format =~ value)\n append_error(attribute_name, message || :is_invalid)\n end\n end",
"def format\n @format ||= self._format_default\n end",
"def with_format(format)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end",
"def process_path_for_respond_to(path, format_params)\n format_suffix = case format_params\n when :any then \"(.:format)\"\n when Array then\n formats = format_params.dup # Prevent changes to HEAD verb\n container = formats.delete(:html) ? \"(%s)\" : \"%s\"\n match = \".{:format,\" + formats.collect { |f| \"#{f}$\" }.join(\"|\") + \"}\"\n container % match\n else \".{:format,#{format_params}}\"\n end\n path + format_suffix\n end",
"def format\n @format ||= (\n if read\n fmt = self.class.supported_formats.find{ |fm| fm.match?(path, read) }\n raise IOError, \"Version file matches no known format.\"\n else\n PlainFormat\n end\n )\n end",
"def format *formats\n format! *formats << true\n end",
"def allowed_format(fmt = nil, note = nil, only:)\n fmt, note = [nil, fmt] if fmt.is_a?(String)\n only = Array.wrap(only).compact\n only = TEST_FORMATS if only.blank? || only.include?(:all)\n return true if fmt.nil? && Array.wrap(only).intersect?(TEST_FORMATS)\n return true if Array.wrap(only).intersect?(Array.wrap(fmt))\n format = 'format'\n only = only.first if only.is_a?(Array) && !only.many?\n msg = ['TEST SKIPPED']\n\n if fmt.nil?\n format = format.pluralize if only.is_a?(Array)\n msg << \"ONLY APPLICABLE for #{only.inspect} #{format}\"\n\n elsif only.is_a?(Array)\n format = format.pluralize if fmt.is_a?(Array) && fmt.many?\n msg << 'NOT APPLICABLE'\n msg << \"#{format} #{fmt.inspect} not in #{only.inspect}\"\n\n elsif fmt.is_a?(Array)\n format = format.pluralize if only.is_a?(Array)\n msg << \"ONLY APPLICABLE for #{only.inspect} #{format}\"\n\n else\n msg << \"NOT APPLICABLE for #{fmt.inspect} #{format}\"\n end\n\n $stderr.puts [*msg, note].compact.join(' - ')\n false\n end",
"def supported?\n if is_simple_format?\n return true\n elsif is_advanced_format?\n return is_supported_advanced_format?\n else\n return false\n end\n end",
"def pre_match\n nil\n end",
"def process_path_for_provides(path)\n path << \"(.:format)?\" unless path[-11, 11] == '(.:format)?'\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def matches?(target)\n @target = target\n provided_formats.include?( @expected )\n end",
"def allowed_formats (*formats)\n\t\tunless formats.empty?\n\t\t\traise_if_error C.glyr_opt_allowed_formats(to_native, formats.flatten.compact.uniq.join(';'))\n\t\telse\n\t\t\tto_native[:allowed_formats] && to_native[:allowed_formats].split(/\\s*;\\s*/)\n\t\tend\n\tend",
"def pattern_match?\n @pattern_match\n end",
"def formats\n @@formats\n end",
"def match\n true\n end",
"def remove_us_formats\n us_format_regexp = /\\Am{1,2}[^m]/\n date_formats.reject! { |format| us_format_regexp =~ format }\n datetime_formats.reject! { |format| us_format_regexp =~ format }\n compile_format_expressions\n end",
"def formats=(values); end",
"def match?\n false\n end",
"def on_match_pattern(node); end",
"def initialize(format)\n @regexp = nil\n @names = []\n @format = parse_format(format)\n end",
"def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end",
"def match parser, index\r\n raise \"Must override match\"\r\n end",
"def register_format(ext, mime)\n FORMATS[ext.to_s] = mime\n end",
"def supported_formats\n # WARNING: This shit won't be documented or even properly tested. It's almost 3 in the morning and I have no idea what I'm doing.\n header_index = output.index('format code')\n return nil if header_index.nil?\n\n formats = []\n output.slice(header_index..-1).split(\"\\n\").each do |line|\n format = {}\n format[:format_code], format[:extension], format[:resolution], format[:note] = line.scan(/\\A(\\d+)\\s+(\\w+)\\s+(\\S+)\\s(.*)/)[0]\n formats.push format\n end\n formats.shift # The first line is just headers\n return [] if formats.first.nil?\n formats.map do |format|\n format[:note].strip! # Get rid of any trailing whitespace on the note.\n format[:format_code] = format[:format_code].to_i # convert format code to integer\n format\n end\n end",
"def detect_format\n # @templates contains Array of Hashes. Example:\n # [{name: \"\"blog-web-prod.json\", block: ...},\n # {name: \"\"api-web-prod.json\", block: ...}]\n formats = @templates.map{ |t| File.extname(t[:name]) }.uniq\n if formats.size > 1\n puts \"ERROR: Detected multiple formats: #{formats.join(\", \")}\".colorize(:red)\n puts \"All the source values in the template blocks in the config folder must have the same format extension.\"\n exit 1\n else\n found_format = formats.first\n if found_format\n detected_format = found_format.sub(/^\\./,'')\n detected_format = \"yaml\" if detected_format == \"yml\"\n else # empty templates, no templates defined yet\n detected_format = \"yaml\" # defaults to yaml\n end\n end\n detected_format\n end",
"def negotiate_mime(order)\n formats.each do |priority|\n if priority == Mime::ALL\n return order.first\n elsif order.include?(priority)\n return priority\n end\n end\n\n order.include?(Mime::ALL) ? format : nil\n end",
"def all_names(format)\n alts = alternates.select { |a| a.include? format }.flatten\n alts.any? ? alts : [format]\n end",
"def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end"
] |
[
"0.6311319",
"0.6311319",
"0.5991302",
"0.5917165",
"0.5873941",
"0.5853508",
"0.5853508",
"0.5838249",
"0.5810381",
"0.5775825",
"0.5751575",
"0.5711792",
"0.56921726",
"0.5679681",
"0.564781",
"0.5601195",
"0.5601195",
"0.55796075",
"0.5553737",
"0.5508502",
"0.5498242",
"0.54943883",
"0.5485298",
"0.54762805",
"0.547431",
"0.54601526",
"0.54419994",
"0.5429737",
"0.54258275",
"0.54195046",
"0.54187506",
"0.5410283",
"0.53902",
"0.53902",
"0.53790474",
"0.5347264",
"0.5347264",
"0.5346221",
"0.5341514",
"0.5340845",
"0.5340845",
"0.533851",
"0.533851",
"0.5337727",
"0.53361934",
"0.53282845",
"0.53274983",
"0.53158474",
"0.5312869",
"0.5311956",
"0.53081536",
"0.53067875",
"0.5306035",
"0.53025156",
"0.53008413",
"0.53005564",
"0.52987593",
"0.52822393",
"0.5279344",
"0.5272429",
"0.5267627",
"0.526477",
"0.5248767",
"0.524749",
"0.52301097",
"0.52234876",
"0.5222129",
"0.5208368",
"0.5204422",
"0.52041906",
"0.5201562",
"0.5157623",
"0.5153604",
"0.51515144",
"0.5149525",
"0.5147036",
"0.5143166",
"0.51419485",
"0.5140827",
"0.5130997",
"0.5129043",
"0.51219195",
"0.5112925",
"0.51093954",
"0.51083386",
"0.5108268",
"0.5090825",
"0.5071202",
"0.5068725",
"0.50647885",
"0.5064495",
"0.506261",
"0.5060418",
"0.50582874",
"0.50570065",
"0.5053813",
"0.5045686",
"0.50438476",
"0.5031788",
"0.50272685",
"0.5026109"
] |
0.0
|
-1
|
GET /login GET /sessions/new
|
def new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @session = Session.new\n\n render 'sessions/login'\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @session }\n # end\n end",
"def new #login page\n end",
"def new\n if !session[:id] && !session[:token]\n redirect_to({controller:'users', action:'signin'})\n end\n end",
"def new\n attempt_login\n redirect_to root_path if logged_in?\n end",
"def new\n @session = Session.new(params[:login])\n\n @page_name = \"Login\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @session }\n end\n end",
"def new\n redirect_to(login_path)\n end",
"def new\n if current_user\n redirect_to root_url\n end\n @user_session = UserSession.new\n end",
"def new\n if current_user\n redirect_to(:action=>'logged_in')\n else\n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end\n\n end",
"def new\n # render login page\n end",
"def new_session_path(arg)\n login_path\n end",
"def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def login\n \t@controller = SessionsController.new\n\tuser = User.create(name: \"Aslyn\", email: \"a@yahoo.com\", password: \"123456\", password_confirmation: \"123456\")\n\tpost :new, :email => \"a@yahoo.com\", :password => \"123456\"\n end",
"def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end",
"def new\n @user_session = UserSession.new\n\n respond_to do |format|\n if current_user\n format.html { redirect_to :users }\n format.json { redirect_to :users }\n else\n format.html # new.html.erb\n format.json { render :json => @user_session }\n end\n end\n end",
"def new\n if(params[\"session\"] == 'nil')\n session[:mailid] = nil\n end\n @loginuser = Loginuser.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loginuser }\n end\n \n end",
"def new\n\n @user = User.new\n\n if params[:redirect_to]\n if !logged_in?\n store_location(params[:redirect_to])\n else\n redirect_to params[:redirect_to]\n return\n end\n end\n\n ss_render_template(:try => 'index', :or => 'sessions/new',\n :assigns => {:user => @user,\n :sso_site => @sso_selected_site})\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n end\n end",
"def new\n @user_session ||= UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_session }\n end\n end",
"def new\n @session = User::Session.new\n end",
"def login\n # delete the session from their last login attempt if still there\n session.delete(:auth) unless session[:auth].nil?\n @login_form = LoginForm.new\n end",
"def new\n @login = Login.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @login }\n end\n end",
"def new\n redirect_to root_path if logged_in?\n end",
"def new\n\n respond_to do |format|\n format.html\n format.json {render json: 'login'}\n end\n end",
"def new\n\n respond_to do |format|\n format.html\n format.json {render json: 'login'}\n end\n end",
"def new \n unless current_user.nil?\n redirect_to backend_root_url\n return\n end\n \n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end",
"def create\n counter_fixation # Counter session fixation (but save forwarding url)\n if Rails.application.config.deny_login\n flash.now[:danger] = t('sessions.login_disabled')\n render 'new', status: :forbidden\n elsif request.env['omniauth.auth'].present?\n omniauth_login\n elsif params[:session][:provider] == 'local'\n local_login\n else\n flash.now[:danger] = t('sessions.incorrect_login_info')\n render 'new'\n end\n end",
"def new\n render :new\n endl\n\n def create\n user = User.find_by_credentials(\n params[:user][:user_name],\n params[:user][:password]\n )\n\n if user.nil?\n flash.now[:errors] = [\"Invalid username or password\"]\n render :new\n else\n login!(user)\n redirect_to cats_url\n end\n end\n\n def destroy\n logout!\n redirect_to new_session_url\n end\n\nend",
"def redirect\n\t\trender 'sessions/new'\n\tend",
"def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end",
"def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end",
"def login \n @user = User.new\n @current_uri = request.env['PATH_INFO']\n render \"users/new\", :layout => \"signup_login\"\n end",
"def create\n @login = Login.new(params)\n @session = @login.authenticate_user\n\n if not @session\n respond_to do |format|\n handle_create_error(\"Invalid credentials. Please try again!\", format)\n end\n\n return\n end\n\n respond_to do |format|\n if @session.save\n @session.put_in_cookie(cookies)\n flash[:notice] = 'Hello ' + @session.user_name\n format.html { redirect_to(@session) }\n format.xml { render :action => \"show\", :status => :created, :location => @session }\n else\n handle_create_error(\"There was a problem logging in. Please try again.\", format)\n end\n end\n end",
"def new\n # If someone is already logged in, skip this step\n login(current_user) and return if logged_in?\n end",
"def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end",
"def new\n if params[:create_user] == '1' or session[:id]\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else\n flash[:error] = \"You will need to Sign In to view this page.\"\n redirect_to :controller => 'system', :action => 'index'\n end\n end",
"def new\n redirect_to games_url if user_session.logged_in?\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\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def index\n redirect_to(new_session_path)\n end",
"def create\n action = LogUserIn.new :web\n\n if user = action.run(params[:login], params[:password])\n previous_path = session[:login_redirect_to]\n\n reset_session\n cookies[:web_session_token] = {\n value: user.login_token(:web),\n httponly: true\n }\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end",
"def new\n p session\n if session[:user].nil? \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else \n respond_to do |format|\n format.html { redirect_to_back }\n format.json { head :ok }\n end\n end\n \n \n end",
"def new\n\n if User.find_by_id(session[:user_id])\n redirect_to users_url, :notice => \"You are already signed in\"\n else\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end\n\n end",
"def create\n u = params[:username]\n p = params[:password]\n user_session = UserSession.new(:login => u, :password => p, :remember_me => true)\n if not user_session.save then\n return render :text => \"error\", :status => 401\n end\n\n ret = { :user => User.find_by_username_or_email(user_session.login) }\n ret[:redir] = URI.parse(session.delete(:return_to)).path if session.include? :return_to\n restful ret\n end",
"def new\n @session = Session.new('')\n end",
"def login\n @user = User.find_by_email(params[:email])\n if @user.password == params[:password]\n session[:id] = @user.id\n session[:visit] = 0\n redirect \"users/#{@user.id}/feed\"\n else\n redirect '/'\n end\nend",
"def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\n end",
"def login\n if session[:user] != nil then\n logged_in_home_page = home_index_path\n respond_to do |format|\n format.html { redirect_to logged_in_home_page}\n format.json { head :no_content }\n end\n return\n end\n\n @user = User.new\n \n respond_to do |format|\n format.html # login.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n\t\t@user_session = UserSession.new\n\tend",
"def new\n redirect_to(root_path) if cookies[COOKIE]\n @post_login_redirect_uri = params[:post_login_redirect_uri]\n end",
"def login\n # show LOGIN form\n\n end",
"def new_session_path(_scope)\n login_path\n end",
"def create\n unless current_user_session.nil?\n redirect_to root_url, :notice => \"You are already logged in.\"\n return\n end\n @user_session = UserSession.new(params[:user_session])\n\n if @user_session.save\n redirect_to(@user_session.user, :notice => \"Login successful. Welcome!\") \n else\n render :action => \"new\" \n end\n end",
"def new\n debugger\n flash[:failure_provider] = request.env['omniauth.error.strategy'].name\n flash[:failre_type] = request.env['omniauth.error.type']\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def create\n user = User.find_by_login(params[:session][:login])\n if user && user.authenticate(params[:session][:password])\n sign_in user\n redirect_back_or user_path(user.login)\n else\n flash.now[:error] = \"Ungültige Passwort / Login Kombination\"\n render 'new'\n end\n end",
"def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end",
"def login(username, password)\n open_session do |sess|\n# If we want to emulate https\n# sess.https!\n sess.post_via_redirect \"/sessions\", \"session[login_name]\" => username, \"session[password]\" => password\n assert_equal '/', sess.path\n assert_equal Constants::LOGGED_IN_NOTICE, sess.flash[:notice]\n# Unemulate https\n# sess.https!(false)\n end\n end",
"def new\n \t if !session[:user_id]\n\t\tredirect_to :action=> 'login'\n\t else\n @gebruiker = Gebruiker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gebruiker }\n end\n end\nend",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def new\n auth_hash = request.env['omniauth.auth']\n session[:auth_provider] = auth_hash[:provider]\n\n # look up auth_field, auth_value of User by provider, from config/initializers/omniauth.rb\n # Currently CAS is our only provider\n auth_config = ResearchMatch::Application.config.auth_providers[session[:auth_provider].to_sym]\n if auth_config\n auth_field = auth_config[:auth_field].to_s\n auth_value = auth_hash[auth_config[:auth_value]].to_s\n session[:auth_field] = auth_field\n session[:auth_value] = auth_value\n else\n flash[:error] = \"There were problems identifying your auth provider. Please try again or contact support.\"\n redirect_to home_path\n return\n end\n\n\n user = User.where(auth_field => auth_value).first\n if user.present?\n UserSession.new(user).save\n session[:user_id] = user.id # TODO remove (use only @user_session)\n redirect_to dashboard_path\n else\n if session[:auth_provider].to_sym == :google_oauth2\n session[:info_hash] = auth_hash[:info]\n end\n puts 'redirect_to new_user_path'\n redirect_to new_user_path\n end\n end",
"def create\n if request.get? && params[:action] == 'new' && @open_auth\n @open_auth.open_authentication.connection_established\n log_in @open_auth.open_authentication.user\n redirect_back_or_default user_newsfeed_url(@open_auth.open_authentication.user)\n end\n end",
"def create\n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n format.html { redirect_to(:home, :notice => 'Login successful.') }\n format.json { render :json => @user_session, :status => :created, :location => @user_session }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_new_session\n client = prepare_request(auth_url)\n\n login_response = do_request_and_handle_errors do\n client.request :login do |soap|\n soap.body = {:id => @user, :pw => @pass}\n end\n end\n\n @session = login_response.to_hash[:login_response][:login_return]\n @cookie = login_response.http.headers[\"Set-Cookie\"]\n\n false unless @session.instance_of? Nori::StringWithAttributes\n end",
"def create\n if SessionService.authenticate(@user, params[:password])\n # TODO Add successful log in message\n logger.debug \"#{@user.email} is trying to create a API session\"\n root_path\n else\n logger.error \"** Failure** Attempt to login as #{params[:user_name]} - rejected\"\n render text: 'Login failed', status: :unauthorized\n end\n end",
"def new\n if logged_in?\n redirect_to index_path\n end\n end",
"def login\n if request.get?\n session[:user_id] = nil\n @user = User.new\n else\n @user = User.new(params[:user])\n logged_in_user = @user.try_to_login\n if logged_in_user\n session[:user_id] = logged_in_user.id\n redirect_to(:controller => \"admin\")\n else\n flash[:notice] = \"Sorry, Invalid user/password combination!\"\n end \n end\n end",
"def new\n @usuario = Usuario.new\n if current_user\n session[:admin_new] = true\n else\n session[:admin_new] = false\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def new\n if logged_in?\n flash[:success] = t('sessions.already_logged_in')\n redirect_to root_url\n else\n use_secure_headers_override(:allow_github_form_action)\n store_location_and_locale\n end\n end",
"def new\n #user wants to log in \n end",
"def new\n #user wants to log in \n end",
"def new_session_path(scope)\n login_path\n end",
"def new_session_path(scope)\n login_path\n end",
"def new_session_path(scope)\n login_path\n end",
"def new_session_path(scope)\n login_path\n end",
"def new\r\n create\r\n# logout_keeping_session!\r\n# respond_to do |format|\r\n# format.html\r\n# end\r\n end",
"def new\n # render the login form\n end",
"def login\n @user = users(:user1)\n post user_session_path, params: { 'user[email]' => @user.email, 'user[password]' => 'password' }\n end",
"def create\n @login = Login.new(login_params)\n\n if @login.save \n session[:login_id] = @login.id \n redirect_to @login, notice: 'Login successfully created.' \n else \n render :new \n end \n end",
"def new\n format.html { redirect_to(:user_sessions, :notice => 'Welcome to BidPal.') } # changed\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end",
"def require_login\n redirect_to '/sessions/new' unless current_user\n end",
"def create\n if @user = login(params[:email], params[:password])\n redirect_back_or_to(projects_path, notice: 'Login successful!')\n # redirect_back_or_to Remebers the page you were on before login and takes you there\n # to this without sorcery, you'd need to store the info in a cookie through the session hash\n # Anytime you want to be able to access a cookie, it's through the sessions hash.\n else\n flash.now[:alert] = 'Login failed'\n render action: :new\n end\n end",
"def index\n @login = Login.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def login\n old_controller = @controller\n @controller = SessionsController.new\n post :create, session: {email: 'guest@gmail.com', password: 'qwerty'}\n @controller = old_controller\n\n return session[:session_token]\n end",
"def login(username = users(:common).username, pass = \"testpassword\")\n post login_url, params: {session: {username: username, password: pass}}\n end"
] |
[
"0.73042536",
"0.71991426",
"0.7178651",
"0.7175112",
"0.71671367",
"0.6840327",
"0.68087745",
"0.6801599",
"0.6727936",
"0.6726871",
"0.67041373",
"0.6687035",
"0.66818374",
"0.6632659",
"0.66037893",
"0.6593621",
"0.6584824",
"0.65643495",
"0.6563939",
"0.65023017",
"0.65001225",
"0.64951456",
"0.6491727",
"0.6478999",
"0.6478999",
"0.647073",
"0.6404661",
"0.6396258",
"0.6383776",
"0.6383191",
"0.6382277",
"0.63770896",
"0.6374136",
"0.635382",
"0.6348729",
"0.6344425",
"0.63369995",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.632386",
"0.6295608",
"0.6295608",
"0.62877476",
"0.6287575",
"0.6287575",
"0.6287575",
"0.6287575",
"0.6287575",
"0.62734514",
"0.62665415",
"0.626649",
"0.62650627",
"0.62523764",
"0.6251542",
"0.6248792",
"0.6248421",
"0.62423986",
"0.62368745",
"0.62283295",
"0.62240916",
"0.6222339",
"0.6222209",
"0.6213261",
"0.6210774",
"0.6208623",
"0.620746",
"0.6206812",
"0.6190822",
"0.6182326",
"0.6181957",
"0.6178089",
"0.6176995",
"0.6159364",
"0.61557853",
"0.61534",
"0.6150976",
"0.6149844",
"0.6149065",
"0.61482733",
"0.61482733",
"0.6145742",
"0.6145742",
"0.6145742",
"0.6145742",
"0.61289674",
"0.6124803",
"0.61186814",
"0.61177504",
"0.6109139",
"0.6109124",
"0.61062664",
"0.61043096",
"0.6100904",
"0.6100413",
"0.6098995"
] |
0.0
|
-1
|
GET /sessions/oauth GET /auth/:provider/callback
|
def oauth
profile = OAuthProfile.from_omniauth(env['omniauth.auth'])
# TODO check for error
# temp_password = SecureRandom.hex
if !profile.user
oauth_custom_params = request.env["omniauth.params"] || {}
session[:oauth_reason] = oauth_custom_params.fetch("dbdesigner_action", "")
session[:profile_id] = profile.id
redirect_to new_registration_path
# profile.user.create({
# username: profile.username,
# email: profile.email,
# password: temp_password,
# password_confirmation: temp_password
# })
else
session[:user_id] = profile.user.id
profile.user.record_login(request: request, oauth_profile: profile)
redirect_to designer_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def oauth\n session[:return_to_url] = params[:redirect_after_login] if params[:redirect_after_login]\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end",
"def auth_endpoint_callback\n Rails.logger.debug \"------ Entering auth_endpoint_callback ------\"\n\n @organization = Organization.find(params[:org])\n\n session[\"access_token\"] = @organization.authorization_server.\n request_access_token(request, callback_url)\n redirect_to organization_records_path(@organization)\n end",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end",
"def oauth2callback\n @g_cal_api.oauth2callback\n end",
"def login\n oauth_callback = url_for(:action => :authorize)\n request_token = @consumer.get_request_token(:oauth_callback => oauth_callback)\n session[:request_token] = request_token\n redirect_to request_token.authorize_url\n end",
"def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end",
"def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end",
"def start_oauth\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = @consumer.get_request_token(:oauth_callback=>\"http://127.0.0.1:3000/a2\")\n Rails.logger.warn \"First Request #{@req_token.inspect}\"\n session[:request_token] = @req_token.token\n session[:request_token_secret] = @req_token.secret\n redirect_to @req_token.authorize_url\nend",
"def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/federicobucci504@gmail.com'\n end",
"def callback\n @request_token = session[:request_token]\n @access_token = @request_token.get_access_token\n\n session[:oauth_token] = @access_token.token\n session[:oauth_token_secret] = @access_token.secret\n\n current_user = twitter_api.account_verify_credentials\n \n session[:user_attributes] = {\n id: current_user.id,\n screen_name: current_user.screen_name,\n profile_image_url: current_user.profile_image_url,\n profile_image_url_https: current_user.profile_image_url_https\n }\n\n redirect_to :root\n end",
"def oauth_uri(provider=\"FACEBOOK\")\n dest= session[\"return_to\"] || request.env[\"REQUEST_URI\"] || \"/\"\n \"#{oauth_uri_left_part}/account/oauth_start?provider=#{CGI.escape(provider)}&dest_left=#{CGI.escape(request_uri_left_part)}&dest_path=#{CGI.escape(dest)}\"\n end",
"def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end",
"def oauth_callback_url\n end",
"def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end",
"def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end",
"def callback\n auth = request.env['omniauth.auth']\n\n session[:facebook_token] = auth[:credentials][:token]\n\n refresh_facebook\n\n redirect_to '/#services'\n end",
"def oauth\n puts '*'*50\n puts session[:category]\n session[:category] = nil\n session[:category] = params[:category]\n puts '*'*50\n puts session[:category]\n login_at(auth_params[:provider])\n end",
"def oauth\n if params[:code]\n token_response = get_user_tokens(params[:code])\n signup_or_login(token_response)\n end\n\n render json: params\n end",
"def auth_callback\n current_user\n omniauth_origin = session[:omniauth_origin]\n session.delete(:omniauth_origin)\n redirect_to omniauth_origin || '/'\n end",
"def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end",
"def oauth_callback_url\n url_for :action => \"list\"\n end",
"def index \n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/home/callback')\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"read_stream,publish_stream\") \t\n\t\tputs session.to_s + \"<<< session\"\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args[:code] = params[:code] if params[:code]\n get_access_token(args)\n end",
"def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end",
"def request_token\n localcallback = \"http://localhost:3000/twitter/callback\"\n herokucallback = \"http://twitter-fobot.herokuapp.com/twitter/callback\"\n @callback_url = Rails.env == 'production' ? herokucallback : localcallback\n @consumer = OAuth::Consumer.new(ENV['consumer_key'],ENV['consumer_secret'],:site=>\"https://api.twitter.com\")\n @consumer.options[:authenticate_path] = \"/oauth/authenticate\"\n \n #@request_token is app specific not user specific\n @request_token = @consumer.get_request_token(:oauth_callback => @callback_url)\n \n session[:request_token] = @request_token\n #redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)\n redirect_to \"https://api.twitter.com/oauth/authenticate?oauth_callback=\" + @callback_url + \"&oauth_token=\" + @request_token.token\n end",
"def auth_at_provider(provider)\n @provider = Config.send(provider)\n if @provider.respond_to?(:get_request_token)\n args = {:request_token => @provider.get_request_token} \n session[:request_token] = args[:request_token]\n end\n redirect_to @provider.authorize_url(args)\n end",
"def oauth_authentication; end",
"def callback\n @oauth = Koala::Facebook::OAuth.new(APPID, SECRET, welcome_callback_url)\n session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]\n if session[:access_token]\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Error logging in\"\n end\n redirect_to welcome_index_path\n end",
"def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end",
"def oauth_callback(params)\n update! psp_credentials: payment_provider.get_access_token(params)\n end",
"def facebook_authorization_callback\n begin\n #Fetch the 'code' query parameter from the callback\n code = params[:code]\n\n #Get token object, passing in the authorization code from the previous step\n logger.fatal \"Redirect to facebook for getting token: #{code} , #{Settings.facebook.REDIRECT_URI}\"\n token = facebook_client.auth_code.get_token(code, {:redirect_uri => Settings.facebook.REDIRECT_URI, :parse => :facebook})\n\n api_endpoint = \"#{Settings.api_endpoints.Login}\"\n response = Typhoeus.post(api_endpoint, body: {\n userId: current_user_id,\n loginType: 'FACEBOOK',\n accessToken: token.token\n })\n\n if response.success? && !api_contains_error(\"Login\", response)\n add_access_token_api_response = JSON.parse(response.response_body)\n add_access_token_api_response = add_access_token_api_response[\"LoginResult\"]\n if add_access_token_api_response[\"isUserLogedIn\"] == true\n session[:facebook_token] = token.token\n end\n end\n\n redirect_to user_path(current_user_id)\n rescue OAuth2::Error => e\n logger.fatal e.message\n logger.fatal e.backtrace.inspect\n redirect_to Settings.facebook_auth_url\n end\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args.merge!({ code: params[:code] }) if params[:code]\n get_access_token(args)\n end",
"def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end",
"def process_callback(params,session)\n args = {}\n args.merge!({:oauth_verifier => params[:oauth_verifier], :request_token => session[:request_token], :request_token_secret => session[:request_token_secret]})\n args.merge!({:code => params[:code]}) if params[:code]\n @access_token = self.get_access_token(args)\n end",
"def authorize\n oauth_verifier = params[:oauth_verifier]\n request_token = session[:request_token]\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n \n user = User.login(access_token)\n session[:user] = user.id unless user.nil?\n redirect_to :controller => :home\n end",
"def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end",
"def callback2\n oauth_token = FitbitOauthToken.where(:token=>params[:state]).last\n verifier = params[:code]\n if oauth_token\n return_url = request.original_url\n #xd = YAML::load oauth_token.extra_data\n # if return_url already has a ? in it, then this needs to add an & and not a ? \n #question_mark_or_ampersand = xd[:return_url].to_s =~ /\\?/ ? '&' : '?'\n question_mark_or_ampersand = return_url.to_s =~ /\\?/ ? '&' : '?'\n #There's a code and a state that need to go with:\n url = \"\"\n url += \"#{return_url.gsub(\"callback2\",\"post_authorize\")}\"\n if !verifier.nil? && !verifier.empty? \n #Only add the token and verifier if we have both\n #This way, the recieving application can respond if they're missing\n url += \"#{question_mark_or_ampersand}\"\n url += \"oauth_token=#{params[:state]}\"\n url += \"&oauth_verifier=#{params[:code]}\"\n end\n redirect_to url\n else\n render :text=>\"error processing oauth token\", :layout=>false\n end\n end",
"def authCallback\n begin\n auth_code = params.fetch(\"code\")\n rescue KeyError\n raise \"error: no code param provided\"\n end\n\n from_sso = params.fetch(\"from_sso\", \"0\") == \"1\" \n origin = params[\"origin\"] if params.key?(\"origin\")\n\n redirect_uri_sso = URI(api_args[\"redirect_uri\"])\n redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| [\"from_sso\", \"origin\"].include? k})\n\n redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args[\"redirect_uri\"]\n\n password_reset = sign_in(auth_code, redirect_uri)\n\n if from_sso\n # we got here from sso, redirect to origin(the page where user entered \n # the site)\n redirect_to origin\n elsif password_reset\n # we got here from email password reset, redirect to change password\n redirect_to \"/#{app.name}/profile_change_password\"\n else\n # since we are in an iframe, reload the parent, not the current window,\n # otherwise we will get nesting.\n render :text => \"<script>window.parent.location.reload()</script>\"\n end \n end",
"def oauth\n request_token = @oauth_consumer.get_request_token\n authorize_url = request_token.authorize_url(:oauth_consumer_key => \n Netflix::Client.consumer_key)\n Launchy.open(authorize_url)\n puts \"Go to browser, a page has been opened to establish oauth\"\n printf \"Pin from Netflix:\"\n pin = gets.chomp\n access_token = request_token.get_access_token(:oauth_verifier => pin)\n end",
"def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end",
"def signin\n oauth_authorize\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def token_callback\n # puts \"INTAGRAM CLIENT response ACCESS TOKEN ???? #{params.inspect}\"\n if params[:access_token]\n session[:instagram_access_token] = params[:access_token]\n # puts \"INTAGRAM SESSION TOKEN #{params[:access_token].inspect}\"\n\n end\n respond_to do |format|\n format.html {redirect_to profile_path }\n # redirect_to :back, :params => params[:url_params]\n end\n end",
"def google_callback\n tokens = get_tokens(params[\"code\"])\n\n @current_user.access_token = tokens[\"access_token\"]\n @current_user.save!\n \n flash[:notice] = \"Authorized\"\n \n redirect_to :root\n end",
"def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end",
"def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end",
"def facebook\n handle_oauth\n end",
"def redirect\n callback_url = url_for :action => :callback\n sc_request_token = $sc_consumer.get_request_token(:oauth_callback => callback_url)\n session[:sc_request_token] = sc_request_token.token\n session[:sc_request_token_secret] = sc_request_token.secret\n @authorize_url = \"http://soundcloud.com/oauth/authorize?oauth_token=#{sc_request_token.token}\"\n\n redirect_to @authorize_url\n end",
"def oauth2_authenticatable(routes, mapping)\n \n database_authenticatable(routes, mapping)\n routes.oauth_callback ::Devise.oauth2_callback_path, :controller => 'sessions', :action => 'oauth_callback'\n end",
"def callback\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_token = session[:request_token]\n verifier = params[:oauth_verifier]\n access_token = @discogs.authenticate(request_token, verifier)\n \n session[:request_token] = nil\n session[:access_token] = access_token\n \n @discogs.access_token = access_token\n \n # You can now perform authenticated requests.\n end",
"def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end",
"def authorize_client session_token\n base_url = \"#{APP_CONFIG['okta_base_url']}/oauth2/v1/authorize\"\n redirect_uri = \"#{APP_CONFIG['okta_openid_redirect_uri']}\"\n client_id = \"#{APP_CONFIG['okta_client_id']}\"\n scopes = [\"openid\", \"email\", \"groups\"].join(\"%20\")\n url = \"#{base_url}?sessionToken=#{session_token}&redirect_uri=#{redirect_uri}&response_type=id_token&client_id=#{client_id}&scope=#{scopes}&response_mode=fragment\"\n\n begin\n HttpClient.get(url)\n rescue HTTParty::RedirectionTooDeep => e\n open_id_token = e.response.header['location']\n end\n open_id_token.split('=').last\n end",
"def callback\n # evernote returns a verifier if user authorized the app\n oauth_verifier = params[:oauth_verifier]\n if oauth_verifier\n consumer = get_consumer\n request_token = OAuth::RequestToken.new(consumer, flash[:request_token], flash[:request_secret])\n # contains the real token, user id, shard, and token expiration date\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n account = EvernoteAccount.where(\"user_id = \" + access_token.params[:edam_userId]).take\n if !account\n # save this stuff\n account = EvernoteAccount.create(\n user_id: access_token.params[:edam_userId],\n token: access_token.token,\n shard: access_token.params[:edam_shard],\n token_expiration: access_token.params[:edam_expires]\n )\n end\n session[:evernote_account_id] = account.id\n # directs to recipes page (recipe_controller.rb)\n redirect_to action: \"index\", controller: \"recipes\"\n else\n redirect_to action: \"index\"\n end\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def request_phase\n request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => 'http://www.google.com/health/feeds'})\n (session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}\n r = Rack::Response.new\n if request_token.callback_confirmed?\n r.redirect(request_token.authorize_url)\n else\n r.redirect(request_token.authorize_url(:oauth_callback => callback_url))\n end\n r.finish\n end",
"def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end",
"def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end",
"def finish_oauth\n\tRails.logger.warn 'here'\n\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = OAuth::RequestToken.new(@consumer,session[:request_token],session[:request_token_secret])\n \n # Request user access info from Twitter\n @access_token = @req_token.get_access_token\n\n # Store the OAuth info for the user\n #@user = {}\n #@user.update_attributes(:token=>@access_token.token,:token_secret=>@access_token.secret)\n Rails.logger.warn \"Second Request #{@access_token.params['user_id']}\"\n # Send the user on their way\n session[:tokens] ={:token=>@access_token.token, :token_secret=>@access_token.secret}\n session[:id] = @access_token.params['user_id']\n redirect_to '/'\nend",
"def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end",
"def omniauth(provider, *args); end",
"def oauth_access_token\n session[:access_token]\n end",
"def oauth_callback\n at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])\n \n #There can only be one...\n Qbo.destroy_all\n\n # Save the authentication information \n qbo = Qbo.new\n qbo.qb_token = at.token\n qbo.qb_secret = at.secret\n qbo.token_expires_at = 6.months.from_now.utc\n qbo.reconnect_token_at = 5.months.from_now.utc\n qbo.company_id = params['realmId']\n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def auth\n\t\tclient = TwitterOAuth::Client.new(\n\t\t :consumer_key => CONSUMER_KEY,\n\t\t :consumer_secret => CONSUMER_SECRET\n\t\t)\n\t\taccess_token = client.authorize(\n\t\t\tsession[:request_token],\n\t\t\tsession[:request_token_key],\n\t\t\t:oauth_verifier => params[:oauth_verifier]\n\t\t)\n\t\tif client.authorized?\n\t\t\tsession[:access_token] = access_token.token\n\t\t\tsession[:access_token_secret] = access_token.secret\n\t\t\tsession[:user_name] = client.info['name']\n\t\tend\n\t\tredirect_to root_url\n\tend",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def oauth_callback\n if params[:state].present?\n oauth2_client = Qbo.get_client\n # use the state value to retrieve from your backend any information you need to identify the customer in your system\n redirect_uri = Setting.host_name + \"/qbo/oauth_callback/\"\n if resp = oauth2_client.auth_code.get_token(params[:code], redirect_uri: redirect_uri)\n \n # Remove the last authentication information\n Qbo.delete_all\n \n # Save the authentication information \n qbo = Qbo.new\n qbo.company_id = params[:realmId]\n \n # Generate Access Token & Serialize it into the database\n access_token = OAuth2::AccessToken.new(oauth2_client, resp.token, refresh_token: resp.refresh_token)\n qbo.token = access_token.to_hash\n qbo.expire = 1.hour.from_now.utc\n \n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n \n end\n end\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def login\n @request_token = twitter_api.connection.consumer.get_request_token(oauth_callback: callback_url)\n session[:request_token] = @request_token\n redirect_to @request_token.authorize_url\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def new\n @verifier = params[:oauth_verifier]\n render \"oauth/new\"\n end",
"def callback\n @T_OAUTH = TwitterOAuth::Client.new(:consumer_key => TWITTER_KEY, :consumer_secret => TWIITER_SECRET )\n @oauth_verifier = params[:oauth_verifier]\n access_token = @T_OAUTH.authorize(session['token'], session['secret'], auth_verifier => @oauth_verifier)\n if (@result = @T_OAUTH.authorized?)\n current_user.create_or_update_twitter_account_with_oauth_token(access_token.token, access_token.secret)\n session['token'] = nil\n session['secret'] = nil\n flash[:notice] = \"Authorize complete\"\n else\n flash[:notice] = \"Authorize failed\"\n end\n\n rescue\n flash[:notice] = \"Authorize failed\"\n end",
"def oauth\n session[:auth_token] = GoogleOauth.oauth(params)\n puts \"saving auth token #{session[:auth_token]}\"\n redirect_to(\"/characters/#{session[:char_id]}\")\nend",
"def oauth_consumer\n @oauth_consumer\n end",
"def callback\n\t\t# I didn't abstract this part since we don't have the user data yet.\n\t\t\n\t @request_token = OAuth::RequestToken.new(get_consumer,\n\t session[:request_token],\n\t session[:request_token_secret]) # generate request token using OAuth consumer obj\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # and existing request token, token secret\n\n\t # Exchange the request token for an access token.\n\t @access_token = @request_token.get_access_token # access token is the application-user combo auth to twitter\n\n\t\t# do a request using the OAuth consumer, to twitter.com/account/verify_credentials.json\n\t\t# USING our access token, so we can GET the data about the user that is described with the access token\n\t @response = get_consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\t\t\n\t\t\n\t case @response\n\t when Net::HTTPSuccess\n\t user_info = JSON.parse(@response.body) # json parse the response\n\n\t unless user_info['screen_name']\n\t\t\t\t\t# for one reason or another -- no screen name was found, auth failed\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t return\n\t end\n\n\t # We have an authorized user, save the information to the database.\n\t\t\t\tfinduser = User.find_by_twitter_name(user_info['screen_name'])\n\t\t\t\tif finduser.nil?\n\t\t\t\t\t@user = User.create do |u|\n\t\t\t\t\t\tu.twitter_name = user_info['screen_name']\n\t\t\t\t\t\tu.token = @access_token.token\n\t\t\t\t\t\tu.secret = @access_token.secret\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@user.save!\n\t\t\t\telse\n\t\t\t\t\tfinduser.token = @access_token.token\n\t\t\t\t\tfinduser.secret = @access_token.secret\n\t\t\t\t\tfinduser.save!\n\t\t\t\t\t\n\t\t\t\t\t@user = finduser\n\t\t\t\tend\n\t\n\t\t\t\tsession[:user_id] = @user.id\n\n\t # Redirect to the show page\n\t redirect_to('/home')\n\t else\n\t RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t # The user might have rejected this application. Or there was some other error during the request.\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t end\n\tend",
"def callback\n sc_request_token = OAuth::RequestToken.new($sc_consumer, session[:sc_request_token], session[:sc_request_token_secret])\n sc_access_token = sc_request_token.get_access_token(:oauth_verifier => params[:oauth_verifier]) \n sc = Soundcloud.register({:access_token => sc_access_token})\n me = sc.User.find_me\n\n # check if user with me.id exists, update username & oauth stuff otherwise create a new user\n user = User.find_by_sc_user_id(me.id)\n if user.nil?\n user = User.create({:sc_user_id => me.id, :sc_username => me.username,\n :access_token => sc_access_token.token, :access_token_secret => sc_access_token.secret })\n else\n user.sc_username = me.username\n user.access_token = sc_access_token.token\n user.access_token_secret = sc_access_token.secret\n user.save!\n end\n \n session[:user_id] = user.id\n redirect_to :controller => :home\n end",
"def handle_oauth\n data = request.env['omniauth.auth']\n\n # Try find student for provider, if found authenticate normally otherwise redirect to oauth signup page.\n student = Student.find_open_auth(data.provider, data.uid).first\n\n if student&.persisted?\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', :kind => data.provider\n sign_in_and_redirect student, :event => :authentication\n else\n # Store auth data in session (remove extra to stop cookie overflow). We mark this with 'devise' so it gets\n # #automatically cleaned up.\n session['devise.oauth_data'] = data.except(:extra)\n redirect_to new_student_oauth_path, alert: (student.errors.full_messages.join(\"\\n\") if student)\n end\n end",
"def login\n state_json = {\n redirect_url: params[:redirect_url],\n access_token: params[:access_token],\n ip: request.remote_ip\n }\n\n unless params[:mixpanel_id].blank?\n state_json.merge!(mp_id: params[:mixpanel_id])\n end\n\n encoded_state = LinkedAccount::Base.encode_state(state_json)\n\n case params[:provider]\n when 'github'\n redirect_to LinkedAccount::Github::User.oauth_url(scope: params[:scope], state: encoded_state)\n\n when 'facebook'\n redirect_to LinkedAccount::Facebook.oauth_url(scope: params[:scope], state: encoded_state)\n\n when 'twitter'\n redirect_to LinkedAccount::Twitter.oauth_url(scope: params[:scope], state: encoded_state)\n\n else render json: { error: 'Unsupported provider' }, status: :bad_request\n end\n end",
"def linkedin_callback\n\t \n\t code = params[:code]\n\t state = params[:state]\n\t \n\t if !state.eql?(STATE)\n\t # Reject the request as it may be a result of CSRF\n\t redirect_to :controller=> 'login', :action=> :login\n\t else\n\t # Get token object, passing in the authorization code from the previous step\n\t begin\n\t \ttoken = linkedin_client.auth_code.get_token(code, :redirect_uri => \"http://localhost:3000/oauth/linkedin_callback\")\n\t \t \tsession['linkedin_token'] = token.token\n\t \t rescue\n\t \t \t\n\t \t end\n\t redirect_to :controller=> 'users', :action => :index\n\n\t end\n\tend",
"def redirect_uri\n @redirect_uri ||= root_url[0..-2] + oauth_callback_path\n end",
"def login_at(provider, args = {})\n @provider = Config.send(provider)\n if @provider.has_callback?\n redirect_to @provider.login_url(params,session)\n else\n #@provider.login(args)\n end\n end",
"def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def authenticate\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_data = @discogs.get_request_token(DISCOGS_API_KEY, DISCOGS_API_SECRET, \"http://127.0.0.1:3000/callback\")\n \n session[:request_token] = request_data[:request_token]\n \n redirect_to request_data[:authorize_url]\n end",
"def consumer\n @consumer = OAuth::Consumer.new session[:consumer_key], session[:consumer_secret], :site => MISO_SITE\nend",
"def oauth_check_authorization\n code = params[:code]\n session[:access_token] = facebook_client.check_authorization code,\n :redirect_uri => oauth_callback_url\n end",
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end",
"def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend",
"def google\n process_oauth_callback\n end",
"def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend",
"def logout\n # clear all scopes\n sign_out_all_scopes\n\n # set redirect_url => sign in page\n redirect_url = new_user_session_url\n # when url-querys has logout_redirect_uri & client_id parameters\n if params[:logout_redirect_uri] && params[:client_id]\n # load oauth application\n application = Doorkeeper::Application.find_by(uid: params[:client_id])\n # check logout_redirect_uri\n # 1. application of client_id exist\n # 2. application.logout_redirect_uri present\n # 3. application.logout_redirect_uri includes params[:logout_redirect_uri]\n # set redirect_url = params[:logout_redirect_uri]\n if application && application.logout_redirect_uri.present?\n if Doorkeeper::OAuth::Helpers::URIChecker.valid_for_authorization?(params[:logout_redirect_uri], application.logout_redirect_uri)\n redirect_url = params[:logout_redirect_uri]\n end\n elsif application && application.redirect_uri.blank?\n redirect_url = params[:logout_redirect_uri]\n end\n end\n redirect_to redirect_url\n end",
"def exchange_oauth_tokens\n end",
"def auth\r\n OAuth2\r\n end",
"def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end",
"def token_url\n \"#{sk_url}/oauth/token\"\n end"
] |
[
"0.7347758",
"0.7256924",
"0.7256924",
"0.68790096",
"0.66832656",
"0.66559714",
"0.66321594",
"0.662259",
"0.65520257",
"0.6530762",
"0.651418",
"0.64893365",
"0.6476555",
"0.6438987",
"0.64315593",
"0.64171696",
"0.64035076",
"0.6383108",
"0.6383108",
"0.6377728",
"0.63751465",
"0.63646984",
"0.6363199",
"0.63387847",
"0.6327995",
"0.63019645",
"0.6275805",
"0.6264484",
"0.62412274",
"0.6235443",
"0.62347853",
"0.6218395",
"0.6217047",
"0.6216002",
"0.6202468",
"0.61928326",
"0.6192008",
"0.61917025",
"0.6172637",
"0.61524355",
"0.61494374",
"0.6131005",
"0.61215293",
"0.61117995",
"0.60917217",
"0.60885745",
"0.60856533",
"0.60812294",
"0.6068917",
"0.6056611",
"0.6054673",
"0.60544705",
"0.6051642",
"0.6048316",
"0.6026849",
"0.60085034",
"0.5985713",
"0.59843963",
"0.59663445",
"0.59591436",
"0.59462005",
"0.5938218",
"0.5937936",
"0.5937708",
"0.5930265",
"0.591385",
"0.589697",
"0.58850145",
"0.5861377",
"0.5834115",
"0.5831483",
"0.58270407",
"0.5824661",
"0.581933",
"0.5816742",
"0.5809027",
"0.5806878",
"0.58057505",
"0.57995594",
"0.57925534",
"0.5788354",
"0.5784754",
"0.57762",
"0.5773831",
"0.57733595",
"0.5766667",
"0.5762317",
"0.57573926",
"0.57554185",
"0.5746913",
"0.5730631",
"0.57299966",
"0.5704214",
"0.5701692",
"0.57009935",
"0.5699143",
"0.56945485",
"0.5686991",
"0.5685458",
"0.5674447"
] |
0.5854426
|
69
|
GET /logout POST /logout DELETE /sessions
|
def destroy
if session[:was_admin]
session[:user_id] = session[:was_admin]
session.delete :was_admin
else
session[:user_id] = nil
end
redirect_to login_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def log_out\n get '/sessions/destroy'\nend",
"def log_out\n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif payload == :SESSION_NO_AUTH\n render status: 403, json: {error: true}\n else\n render status: 404, json: {error: true}\n end\n end",
"def logout\n # delete the session\n session.delete :user_id\n render json: { message: \"Logged Out\" }\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def logout\n session.delete(:user_id)\n end",
"def logout\n reset_session\n redirect_to '/sessions/new'\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def logout\n response = @session.delete\n @auth_token = nil\n @rest.default_headers = { 'Content-Type' => 'application/json' }\n response\n end",
"def logout\n session.delete :user_id\n end",
"def logout!\n session.clear\n end",
"def logout!\n session.clear\n end",
"def logout\n close_session\n end",
"def logout\n @client.make_request :post,\n auth_path('logout')\n end",
"def logout\n \n # test if session is unauth'd\n (print_error \"invalid nonce\";return @body = \"{ success : true }\") if not @session.valid_nonce?(@request)\n (print_error \"invalid session\";return @body = \"{ success : true }\") if not @session.valid_session?(@request)\n \n @headers['Content-Type']='application/json; charset=UTF-8'\n \n # set the session to be log out\n @session.set_logged_out\n \n # clean up UA and expire the session cookie\n config = BeEF::Core::Configuration.instance\n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => \"\", :path => \"/\", :httponly => true, expires: Time.now})\n\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly logged out.\")\n @body = \"{ success : true }\"\n \n end",
"def signout\n session.clear\n end",
"def logout\n reset_session\n render json: nil\n end",
"def logout\n reset_session \n render json: {\n status: 200, \n logged_out: true\n }\n end",
"def logout\n session.delete(SESSION_KEY)\n redirect_to action: :login\n end",
"def destroy\n @session = Session.get_from_cookies(cookies)\n @session.destroy if @session\n Session.remove_from_cookies(cookies)\n\n respond_to do |format|\n format.html { redirect_to(:login) }\n format.xml { head :ok }\n end\n end",
"def logout\n session[:user_id] = nil\n redirect_to :index, notice: \"Signed out successfully\"\n end",
"def user_logout\n res = http_delete(:uri=>\"/session\", :fields=>x_cookie)\n return res.code\n end",
"def destroy #RESTful convention - destroy action to delete sessions (sign out)\n sign_out # defer to sign_out function for signing out\n redirect_to root_path\n end",
"def logout\n end",
"def logout\n end",
"def logout\n reset_session\n render json: {\n \n status: 200, \n logged_out: true\n }\n end",
"def sign_out\n logout\n end",
"def logout\n res = query(\"logout\")\n @sessionid = nil\n puts \"ACS: Logged out\"\n return res.body\n end",
"def destroy\n log_out\n redirect_to login_url, notice: t('controllers.sessions.destroy.logged_out')\n end",
"def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end",
"def logout\n session.delete(:user_id) if current_user\n end",
"def logout!\n session.clear\n end",
"def destroy\n user_session.log_out\n redirect_to root_url\n end",
"def logout\n reset_session\n redirect_to \"/\"\n end",
"def logout\n call :get, '/user/logout'\n end",
"def logout\n session[:user] = nil\n redirect_to '/'\n end",
"def logout\n session[:user] = nil\n redirect_to '/'\n end",
"def logout\n reset_session\n redirect_to new_session_path\n end",
"def destroy\n session.delete(:user_id)\n session.delete(:auth)\n flash[:notice] = 'Logged out successfully.'\n redirect_to \"/home\"\n end",
"def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end",
"def destroy\n session[:user_id] = nil\n redirect_to sessions_path, flash: { info: 'Logged Out' }\n end",
"def destroy\n logout\n redirect_to( \"/\", :notice => I18n.t(\"messages.user_sessions.destroy.succesfull\"))\n end",
"def logout\n url_logout = File.join(session['dominio'],\"autenticazione/logout\")\n reset_session\n redirect_to url_logout\n end",
"def logout\n session[:user_id] = nil\n end",
"def logout\n session[:user_id] = nil\n end",
"def log_out\n session.delete(:user_id)\n cookies.delete :user_id\n end",
"def logout\n \"/users/logout\"\nend",
"def logout\n session[:user] = nil\n session[:permissions] = {}\n session[:admin_user_id] = nil\n redirect_to '/'\n end",
"def logout\n # session.delete(:user_id) does the same thing\n session[:user_id] = nil\n end",
"def logout\n handler = Proc.new do |request|\n if response.code == 204\n clear_session\n else\n case response.code\n when 401 then\n raise Jiralicious::NotLoggedIn.new(\"Not logged in\")\n else\n # Give Net::HTTP reason\n raise Jiralicious::JiraError.new(response)\n end\n end\n end\n\n request(:delete, '/rest/auth/latest/session', :handler => handler)\n end",
"def logout\n HttpWrapper.post(\n url: \"#{::Coyodlee.base_url}/user/logout\"\n )\n end",
"def logout\n log_out\n redirect_to login_path\n end",
"def logout\n log_prefix = \"API(logout)\"\n $log.info(\"#{log_prefix} User: #{session}\")\n s = session[:userid]\n user = User.find_by_userid(s)\n user.logoff if user\n session.clear\n respond_to do |format|\n format.xml { render xml: session.to_xml(:root => 'user') }\n end\n end",
"def form_logout\n post '/goldberg/auth/logout'\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def logout\n session.delete(:subscription_id)\n session.delete(:customer_id)\n redirect_to \"/ssp/index\"\n end",
"def logout\n @session[:user] = nil\n end",
"def logout\n \tlog_out\n \tredirect_to login_path\n end",
"def logout\n session[:user] = nil\n end",
"def log_out\n visit '/sessions/destroy'\nend",
"def destroy\n\n session.delete(:user_id)\n redirect_to root_path, notice: \"logged out successfully \"\n\n end",
"def destroy\n log_out_user\n redirect_to new_session_url\n end",
"def logout\n #TODO: add extra logic if required\n delete_cookie(GlobalConstant::Cookie.user_cookie_name)\n render_api_response(Result::Base.success({}))\n end",
"def logout\n end_session(current_user)\n redirect_to root_path \n end",
"def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def logout\n reset_session\n cookies.delete 'dc_logged_in'\n redirect_to '/'\n end",
"def logout\n user_logout\n session.clear\n flash[:success] = 'You have been logged out'\n redirect(Users.r(:login))\n end",
"def destroy\n session.delete(:user_id)\n flash[:success] = t('.successfully_logged_out')\n redirect_to login_path\n end",
"def logout\n reset_session\n redirect_to :action => 'login'\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def httpdigest_logout\n session.delete(SESSION_NONCE)\n session.delete(SESSION_OPAQUE)\n end",
"def destroy\n sign_out\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def logout\n session[:user_id] = nil\n session[:admin_user_id] = nil\n flash[:notice] = \"Vous êtes déconnecté\"\n redirect_to root_url\n end",
"def destroy\n log_out\n redirected_to root_url\n end",
"def logout\r\n journal(\"log_out\",session[:user_id])\r\n cookies.delete :autologin\r\n Token.delete_all([\"user_id = ? AND action = ?\", logged_in_user.id, \"autologin\"]) if logged_in_user\r\n self.logged_in_user = nil\r\n redirect_to :controller => 'welcome'\r\n # redirect_to :action => 'login'\r\n end",
"def logout\n session[:user_id] = nil\n redirect_to(:action => \"login\")\n end",
"def logout\n session[:user_id] = nil\n flash[:notice] = \"Logged out.\"\n redirect_to(access_login_path)\n end",
"def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end",
"def logout\n session.delete(:user_id)\n @current_user = nil\n end",
"def destroy\n # def self.destroy\n session.clear\n redirect_to login_path\n # reset_session\n # redirect :root_path\n # session[:user_id] = []\n end",
"def destroy\n reset_session\n respond_to do |format|\n format.html { redirect_to new_authentication_url, notice: 'You have logged out' }\n format.json { head :no_content }\n end\n end",
"def handle_logout\n reset_session\n end",
"def sign_out\n reset_session\n end",
"def logout\n\t\treset_session\n\t\tredirect_to root_path\n\tend",
"def logout\n reset_session\n flash[:notice] = \"Logged out\"\n redirect_to :login\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:user_id] = nil\n redirect_to login_path, notice: \"Logged out\"\n end",
"def logout\n reset_session\n redirect_to '/'\n return\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def destroy\n @session_login.destroy\n respond_to do |format|\n format.html { redirect_to session_logins_url, notice: \"Session login was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def logout!(options = {})\n session[:session_token] = session[:active_at] = nil\n end",
"def sign_out\n if @current_user\n session.delete(:user_id)\n redirect_to action: \"index\"\n end\n end"
] |
[
"0.8507462",
"0.8507462",
"0.84587246",
"0.84587246",
"0.84587246",
"0.84587246",
"0.84587246",
"0.7791404",
"0.7781273",
"0.7657879",
"0.76436865",
"0.76216614",
"0.7470535",
"0.74669594",
"0.74576277",
"0.7456397",
"0.7453288",
"0.7436295",
"0.7436295",
"0.7404582",
"0.7390382",
"0.7381403",
"0.7367376",
"0.7366394",
"0.73430055",
"0.7337444",
"0.73259544",
"0.73204917",
"0.731522",
"0.73149604",
"0.7285948",
"0.7285948",
"0.7263661",
"0.7260655",
"0.7255573",
"0.723131",
"0.72233427",
"0.7213159",
"0.7206202",
"0.7200688",
"0.719869",
"0.7197822",
"0.7173472",
"0.7173472",
"0.7168692",
"0.7167655",
"0.715778",
"0.71525025",
"0.71466285",
"0.7146201",
"0.71408457",
"0.71408457",
"0.7129125",
"0.7127877",
"0.71207017",
"0.7119184",
"0.7104392",
"0.7102203",
"0.70987886",
"0.70962",
"0.70955944",
"0.7093289",
"0.7091755",
"0.7091105",
"0.7081287",
"0.70777506",
"0.7070779",
"0.7069623",
"0.7061821",
"0.706156",
"0.7056902",
"0.70474887",
"0.70450705",
"0.70349663",
"0.7033231",
"0.7032085",
"0.7024876",
"0.7018667",
"0.7017654",
"0.7012024",
"0.7001982",
"0.6995751",
"0.6993112",
"0.69923496",
"0.69896847",
"0.6986086",
"0.69807124",
"0.69795346",
"0.6970315",
"0.69696754",
"0.69629437",
"0.6958185",
"0.69576174",
"0.6957418",
"0.69526744",
"0.6952069",
"0.6948278",
"0.6948141",
"0.6945928",
"0.6945745",
"0.69429064"
] |
0.0
|
-1
|
GET /auth/failure OAuth failure callback path
|
def auth_failure
logger.warn "[SESS] auth failure: #{params[:message]}"
redirect_to new_session_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end",
"def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end",
"def default_oauth_fail\n auth = request.env['omniauth.auth']\n session.delete(\"devise.#{auth.provider.to_s}_data\")\n flash[:alert] = @user.errors.to_a[0] if @user.errors\n redirect_to auth.fail_redirect\n end",
"def failure\n redirect_to root_url, alert: 'Twitter authentication denied.'\n end",
"def failure\n msg_returned = request.params['message']\n login_failed msg_returned.nil? ? 'Auth0 login failed.' : msg_returned\n end",
"def failure\n\t\tredirect_to(@@extension_url + '?access_token=' + 'failure')\n\tend",
"def call_authorization_fail_api(ticket, reason)\n return call_api(\"/api/auth/authorization/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend",
"def auth_fail\n fail(Kankri::AuthenticationFailure)\n end",
"def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend",
"def do_token_fail(ticket, reason)\n # Call Authlete's /auth/token/fail API.\n response = call_token_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # Authlete successfully generated an error response\n # for the client application.\n return WebResponse.new(400, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend",
"def auth_failure\n redirect_to '/', :alert => params[:message]\nend",
"def failure_url\n redirect_url([@token && @token.failure_url, TokenAction.failure_url])\n end",
"def failure\n flash[:error] = \"Could not authenticate with #{params[:strategy]}\"\n return redirect_to \"/\"\n end",
"def failure\n origin_locale = get_origin_locale(request, available_locales())\n I18n.locale = origin_locale if origin_locale\n error_message = params[:error_reason] || \"login error\"\n kind = request.env[\"omniauth.error.strategy\"].name.to_s || \"Facebook\"\n flash[:error] = t(\"devise.omniauth_callbacks.failure\",:kind => kind.humanize, :reason => error_message.humanize)\n redirect_to search_path\n end",
"def callback_failure\n flash[:error] = I18n.t(:connection_failure)\n\t redirect_to root_url\n\tend",
"def do_authorization_fail(ticket, reason)\n # Call Authlete's /auth/authorization/fail API.\n response = call_authorization_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The ticket is no longer valid (deleted or expired)\n # and the reason of the invalidity was probably due\n # to the end-user's too-delayed response to the\n # authorization UI.\n return WebResponse.new(400, content).json.to_response\n\n when \"LOCATION\"\n # 302 Found\n # The authorization request was invalid and the error\n # is reported to the redirect URI using Location header.\n return WebResponse.new(302).location(content).to_response\n\n when \"FORM\"\n # 200 OK\n # The authorization request was invalid and the error\n # is reported to the redirect URI using HTML Form Post.\n return WebResponse.new(200, content).html.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend",
"def call_token_fail_api(ticket, reason)\n return call_api(\"/api/auth/token/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend",
"def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end",
"def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end",
"def failure\n return render json: {:message => \"Login Failed\" }, :status => :bad_request\n end",
"def failure\n render json: {error: 'Token is invalid.', messages: params},:status => :unauthorized\n end",
"def auth_failed\n message = params.dig(\"message\") || \"incorrect username and/or password\"\n message = \"Login failed: #{message}\"\n if request.xhr?\n render plain: message, status: :unauthorized\n else\n flash['error'] = message\n redirect_to return_url, allow_other_host: true\n end\n end",
"def failure\n redirect_to :back, flash: { danger: 'Not authorized.' }\n end",
"def failure\n redirect_to login_path,\n alert: \"Authentication failed, please try again.\"\n end",
"def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end",
"def failure\n redirect_to root_url, alert: \"identity failed, please try again.\"\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"def on_failure!(response)\n session.authentication.errors.clear!\n session.authentication.errors.add(:openid, 'OpenID verification failed, maybe the provider is down? Or the session timed out')\n nil\n end",
"def failure\n {:response=>:failure}\n end",
"def failure\n redirect_to new_user_session_path, alert: \"無法取得認證!\"\n end",
"def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end",
"def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end",
"def status_fail!()\n @status = TAC_PLUS_AUTHEN_STATUS_FAIL\n end",
"def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end",
"def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end",
"def unauthorized_request\n Rails.logger.debug \"------ 'Unauthorized' response from resource server ------\"\n\n authorize_path = @organization.authorization_server.authorize_path(callback_url)\n Rails.logger.debug \"------ Redirecting to: #{authorize_path} ------\"\n redirect_to authorize_path\n end",
"def failure_authentication(body = nil)\n api_header(\"1005\", \"Invalid token\", body)\n end",
"def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend",
"def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend",
"def access_denied\n error = error_response_method($e12)\n render :json => error\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def failure\n flash[:error] = \"There was a problem authenticating your PIV.\" # params.permit(:message)[:message] is not helpful UX\n redirect_to url_for_sso_host(\"/login\")\n end",
"def unauthorized_request(err)\n json_response({ message: err.message }, :unauthorized)\n end",
"def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end",
"def invalid_authentication\n render json: { error: 'Invalid request' }, status: 403\n end",
"def invalid_authentication\n Log.error(\"invalid_authentication\")\n render json: {error: 'Invalid authentication'}, status: :unauthorized\n end",
"def failed_auth(msg)\n log_to_rollbar(msg) if defined?(Rollbar)\n DeviseSamlAuthenticatable::Logger.send(msg)\n fail!(error_message.html_safe)\n Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback # rubocop:disable Style/SafeNavigation\n end",
"def after_omniauth_failure_path_for(resource)\n root_path\n end",
"def display_oauth_error\n STDERR.puts \"Oops! Looks like something went wrong there, please try again!\"\n end",
"def unauthorized_access_response(err)\n validation_error(\n err,\n 'invalid_api_params',\n ['invalid_a_t'],\n GlobalConstant::ErrorAction.default\n )\n end",
"def after_omniauth_failure_path_for(scope)\n super(scope)\n end",
"def invalid_login_attempt\n warden.custom_failure!\n json_response({ success: false, message: \"Username/Password incorrect.\" }, 400)\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def invalid_login_attempt\n \n set_flash_message(:alert, :invalid)\n data = {:code => \"NOK\"}\n render json: data \n # render json: flash[:alert], status: 401\n end",
"def test_invalid_oauth_token_response\n # Setup\n @user = setup_user({ 'email' => @user.email })\n\n # Step 1\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n get '/me', {}, headers\n assert_response(@response, :success)\n\n # Step 2\n headers = { 'Authorization' => \"Bearer #{@user.cookie_id}\" }\n\n get '/me', {}, headers\n assert_response(@response, :client_error)\n end",
"def auth_error(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {message: 'Invalid Request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: {error: 'Invalid request'}, status: :unauthorized\n end",
"def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"def auth_failed(response)\n response && response.code == 401\n end",
"def failure(oid, request, session)\n unauthorized\n end",
"def unauthorized_access_response(err)\n error_with_data(\n err,\n 'unauthorized_access_response',\n GlobalConstant::ErrorAction.default\n )\n end",
"def unauthorized_access_response(internal_error_code)\n error_with_identifier(\"unauthorized_access\", internal_error_code)\n end",
"def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"def auth_failure_redirect(path = nil, user: nil, message: nil, **opt)\n Log.info { \"#{__method__}: #{message.inspect}\" }\n local_sign_out # Make sure no remnants of the local session are left.\n re_raise_if_internal_exception(message) if message.is_a?(Exception)\n set_flash_alert(message, **opt) if message.present?\n path ||= after_sign_out_path_for(user || resource)\n redirect_to path\n end",
"def _reviews_get_failure(id)\n get id\n _response_status(404, last_response)\n end",
"def access_denied\n store_location\n redirect_to root_path(:target => request.request_uri)\n #respond_to do |format|\n # format.json do\n # render :partial => \"json/response\",\n # :locals => {\n # :success => false,\n # :message => \"Authorization Required\",\n # :body => nil}\n # end\n # format.html do \n # redirect_to root_path#(:after_login => request.request_uri)\n # end\n #end\n end",
"def authentication_failed\n authentication_failed_msg.text\n end",
"def invalid_authentication\n render json: { error: 'Not Authenticated' }, status: :unauthorized\n end",
"def invalid_authentication\n #render json: {errors: ['Invalid Request']}, status: :unauthorized\n error!('Invalid Request', :unauthorized)\n end",
"def failure\n network = session.delete(:signup_flow_network)\n if params[:message] == 'invalid_credentials'\n scope = session.delete(:signup_flow_scope)\n lambda = network ? Network.klass(network).auth_failure_lambda(scope: scope) : nil\n if lambda && current_user\n lambda.call(current_user)\n set_flash_message(:notice, Network.klass(network).auth_failure_message(scope: scope))\n else\n # When we try to connect the user and fail because the connection was cancelled (ie. we're denied permission\n # by user), we show the signup modal on load with the alert inside the modal rather than float at top of page.\n session[:hide_global_flash] = session[:show_signup_alert] = true\n session[:force_auth] = :immediate\n set_flash_message(:alert, :cancelled)\n end\n else\n msg = \"Network connection failure for user #{current_user ? current_user.person_id : 'unregistered user'}: #{params[:message]}\"\n logger.error(msg)\n if e = request.env['omniauth.error']\n log_stack_trace(e)\n end\n set_flash_message(:alert, :error_communicating)\n end\n respond_to do |format|\n format.html { redirect_to session.delete(:signup_flow_destination) || request.env['omniauth.origin'] || root_path }\n format.json { render_jsend(error: :external_service_failed) }\n end\n end",
"def json_fail(response_params = {})\n json_response 'failed', response_params\n end",
"def invalid_token\n render json: {\n error: \"Invalid Authenticition Token\",\n status: 400\n }, :status => 403\n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def token_not_found_response(err)\n error_with_data(\n err,\n 'token_not_found',\n GlobalConstant::ErrorAction.default\n )\n end",
"def register_failure_callback(callback)\n @duty_failure_callback = callback\n end",
"def oauth2callback\n @g_cal_api.oauth2callback\n end",
"def no_user_with_facebook_uid_or_email_attempt\n warden.custom_failure!\n render :status => 401,\n :json => { :errors => \"User with specified facebook uid or email is not found\", code: 16 },\n :success => false\n end"
] |
[
"0.7027069",
"0.69553906",
"0.693479",
"0.69245285",
"0.68982655",
"0.6872639",
"0.6752903",
"0.6724927",
"0.67187095",
"0.6699484",
"0.6669118",
"0.6665188",
"0.6655913",
"0.6637903",
"0.6634109",
"0.6630609",
"0.65993834",
"0.6584897",
"0.6575338",
"0.6517949",
"0.6475175",
"0.64573437",
"0.639935",
"0.6394184",
"0.63905877",
"0.63665885",
"0.6310463",
"0.6296616",
"0.6294106",
"0.62867725",
"0.62867725",
"0.62867725",
"0.6265185",
"0.62606853",
"0.6247267",
"0.6165357",
"0.61513096",
"0.61375904",
"0.61373997",
"0.6136947",
"0.612383",
"0.6105513",
"0.610425",
"0.610425",
"0.6090749",
"0.60901606",
"0.60901606",
"0.60901606",
"0.60901606",
"0.60901606",
"0.60901606",
"0.60901606",
"0.6079793",
"0.60665363",
"0.606299",
"0.60628694",
"0.6054783",
"0.6025849",
"0.6022358",
"0.6019717",
"0.59963197",
"0.5985815",
"0.59724146",
"0.5968967",
"0.59660786",
"0.59660786",
"0.5959813",
"0.5953811",
"0.5949725",
"0.59489226",
"0.59489226",
"0.59489226",
"0.59489226",
"0.59489226",
"0.592976",
"0.591212",
"0.59112114",
"0.5906579",
"0.5906579",
"0.5906579",
"0.5906579",
"0.5901792",
"0.5896572",
"0.5889602",
"0.5880161",
"0.58793813",
"0.58731145",
"0.58641",
"0.5862719",
"0.585985",
"0.5858568",
"0.583832",
"0.5837847",
"0.58342534",
"0.5832882",
"0.5829157",
"0.58203137",
"0.5806216",
"0.5792302",
"0.5790188"
] |
0.6582985
|
18
|
GET /passwordrecovery/remindersent The success page after the user enters email for password recovery
|
def reminder_sent
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remind\n @title = \"Password Reminder\"\n if param_posted?(:user)\n email = params[:user][:email]\n user = User.find_by_email(email)\n if user\n UserMailer.reminder(user).deliver\n flash[:success] = \"Login information sent to #{email}\"\n redirect_to root_path\n else\n flash[:error] = \"There is no user the email #{email}\"\n end\n end\n end",
"def send_reminders\n User.send_reminders\n redirect_to :back, notice: \"Email reminders sent.\"\n end",
"def recover_password\n begin\n @user = User.find_by_email(params[:user][:email])\n UserMailer.send_password_recovery_mail(@user,\n edit_password_path(@user.authentication_token),\n request.host_with_port) \n flash[:notice] = \"We have sent the password to your email.\"\n rescue Exception => e\n flash[:notice] = \"We have sent the password to your email.\"\n end\n redirect_to root_path\n end",
"def forgot_password\n \n if request.get?\n # forgot_password.rhtml\n elsif request.post?\n user = User.find_by_email(params[:email])\n\n respond_to do |format|\n if user\n user.reset_password_code_until = 1.day.from_now\n user.reset_password_code = Digest::SHA1.hexdigest( \"#{user.email}#{Time.now.to_s.split(//).sort_by {rand}.join}\" )\n user.save!\n Mailer.deliver_forgot_password(user)\n flash[:notice] = \"Instructions on how to reset your password have been sent to #{user.email}\"\n format.html { render :action => \"forgot_password\" }\n else\n flash[:error] = \"Invalid email address: #{params[:email]}\"\n format.html { render :action => \"forgot_password\" }\n end\n end\n end\n \n end",
"def send_recovery_email\n @user = User.find_by_email(params[:user][:email])\n\n if @user\n begin\n @user.reset_recovery_token!\n UserMailer.recovery_email(@user).deliver!\n\n flash[:success] = \"Recovery email sent\"\n rescue StandardError => e\n flash[:errors] = [\"Unable to send recovery email\", e.message]\n end\n\n redirect_to signin_url\n else\n flash.now[:fail] = \"User not found\"\n render :forgot_password\n end\n end",
"def forgot_password\n return unless request.post?\n @user = User.find_by_email(params[:email])\n if @user.nil?\n flash.now[:error] = \"We couldn't find your account. Please check to make sure that the information you entered below is correct.\"\n else\n @user.make_activation_code\n @user.save\n UserNotifier.deliver_password_reset(@user)\n flash.now[:notice] = \"We have found your account and emailed you a link you can use to reset your password. \" +\n \"If you have any questions or need assistance, please contact us.\"\n render :action => 'index'\n end\n end",
"def request_password_reset\n if params[:email]\n user = User.where(email: params[:email]).first\n if user\n password_reset_link = PasswordResetLink.new(user_id: user.id)\n if password_reset_link.save\n #send email\n render json: {status: \"success\", message: \"Reset mail sent\"} and return\n else\n error_message = password_reset_link.errors.full_messages\n end\n else\n error_message = \"User not found\"\n end\n else\n error_message = \"Error invalid parameters\"\n end\n render json: {status: \"Error\", error_message: error_message}\n end",
"def request_password_reset\n if params[:email]\n user = AdminUser.where(email: params[:email]).first\n if user\n password_reset_link = PasswordResetLink.new(user_id: user.id)\n if password_reset_link.save\n #todo: send email\n render json: {status: \"success\", message: \"Reset mail sent\"} and return\n else\n error_message = password_reset_link.errors.full_messages\n end\n else\n error_message = \"User not found\"\n end\n else\n error_message = \"Invalid parameters\"\n end\n render json: {status: \"error\", error_message: error_message}\n end",
"def send_reset_password_instructions\n end",
"def reset_password_notify\n user = User.find_by_email(params[:email])\n\n if user\n user.reset_token\n ::NotifierMailer.reset_password_instructions(user).deliver\n flash.now.notice = t('flash.sessions.reset_password_notify.email_sent')\n else\n flash.now.alert = t('flash.sessions.reset_password_notify.user_not_found')\n end\n\n render :reset_password\n end",
"def password_recovery_success\n PharmacistMailer.password_recovery_success\n end",
"def recover_password\n person = Person.find_by_email(params[:email])\n\n if person\n UserMailer.recovery(:key => CryptoHelper.encrypt(\"#{person.id}:#{person.salt}\"),\n :email => person.email,\n :username => person.username,\n :domain => APP_CONFIG.server_domain).deliver\n render_json :messages => \"Recovery mail sent to specified address.\", :status => :ok and return\n else\n render_json :messages => \"Record not found.\", :status => :not_found and return\n end\n\n end",
"def send_reset_password_instructions; end",
"def forgot_password\n begin\n if params[:email].present?\n user = User.find_by_email(params[:email])\n if user\n user.send_reset_password_instructions({\n redirect_url: forgot_password_redirect_url\n })\n\n response = {:code => \"0\",:status => \"Success\",:message => \"Reset password instruction details has been sent to your email\"}\n else\n response = {:code => \"1\",:status => \"Error\",:message => \"User not exist\"}\n end\n else\n response = {:code => \"1\",:status => \"Error\",:message => \"Please pass an email\"}\n end\n rescue Exception => e\n response = {:code => \"-1\",:status => \"Error\",:message => e.message}\n end\n render :json => response\n end",
"def reset_password\n @user.send_reset_pass_email\n head :no_content\n end",
"def forgot_password\n @page_title = 'Forgotten Password'\n # Always redirect if logged in\n if user?\n flash[:message] = 'You are currently logged in. You may change your password now.'\n redirect_to :action => 'change_password'\n return\n end\n\n # Email disabled... we are unable to provide the password\n if !LoginEngine.config(:use_email_notification)\n flash[:message] = \"Please contact the system admin at #{LoginEngine.config(:admin_email)} to retrieve your password.\"\n redirect_back_or_default :action => 'login'\n return\n end\n\n # Render on :get and render\n return if generate_blank\n params[:user][:email].downcase!\n \n # Handle the :post\n if params[:user][:email].empty?\n flash.now[:warning] = 'Please enter a valid email address.'\n elsif (user = User.find_by_email(params[:user][:email])).nil?\n flash.now[:warning] = \"We could not find a user with the email address #{params[:user][:email]}\"\n else\n begin\n User.transaction(user) do\n key = user.generate_security_token\n url = url_for(:action => 'change_password', :user_id => user.id, :key => key)\n UserNotify.deliver_forgot_password(user, url)\n flash[:notice] = \"Instructions on resetting your password have been emailed to #{params[:user][:email]}\"\n end \n redirect_to :action => 'index', :controller => 'main'\n rescue\n flash.now[:warning] = \"Your password could not be emailed to #{params[:user][:email]}\"\n end\n end\n end",
"def forgot_password\n if request.post?\n @user = User.find_by_email(params[:user][:email])\n if @user\n UserMailer.forgot_password(@user).deliver\n redirect_to :action => \"index\", :controller => 'prelogins'\n else\n flash[:warning] = \"Couldn't send password\"\n end\n else \n render :layout => 'static_layout'\n end\n end",
"def forgot_password\n @doctor = Doctor.find_by_email(params[:email])\n if @doctor.present?\n @doctor.send_reset_password_instructions\n render json: {message: \"Reset Link send succesfully in registerd Email.\"}\n else\n render json: {notice: \"No account is registerd with this Email.\"}\n end\n end",
"def send_reset_password_email\n\n\n @user = User.where(:email => params[:email]).first\n\n if @user\n\n html = File.open(\"app/views/email/password_reset.html.erb\").read\n @renderedhtml = \"1\"\n ERB.new(html, 0, \"\", \"@renderedhtml\").result(binding)\n\n client = Postmark::ApiClient.new('b650bfe2-d2c6-4714-aa2d-e148e1313e37', http_open_timeout: 60)\n response = client.deliver(\n :subject => \"MailFunnels Password Reset\",\n :to => @user.email,\n :from => 'MailFunnels noreply@custprotection.com',\n :html_body => @renderedhtml,\n :track_opens => 'true')\n\n response = {\n success: true,\n message: 'Your password has been sent to your email..'\n }\n\n render json: response\n\n else\n puts \"final else\"\n # Return Error Response\n response = {\n success: false,\n message: 'Sorry, we could not find an account with this email.'\n }\n\n render json: response\n\n end\n\n\n end",
"def send_email\n # Send the email\n ResetPasswordMailer.with(user: @user)\n .reset_password.deliver_later\n\n # Notify the user that the email was sent\n flash[:success] = I18n.t(\"reset_password.sent_email\")\n\n redirect_to root_path\n end",
"def send_reset_email\n begin\n email = params[:email]\n raise 'Invalid email' if(email=='')\n u = User.find_by_email(email)\n ok_msg = \"Email sent, please check your mail.\"\n raise ok_msg if(u==nil)\n key = ApplicationHelper.generate_key\n u.update_attribute(:lost_key,key) \n AppMailer.deliver_lost_password(u,key)\n render(:text=>ok_msg)\n rescue Exception => e\n render(:text=>e.message)\n end\n end",
"def password_rest\n UserMailer.password_rest\n end",
"def forgot\n\t\tif request.post?\n\t\t\t# find user with email specified\n\t\t\tuser = User.find_by_email(params[:user][:email])\n\t\t\tif user\n\t\t\t\t# if found, send the reset code to the email\n \tuser.create_reset_code\n gflash :success => \"Reset code sent to #{user.email}\"\n else\n\t\t\t# else flash pop up regarding error\n gflash :error => \"Email does not exist in system\"\n \tend\n \tredirect_back_or_default('/')\n end\n\tend",
"def create\n @user = User.find_by_email(params[:email])\n #sends an email to the user with password reset instructions (a url with random token)\n @user.deliver_reset_password_instructions! if @user\n flash[:success] = \"Instructions have been sent to your email!\"\n redirect_to root_path\n\n end",
"def forgot_password\n user = UserRequestsPasswordReset.new(:email => registration_params[:email]).call\n UserMailer.password_reset_email(user).deliver if user\n head 204\n end",
"def reminder\n RequestMailer.reminder\n end",
"def create\n if request.post?\n @user = User.find_by_email(params[:email]) \n if @user \n @user.reset_perishable_token!\n magic_url = edit_password_reset_url(@user.perishable_token) \n #MailMailer.deliver_password_reset_instructions(@user,magic_url) \n from = \"support@raiseyourvoicepdx.com\"\n from_alias = \"RaiseYourVoice Support\"\n to = @user.email\n to_alias = \"#{@user.firstname} #{@user.lastname}\"\n subject = \"Raise Your Voice Password Reset Instructions\"\n message = \"Please visit this URL to reset your password: #{magic_url}\"\n send_email(from, from_alias, to, to_alias, subject, message)\n flash[:notice] = \"Instructions to reset your password have been emailed to you.\" \n redirect_to root_url \n else \n flash[:error] = \"No user was found with that email address\" \n end\n end\n end",
"def password_reset\r\n if request.post? && params[:email_address]\r\n flash[:success] = \"Your password has been reset, and emailed to #{params[:email_address]}\"\r\n user = User.find_by_email_address(params[:email_address])\r\n if user\r\n new_password = user.reset_password\r\n email = Emailer.create_password_reset(user, new_password)\r\n Emailer.deliver(email)\r\n end\r\n redirect_to :action => :index\r\n return\r\n end\r\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def forgot_password\n NotificationsMailer.forgot_password\n end",
"def forgot_password\n\t\t@user = User.find_by_email(params[:email])\n\n\t\tif @user\n\t\t\trandom_password = Array.new(10).map { (65 + rand(58)).chr }.join\n\t\t\t@user.password = random_password\n\t\t\t@user.save!\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { @alert = \"Recover password email sent!\" }\n\t\t\tend\n\n\t\t\t#Send user forgot password email\n\t\t\tUserNotification.forgot_password(@user).deliver\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { @alert = \"No account with #{params[:email]} was found!\" }\n\t\t\tend\n\t\tend\n\tend",
"def password_recovery(email, subject = \"CakeMail Password Recovery\", text = \"Your password is: \")\n session.request(\"CakeMail::API::ClassUser\", \"PasswordRecovery\", { :email => email, :subject => subject, :text => text })\n end",
"def reminder\n UsersMailer.reminder\n end",
"def handle_forgotten_2\n email = @cgi['email'] || ''\n return handle_forgotten if email.empty? \n\n user = User.with_email(email)\n\n if user.nil?\n error \"I don't know anyone with that e-mail address\"\n return handle_forgotten\n end\n\n user.send_new_password(FORGOT_PASSWORD)\n\n user.log(\"New password e-mailed to user\")\n\n standard_page(\"Thank You\", \n {'name' => user.contact.con_name,\n 'email' => user.contact.con_email \n },\n PASSWORD_SENT)\n end",
"def reset_password \n if request.post?\n email = params[:reset_password][:email]\n raise NilOrEmptyEmailError if email.nil? || email.empty?\n user = User.find_by_email(email)\n raise EmailNotFoundError if user.nil?\n raise UserNotActiveError if !user.active\n user.reset_password_key = StringUtils::generate_random_string\n user.need_new_password = true \n user.save!\n #send the email\n UserMailer.reset_password_mail(user).deliver \n flash_success \"flash.success.user.reset_password\", {:keep=>true}, {:email=>user.email}\n redirect_to root_path\n else #if get\n render :reset_password\n end\n rescue UserNotActiveError\n flash_error \"flash.error.user.reset_password_inactive_user\", {}, {:email=>email}\n render :reset_password\n rescue NilOrEmptyEmailError\n flash_error \"flash.error.user.reset_password_empty_email\"\n render :reset_password\n #just render the template in case of get\n rescue EmailNotFoundError\n flash_error \"flash.error.user.reset_password_email_not_found\", {}, {:email=>email}\n render :reset_password\n end",
"def forgot_password\n if params[:email].present?\n #@user = User.find_by_email(params[:email])\n @user = User.where(:email => params[:email])\n if @user.present?\n \t@user.first.send_reset_password_instructions\n \trender_json({:result=>{:messages =>[\"ok\"],:rstatus=>1, :errorcode =>\"\"},:data=>{:messages =>[\"You will receive an email with instructions about how to reset your password in a few minutes.\"]}}.to_json)\n else\n render_json({:result=>{:messages => [\"Invalid Email Address\"],:rstatus=>0, :errorcode => 404}}.to_json)\n end \n end\n end",
"def forgot_password\n if request.post?\n @user=User.find(:first, :conditions => [\"email=? AND system_role=?\", params[:user][:email], User::SYSTEM_ROLE_USER])\n if @user.present?\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten;\n newpass = (0..6).map{ o[rand(o.length)] }.join;\n #newpass = (1..7).map{ (0..?z).map(&:chr).grep(/[a-z\\d]/i)[rand(62)]}.join\n @user.encrypted_password = newpass\n \n Notifier.delay.send_password(@user, newpass) if @user.save\n flash[:notice] = \"New password is sent to your email id.\"\n else\n flash[:forget_pw__error] = \"Error\"\n flash[:notice] = \"Email is not registered.\"\n end\n redirect_to :action => \"home\"\n end\n end",
"def forgot_password\n if request.post?\n @user=User.find(:first, :conditions => [\"email=? AND system_role=?\", params[:user][:email], User::SYSTEM_ROLE_USER])\n if @user.present?\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten;\n newpass = (0..6).map{ o[rand(o.length)] }.join;\n #newpass = (1..7).map{ (0..?z).map(&:chr).grep(/[a-z\\d]/i)[rand(62)]}.join\n @user.encrypted_password = newpass\n \n Notifier.send_password(@user, newpass).deliver if @user.save\n flash[:notice] = \"New password is sent to your email id.\"\n else\n flash[:forget_pw__error] = \"Error\"\n flash[:notice] = \"Email is not registered.\"\n end\n redirect_to :action => \"home\"\n end\n end",
"def post(req)\n @subsection = \"forgot\"\n @title = \"Forgot Password\"\n @errors = validate_forgot(@posted)\n return render 'auth/forgot.erb' if has_errors?\n dealership = dealer_dao.get_by_email(@posted['email'])\n dao = Lynr::Persist::Dao.new\n token = dao.create(Lynr::Model::Token.new({\n 'dealership' => dealership,\n 'next' => \"/admin/#{dealership.id}/account/password\",\n }))\n notify_by_email(dealership, token, req)\n @msg = \"Reset notification sent to #{@posted['email']}\"\n render 'auth/forgot.erb'\n end",
"def forgot_password\n\t\t@user = User.find_by_email(params[:email])\n\n\t\tif @user\n\t\t\trandom_password = Array.new(10).map { (65 + rand(58)).chr }.join\n\t\t\t@user.password = random_password\n\t\t\t@user.save!\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to login_path, notice: \"Email sent. Follow the instructions to reset your password.\" }\n\t\t\tend\n\n\t\t\t#Send user forgot password email\n UserNotifier.forgot_password(@user, random_password).deliver\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to recover_path, alert: \"No account with #{params[:email]} was found!\" }\n\t\t\tend\n\t\tend\n\tend",
"def reset_password_request\n user = User.find_by_email(params[:user][:email])\n if(user)\n # add recaptcha check here?\n user.send_password_reset\n redirect_to root_url, :notice => \"Email sent with password reset instructions.\"\n else\n flash[:error] = \"Could not send password. Perhaps you entered you email address incorrectly.\"\n redirect_to root_url\n end\n end",
"def forgot_password\n render :layout => 'minimal' and return if request.get?\n\n if @user = User.find_by_email(params[:email])\n @user.forgot_password\n @user.save\n flash[:notice] = \"A password reset link has been sent to #{@user.email}\" \n redirect_to :controller => :sessions, :action => :login\n else\n flash.now[:error] = \"Could not find a user with that email address\" \n render :layout => 'minimal'\n end\n end",
"def create\n user = User.find_by(email: password_reset_params[:email])\n if user.present?\n user.send_reset_password_instructions\n render json: {responseMessage: \"Your reset request has been sent. Please check your email for a link to reset password.\"}, status: :ok \n else\n render json: { error: \"Email not found\" }, status: :unprocessable_entity\n end\n end",
"def forgot_password\n if request.post?\n # Try to generate and mail a new password\n result = User.generate_and_mail_new_password(params[:user][:name], params[:user][:email])\n\n # Act according to the result\n if result['flash'] == 'forgotten_notice'\n flash.now[:forgotten_notice] = result['message']\n else\n flash[:login_confirmation] = result['message']\n redirect_to(:action => :login)\n end\n end\n end",
"def resend_mail\n if step_active? && merchant_session_active?\n # send an email verification mail to merchant\n @merchant = Merchant.find(session[:temporary_merchant_id])# get merchant details \n MerchantsMailer.registration_email(@merchant).deliver_later\n render 'new'\n return\n else\n redirect_to root_path\n return\n end\n end",
"def send_email\n user = User.find_by_email(params[:email])\n if user\n user.update_attribute('token',Digest::SHA1.hexdigest(rand.to_s)) # Token saved\n # Generates a url where user can edit his password\n url = edit_password_users_path(:token => user.token, :only_path => false) \n email = PasswordMailer.create_sent(user, url)\n email.set_content_type(\"text/html\" )\n PasswordMailer.deliver(email)\n flash[:msg] = \"An email has been sent\"\n redirect_to login_path\n else # When email address given by user does not exists\n flash.now[:msg] = \"user with this email does not exist\"\n render :action => 'forgot_password', :layout => 'application'\n end\n end",
"def request_password\n\t\t@user = User.find_by_email(params[:email])\n\t\tif @user == nil || @user == ''\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please enter a valid email\"\n\t\telse\n\t\t\t@random_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n\t\t\t@url = root_url + 'reset_password/' + @random_string\n \t\tUser.where(:id => @user.id).update_all(reset_password_token: @random_string)\n\t\t\t@email = UserMailer.forgot_password(@user, @url).deliver\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please check your email to reset your password\"\n\t end\n\tend",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def forget_pass\n\t\t@user=User.find_by_email(params[:email])\n\t\t@status=\"\" \n\t\t\tif @user!=nil\n\t\t\t@user.send_reset_password_instructions()\n\t\t\t@status={\"status-msg\"=>\"600\"} #113 =>email sent\n\t\t\telse\n\t\t\t@status={\"status-msg\"=>\"601\"} #113 =>invalid email\n\t\t\tend\n\t\trender :json =>@status.to_json\n\t\tend",
"def forgot\n u = User.find_by_email(params[:user][:email])\n if u and u.send_new_password\n flash[:message] = 'A new password has been sent by email.'\n redirect_to root_url\n else\n flash[:error] = \"Couldn't send password.\"\n end\n end",
"def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a message with reset instructions\"\n else\n flash[:notice] = resp.errors.first + \". Please try again.\"\n redirect_to \"/lost_pass\"\n end\n end",
"def password_reset(user)\n mail_to user, password_reset_subject\n end",
"def password_recovery_success(pharmacist)\n @pharmacist = pharmacist\n\n mail to: @pharmacist.email_primary, subject: \"Password reset successful\"\n end",
"def send_reminder\r\n\t\tif Date.today == expiration_date - 1\r\n\t\t\tReminderMailer.food_reminder_msg(@user).deliver\r\n \t\tflash[:notice] = \"#{@user.username} has been notified by email.\" \r\n \tend\r\n end",
"def handle_forgotten\n values = {\n 'form_target' => url(:handle_forgotten_2),\n 'email' => @cgi['email'] || @data.user_name\n }\n standard_page(\"Retrieve user information\", values, RETRIEVE_USER)\n end",
"def public_forgot_password_send\n if params[:form_forgot_password]\n results = CsApi::Account.reset_password(params[:form_forgot_password][:username])\n logger.info \"[SessionsController][DEBUG]==== reset results: #{results}\"\n if results['success'].eql?('true')\n flash[:notice] = results[\"message\"]\n redirect_to reset_password_url\n else \n flash[:error] = results[\"message\"]\n redirect_to forgot_password_url\n end\n end\n end",
"def assist\n @email = params[:email]\n if request.post? && !@email.blank?\n user = User.find_by_email(@email)\n if user.nil? || (!user.active? && !user.pending?)\n flash.now[:error] = \"We don't have an active account for '#{@email}'. Please try again, or contact us at #{SUPPORT_EMAIL} if you need assistance.\"\n else\n user.send_reset_password_email!\n flash[:notice] = \"An email has been sent to #{@email}.<br />\".html_safe\n flash[:notice] << \"Follow the instructions in the email to reset your password.\"\n redirect_to signin_url\n end\n end\n end",
"def sent_reset_password_mail\n @student = Student.where(\"uin ='#{params[:session][:uin]}'\")\n if @student[0].nil?#case : the UIN is not signed up\n flash[:warning] = \"The student of UIN doesn't sign up\"\n redirect_to '/students/forget_password' \n else\n @student[0].reset_password_confirmation_token#create the reset password confirmation token and the reset email sent time\n StudentMailer.reset_password(@student[0]).deliver\n flash[:notice] = \"Please check your tamu email to reset your password!\"\n redirect_to root_path\n end\n end",
"def password_reset_request\n end",
"def forgot\r\n if pass_reset_params[:email].blank?\r\n redirect_to 'password/resetpass'\r\n flash[:danger] = \"Email not present\"\r\n end\r\n\r\n @user = User.find_by(email: pass_reset_params[:email].downcase)\r\n @user.skip_icpassport_validation = true\r\n @user.skip_name_validation = true\r\n @user.skip_package_validation = true\r\n @user.skip_password_validation = true\r\n\r\n if @user.present?\r\n @user.generate_password_token!\r\n sendmail(@user.email, @user.name, @user.reset_password_token)\r\n redirect_to '/'\r\n flash[:info] = \"Check email for reset password instruction\"\r\n else\r\n redirect_to '/password/resetpass'\r\n flash[:danger] = \"Email address not found. Please check and try again.\"\r\n end\r\n end",
"def student_password_reset\n StudentMailer.student_password_reset\n end",
"def password_reset\n AccountMailer.password_reset\n end",
"def forgot_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = 'Request to change your password'\n @body [\"name\"] = user.login\n @body[\"url\"] = \"http://#{Site.current.domain}/reset_password/#{user.reset_password_code}\" \n end",
"def create\n @user = User.find_by_email(params[:email])\n\n #Send an email to the user with reset instructions\n @user.deliver_reset_password_instructions! if @user\n\n # Tell the user instructions have been sent. Does not specify if email exists in DB, so we don't leak info to hackers\n redirect_to(root_path, :notice => 'Password reset instructions have been emailed to you.')\n end",
"def password_reset\n UserMailMailer.password_reset\n end",
"def create\n @user = User.find_by_email(params[:email])\n \n if @user.initiate_password_reset_request!\n UserMailer.password_change_request(@user).deliver if @user.needs_password_reset_mail?\n render :action => \"mail_sent\"\n else\n flash.now[:notice] = \"That email doesn't exist in our system.\"\n render :action => \"new\"\n end\n \n end",
"def password_reset\n MailerMailer.password_reset\n end",
"def create\n @momentum_cms_user = MomentumCms::User.where(email: params[:momentum_cms_user][:email]).first\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @momentum_cms_user.deliver_reset_password_instructions! if @momentum_cms_user\n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = 'Instructions have been sent to your email.'\n redirect_to cms_admin_root_path\n end",
"def create\n @user = User.where(email: (params[:email])).first\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @user.generate_reset_password_token! if @user\n @url = edit_password_reset_url(@user.reset_password_token)\n\n @mail = send_mail({\n :subject=> \"Password Reset\",\n :from_name=> \"Password Reset\",\n :text=>\"Use the link provided to reset your password\",\n :email=> @user.email,\n :name=> \"#{@user.first_name}\",\n :html=> render_to_string('/mail_templates/password_reset.html.erb', :layout => false, :locals => {:address => @url, :name => @user.first_name}),\n :from_email=>\"notify@4beauty.net\"\n })\n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n redirect_to(root_path, :notice => 'Instructions have been sent to your email.')\n end",
"def password_reset\n @greeting = \"Hi\"\n\n mail to: \"nitish.k008@gmail.com\"\n end",
"def forgotten\n if request.get?\n render 'sessions/forgotten'\n elsif request.post?\n if params[:username].present? &&\n (user = QuoVadis.model_class.where(:username => params[:username]).first)\n if user.email.present?\n user.generate_token\n QuoVadis::Notifier.change_password(user).deliver\n flash_if_present :notice, 'quo_vadis.flash.forgotten.sent_email'\n redirect_to :root\n else\n flash_if_present :alert, 'quo_vadis.flash.forgotten.no_email', :now\n render 'sessions/forgotten'\n end\n else\n flash_if_present :alert, 'quo_vadis.flash.forgotten.unknown', :now\n render 'sessions/forgotten'\n end\n end\n end",
"def password_reset_instructions(user)\n @user = user\n #default_url_options[:host] = \"authlogic_example.binarylogic.com\"\n mail to: user.email, subject: 'Password reset for HiKultura'\n \n \n end",
"def forgot\n return unless params['email']\n\n # is there a user with that email?\n (user = User.find_by_email(params['email'])) or not_found\n # send them an email with a reset token\n if user\n token = SecureRandom.hex(10)\n user.reset = token\n user.save\n ResetMailer.with(user: user).reset_password.deliver_now\n end\n render plain: 'A link has been sent to that email if it exists'\n end",
"def create \n \n @user = User.find_by_email(params[:email].gsub(/\\s+/, \"\").downcase)\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n if @user \n # @user.deliver_reset_password_instructions!\n t = Time.now + 1.day\n @user.update_columns(reset_password_token_expires_at: t, reset_password_email_sent_at: Time.now, set_password_token: SecureRandom.hex(10))\n\n # First we should note the date that this request was made then we will add to the date by one day and save that.\n # We then need to check that the time between the reset password and the expiry date are still valid if they are then we let them stay in the change password form page if not then we need to redirect\n # to the home page where they can try again. We also need to check to make sure that they didnt already change the password. If they did then we need to make sure that we redirect them\n\n ResetPasswordEmailWorker.perform_async(@user.id)\n \n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = 'Instructions have been sent to your email.'\n redirect_to root_path\n\n else\n flash[:danger] = 'Please make sure you have correctly typed in the email.'\n render :new\n\n end\n end",
"def password_reset\n ClientMailer.password_reset\n end",
"def forgot_password\n return unless request.post?\n if @user = User.find_by_email(params[:email])\n @user.forgot_password\n @user.save\n flash.now[:notice] = \"The password reset link has been sent to your email address.\"\n else\n flash.now[:notice] = \"Could not find a user with that email address.\" \n end\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def send_reset_password_instructions()\n generate_reset_password_token! if should_generate_reset_token?\n send_devise_notification(:reset_password_instructions)\n end",
"def forgot_password\n @user = User.find_by_email(params[:email])\n if @user\n @status = I18n.t(:Success)\n else\n @status = I18n.t(:Failure)\n end\n end",
"def forgot_password\n return unless request.post?\n @user = User.find_first(['email = ?', @params[:user]['email']])\n if @user\n @user.update_attributes({ :token => token_string(10),\n :token_expiry => 7.days.from_now })\n url = url_for(:controller => 'user', :action => 'login_by_token', \n :id => @user.id, :token => @user.token)\n UserNotifier.deliver_forgot_password(@user, url) \n render :action => 'forgot_password_done'\n else\n flash[:notice] = \"El correo #{@params[:user]['email']} NO existe en el salva!\"\n end\n end",
"def reset_password_notification(request)\n return ResetPasswordNotificationResponse.new(false, 'Reset Password Notification request null') if request.nil?\n\n return ResetPasswordNotificationResponse.new(false, 'Email does not exist') unless User.find_by_email(request.email)\n UserNotifierMailer.send_reset_password_email(request.email).deliver\n return ResetPasswordNotificationResponse.new(true, 'Email sent')\n end",
"def password_recover\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n if user = LatoCore::Superuser.find_by(email: params[:email].downcase)\n # genero il codice da salvare come session code\n code = \"RECPSW-#{SecureRandom.urlsafe_base64}\"\n # genero il codice per formare l'url di recupero password\n code_url = URI.encode(\"#{user.id}::#{Time.now}::#{code}\")\n # memorizzo il session_code sul db\n user.update_attribute(:session_code, code)\n # invio una mail di recupero\n LatoCore::SuperusersMailer.recover_password(user.email, code_url).deliver_now\n flash[:success] = CORE_LANG['recover_password']['confirm_send']\n else\n flash[:warning] = CORE_LANG['superusers']['not_found']\n end\n redirect_to lato_core.login_path\n end",
"def forgot_password\n\n if params[:method]==\"post\"\n @errors = Array.new\n #email Validation. First checks if its empty and then checks if it has the right format\n if params[:email].blank?\n @errors.push(\"The email is empty\")\n elsif !match_email(params[:email])\n @errors.push(\"The format of the email is wrong\")\n end\n \n if @errors.count==0\n random_token = SecureRandom.urlsafe_base64\n sql=\"UPDATE organizations SET random_token ='?' WHERE organizations.email = '?'\"\n execute_query(sql, random_token, params[:email])\n UserMailer.password_reset(random_token, params[:email]).deliver\n redirect_to '/', :alert => \"Email sent with password reset instructions.\"\n return\n else\n render :template => 'signup/forgot_password'\n end\n end\n\n end",
"def create \n logger.info \"Loading PasswordReset create action\"\n @user = User.find_by_email(params[:email])\n logger.debug \"User attributes hash: #{@user.attributes.inspect}\"\n \n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @user.deliver_reset_password_instructions! if @user\n logger.debug \"Reset email sent to user with instructions\"\n \n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = t(:email_sent, :scope => [:business_validations, :password_reset])\n redirect_to root_path\n end",
"def forgot_password\n return unless request.post?\n if @user = User.find_by_email(params[:user][:email])\n @user.forgot_password\n @user.save\n redirect_back_or_default('/')\n flash[:notice] = \"A password reset link has been sent to your email address\" \n else\n flash[:alert] = \"Could not find a user with that email address\" \n end\n end",
"def create\n\t user = User.find_by_email(params[:email])\n\t user.send_password_reset if user\n\t flash[:success] = \"Email sent with password reset instructions.\"\n\t redirect_to '/login'\n\tend",
"def forgot_password \n if !params[:email].blank? && @user = User.find_by_email(params[:email])\n flash.now[:notice] = \"A password reset link has been sent to your email address\" \n @user.forgot_password\n @user.save \n else\n flash.now[:error] = \"Could not find a user with that email address\" \n end\n \n respond_to do |format| \n format.html { redirect_to '/' }\n format.js \n end\n end",
"def create\n @user = User.find_by_email(params[:email])\n if @user\n @user.deliver_password_reset_instructions!\n flash[:notice] = t 'password_resets.instructions_are_sent'\n redirect_to login_path\n else\n flash.now[:error] = t 'password_resets.no_email', :email => params[:email]\n render :action => :new\n end\n end",
"def lost_password\r\n redirect_to :controller => 'welcome' and return unless Setting.lost_password?\r\n if params[:token]\r\n @token = Token.find_by_action_and_value(\"recovery\", params[:token])\r\n redirect_to :controller => 'welcome' and return unless @token and !@token.expired?\r\n @user = @token.user\r\n if request.post?\r\n @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]\r\n if @user.save\r\n journal(\"recovery pass\",@user.id)\r\n @token.destroy\r\n flash[:notice] = l(:notice_account_password_updated)\r\n redirect_to :action => 'login'\r\n return\r\n end\r\n end\r\n render :template => \"account/password_recovery\"\r\n return\r\n else\r\n if request.post?\r\n user = User.find_by_mail(params[:mail])\r\n # user not found in db\r\n flash.now[:notice] = l(:notice_account_unknown_email) and return unless user\r\n # create a new token for password recovery\r\n token = Token.new(:user => user, :action => \"recovery\")\r\n if token.save\r\n Mailer.deliver_lost_password(token)\r\n journal(\"mailer-lost pass-\"+user.mail,user.id)\r\n redirect_to :controller => 'welcome', :action => 'lost_email_sent'\r\n\r\n # flash[:notice] = l(:notice_account_lost_email_sent)\r\n # redirect_to :action => 'login'\r\n\r\n return\r\n end\r\n end\r\n end\r\n end",
"def create\n puts 'Recovery password!!!!!!!!!!!!!!!!!!!!!!'\n self.resource = resource_class.send_reset_password_instructions(resource_params)\n\n if successfully_sent?(resource)\n render status: 200, json: nil\n else\n render status: 400, json: { message: 'Invalid email!' }\n # binding.pry\n end\n end",
"def create\n reset_password = ResetPassword.new(params[:reset_password])\n reset_password.ip = request.ip\n reset_password.user = User.first(:email => params[:email])\n # TODO sent it, errors\n\n if reset_password.user.nil?\n flash[:reset_password_notice] = \"email not found\"\n elsif reset_password.save\n flash[:reset_password_notice] = \"email sent to reset password. #{request.url}/#{reset_password.token}/edit\"\n else\n p reset_password.errors\n flash[:reset_password_notice] = \"some error occured\"\n end\n respond_to do |format|\n url = reset_password.success_url + \n if reset_password.success_url =~ /^http/\n \"?flash=#{Base64.encode64('reset_password_notice$' + flash[:reset_password_notice])}\"\n else\n \"\"\n end\n format.html { redirect_to(url) }\n format.xml { render :status => :created, :location => reset_password.success_url }\n end\n end",
"def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"to@example.org\"\n end",
"def forgot_password\n @greeting = 'Hi'\n\n mail to: 'to@example.org'\n end",
"def send_recover_password\n self.generate_password_recover\n UserMailer.recover_password(self.id).deliver_now\n end",
"def forgot_password\n if request.post?\n user = User.find_by_email(params[:user][:email])\n if user\n user.create_reset_code!\n flash[:notice] = t(\"users.flash.forgot_password\", :email => user.email)\n redirect_to forgot_password_path\n else\n flash.now[:error] = t(\"users.flash.forgot_password_fail\", :email => params[:user][:email])\n end\n end\n end"
] |
[
"0.7406359",
"0.7377437",
"0.71772474",
"0.7158029",
"0.71422815",
"0.7114576",
"0.7055552",
"0.70383835",
"0.70267326",
"0.70266116",
"0.7014469",
"0.7010182",
"0.6998817",
"0.69758505",
"0.6960167",
"0.6954683",
"0.69166106",
"0.69119704",
"0.6910484",
"0.6874601",
"0.68427396",
"0.6811979",
"0.67932194",
"0.6785264",
"0.6778291",
"0.67663425",
"0.67656714",
"0.675516",
"0.67529756",
"0.67529756",
"0.67529756",
"0.67445123",
"0.6742319",
"0.67300725",
"0.67297035",
"0.6700989",
"0.6698491",
"0.6696898",
"0.66936326",
"0.6691169",
"0.66894287",
"0.66813046",
"0.6678852",
"0.6670258",
"0.6663427",
"0.66505957",
"0.66500735",
"0.6641251",
"0.6637456",
"0.6637456",
"0.6637456",
"0.66350883",
"0.66301334",
"0.6619537",
"0.6618788",
"0.6608385",
"0.6606912",
"0.66047424",
"0.6600121",
"0.6593252",
"0.65921545",
"0.65898466",
"0.6585922",
"0.65827817",
"0.657875",
"0.6577131",
"0.6573298",
"0.65676874",
"0.6566865",
"0.65580136",
"0.65527755",
"0.6550348",
"0.65409976",
"0.65388644",
"0.6534684",
"0.6534179",
"0.65291",
"0.6528248",
"0.6514847",
"0.6512855",
"0.6512855",
"0.6512855",
"0.6509607",
"0.6507008",
"0.65059674",
"0.6505379",
"0.65001863",
"0.6497569",
"0.6491419",
"0.64852846",
"0.647689",
"0.64768314",
"0.6469011",
"0.64685124",
"0.6465766",
"0.6462717",
"0.64598626",
"0.6457184",
"0.64555645",
"0.6452662"
] |
0.650398
|
86
|
GET /passwordrecovery/recover/:token The page where the user lands coming from the password recovery email
|
def recover
@user = User.find_by password_reset_digest: params[:token]
if !@user
flash[:alert] = 'Invalid link'
redirect_to '/password-recovery/remind-password'
return
end
@token = params[:token]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def password_recover\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n if user = LatoCore::Superuser.find_by(email: params[:email].downcase)\n # genero il codice da salvare come session code\n code = \"RECPSW-#{SecureRandom.urlsafe_base64}\"\n # genero il codice per formare l'url di recupero password\n code_url = URI.encode(\"#{user.id}::#{Time.now}::#{code}\")\n # memorizzo il session_code sul db\n user.update_attribute(:session_code, code)\n # invio una mail di recupero\n LatoCore::SuperusersMailer.recover_password(user.email, code_url).deliver_now\n flash[:success] = CORE_LANG['recover_password']['confirm_send']\n else\n flash[:warning] = CORE_LANG['superusers']['not_found']\n end\n redirect_to lato_core.login_path\n end",
"def recover_password\n begin\n @user = User.find_by_email(params[:user][:email])\n UserMailer.send_password_recovery_mail(@user,\n edit_password_path(@user.authentication_token),\n request.host_with_port) \n flash[:notice] = \"We have sent the password to your email.\"\n rescue Exception => e\n flash[:notice] = \"We have sent the password to your email.\"\n end\n redirect_to root_path\n end",
"def recover_password\n person = Person.find_by_email(params[:email])\n\n if person\n UserMailer.recovery(:key => CryptoHelper.encrypt(\"#{person.id}:#{person.salt}\"),\n :email => person.email,\n :username => person.username,\n :domain => APP_CONFIG.server_domain).deliver\n render_json :messages => \"Recovery mail sent to specified address.\", :status => :ok and return\n else\n render_json :messages => \"Record not found.\", :status => :not_found and return\n end\n\n end",
"def recover_password params\n user = find_with_email(params[:email])\n user.send_recover_password\n end",
"def lost_password\r\n redirect_to :controller => 'welcome' and return unless Setting.lost_password?\r\n if params[:token]\r\n @token = Token.find_by_action_and_value(\"recovery\", params[:token])\r\n redirect_to :controller => 'welcome' and return unless @token and !@token.expired?\r\n @user = @token.user\r\n if request.post?\r\n @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]\r\n if @user.save\r\n journal(\"recovery pass\",@user.id)\r\n @token.destroy\r\n flash[:notice] = l(:notice_account_password_updated)\r\n redirect_to :action => 'login'\r\n return\r\n end\r\n end\r\n render :template => \"account/password_recovery\"\r\n return\r\n else\r\n if request.post?\r\n user = User.find_by_mail(params[:mail])\r\n # user not found in db\r\n flash.now[:notice] = l(:notice_account_unknown_email) and return unless user\r\n # create a new token for password recovery\r\n token = Token.new(:user => user, :action => \"recovery\")\r\n if token.save\r\n Mailer.deliver_lost_password(token)\r\n journal(\"mailer-lost pass-\"+user.mail,user.id)\r\n redirect_to :controller => 'welcome', :action => 'lost_email_sent'\r\n\r\n # flash[:notice] = l(:notice_account_lost_email_sent)\r\n # redirect_to :action => 'login'\r\n\r\n return\r\n end\r\n end\r\n end\r\n end",
"def lost_password\n (redirect_to(home_url); return) unless Setting.lost_password?\n if params[:token]\n @token = Token.find_token(\"recovery\", params[:token].to_s)\n if @token.nil? || @token.expired?\n redirect_to home_url\n return\n end\n @user = @token.user\n unless @user && @user.active?\n redirect_to home_url\n return\n end\n if request.post?\n @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]\n if @user.save\n @token.destroy\n flash[:notice] = l(:notice_account_password_updated)\n redirect_to signin_path\n return\n end\n end\n render :template => \"account/password_recovery\"\n return\n else\n if request.post?\n user = User.find_by_mail(params[:mail].to_s)\n # user not found or not active\n unless user && user.active?\n flash.now[:error] = l(:notice_account_unknown_email)\n return\n end\n # user cannot change its password\n unless user.change_password_allowed?\n flash.now[:error] = l(:notice_can_t_change_password)\n return\n end\n # create a new token for password recovery\n token = Token.new(:user => user, :action => \"recovery\")\n if token.save\n Mailer.lost_password(token).deliver\n flash[:notice] = l(:notice_account_lost_email_sent)\n redirect_to signin_path\n return\n end\n end\n end\n end",
"def lost_password\n (redirect_to(home_url); return) unless Setting.lost_password?\n if params[:token]\n @token = Token.find_token(\"recovery\", params[:token].to_s)\n if @token.nil? || @token.expired?\n redirect_to home_url\n return\n end\n @user = @token.user\n unless @user && @user.active?\n redirect_to home_url\n return\n end\n if request.post?\n @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]\n if @user.save\n @token.destroy\n Mailer.password_updated(@user)\n flash[:notice] = l(:notice_account_password_updated)\n redirect_to @on_success_url || home_url\n return\n end\n end\n render :template => \"account/password_recovery\"\n return\n else\n if request.post?\n email = params[:mail].to_s\n user = User.find_by_mail(email)\n # user not found\n unless user\n flash.now[:error] = l(:notice_account_unknown_email)\n redirect_to @on_falure_url || :back\n return\n end\n unless user.active?\n handle_inactive_user(user, lost_password_path)\n redirect_to @on_falure_url || :back\n return\n end\n # user cannot change its password\n unless user.change_password_allowed?\n flash.now[:error] = l(:notice_can_t_change_password)\n redirect_to @on_falure_url || :back\n return\n end\n # create a new token for password recovery\n token = Token.new(:user => user, :action => \"recovery\")\n if token.save\n # Don't use the param to send the email\n recipent = user.mails.detect {|e| email.casecmp(e) == 0} || user.mail\n Mailer.lost_password(token, recipent).deliver\n flash[:notice] = l(:notice_account_lost_email_sent)\n redirect_to @on_success_url || home_url\n return\n end\n end\n end\n end",
"def password_edit\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n redirect_to lato_core.root_path if core_controlSession\n # splitto il token ricevuto (formato: id utente, timestamp, session_code)\n data = URI.decode(params[:token]).split('::')\n # controllo che il formato sia corretto\n if data.length != 3\n flash[:warning] = CORE_LANG['recover_password']['recover_error_token']\n redirect_to lato_core.login_path and return false\n end\n # identifico i singoli dati\n user_id = data.first\n timestamp = data.second\n session_code = data.last\n # cerco l'utente e, se non esiste, stampo un errore\n @user = LatoCore::Superuser.find(user_id)\n if !@user\n flash[:warning] = CORE_LANG['recover_password']['recover_error_user']\n redirect_to lato_core.login_path and return false\n end\n # verifico che il token sia ancora valido e non abbia superato le 24 ore\n if !time = timestamp.to_time || time < Time.now - 24.hours\n flash[:warning] = CORE_LANG['recover_password']['recover_error_token_time']\n redirect_to lato_core.login_path and return false\n end\n # verifico che il session_code del token sia corretto\n if @user.session_code != session_code\n flash[:warning] = CORE_LANG['recover_password']['recover_error_token']\n redirect_to lato_core.login_path and return false\n end\n # genero un nuovo token per togliere la validita' al link di recupero password\n # e lo memorizzo all'utente\n new_code = SecureRandom.urlsafe_base64\n @user.update_attribute(:session_code, new_code)\n end",
"def password_reset(token)\n get(\"/v1/password_resets/#{token}\")\n end",
"def password_reset\r\n token = params.first[0]\r\n @person = Person.find_by_password_reset_token(token)\r\n\r\n if @person.nil?\r\n flash[:error] = 'You have not requested a password reset.'\r\n redirect_to :root\r\n return\r\n end\r\n\r\n if @PERSON.password_expires_after < DateTime.now\r\n clear_password_reset(@person)\r\n @person.save\r\n flash[:error] = 'Password reset has expired. Please request a new password reset.'\r\n redirect_to :forgot_password\r\n end\r\n end",
"def show\n redirect_to edit_password_reset_path\n end",
"def forgot_password\n # verify user\n @user = User.find_by(email: params[:email], token: params[:token])\n if @user\n render\n else\n redirect_to home_path, alert: 'Go away, wrong credentials!'\n end\n end",
"def forgot_password token\n recipients token.user.email\n from SETTING.master_email!\n sent_on Time.now \n subject t(:forgot_password_title, :name => token.user.name, :host => SETTING.master_domain!)\n \n body \\\n :user => token.user,\n :url => reset_password_form_identities_url(:host => SETTING.master_domain!, :token => token.token)\n end",
"def password_recovery\n session[:user_id] = nil\n id = params[:uhash].slice(0, params[:uhash].length-40)\n @user = User.find_by_id(id)\n if not @user or (@user.id.to_s + Digest::SHA1.hexdigest(\"YA\" + @user.email + \"YA\") != params[:uhash])\n return render :text => \"Link is not valid or expired\"\n end\n r = Recovery.find_by_user_id(@user[:id])\n if not r or r[:recover_hash] != params[:hash] or (Time.now - r.updated_at) > 1.day\n return render :text => \"Link is not valid or expired\"\n end\n r.destroy\n session[:user_id] = @user.id\n session[:recovery] = true\n redirect_to schedule_url\n end",
"def password_reset\n\t token = params.first[0]\n\t @user = User.find_by_confirm_token(token)\n\n\t if @user.nil?\n\t flash[:error] = 'You have not requested a password reset.'\n\t return redirect_to :root\t \n\t end\n\n\t if @user.password_expires_after < DateTime.now\n\t clear_password_reset(@user)\n\t @user.save\n\t flash[:error] = 'Password reset has expired. Please request a new password reset.'\n\t redirect_to :forgot_password\n\t end\n\tend",
"def forgot_password\n return unless request.post?\n @user = User.find_first(['email = ?', @params[:user]['email']])\n if @user\n @user.update_attributes({ :token => token_string(10),\n :token_expiry => 7.days.from_now })\n url = url_for(:controller => 'user', :action => 'login_by_token', \n :id => @user.id, :token => @user.token)\n UserNotifier.deliver_forgot_password(@user, url) \n render :action => 'forgot_password_done'\n else\n flash[:notice] = \"El correo #{@params[:user]['email']} NO existe en el salva!\"\n end\n end",
"def state_url\n [Darrrr.recovery_provider(self.audience).recover_account, \"id=#{CGI::escape(token_id.to_hex)}\"].join(\"?\")\n end",
"def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a message with reset instructions\"\n else\n flash[:notice] = resp.errors.first + \". Please try again.\"\n redirect_to \"/lost_pass\"\n end\n end",
"def send_recovery_email\n @user = User.find_by_email(params[:user][:email])\n\n if @user\n begin\n @user.reset_recovery_token!\n UserMailer.recovery_email(@user).deliver!\n\n flash[:success] = \"Recovery email sent\"\n rescue StandardError => e\n flash[:errors] = [\"Unable to send recovery email\", e.message]\n end\n\n redirect_to signin_url\n else\n flash.now[:fail] = \"User not found\"\n render :forgot_password\n end\n end",
"def forgot_password(user,reset_token)\n @user=user\n @reset_token=reset_token\n @mob_url=\"Driveo://driveo.herokuapp.com/api/v1/authentication/resetpassword?hash=#{@reset_token}\"\n @url=\"https://driveo.herokuapp.com/api/v1/authentication/mobile/resetpassword?hash=#{@reset_token}\"\n\n mail to: @user.email, subject: \"Driveo Reset Password\"\n end",
"def with_reset_password_token(token); end",
"def send_recover_password\n self.generate_password_recover\n UserMailer.recover_password(self.id).deliver_now\n end",
"def reset_password\n @user = User.find_by_forgot_password_token(params[:forgot_password_token])\n raise_404 unless good_password_change_request?\n\n @user.reset_password!\n end",
"def reset_password\n @token = params[:token]\n @user = User.load_from_reset_password_token(@token)\n\n if @user.blank?\n not_authenticated\n return\n end\n end",
"def disable_password_reset\n redirect_to '/404'\n end",
"def reset_password\n user = User.find_by(:reset_password_token => params[:token])\n\n if user\n self.establish_session user\n redirect_to profile_url\n else\n # render a 404\n end\n end",
"def edit\n @user = User.find_by_password_reset_token(params[:token]) \n end",
"def reset_password_with_token\n user = User.first(:perishable_token => params[:token])\n if user.nil? || user.password_reset_sent.to_time < 2.days.ago\n flash[:notice] = \"Your link is no longer valid, please request a new one.\"\n redirect_to \"/forgot_password\"\n else\n @token = params[:token]\n @user = user\n render \"login/password_reset\"\n end\n end",
"def index\n redirect_to new_password_reset_path\n end",
"def index\n redirect_to new_password_reset_path\n end",
"def reset_password\n @user.send_reset_pass_email\n head :no_content\n end",
"def handle_forgotten\n values = {\n 'form_target' => url(:handle_forgotten_2),\n 'email' => @cgi['email'] || @data.user_name\n }\n standard_page(\"Retrieve user information\", values, RETRIEVE_USER)\n end",
"def show\n return render_404 unless @user\n\n if @user.reset_password_sent_at < RailsJwtAuth.reset_password_expiration_time.ago\n return render_410\n end\n\n render_204\n end",
"def password_reset\n user = User.first\n user.password_reset_token = new_token\n email = EmailAddress.find_by(id: user.primary_email_address_id).email\n UserMailer.password_reset(user, email)\n end",
"def password_reset(user, token)\n @user = user\n @token = token\n mail(\n to: @user.email,\n from: 'no-replay@lagis-index.com',\n subject: 'パスワードの再設定'\n )\n end",
"def password_reset_request\n end",
"def edit\n @user = User.find_by_password_reset_token!(params[:id])\n if !params[:password_reset_confirmation].nil? && params[:password_reset_confirmation]==\"no\"\n redirect_to root_url, :flash => {:notice => \"Thank you for verifying your profile! \"} and return\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to new_password_reset_path, :flash => {:error => \"Password reset link is invalid.\"}\n end",
"def reset_password_notify\n user = User.find_by_email(params[:email])\n\n if user\n user.reset_token\n ::NotifierMailer.reset_password_instructions(user).deliver\n flash.now.notice = t('flash.sessions.reset_password_notify.email_sent')\n else\n flash.now.alert = t('flash.sessions.reset_password_notify.user_not_found')\n end\n\n render :reset_password\n end",
"def lost_password(user, token, recipient=nil)\n recipient ||= user.mail\n @token = token\n @url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value)\n mail :to => recipient,\n :subject => l(:mail_subject_lost_password, Setting.app_title)\n end",
"def edit\n @user = User.find_by_password_reset_token!(params[:user_id])\n rescue ActiveRecord::RecordNotFound\n redirect_to new_password_reset_path, :flash => {:error => \"Password reset link has expired.\"}\n end",
"def recover_password\n raise Webapp::UserSessionExistsError if user_session\n if request.get?\n @handle_or_user_name = \"\" \n \n elsif request.post?\n @handle_or_user_name = params[:handle_or_email]\n raise Webapp::BadParametersError if @handle_or_user_name.nil? || @handle_or_user_name.empty?\n user = User.find_by_handle_or_email(@handle_or_user_name)\n #Should create a PasswordRecovery\n password_recovery = PasswordRecovery.create_password_recovery(user.id)\n #Should send an email\n UserMailer.deliver_recover_password_instructions(user)\n #TODO: Check why the message does not apears correctly in Web GUI\n #message = sprintf(t(:recover_password_instructions_sent),\n flash_notice(:recover_password_instructions_sent,user.email)\n redirect_to root_url\n #should flash a message and redirect to root_url\n \n else\n raise Webapp::BadRequestError\n end\n \n rescue Webapp::BadRequestError\n logger.error(\"Invalid Request type. Client IP: \"+request.remote_ip)\n flash_error(:invalid_request)\n redirect_to root_url\n \n rescue Webapp::UserSessionExistsError\n logger.error \"Attempt to recover a password within a user session. Client IP: \"+request.remote_ip\n flash_error(:user_session_exists)\n redirect_to root_url\n rescue Webapp::BadParametersError, ActiveRecord::RecordNotFound\n logger.error(\"Attempt to recover a password but email or user name was not provided or not found Email or Name was #{@email_or_user_name}. Client IP:\"+request.remote_ip)\n flash_error(:invalid_login_name_or_email)\n redirect_to recover_password_url\n end",
"def forgot_password\n \n if request.get?\n # forgot_password.rhtml\n elsif request.post?\n user = User.find_by_email(params[:email])\n\n respond_to do |format|\n if user\n user.reset_password_code_until = 1.day.from_now\n user.reset_password_code = Digest::SHA1.hexdigest( \"#{user.email}#{Time.now.to_s.split(//).sort_by {rand}.join}\" )\n user.save!\n Mailer.deliver_forgot_password(user)\n flash[:notice] = \"Instructions on how to reset your password have been sent to #{user.email}\"\n format.html { render :action => \"forgot_password\" }\n else\n flash[:error] = \"Invalid email address: #{params[:email]}\"\n format.html { render :action => \"forgot_password\" }\n end\n end\n end\n \n end",
"def confirm_reset\n \n new_pass = params[:password]\n token = params[:token]\n if User.confirm_reset token, new_pass\n head :no_content\n else\n render json: {message: error_messages[:incorrect_reset_token]},\n status: :unprocessable_entity\n end\n end",
"def password_recovery(email, subject = \"CakeMail Password Recovery\", text = \"Your password is: \")\n session.request(\"CakeMail::API::ClassUser\", \"PasswordRecovery\", { :email => email, :subject => subject, :text => text })\n end",
"def reset_password \n if request.post?\n email = params[:reset_password][:email]\n raise NilOrEmptyEmailError if email.nil? || email.empty?\n user = User.find_by_email(email)\n raise EmailNotFoundError if user.nil?\n raise UserNotActiveError if !user.active\n user.reset_password_key = StringUtils::generate_random_string\n user.need_new_password = true \n user.save!\n #send the email\n UserMailer.reset_password_mail(user).deliver \n flash_success \"flash.success.user.reset_password\", {:keep=>true}, {:email=>user.email}\n redirect_to root_path\n else #if get\n render :reset_password\n end\n rescue UserNotActiveError\n flash_error \"flash.error.user.reset_password_inactive_user\", {}, {:email=>email}\n render :reset_password\n rescue NilOrEmptyEmailError\n flash_error \"flash.error.user.reset_password_empty_email\"\n render :reset_password\n #just render the template in case of get\n rescue EmailNotFoundError\n flash_error \"flash.error.user.reset_password_email_not_found\", {}, {:email=>email}\n render :reset_password\n end",
"def index\n #unless params[:recover_link].blank?\n recover = PasswordRecover.find_by_link(params[:recover_link])\n unless recover.nil?\n user = recover.user\n session[:user_id] = user.id\n user.password_recovers.destroy_all\n redirect_to user_profile_path, flash: { alert: \"Вы были авторизовны по одноразовой ссылке. Пожалуйста, смените Ваш пароль.\" }\n else\n redirect_to home_path, flash: { alert: \"Ссылка восстановления не найдена.\" }\n end\n #end\n end",
"def password_update\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n user = LatoCore::Superuser.find(params[:id])\n if !user || user.session_code != params[:token]\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n user.update(password: params[:password], password_confirmation: params[:password])\n if !user.save\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n\n flash[:success] = CORE_LANG['recover_password']['recover_success']\n redirect_to lato_core.login_path\n end",
"def update\n @user = User.find_by_password_reset_token(params[:token])\n if user.reset_password(params)\n redirect_to root_url, :notice => \"Your password was successfully reset. Try logging in now.\"\n else\n render :action => \"edit\"\n end\n end",
"def forgot_password\n begin\n if params[:email].present?\n user = User.find_by_email(params[:email])\n if user\n user.send_reset_password_instructions({\n redirect_url: forgot_password_redirect_url\n })\n\n response = {:code => \"0\",:status => \"Success\",:message => \"Reset password instruction details has been sent to your email\"}\n else\n response = {:code => \"1\",:status => \"Error\",:message => \"User not exist\"}\n end\n else\n response = {:code => \"1\",:status => \"Error\",:message => \"Please pass an email\"}\n end\n rescue Exception => e\n response = {:code => \"-1\",:status => \"Error\",:message => e.message}\n end\n render :json => response\n end",
"def forgot_password\n user = UserRequestsPasswordReset.new(:email => registration_params[:email]).call\n UserMailer.password_reset_email(user).deliver if user\n head 204\n end",
"def show\r\n @user = User.find_by_id(params[:id])\r\n params[:reset_token] ||= \"\"\r\n if @user\r\n if CGI.escape(Base64.strict_encode64(Digest::SHA256.new.digest(@user.password_digest))) != CGI.escape(params[:reset_token])\r\n redirect_to root_path\r\n end\r\n @pass = CGI.escape(Base64.strict_encode64(Digest::SHA256.new.digest(@user.password_digest)))\r\n else\r\n redirect_to root_path\r\n end\r\n end",
"def forgot_password\n user = User.find_by(email: params[:email])\n\n return render json: { error: 'Something went wrong.' }, status: 422 unless user\n\n user.generate_password_token!\n send_reset_password_email(user.email, user.reload.reset_password_token)\n\n render json: { success: true }, status: 204\n end",
"def forgot_password\n UserMailer.forgot_password(@user, @token).deliver\n @user.update(reset_token: @token)\n render json: { message: \"Please check your Email for reset password!\" }, status: 200\n rescue StandardError => e\n render json: { message: \"System mail account errors: #{e} \" }, status: :bad_request\n end",
"def password_reset\r\n if request.post? && params[:email_address]\r\n flash[:success] = \"Your password has been reset, and emailed to #{params[:email_address]}\"\r\n user = User.find_by_email_address(params[:email_address])\r\n if user\r\n new_password = user.reset_password\r\n email = Emailer.create_password_reset(user, new_password)\r\n Emailer.deliver(email)\r\n end\r\n redirect_to :action => :index\r\n return\r\n end\r\n end",
"def request_password_reset\n if params[:email]\n user = AdminUser.where(email: params[:email]).first\n if user\n password_reset_link = PasswordResetLink.new(user_id: user.id)\n if password_reset_link.save\n #todo: send email\n render json: {status: \"success\", message: \"Reset mail sent\"} and return\n else\n error_message = password_reset_link.errors.full_messages\n end\n else\n error_message = \"User not found\"\n end\n else\n error_message = \"Invalid parameters\"\n end\n render json: {status: \"error\", error_message: error_message}\n end",
"def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end",
"def password_reset\n gamer = Gamer.first\n gamer.reset_token = Gamer.new_token\n GamerMailer.password_reset(gamer)\n end",
"def request_password_reset\n if params[:email]\n user = User.where(email: params[:email]).first\n if user\n password_reset_link = PasswordResetLink.new(user_id: user.id)\n if password_reset_link.save\n #send email\n render json: {status: \"success\", message: \"Reset mail sent\"} and return\n else\n error_message = password_reset_link.errors.full_messages\n end\n else\n error_message = \"User not found\"\n end\n else\n error_message = \"Error invalid parameters\"\n end\n render json: {status: \"Error\", error_message: error_message}\n end",
"def reset_password\n @page_title = 'Reset Password'\n unless params[:t] and @user = User.find_by_uuid(params[:t])\n render_404\n end\n end",
"def forgot_password\n @page_title = 'Forgotten Password'\n # Always redirect if logged in\n if user?\n flash[:message] = 'You are currently logged in. You may change your password now.'\n redirect_to :action => 'change_password'\n return\n end\n\n # Email disabled... we are unable to provide the password\n if !LoginEngine.config(:use_email_notification)\n flash[:message] = \"Please contact the system admin at #{LoginEngine.config(:admin_email)} to retrieve your password.\"\n redirect_back_or_default :action => 'login'\n return\n end\n\n # Render on :get and render\n return if generate_blank\n params[:user][:email].downcase!\n \n # Handle the :post\n if params[:user][:email].empty?\n flash.now[:warning] = 'Please enter a valid email address.'\n elsif (user = User.find_by_email(params[:user][:email])).nil?\n flash.now[:warning] = \"We could not find a user with the email address #{params[:user][:email]}\"\n else\n begin\n User.transaction(user) do\n key = user.generate_security_token\n url = url_for(:action => 'change_password', :user_id => user.id, :key => key)\n UserNotify.deliver_forgot_password(user, url)\n flash[:notice] = \"Instructions on resetting your password have been emailed to #{params[:user][:email]}\"\n end \n redirect_to :action => 'index', :controller => 'main'\n rescue\n flash.now[:warning] = \"Your password could not be emailed to #{params[:user][:email]}\"\n end\n end\n end",
"def password_reset(user)\n @user = user\n\n mail :to => user.email, :subject => t(:password_recover)\n end",
"def forgot_password\n render :layout => 'minimal' and return if request.get?\n\n if @user = User.find_by_email(params[:email])\n @user.forgot_password\n @user.save\n flash[:notice] = \"A password reset link has been sent to #{@user.email}\" \n redirect_to :controller => :sessions, :action => :login\n else\n flash.now[:error] = \"Could not find a user with that email address\" \n render :layout => 'minimal'\n end\n end",
"def password_reset\n user = Customer.last\n user.reset_token = Customer.new_token\n CustomerMailer.password_reset(user)\n end",
"def request_password\n\t\t@user = User.find_by_email(params[:email])\n\t\tif @user == nil || @user == ''\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please enter a valid email\"\n\t\telse\n\t\t\t@random_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n\t\t\t@url = root_url + 'reset_password/' + @random_string\n \t\tUser.where(:id => @user.id).update_all(reset_password_token: @random_string)\n\t\t\t@email = UserMailer.forgot_password(@user, @url).deliver\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please check your email to reset your password\"\n\t end\n\tend",
"def generate_password_reset_link\n \"http://leagueforgamers.com/user/forgot_password/#{self.verification_digest}\"\n end",
"def password_rest\n UserMailer.password_rest\n end",
"def public_forgot_password_send\n if params[:form_forgot_password]\n results = CsApi::Account.reset_password(params[:form_forgot_password][:username])\n logger.info \"[SessionsController][DEBUG]==== reset results: #{results}\"\n if results['success'].eql?('true')\n flash[:notice] = results[\"message\"]\n redirect_to reset_password_url\n else \n flash[:error] = results[\"message\"]\n redirect_to forgot_password_url\n end\n end\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def gen_reset_link(url, token)\n \"#{url}/reset_password/#{token}/edit?email=#{self.email}\"\n end",
"def forgotten\n if request.get?\n render 'sessions/forgotten'\n elsif request.post?\n if params[:username].present? &&\n (user = QuoVadis.model_class.where(:username => params[:username]).first)\n if user.email.present?\n user.generate_token\n QuoVadis::Notifier.change_password(user).deliver\n flash_if_present :notice, 'quo_vadis.flash.forgotten.sent_email'\n redirect_to :root\n else\n flash_if_present :alert, 'quo_vadis.flash.forgotten.no_email', :now\n render 'sessions/forgotten'\n end\n else\n flash_if_present :alert, 'quo_vadis.flash.forgotten.unknown', :now\n render 'sessions/forgotten'\n end\n end\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def forgot\r\n if pass_reset_params[:email].blank?\r\n redirect_to 'password/resetpass'\r\n flash[:danger] = \"Email not present\"\r\n end\r\n\r\n @user = User.find_by(email: pass_reset_params[:email].downcase)\r\n @user.skip_icpassport_validation = true\r\n @user.skip_name_validation = true\r\n @user.skip_package_validation = true\r\n @user.skip_password_validation = true\r\n\r\n if @user.present?\r\n @user.generate_password_token!\r\n sendmail(@user.email, @user.name, @user.reset_password_token)\r\n redirect_to '/'\r\n flash[:info] = \"Check email for reset password instruction\"\r\n else\r\n redirect_to '/password/resetpass'\r\n flash[:danger] = \"Email address not found. Please check and try again.\"\r\n end\r\n end",
"def password_reset(random_token, email)\n @instance_token = random_token\n mail(:to => email, :subject => \"Password Reset\", :bcc =>\"ruthdelcampo@openaidregister.org\") \n end",
"def reset_password(params)\n user = User.find_by_reset_password_token(params[:token])\n if user.nil?\n fail BadRequestError.user_not_found(:token), \"User not found by token.\"\n end\n\n user.reset_password!(params[:password], params[:password_confirmation])\n user\n end",
"def password_reset\n \tuser = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def new_user_password\n client = Client.where(recovery_token: params[:recovery_token]).first\n\n if(client)\n render \"home/change_password_template\", layout: \"application\"\n else\n render \"home/change_password_template_error\"\n end\n\n end",
"def forgot_password\n @doctor = Doctor.find_by_email(params[:email])\n if @doctor.present?\n @doctor.send_reset_password_instructions\n render json: {message: \"Reset Link send succesfully in registerd Email.\"}\n else\n render json: {notice: \"No account is registerd with this Email.\"}\n end\n end",
"def reset_password\n if (params[:token] === @user.reset_token) && (@user.updated_at > DateTime.now - 1)\n @user.update(password: params[:password], password_confirmation: params[:confirm_password], reset_token: \"\")\n render \"reset\" if @user.errors.any?\n else\n @error = \"Token is expired\"; render \"reset\"\n end\n rescue StandardError => e\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end",
"def forgot_password\n return unless request.post?\n @user = User.find_by_email(params[:email])\n if @user.nil?\n flash.now[:error] = \"We couldn't find your account. Please check to make sure that the information you entered below is correct.\"\n else\n @user.make_activation_code\n @user.save\n UserNotifier.deliver_password_reset(@user)\n flash.now[:notice] = \"We have found your account and emailed you a link you can use to reset your password. \" +\n \"If you have any questions or need assistance, please contact us.\"\n render :action => 'index'\n end\n end",
"def new_reset_password\n end",
"def check_token_expiration\n return unless @person.password_reset_expired?\n\n flash[:danger] = I18n.t('password_reset.expired_token')\n redirect_to new_password_reset_url\n end",
"def edit\n redirect_to(new_session_path) unless user.matches_verification_token?(token)\n # render passwords/edit.html.erb\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token #присваивается значение токена сброса пароля\n UserMailer.password_reset(user)\n end",
"def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end",
"def password_reset\n owner = Owner.first\n owner.reset_token = Owner.new_token\n Owner::UserMailer.password_reset(owner)\n end",
"def password_reset\n MailerMailer.password_reset\n end",
"def password_reset\n user = Volunteer.first\n user.reset_token = Volunteer.new_token\n VolunteerMailer.password_reset(user)\n end",
"def password_reset\n user = SbUser.first\n user.reset_token = SbUser.new_token\n SbuserMailer.password_reset(user)\n\n end",
"def password_reset(gamer)\n @gamer = gamer\n mail to: gamer.email, subject: \"Password reset\"\n end",
"def reset_password(email)\n @user = User.find_by_email(email)\n random_password = Array.new(10).map { (65 + rand(58)).chr }.join\n @user.password = random_password\n @user.save!\n# Mailer.create_and_deliver_password_change(@user, random_password)\n# commented out mailer for now as I have no Idea what it is or does. \n\n# Idea - set a reset token on the user model and email it to the user \n# eg http://localhost:9292/reset_password?reset_token=cnu94w3n8c94njevn49an8\n# like we do in rails land\n\nend",
"def forgot_password_confirm\n @email = session.delete(:fp_email)\n render \"login/forgot_password_confirm\"\n end",
"def issue_reset_password_token(params)\n user = User.find_by_email(params[:email])\n if user.nil?\n fail BadRequestError.new(code: :not_exists, field: :email), \"Not exists email.\"\n end\n\n user.tap(&:issue_reset_password_token!)\n end"
] |
[
"0.7462621",
"0.7343085",
"0.7154333",
"0.7150844",
"0.70899653",
"0.6937087",
"0.69230616",
"0.6896216",
"0.6651413",
"0.6637898",
"0.66059184",
"0.6569683",
"0.6552999",
"0.65236306",
"0.6519975",
"0.6487537",
"0.6470082",
"0.6465917",
"0.6448562",
"0.64428467",
"0.6429536",
"0.6423159",
"0.6409204",
"0.63910806",
"0.6386111",
"0.63755107",
"0.6360714",
"0.63519365",
"0.6351927",
"0.6351927",
"0.6348236",
"0.6330545",
"0.6301759",
"0.628007",
"0.6278529",
"0.6277822",
"0.62554413",
"0.6245844",
"0.6231015",
"0.6228097",
"0.6211886",
"0.6210029",
"0.6202064",
"0.6184389",
"0.61459297",
"0.6144554",
"0.6121853",
"0.6102393",
"0.60980153",
"0.6095385",
"0.60866296",
"0.60854816",
"0.6084109",
"0.6076494",
"0.60653335",
"0.60614973",
"0.60593534",
"0.6052568",
"0.60495967",
"0.6045756",
"0.6025998",
"0.60247713",
"0.6009144",
"0.60065705",
"0.60039705",
"0.6000395",
"0.59999424",
"0.5995925",
"0.5995925",
"0.5988943",
"0.59881157",
"0.59867406",
"0.59867406",
"0.59867406",
"0.59867406",
"0.59867406",
"0.59867406",
"0.59867406",
"0.5986003",
"0.598213",
"0.59809893",
"0.59765244",
"0.59639096",
"0.5958924",
"0.5958128",
"0.5954177",
"0.59264445",
"0.592245",
"0.5918118",
"0.59161586",
"0.5908769",
"0.59015495",
"0.5892854",
"0.5891823",
"0.58895445",
"0.5885303",
"0.5884532",
"0.588216",
"0.5880313",
"0.58801836"
] |
0.792576
|
0
|
puts "please inter a number" n =gets.strip counter = 1 sum=0 while counter <=n.to_i if counter % 3==0 || counter % 5==0 sum += counter counter +=1 end end puts sum
|
def guess_the_number
prog_num=rand(1..20)
counter=0
while counter < 10
number=user_guessing
counter+=1
if number>prog_num
if number-(prog_num)>5
puts "too large try no.#{counter}"
else number-(prog_num)>5
puts "bit large try no.#{counter}"
end
elsif number<prog_num
if (prog_num)-number>5
puts "too small try no.#{counter}"
else (prog_num)-number>5
puts "bit small try no.#{counter}"
end
elsif number==prog_num
return puts "you win after #{counter} try(s)."
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def adding some_number\ni = 0\nsum = 0\n while i < some_number\n if i % 5 == 0 or i % 3 == 0\n sum += i\n end\n i += 1\n end\n puts sum\nend",
"def sum_multiples_three_five\n sum = 0\n n = 0\n while n < 1000\n if(((n%3) == 0) || ((n%5) == 0))\n sum += n\n end\n n+=1\n end\n puts \"#{sum}\"\nend",
"def solution(number)\n counter = 3\n sol = 0\n while counter < number\n if (counter % 3 == 0) && (counter % 5 == 0)\n sol += counter\n elsif (counter % 3 == 0) || (counter % 5 == 0)\n sol += counter\n end\n counter += 1\n end\n p sol\nend",
"def sum(n)\n\n s = 0\n\n for i in 1...n\n if i % 3 == 0 || i % 5 == 0\n s += i\n end\n end\n\n return s\n\nend",
"def multisum(number) # number 1..10 determines which numbers are divisible by 3 and 5\n sum = 0\n 1.upto(number) do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num # this adds the numbers from 1..num that either are multiples of 3 or 5\n end\n end\n sum # returns sum, need this here to run program successfully\nend",
"def solution(number)\n return 0 if number < 3\n result = 0\n count = 3\n \n until count > number\n if count % 3 == 0 || count % 5 == 0\n result += count \n end\n count += 1\n end\n \n result\nend",
"def sum_of_multiples(number)\n sum_three = 0\n sum_five = 0\n sum_total = 0\n count_three = 3\n count_five = 5\n\n if number < 5\n sum_five\n else\n while count_five < number\n sum_five += count_five\n count_five += 5\n end\n end\n\n if number < 3\n sum_three\n else\n while count_three < number\n if count_three % 5 != 0\n sum_three += count_three\n end\n count_three += 3\n end\n end\n\n sum_total = sum_five + sum_three\n\n puts sum_total\n return sum_total\nend",
"def sum_3_5(n)\n x = 3\n multiple_sum = 0\n while x < n\n current = x\n if (current % 3 == 0) or (current % 5 == 0)\n multiple_sum += current\n end\n x += 1\n end\n multiple_sum\nend",
"def multisum(number)\n sum = 0\n\n 1.upto(number) { |i| sum += i if i % 3 == 0 || i % 5 == 0 }\n sum\nend",
"def solution(number)\n sum = 0\n for i in 1..number - 1\n if (i % 3 == 0 or i % 5 == 0)\n sum += i\n end\n i += i\n end\n return sum\nend",
"def multisum(number)\n sum = 0\n (1..number).each do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num\n end\n end\n sum\nend",
"def sumdivby3or5(n)\n result = 0\n 1.upto(n) { |e| result += e if (e % 3 == 0) || (e % 5 == 0) }\n puts result\nend",
"def euler_1\n number = 1\n sum = 0\n while number < 1000\n if (number % 3 == 0 || number % 5 == 0)\n sum += number \n end\n number += 1\n end\n p sum\nend",
"def numSum number\nsum = 0\ncount = 0\nwhile (count < number.to_i)\nputs \"enter num:\"\nnum = gets.chomp\nsum += num.to_i\ncount += 1\nend\nreturn sum\nend",
"def natural_sum(num)\n sum = 0\n index = 0\n while index < num\n if index % 3 == 0 || index % 5 == 0\n sum += index\n end\n index += 1\n end\n p sum\nend",
"def solution(number)\n return 0 if number <= 3\n\n sum = 0\n (1..(number - 1)).each do |n|\n if (n % 3 == 0) || (n % 5 == 0)\n sum += n\n end\n end\n\n sum\nend",
"def multiplies(n)\n# i = 1\n# sum = 0\n# while i <= n\n# if i % 15 == 0\n# sum +=i\n# elsif i % 5 == 0\n# sum +=i\n# elsif i % 3 == 0\n# sum+=i\n# end\n# i+=1\n# end\n# sum\n# end\n\nsum = 0\n(0..n).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def multisum(num)\n sum = 0\n 1.upto(num) {|number| sum += number if (number % 3 == 0 || number % 5 == 0)}\n sum\nend",
"def iter_sums_three_five (n)\n sum = 0\n\n (1...n).each do |num|\n if num % 3 == 0 || num % 5 == 0\n sum += num\n end\n end\n sum\nend",
"def divisible_by_3(number)\n sum = 0\n changing_value = 0\n until (changing_value >= number)\n if (changing_value % 5 == 0)\n sum = sum + changing_value\n\n end\n changing_value += 1\n end\n return sum\nend",
"def multisum(int)\n sum = 0\n 1.upto(int) { |num| sum += num if num % 3 == 0 || num % 5 == 0 }\n sum\nend",
"def solution(number)\n number -=1 and sum = 0 and for x in number.downto(0) do x%5 == 0 ? (sum = sum+x) : if(x%3 == 0) then sum = sum+x \n end end and return sum \nend",
"def findSum(n)\n theFinal = 0\n for i in 3..n do\n if (i % 3 == 0 || i % 5 == 0) \n theFinal += i\n end\n end\n puts theFinal\nend",
"def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def multisum(integer)\n total = 0\n (1..integer).each do |num|\n total += num if (num % 3 ==0) || (num % 5 == 0)\n end\n total\nend",
"def multisum(n)\n sum = 0\n (1..n).each do |x|\n sum += x if (x % 3 == 0) || (x % 5 == 0)\n end\n sum\nend",
"def solve\n sum = 0\n (1..999).each do |n|\n if n % 3 == 0 or n % 5 == 0\n sum += n\n end\n end\n sum\nend",
"def multisum(number)\n (0..number).reduce { |sum, n| n % 5 == 0 || n % 3 == 0 ? sum + n : sum }\nend",
"def sum_of_n_numbers()\n\tsum=0\n\ta=gets.chomp.to_i\n#\tputs a\n\tfor i in 1 .. a\n\t\tsum=sum+gets.chomp.to_i\n\tend\n\tputs sum\nend",
"def threefive(num)\n\n if num < 1 || num > 100\n return \"Number must be between 1-100\"\n end\n mult_arr = []\n mult_arr << 0\n i = 0\n\n while num > i\n if (i % 3) == 0\n mult_arr << i\n elsif (i % 5) == 0\n mult_arr << i\n end\n i += 1\n end\n return mult_arr.inject{|sum,n| sum + n}\n\nend",
"def sum_3_5(number) \r\n\tsum3 = 0\r\n\tsum5 = 0\r\n\tsum15 = 0\r\n\t0.step(number-1,3) do |num|\r\n\t\tsum3 += num\r\n\tend\r\n\t0.step(number-1,5) do |num|\r\n\t\tsum5 += num\r\n\tend\r\n\t0.step(number-1,15) do |num|\r\n\t\tsum15 += (num)\r\n\tend\r\n\treturn sum3 + sum5 - sum15\r\nend",
"def solve( maxValue )\n\n return if maxValue < 1\n\n sum = 0;\n count = 1;\n while count < maxValue\n sum += count if count % 3 == 0 or count % 5 == 0\n count += 1\n end\n puts sum\nend",
"def sum_multiples_3_and_5(number)\n\tsum = 0\n\t(1...number).each do |x|\n\t\tif x % 3 == 0\n\t\t\tsum += x\n\t\telsif x % 5 == 0\n\t\t\tsum += x\n\t\tend\n\tend\n\tsum\nend",
"def sumOf(n)\n i = 0\n multiples = []\n while i < n do\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n i += 1\n end\n multiples.inspect\n multiples.reduce(:+)\nend",
"def multisum(number)\n (0..number).select { |num| num % 3 == 0 || num % 5 == 0 }.inject(:+)\nend",
"def multisum(num)\n counter = 1\n arr = []\n while counter <= num\n if counter % 3 == 0 || counter % 5 == 0\n arr << counter\n end\n counter += 1\n end\n arr.sum\nend",
"def multisum(num)\n count = 1\n total = 0\n\n loop do\n if count % 3 == 0 || count % 5 == 0\n total += count\n end\n count += 1\n break if count > num #if count is set to reference 1, loop to be greater than num \n end\n total\nend",
"def solution(number)\n arr = [];\n i = 1;\n while i < number\n if i % 3 == 0 || i % 5 == 0\n arr.push(i)\n end\n i += 1\n end\n\n puts arr.sum\nend",
"def solution(n)\n sum = 0\n (1...n).each { |num| num % 3 == 0 || num % 5 == 0 ? sum += num : false }\n sum\nend",
"def multisum(num)\n 1.upto(num).select { |number| number % 3 == 0 || number % 5 == 0 }.sum\nend",
"def sum_of_3_or_5_multiples(n)\n n = n.to_i\n #compteur de boucle\n i = 0\n #tableu incluant les multiple de 3 et 5\n result_array = []\n while i < n\n a = i%3\n b = i%5\n if a == 0 || b == 0\n result_array << i\n i+=1\n else\n i+=1\t\n end\n \n end\n sum = 0\n result_array.each do |p|\n \t sum = sum + p\n end\n return sum \nend",
"def sum_multiples_of_3_or_5(n)\n (1...n).inject(0) do |sum, n|\n sum + if n % 3 == 0 || n % 5 == 0\n n\n else\n 0\n end\n end\nend",
"def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend",
"def multisum(num)\n (1..num).select{ |x| (x % 3 == 0) || (x % 5 == 0) }.sum\nend",
"def sumOfMultiples()\n sum = 0\n 1.upto(999) do |i|\n if (i % 3 == 0) or (i % 5 == 0)\n sum += i\n end\n end\n sum\nend",
"def multisum(num)\n 1.upto(num).inject(0) {|sum, num| num % 3 == 0 || num % 5 == 0 ? sum += num : sum}\nend",
"def multiples_three_five(max_number)\n sum = 0\n max_number = max_number - 1\n (0..max_number).each do |number|\n if number % 3 == 0 || number % 5 == 0\n sum = sum + number\n end\n end\n return sum\nend",
"def sum_num\n\t#ask for number\n\tputs \"gimme dat number: make sure its more than 1?\"\n\tnum = gets.chomp.to_i\n\t\n\n\tif num < 1\n\t\tputs \"I told you to put a number greater than 1\"\n\t\tsum_num\n\telse\n\t\t# prints number 1 to num\n\t\tcounter = (1..num)\n\t\tnew_num = 0\n\t\tcounter.each do |num|\n\t\t\tnew_num = new_num + num\n\n\n\t\tend\n\n\tend\n\tputs new_num \nend",
"def sum_of_3_or_5_multiples?(final_number)\n \n final_sum=0\n \n if (final_number)is_i?(Fixnum) && final_number >= 0\n \n 0.upto(final_number-1) do |current_number|\n if is_multiple_of_3_or_5? (current_number) == true \n final_sum = final_sum + current_number\n else \n end \n end\n return \"Yo ! Je ne prends que les entiers naturels. TG\"\n end\n return final_sum\n end",
"def multisum(max)\n sum = 0\n 1.upto(max) { |num| sum += num if num % 3 == 0 || num % 5 == 0 }\n sum\nend",
"def multisum(num)\n (1..num).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend",
"def iter_soln\n\ttotal = 0\n\t(0..999).each do |i|\n\t\ttotal += i if(i%3 == 0 || i%5 == 0)\n\tend\n\n\tputs total\nend",
"def multisum(number)\n (1..number).select { |multiple| multiple % 3 == 0 || multiple % 5 == 0 }.inject(:+)\nend",
"def solution(number)\n [*1...number].select {|n| (n % 3 == 0) or (n % 5 == 0)}.sum\nend",
"def multisum(num)\n (1..num).select { |i| i % 3 == 0 || i % 5 == 0 }.reduce(:+)\nend",
"def sumn2(n)\n result = 0\n 1.upto(n) { |e| result += e if (e % 3 == 0) ^ (e % 5 == 0) }\n puts result\nend",
"def find_multiples_of_3_or_5_below_x x\n sum = 0\n n = 3\n while n < x\n sum += n\n n += 3\n end\n n = 5\n while n < x\n sum += n if n % 3 != 0\n n += 5\n end\n sum\nend",
"def multiple_sum int\n (1..int).select { |n| (n % 3 == 0 || n % 5 == 0) }.sum\nend",
"def problem5(n)\n\tnum = n * 2\n\twhile not divisible?(num, n)\n\t\tnum += n\n\tend\n\tnum\nend",
"def sum_to(number)\n i = 0\n output = number\n while i != number\n output += i\n i += 1\n end\n return output \nend",
"def multisum2(number)\n 1.upto(number).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend",
"def three_five_sum\n outcome = (1...1000).to_a.select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n total = 0\n outcome.each do |num|\n total += num\n end\n total\nend",
"def multisum(num)\n (1..num).to_a.select { |n| n % 3 == 0 || n % 5 == 0 }.sum\nend",
"def sum_multiples()\n index = sum = 0\n while index < 1000\n sum += index if index%3 == 0 || index%5 == 0\n index+=1\n end\n sum\nend",
"def multiples_of_three_and_five(number)\n total = 0\n\n (1..(number - 1)).each { |n| total += n if n % 3 == 0 || n % 5 == 0 }\n \n return total\nend",
"def sum_of_multiples(n)\n (1...n).select{ |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend",
"def sum_multiples\n sum = 0\n\n (1...1000).each do |n|\n sum += n if n % 3 == 0 || n % 5 == 0\n end\n\n sum\nend",
"def euler001(max)\n\ti = 1\n\tsum = 0\n\tmax.times do |i|\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tsum += i\n\t\tend\n\tend\n\tprint(sum, \"\\n\")\nend",
"def find_sum_of_multiples_of_3_and_5_below_1000\n answer = 0\n for number in 1...1000\n answer += number if number % 3 == 0 || number % 5 == 0\n end\n answer\nend",
"def sum_of_multiples_3_5_below(n)\n (1...n).select {|x| x%3==0 || x%5==0}.inject(&:+)\nend",
"def run\n (3...1000).inject(0){|sum, num| (num % 3 == 0 || num % 5 == 0) ? sum += num : sum }\nend",
"def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend",
"def solution(number)\n(0...number).map{|x| x % 3 == 0 || x % 5 == 0 ? x : 0}.inject{|sum, x| sum + x}\nend",
"def multiples_3_5_v2\n\tsum = 0\n\n\t1.upto(999) do |i|\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tsum = sum + i\n\t\tend\n\tend\n\n\treturn sum\nend",
"def multiples_of_3_and_5\r\n total = 0\r\n (3...1000).each do |x|\r\n if x % 3 == 0 || x % 5 == 0\r\n # puts x\r\n total += x\r\n end\r\n end\r\n total\r\nend",
"def sums_three_five (n)\n\n sum = 0\n #find sum of all 3s\n # 3 to 999 = 3 * (1 .. n/3) = 3 * 333/2 * (1 + 333)\n last_three = (n/3)\n sum += 3 * ((last_three) * (1 + last_three))/2\n\n #find sum of all 5s\n # 1..200\n last_five = (n/5)\n last_five -= 1 if n % 5 == 0 # -1 because n is not included\n sum += 5 * ((last_five) * (1+last_five))/2\n\n #subtract intersection of 5s and 3s\n last_fifteen = (n/15)\n sum -= 15 * ((last_fifteen) * (1+last_fifteen))/2\n\nend",
"def multisum(number)\n multiples = (1..number).select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend",
"def solution(number)\n ans = 0\n (3...number).step(3) {|n| ans += n}\n (5...number).step(5) {|n| n % 3 == 0 ? next : ans += n}\n return ans\nend",
"def solution(number)\n return (0...number).select{ |x| ((x % 3 == 0) || (x % 5 == 0))}.reduce(:+)\nend",
"def problem1(num)\n (1..num-1).select{|a| a%3 ==0 or a%5==0}.reduce(:+)\nend",
"def multisum(num)\n ary = []\n\n num.times do\n ary << num if num % 5 == 0 || num % 3 == 0\n num -= 1\n end\n\n sum = 0\n ary.each { |n| sum += n }\n sum\nend",
"def multisum(int)\r\n (1..int).select{|x| x % 3 == 0 || x % 5 == 0 }.reduce(:+)\r\nend",
"def sum_nums2(num)\n\ncount = 0\nresult = 0\n\n while num >= count\n result += count\n count += 1\n end\n #puts( result )\n return result\nend",
"def sum_to(number)\n i = 0\n output = 0\n while i < number\n i +=1\n output += i\n end\n return output\nend",
"def sum_s1 num\n i=1\n while i <= num\n case i\n when i.odd? then i = i - 1\n when i.even? then i = i + 1\n end # end case\n end # end while\n\n puts i\nend",
"def multisum(num)\n divisables = []\n 1.upto(num) {|num| num % 3 == 0 || num % 5 == 0 ? divisables << num : next}\n divisables.sum\nend",
"def multisum(number)\n multiples = (1..number).select { |x| (x % 3 == 0) || (x % 5 == 0) }\n multiples.reduce(:+)\nend",
"def multisum(num)\n arr = []\n (1..num).map do |n|\n if n % 3 == 0 || n % 5 == 0\n arr << n\n end\n end\n arr.inject { |n, sum| n + sum }\nend",
"def multisum(number)\n\tbox = []\n\twhile number > 0\n\t\tbox << number if number % 3 == 0 || number % 5 == 0\n\t\tnumber -= 1\n\tend\n\tsum = 0\n\tbox.each { |e| sum += e }\nend",
"def sum_to(number)\n sum = 0\n i = 1\n while i <= number\n sum += i\n i += 1\n end\n return sum\nend",
"def multiples_sums(int)\n sum = 0\n (1...int).to_a.each do |x|\n \tif x % 3 == 0 || x % 5 == 0\n \t\tsum += x.to_int\n \tend\n end\n sum\nend",
"def multisum(limit)\n nums = []\n 1.upto(limit) { |num| nums << num if (num % 3 == 0 || num % 5 == 0)}\n nums.sum\nend",
"def multisum(limit)\n (1..limit).select { |num| (num % 3).zero? || (num % 5).zero? }.sum\nend",
"def wild_sum(n)\r\n # your code here\r\n wild_sum = 0\r\n\r\n for i in 1 ... n\r\n\r\n if i % 2 == 0 && i % 3 != 0\r\n wild_sum += i\r\n\r\n elsif i % 3 == 0 && i % 2 != 0\r\n wild_sum += i\r\n end\r\n end\r\n wild_sum\r\n\r\nend",
"def sum_of_3_and_5_multiples(nbr)\n nbr_a = (1...nbr).to_a\n ls35 = nbr_a.select { |x| (x % 3).zero? || (x % 5).zero? }\n if nbr % 1 != 0 || nbr < 0 # conditiions pour les entiers relatifs\n return 'I said natural number only idiot!'\n elsif nbr > 1000 # pour ne pas calculer les > 1000\n return 'too high!'\n else\n return ls35.sum\n end\nend",
"def euler1\n sum = 0;\n 1..1000.times do |x|\n y = x + 1\n if (x % 3).zero? || (x % 5).zero?\n sum = sum + x\n end\n end\n p sum\nend",
"def sum_of_multiples_of_three_and_five(n)\r\n (1...n).to_a.select{|x| x % 3 == 0 || x % 5 == 0 }.reduce(:+)\r\nend",
"def solution(number)\n sum = 0\n multipliers = (1..number-1).select {|x| x % 3 == 0 or x % 5 == 0}\n print multipliers\n multipliers.inject do |sum, x|\n sum + x\n end\nend",
"def sum_multiple_3_5\n array = [*1..999]\n starter = 0\n array.map do |n|\n if n % 3 ==0 || n % 5 == 0\n starter += n\n end\n end\n puts starter\nend",
"def multiples(input)\n (1..input).select { |num| (num % 3).zero? || (num % 5).zero? }.reduce(:+)\nend",
"def multisum(num)\n i = 1\n totals = []\n while i <= num\n three = 3 * i\n five = 5 * i\n totals << three if three <= num\n totals << five if five <= num\n i += 1\n end\n totals = totals.uniq.sort!\n p totals.sum\nend"
] |
[
"0.82282525",
"0.7856457",
"0.77275616",
"0.7721888",
"0.77003556",
"0.76893055",
"0.7681333",
"0.7619648",
"0.7585935",
"0.7550421",
"0.7539804",
"0.7534963",
"0.7524533",
"0.7501719",
"0.7501187",
"0.7486206",
"0.7471756",
"0.74596924",
"0.7447688",
"0.73945844",
"0.7388843",
"0.7385805",
"0.73698074",
"0.7341346",
"0.7340614",
"0.7337845",
"0.73273987",
"0.7289808",
"0.7280623",
"0.72712755",
"0.7265016",
"0.7261265",
"0.72543705",
"0.72354734",
"0.7185068",
"0.7177643",
"0.7148764",
"0.7142468",
"0.7138318",
"0.7134212",
"0.7107575",
"0.7092756",
"0.70915717",
"0.7058297",
"0.70537496",
"0.70426464",
"0.7035741",
"0.7027554",
"0.7025867",
"0.70050055",
"0.6997202",
"0.6989354",
"0.6963224",
"0.6955637",
"0.6947903",
"0.6942013",
"0.6937957",
"0.69242555",
"0.69137704",
"0.69050604",
"0.69039255",
"0.69010496",
"0.68999517",
"0.68888724",
"0.68825734",
"0.68724793",
"0.6858201",
"0.68528277",
"0.6849701",
"0.684412",
"0.6833947",
"0.68316823",
"0.68269265",
"0.6819542",
"0.6819207",
"0.6817818",
"0.68121284",
"0.68106925",
"0.68073475",
"0.6804309",
"0.6796362",
"0.67955935",
"0.6794938",
"0.6784829",
"0.6782573",
"0.6777495",
"0.6769877",
"0.67633885",
"0.67615163",
"0.6761474",
"0.6758837",
"0.6758721",
"0.6748239",
"0.6737594",
"0.6715345",
"0.66936255",
"0.66883254",
"0.6687242",
"0.66819006",
"0.66704464",
"0.6668285"
] |
0.0
|
-1
|
Checks if current recipient able to receive freeform text
|
def able_to_send_freeform_text?
last_inbound_message = messages.inbound.last
return false unless last_inbound_message
last_inbound_message.created_at + 24.hours >= Time.zone.now
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recipient_available?(current_recipient)\n if current_recipient.nil?\n puts \"No current recipient selected.\"\n else\n puts \"What message would you like to send?\"\n current_recipient.send_message(gets.chomp)\n end\nend",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def recipient_required?\n transfer_type?\n end",
"def verify_banned_message\n if sender.banned?\n self.body = \"This user’s messages have been removed because #{sender.the_sex_prefix} activities violates the LoveRealm community standards. Do not correspond with #{sender.the_sex_prefix}\"\n self.kind = 'text'\n end\n end",
"def can_send?\n !sent?\n end",
"def ask_for_recipient\n\n end",
"def message_meant_for_us?(message)\n filter.matches?(message.to)\n end",
"def can_activate?\n self.sender && self.email_match?\n end",
"def require_description_presence?\n self.can_send_email\n end",
"def is_text_message?(message)\n !message.text.nil?\nend",
"def is_text_message?\n type == 'TextMessage'\n end",
"def require_description_presence?\n self.can_send_email\nend",
"def should_mail_submission_message? # -> email rejection message\n self.authorized == false && (self.message_sent == false && !self.message.blank?)\n end",
"def can_mail? user\n can_send_messages? && profile.is_active?\n end",
"def needs_sending?\n !sent? && !flagged?\n end",
"def has_subscriber?(user)\n has_text? user.email\n end",
"def recipient_contains\n return @recipient_contains\n end",
"def email?(text)\n Gman.new(text).email?\n end",
"def protected?\n @data[:client_address] !~ /^(127\\.0\\.0\\.1|::1)$/ && # exclude local emails\n $recipients.keys.include?(@data[:recipient])\n end",
"def get_recipient_send_message(text)\n (subscribers + friend_list) - blocked_outs\n end",
"def sender_not_supported\n sms.to[0] == \"1\" || # USA\n sms.to[0..2] == \"962\" || # Jordan\n sms.to[0..2] == \"971\" # UAE\n end",
"def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end",
"def check_textbook_id_and_reciever_id\n return false if Textbook.find_by_id(self.textbook_id).nil? || User.find_by_id(self.reciever_id).nil?\n\n if reciever_id === sender_id\n self.errors.add(:reciever_id, \"You can't send an offer to yourself!\")\n\treturn false\n end\n\n if self.sender.listing_from_textbook(self.textbook_id) && self.sender.listing_from_textbook(self.textbook_id).selling? != self.selling?\n if self.selling?\t\n self.errors.add(:reciever_id, \"You're currently listing this book 'Looking For' not 'For Sale'. You must list this book 'For Sale' before sending selling offers for it\")\n\t return false\n\t else\n self.errors.add(:reciever_id, \"You're currently listing this book 'For Sale'. You must remove that listing before sending offers to other users to buy theirs\")\n\t return false\n\n\t end\n end\n\n return true\n end",
"def deliverable?\n recipient.status != \"address_not_exist\"\n end",
"def has_recipient\n return false if @voucher.recipient.nil?\n return true\n end",
"def user_wants_change?\n\n # Detect sms bodies for text \"change\"\n body = (b = params[:Body] and b.kind_of? String and b.include? \"change\")\n\n # Detect voice digits for the digit 9\n digits = (d = params[:Digits] and d.to_i == 9)\n\n # If any were true, change is wanted — otherwise it's not.\n body || digits\n end",
"def user_wants_change?\n\n # Detect sms bodies for text \"change\"\n body = (b = params[:Body] and b.kind_of? String and b.include? \"change\")\n\n # Detect voice digits for the digit 9\n digits = (d = params[:Digits] and d.to_i == 9)\n\n # If any were true, change is wanted — otherwise it's not.\n body || digits\n end",
"def spam?\n texts.count > 0\n end",
"def replyable?\n false\n end",
"def should_send_email_collect?\n !contact_has_email? && inbox.web_widget? && !email_collect_was_sent?\n end",
"def mail_allowed?\n Bushido::Command.get_command(Bushido::Base.allowed_email_url)\n end",
"def not_spam\n errors.add(:base, \"invalid reply\") if check_field.present?\n end",
"def replyable?\n true\n end",
"def test!\n begin\n send_message!(:recipient_number => '_', :body => '')\n rescue Excon::Errors::Error\n false\n rescue MessageRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end",
"def valid_to?\n return true if ( not @sms_to.blank? ) && ( @sms_to.length == 8 ) && ( ['4','9'].include? @sms_to[0] )\n false\n end",
"def recipient; end",
"def send_urgent?; preference == EmailSetting::OPTIONS[:'All Urgent Requests'] || preference.nil?; end",
"def participates?(user)\n \tsender == user || recipient == user\n\tend",
"def needs_address?\n !flagged? && !sent?\n end",
"def check_book_is_listed\n if selling?\n listing = sender.listing_from_textbook(textbook_id)\n\n\tif listing.nil?\n self.errors.add(:sender_id, \"You must list this book 'For Sale' before sending an offer to sell it!\")\n\t return false\n\tend\n else\n listing = reciever.listing_from_textbook(textbook_id)\n\n if listing.nil?\n self.errors.add(:reciever_id, \"#{self.reciever.username} must list this book 'For Sale' before sending an offer to buy it!\")\n\tend\n end\n end",
"def receive_update\n @text = params[:text]\n user = User.find_by_email params[:sender]\n if user\n\n friendship = Friendship.where user_id: user\n\n # get the recipient\n recipients = []\n friendship.each do |f|\n recipients << f.friend.email\n end\n mention = @text.scan(/\\w+@\\w+.\\w+/i)\n recipients << mention.join(', ')\n\n # get the block user\n excludes = []\n subscribes = Subscribe.where user: user, block: true\n subscribes.each do |f|\n excludes << f.target.email\n end\n\n recipients = recipients.reject { |i| excludes.include?(i) }\n\n render json: { success: true, recipients: recipients }\n else\n render json: { success: false, message: \"Sender email not found\" }\n end\n end",
"def is_text?(); @type == GRT_TEXT; end",
"def mentor_letter_received?\n letter_received = false\n mentors.each do |m|\n letter_received = true unless m.letter.nil?\n end\n return letter_received\n end",
"def email?\n !!(@text =~ EMAIL_REGEX)\n end",
"def email?\n !!(@text =~ EMAIL_REGEX)\n end",
"def email_available?\n\t\tself.valid?\n\tend",
"def sends_sms?\n false\n end",
"def can_update_all_recipients_emails? = !prod? && draft_or_planned? && communes.any?",
"def send_bounces?\n self.bounce != 1 && self.mail_from.present?\n end",
"def spam?(message)\n false\n end",
"def email?\r\n short_action_serialized =~ /\\Achrobot\\/smtp_action\\|/\r\n end",
"def is_valid_text(message)\n\treturn message.min >= 32 && message.max <= 122\nend",
"def all_mentor_letters_received?\n mentors.each do |m|\n return false if m.letter.nil?\n end\n true\n end",
"def sms_eligibility_check\n redirect_to(root_url) && return unless current_user.can_edit_patient?\n\n phone_number = params.require(:phone_number)\n blocked = BlockedNumber.exists?(phone_number: phone_number)\n render json: { sms_eligible: !blocked }\n end",
"def sms_confirmation_required?\n !confirmed_sms?\n end",
"def user_can_edit_email?\n targets_for_address.include?(@username)\n end",
"def mailing?\n kind.to_s == \"mailing\"\n end",
"def require_requestor_recipients!\n return true if memberships.requestor.any?\n send_registration_required_notice!\n false\n end",
"def validate\n return (@list_name && @to && @subject) ? true : false\n end",
"def is_contact_an_email?(text)\n regex = /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\Z/\n return (text =~ regex).nil? ? false : true\n end",
"def true_false_rationale(text)\n frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text\n end",
"def has_text?; end",
"def email?\n !(@text =~ EMAIL_REGEX).nil?\n end",
"def isAllowMessage(request)\n return httpRequest('check_message',request)\n end",
"def email_well_formed?\n # thank you devise\n email && email =~ /\\A[^@]+@([^@\\.]+\\.)+[^@\\.]+\\z/\n end",
"def valid?\n self.receiver.valid? && self.sender.valid?\n end",
"def award_letter_sent?\n !award_letter_sent_at.blank?\n end",
"def can_edit_letter?(organization)\n unless organization.new_record? || organization.approved? && current_contact.from_organization?\n true\n end\n end",
"def accept_or_reject\n incoming = Santize.clean(params[:From]).gsub(/^\\+\\d/, '')\n sms_input = params[:Body].downcase\n begin\n @host = User.find_by(phone_number: incoming)\n @reservation = @host.pending_reservation\n\n if sms_input == \"accept\" || sms_input == \"yes\"\n @reservation.confirm!\n else\n @reservation.reject!\n end\n\n @host.check_for_reservations_pending\n\n sms_response = \"You have successfully #{@reservation.status} the reservation.\"\n respond(sms_response)\n rescue\n sms_response = \"Sorry, it looks like you don't have any reservations to respond to\"\n respond(sms_response)\n end\n end",
"def custom_award_letter_text?\n !read_attribute(:award_letter_text).blank?\n end",
"def test!\n begin\n send_message!(:recipient_email => '_', :subject => 'meh')\n rescue Excon::Errors::Error, Timeout::Error\n false\n rescue MessageRejectedError, RecipientRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end",
"def is_message?\n in_reply_to && self.private\n end",
"def any_recipients_left?\n return true if @counters[:recipients][:to] > 0\n return true if @counters[:recipients][:cc] > 0\n return true if @counters[:recipients][:bcc] > 0\n false\n end",
"def replyable?\n @replyable ||= !flags.include?(:more_to_come)\n end",
"def sent_only_to_me\n return @sent_only_to_me\n end",
"def attribute_to_check_message_against; end",
"def recipient?(user_id)\n return (self.to.to_i == user_id.to_i)\n end",
"def valid?\n self.sender.valid? && self.receiver.valid?\n end",
"def should_spit_text?\n @tags_chain.size > 0 && \n #(not @text.empty?) &&\n [\"body\", \"p\", \"br\", \"b\", HTMLConvertor.ping_tag].include?(@tags_chain.last[:name])\n end",
"def recipient_can_bill?\n !posts.detect { |post| post.can_bill? recipient }.nil?\n end",
"def should_store_message?(params)\n (settings.ignore_regex.nil? || !params[:text].match(settings.ignore_regex)) &&\n (settings.reply_regex.nil? || !params[:text].match(settings.reply_regex)) &&\n (ENV['SLACK_USER'].nil? || ENV['SLACK_USER'] == params[:user_name] || ENV['SLACK_USER'] == params[:user_id])\nend",
"def accepts_outcome_text?\n accepted_outcome_types.member?('text')\n end",
"def validate_email\n action_name = @_action_name.to_sym\n unless Settings.can_send_email?(self.class::RESTRICT_ACTIONS[action_name]).inspect\n def self.deliver! ; false ; end\n end\n end",
"def check_recipient_or_email\n has_error = false\n\n unless user_recipients.present?\n if recipient_emails.present?\n recipient_emails.each do |e|\n errors.add(:user_recipients, I18n.t(\"activerecord.errors.models.recognition.not_properly_formatted\", e: e)) unless e.match(Constants::EMAIL_REGEX)\n end\n else\n errors.add(:sender_name, I18n.t('activerecord.errors.models.recognition.recipient_or_email'))\n end\n end\n\n end",
"def request_has_been_accepted_by_user_to_teacher(participation_request, message=nil)\n retrieve_participation_request_variables(participation_request)\n @message = message if message\n mail to: @admin.email, subject: \"Inscription acceptée - #{@user.name}\",\n reply_to: generate_reply_to('admin')\n end",
"def can_reply_to?(topic) false end",
"def can_activate?\n self.person && self.email_match?\n end",
"def check_recipient_or_email\n has_error = false\n\n unless user_recipients.present?\n if recipient_emails.present?\n recipient_emails.each do |e|\n errors.add(:user_recipients, \"#{e} is not properly formatted.\") unless e.match(Authlogic::Regex.email)\n end\n else\n errors.add(:sender_name, I18n.t('activerecord.errors.models.recognition.recipient_or_email'))\n end\n end\n\n end",
"def valid_for_final_negative_message?(user)\n marital_status = user.marital_status.downcase\n expected_header = messaging.translate \"hwf_decision.no_remission.#{marital_status}.heading\"\n expected_detail = messaging.translate \"hwf_decision.no_remission.#{marital_status}.negative.detail\",\n fee: number_to_currency(user.fee, precision: 0, unit: '£'),\n total_income: number_to_currency(user.monthly_gross_income, precision: 0, unit: '£')\n\n !!(feedback_message_with_header(expected_header) &&\n feedback_message_with_detail(expected_detail))\n end",
"def has_recipients?\n (to + cc + bcc).any?\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def self_contact\n credit? ? sender : recipient\n end",
"def not_sent_to_me\n return @not_sent_to_me\n end",
"def block_from_invitation?\n false\n end",
"def no_more_offers?\n message = first('#message')\n message && message.text == \"Come back later for more offers.\"\n end",
"def receive_email\n \n \n #if one of the to addresses matches us, use that one. todo - correctly handle mulitple emails, or correctly fail\n if params[:to].match(/group\\+(\\d+)@/) && @group = Group.find($1)\n from = params[:from]\n body = params[:plain].gsub(/^On .* wrote:$\\s*(^>.*$\\s*)+/,'') #strip out replies and whatnot\n\n if @sender = @group.students.find_by_email(from)\n @group.send_message(@sender.name+\": \"+body,@sender,[@group.user])\n elsif @group.user.email==from\n @group.send_message(@group.user.display_name+\": \"+body,@group.user)\n end\n end\n render :text => 'success', :status => 200\n end",
"def local_switch(body, prevent = false)\n room = body\n room = 'chat' if room.length < 1\n unless @connection.room_ids[room] or room == 'chat' or room[0,1] == '@' or\n @var[:special_rooms].include?(room)\n _notice \"You are not in room '#{room}'\", :error\n return false\n end\n @var[:room] = room\n unless prevent\n if room[0,1] == '@'\n _notice \"You are now private messaging with #{room[1..-1]}.\", room\n else\n _notice \"You are now chatting in '#{room}'\", room\n end\n end\n true\nend",
"def isPriv?\n case @command\n when Event::RECV_CMND_PRIVMSG,Event::RECV_CMND_NOTICE\n #\n # Name which starts with '#','&' or '!' is channel name.\n #\n if(@to=~/^[\\#\\&\\!].+/)\n return false\n else\n return true\n end\n \n else\n return false\n end\n end"
] |
[
"0.67116827",
"0.6551628",
"0.6551628",
"0.6551628",
"0.639441",
"0.6319106",
"0.6124252",
"0.61182696",
"0.60949963",
"0.6088107",
"0.60835266",
"0.6025747",
"0.5957783",
"0.59218585",
"0.5919245",
"0.59189445",
"0.5888836",
"0.58698213",
"0.58676255",
"0.5857659",
"0.5855223",
"0.58097744",
"0.5802578",
"0.5792232",
"0.5792199",
"0.57735366",
"0.57531047",
"0.57494605",
"0.57494605",
"0.574581",
"0.57151514",
"0.57128674",
"0.5656858",
"0.56484556",
"0.5626415",
"0.5618725",
"0.5613755",
"0.5571941",
"0.5566905",
"0.5538481",
"0.5529596",
"0.5520645",
"0.55183434",
"0.55133647",
"0.5512866",
"0.5512214",
"0.5512214",
"0.5511433",
"0.5504665",
"0.5497733",
"0.54861844",
"0.54825306",
"0.5471875",
"0.54712176",
"0.54642653",
"0.5461367",
"0.5449628",
"0.54492354",
"0.5446621",
"0.544008",
"0.54326177",
"0.54310054",
"0.5429924",
"0.54288924",
"0.54278034",
"0.5425718",
"0.5420818",
"0.5387051",
"0.5378818",
"0.53719455",
"0.53709793",
"0.5362439",
"0.53539085",
"0.5353705",
"0.5351384",
"0.535113",
"0.534557",
"0.53382635",
"0.5338003",
"0.5333778",
"0.53186893",
"0.5316497",
"0.53129745",
"0.53113353",
"0.530738",
"0.53066623",
"0.5298628",
"0.5296262",
"0.52926826",
"0.52926636",
"0.5291481",
"0.52899486",
"0.528882",
"0.5287138",
"0.52807444",
"0.52766603",
"0.52604663",
"0.5253414",
"0.5241357",
"0.52394795"
] |
0.66995835
|
1
|
Checks for messaging platform based on their `number` column whatsapp 'whatsapp:+60123456789' sms '+60123456789' messenger 'messenger:123456789'
|
def platform
case number
when /whatsapp/
'whatsapp'
when /messenger/
'messenger'
else
'sms'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_extension_phone_number_detect_sms_feature()\n begin\n endpoint = \"/restapi/v1.0/account/~/extension/~/phone-number\"\n resp = $platform.get(endpoint)\n for record in resp.body['records'] do\n for feature in record['features'] do\n if feature == \"SmsSender\"\n # If user has multiple phone numbers, check and decide which number\n # to be used for sending SMS message.\n return send_sms(record['phoneNumber'])\n end\n end\n end\n if resp.body['records'].length == 0\n puts (\"This user does not own a phone number!\")\n else\n puts(\"None of this user's phone number(s) has the SMS capability!\")\n end\n rescue StandardError => e\n puts (e)\n end\nend",
"def detect_sms_feature()\n begin\n endpoint = \"/restapi/v1.0/account/~/extension/~/phone-number\"\n resp = $platform.get(endpoint)\n for record in resp.body['records'] do\n for feature in record['features'] do\n if feature == \"SmsSender\"\n puts (\"This phone number \" + record['phoneNumber'] + \" has SMS feature\")\n end\n end\n end\n if resp.body['records'].length == 0\n puts (\"This user does not own a phone number!\")\n end\n rescue StandardError => e\n puts (e)\n end\nend",
"def whatsapp_format(phone)\n Phonelib.parse(phone).international(false).tr('+', '')\n end",
"def sender_not_supported\n sms.to[0] == \"1\" || # USA\n sms.to[0..2] == \"962\" || # Jordan\n sms.to[0..2] == \"971\" # UAE\n end",
"def sms?\n message_type&.to_sym == :sms\n end",
"def check_message_list(t)\n bot_user = BotUser.where(name: 'Smooch').last\n bot = t.team_bot_installations.find_by_user_id bot_user.id\n bot ? bot.settings['smooch_project_id'] : nil\nend",
"def mobile?\n return false if number.nil?\n self.number = self.number.gsub(' ', '')\n MOBILE_PREFIXES.any? { |prefix| number.starts_with?(prefix) }\n end",
"def message_type\n 'sms'\n end",
"def get_sms_number\n self.phone_numbers.where([\"type in(1, 3)\"]).first\n end",
"def process_conversation(gateway_name, phone, msg_body)\n msg_body.strip! if msg_body\n\n if !msg_body || msg_body==''\n return process_help(gateway_name,phone,msg_body)\n end\n\n from_users = get_system_org.users.find_all_by_phone(phone)\n\n # if this is the format of a validation code\n # and there is a user requiring validation\n # this takes priority\n might_be_conf_code = (msg_body =~ /the code is (\\d+)/ || msg_body =~ /^\\s*(\\d+)/)\n if might_be_conf_code\n conf_code = $1\n logger.info(\"Attempting to verify phone #{phone} with code #{msg_body}\")\n validating_user = from_users.detect { |user| !user.sms_validated? && user.sms_validation_sent==msg_body }\n # note: even if multiple users are using a phone, and one user is not validated, but this user does return correctly, then this validation will succeed\n # note: if this is an incorrect validation code, then the response\n # if there is no message should reflect an invalid validation code\n # not an invalid conversation piece.\n return process_validation(gateway_name,validating_user,conf_code) if validating_user\n end\n\n # only validated users can be in conversations\n from_users.reject! {|user| !user.sms_validated?}\n\n # if we reach here, it might be a conversation response\n # find recent messages sent to the users\n # if there is only one recent message -> reply to this\n # if there are multiple messages and only one user -> user must address\n # if there are multiple users on the phone -> user must identify themselves -> overcome by just asking to address the message\n num_senders = 0\n msgs = from_users.collect() do |user|\n user_msgs = user.recent_msgs(APP_SETTINGS[:conversations_timeout])\n\n # ignore system messages\n user_msgs.reject! {|m| m.from==OCP::standardize_unique_name(FROM_SYSTEM_NAME)}\n\n # ignore messages from self\n user_msgs.reject! {|m| m.from==user.login_name}\n\n # remove duplicates from the from addresses\n senders = user_msgs.inject([]) do |all_from,m|\n std_name = OCP::standardize_unique_name(m.from)\n (all_from.include?(std_name) ? all_from : all_from.push(std_name))\n end\n\n num_senders += senders.count\n #puts \"\\nSENDERS:***\\n\"+senders.inspect\n (senders.length>0 ? [user,senders] : nil )\n end.compact\n #puts \"\\nCOMBINED MSGS ***\\n\"+msgs.inspect\n\n if (num_senders==1)\n from_user = msgs[0][0]\n org = from_user.org\n prev_sender = msgs[0][1][0]\n to_user = org.find_recipient_by_name(prev_sender)\n if to_user\n msg = safe_send_msg(org, from_user, to_user,msg_body)\n result = \"Sent message to #{to_user.login_name}\"\n reply_to_sender(phone,result)\n return result,false\n else\n logger.debug \"Could not find user who sent the last message: from = #{prev_sender}\"\n must_address = true\n end\n else\n must_address = num_senders>1\n # if no messages then something else\n end\n\n case\n when might_be_conf_code\n return reply_to_sender_with_error(phone, REPLY_VERIFY_DO_NOT_RECOGNIZE_PHONE_AND_CODE)\n when must_address\n all_senders = msgs.collect {|m| m[1].join(',')}\n return reply_to_sender_with_error(phone, sprintf(REPLY_CONVERSATION_MUST_ADDRESS,all_senders.join(',')))\n else\n # no command do nothing\n log_event(\"receive\", \"Unknown request: #{msg_body}\")\n result = \"Unknown command #{msg_body}\"\n error = true\n return result,error\n end\nend",
"def whatsapp_click_to_chat_url(phone)\n \"https://api.whatsapp.com/send?phone=#{whatsapp_format(phone)}&text&source&data&&lang=#{current_user.language}\"\n end",
"def uses_mobile?(phone_number)\n PhoneNumber::MOBILE_PREFIXES.any? { |prefix| phone_number.starts_with?(prefix) }\n end",
"def is_mobile?(number)\n return true if mobile_format.nil?\n number =~ mobile_number_regex ? true : false\n end",
"def is_sender_registered?(phone_number)\n phone_number = phone_number.gsub(/\\+1/, '').gsub(/\\D+/, '')\n get_system_org.users.find_by_phone(phone_number)\n end",
"def windows_phone?\n !!(ua =~ /Windows Phone/)\n end",
"def phone_numbers_match_first_message\n first_message = self.messages.order(:created_at)&.first\n unless first_message.blank?\n unless self.to_phone == first_message.to\n errors.add(:to_phone, 'must match :to attribute of first Message')\n end\n unless self.from_phone == first_message.from\n errors.add(:from_phone, 'must match :from attribute of first Message')\n end\n end\n end",
"def known_numbers\n numbers = {}\n\n numbers[:me] = Set.new(@client.account.incoming_phone_numbers.list.map(&:phone_number))\n\n @client.account.sms.messages.list({}).each do |@message|\n if @message.direction == \"inbound\"\n numbers[:victims] ||= Set.new\n numbers[:victims] << @message.from\n end\n end\n return numbers\nend",
"def send(user, number, message, phone=nil)\n phone = Behaviour.select_phone(number, user['behaviour']) if phone.nil?\n if phone #se fizer match com os existentes\n `gammu-smsd-inject -c ~/.sms/gammu-smsdrc-#{phone} TEXT #{number} -text \"#{message}\"` # send to daemon\n #LOGIT que foi para a fila\n else \n #LOGIT que alguem tentou mas nao foi para a fila\n end\n end",
"def send_sms_verification_code\n number_to_send_to = phone_number\n verification_code = phone_verification_code\n sms_message_body = I18n.t(\"devise.phone.message_body\", :verification_code => verification_code)\n\n sms = Sms.new\n sms.phone_number = number_to_send_to\n sms.message = sms_message_body\n return false unless sms.send!\n\n true\n end",
"def mobile_no_formatting(arg)\n if arg.present? \n if arg.downcase.include?('toll') || arg.downcase.include?('phone') || arg.downcase.include?('direct') || arg.downcase.include?('office')\n return number_to_phone(arg.gsub(/[^\\d,\\.]/, '').to_i, area_code: true)\n elsif arg.downcase.include?('ext')\n phone_number = arg.downcase.split('ext')\n phone = if phone_number[0].to_i == 0 || phone_number[0].to_i.to_s.size < 10\n ph = phone_number[0].gsub!(/[^0-9A-Za-z]/, '')\n ph = ph[1..10] if ph.length > 10\n number_to_phone(ph, area_code: true)\n else\n number_to_phone(phone_number[0].to_i, area_code: true)\n end\n return phone.to_s + ' Ext'+ remove_unnecessary_keywords(phone_number[1])\n elsif arg.include?('(') || arg.include?(')') || arg.include?('-') || arg.include?('.') || arg.include?(' ')\n arg = arg.gsub!(/[^0-9A-Za-z]/, '')\n arg = arg[1..10] if arg.length > 10\n return number_to_phone(arg.to_i, area_code: true) \n elsif arg.include?('x') || arg.include?('�')\n arg = arg.gsub('�', '') if arg.include?('�')\n arg = arg[1..10] if arg.length > 10\n return number_to_phone(arg.to_i, area_code: true)\n else\n arg = arg[1..10] if arg.length > 10\n return number_to_phone(arg.to_i, area_code: true) \n end\n end\n\n end",
"def sms(phone_number)\n mp \"[BP Deprecated] use app.launch(sms: #{phone_number}) over app.sms\"\n launch(sms: phone_number)\n end",
"def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end",
"def smsable?\n properties.include?(\"smsable\")\n end",
"def sends_sms?\n false\n end",
"def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end",
"def mobile_format\n strfphone(MOBILE_FORMAT)\n end",
"def valid_to?\n return true if ( not @sms_to.blank? ) && ( @sms_to.length == 8 ) && ( ['4','9'].include? @sms_to[0] )\n false\n end",
"def show\n whatsapp = WhatsApp.new\n whatsapp.line = @message.sender\n whatsapp.url = @message.url\n whatsapp.appname = @message.appname\n whatsapp.token = @message.token\n whatsapp.messageSearch(@message.id, @message.protocol)\n #whatsapp.questionSearch(@message.id, @message.protocol)\n end",
"def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end",
"def windows_mobile?\n !!(ua =~ /Windows CE/)\n end",
"def sms\n return nil unless @property_hash.has_key? 'sms'\n return nil unless @property_hash['sms'] == '0' || @property_hash['sms'] == '1'\n\n @property_hash['sms'] == '1' ? :true : :false\n end",
"def standardized_sms_phone_number\n PhoneParser.normalize(sms_phone_number)\n end",
"def black_listed?(phone, text)\n number_regex = /\\+1(\\d){10,10}$/\n if number_regex.match(phone).nil? \n true \n end\n end",
"def supports? (activity_type)\n if activity_type == \"message\"\n return true\n else\n return false\n end\n end",
"def send_sms(fromNumber)\n begin\n bodyParams = {\n from: { phoneNumber: fromNumber },\n to: [{ phoneNumber: RECIPIENT }],\n # To send group messaging, add more (max 10 recipients) 'phoneNumber' object. E.g.\n #\n #to: [\n # { phoneNumber: RECIPIENT },\n # { phoneNumber: 'Recipient-Phone-Number' }\n # ],\n text: 'Hello World!'\n }\n endpoint = \"/restapi/v1.0/account/~/extension/~/sms\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts (\"SMS sent. Message id: \" + resp.body['id'].to_s)\n check_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend",
"def get_conversations_messaging_integrations_whatsapp_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_whatsapp ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/whatsapp\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WhatsAppIntegrationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_whatsapp\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def mobile?\n return params[:format] == 'm'\n end",
"def mobile?\n return params[:format] == 'm'\n end",
"def phone_info(phone_number)\n if Telephony.config.pinpoint.sms_configs.empty?\n return PinpointHelper.handle_config_failure(:sms)\n end\n\n response = nil\n error = nil\n\n Telephony.config.pinpoint.sms_configs.each do |sms_config|\n error = nil\n CLIENT_POOL[sms_config].with do |client|\n response = client.phone_number_validate(\n number_validate_request: { phone_number: phone_number },\n )\n rescue Seahorse::Client::NetworkingError,\n Aws::Pinpoint::Errors::ServiceError => error\n PinpointHelper.notify_pinpoint_failover(\n error: error,\n region: sms_config.region,\n channel: :sms,\n extra: {},\n )\n end\n break if response\n end\n\n type = case response&.number_validate_response&.phone_type\n when 'MOBILE'\n :mobile\n when 'LANDLINE'\n :landline\n when 'VOIP'\n :voip\n else\n :unknown\n end\n\n error ||= unknown_failure_error if !response\n\n PhoneNumberInfo.new(\n type: type,\n carrier: response&.number_validate_response&.carrier,\n error: error,\n )\n end",
"def mobile?\n @prefix =~ /\\A1/\n end",
"def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def phone_number_mnemonics(phone_number)\n current_mnemonic = Array.new(phone_number.length, 0)\n mnemonics_found = []\n\n phone_number_mnemonics_helper(0, phone_number, current_mnemonic, mnemonics_found)\n\n mnemonics_found\nend",
"def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end",
"def is_mobile?\n country.is_mobile? \"#{area_code}#{number}\"\n end",
"def check_token(chat_token)\n sender = @handle_keys[chat_token]\n return !sender.nil?\n end",
"def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end",
"def phone_cell\n pid13 = message.fetch('PID').fetch('PID.13')\n\n # prefer PRN (Primary Residence Number) that contains a cell phone number\n phone_cell_record = pid13.find do |record|\n phone_cell_number?(record.fetch('PID.13.1', '') || '') &&\n record.fetch('PID.13.2', :unknown_type_of_phone_record) == 'PRN'\n end\n\n # otherwise choose the first occuring cell phone number\n phone_cell_record ||= pid13.find do |record|\n phone_cell_number?(record.fetch('PID.13.1', '') || '')\n end\n\n # any number for which phone_cell_number? returns false is ignored\n\n strip_non_phone_number_characters(phone_cell_record.fetch('PID.13.1')) if phone_cell_record.present?\n end",
"def check_white_list!(phone_number)\n if self.class.config[:white_list] && !phone_number.white_list?\n raise SmsOnRails::SmsError.new(\"Phone number #{phone_number.human_display} is not in white list\")\n end\n end",
"def calculate(message, phone)\n \n puts message.to\n end",
"def find_all_by_phone_number( number )\n normalised_number = tokenize_phone_number( number )\n country_code = normalised_number.first\n \n # Is this a detector country?\n detector = phone_number_detector_factory.detector_for( country_code )\n if detector\n return detector.find_all_by_phone_number( normalised_number )\n \n # Otherwise ask the general code base for the number\n else\n return Country.find_all_by_country_code( country_code )\n end\n \n rescue\n return nil\n end",
"def valid_indian_mobile_number?(mobile_no)\n is_valid_mobile_no?(mobile_no) ? is_valid_data_with_format?(mobile_no, /^([9]{1}|[8]{1}|[7]{1})([0-9]{9})$/, \"Mobile no.\") : false\nend",
"def is_valid_message?(params)\n settings.environment == :development || (params[:token] == ENV['OUTGOING_WEBHOOK_TOKEN'] && params[:bot_id].nil?)\nend",
"def check_do_not_send!(phone_number)\n if phone_number.do_not_send?\n raise SmsOnRails::SmsError.new(\"Phone number #{phone_number.human_display} do not send is set:#{phone_number.do_not_send}\")\n end\n end",
"def get_partner_phone_no(page)\n\t\tbegin\n\t\t\tschdule_btn = page.search(\"td.reserve-col .btn-transaction\")\n\t\t\tif !schdule_btn.empty?\n\t schdule = schdule_btn[0][\"href\"]\n\t\t\t\t schdule_page = @mechanize.get(@base_url+schdule)\n\t phone = schdule_page.search(\".list-unstyled.activity-slot-details\")[0].search(\"li:last\").text.split(\"+\")[1]\n\t\t\telse\n\t\t\t\tphone = \"\"\n\t\t\tend\n\t\trescue Exception => e\n phone = \"\"\n\t\tend\n\t\treturn phone\n\tend",
"def twilio_send_text_message!(client,phone_num,msg)\n begin\n sms = client.account.sms.messages.create(\n :from => TWILIO_PHONE,\n :to => phone_num,\n :body => msg)\n rescue Exception => e\n puts \"Problems with twilio:\\n#{e}\"\n end\n end",
"def mobile_phone\n return unless @user.loa3?\n\n dig_out('telephones', 'phone_type', VAProfile::Models::Telephone::MOBILE)\n end",
"def check_true(msg, lang)\n # use entries in BotResponse with seq=10xx to identify call type\n m = BotResponse.where(lang: lang).where(\"seq >= ?\", 1100).where(\"seq < ?\", 1200).to_a # Mappings\n result = \"\" # \n m.each do |item|\n item[\"message\"].split(\",\").each do |word|\n if msg.strip.downcase.include?(word.strip.downcase)\n result = item[\"identifier\"].to_s\n break\n end\n end\n if result != \"\"\n break\n end\n end\n if result == \"true\"\n return true\n else\n return false\n end\n end",
"def send_app_notification\n if message.present?\n message.receipts.unread.each do |receipt|\n user = receipt.receiver\n if user.is_a?(User) #&& user.user_setting.\n user_setting = user.user_setting\n allow_push = false\n if message.message_type == 'user_messages' && user_setting.allow_user_messages?\n allow_push = true\n end\n if message.message_type == 'clan_messages' && !(user_setting.allow_clan_messages.include?(message.notified_object_id.to_s))\n allow_push = true\n end\n if allow_push && (user_setting.android? || user_setting.iphone? ) && user_setting.fcm_token.present?\n # sky start\n\n # fcm = FCM.new(\"AIzaSyCHC77aETrtuaAvNTQQqvnLhjFf6zHOSPc\")\n # options = {data: {message: \"#{sender.username}: #{subject}\", url: nil, id: receipt.id, type: :usermessages}, collapse_key: :updated_score}\n # registration_ids = [user_setting.fcm_token]\n # response = fcm.send(registration_ids, options)\n\n # sky end\n\n fcm = FCM.new(\"AAAAqD6vl5g:APA91bEE1FUBihFLdW6kO9XpN-srDxlama2BzzjimePRN-kBlfq0tKMsblhNPW7a2_CeM1J0Pz7SMAYx4c_notZMCx2schfCDYvizOW6EYWAhnUsYA10azWOenextxFiUaFotLT8Z8er\")\n if user_setting.android?\n options = { data: { title: sender.username, message: subject, url: nil, id: receipt.id, type: message.message_type}, collapse_key: :updated_score}\n else\n options = {notification: {title: sender.username, body: subject, icon: \"myicon\", sound: \"notificationRoster.wav\", url: nil, id: receipt.id, type: message.message_type}, priority: \"high\"}\n end\n\n registration_ids = [user_setting.fcm_token]\n response = fcm.send(registration_ids, options)\n\n end\n end\n end\n end\n end",
"def check_phone_status(hsh)\n phone = hsh[:phone]\n phone_f = hsh[:phone_f]\n status = 'invalid'\n status = phone != phone_f ? 'formatted' : 'unchanged' if phone && phone_f\n hsh[:phone_status] = status if status.present?\n hsh\n end",
"def valid_phone_number?(phone)\n # phone.each do |number|\n # number.\n if phone.match(/([0-9] ?){10}/) || phone.match(/(\\([0-9]{3}\\)([0-9]{3}-[0-9]{4})\\b)/) || phone.match(/\\b([0-9]{7})\\b/)\n true\n else\n false\n end\nend",
"def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end",
"def is_valid_mobile_no?(mobile_no)\n (mobile_no.to_i > 0) ? valid_mobile_no_length?(mobile_no) : false\nend",
"def sms_confirmed?\n return false if txter_sms_confirmed_phone_number.blank?\n txter_sms_confirmed_phone_number == txter_sms_phone_number\n end",
"def submit_number\n content_tag(\"strong\", configatron.incoming_sms_number.blank? ? \"[\" + t(\"sms_form.guide.unknown_number\") + \"]\" : configatron.incoming_sms_number)\n end",
"def process\n # abort if the SMS in question is from one of the incoming SMS numbers\n return if all_incoming_numbers.include?(incoming_msg.from)\n\n self.reply = handle_reply\n self.forward = handle_forward\n end",
"def post_conversations_messaging_integrations_whatsapp_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.post_conversations_messaging_integrations_whatsapp ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling ConversationsApi.post_conversations_messaging_integrations_whatsapp\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/whatsapp\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WhatsAppIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#post_conversations_messaging_integrations_whatsapp\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def mobile?\n os_parser.mobile?\n end",
"def send_sms_token\n if(self.phone?)\n generate_sms_token! if self.sms_confirmation_token.nil?\n ::Devise.sms_sender.send_sms(self.phone, I18n.t(:\"devise.sms_activations.sms_body\", :sms_confirmation_token => self.sms_confirmation_token, :default => self.sms_confirmation_token))\n else\n self.class.sms_confirmation_keys.each do |key|\n self.errors.add(key, :no_phone_associated)\n end\n false\n end\n end",
"def matches_message?(message)\n match_message(message).any?\n end",
"def set_messaging\n @messaging = Messaging.find(params[:id])\n end",
"def chat_message(message)\n r = Skype.send_command \"CHATMESSAGE #{id} #{message}\"\n ChatMessage.parse_from(r)\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n whatsapp = WhatsApp.new\n whatsapp.line = @message.sender\n whatsapp.url = @message.url\n whatsapp.appname = @message.appname\n whatsapp.token = @message.token\n whatsapp.messageSend(@message.id, @message.recipient, @message.text)\n #whatsapp.questionSend(@message.id, @message.recipient, @message.text, \"['Sim';'Não']\")\n\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_message(num)\n\n case num\n when 1\n message = \"Your numerology number is #{num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n end\nend",
"def set_message\n @message = Message\n .joins(:chat)\n .where(\n number: params[:number],\n chats: {\n number: params[:chat_number],\n application: Application.find_by(token: params[:application_token]),\n },\n )\n end",
"def parse(number)\n if /\\A[2-9]{10}\\z/ =~ number\n possible_permutations = number_permutations(number)\n process_combinations(possible_permutations)\n else\n puts 'Mobile number should be only 10 digit as well as should not contain 0 and 1'\n end\n end",
"def hk_phone_number?(str)\n # setup a dictionary where indices correspond to a number for O(1) lookup\n numbers = {\n '0' => true,\n '1' => true,\n '2' => true,\n '3' => true,\n '4' => true,\n '5' => true,\n '6' => true,\n '7' => true,\n '8' => true,\n '9' => true\n }\n if str.length == 9\n i = 0\n while i < str.length\n if i == 4 && str[i] != ' '\n return false\n elsif i != 4 && !numbers[str[i]]\n return false\n end\n i += 1\n end\n else\n return false\n end\n true\nend",
"def send_free_message(kind, phone_number = params[:phone_number])\n raise \"Phone_number is not given\" if phone_number.blank?\n \n messaging = Messaging.new\n messaging.send(\"send_free_#{kind}\", normalize_phone(phone_number), @iphone)\n \n render :text => \"\"\n end",
"def verificarMensagens\n\t\tputs \"Verificando mensagens enviadas.\"\n\t\tif @im.received_messages?\n\t\t\t@im.received_messages.each do |mes|\n\t\t\t\t#TO-DO: Verify if the command is valid in order to avoid dangerous acts from the user.\n\t\t\t\tmes.body.sub(/[^ ]*/){|metodo| \n\t\t\t\t\tmethod = @@methods[metodo]\n\t\t\t\t\tif method\n\t\t\t\t\t\tmethod.call(mes,@im)\n\t\t\t\t\telse\n\t\t\t\t\t\t@im.deliver(mes.from,\"Function does not exist.\")\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def new_sms_updates(content, tonumber)\n\t@client.messages.list.each do |message|\n\tRails.logger.debug(message.body)\n\tend\n end",
"def get_message(numerology)\n\n\tcase numerology\n\n\twhen 1\n\t\tmessage = \"One is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\\n\\n\"\n\twhen 2\n\t\tmessage =\"This is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\\n\\n\"\n\twhen 3\n\t\tmessage =\"Number Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three’s enjoy life and have a good sense of humor. Ruled by Jupiter.\\n\\n\"\n\twhen 4\n\t\tmessage =\"This is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\\n\\n\"\n\twhen 5\n\t\tmessage =\"This is the freedom lover. The number five is an intellectual vibration. These are ‘idea’ people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\\n\\n\"\n\twhen 6\n\t\tmessage =\"This is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\\n\\n`\"\n\twhen 7\n\t\tmessage =\"This is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\\n\\n\"\n\twhen 8\n\t\tmessage =\"This is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\\n\\n\"\n\twhen 9 \n\t\tmessage =\"This is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\\n\\n\"\n\n\telse\n\t\tmessage =\"You were born at the wrong time...\\n\\n\"\n\n\tend\nend",
"def messaging\n end",
"def current_user_hasmsg?\n response = get_current_user_meta('hasmsg')\n return false unless response\n\n response['query']['userinfo']['messages'] == ''\n end",
"def set_message\n @message = @chat.messages.find_by_message_number(params[:number])\n end",
"def add_phone_number(phone_number)\n return if self.has_number?(phone_number)\n puts \"adding number: \" + phone_number.number \n self.save\n self.list_memberships.create! :phone_number_id => phone_number.id\n if(self.use_welcome_message?)\n puts \"has welcome message, and creating outgoing message\"\n welcome_message = self.custom_welcome_message\n create_outgoing_message( phone_number, welcome_message )\n end \n end",
"def mobile_enquiry(user_input_tokens)\n phone_enquiry(user_input_tokens)\n end",
"def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end",
"def register_number(message,sms_number)\n chopped_message = message.gsub(/^\\s*reg\\s/i,'').split(\"\\s\")\n $stderr.puts chopped_message\n # check that it is length 2\n send_try_again_sms(sms_number) if chopped_message.length != 2\n register_number = chopped_message.grep(/\\d+/)\n #TODO - could make this more robust and allow for +88 too\n if register_number[0].length != 11 and register_number.grep(/^\\+1/).length != 1 #length of phone numbers in bangladesh\n send_try_again_sms(sms_number,\n \" The phone number should be 11 digits long\")\n return nil\n end\n\n register_name = chopped_message.grep(/[a-zA-Z]+/)\n\n if register_name.length == 1 and register_number.length == 1\n $stderr.puts \"meets field register reqs\"\n field_register_pharmacy(register_number,register_name,sms_number)\n else\n send_try_again_sms(sms_number)\n end\n return nil\nend",
"def check_platform\n mobile_override = params[:mobile] && params[:mobile] == \"1\"\n desktop_override = params[:mobile] && params[:mobile] == \"0\"\n if ( (browser.mobile? and !browser.ipad?) or mobile_override ) and !request.xhr? and !desktop_override\n @platform = 'mobile'\n request.format = :mobile\n else\n @platform = 'desktop'\n end\n end",
"def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end",
"def micro_messenger?(expected_version = nil)\n MicroMessenger.new(ua).match? &&\n detect_version?(full_version, expected_version)\n end",
"def phone_number\n case rand(0..2)\n when 0 then fixed_line_number\n when 1 then mobile_number\n when 2 then mobile_or_pager_number\n end\n end",
"def with_sms_verification(phone)\n # Try to find SMS verification request\n sms_verification = SmsVerification.where({ cookie: cookie, phone: phone }).first\n\n # No SMS code sent yet.\n unless sms_verification\n generate_sms_verification_code(phone)\n false\n # SMS code was already sent\n else\n # SMS code is correct\n if sms_verification.code == params[:sms_verification_code]\n reset(sms_verification)\n true\n # SMS code is incorrect\n else\n sms_verification.attempts += 1\n sms_verification.save\n\n if sms_verification.attempts >= 3\n reset(sms_verification)\n generate_sms_verification_code(phone)\n end\n\n false\n end\n end\n end",
"def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end",
"def mobile_phone\n pull unless @details\n begin\n return @details.mobile_phone.free_form_number\n rescue\n return nil\n end\n end",
"def conversation_extra_infos(conversation)\n extra_infos = Mailboxer::ExtraInfo.find(conversation.mailboxer_extra_info_ids.split(',')) if conversation.mailboxer_extra_info_ids.present?\n end",
"def registration_commands(command, bot_webhook)\n return check_user_consist(bot_webhook) if command.eql?(:message)\n\n self.class.send_message(StrContainer.need_number, bot_webhook)\n end",
"def onomatopoeize(phoneme)\n ONOMATOPOEIC_PHONEMES[phoneme]\n end",
"def formatted_number(phone_number)\n number = phone_number.dup\n number = number.gsub(' ', '').gsub('.', '').gsub('-', '').gsub('/', '')\n\n PhoneNumber::MOBILE_PREFIXES.each do |prefix|\n if number.starts_with? prefix\n number = number.gsub prefix, \"0033#{prefix.last}\" #.last because last is 6 or 7\n break\n end\n end\n number\n end",
"def cell_phone\n parse('cell_phone.formats')\n end"
] |
[
"0.6133845",
"0.58666766",
"0.5720551",
"0.56871295",
"0.5615994",
"0.5611103",
"0.5572347",
"0.55648994",
"0.55512226",
"0.5486782",
"0.5485437",
"0.5461072",
"0.54113466",
"0.53517085",
"0.53516674",
"0.53315014",
"0.52528274",
"0.5250304",
"0.52291155",
"0.5209644",
"0.51946163",
"0.5192",
"0.51736104",
"0.5172033",
"0.5158346",
"0.5151035",
"0.5149836",
"0.514812",
"0.514748",
"0.5128259",
"0.5123595",
"0.50681573",
"0.5062467",
"0.5048925",
"0.5040661",
"0.50379544",
"0.5032858",
"0.5032858",
"0.5003878",
"0.49807802",
"0.49787003",
"0.49113354",
"0.49039704",
"0.48735473",
"0.4871535",
"0.48651317",
"0.483753",
"0.4835167",
"0.48322055",
"0.48288634",
"0.4828012",
"0.48263833",
"0.48226738",
"0.48190802",
"0.4801794",
"0.48013705",
"0.47985157",
"0.47784618",
"0.47756532",
"0.4768019",
"0.47668448",
"0.47636595",
"0.47560653",
"0.4752095",
"0.47512227",
"0.47478014",
"0.47425905",
"0.47397932",
"0.47388756",
"0.47372407",
"0.47317916",
"0.4726685",
"0.47255614",
"0.47228712",
"0.47184542",
"0.47157553",
"0.47108516",
"0.4708473",
"0.47059837",
"0.4694037",
"0.46883103",
"0.4683893",
"0.46822482",
"0.46728426",
"0.46676373",
"0.46673274",
"0.46649736",
"0.46595657",
"0.46543422",
"0.465362",
"0.4647312",
"0.4646477",
"0.4646316",
"0.46296898",
"0.46217486",
"0.46168017",
"0.46146503",
"0.46074888",
"0.4603296",
"0.45993957"
] |
0.68543506
|
0
|
GET /stuk_todo_tasks GET /stuk_todo_tasks.json
|
def index
@to_do = current_user.stuk_todo_tasks.where(state: 'to_do')
@doing = current_user.stuk_todo_tasks.where(state: 'doing')
@done = current_user.stuk_todo_tasks.where(state: 'done')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tasks\n @todos = Todo.all\n render json: @todos\n end",
"def todo\n @tasks = TaskDecorator.decorate_collection Task.getReadyToDoTasks\n render \"v1/tasks/index\"\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def index\n @tasks = Task.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def index\n #@tasks = Task.all\n tasks = @task_list.tasks.all\n render :json => tasks\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def index\n @tasks = Task.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_task }\n end\n end",
"def index\n # /tasks -> created_at順にsortされたTask.allが表示される。\n # /tasks?order_by=due_date_at -> due_date_at順にsortされたTask.allが表示される。\n # /tasks?assignee_id=1 -> 指定したassigneeごとのtasksが表示される。\n # /tasks?user_id=1 -> 指定したuserごとのtasksが表示される。\n # /tasks?due_date_at=2019-01-01 -> 指定した日付のtasksが表示される。\n # /tasks?order_by=due_date_at&assignee_id=1&user_id=1&due_date_at=2019-01-01\n\n if params[:order_by].present?\n column = params[:order_by].to_sym\n else\n column = :created_at\n end\n @tasks = Task.order_by(column)\n \n if params[:assignee_id].present?\n @assignee = User.find(params[:assignee_id])\n @tasks = @tasks.by_assignee(@assignee)\n end\n\n if params[:user_id].present?\n @user = User.find(params[:user_id])\n @tasks = @tasks.by_user(@user)\n end\n\n if params[:due_date_at].present?\n @date = params[:due_date_at].to_sym\n @tasks = @tasks.by_due_date_at(@date)\n end\n\n render json: @tasks if request.xhr?\n end",
"def index\n @tasks = Task.all\n @root = \"tasks\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all(:order => \"position\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = @project.tasks.find(:all, :order => 'project_name asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { redner json: @tasks }\n end\n\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def index\n @to_dos = ToDo.all\n\n render json: @to_dos\n end",
"def index \n render :json => Project.find(11).tasks\n end",
"def index\n @task = Task.new\n @tasks = Task.all.sort_by{|task| task.done? ? 0 : 1;}\n respond_to do |format|\n format.html {render action: 'index'}\n format.json {render json: @tasks}\n end\n end",
"def index\n @tasks = current_user.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tasks }\n end\n end",
"def show\n json_response(@todo)\n end",
"def index\n\t\t@tasks = @event.tasks.all\n\n\n\n\t\t# @task.find(task_id).user.name\n\t\t# user_id = params[:user_id]\n\t\t# @user = User.find(user_id)\n\t\t# render :index\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index}\n\t\t\tformat.json { render json: @tasks }\n\t\tend\n\tend",
"def index\n @tasks = Task.includes(:user).order(created_at: :desc).all\n render json: @tasks, each_serializer: TasksSerializer\n end",
"def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see tasks for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @deadline_tasks = @tasks.where('end_date <= ?', Date.today + 1).where.not(status: 'completed')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n # prepare datas for timeline\n if params[:init_date]\n @init_date = params[:init_date].to_date\n @end_date = @init_date + 6\n # update page without refresh\n respond_to do |format|\n format.js { render action: 'functions/update_timeline'}\n end\n else\n @init_date = Date.yesterday\n @end_date = @init_date + 6\n end\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all \n end",
"def index\n @user = User.find(username: 'default').first\n unless @user\n @user = User.create(username: 'default', fullname: 'Default User')\n end\n @task = Task.new # For a new task to be added\n # Pending tasks for this user\n @pending_tasks = @user.pending.all\n # We paginate completed tasks as the list could be long\n @completed_tasks, @page, @next_page = @user.get_completed_page(params, PAGE_SIZE)\n # Select pending or completed tab on view\n if params[:page]\n # Only completed tab has pagination\n @initial_tab = session[:current_tab] = 1\n elsif session[:current_tab]\n @initial_tab = session[:current_tab]\n else\n # Default\n @initial_tab = session[:current_tab] = 0\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.active.order('tasks.position ASC')\n @completed_tasks = Task.completed.order('tasks.completed_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @api_tasks = Api::Task.all\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def index\n respond_to do |format|\n format.html do\n @task = current_user.tasks.new\n end\n format.json do\n page = (params[:page] || 1).to_i\n per_page = 5\n total_pages = (@tasks.count.to_f / per_page).ceil\n total_pages = 1 if total_pages.zero?\n @tasks = @tasks.paginate(page: page, per_page: per_page)\n render json: { tasks: @tasks, page: page, totalPages: total_pages }\n end\n end\n end",
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def list_todo_items(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/users/self/todo\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def index\n @todos = Todo.all\n json_response(@todos)\n end",
"def index\n @tasks = current_user.tasks.active if user_signed_in?\n @task = Task.new\n @this_week = Week.current\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @todos = Todo.all\n render json: @todos\n end",
"def index\n @tasks = Task.where(:user_id => current_user.id).order('priority desc')\n # @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n authenticate_user!\n @tasks = current_user.tasks\n end",
"def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end",
"def show\n render json: @task\n end",
"def index\n render json: Todo.all\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def index\n @tasks = Task.order_by_company_project_and_task.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @tasks.present? ? \"\" : \"There are no tasks available at this time\"\n format.json do\n status = @tasks.present? ? :ok : :not_found\n render json: { response: @tasks, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:task)\n flash[:alert] = message unless message.blank?\n @tasks\n end\n end\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def index\n @tasks = @list.tasks.order(status: :asc)\n return render_success_task_index\n end",
"def index\n @tasks = Task.all\n @task = Task.new\n end",
"def index\n @tasks = Task.all\n @task = Task.new\n end",
"def index\n @spiffy_tasks = SpiffyTask.all\n end",
"def show\n @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_list }\n end\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def index\n @goals = @todo.goals.all\n render json: @goals\n end",
"def index\r\n @tasks = get_sorted_list_of_tasks\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @tasks }\r\n end\r\n end",
"def tasks\n user = validate_user( request.headers[\"authentication-token\"] )\n if user.nil?\n respond_to do |format|\n format.html do\n flash[:error] = 'Not authenticated.'\n redirect_to root_url\n end\n\n format.xml { render :xml => { :status => :error, :message => 'Invalid authentication code.'}.to_xml, :status => 403 }\n\n format.json { render :json => { :status => :error, :message => 'Invalid authentication code.'}.to_json, :status => 403 }\n end\n else\n projects = Task.find_all_by_project_id( params[:id] )\n if projects\n respond_to do |format|\n format.html { \n @title = \"Dasher - Your Projects\"\n @projects = Project.find_all_by_owner(@user.id)\n }\n format.xml { render :xml => projects.to_xml( :only => [:project_id, :id, :description] ) }\n format.json { render :json => projects.to_json( :only => [:project_id, :id, :description] ) }\n end\n end\n end\n end",
"def index\n\n if params[:project_id].nil?\n results = current_user.tasks\n\n else\n @project = Project.user_readable(current_user).find(params[:project_id])\n results = @project.tasks\n end\n\n @tasks = paginate_results(params[:page], results)\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def index\n @tasklists = Tasklist.all\n end",
"def index\n\t\trespond_to do |format|\n\t\t\tformat.html { \n\t\t\t\t@tasks = normalize_tasks_for_outline\n\t\t\t\t@next_up_visible = current_user.next_up_visible\n\t\t\t\t@completed_tasks_visible = current_user.completed_tasks_visible\n\t\t\t\trender :index \n\t\t\t}\n\t\t\tformat.json { render json: Task.where(user: current_user).order(:position) }\n\t\tend\n\tend",
"def index\n redirect_to root_path and return unless signed_in?\n set_tasks\n @task = Task.new\n end",
"def show\n @to_do = ToDo.find(params[:id])\n\n render json: @to_do\n end",
"def index\n @tasks = @project.tasks\n end",
"def index\n @tasks = @project.tasks\n end",
"def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def get_user_tasks\n puts \"CURRENT USER: #{get_current_user}\"\n if get_current_user\n # if params[:category_ids].empty?\n tasks = get_current_user.tasks.order(created_at: :desc)\n tasks_categories = TaskSerializer.new(tasks)\n\n puts \"CATEGORRRIES\", tasks_categories\n\n render json: TaskSerializer.new(tasks).to_serialized_json\n else \n render json: {\n error: \"Login to see tasks\"\n }\n # render json: get_current_user.tasks.order(created_at: :desc)\n end \n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def index\n @task_lists = TaskList.all\n end",
"def index\n @task_items = Task::Item.all\n end",
"def index\n @todos = @list.todos\n render json: @todos\n end",
"def get_list(id)\n record \"/todos/list/#{id}\"\n end",
"def tasks(tasklist_id = '@default')\n get gtasks_tasks_url(tasklist_id)\n end",
"def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end"
] |
[
"0.81217694",
"0.7636453",
"0.7396693",
"0.7364092",
"0.7293267",
"0.7235082",
"0.72077256",
"0.7199321",
"0.7199321",
"0.7199321",
"0.71991354",
"0.7126991",
"0.7101131",
"0.708493",
"0.7073694",
"0.70497805",
"0.70496905",
"0.7030475",
"0.7016339",
"0.70067847",
"0.7004523",
"0.7001331",
"0.69999176",
"0.6987771",
"0.6965681",
"0.6943839",
"0.6937408",
"0.6919202",
"0.69096404",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69087005",
"0.69016296",
"0.68837595",
"0.687603",
"0.68724954",
"0.6867336",
"0.6858392",
"0.68410516",
"0.68379515",
"0.6827869",
"0.68038696",
"0.679691",
"0.67813545",
"0.67713505",
"0.67656285",
"0.67591584",
"0.67454493",
"0.6742496",
"0.674032",
"0.6734928",
"0.67305225",
"0.67225784",
"0.6718059",
"0.66849244",
"0.66842735",
"0.66842735",
"0.6669887",
"0.66637236",
"0.6660768",
"0.66574985",
"0.6649128",
"0.6644468",
"0.66350126",
"0.66325253",
"0.662269",
"0.6619447",
"0.6614996",
"0.6583459",
"0.65827763",
"0.65827763",
"0.6580683",
"0.6580246",
"0.6571759",
"0.6567149",
"0.6565884",
"0.65629655",
"0.6561367",
"0.6558265",
"0.6557789",
"0.6547964"
] |
0.6669953
|
76
|
GET /stuk_todo_tasks/1 GET /stuk_todo_tasks/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tasks\n @todos = Todo.all\n render json: @todos\n end",
"def show\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_task }\n end\n end",
"def todo\n @tasks = TaskDecorator.decorate_collection Task.getReadyToDoTasks\n render \"v1/tasks/index\"\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def index\n @tasks = Task.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def index\n #@tasks = Task.all\n tasks = @task_list.tasks.all\n render :json => tasks\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index \n render :json => Project.find(11).tasks\n end",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def index\n @tasks = @project.tasks.find(:all, :order => 'project_name asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { redner json: @tasks }\n end\n\n end",
"def index\n @tasks = Task.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def show\n json_response(@todo)\n end",
"def index\n @tasks = Task.all\n @root = \"tasks\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { redner json: @task }\n end\n\n end",
"def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @to_dos = ToDo.all\n\n render json: @to_dos\n end",
"def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n render json: @task\n end",
"def index\n @tasks = Task.all(:order => \"position\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_list }\n end\n end",
"def show\n @to_do = ToDo.find(params[:id])\n\n render json: @to_do\n end",
"def index\n @task = Task.new\n @tasks = Task.all.sort_by{|task| task.done? ? 0 : 1;}\n respond_to do |format|\n format.html {render action: 'index'}\n format.json {render json: @tasks}\n end\n end",
"def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end",
"def show\n @todo=Todo.find(params[:id])\n render json: @todo\n end",
"def index\n # /tasks -> created_at順にsortされたTask.allが表示される。\n # /tasks?order_by=due_date_at -> due_date_at順にsortされたTask.allが表示される。\n # /tasks?assignee_id=1 -> 指定したassigneeごとのtasksが表示される。\n # /tasks?user_id=1 -> 指定したuserごとのtasksが表示される。\n # /tasks?due_date_at=2019-01-01 -> 指定した日付のtasksが表示される。\n # /tasks?order_by=due_date_at&assignee_id=1&user_id=1&due_date_at=2019-01-01\n\n if params[:order_by].present?\n column = params[:order_by].to_sym\n else\n column = :created_at\n end\n @tasks = Task.order_by(column)\n \n if params[:assignee_id].present?\n @assignee = User.find(params[:assignee_id])\n @tasks = @tasks.by_assignee(@assignee)\n end\n\n if params[:user_id].present?\n @user = User.find(params[:user_id])\n @tasks = @tasks.by_user(@user)\n end\n\n if params[:due_date_at].present?\n @date = params[:due_date_at].to_sym\n @tasks = @tasks.by_due_date_at(@date)\n end\n\n render json: @tasks if request.xhr?\n end",
"def index\n\t\t@tasks = @event.tasks.all\n\n\n\n\t\t# @task.find(task_id).user.name\n\t\t# user_id = params[:user_id]\n\t\t# @user = User.find(user_id)\n\t\t# render :index\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index}\n\t\t\tformat.json { render json: @tasks }\n\t\tend\n\tend",
"def index\n @tasks = current_user.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tasks }\n end\n end",
"def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def index\n render json: Todo.all\n end",
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @api_tasks = Api::Task.all\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def index\n @todos = Todo.all\n render json: @todos\n end",
"def index\n @tasks = Task.includes(:user).order(created_at: :desc).all\n render json: @tasks, each_serializer: TasksSerializer\n end",
"def index\n @tasks = Task.all \n end",
"def index\n respond_to do |format|\n format.html do\n @task = current_user.tasks.new\n end\n format.json do\n page = (params[:page] || 1).to_i\n per_page = 5\n total_pages = (@tasks.count.to_f / per_page).ceil\n total_pages = 1 if total_pages.zero?\n @tasks = @tasks.paginate(page: page, per_page: per_page)\n render json: { tasks: @tasks, page: page, totalPages: total_pages }\n end\n end\n end",
"def index\n @todos = Todo.all\n json_response(@todos)\n end",
"def show\n @task = Task[params[:id]]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def index\n @user = User.find(username: 'default').first\n unless @user\n @user = User.create(username: 'default', fullname: 'Default User')\n end\n @task = Task.new # For a new task to be added\n # Pending tasks for this user\n @pending_tasks = @user.pending.all\n # We paginate completed tasks as the list could be long\n @completed_tasks, @page, @next_page = @user.get_completed_page(params, PAGE_SIZE)\n # Select pending or completed tab on view\n if params[:page]\n # Only completed tab has pagination\n @initial_tab = session[:current_tab] = 1\n elsif session[:current_tab]\n @initial_tab = session[:current_tab]\n else\n # Default\n @initial_tab = session[:current_tab] = 0\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def set_task\n @task = Todotasklist.find_by_id(params[:id])\n if @task\n else\n \trender json: { valid: false}, status: 404\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end",
"def index\n @tasks = Task.active.order('tasks.position ASC')\n @completed_tasks = Task.completed.order('tasks.completed_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_list }\n end\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def index\n @tasks = Task.all\n end",
"def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end",
"def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def index\n @tasks = current_user.tasks.active if user_signed_in?\n @task = Task.new\n @this_week = Week.current\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n respond_to do |format|\n # format.html # index.html.erb\n format.json { render json: @todo }\n end\n end",
"def show\n render json: @api_v1_todo\n end",
"def get_list(id)\n record \"/todos/list/#{id}\"\n end",
"def show\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@todo_list }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task }\n end\n end",
"def index\n @tasks = Task.where(:user_id => current_user.id).order('priority desc')\n # @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end"
] |
[
"0.7875715",
"0.74037445",
"0.728949",
"0.7257148",
"0.72104645",
"0.7192503",
"0.7191644",
"0.7178334",
"0.71064097",
"0.71064097",
"0.71064097",
"0.71005887",
"0.7095654",
"0.70947605",
"0.70753324",
"0.7060501",
"0.7054734",
"0.7032845",
"0.7001317",
"0.6951112",
"0.69397163",
"0.6937755",
"0.6934062",
"0.689686",
"0.68951887",
"0.6885552",
"0.68766916",
"0.68674743",
"0.6864486",
"0.68536216",
"0.6853089",
"0.68497664",
"0.6847964",
"0.6829663",
"0.68287885",
"0.68225825",
"0.6820957",
"0.67967886",
"0.67931455",
"0.6770808",
"0.6766761",
"0.67657053",
"0.6749448",
"0.6742929",
"0.6736914",
"0.6735923",
"0.6735567",
"0.6734055",
"0.6722503",
"0.67188454",
"0.6711406",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67112875",
"0.67081225",
"0.6702084",
"0.6702075",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.66895854",
"0.6687028",
"0.6687028",
"0.6686112",
"0.66839886",
"0.66805655",
"0.6671865",
"0.66623497",
"0.66558224",
"0.6654862",
"0.6649106",
"0.66358805"
] |
0.0
|
-1
|
POST /stuk_todo_tasks POST /stuk_todo_tasks.json
|
def create
@stuk_todo_task = current_user.stuk_todo_tasks.new(stuk_todo_task_params)
respond_to do |format|
if @stuk_todo_task.save
format.html { redirect_to @stuk_todo_task, notice: 'Stuk todo task was successfully created.' }
format.json { render :show, status: :created, location: @stuk_todo_task }
else
format.html { render :new }
format.json { render json: @stuk_todo_task.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @todo_task = TodoTask.new(params[:todo_task])\n\n respond_to do |format|\n if @todo_task.save\n format.html { redirect_to @todo_task, notice: 'Todo task was successfully created.' }\n format.json { render json: @todo_task, status: :created, location: @todo_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tasks\n @todos = Todo.all\n render json: @todos\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.task_list_id = @list.id\n respond_to do |format|\n if @todo.save\n format.html { redirect_to @todo, notice: 'Todo was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @task = params[:task] ? Task.create(params[:task]) : Task.create(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n respond_with(@task)\n \n end",
"def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end",
"def create\n \n @user= User.find_by_id(session[:user_id])\n @task = @user.tasks.create(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @to_do = ToDo.new(todo_params)\n\n if @to_do.save\n render json: @to_do, status: :created, location: @to_do\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end",
"def create\n @task = Task.new do |t|\n t.title = params[:title]\n t.picture = params[:picture]\n t.description = params[:description]\n t.color = params[:color]\n t.date = params[:date]\n t.order = params.has_key?(:order) ? params[:order] : 0\n end\n\n if @task.save\n render json: @task, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo_item = TodoItem.new(todo_item_params)\n\n respond_to do |format|\n if @todo_item.save\n format.html { redirect_to :root, notice: 'Your new task was successfully created.' }\n format.json { render :show, status: :created, location: @todo_item }\n else\n format.html { render :new }\n format.json { render json: @todo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end",
"def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end",
"def create\n @item = Todo.create title: params[:title], done: false, created_at: DateTime.now, done_at: nil\n render :json => @item.to_json\n end",
"def create_todo(todo)\n post_params = {\n :body => todo.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n \n response = Logan::Client.post \"/projects/#{@project_id}/todolists/#{@id}/todos.json\", post_params\n Logan::Todo.new response\n end",
"def create(name, description, projectid)\n body = {:name => name, :description => description}\n post(\"projects/#{projectid}/todolists.json\", JSON.generate(body))\n end",
"def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: 201\n else\n render json: @todo.errors, status: 422\n end\n end",
"def create_task(list_id, text)\n path = \"lists/#{list_id}/tasks\"\n params = {task: {text: text}}\n request(path, params, :post)\n\n # output full list again\n show_list(list_id)\n end",
"def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end",
"def create\n #byebug\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo = current_user.todos.create(todo_params)\n\n if @todo.save\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def create\n projusers = ProjectsUser.find(params[:task][:project_users_id])\n @task = projuser.tasks.build(task_params)\n\n if @task.save\n render json: @task , status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n #@task = Task.new(params[:task])\n\n\n @task = current_user.tasks.build(params[:task])\n\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to action: \"index\", notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def todo_params\n params.require(:todo).permit(:name, :done, :task_list_id)\n end",
"def add_tasks(list_of_hash_tasks, *args)\n list_of_hash_tasks = [list_of_hash_tasks,] if list_of_hash_tasks.is_a Hash\n raise ArgumentError, 'Only 50 tasks may be added in a single call' if list_of_hash_tasks.length > 50\n list_of_hash_tasks.each do |task|\n raise ArgumentError, 'A title must be specified when a task is added' if unless task.has_key? :title or task.has_key 'title'\n end\n add('tasks', Babar::Task, list_of_hash_tasks, 'tasks', false)\n end\n\n #Edit a single task through the Toodledo API, using the values specified in the Hash\n #\n\n def edit_task(hash_task, *args)\n edit_tasks([hash_task,], *args)\n end\n\n #Edit a list of up to 50 Task objects through the Toodledo API, using the values specified in the list of Hash objects\n #\n\n def edit_tasks(list_of_hash_tasks, *args)\n list_of_hash_tasks = [list_of_hash_tasks,] if list_of_hash_tasks.is_a Hash\n list_of_hash_tasks.each do |task|\n raise ArgumentError, 'An id must be specified when a task is edited' if unless task.has_key? :id or task.has_key 'id'\n end\n edit(\"tasks\", Babar::Task, list_of_hash_tasks, 'tasks', false, *args)\n end\n\n \n #Given a list of Task ids, delete all the corresponding tasks from the Toodledo API \n def delete_tasks(list_of_task_ids, *args)\n #TODO modify this to accept Task objects as well\n #TODO check that this will work because array is of IDs, not hashes\n modify(endpoint, 'delete', desired_class, array_of_hashes, array_field_name, delete_first_result, *args)\n end\n\n\n #Implement add/edit/delete methods for each of the following Toodledo User-defined lists: Context, Folder, Goal, Location\n %w(context folder goal location).each do |list|\n current_class = Babar::const_get(list.capitalize)\n define_method(\"get_#{list}s\") { get(\"#{list}s\", param_map = {}, desired_class = current_class, delete_first_result = false) }\n %w(add edit delete).each do |mod_endp|\n #Hash_goal is a Hash representation of the (desired) list AFTER it is added/edited/deleted\n #TODO in the case of deletion, make sure an ID suffices\n define_method(\"#{mod_endp}_#{list}\") { |hash_goal| modify_single( endpoint = \"#{list}s\", action = mod_endp, param_map = hash_goal, desired_class = current_class, delete_first_result = false)}\n end\n end\n\n end\n\nend",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def create\n @task = current_user.tasks.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'タスクを登録しました!' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n @users = User.all\n @users.each do |user|\n user.tasks << @task\n end\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = @list.tasks.build(task_params)\n\n if @task.save\n return render_success_task_created\n else\n return render_error_save @task\n end\n end",
"def create(params, projectid, todolistid)\n\n data = params[:due_at]\n data = Date.parse(data.to_a.sort.collect{|c| c[1]}.join(\"-\"))\n\n body =\n {\n :content => params[:content],\n :due_at => data,\n :assignee =>\n {\n :id => params[:assignee_id],\n :type => params[:assignee_type]\n }\n }\n\n post(\"projects/#{projectid}/todolists/#{todolistid}/todos.json\", JSON.generate(body))\n\n end",
"def task_params\n params.require(:task).permit(:title, :description, :done)\n end",
"def create\n @task = current_user.tasks.build(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to :action => :index, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def todo_params\n params.require(:todo).permit(:task, :status, :createdAt, :completedAt)\n end",
"def task_params\n params.require(:task).permit(:title, :content, :completed, :mark_done)\n end",
"def create\n task = Task.new(task_params)\n if task.save\n render json: task, status: :created\n else\n render_errors(task)\n end\n end",
"def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end",
"def create\n if params[:commit] == \"New Task\"\n list_id = List.find_by_title(params[:task][:list_title]).id\n else # Adding a task to a list\n list_id = params[:task][:list_id]\n end\n\n task_params = Task.format_params(params[:task][:title], params[:task][:description], list_id) \n respond_to do |format|\n if @task = Task.create(task_params)\n format.html { redirect_to lists_url, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todolists = Todolist.new(todolist_params)\n\n respond_to do |format|\n if @todolists.save\n format.html { redirect_to @todolists, notice: 'New task was successfully created.' }\n format.json { render :show, status: :created, location: @todolists}\n else\n format.html { render :new }\n format.json { render json: @todolists.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n @user = User[params[:user_id]]\n session[:current_tab] = 0\n \n respond_to do |format|\n if @task.save && @user.pending.unshift(@task)\n format.html { redirect_to action: 'index', notice: 'Todo was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { redirect_to action: 'index', error: 'Sorry, the todo could not be saved' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.new task_params\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.save\n #render json: { :success => 1, :todo => @todo } \n end",
"def create\n @task = Task.find(params[:user_task][:tasks_id])\n\tcurrent_user.craete_task!(@task)\n respond_to do |format|\n if @user_task.save\n format.html { redirect_to @user_task, notice: 'User Task was successfully created.' }\n format.json { render json: @user_task, status: :created, location: @user_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n if @task.save\n redirect_to task_path(@task.id)\n else\n render :new\n end\n end",
"def create\n @todo = @list.todos.new(params[:todo])\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully created.' }\n format.json { render json: @todo, status: :created, location: @todo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save \n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_task\n\t@task = Task.create(:quest_id => params[:id], :user_id => @current_user.id, :title => params[:task][:title])\n\tredirect_to quest_path(params[:id])\n\tend",
"def create\n @project = Project.find(params[:project_id]) \n @task = @project.task.build \n @task.name = params[:task][:name]\n if @task.name.empty? \n @task.name = \"New task\" \n end\n tasks = Task.find_all_by_project_id(@task.project_id)\n @task.priority = tasks.count\n @task.status = false\n @task.deadline = Time.now\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to projects_path }\n format.json { render json: @task, status: :created, location: @task }\n format.js { redirect_to projects_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.lists.find(params[:list_id]).tasks.build(params[:task])\n\n respond_to do |format|\n if @task.save\n format.js\n else\n render :js => \"TODO_IT.UI.show_alert('Something went wrong.')\"\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @task = Task.new(task_param)\n if @task.save\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages \n end\n end",
"def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = @project.tasks.build(params[:task])\n if @task.save\n @task.insert_at # The top of the list.\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task was created.'\n flash[:highlight_dom_id] = dom_id(@task)\n redirect_to project_tasks_path(@project)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'new' }\n end\n end\n end",
"def create\n # @task = Task.new(task_params)\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, success: t('.notice') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #puts \"=====\"\n #puts task_params.inspect\n @task = Task.new(task_params)\n \n # add user id.\n @task.user_id = current_user.id\n #puts @task.inspect\n \n # save to db.\n respond_to do |format|\n if @task.save\n #format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.html { redirect_to action: 'index' }\n #format.json { render action: 'show', status: :created, location: @task }\n #format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n #format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @project = Project.find(params[:project_id])\n @task = @project.tasks.create(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to project_url(@project, {:open_tab_index => '2'}), notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n params[:todo] = params[\"todo_\" + params[:id].to_s]\n @todo.user = current_user\n\n if @todo.save\n @status = \"success\"\n @message = \"To-do created successfully.\"\n unless request.xhr?\n flash[:notice] = @message\n redirect_to action: :index\n else\n render @todo\n end\n else\n @status = \"alert\"\n @message = \"To-do could not be created.\"\n unless request.xhr?\n flash[:alert] = @message\n redirect_to :back\n else\n render @todo\n end\n end\n end",
"def create\n @post_task = PostTask.new(post_task_params)\n\n respond_to do |format|\n if @post_task.save\n format.html { redirect_to @post_task, notice: 'Post task was successfully created.' }\n format.json { render :show, status: :created, location: @post_task }\n else\n format.html { render :new }\n format.json { render json: @post_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n note_id = task_params[\"note_id\"]\n new_task_params = task_params\n new_task_params.delete(\"note_id\")\n @task = Task.new(new_task_params)\n if task_params[\"color\"].nil?\n @task.color = 'purple'\n else\n @task.color = task_params[\"color\"]\n end\n # when note gets dropped on calendar\n if (!note_id.nil?)\n note = Note.find(note_id)\n @task.title = note.title\n @task.description = note.description\n @task.color = note.color\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # note dragged on all-day area\n if (@task.start == @task.end)\n @task.end = @task.start + 1.days\n end\n # for Google API post\n event = Google::Apis::CalendarV3::Event.new({\n start: {date_time: @task.start.localtime.iso8601},\n end: {date_time: @task.end.localtime.iso8601},\n summary: @task.title,\n description: @task.description\n })\n event = @service.insert_event(\"primary\", event)\n @task.google_id = event.id\n @task.user_id = current_user.id\n @task.save\n end",
"def create\n @task = @list.tasks.build(task_params)\n @task.user = current_user\n @task.save\n redirect_to list_url(@list)\n end",
"def create\n @tasklist = Tasklist.new(tasklist_params)\n\n respond_to do |format|\n if @tasklist.save\n format.html { redirect_to @tasklist, notice: 'Tasklist was successfully created.' }\n format.json { render :show, status: :created, location: @tasklist }\n else\n format.html { render :new }\n format.json { render json: @tasklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n if @task.save\n redirect_to project_tasklist_task_path(@project, @tasklist, @task), notice: 'Task was successfully created.'\n else\n render action: \"new\"\n end\n end",
"def create\n\t\t@task = Task.new(task_params)\n\t\t@task.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @task.save\n\t\t\t\tformat.html { render json: @task }\n\t\t\t\tformat.json { render json: @task }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json {render inline: \"location.reload();\" }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def todo_params\n params.require(:todo).permit(:task, :status)\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n set_tasks\n format.js { render_index }\n format.json { render :show, status: :created, location: @task }\n else\n format.js { render :index }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end",
"def create\n @task = Task.new(params[:task])\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n @feature.tasks << @task\n @iteration.tasks << @task\n @feature.save\n @iteration.save\n get_tasks\n format.js\n format.html { redirect_to(@task, :notice => 'Task was successfully created.') }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.js\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.user_id = current_user.id\n respond_to do |format|\n if @todo.save\n format.html { redirect_to list_path(@todo.list), notice: 'Todo was successfully created.' }\n format.json { render :show, status: :created, location: @todo }\n else\n format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stuk_todo_task_params\n params.require(:stuk_todo_task).permit(:content, :state)\n end",
"def create\n task = Task.new(params[:task])\n unless task.save\n flash[:error] = \"Unable to add task\"\n end\n @tasks = Task.open_tasks\n render :partial => \"task_list\", :layout => false\n end",
"def create\n @todo = Todo.new(params[:todo])\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to @todo, :notice=>\"Todo was successfully created.\" }\n format.json { render :json=>@todo, :status=>:created, :location=>@todo }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@todo.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def task_params\n params.require(:task).permit(:description, :date, :completed)\n end",
"def task_params\n params.require(:task).permit(:title, :description, :completed, :user_id)\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n todo = Todo.new(todo_params)\n if todo.save\n render json: todo\n else\n render json: { message: todo.errors.messages }, status: 422\n end\n end",
"def create\n @task = @project.tasks.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to [@project, @task], notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # バリデーション\n if is_valid_todo(todo_params)\n @todo = Todo.new(todo_params)\n @todo.user_id = current_user.id\n\n respond_to do |format|\n if @todo.save\n #format.html { redirect_to @todo, notice: 'Todo was successfully created.' }\n #format.json { render :show, status: :created, location: @todo }\n format.json { render json: @todo, status: :created}\n else\n #format.html { render :new }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json {render json: \"validation_error\", status: :error}\n end\n end",
"def create\n @default_task = DefaultTask.new(params[:default_task])\n\n if @default_task.save\n render json: @default_task, status: :created, location: @default_task\n else\n render json: @default_task.errors, status: :unprocessable_entity\n end\n end",
"def todo\n @tasks = TaskDecorator.decorate_collection Task.getReadyToDoTasks\n render \"v1/tasks/index\"\n end",
"def create\n @api_task = Api::Task.new(api_task_params)\n\n respond_to do |format|\n if @api_task.save\n format.html { redirect_to @api_task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @api_task }\n else\n format.html { render :new }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72900796",
"0.71089965",
"0.70728654",
"0.7051348",
"0.70033",
"0.6977859",
"0.6906729",
"0.6902627",
"0.6896549",
"0.68596447",
"0.68373394",
"0.6836748",
"0.6828704",
"0.68118685",
"0.680485",
"0.6779569",
"0.67759764",
"0.67681193",
"0.6761551",
"0.6726276",
"0.67132014",
"0.6712021",
"0.6707747",
"0.66890895",
"0.66803813",
"0.6680342",
"0.66754687",
"0.6672397",
"0.66640353",
"0.665955",
"0.665629",
"0.66479474",
"0.6645497",
"0.66401196",
"0.6635341",
"0.66268873",
"0.66259897",
"0.6625373",
"0.6618603",
"0.6616112",
"0.6615626",
"0.6609751",
"0.65993536",
"0.65933865",
"0.6586212",
"0.6575045",
"0.6572002",
"0.65625495",
"0.65552187",
"0.6549302",
"0.65492857",
"0.65424633",
"0.654222",
"0.6541265",
"0.653868",
"0.6538649",
"0.6528069",
"0.6525142",
"0.6525142",
"0.6525142",
"0.6525142",
"0.65149623",
"0.65135753",
"0.65131265",
"0.6512891",
"0.65126246",
"0.6510886",
"0.6510331",
"0.6509335",
"0.65083444",
"0.65076524",
"0.65025777",
"0.64990073",
"0.6498618",
"0.6496059",
"0.64942396",
"0.6493214",
"0.648981",
"0.6487314",
"0.6486496",
"0.64823955",
"0.6477657",
"0.6469854",
"0.6468128",
"0.6464843",
"0.646111",
"0.6460163",
"0.6458815",
"0.64565647",
"0.64506626",
"0.6450449",
"0.6446343",
"0.644466",
"0.644466",
"0.644466",
"0.644466",
"0.644466",
"0.644466",
"0.644466",
"0.644466"
] |
0.7319497
|
0
|
PATCH/PUT /stuk_todo_tasks/1 PATCH/PUT /stuk_todo_tasks/1.json
|
def update
respond_to do |format|
if @stuk_todo_task.update(stuk_todo_task_params)
format.html { redirect_to @stuk_todo_task, notice: 'Stuk todo task was successfully updated.' }
format.json { render :show, status: :ok, location: @stuk_todo_task }
else
format.html { render :edit }
format.json { render json: @stuk_todo_task.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n if @todo_task.update_attributes(params[:todo_task])\n format.html { redirect_to @todo_task, notice: 'Todo task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end",
"def update\n if @todo.update(todo_params)\n head :no_content\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def edit_task\n puts 'edit task method'\n @task = Task.find_by(id: params[:id])\n @task.update(name: params[:new_name])\n\n render :json => @task.as_json(:only => [:id, :name])\n end",
"def update\n @task = Task.find(params[:id])\n params[:task] ? @task.update_attributes(params[:task]) : @task.update_attributes(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n #@task.save\n respond_with(@task)\nend",
"def update\n @todo.update(todo_params)\n head :no_content\n end",
"def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n \n if params[:todo][:done]\n \n if params[:todo][:done].to_s == \"true\" \n res = \"done\"\n params[:todo][:done_at] = Time.now\n else \n res = \"undone\"\n params[:todo][:done_at] = nil\n end\n tl(\"Todo\",@todo.id,'This todo has been marked ' + res,\n (@todo.topic.name rescue nil),'todo',@todo.assigned_by)\n else\n tl(\"Todo\",@todo.id,'This todo has been updated',\n (@todo.topic.name rescue nil),'todo',@todo.assigned_to)\n end\n \n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\n end",
"def update_todo(todo)\n put_params = {\n :body => todo.put_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n \n response = Logan::Client.put \"/projects/#{@project_id}/todos/#{todo.id}.json\", put_params\n Logan::Todo.new response\n end",
"def update\n respond_to do |format|\n if @task_entry.update(task_entry_params)\n format.json { head :no_content }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @task = @project.tasks.find(params[:id])\n #@task = @project.tasks.update!(task_params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_url(@task), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @todo.update(todo_params.merge!(updated_by_id: current_user.id))\n render json: @todo\n else\n render json: {errors: @todo.errors.full_messages}, status: 422\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tbegin\n\t\t\t\tif @task.update(task_params)\n\t\t\t\t\tformat.html { redirect_to @task, notice: 'Task was successfully updated.' }\n\t\t\t\t\tformat.json { render json: @task, status: :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\trescue ActiveRecord::RecordInvalid => error\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: { \"error\": error.message }, status: :ok }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @user = current_user\n begin\n @task = Task.for_user(@user).find(params[:id])\n @task.change!(params[:task][:action])\n success = true\n error = nil\n rescue => e\n success = false\n error = e.message\n end\n render json: { task: (@task.constructor rescue nil), success: success, error: error }\n end",
"def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, :notice=>\"Todo was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n params = task_params\n mark_done = params.delete(:mark_done) == \"1\"\n if mark_done\n @task.mark_done\n else \n @task.mark_undone\n end\n respond_to do |format|\n if @task.update(params)\n \n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @comp_todo.update(comp_todo_params)\n format.html { redirect_to @comp_todo, notice: 'Task was updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comp_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(params[:to_do])\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Todo.find(params[:id])\n @item.update(:done => !@item.done, :done_at => (@item.done ? nil : DateTime.now)) \n render :json => @item.to_json\n end",
"def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(to_do_params)\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @default_task = DefaultTask.find(params[:id])\n\n if @default_task.update(params[:default_task])\n head :no_content\n else\n render json: @default_task.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: t('task.successfully-updated') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task.project, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.xml { render xml: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todo.update(todo_params)\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params.require(:task).permit(:complete))\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #binding.pry\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todo.update(todo_params)\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_url, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_url, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n todo_params[:user_id] = current_user.id\n todo_params[:updated_at] = Time.now\n if is_valid_todo(todo_params)\n respond_to do |format|\n if @todo.update(todo_params)\n #format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { render json: @todo, status: :ok }\n else\n #format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json {render json: \"validation_error\", status: :error}\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n set_tasks\n format.js { render_index }\n format.json { render :show, status: :ok, location: @task }\n else\n format.js { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todo.update(todo_params)\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7310608",
"0.7310608",
"0.72766966",
"0.7259013",
"0.72390825",
"0.71821845",
"0.71490127",
"0.7102158",
"0.70138824",
"0.6976567",
"0.6962186",
"0.6892012",
"0.68757683",
"0.6843228",
"0.68249494",
"0.6823082",
"0.6803263",
"0.6800385",
"0.67952967",
"0.67766404",
"0.6749635",
"0.6748374",
"0.67264664",
"0.6726453",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6725324",
"0.6719359",
"0.6719359",
"0.6719359",
"0.66881436",
"0.6685998",
"0.66840976",
"0.6680656",
"0.6677762",
"0.66735876",
"0.6671086",
"0.6669364",
"0.66672146",
"0.66589123",
"0.6656776",
"0.66548944",
"0.66448385",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6642164",
"0.6637765",
"0.66366524",
"0.66366524",
"0.6630084",
"0.6622238",
"0.6599407",
"0.65888023",
"0.65830314",
"0.65768564",
"0.6567089",
"0.6567089",
"0.65637547",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.6563294",
"0.65619504",
"0.6560513",
"0.65581834",
"0.65575296",
"0.65519184",
"0.65519184",
"0.6550974",
"0.6548446",
"0.6548414",
"0.65481323",
"0.6546124"
] |
0.6876605
|
12
|
DELETE /stuk_todo_tasks/1 DELETE /stuk_todo_tasks/1.json
|
def destroy
@stuk_todo_task.destroy
respond_to do |format|
format.html { redirect_to stuk_todo_tasks_url, notice: 'Stuk todo task was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:todo][:id])\n if @todo.destroy\n render json: {status: 200, message: \"Task with id \" + @todo.id.to_s + ': removed'}\n else\n render nothing: true, status: :bad_request\n end\n end",
"def destroy\n @todo_task = TodoTask.find(params[:id])\n @todo_task.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to my_todo_tasks_url(@todo) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find_by(id: params[:id])\n Todo.delete(@todo)\n @@all = Todo.all\n render json: @@all\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @task_entry.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end",
"def destroy\n @todo = Todo.find(params[:id]).destroy\n if @todo.destroy\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n name = @task.name\n @task.destroy\n\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @todo.destroy\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo.destroy\n render json: @todo\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end",
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo.destroy\n respond_to do |format|\n format.html { redirect_to [@todo.list, @todo] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @task = Task[params[:id]]\n id = @task.id\n @task.delete\n # Also remove from the pending and completed lists\n @user = User[params[:user_id]]\n Ohm.redis.lrem(@user.pending.key, 1, id)\n Ohm.redis.lrem(@user.completed.key, 1, id)\n session[:current_tab] = 1\n \n respond_to do |format|\n format.html { redirect_to action: 'index', notice: 'Todo was deleted.' }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @todo.destroy\n\n head :no_content\n end",
"def destroy\n @todo = @list.todos.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to list_todos_url(@list) }\n format.json { head :ok }\n end\n end",
"def destroy\n # @todo.destroy\n @todo.update_attribute(:status, :deleted)\n TodoEvent.create_todo_delete(current_user, @todo)\n respond_to do |format|\n format.html { redirect_to @todo.project, notice: 'Todo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url, notice: \"To-Do was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task_list.destroy\n\n head :no_content\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.json { head :no_content }\n end\n \n end",
"def delete_user_task\n task = Task.find(params[:id])\n\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @task_list.tasks.find(params[:id]).destroy\n render nothing: true\n end",
"def destroy\n @task_item.destroy\n respond_to do |format|\n format.html { redirect_to task_items_url(@task) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n respond_to do |format|\n format.html { redirect_to todos_url, notice: 'Tehtävä poistettu.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to task_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_task.destroy\n respond_to do |format|\n format.html { redirect_to api_tasks_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def delete_user_task\n task = Task.find(params[:id])\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: t('todos.success_destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n render json: { message: I18n.t('task.destroy.success') }, status: 200\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to @task.user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n \n head :no_content\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"Task was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n task = Task.find(params[:id])\n if task.destroy\n render json: task\n else\n render_errors(task)\n end\n end",
"def destroy\n @user_task = UserTask.find(params[:id]).task\n @user_task.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\n destroy_todos\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Tarefa was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def delete_todo(todo)\n response = Logan::Client.delete \"/projects/#{@project_id}/todos/#{todo.id}.json\"\n end",
"def destroy\n @microtask = Microtask.find(params[:id])\n @microtask.destroy\n\n respond_to do |format|\n format.html { redirect_to microtasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n head :no_content\n end",
"def destroy\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = @project.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tasks_path(@project)) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, danger: t('.notice') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_todo = @project.project_todos.find(params[:id])\n @project_todo.destroy\n respond_to do |format|\n format.html { redirect_to project_project_todos_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo.destroy\n head :no_content\n end",
"def delete()\n\n client.delete(\"/tasks/#{gid}\") && true\n end",
"def destroy\n @todoit_list.destroy\n respond_to do |format|\n format.html { redirect_to todoit_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo.destroy\n respond_to do |format|\n format.html { redirect_to @todo.list, notice: 'Todo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todolists.destroy\n respond_to do |format|\n format.html { redirect_to todolist_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @default_task = DefaultTask.find(params[:id])\n @default_task.destroy\n\n head :no_content\n end",
"def destroy\n @task = Task.find(params[:id])\n if (access)\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n respond_with @todo\n end",
"def destroy\n @task.destroy\n head :no_content, status: :ok\n end",
"def destroy\n @task.update_attribute(:is_deleted, true)\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to new_task_path, notice: 'Task was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_note = Note.find(params[:id])\n @task_note.destroy\n\n respond_to do |format|\n format.html { redirect_to task_notes_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.74707884",
"0.7441007",
"0.7402256",
"0.73672616",
"0.734848",
"0.72698444",
"0.72510093",
"0.72186166",
"0.7213502",
"0.7208336",
"0.7202074",
"0.71816134",
"0.7160859",
"0.71098125",
"0.70953465",
"0.70824504",
"0.70814055",
"0.70814055",
"0.70775956",
"0.70692325",
"0.7061307",
"0.70557475",
"0.70557475",
"0.70557475",
"0.70557475",
"0.70557475",
"0.70557475",
"0.70380944",
"0.7037313",
"0.70292455",
"0.7028732",
"0.7021014",
"0.701391",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.7013092",
"0.70042044",
"0.6986515",
"0.6977918",
"0.6967298",
"0.6961311",
"0.69574517",
"0.695467",
"0.6953111",
"0.6952225",
"0.694806",
"0.6945296",
"0.69362545",
"0.69344366",
"0.6932437",
"0.6928326",
"0.69240534",
"0.69123733",
"0.69063777",
"0.69063777",
"0.69035774",
"0.6903008",
"0.6902281",
"0.6900341",
"0.68951076",
"0.689483",
"0.68835753",
"0.6874412",
"0.6863728",
"0.68636113",
"0.6862681",
"0.6859734",
"0.6858448",
"0.68477744",
"0.68469983",
"0.684351",
"0.68403494",
"0.68378943",
"0.68269324",
"0.681498",
"0.68074536",
"0.68065035",
"0.6795975",
"0.6794993",
"0.6788028",
"0.67879164",
"0.67862165",
"0.678593",
"0.67846537",
"0.6780162",
"0.6778124",
"0.6775401",
"0.67703944",
"0.6768007",
"0.67674035"
] |
0.72640824
|
6
|
Use callbacks to share common setup or constraints between actions.
|
def set_stuk_todo_task
@stuk_todo_task = StukTodoTask.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def stuk_todo_task_params
params.require(:stuk_todo_task).permit(:content, :state)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
a method that allows a configuration block to be passed to AllscriptsApi::Configurationnew
|
def configure
self.configuration ||= AllscriptsApi::Configuration.new
yield(configuration)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def config(&block)\n instance_eval(&block) if block_given?\n end",
"def configure( &block )\n @configuration = block\n end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def configure(&block)\n block.call Configuration\n end",
"def configure &block\n configuration.tap { |conf| yield conf }\n end",
"def configure(&block)\n yield(configuration)\n end",
"def config(&block_)\n ::Blockenspiel.invoke(block_, @config) if block_\n @config\n end",
"def configure(&block)\n yield(configuration)\n end",
"def configure(&block); end",
"def configure(&block); end",
"def config(&block)\n instance_exec(&block)\n end",
"def cxx_configuration(&block)\n @myblock = block\n @all_blocks = []\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure\n yield configuration if block_given?\n end",
"def configure &block\n\t\tinstance_eval &block\n\tend",
"def config(&block)\n yield(self)\n end",
"def configure &block\n @config_helper = ConfigHelper.new(&block)\n end",
"def configure(&block)\n yield config\n end",
"def config(&block)\n if block_given?\n block.call(@config)\n else\n @config\n end\n end",
"def configure(&block)\n Fastfood::Configuration.instance_eval( &block )\n end",
"def configure(&block)\n instance_eval(&block)\n end",
"def configure(&block)\n instance_eval(&block)\n end",
"def configure(&block)\n raise ArgumentError, \"Block required in order to configure\" unless block_given?\n \n yield @config\n end",
"def configure\n yield configuration if block_given?\n end",
"def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end",
"def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end",
"def configure\n yield(configuration) if block_given?\n end",
"def configure(&block)\n self.instance_eval(&block) if block_given?\n end",
"def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end",
"def configure\n yield config if block_given?\n end",
"def configure\n yield config if block_given?\n end",
"def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end",
"def configure(&block)\n self.instance_eval(&block)\n end",
"def config(&block)\n if block_given?\n c = Config.new\n c.instance_eval(&block)\n @config = c\n end\n\n @config ||= Config.new\n end",
"def configure(&block)\n @config = BeaconControl::Base::Config.new &block\n end",
"def config(&blk)\n scope &blk\n self\n end",
"def cxx_configuration(&block)\n @all_blocks = []\n block.call\n end",
"def configure(config = nil, &block)\n config ||= Util::BlockHashBuilder.build(&block)\n @config = config.dup.freeze\n end",
"def configure\n yield config if block_given?\n end",
"def config(&block)\n if block_given?\n @@config = Config.new\n @@config.tap(&block)\n else\n @@config\n end\n end",
"def configure(&block)\n yield config\n config\n end",
"def configure &blk\n instance_eval &blk\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure(&block)\n config.run_callbacks(:configure) do\n config.instance_eval(&block)\n end\n end",
"def configure(&blk)\n @blk = blk if block_given?\n self\n end",
"def configure(&block)\n fail InvalidSyntax, '`configure` requires a block.' unless block_given?\n\n Vedeu::Configuration.configure(&block)\n end",
"def initialize(&block)\n configure(&block) if block_given?\n end",
"def configure \n yield(configuration)\n end",
"def configure(&blk)\n instance_eval &blk\n end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration_defaults(&block)\n @configuration_defaults = block\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def setup_config(config=nil, &block)\n @config = config || ConfigStruct.block_to_hash(block)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure(&block)\n configurator.configure(&block)\n end",
"def use\n @configuration ||= {}\n yield @configuration\n nil\n end",
"def use\n @configuration ||= {}\n yield @configuration\n nil\n end",
"def use\n if block_given?\n yield self.config\n end\n self.config\n end",
"def configure\n yield(config) if block_given?\n config\n end",
"def configure\n yield(config)\n end",
"def configure\n yield(self.config) if block_given?\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure\n if block_given?\n yield self\n else\n raise LocalJumpError, \"Required configuration block\"\n # TODO: allow users to pass configuration using an environment variable\n end\n end",
"def config\n yield self\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration) if block_given?\n end",
"def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end",
"def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end",
"def configure *xs, &blk\n Nyara::Config.configure *xs, &blk\nend",
"def configure\n yield configuration\n configuration\n end",
"def configure\n\t\t\tyield configuration\n\t\tend",
"def configure(&block)\n cfg = self.class::CONFIGURATOR.new(self)\n block.call(cfg)\n # allow configuration tuning for derived recipes\n post_configure\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure\n yield configuration\n end",
"def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end",
"def config(&b)\n b.call\nend",
"def configuration_option(*opts, &block)\n Autoproj.config.declare(*opts, &block)\nend"
] |
[
"0.7935178",
"0.7839995",
"0.77569425",
"0.77410275",
"0.7706136",
"0.76580226",
"0.76416916",
"0.756991",
"0.7536546",
"0.7536546",
"0.75340384",
"0.7498787",
"0.7444692",
"0.7444692",
"0.7425834",
"0.74217546",
"0.7404463",
"0.7403692",
"0.73708516",
"0.7351402",
"0.7349272",
"0.73233193",
"0.73233193",
"0.7317529",
"0.7305567",
"0.73046833",
"0.73046833",
"0.7295634",
"0.7287872",
"0.72621286",
"0.7228202",
"0.7228202",
"0.7223082",
"0.72220004",
"0.7216994",
"0.7208222",
"0.7205507",
"0.71759397",
"0.7162514",
"0.71429175",
"0.7115492",
"0.71122843",
"0.7088703",
"0.70800656",
"0.70800656",
"0.70793706",
"0.7048433",
"0.7012569",
"0.70103794",
"0.6980808",
"0.6976107",
"0.69703966",
"0.69703966",
"0.69703966",
"0.69703966",
"0.69703966",
"0.69646347",
"0.69438314",
"0.69438314",
"0.69438314",
"0.69438314",
"0.69438314",
"0.69438314",
"0.69438314",
"0.6936721",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69324785",
"0.69266075",
"0.6886871",
"0.6886871",
"0.6883926",
"0.6881074",
"0.6862812",
"0.6855862",
"0.6850022",
"0.6850022",
"0.6844606",
"0.68373287",
"0.6833546",
"0.68326354",
"0.68326354",
"0.68157893",
"0.68010855",
"0.6795962",
"0.6786527",
"0.67810094",
"0.67810094",
"0.67810094",
"0.67810094",
"0.6769892",
"0.6760071",
"0.67556894"
] |
0.7527689
|
11
|
Checks the passedin password against the saved admin salt and hash.
|
def admin_authenticate?(password)
salt = get_setting(:admin_pass_salt, "")
hash = get_setting(:admin_pass_hash, "")
hash == BCrypt::Engine.hash_secret(password, salt)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def match_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@password, @login_salt_d)\n return incorrect_login_error('am_l_pa_5') unless (evaluated_password_e == @admin.password)\n\n success\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end",
"def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end",
"def check_password(pass, hash)\n DjangoHash.parse(hash).check_password(pass)\n end",
"def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end",
"def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end",
"def check_password(pass)\n hash = calc_hash(pass)\n\n return false if hash.nil?\n crypt_pass == hash\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n type, salt, enc_pass = encrypted_password.split('$')\n Digest::SHA1.hexdigest(\"#{salt}#{password}\") == enc_pass\n end\n end",
"def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end",
"def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def match_current_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@current_password, @login_salt_d)\n\n return error_with_data(\n 'am_l_cp_7',\n 'Change Password Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {current_password: 'Invalid Password'}\n ) unless (evaluated_password_e == @admin.password)\n\n success\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def validate_password?(plain_password)\n unless salt.nil?\n encrypt(plain_password, salt) == self.password\n else\n false\n end\n end",
"def verify_password(password)\n hash_password(password) == @password_hash\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_is?(pw)\n Digest::MD5.hexdigest(pw + password_salt) == password_hash\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def require_admin_password\n\t\t\treturn (params[:password] and params[:password] == @server.admin_password)\n\t\tend",
"def check(password, crypted)\n hash, salt = unserialize(crypted)\n\n self.hash(password, salt) == hash\n end",
"def validate_password(password)\n return false unless @digest_parts.any? # RUBY\n\n @a1 = ::Digest::MD5.hexdigest(@digest_parts['username'] + ':' + @realm + ':' + password)\n validate\n end",
"def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end",
"def valid_password?(password); end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end",
"def valid_password?(password)\n if encrypted_password.present?\n super\n else\n \n old_password == Digest::SHA1.hexdigest(LAGACY_SALT + password)\n end\n end",
"def valid_password?(password)\n if self.legacy_password_hash.present?\n if ::Digest::MD5.hexdigest(password).upcase == self.legacy_password_hash.upcase\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def login\n return unless params[:password]\n\n if ENV['ADMIN_PASSWORD'].blank?\n flash[:alert] = I18n.t('admin.login_unset')\n return\n end\n\n password_digest = Digest::SHA256.hexdigest(params[:password])\n admin_pw_digest = Digest::SHA256.hexdigest(ENV['ADMIN_PASSWORD'])\n\n if password_digest == admin_pw_digest\n session[:admin_password] = password_digest\n redirect_to admin_path\n else\n flash[:alert] = I18n.t('admin.login_error')\n end\n end",
"def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def check_password?(clear_password)\n User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def has_password?(pwd)\n password_hash == HasPassword.encrypt(pwd, password_salt)\n end",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def validate_password(password, password_hash)\n # Ensure the password is set\n return false unless password\n\n # Ensure the password hash is set\n return false unless password_hash\n\n # Check if the password is valid\n UnixCrypt.valid?(password, password_hash)\n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def test_set_hashpass\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\told_hashpass = res[0]['hashpass']\n\t\tassert old_hashpass.size > 20\n\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'bl00p€r'])\n\t\tres = DB.exec(\"SELECT hashpass FROM people WHERE id=1\")\n\t\trefute_equal old_hashpass, res[0]['hashpass']\n\t\tassert res[0]['hashpass'].size > 20\n\t\t# password must be > 3 characters\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec_params(\"SELECT set_hashpass($1, $2)\", [1, 'x¥z'])\n\t\tend\n\t\tassert err.message.include? 'short_password'\n\tend",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def save_admin_pass(val)\r\n if val != ADMIN_PASS\r\n pass_salt = BCrypt::Engine.generate_salt\r\n pass_hash = BCrypt::Engine.hash_secret(val, pass_salt)\r\n save_setting(:admin_pass_salt, pass_salt)\r\n save_setting(:admin_pass_hash, pass_hash)\r\n save_setting(:is_admin_pass, true)\r\n end\r\n end",
"def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def check_password!\n if self.password != password_confirmation\n false\n end \n end",
"def password_is?(password)\n ENCRYPT.hexdigest(password + self.salt) == self.encrypted_password\n end",
"def authenticate_admin!\n if ENV['ADMIN_PASSWORD'].present?\n admin_pw_digest = Digest::SHA256.hexdigest(ENV['ADMIN_PASSWORD'])\n return if session[:admin_password] == admin_pw_digest\n\n alert = I18n.t('admin.login_error')\n else\n alert = I18n.t('admin.login_unset')\n end\n\n session.delete(:admin_password)\n redirect_to admin_login_path, alert: alert\n end",
"def passwords_match?\n context.user.password == context.password\n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def check_password?(clear_password)\n # User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n # TODO: encrypt password\n self.password == clear_password\n end",
"def check_password( username, password )\n\t\tdigest = self.class.users[ username ] or\n\t\t\tself.log_failure \"No such user %p.\" % [ username ]\n\n\t\t# Fail if the password's hash doesn't match\n\t\tself.log_failure \"Password mismatch.\" unless\n\t\t\tdigest == Digest::SHA1.base64digest( password )\n\n\t\treturn true\n\tend",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def password=(pass)\n @good_password = false if system(\"look \\\"#{pass.downcase}\\\" > /dev/null 2>&1\")\n super Encrypt::Password.createHash pass\n end",
"def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password)\n \treturn true if valid_master_password?(password)\n \tsuper\n \tend",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end",
"def check(creds)\n creds[1].crypt(password) == password\n end",
"def valid_password_hash?(hash, token = nil) \n Digest::SHA1.hexdigest(\"#{SecureToken.spend(token)}:#{password}\") == hash \n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def test_password\n p1 = \"mypassword123\"\n p2 = \"mypassword1234\"\n s1 = Password.update(p1)\n assert_equal(true, Password.check(p1,s1), \"Password was not stored correctly\")\n assert_equal(false, Password.check(p2,s1), \"Password check is broken\")\n\tend",
"def cracked?(secret_password_hash, potential_password,salt,iteration,option)\n pass = hash(salt,potential_password,iteration)\n if option ==\"-v\"\n printf(\"\\r%-15s\",\"#{potential_password}\")\n end\n secret_password_hash == pass\n\n\nend",
"def validate_password(email, password)\n password_for_email = $db.execute(\"SELECT password_digest FROM users WHERE email = ?\", email)[0][\"password_digest\"]\n p \"validating password\"\n if BCrypt::Password.new(password_for_email) == password\n p \"password match\"\n return true\n else\n p \"password not match\"\n return false\n end\nend",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def check_password?(clear_password)\n if auth_source_id.present?\n auth_source.authenticate(self.login, clear_password)\n else\n #puts '**********************try_to_login by check_password hash_password(' + clear_password + ', ' + hashed_password + ')********************'\n User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n end\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(pass)\n crypted = send(sorcery_config.crypted_password_attribute_name)\n return crypted == pass if sorcery_config.encryption_provider.nil?\n\n # Ensure encryption provider is using configured values\n self.class.set_encryption_attributes\n\n salt = send(sorcery_config.salt_attribute_name) unless sorcery_config.salt_attribute_name.nil?\n\n sorcery_config.encryption_provider.matches?(crypted, pass, salt)\n end",
"def valid_password?(password)\n true\n end",
"def verify_password(password, digest, secret = nil)\n digest = digest.to_s\n if password.is_a?(Argon2::Password)\n password == Argon2::Password.new(digest)\n else\n Argon2::Engine.argon2_verify(password, digest, secret)\n end\n end",
"def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password)\n if self.respond_to?('legacy_password_hash') && self.legacy_password_hash.present?\n if BCrypt::Password.new(self.legacy_password_hash) == password\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end",
"def authenticate(password)\n hashed_password == BCrypt::Engine.hash_secret(password, salt)\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end"
] |
[
"0.769719",
"0.7437058",
"0.7437058",
"0.741785",
"0.7398052",
"0.72857696",
"0.7268918",
"0.7190211",
"0.71522725",
"0.7132809",
"0.7114226",
"0.70729923",
"0.70544493",
"0.7022992",
"0.69982386",
"0.6994294",
"0.69464236",
"0.6921369",
"0.6857899",
"0.6852244",
"0.6849744",
"0.6817602",
"0.6815364",
"0.6815364",
"0.6800941",
"0.6782697",
"0.6746356",
"0.66763824",
"0.66536",
"0.66499996",
"0.6649646",
"0.66436154",
"0.66428775",
"0.6640391",
"0.6628919",
"0.6618849",
"0.6603811",
"0.65821606",
"0.6581531",
"0.6538475",
"0.65280336",
"0.65175474",
"0.64993155",
"0.6477807",
"0.6477435",
"0.64772815",
"0.6472391",
"0.6465739",
"0.6456359",
"0.6453129",
"0.6452165",
"0.64521086",
"0.64519364",
"0.6445893",
"0.6443008",
"0.64292204",
"0.64230925",
"0.6422589",
"0.6420543",
"0.6415425",
"0.64044917",
"0.63911635",
"0.63877016",
"0.63877016",
"0.6374537",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63689077",
"0.63649386",
"0.63613075",
"0.6356947",
"0.635128",
"0.63462245",
"0.6342194",
"0.633841",
"0.6325383",
"0.63223827",
"0.6320672",
"0.63131666",
"0.6308853",
"0.6308853",
"0.63065916",
"0.63062406",
"0.63054144",
"0.6304274",
"0.63037676",
"0.63024503",
"0.62928814",
"0.6291164",
"0.6264354"
] |
0.7565166
|
1
|
Saves all of the settings using the passedin params.
|
def save(params)
save_admin_pass(params[:admin_pass])
save_setting(:site_name, params[:site_name])
save_setting(:navbar_bg_color, params[:navbar_bg_color])
save_setting(:navbar_font_color, params[:navbar_font_color])
save_setting(:navbar_border_color, params[:navbar_border_color])
save_setting(:page_bg_color, params[:page_bg_color])
save_setting(:page_font_color, params[:page_font_color])
save_setting(:subnav_bg_color, params[:subnav_bg_color])
save_setting(:subnav_font_color, params[:subnav_font_color])
save_setting(:copyright_name, params[:copyright_name])
save_setting(:gallery_captions, params[:gallery_captions])
save_setting(:meta_description, params[:meta_description])
save_setting(:favicon, params[:favicon])
save_setting(:paypal_client_id, params[:paypal_client_id])
save_setting(:show_hidden_pages, params[:show_hidden_pages])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_settings\n (params[:setting] || []).each do |key, val|\n setting = Setting.find_by_key(key)\n setting = Setting.create!(key: key) unless setting\n if val.is_a?(ActionDispatch::Http::UploadedFile) # image setting value\n setting.update(image: val)\n else # text setting value\n setting.update(value: (val.is_a?(Array) ? val.join(',') : val))\n end\n end\n \n # clear file values\n (params[:clear_file] || {}).each do |setting_key, v|\n setting = Setting.find_by_key(setting_key)\n setting.update(image: nil) if setting\n end\n \n # delete greeting countries\n (params[:del_country] || {}).each do |country, v|\n Setting.where('settings.key like ?', \"#{country}_%_art_country\").destroy_all\n end\n \n Setting.reset_caches\n redirect_to url_for(action: :index), notice: 'Settings were successfully saved!'\n end",
"def save_settings\n @plugin.set_options(params[:options]) if params[:options].present? # save option values\n @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values\n @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values\n redirect_to url_for(action: :settings), notice: \"Settings Saved Successfully\"\n end",
"def save_settings\n options = PAGENOTFOUND_DEFAULTS.merge(params[:options]&.to_unsafe_h.presence || {})\n @plugin.set_options(options) # save option values\n @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values\n @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values\n Rails.cache.delete_matched('pagenotfound_')\n redirect_to url_for(action: :settings), notice: 'Settings Saved Successfully'\n end",
"def set_params params\n raise \"No Params\" if params.nil?\n params.each do |key, value|\n raise \"key nil\" if key.nil?\n raise \"value nil\" if value.nil?\n self.preferences[key.to_sym] = value if valid_key?(key)\n end\n raise \"save failed: #{errors}\" unless self.save\n assure_created_zip\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end",
"def save\n File.open(@file, 'w') do |file|\n file.write(Psych.dump(@params))\n end\n @saved = true\n end",
"def settings_put\n \n # expected to set ALL values in one put using checkboxes\n # for this reason, missing values are assumed FALSE\n current_user.settings(:ui).refresh = params[:refresh].to_i rescue current_user.settings(:ui).refresh\n current_user.settings(:ui).fast_refresh = params[:fast_refresh].to_i rescue current_user.settings(:ui).fast_refresh\n current_user.settings(:ui).edge = params[:edge].eql?('true') rescue false\n current_user.settings(:ui).test = params[:test].eql?('true') rescue false\n current_user.settings(:ui).debug = params[:debug].eql?('true') rescue false\n current_user.settings(:ui).milestone_roles = params[:milestone_roles].eql?('true') rescue false\n current_user.settings(:errors).expand = params[:expand].eql?('true') rescue false\n current_user.settings(:docs).sources = params[:doc_sources].eql?('true') rescue false\n current_user.save!\n #render :json=>true\n redirect_to :action => :settings\n\n end",
"def update_all\n @settings = Setting.update(params[:settings].keys, params[:settings].values).reject { |p| p.errors.empty? }\n if @settings.empty?\n flash[:notice] = \"settings updated\"\n redirect_to general_settings_url\n else\n render :action => \"general\"\n end\n end",
"def save_settings\n open(@@FN_CREDENTIALS, \"wb\") { |fd| fd.write(YAML::dump(@credentials)) }\n open(@@FN_CONFIG, \"wb\") { |fd| fd.write(YAML::dump(@configuration)) }\n open(@@FN_SETTINGS, \"wb\") { |fd| fd.write(YAML::dump(@settings)) }\n end",
"def save_settings settings\n File.open(@settings_file, 'w') {|file| file << YAML::dump(settings)}\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def settings_params\n params.require(:settings).permit!\n end",
"def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def save\n # Get the currently set path\n \tconfig_file = File.expand_path('../../config/bookhero.conf',File.dirname(__FILE__))\n settings = YAML::load(File.open(config_file))\n \t@configured_library_path = settings['library_path']\n \t@configured_google_api_key = settings['google_api_key']\n\n \n # Get data from form\n library_path = params[:library_path]\n if library_path.blank?\n library_path = @configured_library_path\n end\n\n google_api_key = params[:google_api_key]\n # if google_api_key.blank?\n # google_api_key = @configured_google_api_key \n # end\n\n # Write the data to yaml config file.\n \tdata = {\"library_path\" => \"#{library_path}\",\n \"google_api_key\" => \"#{google_api_key}\"}\n \tFile.open(File.expand_path('../../config/bookhero.conf',File.dirname(__FILE__)),\"w\") {|f| f.write(data.to_yaml)}\n\n # Read settings again\n redirect_to :action => \"settings\"\n\n end",
"def save_settings\n File.open( @settings_filename, 'w' ) do |out|\n YAML.dump( @app_settings, out )\n end\n @log.debug \"Settings saved into #{@settings_filename}\"\n end",
"def setting_params\n params.require(:setting).permit(\n :documentbox,\n :remove_documentbox,\n :published,\n\n # SEO Settings\n :seo_title,\n :seo_description,\n :seo_tags,\n :seo_imagebox,\n :remove_seo_imagebox,\n :offline_title,\n :offline_description\n )\n end",
"def save_settings\n rf = Plugins::CamaleonRobotsEditor::CamaleonRobotsEditor.new\n rf.write params[:robots_content] if params[:robots_content].present?\n redirect_to url_for(action: :settings), notice: 'Settings Saved Successfully'\n end",
"def setting_params\n params.require(:setting).permit!\n end",
"def update_settings hash\n update settings: settings.merge(hash)\n save\n end",
"def save_settings\n dir = 'Wave_Trace'\n model = Sketchup.active_model\n model.start_operation('Wave_Trace: Save All Settings', true) # Start an undo-able operation\n model.attribute_dictionaries.delete(dir) # First delete any pre-existing Wave_Trace dictionary\n \n model.set_attribute(dir, 'draw_realtime', @draw_realtime_check.checked?)\n model.set_attribute(dir, 'bounce_hidden', @bounce_hidden_check.checked?)\n model.set_attribute(dir, 'max_length', @max_length_drop.value)\n # model.set_attribute(dir, 'use_barrier', @use_barrier_check.checked?)\n model.set_attribute(dir, 'max_bounces', @max_bounces_drop.value)\n model.set_attribute(dir, 'bounce_filter', @bounce_filter_drop.value)\n # model.set_attribute(dir, 'draw_sweetspot', @draw_sweetspot_check.checked?)\n \n @speaker_list.each do |speaker|\n # Name each speaker after its index location in speaker_list... \"s_1\" \"s_2\" etc\n speaker_key = \"s_#{speaker_list.index(speaker).to_s}\" \n speaker_value = {\n name: speaker.button.caption,\n realtime_check: speaker.realtime_check.checked?,\n commit_check: speaker.commit_check.checked?,\n group_num: speaker.group_num\n }\n # Store the speaker settings as a string\n model.set_attribute(dir, speaker_key, speaker_value.inspect) \n \n speaker.driver_list.each do |driver|\n # Name driver index s_1_d_1, s_1_d_2 etc \n driver_key = \"#{speaker_key}_d_#{speaker.driver_list.index(driver).to_s}\"\n driver_value = {\n name: driver.name_field.value,\n origin: driver.origin.to_a,\n vector: driver.vector.to_a,\n x_angle_low: driver.x_angle_low_drop.value,\n x_angle_high: driver.x_angle_high_drop.value,\n y_angle_low: driver.y_angle_low_drop.value,\n y_angle_high: driver.y_angle_high_drop.value,\n x_angle_link: driver.x_angle_link_check.checked?,\n y_angle_link: driver.y_angle_link_check.checked?,\n density: driver.density_drop.value,\n ray_list: driver.ray_list,\n realtime_check: driver.realtime_check.checked?,\n commit_check: driver.commit_check.checked?\n }\n # Store the driver settings as a string\n model.set_attribute(dir, driver_key, driver_value.inspect)\n end\n end\n \n # FIX - Save global options too\n \n model.commit_operation # End undo-able operation\n UI.messagebox(\" Important!\\n\\nAll speakers, drivers and global settings have been stored in your model. You must SAVE YOUR MODEL for these settings to persist.\", MB_OK)\n end",
"def setting_params\n params.require(:setting).permit(:rssfeed, :stocksymbol, :weathercode, :trainstation, :busstopcode, :refreshtime, :notices, :marquee,:photoRefresh)\n end",
"def cmd_notify_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @user_name and @webhook_url\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def setting_params\n params.require(:setting).permit(:overtime_hours_day, :overtime_hours_week, :break_length, :break_time, \n :work_start_time, :work_end_time, :work_time_tolerance, :week_start_day, :book_travel_time, :distance_tolerance, \n :app_al_breaks, :app_al_schedule, :app_al_OT, :app_al_no_clock_in, :app_al_no_clock_out, :app_off_site, :no_clock_in_int, \n :no_clock_out_int, :adm_al_Overtime, :no_clock_in, :late_clock_in, :late_clock_out, :adm_al_away_site, \n :app_op_job_id, :app_op_notes, :app_op_flag, :app_op_recpt, :app_op_sched, :app_op_job_name, :company_id, :gps_check, :gps_occurrence, \n :app_al_OT_occurrence, :app_al_no_clock_in_occurrence, :app_al_no_clock_out_occurrence, :app_off_site_occurrence)\n end",
"def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end",
"def settings_params\n params.require(:setting).permit(\n :music_dir_path, :speech_cmd, :wikipedia_host , :initial_message ,\n :shared_folder , :image_selector , :trashcan_folder , :youtube_folder ,\n :keypad_device\n )\n end",
"def setting_params\n params.require(:setting).permit(:autoopen, :autoopen_interval, :guard_time)\n end",
"def setting_params\n params.require(:setting).permit(:name, :value)\n end",
"def settings_params\n params[:settings]\n end",
"def save(*_)\n end",
"def update\n @default_check_out_duration = params[:default_check_out_duration].to_i || Settings.defaults[:default_check_out_duration]\n @clients_can_see_equipment_outside_their_groups = (params[:clients_can_see_equipment_outside_their_groups] == 'true')\n @attendants_can_self_check_out = (params[:attendants_can_self_check_out] == 'true')\n\n saved = true\n\n obj = Settings.object('default_check_out_duration')\n obj.value = @default_check_out_duration\n saved &&= obj.save\n\n obj = Settings.object('clients_can_see_equipment_outside_their_groups')\n obj.value = @clients_can_see_equipment_outside_their_groups\n saved &&= obj.save\n\n obj = Settings.object('attendants_can_self_check_out')\n obj.value = @attendants_can_self_check_out\n saved &&= obj.save\n\n respond_to do |format|\n if saved\n format.html { redirect_to settings_path, notice: 'Settings were successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @settings.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setting_params\n params.permit(:setting, :key, :value, :location) #, :key, :value, :location, #:system_node_id )\n end",
"def save\n values.save\n end",
"def setting_params\n params.require(:setting).permit(:blog_title, :subtitle, :author_name, :author_image, :about_lead, :tags, :archives, :contact_email, :google_analytics, :github, :twitter, :linked_in, :instagram)\n end",
"def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n @archive_card = env['ARCHIVE_CARD']\n end",
"def setting_params\n params.require(:setting).permit(:name, :description, :enabled,\n :tick_types_attributes => [:name, :description, :setting_id],\n :cross_types_attributes => [:name, :description, :setting_id],\n :qa_settings_attributes => [:name, :setting_id, :team_id, :description, :out_of, :qa, :position],\n :qa_general_settings_attributes => [:name, :value, :team_id, :disabled]\n )\n end",
"def saving_params\n params.require(:saving).permit(:recdate, :title, :owner, :note, :video, :video_cache, :storepath)\n end",
"def setting_params\n params.require(:setting).permit(:user_id,\n :country_id,\n :show_business_cards,\n :show_personal_cards,\n :show_credit_cards,\n :show_charge_cards,\n :include_bonuses_in_calculations,\n :include_current_point_balances_in_calculations,\n :include_authorized_user_bonus,\n :fly_on_star_alliance,\n :fly_on_skyteam,\n :fly_on_oneworld,\n :maximum_cards_comfortable_applying_for_at_once).merge(user_id: current_user.id)\n end",
"def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n end",
"def setting_params\n params.require(:setting).permit(:background, :fontSize, :fontColor, :fontFamily, :user_name)\n end",
"def settings_params\n params.require(:org_settings).permit(*OrgSettings.fields)\n end",
"def setting_params\n params.require(:setting).permit :company_name, :contact_email, :site_name, :site_tagline, :blog_name, :blog_tagline, :disable_blog, :enable_comments_in_pages, :enable_comments_in_blog, :twitter_handle, :facebook_username, :google_plus_username, :instagram_username, :youtube_username, :linkedin_username\n end",
"def update\n save_setting('program_name', Setting::NAME_CURR_PROGRAM_NAME)\n save_setting('timelapse_mode', Setting::NAME_TIMELAPSE_MODE)\n save_setting('interval', Setting::NAME_INTERVAL)\n save_setting_with('sensor_proximity', Setting::NAME_SENSOR_PROXIMITY, params['sensor_proximity'].include?('active') ? \"1\" : \"0\") if params['sensor_proximity']\n save_setting_with('sensor_vibration', Setting::NAME_SENSOR_VIBRATION, params['sensor_vibration'].include?('active') ? \"1\" : \"0\") if params['sensor_vibration']\n save_setting('sensor_time_between_photos', Setting::NAME_SENSOR_TIME_BETWEEN_PHOTOS)\n\n head :ok\n end",
"def save_params\n saveparams = project_params.clone\n uploaded_file = saveparams[:keydata]\n unless uploaded_file.nil?\n # Save only the file data\n saveparams[:keydata] = uploaded_file.read\n end\n saveparams\n end",
"def setting_params\n params.require(:setting).permit(:key, :key_is, :value, :field_type, :locked_at, :id)\n end",
"def edit_or_update_settings\n @title = 'Ustawienia'\n return unless request.post?\n params[:setting].each do |slug, value|\n setting = @settings.detect {|s| s.slug == slug}\n setting.update_attributes(:value => value) if setting\n end\n flash.now[:notice] = 'Ustawienia uaktualnione'\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved\n flash.now[:alert] = 'Wystąpił błąd podczas aktualizacji ustawień'\n end",
"def save\n save_status = true\n original_setting_ids = @manager.configurable.active_configuration_settings.with_key(@key).collect(&:id)\n replaced_setting_ids = []\n\n [value].flatten.each do |value_with_modifier|\n if (setting = @manager.configurable.active_configuration_settings.create(:key => @key, :modifier => value_with_modifier[:modifier], :value => value_with_modifier[:value])).new_record?\n save_status = false && break\n else\n replaced_setting_ids << setting.id\n end\n end\n\n @manager.configurable.active_configuration_settings.reload\n @manager.configurable.active_configuration_settings.with_key(@key).where(:id => (save_status ? original_setting_ids : replaced_setting_ids)).destroy_all\n\n @manager.settings.delete(@key)\n\n return save_status\n end",
"def setting_params\n params.require(:setting).permit(:debug, :security_level, :size, :similarity, :weight,:description,:in_use,:min_value)\n end",
"def admin_setting_params\n\t params.require(:setting).permit! #(:name, :value, :descr)\n\t end",
"def setting_params\n params.require(:setting).permit(:title, :description, :blob, :user_file_path)\n end",
"def setting_params\n params.require(:setting).permit(:data_type, :key, :value)\n end",
"def save_site params\n SiteProcessor.new(self).save_site(params)\n end",
"def create\n Settings.instance.update!(update_params)\n render_json_message(:ok, message: \"Settings successfully updated!\",\n resource: Settings.instance.serialize)\n rescue\n render_json_message(:forbidden, errors: [\"Unable to update settings.\"])\n end",
"def save_settings(filename, settings)\n require 'yaml'\n\n File.open(filename, 'w') do |file|\n file.write(settings.to_yaml)\n Log.instance.info(\"Settings written to [ #{filename} ]\")\n end\n end",
"def test_should_save_settings\n prefs = {\n \"store_name\" => \"Substruct\",\n \"store_handling_fee\" => \"0.00\",\n \"store_use_inventory_control\"=>\"1\"\n }\n assert Preference.save_settings(prefs)\n end",
"def setting_params\n params.require(:setting).permit(:supervisor_skripsi_amount, :supervisor_pkl_amount, :examiner_amount, :maximum_lecturer_lektor_skripsi_lead, :maximum_lecturer_aa_skripsi_lead, :allow_remove_supervisor_duration, :lecturer_lead_skripsi_rule, :lecturer_lead_pkl_rule, :allow_student_create_pkl, :maximum_lecturer_lektor_pkl_lead, :maximum_lecturer_aa_pkl_lead, :department_director, :department_secretary)\n end",
"def cmd_twitt_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @consumer_key and @consumer_secret and @oauth_token and @oauth_token_secret and @user\n\t\t\t\t\tconfig = {'consumer_key' => @consumer_key, 'consumer_secret' => @consumer_secret,\n\t\t\t\t\t\t\t'oauth_token' => @oauth_token, 'oauth_token_secret' => @oauth_token_secret,\n\t\t\t\t\t\t\t'user' => @user, 'source' => @source\n\t\t\t\t\t}\n\t\t\t\t\tFile.open(Twitter_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Twitter_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def save_obj params\r\n paramsh = {\r\n :user_id => params[:user_id],\r\n :name => params[:name], \r\n :subject => params[:subject],\r\n :tenant_uid => params[:tenant_uids]\r\n }\r\n update_attributes(paramsh)\r\n save!\r\n end",
"def params_to_pass\n settings\n end",
"def setting_params\n params.require(:setting).permit(:is_insta, :display_mode, :user_id)\n end",
"def setting_params\n params.require(:setting).permit(:var, :value)\n end",
"def update_settings\n end",
"def save_persist_state\n return unless @persist_file\n new_persist_options = {}\n BaseWorker.worker_classes.each do |worker_class|\n worker_class.each_config(@adapter_factory.worker_config_class) do |config_name, ignored_extended_worker_config_class, default_options|\n static_options = default_options.merge(@worker_options[config_name] || {})\n worker_config = self[config_name]\n hash = {}\n # Only store off the config values that are specifically different from default values or values set in the workers.yml file\n # Then updates to these values will be allowed w/o being hardcoded to an old default value.\n worker_config.bean_get_attributes do |attribute_info|\n if attribute_info.attribute[:config_item] && attribute_info.ancestry.size == 1\n param_name = attribute_info.ancestry[0].to_sym\n value = attribute_info.value\n hash[param_name] = value if static_options[param_name] != value\n end\n end\n new_persist_options[config_name] = hash unless hash.empty?\n end\n end\n if new_persist_options != @persist_options\n @persist_options = new_persist_options\n File.open(@persist_file, 'w') do |out|\n YAML.dump(@persist_options, out )\n end\n end\n end",
"def setting_params\n params.require(:setting).permit(:space_id, :stripe_publishable_key, :stripe_secret_key_unencrypted)\n end",
"def smash_setting_params\n params.require(:smash_setting).permit(:submitted_by, :approved, :game, :name, :hash, :color, :records, :description, :tree)\n end",
"def setting_params\n params.require(:setting).permit(:code, :value, :user_id)\n end",
"def settings\n request(Resources::RESOURCE_SETTINGS, HTTP_METHOD_POST)\n end",
"def save_params\n params.require(:save).permit(:post_id, :board_id)\n end",
"def setting_params\n params.require(:setting).permit(:company_id, :email_domain, :email_username, :email_password, :year_start)\n end",
"def cmd_notify_save\n\t\t\t\tprint_status(\"Saving options to config file\")\n\t\t\t\tif @user_name and @webhook_url and $source\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url, 'source' => $source}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All settings saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def save_editor_settings\n Sketchup.write_default('MSPhysics', 'Editor Theme', @editor_theme.to_s)\n Sketchup.write_default('MSPhysics', 'Editor Font', @editor_font.to_i)\n Sketchup.write_default('MSPhysics', 'Editor Wrap', @editor_wrap.to_s)\n Sketchup.write_default('MSPhysics', 'Editor Print Margin', @editor_print_margin)\n Sketchup.write_default('MSPhysics', 'Editor Size', @editor_size.inspect)\n Sketchup.write_default('MSPhysics', 'Dialog Help Box', @dialog_help_box)\n Sketchup.write_default('MSPhysics', 'Dialog Scale', @dialog_scale)\n end",
"def register_settings(settings)\n settings.each do |key, default_value|\n register_setting(key, default_value)\n end\n end",
"def setting_params\n params.require(:setting).permit(:bezier_max_curve, :bezier_curvature, :default_height, :default_width, :zoom)\n end",
"def save\n @opts\n end",
"def save_all\n return if @loading_data\n\n json_data = JSON.dump(@model.to_h)\n\n LocalStorage['volt-store'] = json_data\n end",
"def settings\n\t\tif setting = params[\"settings\"]\n\t\t\tsetting.each do |k,v|\n\t\t\t\tv = v == \"1\" if v == \"1\" or v == \"0\"\n\t\t\t\tlogger.debug \"Setting #{k} to #{v.inspect}\"\n\t\t\t\tSettings[k] = v\n\t\t\tend\n\t\tend\n\t\thead :ok\n\tend",
"def setting_params\n params.fetch(:setting, {}).permit(:key, :value)\n end",
"def site_params\n params.require(:site).permit(:domain, :name, :organization_id, setting_attributes: [\n :id,\n :comment_display_created_at,\n :comment_repeatable\n ])\n end",
"def write_settings\n Application.settings.set_value('pos', Qt::Variant.new(pos))\n Application.settings.set_value('size', Qt::Variant.new(size))\n Application.settings.sync\n end",
"def save_settings(settings)\n %x{ mkdir #{ENV[\"HOME\"]}/.wts-reader } unless File.directory?(\"#{ENV[\"HOME\"]}/.wts-reader\")\n File.open(ENV[\"HOME\"] + \"/.wts-reader/settings.txt\", 'w') do |file| \n file.write(\"Rate:#{settings[:rate]}\\nVoice:#{settings[:voice]}\\nPath:#{settings[:path] || '/tmp/'}\\n\")\n end\n end",
"def sync_setting_params\n params.require(:sync_setting).permit(:job_name, :schedule, :schedule_period, :schedule_time, :last_sync)\n end",
"def save(params = {})\n return false unless valid?\n\n ActiveRecord::Base.transaction do\n @habit.current_config = @config\n @config.habit = @habit\n @habit.save!\n raise ActiveRecord::Rollback unless errors.empty?\n end\n errors.empty?\n end",
"def setting_params\n params[:setting]\n end",
"def save_form(values)\n mp values\n persist\n\n back_to_previous_screen\n end",
"def settings_write(settings_hash = active_values, name: nil)\n File.open settings_path(name), 'w' do |f|\n f.write settings_hash.to_yaml\n end\n end",
"def save\n SAVE\n end",
"def admin_setting_params\n params.require(:setting).permit(:key, :value)\n end",
"def save *args\n @save = args.first if args.size > 0\n end",
"def setting_params\n params.require(:setting).permit(:namespace, :value)\n end",
"def save\n return unless dirty? && config.respond_to?(:write)\n\n config.write\n clean_up\n end",
"def save!\n end",
"def saving_params\n params.require(:saving).permit(:status, :interest_rate)\n end",
"def save\n save_timeline\n save_queue(id, @queue) #in waitlist module\n save_tweets(id, @tweets)\n save_watchlist(id, @watch_list)\n rules.each{|rule|rule.create}\n end",
"def _save\n properties\n end",
"def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end",
"def set_defaultsettings\r\n AppSettings.item.to_hash.each do |setting, value|\r\n s = RailsSettings::Settings.new \r\n s.var = setting.to_s\r\n s.value = value[:default]\r\n s.thing_id = self.id\r\n s.thing_type = \"Item\" \r\n s.save\r\n end\r\n end",
"def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end",
"def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end",
"def setting_params\n params.require(:setting).permit(:first_name, :allow_reminder_for_birthdays)\n end",
"def cmd_notify_pushover_save\n\t\t\t\tprint_status(\"Saving parameters to config file\")\n\t\t\t\tif @app_key and @user_key\n\t\t\t\t\tconfig = {'app_key' => @app_key, 'user_key' => @user_key}\n\t\t\t\t\tFile.open(Notify_pushover_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_pushover_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend"
] |
[
"0.7590652",
"0.73559767",
"0.6841639",
"0.6654382",
"0.65896815",
"0.65478325",
"0.6514156",
"0.6493019",
"0.64362705",
"0.6330308",
"0.63055104",
"0.6266877",
"0.6252989",
"0.6231826",
"0.61786515",
"0.6168354",
"0.6162905",
"0.6148051",
"0.6091877",
"0.60746914",
"0.6066076",
"0.6061259",
"0.60593784",
"0.6048146",
"0.60386765",
"0.6027133",
"0.60207313",
"0.59790975",
"0.59522086",
"0.59419066",
"0.5928254",
"0.59129405",
"0.59096897",
"0.58912534",
"0.5883849",
"0.58837014",
"0.5880019",
"0.58551973",
"0.58511156",
"0.57982135",
"0.57890207",
"0.5780294",
"0.57704717",
"0.5765917",
"0.57552546",
"0.57539713",
"0.5752609",
"0.57475626",
"0.57436895",
"0.5741271",
"0.5724613",
"0.5720786",
"0.57197434",
"0.57183075",
"0.5705468",
"0.57042056",
"0.569045",
"0.5678064",
"0.5671269",
"0.56706405",
"0.56693393",
"0.5665938",
"0.56624883",
"0.5657443",
"0.56501067",
"0.5647883",
"0.56458026",
"0.5645019",
"0.56092244",
"0.56062067",
"0.55805916",
"0.5576577",
"0.55676407",
"0.5556653",
"0.5550093",
"0.5549423",
"0.5543331",
"0.5531501",
"0.5524608",
"0.55237454",
"0.55162865",
"0.54988503",
"0.5493746",
"0.54866326",
"0.54760957",
"0.5473631",
"0.5467261",
"0.54642683",
"0.5455359",
"0.54477715",
"0.5435508",
"0.54270023",
"0.5421593",
"0.5421205",
"0.5395196",
"0.53934735",
"0.53908926",
"0.5386628",
"0.53835785",
"0.5375497"
] |
0.7825897
|
0
|
Admin page is public until a password is saved.
|
def is_admin_pass
get_setting(:is_admin_pass, IS_ADMIN_PASS)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def protected!\n redirect(\"/privateLogin\") unless admin?\n end",
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def admin_user\n unless ( logged_in? && current_user.admin? )\n store_location\n flash[:danger] = \"У Вас недостаточно прав для выполнения этой операции.\"\n redirect_to root_url\n end \n # redirect_to(root_url) unless current_user.admin?\n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def admin_required\n if not admin?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end",
"def admin?; false end",
"def admin_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\" \n return\n end\n\n unless current_user.admin?\n redirect_to boards_path, notice: \"You do not have permission for that.\" \n return\n end\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def secret\n @admin = Admin.find(params[:id])\n unless @admin.id == current_admin.id\n flash[:notice] = \"Vous n'avez pas les droits d'accès au dashboard d'un autre admin!\"\n redirect_to admin_path(current_admin)\n end\n end",
"def admin_auth\n\t\tif signed_out?\n deny_access \"You must sign in first.\"\t\t\t\n\t\telse\n\t deny_access \"You must be an admin to perform that action.\" unless current_user.admin\n\t\tend\n end",
"def administrate!\n\tif current_user.admin == false \n\t\tredirect \"/home\"\n\tend\nend",
"def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end",
"def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend",
"def admin\n\t\tif !session[:admin]\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend",
"def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin\n #TODO\n end",
"def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end",
"def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend",
"def i_am_admin\n unless current_user.is_admin?\n redirect_to :root \n flash[:error] = \"You haven't the rights to access the required page.\"\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def give_admin!\n self.admin = true\n save\n puts \"Felicitation vous etes admin!\"\n true\n end",
"def authenticate_admin\n unless current_user.admin?\n redirect_to site_path, alert: 'You do not have permission to access that page.' and return\n end\n end",
"def edit_password; end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def admin_user\n\t\tredirect_to(root_path) unless current_user.admin?\n\tend",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end",
"def logged_in_admin\n unless admin?\n # show a flash message on the page\n flash[:danger] = \"Non sei autorizzato a visitare questa pagina\"\n # redirect user to home page\n redirect_to root_path\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end"
] |
[
"0.705954",
"0.7042855",
"0.6955912",
"0.6931952",
"0.6917277",
"0.68907887",
"0.68770546",
"0.6867176",
"0.6864896",
"0.68407977",
"0.68304807",
"0.6828889",
"0.6819817",
"0.68056494",
"0.68033725",
"0.67977357",
"0.67951494",
"0.67951494",
"0.67905617",
"0.6786056",
"0.6784549",
"0.67808396",
"0.6779033",
"0.6768912",
"0.67653334",
"0.67653334",
"0.676232",
"0.676232",
"0.676232",
"0.6760112",
"0.67596304",
"0.67596304",
"0.67596304",
"0.67596304",
"0.67511296",
"0.6749477",
"0.67466336",
"0.6742727",
"0.67412114",
"0.67412114",
"0.6735093",
"0.672467",
"0.6723688",
"0.67190975",
"0.67190975",
"0.67190975",
"0.67190975",
"0.6717884",
"0.67160904",
"0.6707545",
"0.6706801",
"0.6705365",
"0.670305",
"0.6702417",
"0.6702417",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403",
"0.6702403"
] |
0.0
|
-1
|
Gets the value of the setting with the passedin key, otherwise, default.
|
def get_setting(key, default)
setting = Setting.where(key: key).first
setting && !setting.value.blank? ? setting.value : default
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_setting_value(key, hash_setting = nil)\n hash_setting ||= get_setting\n \n hash_setting[key] || self.class.default_value(key)\n end",
"def get(key)\n settings.find_by_key(key).try(:value)\n end",
"def [](key)\n setting_obj = setting(key)\n setting_obj ? setting_obj.value : nil\n end",
"def [](key)\n ensure_config_loaded!\n if setting = setting_for(key.to_s)\n setting.value\n end\n end",
"def get(key, default=nil)\n\t\t\tval = self.send(key)\n\t\t\tval || default\n\t\tend",
"def [](key)\n result = default(key)\n result ? result.value : nil\n end",
"def get(key, default=nil)\n find = KeyValue.find_by_key(key)\n find ? find.value : default\n end",
"def [](key)\n key = normalize_key(key)\n\n @settings[key] && @settings[key].value\n end",
"def get(key, default=nil)\n raise(ArgumentError, \"Argument 'key' must be a String or Symbol.\") unless key.is_a?(String) || key.is_a?(Symbol)\n # Alternative ways can be implemented here. (reading individual registry keys etc.)\n key = key.to_sym unless key.is_a?(Symbol)\n return (@options.include?(key)) ? @options[key] : default\nend",
"def get(key, default = nil)\n include?(key) ? @data[key.to_sym] : default\n end",
"def get_setting(key)\n setting = nil\n\n @lock.synchronize do\n setting = @settings\n keys = key.to_s.downcase.split(/\\./)\n\n keys.each do |k|\n item = eval(\"setting.#{k}\") if setting.is_a?(OpenStruct)\n return nil unless item\n setting = item\n end\n end\n\n setting\n end",
"def [](key)\n self.get(key) || default.get(key)\n end",
"def get_value(key, default_value, user = nil)\n settings, fetch_time = _get_settings()\n if settings.nil?\n message = \"Config JSON is not present when evaluating setting '#{key}'. Returning the `default_value` parameter that you specified in your application: '#{default_value}'.\"\n @log.error(1000, message)\n @hooks.invoke_on_flag_evaluated(EvaluationDetails.from_error(key, default_value, error: message))\n return default_value\n end\n details = _evaluate(key, user, default_value, nil, settings, fetch_time)\n return details.value\n end",
"def get!(key, default=nil, &block)\n value = get key, default, &block\n raise \"Nil value found for option: #{key}, #{default}\" if value.nil?\n return value\n end",
"def get(key, default=nil)\n rv = nil\n\n [*key].each do |k|\n # Lets check for this key\n rv = @config.get(k.to_s)\n break unless rv.nil?\n\n # If it doesn't exist, check with env\n rv = @config.get(KnoxBoxWeb::Application.environment.to_s << '.' << k.to_s)\n break unless rv.nil?\n end\n\n return default if rv.nil?\n return rv\n end",
"def setting(key)\n @settings[key]\n end",
"def get_option(options, key, default_value = \"\")\n result = options.has_key?(key) ? options[key] : nil\n result = default_value if result.nil? || result == \"\"\n result \n end",
"def option_or_default(key, default)\n options? ? options.fetch(key, default) : default\n end",
"def get_option(key = nil, default = nil, meta_key = \"_default\")\n values = cama_options(meta_key)\n key = key.to_sym\n values.has_key?(key) && values[key] != \"\" ? values[key] : default\n end",
"def setting_value(setting_name)\n if Setting.exists?(name: setting_name)\n setting = Setting.find_by(name: setting_name)\n setting.value.empty? ? default_setting_value(setting_name) : setting.value\n else\n default_setting_value(setting_name)\n end\n end",
"def setting(key)\n @hash[key]\n end",
"def get_config key, default = nil\n name_key = my_short_name.to_sym\n\n if Bot::Conf.has_key? name_key\n if Bot::Conf[name_key].has_key? key\n return Bot::Conf[name_key][key]\n end\n end\n\n default\n end",
"def get_site_setting(site, setting = nil)\n if setting && site_settings(site) && site_settings(site)[setting.to_sym]\n site_settings(site)[setting.to_sym]\n else \n nil\n end\n end",
"def fetch(key, default = nil)\n configuration.fetch(key, default)\n end",
"def value_for(key, params, default_value = nil)\n params.values_at(key, key.to_sym, underscore(key), underscore(key).to_sym).compact.first || default_value\n end",
"def get_setting(region, key, default = nil)\n region = ('r' + region.to_s).to_sym unless region == :global\n key = key.to_sym\n begin\n unless @real_settings.key?(region)\n raise(KeyError, \"region [#{region}] does not exist in settings hash and no default provided for [#{key}]\") unless @real_settings[:default].key?(key)\n return @real_settings[:default][key]\n end\n return @real_settings[region][key] if @real_settings[region].key?(key)\n raise(KeyError, \"key [#{key}] does not exist in region [#{region}] or defaults settings hash, and no default provided\") unless @real_settings[:default].key?(key)\n return @real_settings[:default][key]\n rescue KeyError => e\n raise e if default.nil?\n return default\n end\n end",
"def get_with_default(hash, key, default)\n hash.key?(key) ? hash[key] : default\n end",
"def setting_for(key)\n ensure_config_loaded!\n setting_class.find_by_key(key.to_s)\n end",
"def get(setting, _site_name, _environment_name, default = nil)\n @config.dig(*setting) || default\n end",
"def from_setting_or_image_info(key, val=nil, default=nil)\n @settings[key] = val unless val.nil?\n return @settings[key] if @settings.include?(key)\n return image_info[key] unless image_info.nil?\n return default # otherwise\n end",
"def [](key)\n hash = to_h\n if hash.has_key?(key)\n hash[key]\n else\n default(key)\n end\n end",
"def [](key)\n initialize_cache unless @initialized\n return @settings[key]\n end",
"def get_key(key, default: nil, error: false)\n if(has_key?(key))\n return self[key]\n end\n \n raise ArgumentError.new(\"Value #{key} not found.\") unless !error\n return default\n end",
"def get_param(key, default_value = \"\")\n result = get_option(@params, key, default_value)\n result\n end",
"def get_value(section, key)\n if section.nil?\n raise TypeError.new('nil not allowed')\n end\n section = 'default' if section.empty?\n get_key_string(section, key)\n end",
"def config_or_default(config,key,default)\n (config && config[key] ? config[key] : default)\n end",
"def getConf(key, defaultValue = DefaultValue, conf = @conf)\n if (conf.key?(key)) then\n return conf[key] ;\n elsif(conf != @conf && @conf.key?(key)) then\n return @conf[key] ;\n else\n return defaultValue ;\n end\n end",
"def [](key)\n config[key.to_s] || config[key.to_sym]\n end",
"def get(key, default=nil, &block)\n value = options[key]\n value = default if value.nil?\n value = block.call if value.nil? && block\n return value\n end",
"def param_or_default(key)\n return params[key] unless params[key].nil?\n if (alt_key = alternative_key(key)) && params[alt_key]\n return params[alt_key]\n end\n\n user_params_model[key].default_value\n end",
"def fetch(key, default)\n @configuration.fetch(key, default)\n end",
"def fetch(key, default)\n @configuration.fetch(key, default)\n end",
"def default_or_inferred_for(key_name)\n @defaults[key_name] || send(\"default_value_for_#{key_name}\") || \\\n raise(\"No default value for: #{key_name}\")\n end",
"def get_property(key, default_value = nil)\n end",
"def default key\n @defaults[String(key).to_sym]\n end",
"def default(key)\n @defaults[key]\n end",
"def or_default( key, defaultValue )\n raise \"key must be a Symbol or String\" unless key.is_a?( Symbol ) || key.is_a?( String )\n\n if self.of(@section).has_key?( key ) # ToDo: Nicer: create Conf::has_key?\n res = self[key]\n else\n self[key]= defaultValue\n res = defaultValue\n self.save ## if @instant_save # 2009-06-11\n end\n\n res\n end",
"def get!(key)\n rv = @config.get(key)\n return rv\n end",
"def default(key = nil)\n if key.is_a?(Symbol) && include?(key = key.to_s)\n self[key]\n else\n super\n end\n end",
"def get(key)\n\t\t\treturn @config[key]\n\t\tend",
"def get_option(hash, key)\n hash[key.to_sym] || hash[key] || nil\n end",
"def value(key, default = nil)\n keys = key.split(\".\")\n r = recurse_config(@full[@env], keys.dup, :key_missing)\n if r == :key_missing\n recurse_config(@full[\"common\"], keys.dup, default)\n else\n r\n end\n end",
"def setting(key)\n keys = [key]\n case key\n when String\n keys << key.to_sym\n when Symbol\n keys << key.to_s\n end\n\n # Scan all possible keys to see if the config has a matching value\n keys.inject(nil) do |rv, k|\n v = @config[k]\n break v unless v.nil?\n end\n end",
"def setting(key)\n keys = [key]\n case key\n when String\n keys << key.to_sym\n when Symbol\n keys << key.to_s\n end\n\n # Scan all possible keys to see if the config has a matching value\n keys.inject(nil) do |rv, k|\n v = @config[k]\n break v unless v.nil?\n end\n end",
"def set_default(key, value)\n settings.send :\"#{key}=\", value unless settings.send(:\"#{key}?\")\n end",
"def get_config_value(key_sym, default)\n if !worker_config[key_sym].nil?\n worker_config[key_sym]\n elsif !BDRB_CONFIG[:backgroundrb][key_sym].nil?\n BDRB_CONFIG[:backgroundrb][key_sym]\n else\n default\n end\n end",
"def config_for_key(key)\n settings.config[key]\n end",
"def get(key, default = nil)\n return nil if not key\n\n key = key.to_sym if key.class == String\n\n return @oConfig.runtimeGet(key) if @oConfig.runtimeExist?(key)\n\n section = ForjDefault.get_meta_section(key)\n default_key = key\n\n if not section\n Logging.debug(\"ForjAccount.get: No section found for key '%s'.\" % [key])\n else\n return rhGet(@hAccountData, section, key) if rhExist?(@hAccountData, section, key) == 2\n\n hMeta = @oConfig.getAppDefault(:sections)\n if rhExist?(hMeta, section, key, :default) == 3\n default_key = rhGet(hMeta, section, key, :default)\n Logging.debug(\"ForjAccount.get: Reading default key '%s' instead of '%s'\" % [default_key, key])\n end\n return default if rhExist?(hMeta, section, key, :account_exclusive) == 3\n end\n\n @oConfig.get(default_key , default )\n end",
"def value_for_key(keypath = '')\n cfg = @settings\n real_path = ['config']\n unless keypath =~ /^[.*]?$/\n real_path = resolve_key_path(keypath, create: false)\n return nil unless real_path&.count&.positive?\n\n cfg = cfg.dig(*real_path)\n end\n\n cfg.nil? ? nil : { real_path[-1] => cfg }\n end",
"def get(key)\n self.config[key]\n end",
"def [](key)\n @override[key] || values[key] || defaults[key]\n end",
"def find_setting(setting_key:)\n return settings.detect do |setting|\n setting.key.to_sym == setting_key.to_sym\n end\n end",
"def get(key)\n _get_from_params(key) || _get_from_values(key)\n end",
"def get(key, log: true)\n key = key&.to_sym\n if @value.key?(key)\n @value[key]\n elsif (meth = option_method(key))\n @value[key] = send(meth)\n elsif log\n Log.warn(\"#{self.class}[#{key.inspect}]: invalid key\")\n end\n end",
"def config_value_for(key)\n cmd = executable_command config_value_str(key)\n value = `#{cmd}`.strip\n value = nil if value == ''\n value\n end",
"def pref(key)\n if pref = preferences.find_by(key: key)\n pref.value\n else\n Droom.user_default(key)\n end\n end",
"def GetXendOption(option_key)\n Ops.get(@SETTINGS, option_key, Ops.get(@DEFAULT_CONFIG, option_key, \"\"))\n end",
"def set_default(key, default_value)\n return default_value unless @options.key? key.to_s\n @options[key.to_s]\n end",
"def get_value(key)\n self[key]\n end",
"def getvalue(key)\r\n return @@params[key] if (key != nil)\r\n return nil\r\n end",
"def get_value(item, key, default: nil, **)\n return if key.blank?\n if key.is_a?(Array)\n key.find { |k| (v = get_value(item, k)) and break v }\n elsif item.respond_to?(key)\n item.send(key)\n elsif item.respond_to?(:emma_metadata) # Upload, etc.\n item.emma_metadata&.dig(key.to_sym)\n elsif item.is_a?(Hash)\n item[key.to_sym] || item[key.to_s]\n end.presence || default\n end",
"def get(key)\n @config_hash[key]\n end",
"def get(key, ignore: nil)\n if option = find(key)\n option.first\n else\n nil\n end\n end",
"def setting(key)\n @setting_cache ||= {}\n return @setting_cache[key] if @setting_cache[key].present?\n\n log \"looking up business setting: <strong>#{key}</strong>\"\n setting = Setting.business(business).key(key).first\n raise \"Unknown Setting key:#{key}\" if setting.nil?\n\n @setting_cache[key] = setting\n setting\n end",
"def read(key, default=nil)\n document = @dao.collection.find_one(selector(key))\n if !document.nil?\n document['v']\n else\n default\n end\n end",
"def default? key\n @defaults.key? String(key).to_sym\n end",
"def get_config(key)\n if config.key? key\n config[key]\n else\n application.default_config[key]\n end\n end",
"def get(key)\n return do_get(key, false)\n end",
"def _fetch(key, options = {})\n value = params.key?(key) ? params[key] : options[:default]\n options[:required] ? _ensure(value, options) : value\n end",
"def get(name, default = nil)\n\t\t\t\tname = name.to_sym\n\n\t\t\t\tif @options[name][:value] != nil then\n\t\t\t\t\t@options[name][:value]\n\t\t\t\telsif default != nil then\n\t\t\t\t\tdefault\n\t\t\t\telse\n\t\t\t\t\t@options[name][:default]\n\t\t\t\tend\n\t\t\tend",
"def method_missing(key, *args, &block)\n begin\n value = fetch(key.to_s)\n rescue IndexError\n raise MissingSetting, \"Missing setting '#{key}' in #{@section}\"\n end\n value.is_a?(Hash) ? self.class.new(value, \"'#{key}' section in #{@section}\") : value\n end",
"def preference_for setting\n\n if preferences = self.preference\n pref = preferences.attributes[setting.to_s]\n return pref unless pref.empty?\n end\n\n Preference.default_for setting\n end",
"def with_default(default, key)\n assert_explanation(key)\n configured?(key) ? self[key] : default\n end",
"def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end",
"def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end",
"def fetch_config_value(key)\n valid_value = valid_config_value(::NewRelic::Agent.config[key].to_s.to_sym)\n ::NewRelic::Agent.logger.debug(\"Using #{valid_value} configuration value for #{self.name} to configure instrumentation\")\n return valid_value\n end",
"def value\n case ALLOWED_SETTINGS[object['key']]\n when :easy\n ::EasySetting.value(object['key'], object['project'].try(:id))\n when :redmine\n if object['key'] == 'date_format'\n ::Setting.date_format.presence || ::I18n.t('date.formats.default')\n else\n ::Setting.send(object['key'])\n end\n when :time_entry\n ::EasyGlobalTimeEntrySetting.value(object['key'], ::User.current.roles)\n else\n raise GraphQL::ExecutionError, \"Unknow setting '#{object['key']}'\"\n end\n end",
"def get_option(key)\n o = @grammar.get_locally_defined_option(key)\n if (!(o).nil?)\n return o\n end\n if (!(@parent).nil?)\n return @parent.get_option(key)\n end\n return nil # not found\n end",
"def get(key, default = nil)\n return default unless servers?\n if key.kind_of? Array\n @cache.get_multi(key_in_ns(key))\n else\n @cache.get(key_in_ns(key)) || default \n end\n end",
"def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def [](key)\n opts[key]\n end",
"def var(option_key, default_value=:__UNDEFINED__, opts={}, &block)\n ret = _pair(option_key, default_value, opts, &block)\n return if ret[2] # ignore\n instance_variable_set(\"@#{ret[0]}\".to_sym, ret[1])\n ret[1]\n end",
"def [](key)\n load_config unless @config\n @config[key]\n end",
"def default(key) end",
"def get(key)\n a_hash[key] || -1 \n end",
"def value_by_key(hash, key)\n hash[key.to_s] || hash[key.to_sym]\n end",
"def get(key)\n key = key.to_s\n %w(local_config app_config m2mhub_config).each do |config_key|\n if (config = @yaml_config[config_key])\n if config_key == 'app_config'\n next unless config = config[Rails.env.downcase]\n end\n if config.member?(key)\n return config[key]\n end\n end\n end\n nil\n end",
"def fetch(key, *default)\n result =\n if key?(key)\n self[key]\n elsif block_given?\n yield(self)\n end\n unless result\n raise KeyError, \"key not found \\\"#{key}\\\"\" if default.empty?\n result = default.first\n end\n result\n end",
"def setting(name)\n @settings[normalize_key(name)]\n end"
] |
[
"0.82567984",
"0.779489",
"0.77867734",
"0.7385333",
"0.7326429",
"0.73019946",
"0.72514933",
"0.72428375",
"0.7231807",
"0.7206626",
"0.72030574",
"0.7148321",
"0.7117809",
"0.7058934",
"0.7033194",
"0.70088047",
"0.7007596",
"0.69341326",
"0.69001806",
"0.6856759",
"0.68560004",
"0.6807217",
"0.6796011",
"0.67958885",
"0.6753786",
"0.6742522",
"0.6742429",
"0.67305",
"0.67065346",
"0.668684",
"0.6679365",
"0.6656803",
"0.66538477",
"0.6652308",
"0.6643105",
"0.661859",
"0.6603496",
"0.6593118",
"0.65791947",
"0.6576277",
"0.6572039",
"0.6572039",
"0.65463924",
"0.6532741",
"0.65268993",
"0.6520482",
"0.65175223",
"0.65075654",
"0.6472511",
"0.6471923",
"0.6469615",
"0.64660954",
"0.64650166",
"0.64650166",
"0.64007115",
"0.63837874",
"0.6372658",
"0.6364252",
"0.63616246",
"0.6353165",
"0.6322538",
"0.6317292",
"0.63121915",
"0.6299769",
"0.6277761",
"0.6265247",
"0.6247188",
"0.6236586",
"0.6193961",
"0.6192787",
"0.6171881",
"0.6163366",
"0.6147943",
"0.6145334",
"0.6123331",
"0.6115745",
"0.61059296",
"0.6102681",
"0.6102657",
"0.6068419",
"0.6067011",
"0.6065535",
"0.6043256",
"0.60006016",
"0.59852564",
"0.5984919",
"0.5970469",
"0.59357095",
"0.5934752",
"0.5933088",
"0.5927247",
"0.59230024",
"0.5917322",
"0.5913185",
"0.5902881",
"0.58977985",
"0.5897249",
"0.58640265",
"0.5858766",
"0.5845844"
] |
0.82835025
|
0
|
Saves the settings with the passedin key and val.
|
def save_setting(key, val)
# Check for nil, since unchecked checkboxes don't send a value.
# Check for whether a boolean, since .blank? returns true for false.
# Check for a blank string.
if val == nil || !!val == val || !val.blank?
setting = Setting.where(key: key).first_or_create
setting.value = val
setting.save
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_settings\n (params[:setting] || []).each do |key, val|\n setting = Setting.find_by_key(key)\n setting = Setting.create!(key: key) unless setting\n if val.is_a?(ActionDispatch::Http::UploadedFile) # image setting value\n setting.update(image: val)\n else # text setting value\n setting.update(value: (val.is_a?(Array) ? val.join(',') : val))\n end\n end\n \n # clear file values\n (params[:clear_file] || {}).each do |setting_key, v|\n setting = Setting.find_by_key(setting_key)\n setting.update(image: nil) if setting\n end\n \n # delete greeting countries\n (params[:del_country] || {}).each do |country, v|\n Setting.where('settings.key like ?', \"#{country}_%_art_country\").destroy_all\n end\n \n Setting.reset_caches\n redirect_to url_for(action: :index), notice: 'Settings were successfully saved!'\n end",
"def save(key, value)\n storage.transaction {storage[key] = value}\n end",
"def add_setting(setting_key, setting_val)\n @settings[setting_key.to_sym] = setting_val\n end",
"def save\n save_status = true\n original_setting_ids = @manager.configurable.active_configuration_settings.with_key(@key).collect(&:id)\n replaced_setting_ids = []\n\n [value].flatten.each do |value_with_modifier|\n if (setting = @manager.configurable.active_configuration_settings.create(:key => @key, :modifier => value_with_modifier[:modifier], :value => value_with_modifier[:value])).new_record?\n save_status = false && break\n else\n replaced_setting_ids << setting.id\n end\n end\n\n @manager.configurable.active_configuration_settings.reload\n @manager.configurable.active_configuration_settings.with_key(@key).where(:id => (save_status ? original_setting_ids : replaced_setting_ids)).destroy_all\n\n @manager.settings.delete(@key)\n\n return save_status\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end",
"def save(key, value)\n s3_write key, value\n end",
"def setting(nested_key, value)\n settings.set(nested_key, value)\n save_settings!\n end",
"def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end",
"def []=(key, val)\n item = find_item(key)\n if item\n @values.set_value(item.key, Settings.parse(val, item.type))\n end\n val\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def save_value(key, value)\n raise NotImplementedError,\n \"The :save_value method should be overwritten by a subclass.\"\n end",
"def save_settings\n open(@@FN_CREDENTIALS, \"wb\") { |fd| fd.write(YAML::dump(@credentials)) }\n open(@@FN_CONFIG, \"wb\") { |fd| fd.write(YAML::dump(@configuration)) }\n open(@@FN_SETTINGS, \"wb\") { |fd| fd.write(YAML::dump(@settings)) }\n end",
"def save_settings settings\n File.open(@settings_file, 'w') {|file| file << YAML::dump(settings)}\n end",
"def set(key, value)\n settings.send :\"#{key}=\", value\n end",
"def save_settings(filename, settings)\n require 'yaml'\n\n File.open(filename, 'w') do |file|\n file.write(settings.to_yaml)\n Log.instance.info(\"Settings written to [ #{filename} ]\")\n end\n end",
"def save_settings\n @plugin.set_options(params[:options]) if params[:options].present? # save option values\n @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values\n @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values\n redirect_to url_for(action: :settings), notice: \"Settings Saved Successfully\"\n end",
"def store(key, value)\n filename = File.join(dir, key)\n File.write(filename, value)\n filename\n end",
"def []=(key, val)\n setting_obj = setting(key) || define_setting(key)\n setting_obj.value = val\n end",
"def write key, value\n @content[key] = value\n File.open(@file_path, 'w') { |f| YAML.dump(@content, f) }\n end",
"def set(k, v)\n settings[k.to_sym] = v\n end",
"def save(params)\r\n save_admin_pass(params[:admin_pass])\r\n save_setting(:site_name, params[:site_name])\r\n save_setting(:navbar_bg_color, params[:navbar_bg_color])\r\n save_setting(:navbar_font_color, params[:navbar_font_color])\r\n save_setting(:navbar_border_color, params[:navbar_border_color])\r\n save_setting(:page_bg_color, params[:page_bg_color])\r\n save_setting(:page_font_color, params[:page_font_color])\r\n save_setting(:subnav_bg_color, params[:subnav_bg_color])\r\n save_setting(:subnav_font_color, params[:subnav_font_color])\r\n save_setting(:copyright_name, params[:copyright_name])\r\n save_setting(:gallery_captions, params[:gallery_captions])\r\n save_setting(:meta_description, params[:meta_description])\r\n save_setting(:favicon, params[:favicon])\r\n save_setting(:paypal_client_id, params[:paypal_client_id])\r\n save_setting(:show_hidden_pages, params[:show_hidden_pages])\r\n end",
"def test_should_save_settings\n prefs = {\n \"store_name\" => \"Substruct\",\n \"store_handling_fee\" => \"0.00\",\n \"store_use_inventory_control\"=>\"1\"\n }\n assert Preference.save_settings(prefs)\n end",
"def setconfig(key, val, store=config_store)\n return store.transaction { store[key] = val }\nend",
"def []=(key, value)\n @data[key] = value\n\n save if autosave?\n end",
"def save_settings\n File.open( @settings_filename, 'w' ) do |out|\n YAML.dump( @app_settings, out )\n end\n @log.debug \"Settings saved into #{@settings_filename}\"\n end",
"def update_settings hash\n update settings: settings.merge(hash)\n save\n end",
"def save_settings\n options = PAGENOTFOUND_DEFAULTS.merge(params[:options]&.to_unsafe_h.presence || {})\n @plugin.set_options(options) # save option values\n @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values\n @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values\n Rails.cache.delete_matched('pagenotfound_')\n redirect_to url_for(action: :settings), notice: 'Settings Saved Successfully'\n end",
"def store(key, value)\n #open!(key)\n super(key, value)\n end",
"def []=(key, value)\n @settings[@key] << \"#{key}=#{value}\"\n end",
"def write(key, value)\n @dao.collection.save({ '_id' => key, 'v' => value })\n end",
"def set(k, v)\n settings[k.to_sym] = v\n end",
"def set(domain, key, value, type = nil)\n command = ['defaults', 'write', domain, key]\n command << \"-#{type}\" unless type.nil?\n command << value.to_s\n log command.join(' ')\n shell!(*command)\n end",
"def setting_params\n params.require(:setting).permit(:key, :key_is, :value, :field_type, :locked_at, :id)\n end",
"def e_set_setting(key, value)\n set_option(key, value, '_setting_ecommerce')\n end",
"def set(key, val)\n return unless val\n db[key] = val\n end",
"def []=(key, val)\n self.setObject(val, forKey: key.to_s)\n self.synchronize\n end",
"def write(key, value)\n perform_update(:write, key, value.to_s)\n end",
"def set(hash)\n hash.each do | key, value |\n setting = settings.find_by_key(key) || settings.new(:key => key)\n setting.value = value\n setting.save!\n end\n end",
"def []=( key, value )\n raise \"key must be a Symbol or String\" unless key.is_a?( Symbol ) || key.is_a?( String )\n\n self.of(@section).store( key, value)\n self.save if @instant_save\n value\n end",
"def save(fn)\n begin\n File.open(fn,\"w\") do |file|\n output = \"\"\n self.each do |key, value|\n output << key.to_s + \"=\" + value.to_s + \"\\r\\n\"\n end\n\n file.print output\n file.close\n end\n rescue\n raise \"Error: trouble saving configuration file: #{fn}.\\nDetails: #{$!}\"\n end\n end",
"def mdump(key, val)\n set(key, Marshal.dump(val))\n end",
"def save\n # Get the currently set path\n \tconfig_file = File.expand_path('../../config/bookhero.conf',File.dirname(__FILE__))\n settings = YAML::load(File.open(config_file))\n \t@configured_library_path = settings['library_path']\n \t@configured_google_api_key = settings['google_api_key']\n\n \n # Get data from form\n library_path = params[:library_path]\n if library_path.blank?\n library_path = @configured_library_path\n end\n\n google_api_key = params[:google_api_key]\n # if google_api_key.blank?\n # google_api_key = @configured_google_api_key \n # end\n\n # Write the data to yaml config file.\n \tdata = {\"library_path\" => \"#{library_path}\",\n \"google_api_key\" => \"#{google_api_key}\"}\n \tFile.open(File.expand_path('../../config/bookhero.conf',File.dirname(__FILE__)),\"w\") {|f| f.write(data.to_yaml)}\n\n # Read settings again\n redirect_to :action => \"settings\"\n\n end",
"def save_settings(settings)\n %x{ mkdir #{ENV[\"HOME\"]}/.wts-reader } unless File.directory?(\"#{ENV[\"HOME\"]}/.wts-reader\")\n File.open(ENV[\"HOME\"] + \"/.wts-reader/settings.txt\", 'w') do |file| \n file.write(\"Rate:#{settings[:rate]}\\nVoice:#{settings[:voice]}\\nPath:#{settings[:path] || '/tmp/'}\\n\")\n end\n end",
"def set(key, value)\n self.data ||= {}\n self.data[key.to_s] = value\n self.save!\n end",
"def set(key, value)\n filename = filename_from_url(key)\n mkpath(filename)\n\n # Save metadata in a parallel file\n if value.respond_to?(:meta)\n filename_meta = \"#{filename}.meta\"\n meta = value.meta\n meta[:status] = value.status if value.respond_to?(:status)\n meta[:content_type] = value.content_type if value.respond_to?(:content_type)\n meta[:base_uri] = value.base_uri if value.respond_to?(:base_uri)\n File.open(filename_meta, 'wb') {|f| YAML::dump(meta, f)}\n end\n\n # Save file contents\n File.open(filename, 'wb'){|f| f.write value.read }\n value.rewind\n value\n end",
"def write_config_entry(key, value)\n if $has_config.call then\n curr_config = YAML.load(File.read($config_filename))\n else\n curr_config = {}\n end\n\n curr_config[key] = value\n\n File.open($config_filename, 'w') { |f| f.write(curr_config.to_yaml) }\nend",
"def put(key, value)\n \n end",
"def []=(key, val)\n @write_lock ||= true\n @data ||= restore\n @data[key] = val\n end",
"def store(keyname, value)\n @keystore.store(key: keyname, value: value)\n end",
"def setting_params\n params.require(:setting).permit(:data_type, :key, :value)\n end",
"def settings_write(settings_hash = active_values, name: nil)\n File.open settings_path(name), 'w' do |f|\n f.write settings_hash.to_yaml\n end\n end",
"def persist(key); end",
"def persist(key); end",
"def add_setting_writer(item)\n self.send(:define_method, \"#{item.name}=\") do |newvalue|\n old = send(item.name)\n retval = settings[item.name] = canonicalize(item.name, newvalue)\n self.settings_changed << item.name unless old == retval\n unless new_record?\n self.settings_will_change!\n end\n retval\n end\n end",
"def set_administration_key(key, val)\n raise ArgumentException, \"#{key} is not a valid admin key!\" unless @admin.keys.index(key)\n @admin[key][\"value\"] = val\n end",
"def save(data)\n\t\t\tredis.sadd(key, data)\n\t\tend",
"def set_value(key, value)\n @store_[key] = value\n YakvdConstants.success\n end",
"def store_in_buffer_setting(key, value)\n if key == \"OPTIONS\"\n\n # Options are stored in a hash. Special-case.\n value.scan(/([^ ]*):((((\\(.*\\))))|([^ ])*)/) do |o, v|\n @options[o] = v\n end\n elsif key =~ /^(TODO|SEQ_TODO|TYP_TODO)$/\n # Handle todo keywords specially.\n value.split.each do |keyword|\n keyword.gsub!(/\\(.*\\)/, \"\") # Get rid of any parenthetical notes\n keyword = Regexp.escape(keyword)\n next if keyword == \"\\\\|\" # Special character in the todo format, not really a keyword\n @custom_keywords << keyword\n end\n else\n @in_buffer_settings[key] = value\n end\n end",
"def set(key, value); end",
"def set(key, value); end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end",
"def settings( key )\n if @settings[key].is_a? Proc\n @settings[key] = @settings[key].call\n end\n\n @settings[key]\n end",
"def set(key = nil, value = nil, **opts)\n if key\n detect_changes({ key => value }.expand)\n configuration.hpath_set(key => value)\n else\n detect_changes(opts.expand)\n opts.each do |k, v|\n configuration.hpath_set(k => v)\n end\n end\n save if sync_down\n true\n end",
"def write_settings\n Application.settings.set_value('pos', Qt::Variant.new(pos))\n Application.settings.set_value('size', Qt::Variant.new(size))\n Application.settings.sync\n end",
"def set(key, value)\n end",
"def write(key, value)\n paths = ::File.split(full_key(key))\n FileUtils.mkdir_p(paths.first) unless ::File.directory?(paths.first)\n f = ::File.open(full_key(key), 'w') {|f| f.write(value) }\n end",
"def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end",
"def write(key, value)\n filepath = realpath(key)\n FileUtils.mkdir_p(File.dirname(filepath))\n IO.binwrite(filepath, Marshal.dump(value))\n true\n end",
"def set_keyval\n @keyval = Keyval.find(params[:id])\n end",
"def save\r\n if valid?\r\n begin\r\n File.open(@filename, 'w') { |f| YAML.dump(@hash, f) }\r\n rescue StandardError => e\r\n Rails.logger.error(e)\r\n end\r\n \r\n # in production environment, there may be several threads of the application that are being cached, which will contain old\r\n # values for these settings; to workaround this, tell Passenger to restart after saving. This will cause the server to restart\r\n # on the next request (there is a separate server process that checks this file).\r\n FileUtils.touch(File.join(Rails.root, 'tmp', 'restart.txt')) if Rails.env.production?\r\n \r\n true\r\n else\r\n false\r\n end\r\n end",
"def admin_setting_params\n params.require(:setting).permit(:key, :value)\n end",
"def update_setting!(setting: nil)\n existing = find_setting(setting_key: setting.key)\n existing.value = setting.value\n self.settings = settings\n end",
"def setting_params\n params.fetch(:setting, {}).permit(:key, :value)\n end",
"def set_config(key, val)\n config[key] = val\n end",
"def write(key, value, options = {})\n entry = ::Elephas::Entry.ensure(value, key, options)\n entry.refresh\n @data[key] = entry\n entry\n end",
"def save\n Dir.chdir(@gl_admin.working_dir)\n\n #Process config file\n new_conf = @config.to_file(@confdir)\n @gl_admin.add(new_conf)\n\n #Process ssh keys\n files = list_keys(@keydir).map{|f| File.basename f}\n keys = @ssh_keys.values.map{|f| f.map {|t| t.filename}}.flatten\n\n to_remove = (files - keys).map { |f| File.join(@keydir, f)}\n @gl_admin.remove(to_remove)\n\n @ssh_keys.each_value do |key|\n key.each do |k|\n @gl_admin.add(k.to_file(@keydir))\n end\n end\n end",
"def put(key, value); end",
"def []=(key,value) #:nodoc:\n key = convert_key(key)\n regular_writer(key,convert_value(value))\n end",
"def edit_or_update_settings\n @title = 'Ustawienia'\n return unless request.post?\n params[:setting].each do |slug, value|\n setting = @settings.detect {|s| s.slug == slug}\n setting.update_attributes(:value => value) if setting\n end\n flash.now[:notice] = 'Ustawienia uaktualnione'\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved\n flash.now[:alert] = 'Wystąpił błąd podczas aktualizacji ustawień'\n end",
"def set!(path, value)\n setProperty path, value\n save if respond_to? :save # Only Configuration can save\n value\n end",
"def setting_params\n params.require(:setting).permit(:var, :value)\n end",
"def setting_params\n params.permit(:setting, :key, :value, :location) #, :key, :value, :location, #:system_node_id )\n end",
"def put key, value\n # append value to open file\n # write new keydict value\n @keydict[key] = write_data_entry key, value\n\n # sync\n\n if @data_file.size > MAX_FILE_SIZE\n fname = @data_file.path\n @data_file.close\n @data_file = open_new_data_file\n @old_data_files[fname] = File.open(fname, \"rb\")\n end\n end",
"def save\n values.save\n end",
"def store(key, value)\n value = apply_store_hook(key, value)\n key = aliases[key] || key\n super(key, value) unless @frozen_keys.include?(key)\n end",
"def cfg_set(key, value)\n hr_config.set_for_url(url.to_s, key, value)\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def []=(key, val)\n @write_lock ||= true\n @data ||= @dbman.restore\n @data[key] = val\n end",
"def set(key, value)\n Lib.set @path, @no_follow, key.to_s, value.to_s\n end",
"def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end",
"def setting_params\n params.require(:setting).permit(:name, :value)\n end",
"def setting(key)\n @settings[key]\n end",
"def set key, value, expiration\n backend.set key.to_s, serialize(value), expiration rescue nil\n end",
"def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end",
"def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end",
"def save_settings\n rf = Plugins::CamaleonRobotsEditor::CamaleonRobotsEditor.new\n rf.write params[:robots_content] if params[:robots_content].present?\n redirect_to url_for(action: :settings), notice: 'Settings Saved Successfully'\n end",
"def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end",
"def []=(key, val)\n @monitor.synchronize do\n expire!\n store(key, val)\n end\n end",
"def settings=(keys)\n @settings = keys\n keys.each do |key|\n #Change key to local method\n local_key = key.tr('.', '_')\n\n #Getter\n define_method(local_key.to_sym()) do\n self[key]\n end unless method_defined?(local_key.to_sym())\n\n #Setter\n define_method(:\"#{local_key}=\") do |value|\n self[key] = value\n end unless method_defined?(:\"#{local_key}=\")\n end\n end"
] |
[
"0.65049446",
"0.64630955",
"0.6442019",
"0.6379647",
"0.6346737",
"0.6198693",
"0.6194307",
"0.6174642",
"0.6109541",
"0.6098306",
"0.6091826",
"0.6089523",
"0.60892266",
"0.6073278",
"0.6063142",
"0.6054539",
"0.6030947",
"0.5986636",
"0.59849757",
"0.5968679",
"0.5918444",
"0.5908938",
"0.5907966",
"0.58994603",
"0.58976096",
"0.589104",
"0.5890094",
"0.58895713",
"0.5885429",
"0.58686525",
"0.5862222",
"0.5830798",
"0.58226883",
"0.57979786",
"0.5776943",
"0.5775342",
"0.57403445",
"0.571754",
"0.5714779",
"0.5713468",
"0.56956685",
"0.56864154",
"0.5683272",
"0.5678098",
"0.56688124",
"0.5662608",
"0.56026095",
"0.5596806",
"0.5581206",
"0.55805916",
"0.5574536",
"0.5574357",
"0.5567939",
"0.5567939",
"0.55676734",
"0.55617106",
"0.55315894",
"0.55164057",
"0.55144894",
"0.5507792",
"0.5507792",
"0.55026716",
"0.54978055",
"0.5486453",
"0.5478628",
"0.5476986",
"0.5469608",
"0.546559",
"0.54644597",
"0.54616517",
"0.54536974",
"0.54474396",
"0.5432785",
"0.5430512",
"0.5407072",
"0.54045016",
"0.5397732",
"0.53962725",
"0.5395689",
"0.5395267",
"0.5393263",
"0.5393251",
"0.53924423",
"0.5390645",
"0.53880847",
"0.5386919",
"0.53767896",
"0.5367891",
"0.5365156",
"0.5364146",
"0.5360833",
"0.53534275",
"0.5351917",
"0.5349622",
"0.5347592",
"0.5347592",
"0.5342199",
"0.53346",
"0.5332205",
"0.53151345"
] |
0.7639786
|
0
|
Saves the admin password salt, hash, and whether the password exists.
|
def save_admin_pass(val)
if val != ADMIN_PASS
pass_salt = BCrypt::Engine.generate_salt
pass_hash = BCrypt::Engine.hash_secret(val, pass_salt)
save_setting(:admin_pass_salt, pass_salt)
save_setting(:admin_pass_hash, pass_hash)
save_setting(:is_admin_pass, true)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_password\n @admin.password = Admin.get_encrypted_password(@new_password, @login_salt_d)\n @admin.save!\n end",
"def create_hashed_password\n\t\t#if :password has a value\n\t\t#\t-indicates we want to update the passowrd\n\t\t#\t-before_save: encrypt value with salt\n\t\t#\t-Save hash in :hashed_password\n\t\t# \t-after_save: clear :password\n\t\t\n\t\t#if :password does not have a value\n\t\t#\t-No encryption, no :hashed_password change\n\t\t#\t-Allow the record to save normally\n\t\t#Validate presence of :password for all new users\n\t\n unless password.blank?\n\t self.salt = AdminUser.make_salt(username) if salt.blank? #for new record only. It's ok to add self.salt.blank, but not necesary\n\t #Note: when we are doing assingment, self.salt is needed on the left side of the equal sign\n\t self.hashed_password = AdminUser.hash_with_salt(password, salt)\n\tend\n end",
"def create_password_on_update\n if !@password.blank?\n self.salt = User.make_salt(self.username) if self.salt.blank?\n self.hashed_password = User.hash_with_salt(@password, self.salt)\n end\n end",
"def create_hashed_password\n #only hash passwords if the password variable has been set\n unless password.blank?\n self.salt = Admin.make_salt(username) if salt.blank?\n self.hashedPassword = Admin.hash_with_salt(password , salt)\n end\n end",
"def password=(pass)\n @password = pass = password_confirmation\n self.password_hash = Digest::SHA256.hexdigest(pass)\n #Salt!\n #self.salt = User.random_string(10) if !self.salt?\n #self.password_hash = User.encrypt(@password, self.salt)\nend",
"def password=(pwd)\n @password = pwd\n return if pwd.blank?\n #set the salt value for the user\n create_new_salt\n #create new hashed password\n self.hashed_password = User.encrypted_password(self.password, self.salt)\n end",
"def add_password(a_password)\n self.password_hash = Digest::SHA256.hexdigest(a_password + Rails.application.secrets.salt)\n self.save\n end",
"def password=(pwd)\n @password = pwd\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.password_salt) \n end",
"def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end",
"def password=(pwd)\n @password = pwd\n return if pwd.blank?\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.salt)\n end",
"def before_save\n if (self.salt == nil)\n self.salt = random_numbers(5)\n self.password = Digest::MD5.hexdigest(self.salt + self.password)\n end\n end",
"def admin_authenticate?(password)\r\n salt = get_setting(:admin_pass_salt, \"\")\r\n hash = get_setting(:admin_pass_hash, \"\")\r\n hash == BCrypt::Engine.hash_secret(password, salt)\r\n end",
"def encrypt_password\n if new_record?\n self.salt = make_salt\n self.password_digest = encrypt(password_digest)\n end\n end",
"def set_password pass\n self.pass_salt = SHA256Salt.generate_random\n self.pass_hash = WodaHash.digest(self.pass_salt + pass).to_hex\n end",
"def save\r\n if valid_password?\r\n super\r\n else\r\n false\r\n end\r\n end",
"def update_hash!(password)\n self.password = password\n hash_password\n save\n end",
"def cdb_save\n cdb_set_password( @new_password, @confirm_new_password ) if @new_password\n @new_password, @confirm_new_password = nil, nil # Just to ensure that we don't save them!\n results = couchdb.store(\"webui_user\", @name, self)\n @couchdb_rev = results[\"rev\"]\n results\n end",
"def password=(pass)\n @password=pass\n # self.password_updated_at = Time.now()\n salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp\n self.password_salt, self.password_hash = salt, Digest::SHA256.hexdigest(@password + salt)\n end",
"def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = encrypt(password)\n end",
"def password=(pwd)\n @password = pwd\n return if pwd.blank?\n create_new_salt\n self.hashed_password = Agent.encrypted_password(self.password, self.salt)\n end",
"def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend",
"def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend",
"def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = User.encrypt(password,self.salt)\n end",
"def create_password\n self.salt = User.make_salt(self.username)\n self.hashed_password = User.hash_with_salt(@password, self.salt)\n end",
"def hash_password # We'll call this method in the seed file; from https://gist.github.com/mdang/7b6097cc13b07db82c78\n if password.present?\n self.password_digest = BCrypt::Password.create(password)\n end\n end",
"def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end",
"def hash_password\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.password_digest = BCrypt::Engine.hash_secret(self.password, self.salt)\n \t\tself.password = nil\n \tend",
"def encrypt_password\n return if self.password.blank?\n \n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.username}--\") if self.new_record?\n self.crypted_password = self.encrypt(self.password)\n end",
"def hash_password!\n\t\t@password = BCrypt::Password.create(@password) \t\n\tend",
"def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end",
"def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def encrypt_password\n if password.present?\n #create salt password\n self.salt_password = BCrypt::Engine.generate_salt\n #create hash password\n self.password = BCrypt::Engine.hash_secret(password,salt_password)\n end\n end",
"def encrypt_password\n\t\treturn if password.blank?\n\t\tif new_record?\n\t\t\tself.salt = Digest::SHA1.hexdigest(\"--#{Time.now}--#{name}--\")\n\t\tend\n\t\tself.encrypted_password = User.encrypt(password, salt)\n\tend",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n if self.password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def encrypt_passhash\n if passhash_changed?\n self.salt = BCrypt::Engine.generate_salt\n self.passhash = BCrypt::Engine.hash_secret(passhash, salt)\n end\n end",
"def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n\n p \"hashed password==\", self.hashed_password\n end",
"def save\n puts \"############## aqui...\"\n # create a user\n c = Usuario.new\n c.email = \"isac.coelho@gmail.com\"\n c.password_hash = '123'\n c.password_hash.encrypted?\n c.save\n \n end",
"def password=(new_pass)\n validate_password new_pass\n self.password_salt = User.random_string\n self.password_hash = digest(new_pass)\n end",
"def encrypt_password\n return if password.blank?\n self.salt = User.make_token if new_record?\n self.crypted_password = encrypt(password)\n end",
"def password= passwd\n return unless passwd\n new_salt = User.fresh_salt\n self.passworddate = Date.today.to_s\n self.salt = new_salt\n self.send(:write_attribute, :password, User.password_hash(passwd.to_s, new_salt))\n end",
"def password=(pass)\n @good_password = false if system(\"look \\\"#{pass.downcase}\\\" > /dev/null 2>&1\")\n super Encrypt::Password.createHash pass\n end",
"def encrypt_password\n # It should be, because we're validating it's presence!\n if password.present?\n # Generate a salt we'll use to hash the password\n self.password_salt = BCrypt::Engine.generate_salt\n # Actually hash the password\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def update_attributes_and_password(attrs)\n self.assign_attributes(attrs)\n self.valid?\n if self.password.present? && confirm_passwords\n self.password_hash = Digest::SHA256.hexdigest(self.password + Rails.application.secrets.salt)\n end\n if self.errors.empty?\n self.save\n end\n end",
"def set_password(password) \n\t\t#Generate salt\n\t\tbase = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n\t\tsalt = (0...50).map{ base[rand(base.length)] }.join\n\t\t\n\t\tenc_password = Digest::SHA1.hexdigest(salt+password)\n\t\t\n\t\tself.salt = salt\n\t\tself.password = enc_password\n\t\tself.temp_password = nil\n\t\tself.save\n\tend",
"def password=(pwd)\n @password = pwd\n\n self.password_digest = BCrypt::Password.create(pwd)\n\n self.save\n end",
"def hash_password\n return if password.blank?\n self.password_hash = Password.create(password)\n end",
"def saved_password\n @saved_password ||= BCrypt::Password.new(encrypted_password)\n end",
"def seed_admin\n\t\t\tAdmin.create(email: 'admin@euroso.com', password: \"123qweAadmin\")\n\t\t\tp \"Pease login to admin using email - admin@euroso.com and password - 123qweAadmin \"\n\t\tend",
"def password=(new_pw)\n @password = Password.create(new_pw)\n self.password_hash = @password\n end",
"def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n end",
"def crypt_password\n write_attribute \"password\", self.class.sha1(self.class.generate_salt, password)\n @password = nil\n end",
"def hash_password\n self.password_salt = SecureRandom.base64(8) if self.password_salt == nil\n self.hashed_password = Digest::SHA1.hexdigest(self.password_salt + self.password)\n end",
"def password=(pwd)\n\t\t@password=pwd\n\t\treturn if pwd.blank?\n\t\tcreate_new_salt\n\t\tself.hashed_password = User.encrypted_password(self.password, self.salt)\n\tend",
"def encrypt_password\n unless password.blank?\n self.salt = BCrypt::Engine.generate_salt\n self.fish = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def hash_new_password\n self.encrypted_password = BCrypt::Password.create(@new_password)\n end",
"def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end",
"def password=(pw)\n @password = pw #used by confirmation validator\n salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp # 2^48 combos\n self.password_salt, self.password_hash =\n salt, User.hashed_password(pw, salt)\n end",
"def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end",
"def crypt_password\n \t\twrite_attribute \"password\", self.class.sha1(password) unless self.password.empty?\n end",
"def encrypt_password\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end",
"def password=(new_password); end",
"def update_password\n\t\t@admin = current_admin\n\t\tif(@admin.update_attributes(params[:admin]))\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :action => \"reset\"\n\t\tend\n\tend",
"def password=(password)\n @password = password\n if password.present?\n generate_salt\n self.hashed_password = self.class.encrypt_password(password, salt)\n end\nend",
"def password=(unencrypted_password) #setter method for password.\n unless unencrypted_password.empty? #if there is no password, take the inputed password, salt and hash it. Then set it in the record for that user. \n @password = unencrypted_password\n self.password_digest = BCrypt::Password.create(unencrypted_password)\n end\n end",
"def password=(pass)\n @password = pass\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_encrypted = BCrypt::Engine.hash_secret(pass, self.password_salt)\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def password=(val)\n return if val.blank?\n attribute_set(:salt, Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{name}--\")) if new?\n attribute_set(:crypted_password, val.encrypt(self.salt))\n end",
"def encrypt_password\n\n if password.present?\n\n self.password_salt = BCrypt::Engine.generate_salt\n\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n\n end \n\n end",
"def hash_password\n self.hashed_password = BCrypt::Password.create(self.hashed_password)\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def encrypt_password!\n if( !password.blank? )\n self['encrypted_password_store'] = BCrypt::Password.create( password, :cost => 11 )\n password, password_confirmation = nil, nil\n end\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end",
"def check_admin_user(password=\"spree\", email=\"spree@example.com\")\n admin = User.find_by_login(email) || User.create( :password => password,:password_confirmation => password,\n :email => email, :login => email )\n # create an admin role and and assign the admin user to that role\n admin.roles << Role.find_or_create_by_name(\"admin\")\n admin.save!\n end",
"def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end",
"def encrypt_password()\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def password=(pw)\n @password = pw\n if pw and pw.size > 0\n self.salt = rand(100000000)\n self.hashed_password = Member.hashed_password(pw, self.salt)\n end\n end",
"def save_passwords?\n self.savepwds == 'YES'\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def hash_password\n\t\t# Is there a password set in the model? If not then do nothing\n\t\tif password.present?\n\t\t\treturn self.password_digest = BCrypt::Password.create(password)\n\t\tend\n\tend",
"def crypt_password\n\t\twrite_attribute \"password\", self.class.sha1(password)\n\tend",
"def encrypt_password\n if self.password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(self.password, salt)\n end\n end",
"def change_password(new_pass)\n self.salt = User.gen_salt\n salted_pass = User.salt_password(new_pass, self.salt)\n self.password = salted_pass\n end",
"def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end",
"def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end",
"def update_staffs_password(password, password_confirmation)\n self.update_attributes(password: password, password_confirmation: password_confirmation)\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(self.password)\n end",
"def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end",
"def stored_node_password\n if node['mysql']['local_admins'] && node['mysql']['local_admins'][new_resource.user]\n node['mysql']['local_admins'][new_resource.user]['password']\n end\n end",
"def set_password=(new_password)\n self.password = Password.create(new_password)\n self.save\n end",
"def password_encrypt\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def update_password(newpwd)\n self.password = Utils.sha1(newpwd + 'ad2012spot' + email)\n end",
"def set_temp_password() \n\t\t#Generate new password\n\t\tpassword = User.generate_password()\n\t\t\n\t\tsalt = self.salt\n\t\tenc_password = Digest::SHA1.hexdigest(salt+password)\n\t\t\n\t\tself.temp_password = enc_password\n\t\tself.save\n\t\t\n\t\t#Ignore temp password if user is already logged in\n\t\tself.temp_password = nil\n\t\t\n\t\t#Notify user\n\t\tAppMailer.temporary_password_created(self, password).deliver\n\tend",
"def password=(pwd)\n return if pwd.blank?\n @password = pwd.to_s\n salt = HasPassword.random_hex(self.class.salt_length)\n self.password_salt = salt\n self.password_hash = HasPassword.encrypt(@password, salt)\n end"
] |
[
"0.69242066",
"0.6907935",
"0.6779018",
"0.6631843",
"0.651768",
"0.65106",
"0.648056",
"0.6426778",
"0.6382841",
"0.6331234",
"0.6310939",
"0.63054407",
"0.6302917",
"0.63028574",
"0.62918323",
"0.62731266",
"0.62249255",
"0.6209997",
"0.61880714",
"0.6187574",
"0.6185089",
"0.6185089",
"0.6180297",
"0.6163661",
"0.61632174",
"0.61383164",
"0.6136836",
"0.6133578",
"0.61289775",
"0.6127273",
"0.610221",
"0.6097679",
"0.6096227",
"0.6094856",
"0.6093486",
"0.6090381",
"0.6089726",
"0.6087199",
"0.6082638",
"0.6080909",
"0.6080566",
"0.60735744",
"0.6072642",
"0.606034",
"0.60600764",
"0.60595834",
"0.60554874",
"0.6040001",
"0.60372627",
"0.6025404",
"0.60245925",
"0.60188836",
"0.6009009",
"0.6008816",
"0.60058856",
"0.5999656",
"0.5998211",
"0.59978426",
"0.5995786",
"0.5986663",
"0.5985759",
"0.59813917",
"0.5980547",
"0.59804684",
"0.59782445",
"0.5970365",
"0.59680647",
"0.59612495",
"0.59612495",
"0.59612495",
"0.59612495",
"0.59612495",
"0.595889",
"0.5956436",
"0.59460175",
"0.5941666",
"0.5934146",
"0.59339184",
"0.5925859",
"0.59256965",
"0.5923459",
"0.5922633",
"0.5921289",
"0.59157234",
"0.59157234",
"0.59140265",
"0.5912709",
"0.5895244",
"0.58932686",
"0.58876294",
"0.58876294",
"0.58869076",
"0.58851224",
"0.58833843",
"0.5882199",
"0.5881703",
"0.58801234",
"0.5865352",
"0.5863632",
"0.5862757"
] |
0.7605614
|
0
|
def index if user_signed_in? if current_user.legal_name.present? user_session_path(current_user) else edit_user_registration_path(current_user) end end end
|
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:company_name, :email, :password, :password_confirmation, :current_password)}
# devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:password, :email)}
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:company_name, :email, :password, :password_confirmation, :current_password, :legal_name,
:dba, :billing_address_line_1, :billing_address_line_2, :billing_city, :billing_state, :billing_zip, :billing_phone_number, :info_website, :info_company_description, :info_hours, :info_customer_service_phone,
:info_accounts_payable_person, :info_marketing_manager, :owner_direct_name, :owner_direct_email, :owner_direct_phone, :dropbox_info)}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n \tif user_signed_in?\n \t\tname = current_user.name(false)\n# TODO: Investigate if this is even relevant anymore. The name var will never be blank here because the logic in\n# User says to return the email if the firstname and surname are empty regardless of the flag passed in\n \t\tif name.blank?\n \t\t\tredirect_to edit_user_registration_path\n \t\telse\n \t\t\tredirect_to plans_url\n \t\tend\n \tend\n end",
"def index\n # if !user_signed_in?\n # redirect_to new_user_session_path\n # end\n end",
"def index\n if signed_in?\n redirect_to current_user\n else\n redirect_to new_user_path\n end\n end",
"def index\n redirect_to after_sign_in_path_for current_user if current_user\n end",
"def index\n redirect_to after_sign_in_path_for current_user if current_user\n end",
"def index\n redirect_to @current_user if current_user\n end",
"def show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def index?\n user.present?\n end",
"def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end",
"def index\n if !user_signed_in?\n redirect_to home_path\n elsif current_user.admin?\n redirect_to admin_portal_path\n else\n redirect_to portal_path\n end\n end",
"def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end",
"def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end",
"def show\n if current_user && current_user.admin?\n else\n #flash[:notice] = \"No such page exists\"\n redirect_to new_sponsorship_path\n end \n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def index\n redirect_to user_path(current_user)\n end",
"def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end",
"def index\n\t\tif signed_in?\n \t\t user=User.find(session[:user_id])\n \t\tcase user.role\n \twhen \"s\"\n \t\tredirect_to supervisor_index_path and return\n \twhen \"a\"\n \t redirect_to receptionnist_index_path and return\n \tend\t\n \tend\n\tend",
"def index\n @username = (is_admin? ? params[:id] : current_user_model.username)\n @pronoun = (is_admin? ? \"\" : \" Your \")\n @username = current_user_model.username if @username.blank?\n if is_admin?\n @investigators = Investigator.by_name\n render :action => 'admin_index'\n else\n render\n end\n end",
"def index\n if instructor_signed_in? and current_instructor.is_admin\n # Only an admin has access to this information. Ohter instructors will not get the link\n @instructor = Instructor.all\n else \n redirect_to root_path\n return\n end\n end",
"def index\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = User.find(session[:user_id])\n end\n end",
"def index\n if current_user\n if current_user.role == 2\n redirect_to users_adminhome_path\n else\n redirect_to home_user_path(current_user)\n end\n else\n redirect_to new_session_path\n end\n #@users = User.all\n\n end",
"def index\n if user_signed_in? \n if current_user.email == \"ale@ale.cl\"\n @alejandros = Alejandro.all\n else\n redirect_to shops_path\n end\n else\n redirect_to shops_path\n end\n \n end",
"def after_sign_in_path_for(user)\n if user.registration_complete\n \t dashboard_index_path\n else\n edit_user_registration_path\n end\n end",
"def index\n @current_user = current_user if signed_in?\n end",
"def index\n\t\tredirect_to dashboard_users_path if current_user\n\tend",
"def index\n redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface\n end",
"def index \n @patients = current_user.patients \n # Which patients should a user see when they're logged in? \n # We only show the patients that belong to the current user.\n # With devise, current_user is accessible in controllers and views. \n # If there is no current user or a User isn't logged in we're redirected to login ?? \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def index\n if confirm_logged_in\n redirect_to new_user_reservation_path(session[:user_id] || cookies[:user_id])\n end\n end",
"def index\n return_path users_path # !!! same as line 10?\n# @is_first_user = User.first.id == 1\n# session[:go_to_after_edit] = users_path\n @users = User.search(params[:search]).order(sort_column + \" \" + sort_direction).page(params[:page]).per(25)\n @menu='admin'\n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end\n end",
"def index\n if Administrator.find_by_user_id(current_user.id).admin\n @users = User.all\n else\n redirect_to root_path\n end\n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def index\n if !current_user\n redirect_to '/'\n end\n\n if current_user.email == 'samir@test.com' || current_user.email == 'priyatham.ven@gmail.com'\n @critiques = Critique.all\n else\n redirect_to '/'\n end\n end",
"def index\n # If someone is signed in on the browser\n if signed_in?\n # Take the user to their profile page\n redirect_to \"/#{@current_user.name}\"\n # Abort execution\n return\n end\n \n # Don't use an application layout.\n render layout: false\n end",
"def user\n if !user_signed_in? \n redirect_to '/404.html'\n end\n end",
"def index\n # Shut up I know this is stupid\n @users = User.all\n unless user_signed_in? and current_user.is_admin?\n redirect_to root_path, notice: \"Log in first\"\n end\n end",
"def index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end",
"def index\n @user = User.find(params[:user_id])\n @conditions = @user.conditions\n\n if current_user.id == @user.id\n\t\t\trender action: :index\n\t\telse\n\t\t\trender file: 'public/denied'\n\t\tend\n end",
"def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end",
"def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end",
"def after_sign_in_path_for(_resource)\n if current_user && current_user.sign_in_count == 1\n edit_user_path(current_user)\n elsif current_user.sports.empty? || current_user.goals.empty?\n edit_user_path(current_user)\n else\n root_path\n end\n end",
"def index\n redirect_to current_user\n end",
"def redirect_to_index\n redirect_to :action => 'index' unless current_user\n @user = current_user\n end",
"def index\n if !session[:token].nil?\n if (session[:user_id] == 'superadmin')\n redirect_to admin_companies_path\n else\n redirect_to dashboard_path\n end\n else\n render layout: false\n end\n end",
"def show\n if not ( paziente_signed_in? or administrator_signed_in?)\n redirect_to root_path and return\n end\n end",
"def index\n redirect_to :nieuw if current_user\n end",
"def index\n if not current_user.role? :admin\n redirect_to root_path\n end\n end",
"def index\n @current_user ||= User.find_by(id: session[:user_id])\n if current_user.is_admin?\n @users = User.all\n else\n redirect_to '/home'\n end\n end",
"def check_user\n if current_user.blank?\n puts\"false\"\n new_user_session_path\n else\n puts\"true\"\n end\n end",
"def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end",
"def index\n redirect_to disabled_path\n # unless logged_in?\n # redirect_to tour_path\n # else\n # @current_item = \"my_hsa\"\n # end\n end",
"def reg_only!\n\tif !current_user || current_user.pro || current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end",
"def index\n if current_user.role == \"super_admin\" || current_user.role == \"admin\" #[99, 100]\n @users = User.all\n else\n redirect_to user_path(current_user)\n end\n end",
"def show\n if !current_user || current_user.status != \"1\"\n redirect_to new_user_session_path\n end\n end",
"def index\n\n if user_signed_in?\n if current_user.id == 1\n @users = User.all\n else\n flash[:error] = \"Não tens permissões para realizar tal acção!\"\n redirect_to root_url\n end\n elsif params[:type] == 'admin'\n @users = User.all\n else\n flash[:error] = \"Não tens permissões para realizar tal acção!\"\n redirect_to root_url\n end\n\n end",
"def show\n if user_signed_in?\n else\n redirect_to root_path\n end\n end",
"def show\n if !current_user.isAdmin? and current_user.id != @user.id\n redirect_to user_path(current_user.id)\n end\n end",
"def index\n redirect_to(:action => 'signup') unless logged_in? or User.count > 0\n end",
"def index\n redirect_to(:action => 'signup') unless logged_in? or User.count > 0\n end",
"def ownerOrAdmin\n if not signed_in? && (Greenroof.find_by_id(params[:id]).user_id == current_user.id || current_user.admin?)\n redirect_to root_url\n end\n end",
"def index\n if current_user && current_user.admin? \n @users = User.all\n respond_with users_path\n else\n flash[:notice] = 'You do not have rights to see the list of users.'\n redirect_to home_index_path\n end\n end",
"def check_user\n\n redirect_to root_path if current_user == nil\n if current_user \n redirect_to root_path if current_user.vendor == false\n end\n end",
"def index\n if @current_user[:role] == 'admin'\n @users = User.all\n else \n redirect_to root_path\n end\n end",
"def index\n redirect_to user_path(@user)\n end",
"def show\n self.current_user\n \n if not @current_user\n redirect_to login_path\n else\n render :action => 'edit'\n end\n end",
"def index\n if((current_user!=nil && current_user.rol!=\"messenger\"))\n if (current_user!=nil && current_user.rol==\"admin\")\n @user=User.find(params[:id])\n elsif(current_user!=nil && current_user.rol==\"regular\")\n @user=current_user\n end\n @locations = @user.locations\n \n else\n redirect_to root_path\n end\n end",
"def index?\n # @current_user.admin?\n end",
"def show\n unless current_user && current_user.id == @user.id || current_user && current_user.role == 'admin'\n redirect_to root_path\n end\n end",
"def index\n \tputs \"home#index\"\n \tputs params\n \t# puts user_signed_in?\n # puts user_session[:username].empty?\n \t# puts current_user \n \t# puts current_user.id\n \t# puts current_user.username \n \t# puts current_user.email\n \t# user_session\n # user_session[:username] = current_user.username\n # user_session[:useremail] = current_user.email\n \t# puts user_session.blank?\n \t# puts devise_controller?\n \t# puts controller_name\n \n end",
"def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end",
"def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end",
"def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end",
"def index?\n @current_user.admin?\n end",
"def index\n if current_user.nil?\n show_empty\n elsif current_user.role.id == 1\n show_analist\n elsif current_user.role.id == 2\n show_qa_analist\n elsif current_user.role.id == 3\n show_planner\n elsif current_user.role.id == 5\n show_admin\n else\n show_empty\n end\n end",
"def index\n @user = current_user\n if @user.is_admin\n @users = User.all\n # @licenses = @user.license\n elsif @user.licensed\n @users = User.where(id: current_user.id)\n else\n redirect_to licenses_stub_path\n end\n end",
"def check_if_current_user_page\n redirect_to('/') and return unless (current_user.id == User.from_param(params[:id])) || current_user.is_admin?\n end",
"def index\n\n\n # if ( !current_user || !current_user.isAdmin )\n # render :text => \"You are not authorized to see this page\", :layout => true\n #\n # return\n # end\n\n @users = User.all\n end",
"def index\n if(Admin.new.type== current_user.type)\n @instructors = Instructor.all\n else\n flash[:danger] = \"You are not authorized to view this page!\"\n redirect_to user_path(current_user.id)\n end\n end",
"def after_sign_in_path_for(user)\n @user = current_user\n if (@user.bio && @user.skills != nil) \n user_path(@user.id)\n else \n edit_user_registration_path\n end \n end",
"def index\n if current_user.admin?\n @users = User.all\n end\n \n end",
"def index\n if logged_in\n redirect_to profile_path\n end\n end",
"def show\n redirect_to users_index_url\n end",
"def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end",
"def edit\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def check_current_user\n redirect_to '/' unless @user.id == current_user.id\n end",
"def show\n if not signed_in?\n redirect_back_or signin_path\n end\n end",
"def index\n # FIXME: if logged in as an author, only show own user's crUd stuff; for\n # admins, show all CRUD operations for all users\n if logged_in?\n @users = User.order(:name)\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Cannot view all users.' }\n end\n end\n end",
"def index\n if current_user && current_user.role == 'admin'\n @users = User.all\n else\n redirect_to root_path\n end\n end",
"def index\n @loggedin_user=current_user.name\n @users = User.all\n end",
"def index\n # only admins see the whole user list\n if current_user && current_user.is_admin\n @users = User.all\n render :index\n else\n redirect_to \"/\"\n end\n end",
"def index\n @user = current_user\n end",
"def index\n if session[:user]\n redirect_to :controller => 'profile', :action => 'show'\n end\n end",
"def show\n if current_user.rol != \"bioquimica\"\n redirect_to '/'\n end\n end",
"def show\n current_email = current_user.email\n if !current_user.admin? && current_email.gsub(\".\",\"-dot-\") != params[:id]\n flash.keep[:notice] = 'You must be an administrator to access that feature.'\n redirect_to '/'\n end\n super\n end",
"def index\n if logged_in?\n redirect_to :controller => 'account', :action => 'mypage'\n else\n if User.count > 0\n redirect_to :controller => 'account', :action => 'signup'\n else\n redirect_to :controller => 'recommend', :action => 'question'\n end\n end\n end",
"def index\n unless current_user == User.find(1)\n redirect_to root_url\n end\n @users = User.all\n end"
] |
[
"0.81672263",
"0.7306332",
"0.72463214",
"0.70591635",
"0.70591635",
"0.7022086",
"0.69894564",
"0.6962173",
"0.6940778",
"0.69293",
"0.6886878",
"0.6879392",
"0.6874846",
"0.68659586",
"0.68659586",
"0.6854447",
"0.68541944",
"0.68356895",
"0.6829055",
"0.6798437",
"0.678745",
"0.6773047",
"0.6767508",
"0.6762246",
"0.6744008",
"0.67391336",
"0.6730785",
"0.6718798",
"0.6707647",
"0.67048174",
"0.6698199",
"0.66938376",
"0.6691071",
"0.668561",
"0.668561",
"0.668561",
"0.66847885",
"0.66795254",
"0.6679058",
"0.66754985",
"0.66709113",
"0.6670553",
"0.6665697",
"0.6665697",
"0.66500324",
"0.6644748",
"0.6639605",
"0.66382784",
"0.6628097",
"0.6623573",
"0.66225994",
"0.66192025",
"0.6607778",
"0.6595929",
"0.65932333",
"0.65889597",
"0.65847087",
"0.6579227",
"0.6577764",
"0.65743893",
"0.6574179",
"0.6569364",
"0.6560198",
"0.6560198",
"0.6559589",
"0.65554607",
"0.65536994",
"0.6546184",
"0.6546046",
"0.6535528",
"0.65352106",
"0.65344906",
"0.6533184",
"0.6532801",
"0.6529109",
"0.6529109",
"0.6529109",
"0.65226614",
"0.6520912",
"0.6517248",
"0.6516304",
"0.65145934",
"0.6509776",
"0.6501552",
"0.6501067",
"0.6496764",
"0.6496336",
"0.6494488",
"0.6489671",
"0.6485591",
"0.6457006",
"0.64520043",
"0.6447188",
"0.6446442",
"0.64436835",
"0.6442776",
"0.6440936",
"0.643657",
"0.6432048",
"0.6422635",
"0.64208853"
] |
0.0
|
-1
|
the recommendations made by some user
|
def user
recommendations 'user'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end",
"def recommended_by_current_user\n if current_user\n extract = Csvarchive.find(params[:id])\n e_rec = extract.recommendations\n u_rec = current_user.recommendations\n all_rec = e_rec & u_rec\n if !all_rec.empty?\n @recommended = true\n else\n @recommended = false\n end\n else\n @recommended = false\n end\n end",
"def recommendation\n return @recommendation\n end",
"def recommendations\n unless params[:user_id].present?\n render json: { response: 'User id not present' }, status: :bad_request\n end\n\n user = User.find_by_id(params[:user_id])\n recommendations = []\n\n user.movies.each do |movie|\n recommendations_for_movie = Tmdb::Movie.recommendations(movie[:id])\n recommendations_for_movie[:results].each do |recommendation|\n recommendations << recommendation\n end\n end\n\n render json: { response: recommendations }, status: :ok\n end",
"def recommend\n recs = []\n User.all.each do |user|\n if user.hotspots.include?(self)\n user.hotspots.each do |hs|\n recs << hs\n end#user.hotspots end\n end#if include? end\n return recs.uniq\n end#users.each end\n end",
"def recommendations_for(obj)\n recommend_by_item_based obj\n end",
"def recommendation=(value)\n @recommendation = value\n end",
"def recommend_for_user(user,opts={})\n o = slope_one_options\n q = %Q{\n SELECT a.*\n FROM #{o[:resource_table]} a, (#{frequency_matrix}) f\n JOIN #{o[:rating_table]} r1 ON r1.#{o[:resource_key]} = f.target_id\n LEFT JOIN #{o[:rating_table]} r2 ON r2.#{o[:resource_key]} = f.source_id AND r2.#{o[:rater_key]} = r1.#{o[:rater_key]}\n WHERE r1.#{o[:rater_key]} = ?\n AND f.frequency > 0 \n AND a.id = f.source_id\n #{\"AND r2.#{o[:resource_key]} IS NULL\" if opts[:exclusive]}\n GROUP BY f.source_id, a.id\n ORDER BY ( SUM(f.difference + f.frequency * r1.#{o[:rating_property]}) / SUM(f.frequency) ) DESC LIMIT ?;\n }\n find_by_sql [q, user.id, opts[:limit] || 20]\n end",
"def rates_by\n recommendable_likes.map(&:user_id) + recommendable_dislikes.map(&:user_id)\n end",
"def get_user_recommendations\n recommendations = []\n csv = open( CONFIG['SPREADSHEET_URL'] ).read\n CSV.parse( csv ).each_with_index do |line,i|\n next if i == 0 # Skip header\n date, title, category, url, note, person = *line\n next if category.match(/^Other/) # Looking at specific categories - Other is too broad\n if matches = url.match(%r{/(?:dp|product|ASIN)/([^/]*)})\n recommendations << {\n :id => matches[1],\n :category => category\n }\n end\n end\n recommendations\n end",
"def recommendations\n @recommendations = []\n @connection.response_data.map do |rec|\n recommendation = {}\n recommendation['name'] = rec[\"name\"]\n recommendation['rating'] = rec[\"rating\"] \n recommendation['price'] = rec[\"price_level\"]\n recommendation['address'] = rec[\"vicinity\"]\n @recommendations << recommendation\n end\n @recommendations\n end",
"def recommendations_menu\n if @user.mylist.length.positive?\n recommendation = Rec.new(@user)\n recommendation.amount_of_suggestions\n else\n no_items\n end\n end",
"def update_recommendations_for(user_id)\n user_id = user_id.to_s\n\n nearest_neighbors = Recommendable.config.nearest_neighbors || Recommendable.config.user_class.count\n Recommendable.config.ratable_classes.each do |klass|\n rated_sets = [\n Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.hidden_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.bookmarked_set_for(klass, user_id)\n ]\n temp_set = Recommendable::Helpers::RedisKeyMapper.temp_set_for(Recommendable.config.user_class, user_id)\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n recommended_set = Recommendable::Helpers::RedisKeyMapper.recommended_set_for(klass, user_id)\n most_similar_user_ids = Recommendable.redis.zrevrange(similarity_set, 0, nearest_neighbors - 1)\n least_similar_user_ids = Recommendable.redis.zrange(similarity_set, 0, nearest_neighbors - 1)\n\n # Get gems from the most similar users\n sets_to_union = most_similar_user_ids.inject([]) do |sets, id|\n sets << Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id)\n end\n\n # Get disgems from the least similar users\n least_similar_user_ids.inject(sets_to_union) do |sets, id|\n sets << Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, id)\n end\n\n return if sets_to_union.empty?\n\n # SDIFF rated items so they aren't recommended\n Recommendable.redis.sunionstore(temp_set, *sets_to_union)\n item_ids = Recommendable.redis.sdiff(temp_set, *rated_sets)\n scores = item_ids.map { |id| [predict_for(user_id, klass, id), id] }\n scores.each do |s|\n Recommendable.redis.zadd(recommended_set, s[0], s[1])\n end\n\n Recommendable.redis.del(temp_set)\n\n if number_recommendations = Recommendable.config.recommendations_to_store\n length = Recommendable.redis.zcard(recommended_set)\n Recommendable.redis.zremrangebyrank(recommended_set, 0, length - number_recommendations - 1)\n end\n end\n\n true\n end",
"def recommend_new_users\n user_ids = following_ids + [self.id]\n User.only(:id, :name, :avatar, :recommend_note).nin(id: user_ids).desc(:recommend_priority, :karma)\n end",
"def personalized_recommendations(customer_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.recommended(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def recommendation()\n @type.recommendation(self)\n end",
"def recommend_artists(current_user, recommended_user)\n recommended_artists = Array.new\n artists = retrieve_favourite_artists(recommended_user)\n artists.each do |artist|\n unless current_user.artists.to_a.include?(artist[0]) || recommended_artists.length >= 10\n recommended_artists << artist[0]\n end\n end\n recommended_artists\n end",
"def get_recommendations\n SpotifyApiAdapter.get_recommendations(self)\n end",
"def update_recommendations_for(user_id)\n user_id = user_id.to_s\n\n Recommendable.set_shard_key user_id\n\n nearest_neighbors = (Recommendable.config.nearest_neighbors || Recommendable.config.user_class.count).to_i\n Recommendable.config.ratable_classes.each do |klass|\n rated_sets = [\n Recommendable::Helpers::RedisKeyMapper.liked_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.disliked_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.hidden_set_for(klass, user_id),\n Recommendable::Helpers::RedisKeyMapper.bookmarked_set_for(klass, user_id),\n ]\n temp_set = Recommendable::Helpers::RedisKeyMapper.temp_set_for(klass, user_id)\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n recommended_set = Recommendable::Helpers::RedisKeyMapper.recommended_set_for(klass, user_id)\n most_similar_user_ids, least_similar_user_ids = Recommendable.redis.pipelined do\n Recommendable.redis.zrevrange(similarity_set, 0, nearest_neighbors - 1)\n Recommendable.redis.zrange(similarity_set, 0, nearest_neighbors - 1)\n end\n\n # Get likes from the most similar users\n sets_to_union = most_similar_user_ids.inject([]) do |sets, id|\n sets << Recommendable::Helpers::RedisKeyMapper.liked_set_for(klass, id)\n end\n\n # Get dislikes from the least similar users\n sets_to_union = least_similar_user_ids.inject(sets_to_union) do |sets, id|\n sets << Recommendable::Helpers::RedisKeyMapper.disliked_set_for(klass, id)\n end\n\n return if sets_to_union.empty?\n\n # SDIFF rated items so they aren't recommended\n Recommendable.redis.sunionstore(temp_set, *sets_to_union)\n item_ids = Recommendable.redis.sdiff(temp_set, *rated_sets)\n\n item_ids.each do |id|\n Recommendable.redis.eval(predict_for_lua('((liked_by_count + disliked_by_count) > 0) and similarity_sum / (liked_by_count + disliked_by_count) or 0'),\n [ recommended_set ],\n [ user_id, id,\n Recommendable.config.redis_namespace,\n Recommendable.config.user_class.to_s.tableize,\n klass.to_s.tableize ])\n end\n\n Recommendable.redis.del(temp_set)\n\n if Recommendable.config.recommendations_to_store\n number_recommendations = Recommendable.config.recommendations_to_store.to_i\n length = Recommendable.redis.zcard(recommended_set).to_i\n Recommendable.redis.zremrangebyrank(recommended_set, 0, length - number_recommendations - 1) if length > number_recommendations\n end\n end\n\n true\n end",
"def recommendations\n @user.community.events.upcoming.where(:owner_type => \"Feed\").map do |e|\n EventRecommendation.new(e)\n end\n end",
"def recommendations\n User.where.not(id: self.friends).or(User.where.not(id: self.inverse_friends)).limit(5)\n end",
"def show\n @user = User.find(params[:id])\n @recommendation = @user.recommendations.build if logged_in?\n end",
"def recommendations\n\t @recommendations = Restaurant.find(params[:id]).recommendations\n\t \n\t respond_to do |format|\n\t\t format.html # recommendations.html.erb\n\t \t format.json { render json: @recommendations.to_json(except: [ :created_at, :updated_at ]) }\n\t end\n end",
"def recommend(user, recommends)\n @greeting = \"Hi\"\n @user = user\n @recommends = recommends\n mail to: user.email\n end",
"def get_recommendations\n result = []\n DIST[@pain_severity].each do |element|\n unique = false\n while !unique\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n if result.include? recommendation\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n else\n result << recommendation\n unique = true\n end\n end\n end\n result\n end",
"def recommend\n @user = current_user\n @pods = @user.pods\n @podsname = @pods.last.name\n\n if @podsname == nil\n @query = Pod.search do \n fulltext \"djsadpkapodpoakd;sad\"\n end\n @podslist = @query.results\n else\n @query = Pod.search do\n fulltext (@podsname)\n end\n @podslist = @query.results \n end \n\n end",
"def recommend_by_item_based(user, top = @default_recommendation_count)\n return unless @similarity_matrix\n \n weighted_similar_items = Hash.new(0.0)\n similarity_sum_per_item = Hash.new(0.0)\n \n user.list.items.each_value do |user_item|\n item = @items[user_item.id]\n \n sim_objs = @similarity_matrix[item.id]\n sim_objs.each do |obj|\n next if user.has_item? obj[:id]\n weighted_similar_items[obj[:id]] += user_item.rating * obj[:similarity].abs\n similarity_sum_per_item[obj[:id]] += obj[:similarity].abs\n end\n end\n \n recommendations = weighted_similar_items.collect do |k, v|\n next if v == 0.0 or similarity_sum_per_item[k] == 0.0\n { :id => k, :est => (v / similarity_sum_per_item[k]) }\n end\n recommendations.compact.sort{ |x, y| y[:est] <=> x[:est] }.first(top || recommendations.size)\n end",
"def suggest\r\n if current_user and !(current_user.followed_topic_ids.blank? and current_user.following_ids.blank?)\r\n elim = current_user.is_expert ? 3 : 2\r\n ulim = current_user.is_expert ? 0 : 1\r\n tlim = 2\r\n e,u,t = UserSuggestItem.find_by_user(current_user)\r\n @suggested_experts = e.blank? ? [] : User.any_in(:_id=>e.random(elim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_users = u.blank? ? [] : User.any_in(:_id=>u.random(ulim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_topics = t.blank? ? [] : Topic.any_in(:name=>t.random(tlim))\r\n end\r\n end",
"def index\n @recommendations = Recommendation.all\n end",
"def getRecommendations()\n totals=Hash.new(0)\n simSum=Hash.new(0)\n \n \n @prefs.each_pair do |other,ranks|\n \n # next if it's me\n next if other == @person\n \n # check the affinity \n sim = @similarity.compute(other)\n \n # next if no affinity\n next if sim <= 0\n \n # for each unranked element\n ranks.each_pair do |name,rank|\n if !@prefs[@person].include?(name) or @prefs[@person].length == 0\n \n totals[name] += rank * sim\n simSum[name] += sim\n \n end\n end \n end\n \n # Array creation\n totals.to_a.collect do |e|\n [e[1]/simSum[e[0]],e[0]]\n end.sort do |a,b|\n b[0] <=> a[0]\n end\n \n end",
"def get_recommended_items(data, item_sim, user)\n user_rating = data[user]\n scores = {}\n total_sim = {}\n\n user_rating.each do |item, rating|\n item_sim[item].each do |similarity, item2|\n if user_rating[item2].nil?\n # weighted sum of rating times similarity\n scores[item2] ||= 0\n scores[item2] += similarity*rating\n\n # sum of all similarities\n total_sim[item2] ||= 0\n total_sim[item2] += similarity\n end\n end\n end\n\n rankings = scores.collect do |item, score|\n [score/total_sim[item], item]\n end\n rankings.sort!\n rankings.reverse! \n end",
"def get_recommendation(recommendation_name)\n request_body = {\n identification: identification,\n max_products: 16,\n \trequest: [\n \"details\",\n \"results\"\n ]\n }.compact\n search_response = request_tagalys(\"/recommendations/\" + recommendation_name, request_body)\n end",
"def recommended?(user_id)\n return self.article_recommendations.exists?(user_id: user_id)\n end",
"def my_results(user)\n self.design_review_results.to_ary.find_all { |drr| drr.reviewer == user }\n end",
"def recommended\n @users = popular_users\n\n all_plucked_tags_photo_ids = []\n @tags = popular_tags.map do |tag|\n current_tag_photo_ids = tag.photo_ids\n all_plucked_tags_photo_ids += current_tag_photo_ids[0..7]\n [tag.name, current_tag_photo_ids[0..7]]\n end\n\n @photos = Photo\n .includes(:tags, :likers, :author)\n .where(id: all_plucked_tags_photo_ids)\n\n render :recommended\n end",
"def predict_all\r\n @recommendations = Professional.all.map do |professional|\r\n Recommender.new(professional).recommend\r\n end\r\n true\r\n end",
"def set_movie_user_recommendation\n @recommendation ||= MovieUserRecommendation.find(params[:id])\n end",
"def find_recommendations(doc)\n\t\tnum_recommendations = doc.xpath('//*[@id=\"overview\"]/dd[2]/p/strong/text()')\n\t\t#puts \"Number of recommendations #{num_recommendations}\"\n\t\treturn num_recommendations.to_s.gsub(/\\s+/, ' ')\n\tend",
"def show\n redirect_to root_path if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @player_profile = @user.player_profile\n unless @player_profile.nil?\n @similar_profiles = User.recommender(@player_profile, \"player\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"0\")\n else\n @similar_profiles = nil\n end\n end",
"def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end",
"def user_recommendations user_id, options = {}\n options = options.reverse_merge(default_options)\n klass = options.delete(:object_type) || options.delete(:class)\n\n if klass.present?\n data = request_object.user.send(klass).recommendations.page(options[:page]).limit(options[:limit]).get(user_id)\n else\n data = request_object.user.recommendations.page(options[:page]).limit(options[:limit]).get(user_id)\n end\n return [] if data[\"recommendations\"].blank?\n\n if options[:load]\n return klass.classify.constantize.where(id: data[\"recommendations\"].map { |d| d[\"recommendation_id\"] }) if klass.present?\n return data[\"recommendations\"].map { |d| d[\"object_type\"].classify.constantize.where(id: d[\"recommendation_id\"]).first }.reject(&:nil?)\n end\n data[\"recommendations\"].map { |d| { type: d[\"object_type\"], id: d[\"recommendation_id\"] } }\n end",
"def find_matches \n @current_user = User.find(session[:user_id])\n @user = @current_user\n\n @title = \"Suggested matches for #{@current_user.name}\"\n\n # don't include the current user or existing matches in the possible matches \n @users = (User.all - [@current_user]) - @current_user.matches\n\n # associate each user with the number of shared interests they have with the current user\n users_shared_interests = {}\n @users.each do |user|\n users_shared_interests[user.id] = @current_user.shared_interests(user).size\n end\n\n\n suggested_matches = []\n users_shared_interests.sort_by { |user, count| count }.each do |date|\n suggested_matches << date.first\n end\n suggested_matches = suggested_matches.last(10).shuffle.first(3)\n\n @suggested_matches = []\n suggested_matches.each {|sm| @suggested_matches << User.find(sm) }\n end",
"def getRecommendations(prefs, person, scorefunc = :sim_pearson )\n totals = {}\n simSums = {}\n for other in prefs.keys\n # don't compare me to myself\n next if other == person\n\n if scorefunc == :sim_pearson\n sim = sim_pearson( prefs, person, other)\n else\n sim = sim_distance( prefs, person, other)\n end\n\n # ignore scores of zero or lower\n next if sim <= 0\n\n for item in prefs[other].keys\n # only score movies I haven't seen yet\n if !prefs[person].include? item or prefs[person][item] == 0\n # similarity * score\n totals.default = 0\n totals[item] += prefs[other][item] * sim\n # sum of similarities\n simSums.default = 0\n simSums[item] += sim\n end\n end\n end\n\n # Create a normalized list\n rankings = []\n totals.each do |item,total|\n rankings << [total/simSums[item], item]\n end\n\n # Return the sorted list\n return rankings.sort.reverse\n end",
"def getRecommendations( prefs, person, scorefunc = :sim_pearson )\n totals = {}\n simSums = {}\n for other in prefs.keys\n # don't compare me to myself\n next if other == person\n \n if scorefunc == :sim_pearson\n sim = sim_pearson( prefs, person, other )\n else\n sim = sim_pearson( prefs, person, other )\n end\n puts \"rec sim val: #{sim}\"\n #ignore scores of zero or lower\n next if sim <= 0\n \n for item in prefs[other].keys\n # only score movies I haven't seen yet\n if !prefs[person].include? item or prefs[person][item] == 0\n # similarity * score\n totals.default = 0\n totals[item] += prefs[other][item] * sim\n # sum of similarities\n simSums.default = 0\n simSums[item] += sim\n end\n end\n end\n \n # create a normalised list\n rankings = []\n totals.each do |item,total|\n rankings << [total/simSums[item], item]\n end\n \n # Return the sorted list\n return rankings.sort.reverse\n end",
"def recommend_users(bilateral = false)\n if auth = auths.select { |a| a.provider == 'weibo' }.first\n auth.friends_on_site(bilateral).desc(:followers_count)\n end\n end",
"def index\n @recommendeds = Recommended.all\n end",
"def update_similarities_for_(user_id)\n user_id = user_id.to_s # For comparison. Redis returns all set members as strings.\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n\n Recommendable.set_shard_key user_id\n\n # Only calculate similarities for users who have rated the items that\n # this user has rated\n relevant_user_ids = Recommendable.config.ratable_classes.inject([]) do |memo, klass|\n liked_set = Recommendable::Helpers::RedisKeyMapper.liked_set_for(klass, user_id)\n disliked_set = Recommendable::Helpers::RedisKeyMapper.disliked_set_for(klass, user_id)\n\n item_ids = Recommendable.redis.sunion(liked_set, disliked_set)\n\n unless item_ids.empty?\n sets = item_ids.map do |id|\n liked_by_set = Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(klass, id)\n disliked_by_set = Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(klass, id)\n\n [liked_by_set, disliked_by_set]\n end\n\n memo | Recommendable.redis.sunion(*sets.flatten)\n else\n memo\n end\n end\n\n similarity_values = relevant_user_ids.map { |id| similarity_between_(user_id, id) }\n Recommendable.redis.pipelined do\n relevant_user_ids.zip(similarity_values).each do |id, similarity_value|\n next if id == user_id # Skip comparing with self.\n Recommendable.redis.zadd(similarity_set, similarity_value, id)\n end\n end\n\n if knn = Recommendable.config.nearest_neighbors\n length = Recommendable.redis.zcard(similarity_set)\n kfn = Recommendable.config.furthest_neighbors || 0\n\n Recommendable.redis.zremrangebyrank(similarity_set, kfn, length - knn - 1)\n end\n\n true\n end",
"def recommendations_enabled\n return @recommendations_enabled\n end",
"def update_recommendation\n user = current_user\n user_interest = UserInterest.find(params[:answer_reco][:user_interest_id])\n authorize user_interest\n user_interest.recommendation == 'Pending' ? @switch = 'false' : @switch = 'true'\n user_interest.update(recommendation: params[:answer_reco][\"answer-#{user_interest.id}\"], comments: params[:answer_reco][:comments])\n\n @recommendations = UserInterest.where(user_id: current_user)\n @pending_recommendations = @recommendations.where(recommendation: \"Pending\")\n @accepted_recommendations = @recommendations.where(recommendation: \"Yes\")\n @declined_recommendations = @recommendations.where(recommendation: \"No\")\n respond_to do |format|\n format.html {redirect_to trainings_path}\n format.js\n end\n end",
"def recommend\n # @users = User.where(id: params[:recommend][:users_id])\n @user = User.find(params[:recommend][:user_id])\n if params[:recommend][:folder_id].present?\n @folder = Folder.find(params[:recommend][:folder_id])\n else\n @content = Content.find(params[:recommend][:content_id])\n end\n params[:recommend][:folder_id].present? ? @interest = UserInterest.find_by(user_id: @user.id, folder_id: @folder.id) : @interest = UserInterest.find_by(user_id: @user.id, content_id: @content.id)\n if @interest.present?\n @interest.update(recommendation: 'Pending')\n else\n params[:recommend][:folder_id].present? ? @interest = UserInterest.create(folder_id: @folder.id, user_id: @user.id, recommendation: 'Pending') : @interest = UserInterest.create(content_id: @content.id, user_id: @user.id, recommendation: 'Pending')\n end\n authorize @interest\n respond_to do |format|\n format.js\n end\n end",
"def recommend(num)\n system('clear')\n recommendations = recommendations_generate(num)\n cleaned_recs = recommendations.tracks.map { |t| \"#{t.name} by #{t.artists[0].name}\" }\n puts '》 RECOMMENDATIONS 《'.colorize(:light_green)\n puts 'Select the recommendations you want to add to your playlist!'\n selections = @prompt.multi_select('Hit enter with none selected to skip.', cleaned_recs)\n clean_recommendations(selections)\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n Recommendable.set_shard_key user_id\n liked_by_set = Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n disliked_by_set = Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(klass, item_id)\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.eval(similarity_total_for_lua, keys: [liked_by_set, similarity_set]).to_f\n similarity_sum -= Recommendable.redis.eval(similarity_total_for_lua, keys: [disliked_by_set, similarity_set]).to_f\n\n liked_by_count, disliked_by_count = Recommendable.redis.pipelined do\n Recommendable.redis.scard(liked_by_set)\n Recommendable.redis.scard(disliked_by_set)\n end\n prediction = similarity_sum / (liked_by_count + disliked_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def recommendations(options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n return [] if likes.count + dislikes.count == 0\n\n unioned_predictions = \"#{self.class}:#{id}:predictions\"\n Recommendable.redis.zunionstore unioned_predictions, Recommendable.recommendable_classes.map {|klass| predictions_set_for(klass)}\n \n recommendations = Recommendable.redis.zrevrange(unioned_predictions, 0, options[:count]).map do |object|\n klass, id = object.split(\":\")\n klass.constantize.find(id)\n end\n \n Recommendable.redis.del(unioned_predictions) and return recommendations\n end",
"def index\n @recommendations = current_user.recommendations.sort_by(&:created_at).reverse!\n recommendations_ids = @recommendations.collect(&:id)\n\n @provider_logos = AmazonS3.instance.provider_logos_hash_for_recommendations(@recommendations)\n @profile_pictures = User.author_profile_images_hash_for_recommendations(@recommendations)\n\n @activities = PublicActivity::Activity.order(Arel.sql('created_at desc')).where(trackable_id: recommendations_ids, trackable_type: 'Recommendation', owner_id: current_user.connected_users_ids)\n @activity_courses = {}\n @activity_courses_bookmarked = {}\n return unless @activities\n\n @activities.each do |activity|\n if activity.user_ids.present? && (activity.user_ids.include? current_user.id)\n @activity_courses[activity.id] = Recommendation.find(activity.trackable_id).course\n @activity_courses_bookmarked[activity.id] = @activity_courses[activity.id].bookmarked_by_user? current_user if @activity_courses[activity.id].present?\n else\n @activities -= [activity]\n end\n end\n end",
"def update_recommendations\n Recommendable.recommendable_classes.each {|klass| update_recommendations_for klass}\n end",
"def show\n if current_user.role == 'Student'\n subject_ids = current_user.proficiencies.where(\"marks_in_perc < ?\", 65).pluck(:subject_id)\n keywords = current_user.search_histories.order(\"hits DESC\").limit(5).pluck(:keywords)\n @recommended_resources = Resource.includes([:subject, :tags]).where(\"subject_id IN (?)\", subject_ids) + Resource.includes([:subject, :tags]).ransack(title_or_description_or_subject_title_or_tags_name_cont_any: keywords).result.limit(5)\n end\n end",
"def recommendation_params\n params.require(:recommendation).permit(:note, :user_id, :movie_id)\n end",
"def index\n @book_recommendations = BookRecommendation.all\n end",
"def recommendations_for item, options = {}\n options = options.reverse_merge(default_options)\n\n klass = item.is_a?(Hash) ? item.delete(:class) : item.class.to_s.downcase\n object_id = item.is_a?(Hash) ? item.delete(:object_id) : item.id\n\n data = request_object.object_types.send(klass).object.recommendations.page(options[:page]).limit(options[:limit]).get(object_id)\n return [] if data[\"recommendations\"].blank?\n ids = data[\"recommendations\"].map { |d| d[\"recommendation_id\"] }\n return klass.classify.constantize.where(id: ids) if options[:load]\n ids\n end",
"def show\n redirect_to '/unauthorized' if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @dm_profile = @user.dm_profile\n unless @dm_profile.nil?\n @similar_profiles = User.recommender(@dm_profile, \"dm\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"1\")\n else\n @similar_profiles = nil\n end\n if !@dm_profile\n redirect_to new_user_dm_profiles_path(@user, tutorial: params[:tutorial])\n else\n render 'show'\n end\n end",
"def answer_recommended_users(excluded_users = [], content = '', qty = 10)\n excluded_users = excluded_users.presence || []\n _tags = HashTag.where(\"? LIKE '% '||replace(hash_tags.name, '#', '')||' %'\", \" #{content} \").pluck(:id)\n res = Content.joins(:hash_tags)\n .where({contents_hash_tags:{hash_tag_id: _tags}})\n .where.not({contents:{user_id: excluded_users}})\n .select(\"contents.user_id, count(contents.id) as qty_contents\")\n .group('contents.user_id')\n .order('qty_contents desc')\n .limit(qty)\n .to_a.map{|c| User.exclude_blocked_users(self).select(\"*, (#{c.qty_contents}) as qty_comments\").find(c.user_id) }\n res = User.exclude_blocked_users(self).where.not(id: excluded_users + [self.id]).group('users.id').joins(:comments).select('users.*, count(comments.id) as qty_comments').order('qty_comments DESC').limit(qty) unless res.present?\n res\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n liked_by_set = Recommendations::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n # Get sum of similarities of each item in set\n similarity_sum = similarity_total_for(user_id, liked_by_set)\n\n liked_by_count = Recommendations.redis.pipelined do\n Recommendations.redis.scard(liked_by_set)\n end\n prediction = similarity_sum / (liked_count).to_f\n prediction.finite ? prediction : 0.0\n end",
"def recommendation_notifier(recommended_user, recommender, recommended)\n\t@recommendation = recommended_user\n\t@recommender = recommender\n\t@recommended = recommended\n\tmail(:to => recommended_user.email,\n\t :subject => \"#{recommender.first_name} just recommended you to their supplier #{recommended.first_name} on mylmp.com\")\n end",
"def recommendations_for(klass, options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n \n return [] if likes_for(klass).count + dislikes_for(klass).count == 0 || Recommendable.redis.zcard(predictions_set_for(klass)) == 0\n \n recommendations = []\n i = 0\n until recommendations.size == options[:count]\n prediction = Recommendable.redis.zrevrange(predictions_set_for(klass), i, i).first\n return recommendations unless prediction # User might not have enough recommendations to return\n \n object = klass.to_s.classify.constantize.find(prediction.split(\":\")[1])\n recommendations << object\n i += 1\n end\n \n return recommendations\n end",
"def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end",
"def non_first_time_user_feed products\n #generate raking based on the search, bookmarks and feedback \n searches = @user.searches.limit(3)\n feedbacks = @user.feedbacks\n bookmarks = @user.bookmarks\n results = Hash.new\n products.each do |product|\n score = product.internal_score\n bookmarks.each do |bookmark|\n if bookmark.product_id == product.id\n score += 2 #bookmarked products should be on top.\n end\n end\n feedbacks.each do |feedback|\n if feedback.product_id == product.id\n score += (feedback.rating - 3) #considering 3 rating as average\n elsif feedback.product.sub_category_id == product.sub_category_id\n score += (3 - feedback.rating) #For postive feedback user might not want to see other products in that sub_category at top, for negative feedback reverse\n end \n end\n searches.each do |search|\n if search.searchable_type == 'Product'\n if search.searchable_id == product.id\n score += 2 #latest search products at top\n end\n else\n if search.searchable_id == product.sub_category_id\n score += 1 #latest serach subcategory products at top\n end\n end\n end\n results[score] = results.key?(score) ? results[score] + [product] : [product]\n end\n results = results.sort.reverse.to_h\n result_array = Array.new\n results.each do |key, value| \n result_array += value\n end\n result_array\n end",
"def compute_user_rate(user)\n user_rate = Hash.new(0)\n user_movies = @data.select { |item| item[0].to_i == user }.each { |item| user_rate[item[1].to_i] = item[2].to_i }\n user_rate\n end",
"def predict(user_id, movie_id)\n movie_average_rating = set.popularity(movie_id)\n #puts \"The popularity of movie #{movie_id} is #{movie_average_rating}\"\n\n most_similar_users_list_ratings = set.most_similar(user_id)[0..29].collect do |u, r|\n if rating(u, movie_id)!=0 then\n rating(u, movie_id)\n end\n end.compact[0..9]\n #puts \"Actual rating: #{rating(user_id, movie_id)}\"\n #puts \"most_similar_users_list_ratings: #{most_similar_users_list_ratings}\"\n #puts \"Prediction: #{take_average(most_similar_users_list_ratings)}\"\n\n if most_similar_users_list_ratings.size > 0\n avg_most_similar_users_ratings = take_average(most_similar_users_list_ratings)\n 0.3*avg_most_similar_users_ratings+0.7*movie_average_rating\n else\n movie_average_rating\n end\n end",
"def show\n @recommender = User.where(username: params[:username]).first.recommender\n if @recommender.nil?\n render json: \"No Recommender of this user found\"\n else\n render json: @recommender.to_json(only: :latest_recommendation)\n end\n end",
"def update_similarities_for(user_id)\n user_id = user_id.to_s # For comparison. Redis returns all set members as strings.\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n\n # Only calculate similarities for users who have rated the items that\n # this user has rated\n relevant_user_ids = Recommendable.config.ratable_classes.inject([]) do |memo, klass|\n gemd_set = Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, user_id)\n disgemd_set = Recommendable::Helpers::RedisKeyMapper.disgemd_set_for(klass, user_id)\n\n item_ids = Recommendable.redis.sunion(gemd_set, disgemd_set)\n\n unless item_ids.empty?\n sets = item_ids.map do |id|\n gemd_by_set = Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(klass, id)\n disgemd_by_set = Recommendable::Helpers::RedisKeyMapper.disgemd_by_set_for(klass, id)\n\n [gemd_by_set, disgemd_by_set]\n end\n\n memo | Recommendable.redis.sunion(*sets.flatten)\n else\n memo\n end\n end\n\n relevant_user_ids.each do |id|\n next if id == user_id # Skip comparing with self.\n Recommendable.redis.zadd(similarity_set, similarity_between(user_id, id), id)\n end\n\n if knn = Recommendable.config.nearest_neighbors\n length = Recommendable.redis.zcard(similarity_set)\n kfn = Recommendable.config.furthest_neighbors || 0\n\n Recommendable.redis.zremrangebyrank(similarity_set, kfn, length - knn - 1)\n end\n\n true\n end",
"def show\n @weights_count = Weight.count\n @weights = Weight.where(userId: @profile.userId)\n @BMI = calc_BMI @profile.weight, @profile.feet, @profile.inch\n @BMI_message = calc_BMI_message(@BMI)\n @recommend = profileToRecomm @profile.fitnessGoal, @BMI_message \n end",
"def get_recommendation(data, key, metric = Pearson.new)\n totals = {}\n sim_sums = {}\n\n others = data.keys - [key]\n others.each do |other|\n sim = metric.distance(data, key, other)\n\n # only check others with similarity > 0\n if sim > 0\n data[other].each do |item, score|\n # only check item not rated by me\n if data[key][item].nil? or data[key][item] == 0\n totals[item] = 0 if totals[item].nil?\n sim_sums[item] = 0 if sim_sums[item].nil?\n\n totals[item] += score * sim\n sim_sums[item] += sim\n end\n end\n end\n end\n\n rankings = totals.collect do |item, score|\n [score/sim_sums[item], item] \n end\n rankings.sort!\n rankings.reverse!\n end",
"def user_average_rating(user)\n #av = promedio (avarage), counter = contador(para calcular el total de reviews realizada)\n av, counter = 0.0, 0.0\n \n Review.where(user_id: user.id).each_with_index do |review, i|\n if review.rating\n av = av + review.rating\n counter = counter + 1.0\n end\n end\n\n av / counter\n end",
"def recommend_articles\n @user = User.find(params[:user_id])\n @articles = @user.recommend_articles.accessibles(current_user).order_by_recommendations_count_desc.paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::RECOMMEND)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end",
"def predict(u,m)\n rating = 0\n count = 0\n most_similar = -1\n\n #the rating from the user who has rated m and is most similar to user u is\n #our prediction\n\n #to avoid we repeat computing similarity between two users, we use similarity_list to\n #contain similarity between users.\n if !@similarity_list.has_key?(u)\n @similarity_list[u] = Hash.new\n end\n\n viewers(m).each do |viewer|\n similarity = 0\n #if this similarity is already in the similarity_list, we directly access it from the list\n if @similarity_list[u].has_key?(viewer)\n similarity = @similarity_list[u][viewer]\n elsif @similarity_list.has_key?(viewer) && @similarity_list[viewer].has_key?(u)\n similarity = @similarity_list[viewer][u]\n else\n #if this similarity is not in the list, we compute it and put it into the list\n similarity = similarity(u, viewer)\n @similarity_list[u][viewer] = similarity\n end\n\n #then we look for the user who is most similar to user u. If there exists more than one,\n #we average the sum of ratings.\n if similarity > most_similar\n most_similar = similarity\n count = 1\n rating = @moviemap[m][viewer]\n elsif similarity == most_similar\n count = count + 1\n rating += @moviemap[m][viewer]\n end\n end\n\n if count == 0\n #if no one ever rates this movie, predict an average rating 3\n 3\n else\n rating/count.to_f\n end\n end",
"def paper\n reviewer_recommendations_task.paper\n end",
"def recommend\n recommend_count = 0\n ActiveRecord::Base.transaction do\n if params[:cancel]\n # cancel recommendation\n recommend_count = ArticleRecommendation.delete(params[:article_id], current_user.id)\n logger.info \"ユーザ #{current_user.id} が記事 #{params[:article_id]} に対するオススメをキャンセルしました。\"\n else\n # commit reccomendation\n recommend_count = ArticleRecommendation.add(params[:article_id], current_user.id)\n logger.info \"ユーザ #{current_user.id} が記事 #{params[:article_id]} に対してオススメしました。\"\n end\n respond_to do |format|\n # toggle recommend button\n format.js { render locals: { article: Article.find(params[:article_id]) } }\n end\n end\n end",
"def list_ratings\n final_result = []\n # grab all of the rating attributes and counts and turn them into an array\n rating_results = rating.count_attributes.to_a\n \n # order the rating counts and attributes\n ordered_results = []\n ['one', 'two', 'three', 'four'].each do |order|\n rating_results.each do |result|\n if order == result[0]\n ordered_results << result\n end\n end\n end\n \n # add in the friendly name\n for i in 0...ordered_results.length\n final_result << [AppConstants::FRIENDLY_RATING_NAMES[i],ordered_results[i][0],(ordered_results[i][1].to_f/total_votes.to_f)*100]\n end\n \n final_result\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n end",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def predict(user, movie)\n list = most_similar(user) #array of similar users\n done = true\n user_predicted_rating = 0;\n\n #see which user has seen the movie\n while done && !list.empty?\n first_user = list.shift #user similar to u\n\n if $unique_user_data[first_user.to_i - 1].has_key?(movie)\n user_predicted_rating = $unique_user_data[first_user.to_i - 1][movie]\n return user_predicted_rating\n end\n end\n return user_predicted_rating\n end",
"def reviewers\n reviews.map { |r|\n r.user }.uniq\n end",
"def hasRecommendation(course, fname, lname)\n\t@recommendations = Recommendation.where(\"course_number LIKE \" + course.to_s + \" AND student_fname LIKE '\" + fname + \"' AND student_lname LIKE '\" + lname + \"'\")\n\t@answer = @recommendations.length > 0\nend",
"def recommendationAdded\n# totalThumbsUp = self.views.where('rating > 0').sum(:rating)\n# if(totalThumbsUp == User::NEW_TRIP_2ND_CONTRIBUTION_CUTOFF)\n# user.add_content_contribution_time User::NEW_TRIP_2ND_CONTRIBUTION_AMOUNT\n# user.recentGrantedAccessTime += User::NEW_TRIP_2ND_CONTRIBUTION_AMOUNT\n# user.save\n# elsif(totalThumbsUp == User::NEW_TRIP_3RD_CONTRIBUTION_CUTOFF)\n# user.add_content_contribution_time User::NEW_TRIP_3RD_CONTRIBUTION_AMOUNT\n# user.recentGrantedAccessTime += User::NEW_TRIP_3RD_CONTRIBUTION_AMOUNT\n# user.save\n# end\n end",
"def item_recommendations_email(user, item_count)\n @user = user;\n @item_count = item_count\n mail(to: @user.email, subject: \"you have #{@item_count} new gift recommmendations from your friends!\")\n end",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def suggest_movie\n\t\t# Take 5 random movies\n\t\tmovies = self.get_source_content.shuffle[0..4]\n\n\t\t# Create a readable list of movie names\n\t\tdisplay_list = movies.collect { |filepath|\n\t\t\tFile.basename(filepath).gsub(File.extname(filepath), '')\n\t\t}\n\n\t\t# Ask the user to veto a movie\n\t\tallowed_answers = (1..display_list.size).to_a\n\t\tusers = ['Tim', 'Maud'].shuffle\n\t\tuser = rand(1)\n\t\tmovie_id = nil\n\t\twhile movie_id.nil? do\n\t\t\tsystem 'clear'\n\t\t\tputs \n\n\t\t\t# Display list\n\t\t\tdisplay_list.each_with_index do |movie, i|\n\t\t\t\tputs \"#{i+1}: #{movie}\"\n\t\t\tend\n\t\t\tputs\n\n\t\t\t# If only one movie left, we select it\n\t\t\tif allowed_answers.size == 1\n\t\t\t\tmovie_id = allowed_answers[0] \n\t\t\t\tdisplay_name = display_list[movie_id-1]\n\t\t\t\tfilepath = movies[movie_id-1]\n\t\t\t\tputs \"On regarde donc #{display_name}, qui se trouve dans\"\n\t\t\t\tputs filepath\n\n\t\t\t\t# We remove it from the list\n\t\t\t\tself.remove_movie_from_list filepath\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t# Ask user for a veto\n\t\t\tputs \"#{users[user]}, à toi de mettre un véto\"\n\t\t\tanswer = gets.chomp.to_i\n\n\t\t\t# Incorrect answer\n\t\t\tif !allowed_answers.include? answer\n\t\t\t\tputs \"#{answer} n'est pas une réponse valide.\"\n\t\t\t\tputs \"Les seuls réponses valides sont : #{allowed_answers.join(', ')}\"\n\t\t\t\tputs \"Appuyez sur Entrée pour recommencer\"\n\t\t\t\tgets\n\t\t\telse\n\t\t\t\t# We remove this answer from the list\n\t\t\t\tallowed_answers.delete(answer)\n\t\t\t\tdisplay_list[answer-1].gsub!(/./, '#')\n\t\t\t\t# Switch to next user\n\t\t\t\tuser = (user+1)%2\n\t\t\tend\n\t\tend\n\n\tend",
"def avg_rating\n movie_recs = self.given_movie_recommendations\n book_recs = self.given_book_recommendations\n ratings = (movie_recs + book_recs).map(&:recommendee_rating).compact\n return 0 if ratings.empty?\n (ratings.sum.to_f / ratings.size.to_f).round(1)\n end",
"def rating_by(user)\n\t\tratings.select{ |rating| rating.rater_id == user.id }.first if user.try(:id)\n\tend",
"def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end",
"def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end",
"def recommendation_params\n params.require(:recommendation).permit(:name, :detail, :rating)\n end",
"def prediction(user, item)\n av_user = user_average_rating(user)\n upper_sum, bottom_sum = 0, 0\n neighbours = get_neighbours(user)\n\n neighbours.each_with_index do |neighbour, i|\n if neighbour_rating = Review.where(user_id: neighbour.id, item_id: item.id).first\n upper_sum = upper_sum + ( similarity(user, neighbour) * (neighbour_rating.rating - user_average_rating(neighbour)) )\n bottom_sum = bottom_sum + similarity(user, neighbour)\n end\n\n end\n\n if upper_sum > 0 and bottom_sum > 0\n av_user + (upper_sum / bottom_sum)\n else\n 0\n end\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n gemd_by_set = Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(klass, item_id)\n disgemd_by_set = Recommendable::Helpers::RedisKeyMapper.disgemd_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.smembers(gemd_by_set).inject(0) do |memo, id|\n memo += Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n similarity_sum += Recommendable.redis.smembers(disgemd_by_set).inject(0) do |memo, id|\n memo -= Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n gemd_by_count = Recommendable.redis.scard(gemd_by_set)\n disgemd_by_count = Recommendable.redis.scard(disgemd_by_set)\n prediction = similarity_sum / (gemd_by_count + disgemd_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def viewers(m)\n\t\tviewer_list = []\n\t\ttraining_set.each do |row|\n\t\t\tif row[\"movie_id\"] == m\n\t\t\t\tviewer_list.push({\"user_id\"=>row[\"user_id\"],\"rating\"=>row[\"rating\"]})\n\t\t\tend\n\t\tend\n\t\treturn viewer_list\n\tend",
"def most_similar (user1)\n\t\tuser1 = user1.to_s\n\t\tsimilarity_list = Array.new\n\t\t@user_rating_index.each_key do |key|\n\t\t\tunless key == user1 \n\t\t\t\tpair = Array.new()\n\t\t\t\tpair = [similarity(user1, key), key]\n\t\t\t\tsimilarity_list << pair\n\t\t\tend \n\t\tend\n\t\tsimilarity_list= similarity_list.sort\n\t\treturn similarity_list\n\tend",
"def viewers m\n \tusers = @userdata.keys\n \tmovie_viewers = []\n \tusers.each do |user|\n \t\tif rating(user, m) != 0\n \t\t\tmovie_viewers.push(user)\n \t\tend\n\n \tend\n \treturn movie_viewers\n end",
"def index\n @page_title = 'Movie Recommendations'\n @pagy, @recommendations = pagy(MovieUserRecommendation.includes(:user, :movie).all, items: 99)\n end",
"def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend"
] |
[
"0.781104",
"0.764283",
"0.7367639",
"0.7309262",
"0.7185015",
"0.71237814",
"0.70941293",
"0.7024433",
"0.69872284",
"0.6975372",
"0.6952374",
"0.6946477",
"0.69447094",
"0.69369817",
"0.68893766",
"0.6883884",
"0.6842288",
"0.68398297",
"0.68184286",
"0.6811445",
"0.68055683",
"0.6799685",
"0.6799115",
"0.6771097",
"0.6727951",
"0.67193025",
"0.67107874",
"0.67019254",
"0.6689714",
"0.66290927",
"0.65639764",
"0.65114194",
"0.6496378",
"0.64315134",
"0.64140695",
"0.64032525",
"0.63833565",
"0.6367396",
"0.6351474",
"0.62628305",
"0.62506145",
"0.6249311",
"0.62339324",
"0.62257195",
"0.6214293",
"0.6191761",
"0.6190898",
"0.61847526",
"0.61784256",
"0.6140164",
"0.6092193",
"0.60801816",
"0.60689676",
"0.6061864",
"0.6043841",
"0.60349256",
"0.6032263",
"0.60306907",
"0.6027949",
"0.6019668",
"0.6012517",
"0.6000022",
"0.5997639",
"0.599173",
"0.59826297",
"0.59759754",
"0.59738624",
"0.5973179",
"0.59616923",
"0.59552115",
"0.5949315",
"0.59487057",
"0.5944871",
"0.5939428",
"0.5937535",
"0.59362644",
"0.5936191",
"0.5932862",
"0.5932816",
"0.593213",
"0.5932025",
"0.5925258",
"0.59167093",
"0.59018123",
"0.59014696",
"0.5900652",
"0.5900652",
"0.58891827",
"0.5887794",
"0.5874551",
"0.5864406",
"0.5855689",
"0.58483523",
"0.5846957",
"0.5835807",
"0.58269876",
"0.5824273",
"0.58236176",
"0.581885",
"0.5818489"
] |
0.7848443
|
0
|
the recommendations made about some location
|
def location
recommendations 'location'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end",
"def recommendation\n return @recommendation\n end",
"def recommendations\n @recommendations = []\n @connection.response_data.map do |rec|\n recommendation = {}\n recommendation['name'] = rec[\"name\"]\n recommendation['rating'] = rec[\"rating\"] \n recommendation['price'] = rec[\"price_level\"]\n recommendation['address'] = rec[\"vicinity\"]\n @recommendations << recommendation\n end\n @recommendations\n end",
"def get_recommendations\n result = []\n DIST[@pain_severity].each do |element|\n unique = false\n while !unique\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n if result.include? recommendation\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n else\n result << recommendation\n unique = true\n end\n end\n end\n result\n end",
"def index\n if !params[:cuisine]\n query = params[:search][:term].split(\",\")\n result = Restaurant.get_results_from_google_places(query, current_user)\n @restaurants = result\n else\n query = params[:cuisine]\n result = Restaurant.get_results_from_google_places(query, current_user, true)\n @restaurants = result\n end\n\n # so that we render the links only when we have recommendations from friends\n @found_recommendations = []\n @restaurants.each do |restaurant|\n recommendations = Recommendation.get_friend_recommedation_by_restaurant(restaurant[\"id\"], @registered_friends)\n if recommendations.empty?\n @found_recommendations << false\n else\n @found_recommendations << true\n end\n end\n end",
"def prepare_suggested_searches\n @suggested_searches = [\n # { label_key: 'search_suggestion_whale_mass',\n # params: {\n # sort: 'desc',\n # min: 10000,\n # taxon_concept_id: 7649,\n # attribute: 'http://purl.obolibrary.org/obo/VT_0001259',\n # unit: 'http://purl.obolibrary.org/obo/UO_0000009' }},\n # { label_key: 'search_suggestion_cavity_nests',\n # params: {\n # q: 'cavity',\n # attribute: 'http://eol.org/schema/terms/NestType' }},\n { label_key: 'search_suggestion_diatom_shape',\n params: {\n attribute: 'http://purl.obolibrary.org/obo/OBA_0000052',\n taxon_concept_id: 3685 }} #,\n # { label_key: 'search_suggestion_blue_flowers',\n # params: {\n # q: 'http://purl.obolibrary.org/obo/PATO_0000318',\n # attribute: 'http://purl.obolibrary.org/obo/TO_0000537' }}\n ]\n end",
"def recommendation=(value)\n @recommendation = value\n end",
"def list\n # list possible locations \n\n @location_suggest = get_location_suggest\n\n if params[:location]\n locations = WoeidHelper.search_by_name params[:location]\n if not locations.nil? and locations.count == 1\n set_location locations[0]\n else\n @location_asked = locations\n end\n end\n end",
"def suggest_location\n return @suggest_location\n end",
"def getRecommendations()\n totals=Hash.new(0)\n simSum=Hash.new(0)\n \n \n @prefs.each_pair do |other,ranks|\n \n # next if it's me\n next if other == @person\n \n # check the affinity \n sim = @similarity.compute(other)\n \n # next if no affinity\n next if sim <= 0\n \n # for each unranked element\n ranks.each_pair do |name,rank|\n if !@prefs[@person].include?(name) or @prefs[@person].length == 0\n \n totals[name] += rank * sim\n simSum[name] += sim\n \n end\n end \n end\n \n # Array creation\n totals.to_a.collect do |e|\n [e[1]/simSum[e[0]],e[0]]\n end.sort do |a,b|\n b[0] <=> a[0]\n end\n \n end",
"def recommendations_for(obj)\n recommend_by_item_based obj\n end",
"def recommendations\n\t @recommendations = Restaurant.find(params[:id]).recommendations\n\t \n\t respond_to do |format|\n\t\t format.html # recommendations.html.erb\n\t \t format.json { render json: @recommendations.to_json(except: [ :created_at, :updated_at ]) }\n\t end\n end",
"def service_learners\n service_learning_positions.collect(&:placements).flatten.collect(&:person).compact.uniq\n end",
"def recommendation()\n @type.recommendation(self)\n end",
"def yelp_search\n begin\n client = Yelp::Client.new\n request = Yelp::V2::Search::Request::Location.new(\n term: \"#{self.name}\",\n address: \"#{self.address}\",\n city: \"New York\"\n )\n response = client.search(request)\n rating = response[\"businesses\"].first[\"rating\"]\n img_url = response[\"businesses\"].first[\"image_url\"]\n info_array = [rating, img_url]\n rescue\n info_array = [0.0, \"http://upload.wikimedia.org/wikipedia/en/d/d6/Image_coming_soon.png\"]\n end\n return info_array\n end",
"def recommend\n @user = current_user\n @pods = @user.pods\n @podsname = @pods.last.name\n\n if @podsname == nil\n @query = Pod.search do \n fulltext \"djsadpkapodpoakd;sad\"\n end\n @podslist = @query.results\n else\n @query = Pod.search do\n fulltext (@podsname)\n end\n @podslist = @query.results \n end \n\n end",
"def suggestions\n suggest_response['suggest'].values.first[q]['suggestions']\n .uniq { |s| s['term'].downcase }\n .sort_by { |s| (-s['weight']) * 100 + s['term'].length }\n .take(5)\n end",
"def get_recommendations\n SpotifyApiAdapter.get_recommendations(self)\n end",
"def user\n recommendations 'user'\n end",
"def create_recommendation\n # once you have the forecast, ask each Weather object for the appropriate\n # clothing and accessories, store the result in @recommendation. You might\n # want to implement the two methods below to help you kee this method\n # smaller...\n end",
"def recommend\n recs = []\n User.all.each do |user|\n if user.hotspots.include?(self)\n user.hotspots.each do |hs|\n recs << hs\n end#user.hotspots end\n end#if include? end\n return recs.uniq\n end#users.each end\n end",
"def find_recommendations(doc)\n\t\tnum_recommendations = doc.xpath('//*[@id=\"overview\"]/dd[2]/p/strong/text()')\n\t\t#puts \"Number of recommendations #{num_recommendations}\"\n\t\treturn num_recommendations.to_s.gsub(/\\s+/, ' ')\n\tend",
"def show\n @random_location = Location.where.not(id: @location).order(\"RANDOM()\").first(3)\n @reviews = Review.where(location_id: @location.id).order(\"created_at DESC\")\n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end",
"def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end",
"def hash_for_location(offense); end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def get_user_recommendations\n recommendations = []\n csv = open( CONFIG['SPREADSHEET_URL'] ).read\n CSV.parse( csv ).each_with_index do |line,i|\n next if i == 0 # Skip header\n date, title, category, url, note, person = *line\n next if category.match(/^Other/) # Looking at specific categories - Other is too broad\n if matches = url.match(%r{/(?:dp|product|ASIN)/([^/]*)})\n recommendations << {\n :id => matches[1],\n :category => category\n }\n end\n end\n recommendations\n end",
"def recommended_by_current_user\n if current_user\n extract = Csvarchive.find(params[:id])\n e_rec = extract.recommendations\n u_rec = current_user.recommendations\n all_rec = e_rec & u_rec\n if !all_rec.empty?\n @recommended = true\n else\n @recommended = false\n end\n else\n @recommended = false\n end\n end",
"def get_by_location\n \tlat = params[:lat]\n \tlng = params[:lng]\n \tnext_start = params[:next_start]\n \tshops = Hotpepper.search_location(lat, lng, next_start);\n \tset_to_results(shops);\n end",
"def offers_by_location\n offers = {}\n self.cards.each do |card|\n offers[card.location.name] = card.location.offer_reductions\n end\n offers\n end",
"def display_searched\n\t\tlocation = Location.find_by(id: params[:id])\n\t\t@location_id = location.id\n\t\t@trip_id = location.trip_id\n\t\t# shows location that was searched\n\t\t@hash = Gmaps4rails.build_markers(location) do |location, marker|\n \t\t\tmarker.lat location.to_coordinates[0]\n \t\t\tmarker.lng location.to_coordinates[1]\n \t\t\tmarker.infowindow location.description\n \t\t\tmarker.picture({\n \t\"url\" => \"http://i.imgur.com/1OCtNP3.png\",\n \t\"width\" => 36,\n \t\"height\" => 36})\n\t\tend\n\tend",
"def suggest\n end",
"def restaurant_suggestions\n match_key = Riddle.escape(params[:key]).split(' ').join('* ') + '*'\n begin\n suggestions = Restaurant.search(match_key,{:limit=>20,:match_mode => :extended,\n :ignore_errors=>true,:populate=>true,:retry_stale=>true})\n rescue Exception\n suggestions = []\n end\n response = []\n suggestions.each{|d| response << {:value=>d.id,:label=>d.name}}\n render :json=>response.to_json\n end",
"def search\n\n\t\t@search_loc = params[:search_loc] # address user searched for\n\t\t@search_lat = params[:search_lat] # the user's current location latitude. If the address searched for fails to give a new latitude, this is used instead\n\t\t@search_long = params[:search_long] # the user's current longitude - same use case as above\n\t\tif @search_loc != nil\n\t\t\taddress = @search_loc.gsub(/\\s/, \"+\")\n\t\t\turi = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?address=\" + address + \"&sensor=false\")\n\t\t\thttp = Net::HTTP.get_response(uri)\n\t\t\tresults = JSON.parse(http.body)\n\t\t\t# if address yielded results, override the user's current location coordinates with the searched-for-latitude/longitude\n\t\t\tif results[\"status\"] != \"ZERO_RESULTS\"\n\t\t\t\t@search_lat = results[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\t\t\t@search_long = results[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\t\tend\n\t\tend\n\n\t\t@search_item = \"\"\n\t\tif params[:search_item] then\n\t\t\t@search_item = params[:search_item]\n\t\tend\n\t\t@search_item.downcase\n\n\t\t# the default search distance (max circular radius of a restaurant from the searched for location) is 5 unless the user specified a search radius\n\t\t@search_distance = DEFAULT_SEARCH_DISTANCE\n\t\tif params[:search_distance] then\n\t\t\t@search_distance = params[:search_distance]\n\t\tend\n\n\t\t@max_results = DEFAULT_MAX_RESULTS\n\t\tif params[:results] then\n\t\t\t@max_results = params[:results].to_i\n\t\tend\n\n\t\t# Based on the Haversine Formula found on google maps API. The below is a Sql query to find all restaurants that has dishes with a dish name containing the search query or a dish description containing the search query,\n\t\t# (independent of case), or the restaurant name or description contains the search query, and the restaurant must be within the circular search\n\t\t# radius of the searched for location.\n\t\t@restaurants = Restaurant.find_by_sql([\"SELECT DISTINCT restaurants.* from foods, restaurants WHERE\n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id LIMIT ?\", @search_lat, @search_long, @search_lat, @search_distance, \"%#{@search_item}%\", \n\t\t\t\"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t# All of the dishes returned below are ordered by average rating from highest to lowest.\n\t\t# Similar to the above query, but returns the dishes that are within restaurants within the given distance radius that has a dish name or description\n\t\t# with the search query, or its restaurant name / description has the search query.\n\t\t@dishes = Food.find_by_sql([\"SELECT DISTINCT foods.* from foods, restaurants WHERE \n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id ORDER BY foods.rating DESC NULLS LAST OFFSET 2 LIMIT ?\", @search_lat, @search_long, @search_lat, \n\t\t\t@search_distance, \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t@num_items_per_row = DEFAULT_NUM_ITEMS_PER_ROW\n\t\t@num_rows_per_page = DEFAULT_NUM_ROWS_PER_PAGE\n\t\tif params[:itemspr] then\n\t\t\t@num_items_per_row = params[:itemspr].to_i\n\t\tend\n\t\tif params[:rowspp] then\n\t\t\t@num_rows_per_page = params[:rowspp].to_i\n\t\tend\n\n\t\t@render = 'default'\n\t\tif params[:render] then\n\t\t\t@render = params[:render]\n\t\tend\n\n\t\tif @render == 'json_only' then\n\t\t\trender :json => {:restaurants => @restaurants, :dishes => @dishes}\n\t\telsif @render == 'partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'partials_and_json_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => true, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'dish_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'dishes_only', :render_restaurants => false, :results => 'dishes',\n\t\t\t\t:dishes => @dishes, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'restaurant_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'restaurants_only', :results => 'restaurants',\n\t\t\t\t:restaurants => @restaurants, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\tend\n\t\t# else search.html.erb (the default) will be rendered\n\n\tend",
"def suggest_prereqs; suggest_with_score(prereqs).last; end",
"def personalized_recommendations(customer_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.recommended(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def additional_brief_location_note(document, _location)\n # Law records need a link back to their native catalog\n if document && document.in_pegasus?\n return content_tag(:span, pegasus_item_link(document, 'Search Results'), class: 'url_link_note')\n end\n end",
"def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end",
"def suggest()\n\n\t\t\t# It is necessary to clone the json in order to manipulate it\n\t\t\tarticles_clone = articles.clone\n\n\t\t\t# This variable stores the total of articles in logs/content/myad categories inside the json\n\t\t\ttotal_articles = articles_clone[\"logs\"].length + articles_clone[\"content\"].length + articles_clone[\"myad\"].length\n\n\t\t\t# This variable stores the result in array\n\t\t\ttoken_result = Array.new\n\n\t\t\tloop do\n\t\t\t\tarticles_clone.each do |key, array_value|\n\t\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES \n\t\t\t\t\tnext if array_value.empty?\n\n\t\t\t\t\tarray = array_value.shift\t\t # Store the first element of the array in this iteration\n\t\t\t\t\ttoken_result.push(array[\"token\"].to_i) # We add a new \"token\" from the element\n\t\t\t\tend\n\n\t\t\t\t# It is mandatory to control the amount of items in the array (token_result), otherwise, we have an infinite loop.\n\t\t\t\tbreak unless token_result.length < MAX_RECOMMENDED_ARTICLES && token_result.length < total_articles\t\n\t\t\tend\n\n\t\t\ttoken_result \n\t\tend",
"def index\n @result = request.location\n if user_signed_in?\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n if params[:tag]\n @ideas = Idea.where('city = ? OR country = ?', @location.city_name, @location.country_name).near([@result.latitude, @result.longitude], 5, :units => :km).tagged_with(params[:tag])\n else\n @ideas = Idea.where('city = ? OR country = ?', @location.city_name, @location.country_name).near([@result.latitude, @result.longitude], 5, :units => :km)\n end\n else\n @ideas = Idea.all.near([@result.latitude, @result.longitude], 5, :units => :km)\n end\n end",
"def suggestions\n suggest(search_suggestions)\n end",
"def alternatives\n self.product_suggestions.collect{|ps| ps.suggested_product}\n end",
"def index\n @recommendations = Recommendation.all\n end",
"def findorsuggest()\n \n end",
"def locations; end",
"def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end",
"def discover\n discover_places = [\n \"Experimental Cocktail Club Paris\",\n \"Le Connetable\",\n \"Le Baron Rouge\",\n \"Le Bistrot des Dames\",\n \"Aux Folies\",\n \"UDO Bar\"\n ]\n params_hash = {\n q: discover_places.sample\n }\n call(params_hash)\n end",
"def additional_holdings_location_notes(document, location)\n location_notes = []\n\n # Law records need a link back to their native catalog\n if document && document.in_pegasus?\n location_notes << content_tag(:span, pegasus_item_link(document, 'Search Results'), class: 'url_link_note')\n end\n\n # Check for any location notes in app_config - that's used for\n # somewhat dynamic values that we don't want to put in code\n app_config_notes = Location.get_app_config_location_notes(location)\n location_notes << app_config_notes.html_safe unless app_config_notes.nil?\n\n return location_notes unless location_notes.empty?\n nil\n end",
"def get_recommendation(data, key, metric = Pearson.new)\n totals = {}\n sim_sums = {}\n\n others = data.keys - [key]\n others.each do |other|\n sim = metric.distance(data, key, other)\n\n # only check others with similarity > 0\n if sim > 0\n data[other].each do |item, score|\n # only check item not rated by me\n if data[key][item].nil? or data[key][item] == 0\n totals[item] = 0 if totals[item].nil?\n sim_sums[item] = 0 if sim_sums[item].nil?\n\n totals[item] += score * sim\n sim_sums[item] += sim\n end\n end\n end\n end\n\n rankings = totals.collect do |item, score|\n [score/sim_sums[item], item] \n end\n rankings.sort!\n rankings.reverse!\n end",
"def getRecommendations(prefs, person, scorefunc = :sim_pearson )\n totals = {}\n simSums = {}\n for other in prefs.keys\n # don't compare me to myself\n next if other == person\n\n if scorefunc == :sim_pearson\n sim = sim_pearson( prefs, person, other)\n else\n sim = sim_distance( prefs, person, other)\n end\n\n # ignore scores of zero or lower\n next if sim <= 0\n\n for item in prefs[other].keys\n # only score movies I haven't seen yet\n if !prefs[person].include? item or prefs[person][item] == 0\n # similarity * score\n totals.default = 0\n totals[item] += prefs[other][item] * sim\n # sum of similarities\n simSums.default = 0\n simSums[item] += sim\n end\n end\n end\n\n # Create a normalized list\n rankings = []\n totals.each do |item,total|\n rankings << [total/simSums[item], item]\n end\n\n # Return the sorted list\n return rankings.sort.reverse\n end",
"def location\n ans = location_answers.first\n ans ? ans.location : nil\n end",
"def restaurant\n location.restaurant\n end",
"def recommendations\n @user.community.events.upcoming.where(:owner_type => \"Feed\").map do |e|\n EventRecommendation.new(e)\n end\n end",
"def recommended_to(main, opts={})\n opts.merge!(default_options)\n\n @similarities = @totals = Hash.new(0)\n\n create_similarities_totals(main)\n\n results = generate_rankings\n\n sort_results(results,opts[:size])\n end",
"def recommend_a_place\n # 1- Find the person we are giving the recommendation to (determined by the user_id)\n # 2- Calculate the total VALUE that each place has for that given user (algorithm)\n # 3- Sort by value the array of recommended places\n # 4- Return the data for the user and the array of recommended places in the specified format \n if params[:user_id]\n @person = User.find(params[:user_id])\n else \n wrong_user_id = true\n end\n \n unless wrong_user_id\n # The algorithm to calculate the total VALUE of each place returns an array of arrays, where the 1st element is the value\n # of the place which is in the 2nd element.\n array_values_places = calculate_value_of_places(@person)\n @sorted_array_values_places = array_values_places.sort_by { |e| e[0] }.reverse\n\n respond_to do |format|\n if wrong_user_id\n format.json { render :json => { :status => \"Error\", :response => {} }}\n else\n format.json { render :file => \"places/recommend_a_place.json.erb\", :content_type => 'application/json' }\n end\n end\n end \n \n end",
"def predict_all\r\n @recommendations = Professional.all.map do |professional|\r\n Recommender.new(professional).recommend\r\n end\r\n true\r\n end",
"def getRecommendations( prefs, person, scorefunc = :sim_pearson )\n totals = {}\n simSums = {}\n for other in prefs.keys\n # don't compare me to myself\n next if other == person\n \n if scorefunc == :sim_pearson\n sim = sim_pearson( prefs, person, other )\n else\n sim = sim_pearson( prefs, person, other )\n end\n puts \"rec sim val: #{sim}\"\n #ignore scores of zero or lower\n next if sim <= 0\n \n for item in prefs[other].keys\n # only score movies I haven't seen yet\n if !prefs[person].include? item or prefs[person][item] == 0\n # similarity * score\n totals.default = 0\n totals[item] += prefs[other][item] * sim\n # sum of similarities\n simSums.default = 0\n simSums[item] += sim\n end\n end\n end\n \n # create a normalised list\n rankings = []\n totals.each do |item,total|\n rankings << [total/simSums[item], item]\n end\n \n # Return the sorted list\n return rankings.sort.reverse\n end",
"def friend_suggestions\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n if self_node\n recommendations = self_node.both(:friends).order(\"breadth first\").uniqueness(\"node global\").filter(\"position.length() == 2;\").depth(2)\n all_recommendations = recommendations.map{|n| \n begin\n n.object_type.safe_constantize.find(n[:object_id])\n # n.object_type.safe_constantize.find(n[\"object_id\"])\n rescue Exception\n end\n }\n else\n false\n end\n end",
"def get_recommendation(recommendation_name)\n request_body = {\n identification: identification,\n max_products: 16,\n \trequest: [\n \"details\",\n \"results\"\n ]\n }.compact\n search_response = request_tagalys(\"/recommendations/\" + recommendation_name, request_body)\n end",
"def favorite_restaurant(r1, r2)\n res1 = {}\n res2 = {}\n\n short, long = r1.length > r2.length ? [r2, r1] : [r1, r2]\n\n (0...long.length).each do |i|\n res1[r1[i]] = i if r1[i]\n res2[r2[i]] = i if r2[i]\n end\n\n best_rank = nil\n best_restaurant = nil\n\n res1.each do |k, v|\n if res2[k]\n rank = res1[k] + v\n if !best_rank || rank < best_rank\n best_rank = rank\n best_restaurant = k\n end\n end\n end\n\n best_restaurant || \"Yelpwich\"\nend",
"def arches\n @arches ||= lipo.info\n end",
"def approximate_recommendation\n segments = self.segments\n\n segments.pop while segments.any? {|s| String === s }\n segments.pop while segments.size > 2\n segments.push 0 while segments.size < 2\n\n recommendation = \"~> #{segments.join(\".\")}\"\n recommendation += \".a\" if prerelease?\n recommendation\n end",
"def search\n @user = User.where('prefecture_name LIKE(?)', \"%#{params[:keyword]}%\").first\n @users = User.where('prefecture_name LIKE(?)', \"%#{params[:keyword]}%\")\n @search_answers = []\n @users.each do |user|\n @search_answers += user.notes\n end\n \n gmaps_markers(@search_answers)\n # @search_answers = @search_answers.order(\"created_at DESC\")\n end",
"def approximate_recommendation\n segments = self.segments\n\n segments.pop while segments.size > 2\n segments.push 0 while segments.size < 2\n\n recommendation = \"~> #{segments.join(\".\")}\"\n recommendation\n end",
"def recommendations_menu\n if @user.mylist.length.positive?\n recommendation = Rec.new(@user)\n recommendation.amount_of_suggestions\n else\n no_items\n end\n end",
"def get_restaurants(location)\n latitude, longitude = convert_location(location)\n\n food_query = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/place/nearbysearch/json\",\n :query_values => {:location => \"#{latitude},#{longitude}\",\n :radius => \"#{get_distance}\",\n :types => \"food\",\n :key => \"#{KEY}\",\n :sensor => \"false\",\n :keyword => \"#{get_food_kind}\"}\n )\n food_query_json = RestClient.get(food_query.to_s)\n JSON.parse(food_query_json)[\"results\"]\n end",
"def show\n @trip = Trip.find(params[:id],:include => :participants)\n @participations=@trip.participations\n profile_list= @participations.collect { |p| p.profile_id } \n (@tags,@points)=Tag.forProfiles(profile_list) # find interests\n # @res= Place.supportsTagsLoc(@tags,45,-120,300, @trip.departure_date )\n begin\n @suggestions=Trip.clusterLocations(@tags,@trip) # find interesting places around cities\n rescue Exception => err\n @suggestions = []\n flash[:error] = \"Can't get suggestions: #{err.to_s}\"\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def suggest\r\n if current_user and !(current_user.followed_topic_ids.blank? and current_user.following_ids.blank?)\r\n elim = current_user.is_expert ? 3 : 2\r\n ulim = current_user.is_expert ? 0 : 1\r\n tlim = 2\r\n e,u,t = UserSuggestItem.find_by_user(current_user)\r\n @suggested_experts = e.blank? ? [] : User.any_in(:_id=>e.random(elim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_users = u.blank? ? [] : User.any_in(:_id=>u.random(ulim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_topics = t.blank? ? [] : Topic.any_in(:name=>t.random(tlim))\r\n end\r\n end",
"def index\n # TODO: get current location vs get default location\n if current_user\n addr = \"#{current_user.street_address}, #{current_user.locality}, #{current_user.region}\"\n else\n addr = '580 Portola Plaza, Los Angeles, CA'\n end\n\n loc = Geokit::Geocoders::GoogleGeocoder.geocode addr\n if loc.nil?\n loc = Geokit::GeoLoc.new\n loc.lat = 34.0704374\n loc.lng = -118.4421695\n loc.success = true\n end\n\n # 1 degree ~ 70 miles\n if params[:distance] and !params[:distance].empty?\n distance = params[:distance].to_f / 70.0\n else\n distance = 1\n end\n\n # degrees\n w_bound = loc.lng - distance\n e_bound = loc.lng + distance\n n_bound = loc.lat - distance\n s_bound = loc.lat + distance\n\n if params[:keyword] and !params[:keyword].empty? and\n params[:classification] and !params[:classification].empty?\n @products = Product.where('name like ? and classification like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:keyword]}%\",\n \"%#{params[:classification]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n elsif params[:keyword] and !params[:keyword].empty?\n @products = Product.where('name like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:keyword]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n elsif params[:classification] and !params[:classification].empty?\n @products = Product.where('classification like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:classification]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n else\n @products = Product.where('lat < ? and lat > ? and lon < ? and lon > ?',\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n end\n\n @products = @products.paginate(:page => params[:page], :per_page => 12)\n end",
"def location\n fetch('harry_potter.locations')\n end",
"def location\n fetch('hey_arnold.locations')\n end",
"def create_recommendation\n # once you have the forecast, ask each Weather object for the appropriate\n # clothing and accessories, store the result in @recommendation. You might\n # want to implement the two methods below to help you kee this method\n # smaller...\n @recommendation = @forecast.map do |day|\n weather = Weather.new(day[:min_temp].to_i,day[:max_temp].to_i,day[:condition])\n {date: day[:date], min_temp: day[:min_temp], max_temp: day[:max_temp], condition: day[:condition], clothes: weather.appropriate_clothing , accessory: weather.appropriate_accessories}\n end\n\n end",
"def index\n\n today = Date.today\n active = true\n # reservations = @room.reservations.where(\"(start_date >= ? OR end_date >= ?) AND status = ?\", today, today, 1)\n\n if params[:search].present? && params[:search].strip != \"\"\n session[:loc_search] = params[:search]\n # @experiences = Experience.where(active: true).near(session[:loc_search] , 15, order: 'distance')\n @experiences = Experience.where(\"start_date >= ? AND active = ?\", today, active).near(session[:loc_search] , 30, order: 'distance')\n else\n # @experiences = Experience.where(active: true).all\n puts \"**********executing BLANK Search**********\"\n @experiences = Experience.where(\"start_date >= ? AND active = ?\", today, active).all\n \n end\n\n \n\n # get the average rating per experience\n # @experiences.each do |e |\n # @per_experience = Experience.friendly.find(e.id)\n # @reviews = @per_experience.reviews\n # @rew = @reviews.average(:rating)\n # puts \"# of reviews: #{@reviews.count}, Average review is #{@rate} for experience #{@per_experience.id}, NAME: #{@per_experience.exp_name}\" \n # end\n\n if !current_user.present?\n redirect_to root_path(params[:search])\n else\n \n end\n\n# Original search for all\n # @experiences = Experience.all\n end",
"def rates_by\n recommendable_likes.map(&:user_id) + recommendable_dislikes.map(&:user_id)\n end",
"def location\n fetch('how_to_train_your_dragon.locations')\n end",
"def wishlisted\n wishlisted = self.visits.select { |visit| visit.visited == false }\n wishlisted.map { |museum| museum.user }\n end",
"def predictions\n raise \"Err\"\n buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)\n render json: buyer_suggestions, status: 200\n end",
"def hasRecommendation(course, fname, lname)\n\t@recommendations = Recommendation.where(\"course_number LIKE \" + course.to_s + \" AND student_fname LIKE '\" + fname + \"' AND student_lname LIKE '\" + lname + \"'\")\n\t@answer = @recommendations.length > 0\nend",
"def calculate_rating(query)\n @rating = 0 #initialize page rating\n count = 0\n q_keyword_weight = 0\n p_keyword_weight = 0\n query.keywords.each do |q_keyword|\n q_keyword_weight = MAX_NUM_KEYWORDS - count\n count += 1\n @keywords.each do |p_keyword|\n if p_keyword.downcase == q_keyword.downcase\n p_keyword_weight = MAX_NUM_KEYWORDS - @keywords.index(p_keyword)\n @rating += (q_keyword_weight * p_keyword_weight )\n end\n end\n end\n end",
"def suggestions\n response.try(:[], \"suggest\").try(:[], @suggest_key).try(:[], request_params[:q]).try(:[], \"suggestions\") || []\n end",
"def suggest_location=(value)\n @suggest_location = value\n end",
"def collection\n @recommendations ||= end_of_association_chain.find :all, :order => 'position'\n end",
"def location_decider(root,user1,final_location)\n\n #The array below stores all the names of the restaurants stored in the program\n restaurants = [\"Hai Nan Village Lei Cha\", \"Rock Road Seafood Restaurant\",\"Go Fun Kee Bak Kut Teh (Jalan Rock 2 1/2)\",\"Ono Poke\",\"SUUKEE The Original Hainanese Chicken Rice @ Icom Square\",\"Seoul Garden Vivacity Megamall\",\"Chong Chon Green Noodles\",\"Boulevard Restaurant\",\"Sharing Too @ CityOne\",\"Subway @ Plaza Merdeka\",\"Earthlings Coffee Workshop HQ\",\"Howdy's Grillhouse\",\"McDonalds @ Padungan\",\"Sukha Cafe\",\"My Restaurant\",\"The Granary\"]\n\n\n #Below contains all the if-else function used to determine the restaurant based on the uers's input\n #The restaurant list is narrowed based on whether certain criterias are true or false\n\n #Here are what each results would mean\n #If cuisine is True, it means Asian Cuisine, if it is False, it means Western Cuisine\n #If healthy is True, it means Healthy Options, if it is False, it means Less Healthy Options\n #If halal is True, it means Halal options, if it is False, it means Non-halal Options\n #If Price is True, it means price range is Cheap, if it is False, it means price range is expensive\n\n\n if user1.cuisine==true #If the cuisine choice is 'Asian'\n restaurants = [\"Hai Nan Village Lei Cha\", \"Rock Road Seafood Restaurant\",\"Go Fun Kee Bak Kut Teh (Jalan Rock 2 1/2)\",\"Ono Poke\",\"SUUKEE The Original Hainanese Chicken Rice @ Icom Square\",\"Seoul Garden Vivacity Megamall\",\"Chong Chon Green Noodles\",\"Boulevard Restaurant\"]\n\n if user1.healthy==true# If the cuisine choice is 'Asian' and 'Healthy'\n restaurants = [\"Hai Nan Village Lei Cha\", \"Rock Road Seafood Restaurant\",\"Go Fun Kee Bak Kut Teh (Jalan Rock 2 1/2)\",\"Ono Poke\"]\n\n if user1.halal == true #If the cuisine choice is 'Asian', healthy and has to be Halal\n restaurants = [\"Hai Nan Village Lei Cha\", \"Rock Road Seafood Restaurant\"]\n\n if user1.price==true #If the cuisine choice is 'Asian', healthy,halal and Cheap\n restaurants = [\"Hai Nan Village Lei Cha\"]\n else\n restaurants = [\"Rock Road Seafood Restaurant\"]\n end\n else\n restaurants = [\"Go Fun Kee Bak Kut Teh (Jalan Rock 2 1/2)\",\"Ono Poke\"]\n if user1.price==true\n restaurants = [\"Go Fun Kee Bak Kut Teh (Jalan Rock 2 1/2)\"]\n else\n restaurants = [\"Ono Poke\"]\n end\n end\n else\n restaurants = [\"SUUKEE The Original Hainanese Chicken Rice @ Icom Square\",\"Seoul Garden Vivacity Megamall\",\"Chong Chon Green Noodles\",\"Boulevard Restaurant\"]\n\n if user1.halal == true\n restaurants = [\"SUUKEE The Original Hainanese Chicken Rice @ Icom Square\",\"Seoul Garden Vivacity Megamall\"]\n\n if user1.price==true\n restaurants = [\"SUUKEE The Original Hainanese Chicken Rice @ Icom Square\"]\n else\n restaurants = [\"Seoul Garden Vivacity Megamall\"]\n end\n else\n restaurants = [\"Chong Chon Green Noodles\",\"Boulevard Restaurant\"]\n if user1.price==true\n restaurants = [\"Chong Chon Green Noodles\"]\n else\n restaurants = [\"Boulevard Restaurant\"]\n end\n end\n end\n else\n restaurants = [\"Sharing Too @ CityOne\",\"Subway @ Plaza Merdeka\",\"Earthlings Coffee Workshop HQ\",\"Howdy's Grillhouse\",\"McDonalds @ Padungan\",\"Sukha Cafe\",\"My Restaurant\",\"The Granary\"]\n\n if user1.healthy==true\n restaurants = [\"Sharing Too @ CityOne\",\"Subway @ Plaza Merdeka\",\"Earthlings Coffee Workshop HQ\",\"Howdy's Grillhouse\"]\n\n\n if user1.halal == true\n restaurants = [\"Sharing Too @ CityOne\",\"Subway @ Plaza Merdeka\"]\n\n if user1.price==true\n restaurants = [\"Sharing Too @ CityOne\"]\n else\n restaurants = [\"Subway @ Plaza Merdeka\"]\n end\n else\n restaurants = [\"Earthlings Coffee Workshop HQ\",\"Howdy's Grillhouse\"]\n\n if user1.price==true\n restaurants = [\"Earthlings Coffee Workshop HQ\"]\n else\n restaurants = [\"Howdy's Grillhouse\"]\n end\n end\n else\n restaurants = [\"McDonalds @ Padungan\",\"Sukha Cafe\",\"My Restaurant\",\"The Granary\"]\n\n if user1.halal == true\n restaurants = [\"McDonalds @ Padungan\",\"Sukha Cafe\"]\n if user1.price==true\n restaurants = [\"McDonalds @ Padungan\"]\n else\n restaurants = [\"Sukha Cafe\"]\n end\n else\n restaurants = [\"My Restaurant\",\"The Granary\"]\n\n if user1.price==true\n restaurants = [\"My Restaurant\"]\n else\n restaurants = [\"The Granary\"]\n end\n end\n end\n end\n\n #This function is used to insert the location information into the user-defined class called \"final_location\"\n get_location_info(restaurants[0].to_s,final_location)\n\n #This function is called to display the results window\n result_window(root,final_location)\nend",
"def ratings_search(rating)\n @rating_comments = Comment.where(rating: rating)\n @all_comments = current_user.comments\n @comments = @rating_comments & @all_comments\n @comments.map do |comment|\n comment.recipe.name\n end\n end",
"def suggestions\n authenticate_user!\n\n # Check if there are cached suggestions on the user\n if current_user.suggested_map_ids.present?\n maps = Map.where(:_id.in => current_user.suggested_map_ids).to_a.compact\n else\n maps = nil\n end\n\n # Use cached suggestions if present\n if maps.present?\n @maps = current_user.suggested_map_ids.map{|id| maps.find{|m| m.id == id} } # ensure same order as in the suggested_map_ids\n\n # If no cached suggestions, then load new suggestions\n else\n @last_played = Game.last_played_map_ids(current_user, 20) # exclude last 20 played maps\n\n @maps = get_trial_suggestions || get_standard_suggestions || get_unfiltered_suggestions || []\n @maps = @maps.sort_by(&:skill_mean) # Order by difficulty\n\n # Cache new suggestions\n current_user.update_attribute(:suggested_map_ids, @maps.map(&:id))\n end\n\n render :list\n end",
"def results \n if (params['location'].blank?)\n redirect_to :action => 'index'\n return\n end\n \n @venues = FoursquareVenueQuery.query(params['location']['latitude'], params['location']['longitude'])\n @reviews = {}\n \n @venues.each do |venue|\n review = Review.find_by_venue_id(venue['id'])\n \n unless (review == nil)\n @reviews[venue['id']] = review\n else\n @reviews[venue['id']] = Review.new # I don't like dealing with nils in the view\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => '' }\n end\n end",
"def show\n if @search.industry_id.nil?\n @results = Supplier.near(@search.location)\n else\n @results = Supplier.where(\"industry_id = ?\", @search.industry_id).near(@search.location)\n end\n ids = []\n @results.each do |r|\n ids.push r.id\n end\n @offers = Offer.where(supplier_id: ids).all\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n @profile = Profile.find_by_user_id(@trip.user_id)\n @custom_venues = Array.new\n @venue_categoies= Array.new\n @recommended = \"\"\n \n #This method will load results according to search paramater .\n if params[:search].present?\n @cafes = venueReport.search_venues(near: @trip.destination, query: params[:search] ,limit: 15)\n if @cafes.nil?\n flash[:error] = \"Sorry!! We didn't find any results for you.\"\n redirect_to caffes_url and return \n else\n @custom_venues << @cafes\n @recommended = params[:search]\n end\n \n else\n #Load all the recomandations based on User's like.\n my_string = @profile.likedvenue\n @recommended = my_string\n if my_string.include? \",\"\n elements = my_string.split(\",\")\n elements.delete_if{|e| e.length == 0}\n elements.each do |value|\n @venue_categoies << value\n @cafes = venueReport.search_venues(near: @trip.destination, query: value ,limit: 15) \n @custom_venues << @cafes\n end\n else\n @cafes = venueReport.search_venues(near: @trip.destination, query: @profile.likedvenue ,limit: 15) \n @custom_venues << @cafes\n @recommended = \"Recommended #{my_string}\"\n end\n end\n end",
"def from_museum\n\t\tif @random_number == 1\n\t\t\t@street_used = \"Fifth Ave.\"\n\t\t\t@location = \"Hillman\"\n\t\telse\n\t\t\t@street_used = \"Bar St.\"\n\t\t\t@location = \"Cathedral\"\n\t\tend\n\tend",
"def similar artist\n url = \"http://developer.echonest.com/api/v4/artist/similar?api_key=#{ECHONEST_API_KEY}&bucket=years_active&name=#{artist}&format=json&start=0&results=#{RESULTS}\"\n parseURL url\n #also get their hotness?\nend",
"def show\n @coords = params[:location]\n @full_width = true\n dish_moods = DishMood.where(\"mood_id = ?\", @mood.id).map{|d| d.dish_id}\n dishes_no_mood = Dish.joins(:restaurant).near([@coords.first, @coords.last], 0.75)\n @dishes = dishes_no_mood.select{|dish| dish_moods.include?(dish.id)}\n @dishes.shuffle!\n end",
"def auto_suggest(input,sports_reg_exp)\n similarity = 0\n sport_suggestion = \"\"\n # iterates through each regular expression option\n\n return \"\" if input == \" \" || input == \"\"\n sports_reg_exp.each do |sport, reg_exp|\n #hashmap to numerize the similarity\n count = Hash.new 0\n # hits on matches and adds to hash the size of the match\n input.scan(reg_exp).each {|elm| count[elm.length] += 1}\n temp_similarity = 0;\n count.each do |k,v|\n # longer matches are given more weight in the sum\n count[k] = k ** v\n temp_similarity += count[k]\n end\n # identifies the most similar spot\n if temp_similarity > similarity\n sport_suggestion = sport\n similarity = temp_similarity\n elsif temp_similarity == similarity\n # returns different sports for mistyped input\n sport_suggestion = sport if rand(0..1) == 1\n end\n end\n # returns empty string if not similar enough\n sport_suggestion = \"\" if (similarity == 1 || (similarity <= 3 && sport_suggestion.length > 15))\n sport_suggestion\nend",
"def location_search # :nologin: :norobots:\n query = create_query(:Location, :pattern_search, :pattern => Location.user_name(@user, params[:pattern].to_s))\n show_selected_locations(query, :link_all_sorts => true)\n end",
"def index\n\t\trender text: \"Cannot show nearby locations without a lat and lon.\", status: :bad_request and return unless params[\"lat\"] && params[\"lon\"]\n\t\tlat = Location.convert_lat_or_lon_to_d(params[\"lat\"])\n\t\tlon = Location.convert_lat_or_lon_to_d(params[\"lon\"])\n\t\tputs \"LAT:#{lat}\", \"LON:#{lon}\"\n\n\t\tangular_radius = @@DISTANCE / @@EARTH_RADIUS\n\t\tlat_min = lat - angular_radius\n\t\tlat_max = lat + angular_radius\n\t\tputs \"LAT_MAX:#{lat_max}\", \"LAT_MIN:#{lat_min}\"\n\n\t\tdelta_lon = Math.asin(Math.sin(angular_radius) / Math.cos(lat))\n\t\tlon_min = lon - delta_lon\n\t\tlon_max = lon + delta_lon\n\t\tputs \"LON_MAX:#{lon_max}\", \"LON_MIN:#{lat_min}\"\n\n\t\tlocations = nil\n\t\tif params[\"food\"]\n\t\t\tlocations = Location.joins({ vehicles: { vendor: :foods}})\n\t\t\t\t\t\t\t.where(\"foods.name ilike ? OR foods.name ilike '%everything%'\", \"%#{params['food']}%\").where(\"status = 'APPROVED'\")\n\t\t\t\t\t\t\t.where(\"lat BETWEEN ? AND ?\", lat_min, lat_max).where(\"lon BETWEEN ? AND ?\", lon_min, lon_max)\n\t\t\t\t\t\t\t.where(\"acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lon - ?)) <= ?\", lat, lat, lon, angular_radius)\n\t\t\t\t\t\t\t# formula distance = arccos(sin(lat1) · sin(lat2) + cos(lat1) · cos(lat2) · cos(lon1 - lon2)) * earth_radius\n\t\t\t\t\t\t\t# doesn't take into account poles or the 180th Meridian\n\t\telse\n\t\t\tlocations = Location.joins(:vehicles).where(\"status = 'APPROVED'\")\n\t\t\t\t\t\t\t.where(\"lat BETWEEN ? AND ?\", lat_min, lat_max).where(\"lon BETWEEN ? AND ?\", lon_min, lon_max)\n\t\t\t\t\t\t\t.where(\"acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lon - ?)) <= ?\", lat, lat, lon, angular_radius)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: locations }\n\t\t\tformat.html { render :nothing }\n\t\tend\n\tend",
"def grab_nearest_by_location(distance, loc)\n\n end",
"def google_search_response(auto_metareview)\n review_text_arr = auto_metareview.review_array\n # require 'ruby-web-search'\n count = 0\n temp_array = Array.new\n review_text_arr.each{\n |rev_text|\n if(!rev_text.nil?)\n #placing the search text within quotes to search exact match for the complete text\n response = RubyWebSearch::Google.search(:query => \"\\\"\"+ rev_text +\"\\\"\") \n #if the results are greater than 0, then the text has been copied\n if(response.results.length > 0)\n count+=1\n else\n temp_array << rev_text #copying the non-plagiarised text for evaluation\n end\n end\n }\n #setting temp_array as the @review_array\n auto_metareview.review_array = temp_array\n \n if(count > 0)\n return true\n else\n return false\n end\n end",
"def index\n if params[:search].present?\n @locations = Location.near(params[:search], 50)#, :order => :distance)\n else\n @locations = Location.all\n end\n end",
"def location\n fetch('rick_and_morty.locations')\n end",
"def evaluate\n\t\tif !empty?\n\t\t\tpossible_suggestion = PossibleSuggestion.new( trim_lastfm_track(@similar_tracks.shift) )\n\t\t\t#see if track is already in pool; see method 'return_suggestion_with_traits' in Blackboard class\n\t\t\tres = get_suggestion_from_pool_with_traits( possible_suggestion )\n\t\t\tif res\n\t\t\t\t#if we have seen this suggestion before, add the related assumption to the existing track\n\t\t\t\ttrack_recommended_more_than_once = Assumption.new( self, Constants::TRACK_RECOMMENDED_MORE_THAN_ONCE, res )\n\t\t\t\tres.add_affirmation( Affirmation.new(track_recommended_more_than_once) )\n\t\t\t\tputs \"SimilarTracks KS added positive assumption for #{res.get_artist}, #{res.get_track}\"\n\t\t\telsif !reject_pool_contains_suggestion?( possible_suggestion )\n\t\t\t\t@blackboard.add( possible_suggestion )\n\t\t\tend\n\t\telse\n\t\t\tputs \"SimilarTracks KS ran out of suggestions!\"\n\t\t\tConstants::NO_REMAINING_SUGGESTIONS\n\t\tend\n\tend",
"def recommendations\n unless params[:user_id].present?\n render json: { response: 'User id not present' }, status: :bad_request\n end\n\n user = User.find_by_id(params[:user_id])\n recommendations = []\n\n user.movies.each do |movie|\n recommendations_for_movie = Tmdb::Movie.recommendations(movie[:id])\n recommendations_for_movie[:results].each do |recommendation|\n recommendations << recommendation\n end\n end\n\n render json: { response: recommendations }, status: :ok\n end"
] |
[
"0.6895317",
"0.64271694",
"0.61626726",
"0.61371845",
"0.6095805",
"0.6088224",
"0.6049037",
"0.60365665",
"0.6002279",
"0.5947189",
"0.59232193",
"0.5922127",
"0.5903396",
"0.5897451",
"0.5890264",
"0.58837897",
"0.58737075",
"0.5868922",
"0.5841194",
"0.5817728",
"0.5791755",
"0.5772436",
"0.57722276",
"0.5769642",
"0.5765457",
"0.57482266",
"0.5681032",
"0.567922",
"0.5656989",
"0.56560254",
"0.5630486",
"0.56290734",
"0.5623864",
"0.56022555",
"0.5585032",
"0.55784947",
"0.5575802",
"0.5562084",
"0.555273",
"0.55433077",
"0.55388826",
"0.5538272",
"0.55308884",
"0.55240405",
"0.552337",
"0.55200136",
"0.5517187",
"0.55119944",
"0.55032194",
"0.54909027",
"0.5455451",
"0.5453171",
"0.5447794",
"0.5425871",
"0.5422093",
"0.54167795",
"0.5411788",
"0.5410528",
"0.5409989",
"0.540779",
"0.5401816",
"0.53961515",
"0.53950983",
"0.53931814",
"0.5371361",
"0.53695977",
"0.5349699",
"0.53494555",
"0.53263694",
"0.5317697",
"0.53113896",
"0.5308503",
"0.52990663",
"0.52988315",
"0.52956754",
"0.52893883",
"0.528766",
"0.5285283",
"0.5285082",
"0.5284002",
"0.52744055",
"0.5266109",
"0.52650815",
"0.5262313",
"0.5255468",
"0.5254795",
"0.5254244",
"0.5253458",
"0.52493024",
"0.5240594",
"0.5237526",
"0.52358",
"0.52310836",
"0.52303445",
"0.52282345",
"0.5226733",
"0.522422",
"0.52154297",
"0.5214747",
"0.52141356"
] |
0.7703625
|
0
|
Create a new logger.
|
def initialize(label = nil, &block)
@label = label
block.call(self) if block
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create(name = nil)\n logger_name = name || caller(1..1).first[/`(.+)'/, 1]\n Logger.new(logger_name)\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def create(name, level = ::Logger::INFO)\n dir = \"#{Bitcoin.base_dir}/log\"\n FileUtils.mkdir_p(dir)\n logger = ::Logger.new(dir + \"/#{name}.log\", 10)\n logger.level = level\n logger.formatter = proc do |severity, datetime, progname, msg|\n Format % [severity[0..0], format_datetime(datetime), $$,\n Thread.current.object_id, severity, progname, msg2str(msg)]\n end\n logger\n end",
"def create_logger(conf)\n name = self.class.to_s\n @logger = Patriot::Util::Logger::Factory.create_logger(name, conf)\n end",
"def create_logger(outputter=STDOUT, level=Logger::INFO)\n LOGGER.set_logger(Logger.new(outputter, level))\n end",
"def new_logger(path)\n if path.is_a? String\n FileUtils.touch path # prevent autocreate messages in log\n Logger.new path\n elsif path.is_a? Array\n log_file, logs_files_to_keep, log_files_max_size, * = path\n FileUtils.touch log_file # prevent autocreate messages in log\n Logger.new(log_file, logs_files_to_keep, log_files_max_size)\n end\n end",
"def logger log_name, resource, labels = {}\n Logger.new self, log_name, resource, labels\n end",
"def create_logger\r\n new_logger = Log4r::Logger.new(\"SAF\")\r\n new_logger.outputters = [Log4r::Outputter.stdout]\r\n Log4r::Outputter.stdout.formatter = SAFSTDOUTFormatter.new\r\n\r\n return new_logger\r\n end",
"def log_create(p_args)\n Logging::create_log(p_args)\n end",
"def create_logger path\n #path = File.join(ENV[\"LOGDIR\"] || \"./\" ,\"canis14.log\")\n _path = File.open(path, File::WRONLY|File::TRUNC|File::CREAT) \n logg = Logger.new(_path)\n raise \"Could not create logger: #{path}\" unless logg\n # if not set, will default to 0 which is debug. Other values are 1 - info, 2 - warn\n logg.level = ENV[\"CANIS_LOG_LEVEL\"].to_i\n colors = Ncurses.COLORS\n logg.info \"START #{colors} colors -- #{$0} win: #{@window} : log level: #{logg.level}. To change log level, increase CANIS_LOG_LEVEL in your environment to 1 or 2 or 3.\"\n return logg\n end",
"def logger\n @logger ||= create_logger\n end",
"def logger\n @logger ||= create_logger\n end",
"def logger\n Logger.new(files[:logfile], 10, 1024000)\n end",
"def initialize_logger\n return if @logger.blank?\n log = @logger\n log = log.to_s if log.is_a?(Pathname)\n if log.is_a?(String)\n log = File.join(TMP_ROOT_DIR, log) unless log.start_with?('/')\n @logger =\n Logger.new(log).tap { |l| l.level = Logger.const_get(@log_level) }\n end\n unless @logger.is_a?(Logger)\n raise \"expected String, got #{log.class} #{log.inspect}\"\n end\n end",
"def logger(name = self.class.name)\n Logger.new(name)\n end",
"def logger\n return @local_logger if @local_logger\n FileUtils.mkdir_p(File.dirname(log_path)) unless File.exists?(File.dirname(log_path))\n\n if API_KEYS[\"logentries\"]\n token = API_KEYS[\"logentries\"][Rails.env][\"nsc\"]\n @local_logger = Le.new(token, :debug => false, :local => log_path, :ssl => true, :tag => true)\n else\n @local_logger = Logger.new(log_path)\n end\n @local_logger\n end",
"def create_logger\n l = self['logger']\n\n if l == true or l.nil?\n ::Logger.new(production? ? project_path('production.log') : STDOUT)\n elsif l.is_a?(Class)\n l.new(production? ? project_path('production.log') : STDOUT)\n elsif l.is_a?(Proc)\n l.call\n elsif l\n raise 'bad logger configure, should be: `true` / `false` / Class / Proc'\n end\n end",
"def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end",
"def build_logger\n path = Hanami.root.join(\"log\", [\"emergency_log.\", Hanami.env].join)\n Logger.new(path)\n end",
"def logger\n return @logger if defined?(@logger) && !@logger.nil?\n path = log_path\n FileUtils.mkdir_p(File.dirname(path))\n prepare_logger(path)\n rescue\n prepare_logger(STDOUT)\n end",
"def create_logfile\n LibLog.create_logfile(ClientConfig::LOGGING,\n ClientConfig::LOG_LOCATION,\n ClientConfig::LOG_FILENAME)\n end",
"def new_logger(name, logdev, loglvl)\n logdev = [ global_logdev(name), logdev, $stderr ].find { |e| e }\n loglvl = [ global_loglvl(name), loglvl, Logger::INFO ].find { |e| e }\n logger = Logger.new(logdev)\n logger.level = loglvl\n logger.formatter = proc { |sev, datetime, progname, msg|\n \"#{name}: #{msg}\\n\"\n }\n children[name] = { logdev: logdev, loglvl: loglvl }\n logger\n end",
"def logger\n @logger ||= Testable::Logger.new.create\n end",
"def logger\n @logger ||= Testable::Logger.new.create\n end",
"def create_logger\n\n logger_level = settings[\"log.level\"] || \"info\"\n\n # log everything to STDERR or specified logfile\n logger = Yell::Logger.new(:null)\n logger.format = logger_format\n logger.level = logger_level\n\n logger_destination = settings[\"log.file\"] || \"STDERR\"\n # We intentionally repeat the logger_level\n # on the adapter, so it will stay there if overall level\n # is changed.\n case logger_destination\n when \"STDERR\"\n logger.adapter :stderr, level: logger_level, format: logger_format\n when \"STDOUT\"\n logger.adapter :stdout, level: logger_level, format: logger_format\n else\n logger.adapter :file, logger_destination, level: logger_level, format: logger_format\n end\n\n\n # ADDITIONALLY log error and higher to....\n if settings[\"log.error_file\"]\n logger.adapter :file, settings[\"log.error_file\"], :level => 'gte.error'\n end\n\n return logger\n end",
"def create_logger\n\n logger_level = settings[\"log.level\"] || \"info\"\n\n # log everything to STDERR or specified logfile\n logger = Yell::Logger.new(:null)\n logger.format = logger_format\n logger.level = logger_level\n\n logger_destination = settings[\"log.file\"] || \"STDERR\"\n # We intentionally repeat the logger_level\n # on the adapter, so it will stay there if overall level\n # is changed.\n case logger_destination\n when \"STDERR\"\n logger.adapter :stderr, level: logger_level, format: logger_format\n when \"STDOUT\"\n logger.adapter :stdout, level: logger_level, format: logger_format\n else\n logger.adapter :file, logger_destination, level: logger_level, format: logger_format\n end\n\n\n # ADDITIONALLY log error and higher to....\n if settings[\"log.error_file\"]\n logger.adapter :file, settings[\"log.error_file\"], :level => 'gte.error'\n end\n\n return logger\n end",
"def create_logger\n transform_log_dir = Pathname.new(\"edi/logs/out\").join(Time.now.strftime(\"%Y_%m_%d\"), 'transformers')\n transform_log_dir.mkpath\n EdiHelper.make_transform_log(transform_log_dir.to_s,\n @filename + \"_\" +\n Time.now.strftime(\"%m_%d_%Y_%H_%M_%S\") +\n \".log\", 'out')\n end",
"def logger\n @logger ||= _new_logger\n end",
"def create_logger(job_id)\n log_file_path = File.join(JOB_LOG_DIR, \"job_#{job_id}.log\")\n logger = Logger.new(log_file_path)\n logger.formatter = proc do |severity, datetime, progname, msg|\n \"#{datetime.strftime(\"%Y-%m-%d %H:%M:%S\")} : #{severity} : #{msg}\\n\"\n end\n return logger\n end",
"def logger\n @_logger ||= ::Logger.new(log_file)\n end",
"def logger\n @logger ||= build_logger\n end",
"def logger\n dir = File.dirname(\"#{Rails.root}/log/#{self.id}/game.log\")\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n @logger ||= Logger.new(\"#{Rails.root}/log/#{self.id}/game.log\")\n end",
"def add_logger(arg)\n key = nil\n logger = nil\n io = nil\n if arg.is_a? String\n # We have a filename\n key = File.basename(arg)\n\n # Try to create the logger.\n io = File.new(arg, File::WRONLY | File::APPEND | File::CREAT)\n logger = Logger.new(io)\n\n # Initialize logger\n io.write \"Logging to '#{arg}' initialized with level #{string_level(@default_level)}.\\n\"\n logger.level = convert_level(@default_level)\n else\n # We have some other object - let's hope it's an IO object\n key = nil\n case arg\n when STDOUT\n key = 'STDOUT'\n when STDERR\n key = 'STDERR'\n else\n key = arg.to_s\n end\n\n # Try to create the logger.\n io = arg\n logger = Logger.new(io)\n\n # Initialize logger\n io.write \"Logging to #{key} initialized with level #{string_level(@default_level)}.\\n\"\n logger.level = convert_level(@default_level)\n end\n\n # Set the logger formatter\n logger.formatter = @formatter\n\n # Extend logger instances with extra functionality\n logger.extend(::TeeLogger::LoggerExtensions)\n logger.teelogger_io = io\n logger.flush_interval = DEFAULT_FLUSH_INTERVAL\n\n # Flush the \"Logging to...\" line\n logger.flush\n\n if not key.nil? and not logger.nil? and not io.nil?\n @loggers[key] = logger\n @ios[key] = io\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def logger\n @logger ||= Logger.new(@log_file_name)\n\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"%s, [%s #%d] (%s) %5s -- %s: %s\\n\" % [severity[0..0], datetime, $$, Conf.global_conf[:hostname], severity, progname, msg]\n end\n\n if Conf.global_conf[:debug]\n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::INFO\n end\n @logger\n end",
"def setup_log(type=:memory)\n case type\n when :memory\n @log_content = StringIO.new\n @logger = Logger.new(@log_content)\n else\n unless defined?(@@log_file_base_name)\n @@log_file_base_name = File.normalize_path(File.join(Dir.tmpdir, \"#{File.basename(__FILE__, '.rb')}_#{Time.now.strftime(\"%Y-%m-%d-%H%M%S\")}\"))\n @@log_file_index = 0\n end\n @@log_file_index += 1\n @log_file_name = \"#{@@log_file_base_name}_#{@@log_file_index}.log\"\n @log_file = File.open(@log_file_name, 'w')\n @logger = Logger.new(@log_file)\n end\n\n @logger.level = is_debug? ? Logger::DEBUG : Logger::INFO\n return @logger\n end",
"def log\n @logger ||= Logger.new(nil)\n @logger\n end",
"def new(context)\n dup.tap do |logger|\n logger.context = \"#{logger.context}#{context_separator}#{context}\"\n end\n end",
"def create_logger\n logger = Log4r::Logger.new(\"rrproxy\")\n log_format = Log4r::PatternFormatter.new(:pattern => \"[%d : %l] %m\")\n logger.add(Log4r::StdoutOutputter.new(\"console\", :formatter => log_format))\n logger.level = Log4r::INFO\n logger\nend",
"def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end",
"def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end",
"def log\n unless self.class._slflogger\n self.class.createlogger\n end\n return self.class._slflogger\n end",
"def initialize\n @logger = Logger.new('cf_flattener.log')\n end",
"def initialize(filename, level, rotation=10, max_size=1024000)\n # create the directory for the log if it doesn't exist\n if !File.exist? File.dirname(filename)\n FileUtils.mkdir_p File.dirname(filename)\n end\n\n @log ||= Logger.new(filename, rotation, max_size)\n @log.level = level\n @log\n end",
"def logger\n if @logger.nil?\n @logger = Logger::new(STDOUT)\n \n # formatter\n default = Logger::Formatter::new\n @logger.formatter = proc do |severity, datetime, progname, msg|\n progname = @targets.from\n msg = \"##{Thread.current.object_id} \" + msg \n default.call(severity, datetime, progname, msg)\n end\n end\n \n return @logger\n end",
"def logger\n initialize_logger unless @logger\n @logger\n end",
"def logger\n init unless @initialized\n logger = @logger\n end",
"def initLogger()\n\tconfig = FileUtil.loadjson(File.dirname(__FILE__) + '/utilcfg.json')\n\tif config.key?('log.path')\n\t\tlpath = config['log.path']\n\t\tunless File.file?(lpath)\n\t\t\tdpath = lpath.gsub(/[^\\/]+$/,'')\n\t\t\tDir.mkdir(dpath) unless Dir.exist?(dpath)\n\t\tend\n\t\tif config.key?('log.interval')\n\t\t\t$logger = Logger.new(lpath, config['log.interval'])\n\t\telse\n\t\t\t$logger = Logger.new(lpath)\n\t\tend\n\tend\n\tLogUtil.setformatter\n\tLogUtil.setloglevel(config['log.level'])\nend",
"def setup_logger(log_name)\n date = Time.new.localtime.strftime('%F %H.%M.%S%L')\n logger = Logger.new(\"#{$VALUE}/test_logs/#{log_name}_#{date}.log\")\n logger.formatter = proc do |severity, datetime, _progname, msg|\n date_format = datetime.strftime('%Y-%m-%d %H:%M:%S%L')\n if (severity == 'INFO') || (severity == 'WARN')\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n else\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n end\n end\n logger\nend",
"def logger\n raise NotImplementedError\n end",
"def new_tagged_logger; end",
"def initialize_logger(logging_directory, log_file_name, logging_level)\n logger = Logger.new(\"#{logging_directory}/#{log_file_name}\", 100, 1048576) # Keep last 100 log files, rotating them when they reach 1MB in size.\n logger.level = filter_logging_level logging_level\n # Suppress the default logging chatter.\n logger.formatter = proc do |severity, datetime, progname, msg|\n \"#{msg}\\n\"\n end\n\n logger\n end",
"def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end",
"def init_logger\n log = Log4r::Logger.new(STANDARD_LOGGER)\n log.trunc = true\n\n # sanity checks since we defined log4r's dynamic levels statically\n unless (Log4r::DEBUG == DEBUG) &&\n (Log4r::INFO == INFO) &&\n (Log4r::WARN == WARN) &&\n (Log4r::ERROR == ERROR) &&\n (Log4r::FATAL == FATAL)\n raise \"Logger levels do not match Log4r levels, levels may have been customized\"\n end\n\n Log4r::Logger[STANDARD_LOGGER].level = ERROR\n Log4r::Logger[STANDARD_LOGGER].trace = true\n\n Log4r::StderrOutputter.new :console\n Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => \"[%l] %m\")\n log.add(:console)\n end",
"def log_file_creation()\n\tcurrent_path = File.dirname(File.realpath(__FILE__))\n\t$csv_path = \"#{current_path}/Attachments.csv\"\n\tif !File.directory?(\"#{current_path}/logs\")\n\t\tFileUtils.mkdir_p \"#{current_path}/logs\"\n\tend\n\t$log_path = \"#{current_path}/logs/jira-attachment-upload.txt\"\n\t$log = Logger.new(\"#{current_path}/logs/jira-attachment-upload.txt\", 'daily')\nend",
"def _logger\n @logger ||= Log4r::Logger.new(self.class.to_s)\n end",
"def init_logs\n begin\n if !@cloud.log_directory.nil?\n node_log_file = @cloud.log_directory + \"/#{@name.to_s}.log\"\n if !File.exists?(node_log_file)\n File.new(node_log_file, \"a+\")\n @log_file = node_log_file\n @logger.info \"Created #{node_log_file}\"\n end\n outputter = Log4r::FileOutputter.new(\"#{@name.to_s}-file\", :formatter => FileFormatter.new, :filename => node_log_file, :truncate => false)\n @logger.add(outputter)\n end\n rescue RuntimeError => rerr\n if !rerr.message.eql?(\"Maestro not configured correctly. Either RAILS_ROOT, Rails.root, or ENV['MAESTRO_DIR'] must be defined\")\n @logger.error \"Unexpected Error\"\n @logger.error rerr\n end\n rescue SystemCallError => syserr\n @logger.error \"Error creating Node log file\"\n @logger.error syserr\n rescue StandardError => serr\n @logger.error \"Unexpected Error\"\n @logger.error serr\n end\n end",
"def logger(log_level = Logger::ERROR,log_file = nil)\n if log_file.nil?\n @log = Logger.new(STDOUT)\n else\n @log = Logger.new(log_file)\n end\n @log.level = log_level\n @log.formatter = proc { |severity, datetime, progname, msg|\n \"[#{datetime.strftime(\"%Y-%m-%d %H:%M:%S\")}] #{severity}: #{msg}\\n\"\n }\n end",
"def configure_logger_for(classname)\n # handle case in which log path does not exists\n begin\n logger = Logger.new(@log_path)\n rescue Errno::ENOENT\n FileUtils.mkdir_p File.dirname @log_path\n retry\n end\n\n logger.progname = classname\n logger.level = @level\n logger.formatter = proc { |severity, datetime, progname, msg|\n case severity\n when 'DEBUG'\n spaciator = \" *\"\n after_space = \"\"\n when 'INFO'\n spaciator = \" **\"\n after_space = \" \"\n when 'WARN'\n spaciator = \" ***\"\n after_space = \" \"\n when 'ERROR'\n spaciator = \" ****\"\n after_space = \"\"\n when 'FATAL'\n spaciator = \"*****\"\n after_space = \"\"\n else\n spaciator = \" \"\n after_space = \"\"\n end\n\n formatted_output = \" #{spaciator} [#{severity}]#{after_space} [#{datetime}] -- #{msg} { #{progname} }\\n\"\n formatted_output\n }\n logger\n end",
"def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n else\n eval(get_rails_default_logger_name)\n end \n end",
"def new\n @log = Log.new\n end",
"def initialize\n @logger = Logging::Logger[self]\n end",
"def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end",
"def init_logger\n l = Logger.new(STDOUT)\n l.level = Logger::INFO\n Log.logger = l\nend",
"def log\n return @logger if @logger\n @logger = Logger.new(LogFile)\n @logger.level = Logger::INFO\n @logger\n end",
"def named(name)\n new_name = self.progname.to_s.dup\n new_name << \".\" unless new_name.empty?\n new_name << name\n new_logger = Logger.new(*@base_args)\n [:level, :formatter, :datetime_format].each do |m|\n new_logger.send(\"#{m}=\", self.send(m))\n end\n new_logger.progname = new_name\n new_logger\n end",
"def setupLog(fileName)\n\t# Setting up logging feature\n\tlogFile = File.open(fileName, 'w')\n\tlog = Logger.new(logFile)\n\tlog.formatter = proc do |severity, datetime, progname, msg|\n\t Time.now.asctime + \":: #{msg}\\n\"\n\tend\n\treturn log\nend",
"def logger!(_output)\n @logger = Logger.new(_output)\n end",
"def with_prefix (string)\n Logger.send(:new, string)\n end",
"def logger\n\t\t\tunless CLILogging.class_variable_defined?(:@@logger)\n\t\t\t\t@@logger = CLILogger.new\n\t\t\t\t@@logger.progname=$0\n\t\t\tend\n\t\t\t@@logger\n\t\tend",
"def logger\n\t\t\tunless CLILogging.class_variable_defined?(:@@logger)\n\t\t\t\t@@logger = CLILogger.new\n\t\t\t\t@@logger.progname=$0\n\t\t\tend\n\t\t\t@@logger\n\t\tend",
"def logger\n @logger ||= NilLogger.new\n end",
"def make_own_logger(new_progname = nil, new_level = nil)\n new_logger = @logger || self.logger.dup\n if new_progname\n new_logger.progname = new_progname\n end\n if new_level\n new_logger.level = new_level\n end\n self.logger = new_logger\n end",
"def initialize(*, verbose: '1', log_file: STDERR, **)\n v = (verbose =~ /\\d+/) ? verbose.to_i : verbose.to_sym\n self.logger = Logger.new(log_file, v)\n end",
"def logger\n @logger ||=\n begin\n logger = SemanticLogger::Processor.logger.clone\n logger.name = self.class.name\n logger\n end\n end",
"def initialize(logdev, shift_age=0, shift_size=0)\n @default_shift_age = shift_age\n @default_shift_size = shift_size\n target = ::Logger.new(logdev, shift_age, shift_size)\n target.formatter = DEFAULT_FORMATTER\n @targets = [target]\n end",
"def logger\n @_logger ||= Logger.new(self)\n end",
"def logger\n ::Logger.new($stdout).tap do |log|\n log.formatter = proc do |severity, _datetime, _progname, msg|\n prep = ' ' * (severity.size + 3)\n message = msg.lines.map.with_index do |str, i|\n next str if i.zero?\n\n str.strip.empty? ? str : prep + str\n end\n color = severity.downcase.to_sym\n msg = +\"[#{SeccompTools::Util.colorize(severity, t: color)}] #{message.join}\"\n msg << \"\\n\" unless msg.end_with?(\"\\n\")\n msg\n end\n end\n end",
"def create_child_logger(child_name)\n # add child_prefix + child_id\n instance_name = [\n @options[:_instance], self.class.child_prefix, child_name\n ].compact.join(self.class.separator)\n\n self.class.new(*@args, @options.merge(_instance: instance_name))\n end",
"def logger_func()\n\t########TO DO########\n# logging configuration\n# logger = Logger.new(STDOUT)\n# log_file = File.open(\"/Users/rubenalberto/Desktop/my-output.log\", \"a\")\n# logger = Logger.new(TeeRb::IODelegate.new(log_file, STDOUT))\n#logger = Logger.new(log_file)\nend",
"def start_logger\n if config && config[:log] == \"file\" && config.log_file_path\n start_file_logger(config.log_file_path)\n else\n start_stdout_logger\n end\n\n logger.level =\n if config\n config.log_level\n else\n Appsignal::Config::DEFAULT_LOG_LEVEL\n end\n logger << @in_memory_log.string if @in_memory_log\n end",
"def logger\n @logger ||= begin\n l = ::Logger.new logfile\n l.level = loglevel\n l.progname = \"EM::AWS\"\n l\n end\n end",
"def logger\n @logger ||= default_logger\n end",
"def logger\n classname = self.class.name\n methodname = caller[0][/`([^']*)'/, 1]\n\n @_logger ||= ProjectHanlon::Logging.logger_for(classname, methodname)\n @_logger.progname = \"#{caller[0]}>>#{classname}\\##{methodname}\"\n @_logger\n end",
"def initialize_log(log)\n close if @log # be sure that we don't leave open files laying around.\n\n if log.respond_to?(:write)\n @log = log\n elsif File.exist?(log)\n @log = open(log, (File::WRONLY | File::APPEND))\n @log.sync = true\n else\n FileUtils.mkdir_p(File.dirname(log)) unless File.directory?(File.dirname(log))\n @log = open(log, (File::WRONLY | File::APPEND | File::CREAT))\n @log.sync = true\n @log.write(\"#{Time.now.httpdate} #{delimiter} info #{delimiter} Logfile created\\n\")\n end\n end",
"def logger(filename = nil)\n logger = Logger.new(filename || STDOUT)\n logger.level = verbose? ? Logger::DEBUG : Logger::INFO\n logger.formatter = proc do |severity, datetime, _prog_name, msg|\n time_s = severity == 'DEBUG' ? LOG_SPACE : datetime.strftime(LOG_TIME)\n \"#{time_s}#{msg}\"\n end\n logger\n end",
"def logger\n @logger ||= Logger.new(\"/dev/null\")\n end",
"def logger\n @logger ||= default_logger\n end",
"def logger\n @logger ||= LogAdapter.new(Stevenson.new, (ENV[\"DAODAO_LOG_LEVEL\"] || :info).to_sym)\n end",
"def configure_logger_for(name)\n logger = Logger.new(@logdev, @shift_age, @shift_size)\n logger.level = @level\n logger.progname = name\n logger.formatter = formatter\n logger\n end",
"def initialize(log_dir = VidazingLogger::LOG_DIR, name:)\n @name = name\n @log_dir = log_dir\n\n create_log_dir\n end",
"def set clazz, *args\n @logger = clazz.send(:new, *args)\n end",
"def logger(level = Logger::INFO)\n unless @logger\n @logger = Logger.new(STDOUT)\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"#{ident} (#{severity}): #{msg}\\n\"\n end\n end\n\n @logger.level = level\n @logger\n end",
"def logger\n @logger ||= Logger.new(self)\n end",
"def logger\n if @logger.nil?\n @logger = Logger.new($stdout)\n @logger.level = Logger::WARN\n @logger.formatter = proc do |severity, datetime, m_progname, msg|\n \"[#{datetime.strftime('%F %H:%M:%S')} #{severity.red}] #{msg}\\n\"\n end\n end\n @logger\n end",
"def logger\n classname = (self.is_a? Module) ? self : self.class.name\n @logger ||= Loggable.logger_for(classname)\n end",
"def logger\n init_logger if Log4r::Logger[STANDARD_LOGGER].nil?\n Log4r::Logger[STANDARD_LOGGER]\n end",
"def logger\n @logger ||= ::Logger.new STDOUT\n end"
] |
[
"0.79765797",
"0.794848",
"0.794848",
"0.78039277",
"0.75099957",
"0.7403024",
"0.73947096",
"0.7295929",
"0.72065526",
"0.7194099",
"0.7097616",
"0.6976701",
"0.6976701",
"0.6968951",
"0.6941117",
"0.69383436",
"0.6933682",
"0.69134665",
"0.68358564",
"0.68244165",
"0.6804667",
"0.6798809",
"0.6790142",
"0.67576766",
"0.67576766",
"0.6725192",
"0.6725192",
"0.66984963",
"0.66459614",
"0.6643513",
"0.66033244",
"0.6542763",
"0.6512227",
"0.64876974",
"0.6473995",
"0.6473995",
"0.6473995",
"0.645974",
"0.64279073",
"0.64195365",
"0.64024687",
"0.64024264",
"0.6391534",
"0.6391534",
"0.6375456",
"0.6372737",
"0.63576585",
"0.6337067",
"0.6326535",
"0.63129824",
"0.62694204",
"0.6259941",
"0.62588495",
"0.625878",
"0.62581193",
"0.6256008",
"0.6252454",
"0.62317234",
"0.6219998",
"0.62124115",
"0.6207843",
"0.6204136",
"0.6202704",
"0.61903757",
"0.6177708",
"0.6175843",
"0.61687595",
"0.6162907",
"0.6148341",
"0.6148242",
"0.61419696",
"0.61384076",
"0.61363256",
"0.61363256",
"0.61355966",
"0.6130621",
"0.6126554",
"0.6124317",
"0.61188686",
"0.6104471",
"0.6087737",
"0.6086252",
"0.60845166",
"0.6075336",
"0.6074065",
"0.6073545",
"0.60720897",
"0.60704565",
"0.60575527",
"0.6034116",
"0.603173",
"0.6022181",
"0.6019126",
"0.6010938",
"0.6010886",
"0.601054",
"0.60093987",
"0.60026556",
"0.5999409",
"0.5998656",
"0.59900653"
] |
0.0
|
-1
|
The cached formatter instance. If there's none, one will be created.
|
def formatter
@formatter ||= Formatters::Default.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @formatter = method(:default_formatter)\n end",
"def formatter\n @formatter.formatter\n end",
"def formatter()\n @formatter\n end",
"def formatter=(formatter)\n @formatter =\n if formatter.nil?\n respond_to?(:call) ? self : default_formatter\n else\n Formatters.factory(formatter)\n end\n end",
"def initialize\n @formatter = nil\n reset!\n end",
"def formatter\n @formatter ||= HumanFormatter.new\n end",
"def formatter_loader\n @formatter_loader ||= NagiosHerald::FormatterLoader.new\n end",
"def formatter fmt\n @formatter = fmt\n end",
"def use_formatter(formatter)\n @formatter = formatter\n end",
"def formatter\n @formatter ||= PdfFormatter.new\n end",
"def formatter\n @formatter ||= Unipept::Formatter.new_for_format(options[:format])\n end",
"def formatted_with( new_formatter, &block )\n\t\treturn self.clone_with( formatter: new_formatter, &block )\n\tend",
"def formatted_with( new_formatter, &block )\n\t\treturn self.clone_with( formatter: new_formatter, &block )\n\tend",
"def create_formatter\n BunyanFormatterWithSilencedTimestamp.new\n end",
"def formatter\n return @formatter if @formatter\n\n # The below allows for arbitrary fields that aren't on the object\n value = @builder.object.send(@method) if @builder.object.respond_to?(@method)\n @formatter = Core::FormatterDelegate.new(value: value, type: :automatic)\n end",
"def get_formatter_class\n fail 'get_formatter_class method is not override'\n end",
"def formatter(value=nil,&block)\n if block_given?\n @formatter=Lolita::Support::Formatter.new(value,&block) \n elsif value || !@formatter\n if value.kind_of?(Lolita::Support::Formatter)\n @formatter=value\n else\n @formatter=Lolita::Support::Formatter::Rails.new(value)\n end\n end\n @formatter\n end",
"def format\n @format ||= Manipulator.new\n end",
"def formatter\n raw_data['formatter']\n end",
"def formatter=(formatter)\n @formatter.formatter = formatter\n end",
"def use(formatter)\n formatters << proc { |progress| formatter.new(progress) }\n end",
"def formatter(formatter = T.unsafe(nil)); end",
"def formatter\n raise NotImplementedError\n end",
"def default_formatter\n Sapience::Formatters::Default.new\n end",
"def format\n @format ||= properties.format.new self\n end",
"def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end",
"def default_formatter\n SemanticLogger::Formatters::Default.new\n end",
"def get_formatter_class\n Formatter::V0::Customer\n end",
"def register_formatter formatter_class\n @formatters << formatter_class.new\n end",
"def register_formatter formatter_class\n @formatters << formatter_class.new\n end",
"def use_format(formatter, *args)\n klass = formatter.is_a?(Class) ? formatter : formatter_class(formatter)\n self.output = klass.new($stdout, *args)\n end",
"def formatters\n @formatters ||= {}\n end",
"def formatter\n @loggers.each do |logger|\n return logger.formatter if logger.respond_to?(:formatter)\n end\n end",
"def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end",
"def format\n @format ||= self._format_default\n end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def set_formatter(formatter)\n @formatter = formatter\n end",
"def formatter_config\n formatter.config\n end",
"def diff_formatter= diff_formatter\n register_diff_formatter(/.*/, diff_formatter)\n register_diff_formatter(nil, diff_formatter)\n end",
"def default_formatter\n SemanticLogger::Formatters::Json.new\n end",
"def default_formatter\n SemanticLogger::Formatters::Json.new\n end",
"def default_formatter\n SemanticLogger::Formatters::Json.new\n end",
"def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n \"#{progname}##{caller_method}\",\n msg.dump)\n end\n end",
"def create_formatter(config)\n log_format = get_format_config(config)\n formatter = Log4r::PatternFormatter.new(:pattern => log_format)\n return formatter\n end",
"def add_formatter formatter = nil, &block\n @formatters.push( formatter ) unless formatter.blank?\n @formatters.push( block ) if block_given?\n end",
"def create_formatter\n ::Ougai::Formatters::Bunyan.new\n end",
"def configure_formatter(format, output = nil)\n @formatters << MetricFu::Formatter.class_for(format).new(output: output)\n end",
"def formatter\n @formatter ||= ::Shell::Formatter::Console.new\n end",
"def log_formatter=(_arg0); end",
"def log_formatter=(_arg0); end",
"def format\n @format ||= {}\n end",
"def load_formatters\n @formatters_loaded ||= formatter_loader.load_formatters\n end",
"def to_missing_format(formatter_name, options={})\n formatter_klass = Timely::Formats.const_get(formatter_name.camelcase)\n to_format formatter_klass, options\n end",
"def outputter(value = nil)\n setget(:@formatter, value)\n end",
"def formatter\n return @formatter if defined? @formatter\n\n options = @store.rdoc.options\n this = RDoc::Context === self ? self : @parent\n\n @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this\n @formatter.code_object = self\n @formatter\n end",
"def formatter=(proc)\n @formatter = proc\n end",
"def default_formatter\n SemanticLogger::Formatters::Raw.new\n end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def get_formatter_class\n Formatter::V2::UsersKycDetail\n end",
"def <<(formatter)\n unless formatter.respond_to?(:format)\n raise 'Formatter does not respond to `format` method'\n end\n @formatters << formatter\n end",
"def formatters=(formatters); end",
"def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end",
"def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end",
"def register_formatter(name, &block)\n Valuable::Utils.formatters[name] = block\n end",
"def log_formatter; end",
"def log_formatter; end",
"def result_as(formatter)\n formatter.new(@result).format\n end",
"def format(formatter = DateTimeFormatter::ISO_LOCAL_TIME)\n formatter.format self\n end",
"def format(value = nil)\n if value.nil?\n @format ||= nil\n else\n @format = value\n end\n end",
"def format_renderer(format)\n renderer_name = format.to_s.capitalize + \"Renderer\"\n\n begin\n renderer_class = Object.const_get(renderer_name)\n rescue\n Logging.logger.warn(\"Renderer #{renderer_name} not found. Falling back to plaintext.\")\n renderer_class = Object.const_get(\"PlaintextRenderer\")\n end\n\n renderer_class.new(verbose, group)\n end",
"def default_formatter\n if protocol == :syslog\n # Format is text output without the time\n SemanticLogger::Formatters::Default.new(time_format: nil)\n else\n SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)\n end\n end",
"def format\n @_format\n end",
"def cached_instance\n @cached_instance ||= read_instance\n end",
"def formatter_for(klass) # :nodoc:\n check_modules = true\n until klass.nil?\n formatter = @class_formatters[klass.name]\n return formatter if formatter\n\n if check_modules\n _, formatter = @module_formatters.detect { |mod, f| klass.include?(mod) }\n check_modules = false\n return formatter if formatter\n end\n\n klass = klass.superclass\n end\n end",
"def initialize\r\n raise MissingFormatterMethodError unless @node\r\n @default_font_size = @document.default_paragraph_style.font_size\r\n set_text_runs\r\n end",
"def build_formatter_options(formatter, column_def)\r\n r = {}\r\n if formatter == :function\r\n r[:formatter_function] = column_def[:formatter_function]\r\n end\r\n r\r\n end",
"def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end",
"def coerce_formatter(name)\n case name\n when String, Symbol\n const_name = if Formatters.const_defined?(name.upcase)\n name.upcase\n else\n name.capitalize\n end\n Formatters.const_get(const_name)\n when Class\n name\n else\n raise_formatter_error(name)\n end\n rescue NameError\n raise_formatter_error(name)\n end",
"def toggle_formatter\n config[:formatter] = !config[:formatter]\n end",
"def create_format_method\n end",
"def cached\n self\n end",
"def initialize(&formatter) \n\t\t@title = 'Monthly Report' \n\t\t@text = [ 'Things are going', 'really, really well.' ] \n\t\t@formatter = formatter\n\tend",
"def set_format(name)\n id = name.to_s.capitalize\n @formatter = Berkshelf.const_get(\"#{id}Formatter\").new\n end",
"def format(value = nil, &block)\n __define__(:format, value, block)\n end",
"def format idx\n case idx\n when Integer\n @formats[idx] || @default_format || Format.new\n when String\n @formats.find do |fmt| fmt.name == idx end\n end\n end",
"def cache\n @__cache ||= Cache.new self\n end",
"def formatter_for(volume, type)\n type_str = type.to_s.split(\"_\").map(&:capitalize).join\n namespace_str = volume.config[:type].to_s.split(\"_\").map(&:capitalize).join\n sym = :\"#{namespace_str}#{type_str}Formatter\"\n @formatters ||= {}\n @formatters[sym] ||= CSKit::Formatters.const_get(namespace_str.to_sym).const_get(sym).new\n end",
"def formatter(io)\n if @formatter_klass then\n @formatter_klass.new\n elsif paging? or !io.tty? then\n RDoc::Markup::ToBs.new\n else\n RDoc::Markup::ToAnsi.new\n end\n end",
"def style_default\n lock(:s) do\n @cache[:s][:default] ||= style_new\n end\n end",
"def formatter?\n subscribers.any? { |s| s.respond_to?(:is_formatter?) && s.is_formatter? }\n end",
"def test_new_formatter\n assert_instance_of NagiosHerald::Formatter::CheckMemory, @formatter\n end",
"def formatters\n mentos(:get_all_formatters).inject(Hash.new) do | hash, (name, desc, aliases) |\n # Remove the long-winded and repetitive 'Formatter' suffix\n name.sub!(/Formatter$/, '')\n hash[name] = {\n :name => name,\n :description => desc,\n :aliases => aliases\n }\n hash\n end\n end",
"def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end",
"def clear\n @class_formatters.clear\n @module_formatters.clear\n self\n end",
"def with_format(format)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end",
"def initialize(json_formatter, html_formatter)\n @json_formatter = json_formatter.output_hash\n @html_formatter = html_formatter\n @build_number = CommonUtil.get_installed_d2d_version\n #@build_number = \"1111.1\"\n if @json_formatter[:summary][:failure_count] > 0\n @bq_status = \"Failed\"\n else\n @bq_status = \"Passed\"\n end\n end"
] |
[
"0.6976056",
"0.66532505",
"0.6622581",
"0.65775734",
"0.6514169",
"0.6495601",
"0.64901483",
"0.64893776",
"0.64805293",
"0.6469977",
"0.63685036",
"0.6346911",
"0.6346911",
"0.6291584",
"0.62146187",
"0.6171398",
"0.6147943",
"0.61447847",
"0.6122132",
"0.6077509",
"0.607112",
"0.6058954",
"0.6052543",
"0.60155183",
"0.5981805",
"0.59799296",
"0.59719473",
"0.59534174",
"0.5951148",
"0.5951148",
"0.590997",
"0.5901224",
"0.5841461",
"0.5769742",
"0.5731673",
"0.57139266",
"0.57139266",
"0.57139266",
"0.5712847",
"0.56665283",
"0.56411433",
"0.56060314",
"0.56060314",
"0.56060314",
"0.56032574",
"0.558007",
"0.5570074",
"0.55688256",
"0.5537275",
"0.54889077",
"0.5487621",
"0.5487621",
"0.54644424",
"0.53860897",
"0.53837234",
"0.53660566",
"0.53452045",
"0.5311178",
"0.5304372",
"0.5303697",
"0.5303697",
"0.5303697",
"0.52972764",
"0.528303",
"0.52679265",
"0.5243333",
"0.5209345",
"0.5198082",
"0.516384",
"0.516384",
"0.514482",
"0.5120108",
"0.5108653",
"0.51011413",
"0.5067611",
"0.5064432",
"0.50440836",
"0.50407046",
"0.50094324",
"0.5007679",
"0.49985567",
"0.49934256",
"0.49680266",
"0.4966841",
"0.49399224",
"0.49351478",
"0.49288803",
"0.49121672",
"0.4910124",
"0.49029782",
"0.49",
"0.48968843",
"0.48968688",
"0.48894146",
"0.4878934",
"0.4878783",
"0.48715577",
"0.48539895",
"0.48405245",
"0.4839031"
] |
0.7393584
|
0
|
def add_commissions(account, amount) redis.hset pk(account), "total_commissions", total_commissions(account) + amount end
|
def balance(account)
net_deposits(account) - net_withdraws(account)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_or_remove_cash(cash, amount)\n return cash[:admin][:total_cash] += amount\nend",
"def add_or_remove_cash(cash, amount)\n return cash[:admin][:total_cash] += amount\nend",
"def add(cash)\n @current_balance = @current_balance + cash\n end",
"def add_or_remove_cash(shop, amount)\n shop[:admin][:total_cash] += amount\nend",
"def add_or_remove_cash(shop,amount)\n shop[:admin][:total_cash] += amount\nend",
"def add_or_remove_customer_cash(customer, amount)\n customer[:cash] += amount\nend",
"def set_number_of_commissions\n @hash[\"number of commissions\"] = calculate_number_of_commissions\n end",
"def add_amount_to(transactions, value) \n transactions.each do |transaction|\n new_balance = transaction.account_balance + value\n transaction.update(:account_balance => new_balance)\n end\n end",
"def credit(amount)\n\t\t@revenue += amount\n\tend",
"def add_or_remove_cash(petshop,cash) \n petshop[:admin][:total_cash] += cash\n end",
"def add_or_remove_cash(shop, cash_amount)\n shop[:admin][:total_cash] += cash_amount\nend",
"def add_or_remove_cash(shop, cash_amount)\n shop[:admin][:total_cash] += cash_amount\nend",
"def store_cash(price)\n @cash = cash + Money.new(price * 100)\n end",
"def add_money\n @total += fee\n end",
"def add_credits(qty)\n update_column(:credits, credits + qty)\n end",
"def add_or_remove_cash(pet_shop, amount)\n pet_shop[:admin][:total_cash] += amount\nend",
"def add_amount(amount)\n @balance += amount\n end",
"def console_add_money(amount)\n credits.create!(amount: amount, note: \"Admin added #{amount} cents\")\n end",
"def add_or_remove_cash(update, cash)\n update[:admin][:total_cash] += cash\n return cash\nend",
"def add_or_remove_cash(update, cash)\n update[:admin][:total_cash] += cash\n return cash\nend",
"def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end",
"def put_infinite_money!\n { 50 => 10_000,\n 25 => 10_000,\n 10 => 10_000,\n 5 => 10_000,\n 2 => 10_000,\n 1 => 10_000 }.each do |k, v|\n @money[k] += v\n end\n save!\n end",
"def add_or_remove_cash(pet_shop_hash,cash)\n return pet_shop_hash[:admin][:total_cash] += cash\nend",
"def add_money(value)\n raise_invalid_coin! if @money[value.to_s].nil?\n @money[value.to_s] += 1\n update_money\n end",
"def give_shnack_credit(creditor_id, amount)\n @creditor = User.find(creditor_id)\n creditor.account_credit = creditor.account_credit + amount\n end",
"def pay_in(balance)\n @balance += balance\nend",
"def deposit(cash)\n @balance += cash\n end",
"def add_or_remove_cash(pet_shop, cost)\n pet_shop[:admin][:total_cash] += cost\nend",
"def add_or_remove_cash(pet_shop, cash)\n return total_cash = pet_shop[:admin][:total_cash] += cash\nend",
"def add_or_remove_cash(pet_shop, num) \n return pet_shop[:admin][:total_cash] += num \nend",
"def add_or_remove_cash(pet_shop, cash)\n pet_shop[:admin][:total_cash] += cash\nend",
"def add_or_remove_cash(pet_shop, amount_cash)\n pet_shop[:admin][:total_cash] += amount_cash\nend",
"def add_or_remove_cash(pet_shop,cash)\n return pet_shop[:admin][:total_cash] +=cash\nend",
"def add_or_remove_cash(pet_shop, cash)\n pet_shop[:admin][:total_cash] += cash\n # total_cash += cash\n # return total_cash\nend",
"def creditCoins(amount)\r\n @betESSCoins += amount\r\n end",
"def put_inside!(money_hash)\n money_hash.each do |k, v|\n @money[k] += v\n end\n save!\n end",
"def increase_balance(amount)\n self.balance += amount\n save\n end",
"def add_credits_of(questionnaire)\n update(credits: credits + questionnaire.credits)\n end",
"def add_pending_to_customer(num = 1)\n ### don't lock if we have plenty of stock.\n if low_stock?\n # If the stock is low lock the inventory. This ensures\n inventory.lock!\n self.inventory.count_pending_to_customer = inventory.count_pending_to_customer.to_i + num.to_i\n inventory.save!\n else\n sql = \"UPDATE inventories \n SET count_pending_to_customer = (#{num} + count_pending_to_customer) \n WHERE id = #{self.inventory.id}\"\n ActiveRecord::Base.connection.execute(sql)\n end\n end",
"def add_cash(amount)\n transaction = Transaction.new\n transaction.transaction_type_id = 1\n transaction.seller_id = self.id\n transaction.price = Setting.first.exchange_rate\n transaction.amount = amount\n transaction.save\n self.update_portfolio\n return transaction\n end",
"def add_pending_to_customer(num = 1)\n ### don't lock if we have plenty of stock.\n if low_stock?\n # If the stock is low lock the inventory. This ensures\n inventory.lock!\n self.inventory.count_pending_to_customer = inventory.count_pending_to_customer.to_i + num.to_i\n inventory.save!\n else\n sql = \"UPDATE inventories SET count_pending_to_customer = (#{num} + count_pending_to_customer) WHERE id = #{self.inventory.id}\"\n ActiveRecord::Base.connection.execute(sql)\n end\n end",
"def balance\n transactions.inject(:+)\n end",
"def add_to_balance\n self.user.balance += self.price\n self.user.save\n end",
"def change_player_money(hash,amount)\n return hash[:money] += amount\nend",
"def deposit(money)\n @balance += money\nend",
"def give_coins(from_addr, to_addr, coins, acc_balances)\n acc_balances[from_addr] = acc_balances[from_addr].to_i - coins.to_i\n acc_balances[to_addr] = acc_balances[to_addr].to_i + coins.to_i\n\n acc_balances\nend",
"def manage_commission_level\n\t\tif self.commission_level.present? && !self.commission_level.empty?\n \t\tsum = 0\n\t\t\tlevel = 0\n _commission_level = {}\n \tself.commission_level.each do |k, v| \n \t\tlevel = level + 1\n _commission_level[level] = v\n \t\tsum = sum + v.to_d\n \tend\n self.commission_level = _commission_level\n \tself.levels = level\n \tself.commission = sum\n end\n\tend",
"def update_purchase_balance\n update(balance: financial_transactions.sum(:total_amount))\n end",
"def spend(amount)\r\n @spend += amount\r\n end",
"def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end",
"def increment(cache_key, amount, options)\n counter = counter(cache_key, options)\n counter[:bucket] += amount\n Prop::Limiter.cache.write(cache_key, counter)\n counter\n end",
"def add_credit\n#\t\tcurrent_user.update(balance: current_user.balance + params[:amount])\n\tend",
"def add_to_cache(db, user_name)\r\n\tcache_bonus = (current_cache(db, user_name) + extra_cash(db, user_name))\r\n\tadd_bonus = '\r\n\r\n\tUPDATE users \r\n\r\n\tSET cache = ?\r\n\tWHERE name = ?'\r\n\tdb.execute(add_bonus, [cache_bonus, user_name])\r\nend",
"def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end",
"def get_paid(salary)\n self.bank_account += salary\n return \"all about the benjamins\"\nend",
"def pay_workers\r\n\t\t@cash -= (@sellers + @thieves)*10\r\n\tend",
"def add_to_customer_total\n \tcurrent_total = self.customer.total_repair\n \tcustomer = self.customer\n \tif current_total\n \t\tcustomer.total_repair += self.total_charge\n \telse\n \t\tcustomer.total_repair = self.total_charge\n \tend\n \tcustomer.save\n end",
"def add_account(account)\n @accounts[account.id] = account\n end",
"def add_pending(value)\n raise_invalid_coin! if @pending_money[value.to_s].nil?\n @pending_money[value.to_s] += 1\n update_pending\n end",
"def add_credit(amount)\n raise Transfer::NegativeAmountException if(amount < 0)\n self.lines.create(amount: self.balance + amount)\n self.balance += amount\n end",
"def save!\n redis.set('money', @money.to_json) if @use_redis\n end",
"def get_paid(salary)\n self.bank_account += salary\n self.happiness += 1\n \"all about the benjamins\"\n end",
"def transfer_pending_to_money\n @pending_money.each do |coin, value|\n @money[coin] += value\n @pending_money[coin] = 0\n end\n update_pending\n update_money\n end",
"def add_stock_to_account(company, price)\n stock = Stock.new\n stock.company = company\n stock.price = price\n stocks.push(stock)\n end",
"def assets_balance(assets, received = 0)\n assets.map { |x| { \"#{x['policy_id']}#{x['asset_name']}\" => x['quantity'] + received } }.to_set\nend",
"def own_amounts\n hash_totals = {}\n\n self.user_currencies.each do |uc|\n if hash_totals[uc.currency.crypto]\n hash_totals[uc.currency.crypto][:amount] = hash_totals[uc.currency.crypto][:amount] + uc.amount.to_i\n else\n hash_totals[uc.currency.crypto] = { amount: uc.amount }\n end\n end\n hash_totals\n end",
"def deposit(name, amount)\n find_account(name)[:balance] += amount\n end",
"def credit!(amount)\n self.balance += parse_monetary_value(amount)\n self.store\n end",
"def add_club_cash(agent, amount = 0, description = nil, set_expire_date = false)\n answer = { code: Settings.error_codes.club_cash_transaction_not_successful, message: \"Could not save club cash transaction\" }\n begin\n if not club.allow_club_cash_transaction?\n answer = { message: I18n.t(\"error_messages.club_cash_not_supported\"), code: Settings.error_codes.club_does_not_support_club_cash }\n elsif amount.to_f == 0\n answer[:message] = I18n.t(\"error_messages.club_cash_transaction_invalid_amount\")\n answer[:errors] = { amount: \"Invalid amount\" } \n elsif !is_drupal?\n ClubCashTransaction.transaction do\n begin\n if (amount.to_f < 0 and amount.to_f.abs <= self.club_cash_amount) or amount.to_f > 0\n cct = ClubCashTransaction.new(amount: amount, description: description)\n self.club_cash_transactions << cct\n raise \"Could not save club cash transaction\" unless cct.valid? and self.valid?\n self.club_cash_amount = self.club_cash_amount + amount.to_f\n self.club_cash_expire_date = Time.current.to_date + 1.year if set_expire_date\n self.save(validate: false)\n message = \"#{cct.amount.to_f.abs} club cash was successfully #{ amount.to_f >= 0 ? 'added' : 'deducted' }.\"+(description.blank? ? '' : \" Concept: #{description}\")\n if amount.to_f > 0\n Auditory.audit(agent, cct, message, self, Settings.operation_types.add_club_cash)\n elsif amount.to_f < 0 and amount.to_f.abs == club_cash_amount \n Auditory.audit(agent, cct, message, self, Settings.operation_types.reset_club_cash)\n elsif amount.to_f < 0 \n Auditory.audit(agent, cct, message, self, Settings.operation_types.deducted_club_cash)\n end\n answer = { message: message, code: Settings.error_codes.success }\n else\n answer[:message] = \"You can not deduct #{amount.to_f.abs} because the user only has #{self.club_cash_amount} club cash.\"\n answer[:errors] = { amount: \"Club cash amount is greater that user's actual club cash.\" }\n end\n rescue Exception => e\n answer[:errors] = cct.errors_merged(self) unless cct.nil?\n Auditory.report_issue('Club cash Transaction', e, { answer_message: answer[:message], user: self.id, amount: amount, description: description, club_cash_transaction: cct.try(:id) })\n answer[:message] = I18n.t('error_messages.airbrake_error_message')\n raise ActiveRecord::Rollback\n end\n end\n elsif not api_id.nil?\n Drupal::UserPoints.new(self).create!({amount: amount, description: description})\n message = last_sync_error || \"Club cash processed at drupal correctly. Amount: #{amount}. Concept: #{description}\"\n auditory_code = Settings.operation_types.remote_club_cash_transaction_failed\n if self.last_sync_error.nil?\n auditory_code = Settings.operation_types.remote_club_cash_transaction\n answer = { message: message, code: Settings.error_codes.success }\n else\n answer = { message: last_sync_error, code: Settings.error_codes.club_cash_transaction_not_successful }\n end\n answer[:message] = I18n.t('error_messages.drupal_error_sync') if message.blank?\n Auditory.audit(agent, self, answer[:message], self, auditory_code)\n end\n rescue Exception => e\n Auditory.report_issue('Club cash Transaction', e, { answer_message: answer[:message], user: self.id, amount: amount, description: description })\n answer[:message] = I18n.t('error_messages.airbrake_error_message')\n answer[:errors] = { amount: \"There has been an error while adding club cash amont.\" }\n end\n answer\n end",
"def increase key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] += amount\n end\n end",
"def add_monthly_interest\n\t\t@debt *= 1.015\n\t\t@balance *= 1.0003\n\tend",
"def addSale count=1, payout=0\n @saleCount += count\n @totalPayout += payout\n end",
"def total_commission\n @payment.total_commission\n end",
"def buy_amap(account, ticker, timestamp, amount = nil)\n amount ||= account.cash\n amount = [amount, account.cash].min\n quote = exchange.quote(ticker, timestamp)\n max_shares = ((amount - buy_commission) / quote).floor\n cost = quote * max_shares\n if max_shares > 0 && account.cash >= cost + buy_commission\n #buy(account, ticker, max_shares, timestamp)\n account.cash -= (cost + buy_commission)\n account.portfolio[ticker] += max_shares\n account.commission_paid += buy_commission\n #puts \"bought #{max_shares} of #{ticker} on #{timestamp}\"\n max_shares # return the number of shares bought\n else\n 0\n end\n end",
"def persist_total\n clinton = Candidate.find_by(name: 'Clinton')\n clinton.total += @clinton\n clinton.save\n\n trump = Candidate.find_by(name: 'Trump')\n trump.total += @trump\n trump.save\n\n seconds = Candidate.find_by(name: 'Seconds Ran')\n seconds.total += 5\n seconds.save\n end",
"def update_money\n @amount = self.class.count_money @money\n end",
"def give_credits(credits)\r\n self.credits = self.credits + credits\r\n end",
"def remove_customer_cash(customers, amount)\n customers[:cash] -= amount\nend",
"def add_money(value)\n @calculator.add_money value\n end",
"def purchase(item_price)\n @total += item_price\n total\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(money_to_deposit)\n @balance += money_to_deposit\n end",
"def add_money_to_till(amount)\n @till += amount\nend",
"def cashRegister(price, cash)\n\nend",
"def deposit(money)\n self.balance = (self.balance + money)\n end",
"def shares_totals\n @total = @shares * @price\n @total_con = @shares * @con\n end",
"def create(total_items)\n $redis.hmset(redis_key, :processed_items, 0, :total_items, total_items)\n end",
"def reward\n business.add_to_balance(amount)\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def set_amounts\n super\n self.paid_amount = 0\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n end",
"def increase_pets_sold(increase, total)\n return increase[:admin][:pets_sold] += total\nend",
"def add_to_redis(mutex = Mutex.new)\n mutex.synchronize do\n data.sadd\n end\n end",
"def deposit(account_id, accounts,action)\n account = accounts[account_id]\n show_message \"Enter amount to deposit in your account\"\n money_to_deposit = gets.chomp.to_i\n balance=account[:balance]\n #accounts[:account_id].store :balance ,balance+money_to_deposit\n account[:balance] = balance + money_to_deposit\n show_message \"wooow !!! transaction sucessful..your current balance is #{account[:balance]}\"\n create_history(account_id,accounts,action,money_to_deposit,account[:balance])\nend",
"def add_item(item, amount = 1)\n\n # Increase the amount if the item already exists in the inventory.\n @inventory.each do |couple|\n if (couple.first == item)\n couple.second += amount\n return\n end\n end\n\n # If not already in the inventory, push a Couple.\n @inventory.push(Couple.new(item, amount))\n end",
"def deposit(amount)\n @balance += amount\n @balance\n end",
"def increment_total_transaction_sum(by)\n Merchant.update_counters(id, total_transaction_sum: by)\n end",
"def send_money(amount)\n fail unless amount >= 0\n self.credits += amount\n end",
"def give_coins(token, amount)\n raise 'Only Game or action resolvers should call this method' if token != @action_token\n @coins += amount\n end",
"def deal_cash\n self.game_players.each do |player|\n player.cash = 6000\n player.save\n end\n end"
] |
[
"0.6433548",
"0.6433548",
"0.6316251",
"0.6292813",
"0.62759715",
"0.62539375",
"0.6241147",
"0.61344224",
"0.6132019",
"0.6083905",
"0.6048235",
"0.60365194",
"0.60347515",
"0.6031226",
"0.6020373",
"0.6015895",
"0.60047907",
"0.59966534",
"0.59648144",
"0.59648144",
"0.59474015",
"0.5925746",
"0.59160024",
"0.5907422",
"0.58986706",
"0.5836766",
"0.57958823",
"0.5793464",
"0.57933795",
"0.57901376",
"0.5789946",
"0.57835835",
"0.57697475",
"0.574952",
"0.571267",
"0.5707726",
"0.5697048",
"0.56921387",
"0.5690294",
"0.5689048",
"0.56774914",
"0.5669489",
"0.5652106",
"0.56028306",
"0.56001306",
"0.55888236",
"0.55870235",
"0.5578329",
"0.5568376",
"0.55553025",
"0.5543734",
"0.55068266",
"0.5480441",
"0.54754114",
"0.5473596",
"0.54678184",
"0.5464904",
"0.5457307",
"0.5451652",
"0.5447943",
"0.54450196",
"0.544453",
"0.54428744",
"0.54404795",
"0.54252326",
"0.5413176",
"0.54110396",
"0.5399396",
"0.53989345",
"0.53938246",
"0.5387353",
"0.53575474",
"0.5351071",
"0.5348617",
"0.5338037",
"0.5334916",
"0.5330292",
"0.5322011",
"0.5311584",
"0.52915245",
"0.5291501",
"0.5291501",
"0.52914476",
"0.52825403",
"0.5281455",
"0.5281248",
"0.5281175",
"0.5278714",
"0.5277367",
"0.52753633",
"0.5272005",
"0.5266811",
"0.5261526",
"0.526088",
"0.5254475",
"0.525398",
"0.52536494",
"0.5245003",
"0.5241748",
"0.5241157",
"0.52375895"
] |
0.0
|
-1
|
GET /gigapans GET /gigapans.json
|
def index
@gigapans = Gigapan.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def index\n @gakkas = Gakka.all\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def index\n\t\t@gig = Gig.all\n\tend",
"def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def index\n @gongdans = Gongdan.all\n end",
"def index\n @gangs = Gang.all\n end",
"def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end",
"def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def index\n @greats = Great.all\n end",
"def index\n @gifs = Gif.sorted.paginate(page: params[:page], per_page: 12)\n\n respond_to do |format|\n format.html\n format.json { render json: @gifs }\n end\n end",
"def index\n @gudangs = Gudang.all\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def index\n @gathas = Gatha.all\n end",
"def show\n @gig = Gig.find(params[:id])\n end",
"def index\n @galinhas = Galinha.all\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @gatos = Gato.all\n end",
"def index\n @garantia = Garantium.all\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig, callback: params[:callback] }\n format.xml { render xml: @gig }\n end\n end",
"def index\n @gakunenns = Gakunenn.all\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end",
"def index\n @players = Player.order(:gamertag_lower).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def index\n @gig_types = GigType.all\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end",
"def index\n @in_game_gifts = InGameGift.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @in_game_gifts }\n end\n end",
"def index\n @gamers = Gamer.all\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def index\n @gentres = Gentre.all\n end",
"def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n @ganhos = Ganho.all\n end",
"def index\n @gigs = Gig.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gigs, callback: params[:callback] }\n format.xml { render xml: @gigs }\n end\n end",
"def index\n @gig_rosters = GigRoster.all\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @galleta = Galletum.all\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def index\n @galaxies = Galaxy.all\n end",
"def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def index\n @gommis = Gommi.all\n end",
"def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end",
"def index\n @grapes = Grape.all\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index\n @guas = Gua.all\n\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @gravity = Gravity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gravity }\n end\n end",
"def index\n @goofballs = Goofball.all\n end",
"def index\n @gongjijins = Gongjijin.all\n end",
"def index\n @gatineos = Gatineo.all\n end",
"def index\n @gomis = Gomi.all\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index\n @garplies = Garply.all\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def index\n @gists = Gist.paginate(:page => params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def show\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift }\n end\n end",
"def index\n @gruas = Grua.all\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n @gastronomia = Gastronomium.all\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def index\n order = sortable_column_order, \"gage_number desc\"\n @gages = Gage.paginate page: params[:page], order: order, per_page: 50\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gages }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end",
"def index\n add_breadcrumb 'Graves'\n @graves = Grave.all\n end",
"def index\n @gonzos = Gonzo.all\n end",
"def index\n @uasgs = Uasg.all\n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def index\n\t\tparams[:search] ? @genres=Genre.search(params[:search]) : @genres=Genre.where(\"user_id = ?\", current_user.id).order(\"name\")\n\t\t@genres = @genres.paginate(page: params[:page], per_page: 18) if @genres\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @genres }\n\t\t\tformat.js\n\t\tend\n\tend",
"def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end",
"def index\n @gposts = Gpost.all\n end",
"def index\n @gmaps = Gmap.all\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n @gifts = Gift.all\n end",
"def index\n @gifts = Gift.all\n end",
"def index\n @gift_lists = GiftList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gift_lists }\n end\n end",
"def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end"
] |
[
"0.7172506",
"0.6659971",
"0.6642913",
"0.6595735",
"0.65871245",
"0.65791607",
"0.6527109",
"0.64854366",
"0.64815277",
"0.64590824",
"0.6453193",
"0.63492286",
"0.63449687",
"0.6342909",
"0.6331624",
"0.62757236",
"0.6259193",
"0.62442195",
"0.62335265",
"0.6215515",
"0.620642",
"0.61972183",
"0.6196289",
"0.6174402",
"0.61590946",
"0.6152515",
"0.6151133",
"0.61461854",
"0.6145483",
"0.61429924",
"0.61279297",
"0.6126965",
"0.6121143",
"0.6109951",
"0.61018777",
"0.6093411",
"0.60933626",
"0.6090275",
"0.6084922",
"0.60753596",
"0.6071076",
"0.605482",
"0.6049634",
"0.6040838",
"0.60327053",
"0.6017593",
"0.6016387",
"0.60074395",
"0.5997263",
"0.5997186",
"0.5978893",
"0.5977388",
"0.5974169",
"0.5974102",
"0.59665745",
"0.59607154",
"0.5950776",
"0.5947808",
"0.59410256",
"0.5940232",
"0.59396636",
"0.5937498",
"0.5936202",
"0.59356254",
"0.5931755",
"0.5927529",
"0.59270686",
"0.5919764",
"0.59143335",
"0.5911275",
"0.5909138",
"0.5908408",
"0.59049636",
"0.5904528",
"0.5891325",
"0.5887977",
"0.58873606",
"0.5885847",
"0.58758235",
"0.5871654",
"0.5868599",
"0.586567",
"0.58630747",
"0.5858093",
"0.5857342",
"0.58555365",
"0.5851678",
"0.58503014",
"0.5842926",
"0.58333766",
"0.58330816",
"0.583179",
"0.58148456",
"0.58122045",
"0.58000547",
"0.57974684",
"0.57974404",
"0.57974404",
"0.57973886",
"0.5794776"
] |
0.74949664
|
0
|
GET /gigapans/1 GET /gigapans/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def index\n @gigapans = Gigapan.all\n end",
"def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def show\n @gig = Gig.find(params[:id])\n end",
"def index\n\t\t@gig = Gig.all\n\tend",
"def index\n @gakkas = Gakka.all\n end",
"def index\n @gangs = Gang.all\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def index\n @gifs = Gif.sorted.paginate(page: params[:page], per_page: 12)\n\n respond_to do |format|\n format.html\n format.json { render json: @gifs }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end",
"def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end",
"def index\n @gongdans = Gongdan.all\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end",
"def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig, callback: params[:callback] }\n format.xml { render xml: @gig }\n end\n end",
"def index\n @greats = Great.all\n end",
"def show\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gen }\n end\n end",
"def index\n @gudangs = Gudang.all\n end",
"def show\n @gravity = Gravity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gravity }\n end\n end",
"def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end",
"def index\n @galinhas = Galinha.all\n end",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def show\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end",
"def index\n @garantia = Garantium.all\n end",
"def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end",
"def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def show\n @nugget = Nugget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nugget }\n end\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def index\n @gathas = Gatha.all\n end",
"def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def index\n @in_game_gifts = InGameGift.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @in_game_gifts }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @ganhos = Ganho.all\n end",
"def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end",
"def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end",
"def index\n @gatos = Gato.all\n end",
"def index\n @players = Player.order(:gamertag_lower).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def show\n @immigrant = Immigrant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @immigrant }\n end\n end",
"def index\n @gommis = Gommi.all\n end",
"def index\n @gamers = Gamer.all\n end",
"def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end",
"def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end",
"def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end",
"def show\n @go = Go.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go }\n end\n end",
"def index\n @gakunenns = Gakunenn.all\n end",
"def show\n @green = Green.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @green }\n end\n end",
"def index\n @galleta = Galletum.all\n end",
"def new\n @gastracker = Gastracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def index\n @galaxies = Galaxy.all\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def index\n @gig_types = GigType.all\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index\n @gastronomia = Gastronomium.all\n end",
"def show\n @grm_dog = GrmDog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_dog }\n end\n end",
"def gist(id)\n get \"/gists/#{id}\"\n end",
"def index\n @gongjijins = Gongjijin.all\n end",
"def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end",
"def index\n @gomis = Gomi.all\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def index\n @gists = Gist.paginate(:page => params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def index\n @gig_rosters = GigRoster.all\n end",
"def index\n @gentres = Gentre.all\n end",
"def index\n @guas = Gua.all\n\n end",
"def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end"
] |
[
"0.7457587",
"0.7255503",
"0.6782684",
"0.6748193",
"0.6728249",
"0.6545615",
"0.6517136",
"0.65053946",
"0.649888",
"0.6469542",
"0.646225",
"0.64499056",
"0.64369404",
"0.64118344",
"0.64106995",
"0.6396985",
"0.6395171",
"0.63889813",
"0.6385452",
"0.6383362",
"0.63814896",
"0.6355184",
"0.634669",
"0.6345625",
"0.6317055",
"0.63009346",
"0.6297707",
"0.62799406",
"0.62628084",
"0.6258964",
"0.6239682",
"0.6226979",
"0.6196274",
"0.61780286",
"0.6151329",
"0.6150126",
"0.6146539",
"0.6134916",
"0.61306626",
"0.6119241",
"0.61175317",
"0.6113695",
"0.6103407",
"0.60935116",
"0.6083454",
"0.6081617",
"0.60725814",
"0.6072062",
"0.60634696",
"0.60606956",
"0.6059715",
"0.6057577",
"0.60568005",
"0.6040851",
"0.6037224",
"0.6025686",
"0.6019266",
"0.60128397",
"0.60012054",
"0.5987454",
"0.5983724",
"0.5983592",
"0.59774315",
"0.5976207",
"0.59693426",
"0.59691304",
"0.5963877",
"0.59515435",
"0.59507036",
"0.595002",
"0.5930296",
"0.5925385",
"0.59221447",
"0.59217805",
"0.59178615",
"0.59170985",
"0.5914716",
"0.59103924",
"0.59077287",
"0.5905962",
"0.58992124",
"0.58942556",
"0.5890532",
"0.5889027",
"0.58870345",
"0.58840466",
"0.58813155",
"0.58794343",
"0.5878148",
"0.5876016",
"0.58749646",
"0.58724475",
"0.58681655",
"0.5867703",
"0.58675987",
"0.58659863",
"0.58642644",
"0.5860953",
"0.5860928",
"0.585911",
"0.5858567"
] |
0.0
|
-1
|
POST /gigapans POST /gigapans.json
|
def create
@gigapan = Gigapan.new(gigapan_params)
respond_to do |format|
if @gigapan.save
format.html { redirect_to @gigapan, notice: 'Gigapan was successfully created.' }
format.json { render :show, status: :created, location: @gigapan }
else
format.html { render :new }
format.json { render json: @gigapan.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @gang = Gang.new(gang_params)\n\n respond_to do |format|\n if @gang.save\n format.html { redirect_to @gang, notice: 'Gang was successfully created.' }\n format.json { render :show, status: :created, location: @gang }\n else\n format.html { render :new }\n format.json { render json: @gang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n gig = Gig.new()\n respond_to do |format|\n if update_gig(gig)\n format.html { render json: gig, status: :created, location: gig }\n format.json { render json: gig, status: :created, location: gig }\n else\n format.html { render action: \"new\" }\n format.json { render json: gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gudang = Gudang.new(gudang_params)\n\n respond_to do |format|\n if @gudang.save\n format.html { redirect_to @gudang, notice: 'Gudang was successfully created.' }\n format.json { render :show, status: :created, location: @gudang }\n else\n format.html { render :new }\n format.json { render json: @gudang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig_request = GigRequest.new(params[:gig_request])\n\n respond_to do |format|\n if @gig_request.save\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully created.' }\n format.json { render json: @gig_request, status: :created, location: @gig_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@gig = Gig.new(gig_params)\n\n @gig = current_user.gigs.build(gig_params)\n\n respond_to do |format|\n if @gig.save\n format.html { redirect_to @gig, notice: \"Gig was successfully created.\" }\n format.json { render :show, status: :created, location: @gig }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig_type = GigType.new(gig_type_params)\n\n respond_to do |format|\n if @gig_type.save\n format.html { redirect_to @gig_type, notice: 'Gig type was successfully created.' }\n format.json { render :show, status: :created, location: @gig_type }\n else\n format.html { render :new }\n format.json { render json: @gig_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @gigapans = Gigapan.all\n end",
"def create\n @ganho = Ganho.new(ganho_params)\n\n respond_to do |format|\n if @ganho.save\n format.html { redirect_to ganhos_path, notice: 'Ganho was successfully created.' }\n format.json { render :show, status: :created, location: @ganho }\n else\n format.html { render :new }\n format.json { render json: @ganho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gosok = Gosok.new(gosok_params)\n\n respond_to do |format|\n if @gosok.save\n format.html { redirect_to gosoks_url, notice: 'Gosok was successfully created.' }\n format.json { render :show, status: :created, location: @gosok }\n else\n format.html { render :new }\n format.json { render json: @gosok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gakka = Gakka.new(gakka_params)\n\n respond_to do |format|\n if @gakka.save\n format.html { redirect_to @gakka, notice: \"Gakka was successfully created.\" }\n format.json { render :show, status: :created, location: @gakka }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gakka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gatha = Gatha.new(gatha_params)\n\n respond_to do |format|\n if @gatha.save\n format.html { redirect_to @gatha, notice: 'Gatha was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gatha }\n else\n format.html { render action: 'new' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def create\n @gastracker = Gastracker.new(params[:gastracker])\n\n respond_to do |format|\n if @gastracker.save\n format.html { redirect_to @gastracker, notice: 'Gastracker was successfully created.' }\n format.json { render json: @gastracker, status: :created, location: @gastracker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gastracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @currentgwamokid = params[:currentgwamokid]\n @sigan = Sigan.new(sigan_params)\n\n respond_to do |format|\n if @sigan.save\n format.html { redirect_to @sigan, notice: 'Sigan was successfully created.' }\n format.json { render :show, status: :created, location: @sigan }\n else\n format.html { render :new }\n format.json { render json: @sigan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @galletum = Galletum.new(galletum_params)\n\n respond_to do |format|\n if @galletum.save\n format.html { redirect_to @galletum, notice: 'Galletum was successfully created.' }\n format.json { render :show, status: :created, location: @galletum }\n else\n format.html { render :new }\n format.json { render json: @galletum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gongjijin = Gongjijin.new(gongjijin_params)\n\n respond_to do |format|\n if @gongjijin.save\n format.html { redirect_to @gongjijin, notice: 'Gongjijin was successfully created.' }\n format.json { render :show, status: :created, location: @gongjijin }\n else\n format.html { render :new }\n format.json { render json: @gongjijin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @giohang = Giohang.new(giohang_params)\n\n respond_to do |format|\n if @giohang.save\n format.html { redirect_to @giohang, notice: \"Giohang was successfully created.\" }\n format.json { render :show, status: :created, location: @giohang }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @giohang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @made_in_g = MadeInG.new(made_in_g_params)\n\n respond_to do |format|\n if @made_in_g.save\n format.html { redirect_to @made_in_g, notice: 'Made in g was successfully created.' }\n format.json { render :show, status: :created, location: @made_in_g }\n else\n format.html { render :new }\n format.json { render json: @made_in_g.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig_request = GigRequest.new(gig_request_params)\n \n #@gig_request.name = encode(@gig_request.name)\n #@gig_request.address = encode(@gig_request.address)\n #@gig_request.email = encode(@gig_request.email)\n\n respond_to do |format|\n if @gig_request.save\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully created.' }\n format.json { render :show, status: :created, location: @gig_request }\n else\n format.html { render :new }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n #flash[:error] = @gig_request.errors.full_messages[0]\n #render 'new'\n end\n end\n end",
"def create\n @rigging = Rigging.new(rigging_params)\n\n respond_to do |format|\n if @rigging.save\n format.html { redirect_to @rigging, notice: 'Rigging was successfully created.' }\n format.json { render :show, status: :created, location: @rigging }\n else\n format.html { render :new }\n format.json { render json: @rigging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig_set = GigSet.new(gig_set_params)\n @gig_set.number = (@gig_set.gig.gig_sets.map(&:number).compact.max || 0) + 1\n\n respond_to do |format|\n if @gig_set.save\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't add a new set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gua = Gua.new(gua_params)\n\n respond_to do |format|\n if @gua.save\n format.html { redirect_to @gua, notice: 'Gua was successfully created.' }\n format.json { render :show, status: :created, location: @gua }\n else\n format.html { render :new }\n format.json { render json: @gua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @garnish = Garnish.new(garnish_params)\n\n respond_to do |format|\n if @garnish.save\n format.html { redirect_to garnishes_url, notice: 'Garnish was successfully created.' }\n format.json { render :show, status: :created, location: @garnish }\n else\n format.html { render :new }\n format.json { render json: @garnish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gato = Gato.new(gato_params)\n\n respond_to do |format|\n if @gato.save\n format.html { redirect_to gatos_url, notice: 'Gato Creado.' }\n format.json { render :show, status: :created, location: @gato }\n else\n format.html { render :new }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uasg = Uasg.new(uasg_params)\n\n respond_to do |format|\n if @uasg.save\n format.html { redirect_to @uasg, notice: 'Uasg was successfully created.' }\n format.json { render :show, status: :created, location: @uasg }\n else\n format.html { render :new }\n format.json { render json: @uasg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gram = Gram.new(gram_params)\n\n respond_to do |format|\n if @gram.save\n format.html { redirect_to @gram, notice: 'Gram was successfully created.' }\n format.json { render :show, status: :created, location: @gram }\n else\n format.html { render :new }\n format.json { render json: @gram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @galeria = Galeria.new(params[:galeria])\n\n respond_to do |format|\n if @galeria.save\n format.html { redirect_to @galeria, notice: 'Galeria was successfully created.' }\n format.json { render json: @galeria, status: :created, location: @galeria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @galeria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grua = Grua.new(grua_params)\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to gruas_url, notice: 'Grua Se creó correctamente.' }\n format.json { render :index, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gastracker = Gastracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def create\n @great = Great.new(great_params)\n\n respond_to do |format|\n if @great.save\n format.html { redirect_to @great, notice: 'Great was successfully created.' }\n format.json { render :show, status: :created, location: @great }\n else\n format.html { render :new }\n format.json { render json: @great.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gigapan_params\n params.require(:gigapan).permit(:name, :project, :gig_id, :description)\n end",
"def create\n @gatineo = Gatineo.new(gatineo_params)\n\n respond_to do |format|\n if @gatineo.save\n format.html { redirect_to @gatineo, notice: 'Gatineo criado com sucesso!' }\n format.json { render :show, status: :created, location: @gatineo }\n else\n format.html { render :new }\n format.json { render json: @gatineo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grooming = Grooming.new(grooming_params)\n\n respond_to do |format|\n if @grooming.save\n format.html { redirect_to @grooming, notice: 'Visit was successfully created.' }\n format.json { render :show, status: :created, location: @grooming }\n else\n format.html { render :new }\n format.json { render json: @grooming.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gram = current_user.grams.new(params[:gram])\n\n respond_to do |format|\n if @gram.save\n format.html { redirect_to @gram, notice: 'Gram was successfully created.' }\n format.json { render json: @gram, status: :created, location: @gram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ginasio = Ginasio.new(params[:ginasio])\n\n respond_to do |format|\n if @ginasio.save\n format.html { redirect_to @ginasio, :flash => { :success => 'Ginasio criado com sucesso!' } }\n format.json { render :json => @ginasio, :status => :created, :location => @ginasio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @gentre = Gentre.new(gentre_params)\n\n respond_to do |format|\n if @gentre.save\n format.json { render :show, status: :created, location: @gentre }\n else\n format.json { render json: @gentre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grumble = Grumble.new(grumble_params)\n\n respond_to do |format|\n if @grumble.save\n format.html { redirect_to @grumble, notice: 'Grumble was successfully created.' }\n format.json { render :show, status: :created, location: @grumble }\n else\n format.html { render :new }\n format.json { render json: @grumble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grape = Grape.new(grape_params)\n\n respond_to do |format|\n if @grape.save\n format.html { redirect_to @grape, notice: \"Grape was successfully created.\" }\n format.json { render :show, status: :created, location: @grape }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @grape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anuphat = Anuphat.new(anuphat_params)\n\n respond_to do |format|\n if @anuphat.save\n format.html { redirect_to @anuphat, notice: 'Anuphat was successfully created.' }\n format.json { render :show, status: :created, location: @anuphat }\n else\n format.html { render :new }\n format.json { render json: @anuphat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def create\n @gakunenn = Gakunenn.new(gakunenn_params)\n\n respond_to do |format|\n if @gakunenn.save\n format.html { redirect_to @gakunenn, notice: \"学年を追加しました\" }\n format.json { render :show, status: :created, location: @gakunenn }\n else\n format.html { render :new }\n format.json { render json: @gakunenn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gasto = Gasto.new(params[:gasto])\n\n respond_to do |format|\n if @gasto.save\n format.html { redirect_to @gasto, notice: 'Gasto was successfully created.' }\n format.json { render json: @gasto, status: :created, location: @gasto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @groep = Groep.new(params[:groep])\n @lesgevers = Lesgever.order('name').all\n @dags = Dag.all\n @niveaus = Niveau.order('position').all\n respond_to do |format|\n if @groep.save\n format.html { redirect_to @groep, notice: 'Groep werd succesvol aangemaakt.' }\n format.json { render json: @groep, status: :created, location: @groep }\n else\n format.html { render action: \"new\" }\n format.json { render json: @groep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @g_anewby = GAnewbie.new(g_anewby_params)\n\n respond_to do |format|\n if @g_anewby.save\n format.html { redirect_to @g_anewby, notice: 'G anewbie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @g_anewby }\n else\n format.html { render action: 'new' }\n format.json { render json: @g_anewby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gpost = Gpost.new(gpost_params)\n\n respond_to do |format|\n if @gpost.save\n format.html { redirect_to @gpost, notice: 'Gpost was successfully created.' }\n format.json { render :show, status: :created, location: @gpost }\n else\n format.html { render :new }\n format.json { render json: @gpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gato = Gato.new(gato_params)\n @gato.user_id = current_user.id\n\n respond_to do |format|\n if @gato.save\n format.html { redirect_to @gato, notice: 'Gato was successfully created.' }\n format.json { render :show, status: :created, location: @gato }\n else\n format.html { render :new }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goat = Goat.new(params[:goat])\n\n respond_to do |format|\n if @goat.save\n format.html { redirect_to @goat, notice: 'Goat was successfully created.' }\n format.json { render json: @goat, status: :created, location: @goat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @megalith = Megalith.new(megalith_params)\n\n respond_to do |format|\n if @megalith.save\n format.html { redirect_to @megalith, notice: \"Megalith was successfully created.\" }\n format.json { render :show, status: :created, location: @megalith }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @megalith.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig = current_user.gigs.new(gig_params)\n location = Location.find_or_create_by({\n postcode_address: params[:location][:postcode_address],\n street_address: params[:location][:street_address]\n })\n @gig.location = location\n respond_to do |format|\n if @gig.save\n format.html { redirect_to @gig, notice: 'Gig was successfully created.' }\n format.json { render :show, status: :created, location: @gig }\n else\n format.html { render :new }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sambok = Sambok.new(sambok_params)\n\n respond_to do |format|\n if @sambok.save\n format.html { redirect_to @sambok, notice: 'Sambok was successfully created.' }\n format.json { render :show, status: :created, location: @sambok }\n else\n format.html { render :new }\n format.json { render json: @sambok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aggrupation = Aggrupation.new(aggrupation_params)\n\n respond_to do |format|\n if @aggrupation.save\n format.html { redirect_to @aggrupation, notice: 'Aggrupation was successfully created.' }\n format.json { render :show, status: :created, location: @aggrupation }\n else\n format.html { render :new }\n format.json { render json: @aggrupation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tack = Tack.new(tack_params)\n\n if @tack.save\n render json: @tack, status: :created, location: @tack\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end",
"def create\n @goofball = Goofball.new(goofball_params)\n\n respond_to do |format|\n if @goofball.save\n format.html { redirect_to @goofball, notice: 'Goofball was successfully created.' }\n format.json { render action: 'show', status: :created, location: @goofball }\n else\n format.html { render action: 'new' }\n format.json { render json: @goofball.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@gift = Gift.new(gift_params)\n #create(giftname, gifturl, username)\n @id = gift_params[:giver]\n @user = Users.find_by(id: @id)\n puts params\n output = Gift.create(gift_params[:name], gift_params[:url], @user.username, params[:bio])\n render json: output\n # respond_to do |format|\n # if @gift.save\n # format.html { redirect_to @gift, notice: 'Gift was successfully created.' }\n # format.json { render :show, status: :created, location: @gift }\n # else\n # format.html { render :new }\n # format.json { render json: @gift.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @kingsizeb = Kingsizeb.new(kingsizeb_params)\n\n respond_to do |format|\n if @kingsizeb.save\n format.html { redirect_to @kingsizeb, notice: 'Kingsizeb was successfully created.' }\n format.json { render :show, status: :created, location: @kingsizeb }\n else\n format.html { render :new }\n format.json { render json: @kingsizeb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ton_giao = TonGiao.new(ton_giao_params)\n\n respond_to do |format|\n if @ton_giao.save\n format.html { redirect_to @ton_giao, notice: 'Ton giao was successfully created.' }\n format.json { render :show, status: :created, location: @ton_giao }\n else\n format.html { render :new }\n format.json { render json: @ton_giao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cetak_gtg = CetakGtg.new(cetak_gtg_params)\n\n respond_to do |format|\n if @cetak_gtg.save\n format.html { redirect_to cetak_gtgs_url, notice: 'Cetak gtg was successfully created.' }\n format.json { render :show, status: :created, location: @cetak_gtg }\n else\n format.html { render :new }\n format.json { render json: @cetak_gtg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @messege = Messege.new(params[:messege])\n\n respond_to do |format|\n if @messege.save\n format.html { redirect_to @messege, notice: 'Messege was successfully created.' }\n format.json { render json: @messege, status: :created, location: @messege }\n else\n format.html { render action: \"new\" }\n format.json { render json: @messege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jugador = Jugador.new(jugador_params)\n\n respond_to do |format|\n if @jugador.save\n format.html { redirect_to @jugador, notice: 'Jugador was successfully created.' }\n format.json { render :show, status: :created, location: @jugador }\n else\n format.html { render :new }\n format.json { render json: @jugador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gonullu = Gonullu.new(gonullu_params)\n\n respond_to do |format|\n if @gonullu.save\n format.html { redirect_to @gonullu, notice: 'Gonullu was successfully created.' }\n format.json { render :show, status: :created, location: @gonullu }\n else\n format.html { render :new }\n format.json { render json: @gonullu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @garantium = Garantium.new(garantium_params)\n\n respond_to do |format|\n if @garantium.save\n format.html { redirect_to @garantium, notice: 'Garantium was successfully created.' }\n format.json { render :show, status: :created, location: @garantium }\n else\n format.html { render :new }\n format.json { render json: @garantium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @garply = Garply.new(garply_params)\n\n respond_to do |format|\n if @garply.save\n format.html { redirect_to @garply, notice: 'Garply was successfully created.' }\n format.json { render :show, status: :created, location: @garply }\n else\n format.html { render :new }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gastronomium = Gastronomium.new(gastronomium_params)\n\n respond_to do |format|\n if @gastronomium.save\n format.html { redirect_to @gastronomium, notice: 'Gastronomium was successfully created.' }\n format.json { render :show, status: :created, location: @gastronomium }\n else\n format.html { render :new }\n format.json { render json: @gastronomium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end",
"def create\n @barangay_population = BarangayPopulation.new(barangay_population_params)\n\n respond_to do |format|\n if @barangay_population.save\n format.html { redirect_to @barangay_population, notice: 'Barangay population was successfully created.' }\n format.json { render action: 'show', status: :created, location: @barangay_population }\n else\n format.html { render action: 'new' }\n format.json { render json: @barangay_population.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tuiguangxiangqing = Tuiguangxiangqing.new(tuiguangxiangqing_params)\n\n respond_to do |format|\n if @tuiguangxiangqing.save\n format.html { redirect_to @tuiguangxiangqing, notice: 'Tuiguangxiangqing was successfully created.' }\n format.json { render :show, status: :created, location: @tuiguangxiangqing }\n else\n format.html { render :new }\n format.json { render json: @tuiguangxiangqing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @golfer = Golfer.new(params[:golfer])\n\n respond_to do |format|\n if @golfer.save\n format.html { redirect_to @golfer, notice: 'Golfer was successfully created.' }\n format.json { render json: @golfer, status: :created, location: @golfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gondola = Gondola.new(gondola_params)\n\n respond_to do |format|\n if @gondola.save\n format.html { redirect_to @gondola, notice: 'Gondola was successfully created.' }\n format.json { render :show, status: :created, location: @gondola }\n else\n format.html { render :new }\n format.json { render json: @gondola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gig = Gig.new(params[:gig])\n @venue = Venue.new(params[:venue])\n respond_to do |format|\n if @gig.save\n @gig.venue_id = @venue\n @venue.save\n format.html { redirect_to(@gig) }\n format.xml { render :xml => @gig, :status => :created, :location => @gig }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gig.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def gang_params\n params.require(:gang).permit(:flexed, :shift_id, :top_pick, :utr, :note)\n end",
"def create\n @game = Game.new(game_params)\n @game.user_id = current_user.id \n @game.img_url_small = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"image\"][\"screen_url\"]\n @game.img_url_large = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"image\"][\"small_url\"]\n @game.deck = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"deck\"]\n @game.developers = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"developers\"][0][\"name\"]\n @game.genre = APIS::Giantbomb.new.game_by_id(@game.game_id)[\"results\"][\"genres\"][0][\"name\"]\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to search_index_path, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gastos_balanceado = GastosBalanceado.new(gastos_balanceado_params)\n\n respond_to do |format|\n if @gastos_balanceado.save\n format.html { redirect_to @gastos_balanceado, notice: 'Gastos balanceado was successfully created.' }\n format.json { render :show, status: :created, location: @gastos_balanceado }\n else\n format.html { render :new }\n format.json { render json: @gastos_balanceado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, :notice => 'Badge was successfully created.' }\n format.json { render :json => @badge, :status => :created, :location => @badge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugestao = Sugestao.new(sugestao_params)\n\n respond_to do |format|\n if @sugestao.save\n format.html { redirect_to @sugestao, notice: 'Sugestão salva com sucesso.' }\n format.json { render :show, status: :created, location: @sugestao }\n else\n format.html { render :new }\n format.json { render json: @sugestao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @gongdans = Gongdan.all\n end",
"def create\n @engraving = Engraving.new(engraving_params)\n\n respond_to do |format|\n if @engraving.save\n format.html { redirect_to @engraving, notice: 'Engraving was successfully created.' }\n format.json { render :show, status: :created, location: @engraving }\n else\n format.html { render :new }\n format.json { render json: @engraving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend",
"def create\n @grm_grappt = GrmGrappt.new(params[:grm_grappt])\n\n respond_to do |format|\n if @grm_grappt.save\n format.html { redirect_to @grm_grappt, notice: 'Grooming appointment was successfully created.' }\n format.json { render json: @grm_grappt, status: :created, location: @grm_grappt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grm_grappt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def create\n @kindergarten = Kindergarten.new(kindergarten_params)\n\n respond_to do |format|\n if @kindergarten.save\n format.html { redirect_to @kindergarten, notice: 'Kindergarten was successfully created.' }\n format.json { render :show, status: :created, location: @kindergarten }\n else\n format.html { render :new }\n format.json { render json: @kindergarten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geocach = Geocach.new(params[:geocach])\n\n respond_to do |format|\n if @geocach.save\n format.html { redirect_to @geocach, notice: 'A Geocache was successfully created.' }\n format.json { render json: @geocach, status: :created, location: @geocach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gempost = Gempost.new(gempost_params)\n\n respond_to do |format|\n if @gempost.save\n format.html { redirect_to @gempost, notice: 'Gempost was successfully created.' }\n format.json { render :show, status: :created, location: @gempost }\n else\n format.html { render :new }\n format.json { render json: @gempost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gizmo = Gizmo.new(gizmo_params)\n\n respond_to do |format|\n if @gizmo.save\n format.html { redirect_to @gizmo.family || @gizmo, notice: 'Gizmo was successfully created.' }\n format.json { render :show, status: :created, location: @gizmo }\n else\n format.html { render :new }\n format.json { render json: @gizmo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gongdan_params\n params.require(:gongdan).permit(:number, :title, :creator, :department, :area, :demander, :emergent, :file_time, :appoint_worker_again, :image, :avatar,\n :description, :appoint_worker, :state, :evaluate, :user_id, :e_timeliness, :e_attitude,:accept_time,\n :dispatch_time, :dispatch_time_second, :transfer_time, :e_quality, :e_improvement, :experience_base, :file,\n :finish_time, :transger_reson, :appoint_worker_again, :flag, :build_way, :appoint_department,:category, :processing_procedure,\n :helpers => [] )\n\n end",
"def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupoassunto = Grupoassunto.new(grupoassunto_params)\n\n if @grupoassunto.save\n render json: @grupoassunto, status: :created, location: @grupoassunto\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end",
"def new\n @gram = current_user.grams.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gram }\n end\n end"
] |
[
"0.6331206",
"0.6269475",
"0.60883754",
"0.60736394",
"0.6058379",
"0.6015301",
"0.60093653",
"0.5913532",
"0.5912147",
"0.5908234",
"0.5886577",
"0.5848796",
"0.58117175",
"0.58074707",
"0.57898474",
"0.5749476",
"0.5709044",
"0.57076526",
"0.5680967",
"0.56791526",
"0.56687135",
"0.5652651",
"0.5646969",
"0.56467426",
"0.5644432",
"0.56340635",
"0.55947727",
"0.5582081",
"0.55641764",
"0.5561868",
"0.55609",
"0.55540556",
"0.55515164",
"0.55448836",
"0.5544019",
"0.55404174",
"0.5531864",
"0.55233353",
"0.55166095",
"0.5512663",
"0.5507563",
"0.5506503",
"0.550251",
"0.5497229",
"0.5486383",
"0.5472782",
"0.5462672",
"0.544169",
"0.54414654",
"0.5432486",
"0.54250085",
"0.54106945",
"0.53959256",
"0.5390375",
"0.5389639",
"0.5388477",
"0.53879124",
"0.5369594",
"0.5369214",
"0.5365803",
"0.53592694",
"0.53589135",
"0.5350736",
"0.5350414",
"0.5347278",
"0.5341018",
"0.53398305",
"0.5331394",
"0.53224695",
"0.53170645",
"0.5309168",
"0.53091663",
"0.5308971",
"0.530696",
"0.5306035",
"0.5303245",
"0.5303003",
"0.53022134",
"0.529959",
"0.5298278",
"0.52954954",
"0.5293948",
"0.5281894",
"0.52759045",
"0.52726495",
"0.5272495",
"0.5271735",
"0.52715534",
"0.5270085",
"0.52639407",
"0.5259795",
"0.5255349",
"0.5253798",
"0.52468103",
"0.52378166",
"0.5237224",
"0.52334654",
"0.52324104",
"0.52317524",
"0.52289796"
] |
0.64743775
|
0
|
PATCH/PUT /gigapans/1 PATCH/PUT /gigapans/1.json
|
def update
respond_to do |format|
if @gigapan.update(gigapan_params)
format.html { redirect_to @gigapan, notice: 'Gigapan was successfully updated.' }
format.json { render :show, status: :ok, location: @gigapan }
else
format.html { render :edit }
format.json { render json: @gigapan.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n if update_gig(@gig)\n format.html { redirect_to @gig, notice: 'Gig was successfully updated.' }\n format.json { render json: @gig, status: :ok, location: @gig }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n if @gig_request.update_attributes(params[:gig_request])\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gig.update(gig_params)\n format.html { redirect_to @gig, notice: \"Gig was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gig }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gig_set.update(gig_set_params)\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't update set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gig_request.update(gig_request_params)\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { render :show, status: :ok, location: @gig_request }\n else\n format.html { render :edit }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gakka.update(gakka_params)\n format.html { redirect_to @gakka, notice: \"Gakka was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gakka }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gakka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @gato.update(gato_params)\n format.html { redirect_to @gato, notice: 'Gato was successfully updated.' }\n format.json { render :show, status: :ok, location: @gato }\n else\n format.html { render :edit }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gatha.update(gatha_params)\n format.html { redirect_to @gatha, notice: 'Gatha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @gosok.update(gosok_params)\n format.html { redirect_to gosoks_url, notice: 'Gosok was successfully updated.' }\n format.json { render :show, status: :ok, location: @gosok }\n else\n format.html { render :edit }\n format.json { render json: @gosok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gama.update(gama_params)\n format.html { redirect_to @gama, notice: 'Gama was successfully updated.' }\n format.json { render :show, status: :ok, location: @gama }\n else\n format.html { render :edit }\n format.json { render json: @gama.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @gang.update(gang_params)\n format.html { redirect_to @gang, notice: 'Gang was successfully updated.' }\n format.json { render :show, status: :ok, location: @gang }\n else\n format.html { render :edit }\n format.json { render json: @gang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @grape.update(grape_params)\n format.html { redirect_to @grape, notice: \"Grape was successfully updated.\" }\n format.json { render :show, status: :ok, location: @grape }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @grape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ganho.update(ganho_params)\n format.html { redirect_to @ganho, notice: 'Ganho was successfully updated.' }\n format.json { render :show, status: :ok, location: @ganho }\n else\n format.html { render :edit }\n format.json { render json: @ganho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n if @gig.update_attributes(params[:gig])\n flash[:notice] = 'Gig was successfully updated.'\n format.html { redirect_to(@gig) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gig.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @great.update(great_params)\n format.html { redirect_to @great, notice: 'Great was successfully updated.' }\n format.json { render :show, status: :ok, location: @great }\n else\n format.html { render :edit }\n format.json { render json: @great.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @made_in_g.update(made_in_g_params)\n format.html { redirect_to @made_in_g, notice: 'Made in g was successfully updated.' }\n format.json { render :show, status: :ok, location: @made_in_g }\n else\n format.html { render :edit }\n format.json { render json: @made_in_g.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gato.update(gato_params)\n format.html { redirect_to gatos_url, notice: 'Gato actualizado.' }\n format.json { render :show, status: :ok, location: @gato }\n else\n format.html { render :edit }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @galinha.update(galinha_params)\n format.html { redirect_to @galinha, notice: 'Galinha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @galinha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @gig_type.update(gig_type_params)\n format.html { redirect_to @gig_type, notice: 'Gig type was successfully updated.' }\n format.json { render :show, status: :ok, location: @gig_type }\n else\n format.html { render :edit }\n format.json { render json: @gig_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gin.update(gin_params)\n format.html { redirect_to @gin, notice: 'Gin was successfully updated.' }\n format.json { render :show, status: :ok, location: @gin }\n else\n format.html { render :edit }\n format.json { render json: @gin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @grape.update(grape_params)\n format.html { redirect_to @grape, notice: 'Composition was successfully updated.' }\n format.json { render :show, status: :ok, location: @grape }\n else\n format.html { render :edit }\n format.json { render json: @grape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n if @grm_grappt.update_attributes(params[:grm_grappt])\n format.html { redirect_to @grm_grappt, notice: 'Grooming appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grm_grappt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gist.update(gist_params)\n format.html { redirect_to @gist, notice: 'Gist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n if @gastracker.update_attributes(params[:gastracker])\n format.html { redirect_to @gastracker, notice: 'Gastracker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gastracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def create\n gig = Gig.new()\n respond_to do |format|\n if update_gig(gig)\n format.html { render json: gig, status: :created, location: gig }\n format.json { render json: gig, status: :created, location: gig }\n else\n format.html { render action: \"new\" }\n format.json { render json: gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n if @gasto.update_attributes(params[:gasto])\n format.html { redirect_to @gasto, notice: 'Gasto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grave.updated_by_id = current_user.id\n respond_to do |format|\n if @grave.update(grave_params)\n format.html { redirect_to graves_url, notice: 'Grave was successfully updated.' }\n format.json { render :show, status: :ok, location: @grave }\n else\n format.html { render :edit }\n format.json { render json: @grave.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @garply.update(garply_params)\n format.html { redirect_to @garply, notice: 'Garply was successfully updated.' }\n format.json { render :show, status: :ok, location: @garply }\n else\n format.html { render :edit }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n if @goat.update_attributes(params[:goat])\n format.html { redirect_to @goat, notice: 'Goat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n if @gist.update_attributes(params[:gist])\n format.html { redirect_to @gist, notice: 'Gist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @gift.user == @current_user\n if @gift.update(gift_params)\n render json: @gift, include: :ages\n else\n render json: @gift.errors, status: :unprocessable_entity\n end\n else\n render json: { errors: \"not authorized\" }, status: :unauthorized\n end\n end",
"def update\n respond_to do |format|\n if @allergy.update(allergy_params)\n format.html { redirect_to @allergy, notice: t('allergies.update_success') }\n format.json { render :show, status: :ok, location: @allergy }\n else\n format.html { render :edit }\n format.json { render json: @allergy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @greffe.update(greffe_params)\n format.html { redirect_to administration_greffe_path(@greffe), notice: 'Greffe was successfully updated.' }\n format.json { render :show, status: :ok, location: @greffe }\n else\n format.html { render :edit }\n format.json { render json: @greffe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @goofball.update(goofball_params)\n format.html { redirect_to @goofball, notice: 'Goofball was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goofball.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @badge }\n else\n format.html { render :edit }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n if @glass.update_attributes(params[:glass])\n format.html { redirect_to @glass, notice: 'Glass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @galletum.update(galletum_params)\n format.html { redirect_to @galletum, notice: 'Galletum was successfully updated.' }\n format.json { render :show, status: :ok, location: @galletum }\n else\n format.html { render :edit }\n format.json { render json: @galletum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gabinete_object.update(gabinete_object_params)\n format.html { redirect_to creation_gabinete_objects_path, notice: 'Gabinete object was successfully updated.' }\n format.json { render :show, status: :ok, location: @gabinete_object }\n else\n format.html { render :edit }\n format.json { render json: @gabinete_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gongjijin.update(gongjijin_params)\n format.html { redirect_to @gongjijin, notice: 'Gongjijin was successfully updated.' }\n format.json { render :show, status: :ok, location: @gongjijin }\n else\n format.html { render :edit }\n format.json { render json: @gongjijin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rigging.update(rigging_params)\n format.html { redirect_to @rigging, notice: 'Rigging was successfully updated.' }\n format.json { render :show, status: :ok, location: @rigging }\n else\n format.html { render :edit }\n format.json { render json: @rigging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @golf.update(golf_params)\n format.html { redirect_to @golf, notice: 'Golf was successfully updated.' }\n format.json { render :show, status: :ok, location: @golf }\n else\n format.html { render :edit }\n format.json { render json: @golf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gua.update(gua_params)\n format.html { redirect_to @gua, notice: 'Gua was successfully updated.' }\n format.json { render :show, status: :ok, location: @gua }\n else\n format.html { render :edit }\n format.json { render json: @gua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @giohang.update(giohang_params)\n format.html { redirect_to @giohang, notice: \"Giohang was successfully updated.\" }\n format.json { render :show, status: :ok, location: @giohang }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @giohang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gatineo.update(gatineo_params)\n format.html { redirect_to @gatineo, notice: 'Gatineo atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @gatineo }\n else\n format.html { render :edit }\n format.json { render json: @gatineo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n if @galeria.update_attributes(params[:galeria])\n format.html { redirect_to @galeria, notice: 'Galeria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @galeria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_request = GiftRequest.find(params[:id])\n \n respond_to do |format|\n if @gift_request.update_attributes(params[:gift_request])\n format.html { redirect_to @gift_request, notice: 'Gift request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_request.errors.full_messages.to_sentence, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n respond_to do |format|\n if @gentre.update(gentre_params)\n format.json { render :show, status: :ok, location: @gentre }\n else\n format.json { render json: @gentre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n if @gopy.update_attributes(params[:gopy])\n format.html { redirect_to @gopy, notice: 'Gopy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gopy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @megalith.update(megalith_params)\n format.html { redirect_to @megalith, notice: \"Megalith was successfully updated.\" }\n format.json { render :show, status: :ok, location: @megalith }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @megalith.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @good = Good.find(params[:id])\n\n respond_to do |format|\n if @good.update_attributes(params[:good])\n format.html { redirect_to :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @good.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pg_first.update(pg_first_params)\n format.html { redirect_to @pg_first, notice: 'Pg first was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pg_first.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n if @genotype.update_attributes(params[:genotype])\n format.html { redirect_to @genotype, notice: 'Genotype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @allergens_ingredient.update(allergens_ingredient_params)\n format.html { redirect_to @allergens_ingredient, notice: 'Allergens ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @allergens_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @allergens_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jugadore.update( jugadore_params )\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jugadore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @grumble.update(grumble_params)\n format.html { redirect_to @grumble, notice: 'Grumble was successfully updated.' }\n format.json { render :show, status: :ok, location: @grumble }\n else\n format.html { render :edit }\n format.json { render json: @grumble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gift.update(gift_params)\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift }\n else\n format.html { render :edit }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gift.update(gift_params)\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift }\n else\n format.html { render :edit }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update_plant\n @plant.deleted = false\n\n respond_to do |format|\n if set_attributes_from_filemaker(@plant)\n format.json do\n render status: :created,\n json: {\n id: @plant.id,\n botanical_name: @plant.botanical_name,\n alternative_names: @plant.alternative_names,\n updated_at: @plant.updated_at,\n visible: (!@plant.deleted).to_s\n }\n end\n else\n format.json do\n render json: @plant.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_method\n :put_json\n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n if @brag.update_attributes(params[:brag])\n format.html { redirect_to @brag, notice: 'Brag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @good.update(good_params)\n format.html { redirect_to @good, notice: 'Good was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @good.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @in_game_gift.update(in_game_gift_params)\n format.html { redirect_to @in_game_gift, notice: 'In game gift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @in_game_gift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n respond_to do |format|\n if @bracket_golfer.update(bracket_golfer_params)\n format.html { redirect_to @bracket_golfer, notice: 'Bracket golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pug = Pug.find(params[:id])\n\n if @pug.update(pug_params)\n head :no_content\n else\n render json: @pug.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.6654686",
"0.64530367",
"0.64485854",
"0.6409269",
"0.6276356",
"0.6251555",
"0.6227445",
"0.62250435",
"0.6216419",
"0.6193928",
"0.6120833",
"0.6115311",
"0.6106076",
"0.6100362",
"0.6099361",
"0.6074797",
"0.6061791",
"0.6045284",
"0.60261714",
"0.6011834",
"0.60048956",
"0.599397",
"0.59858334",
"0.5983871",
"0.59807503",
"0.59795517",
"0.59701014",
"0.5962229",
"0.59448665",
"0.5925371",
"0.59204537",
"0.59054273",
"0.59019387",
"0.5889543",
"0.58675736",
"0.585686",
"0.58539504",
"0.5853373",
"0.5853373",
"0.58520913",
"0.58514184",
"0.58495736",
"0.58443624",
"0.5843395",
"0.5834838",
"0.58328086",
"0.5828033",
"0.5826824",
"0.5826229",
"0.5816605",
"0.5809884",
"0.5802512",
"0.5798394",
"0.5795075",
"0.5787815",
"0.57866544",
"0.57798004",
"0.57751405",
"0.5768031",
"0.5764727",
"0.57635564",
"0.5761968",
"0.57440776",
"0.5741033",
"0.57368404",
"0.57295865",
"0.5717662",
"0.57171655",
"0.57072955",
"0.56984913",
"0.56984913",
"0.56926984",
"0.5690456",
"0.5689944",
"0.56878036",
"0.5685539",
"0.56815946",
"0.5679109",
"0.5673347",
"0.56731176",
"0.56696993",
"0.5668959",
"0.56650263",
"0.5664511",
"0.5664511",
"0.56632614",
"0.56624657",
"0.56622154",
"0.56596893",
"0.56593937",
"0.5655018",
"0.56549686",
"0.5652873",
"0.5651777",
"0.5648174",
"0.56354415",
"0.5632928",
"0.56257826",
"0.5625442",
"0.5620749"
] |
0.60503423
|
17
|
DELETE /gigapans/1 DELETE /gigapans/1.json
|
def destroy
@gigapan.destroy
respond_to do |format|
format.html { redirect_to gigapans_url, notice: 'Gigapan was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { render json: nil, status: :ok }\n end\n end",
"def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gig.destroy\n respond_to do |format|\n format.html { redirect_to gigs_url, notice: 'Gig was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gig.destroy\n respond_to do |format|\n format.html { redirect_to gigs_url, notice: \"Gig was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to(gigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @galinha.destroy\n respond_to do |format|\n format.html { redirect_to galinhas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gakka.destroy\n respond_to do |format|\n format.html { redirect_to gakkas_url, notice: \"Gakka was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gang.destroy\n respond_to do |format|\n format.html { redirect_to gangs_url, notice: 'Gang was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @gig_request.destroy\n respond_to do |format|\n format.html { redirect_to gig_requests_url, notice: 'Gig request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gudang.destroy\n respond_to do |format|\n format.html { redirect_to gudangs_url, notice: 'Gudang was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gama.destroy\n respond_to do |format|\n format.html { redirect_to gamas_url, notice: 'Gama was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grooming.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Visit was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @great.destroy\n respond_to do |format|\n format.html { redirect_to greats_url, notice: 'Great was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gato.destroy\n respond_to do |format|\n format.html { redirect_to gatos_url, notice: 'Gato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @gatineo.destroy\n respond_to do |format|\n format.html { redirect_to gatineos_url, notice: 'Gatineo apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gastracker = Gastracker.find(params[:id])\n @gastracker.destroy\n\n respond_to do |format|\n format.html { redirect_to gastrackers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gato.destroy\n respond_to do |format|\n format.html { redirect_to gatos_url, notice: 'Gato eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ganho.destroy\n respond_to do |format|\n format.html { redirect_to ganhos_url, notice: 'Ganho was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @galeria = Galeria.find(params[:id])\n @galeria.destroy\n\n respond_to do |format|\n format.html { redirect_to galerias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gig_type.destroy\n respond_to do |format|\n format.html { redirect_to gig_types_url, notice: 'Gig type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gin.destroy\n respond_to do |format|\n format.html { redirect_to gins_url, notice: 'Gin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gosok.destroy\n respond_to do |format|\n format.html { redirect_to gosoks_url, notice: 'Gosok was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gua.destroy\n respond_to do |format|\n format.html { redirect_to guas_url, notice: 'Gua was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gentre.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ganho = Ganho.find(params[:id])\n @ganho.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganhos_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @grave.destroy\n respond_to do |format|\n format.html { redirect_to graves_url, notice: 'Grave was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @golfer = Golfer.find(params[:id])\n @golfer.destroy\n\n respond_to do |format|\n format.html { redirect_to golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @galletum.destroy\n respond_to do |format|\n format.html { redirect_to galleta_url, notice: 'Galletum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gist.destroy\n respond_to do |format|\n format.html { redirect_to gists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grupa = Grupa.find(params[:id])\n @grupa.destroy\n\n respond_to do |format|\n format.html { redirect_to grupy_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @made_in_g.destroy\n respond_to do |format|\n format.html { redirect_to made_in_gs_url, notice: 'Made in g was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gaz_assay = GazAssay.find(params[:id])\n @gaz_assay.destroy\n\n respond_to do |format|\n format.html { redirect_to gaz_assays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @rigging.destroy\n respond_to do |format|\n format.html { redirect_to riggings_url, notice: 'Rigging was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @grm_grappt = GrmGrappt.find(params[:id])\n @grm_grappt.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_grappts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @percentual_gordura.destroy\n respond_to do |format|\n format.html { redirect_to percentual_gorduras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupe_aile.destroy\n respond_to do |format|\n format.html { redirect_to groupe_ailes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @gopy = Gopy.find(params[:id])\n @gopy.destroy\n\n respond_to do |format|\n #format.html { redirect_to gopies_url }\n format.html { redirect_to hienthi_gopies_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gravity = Gravity.find(params[:id])\n @gravity.destroy\n\n respond_to do |format|\n format.html { redirect_to gravities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @immigrant = Immigrant.find(params[:id])\n @immigrant.destroy\n\n respond_to do |format|\n format.html { redirect_to immigrants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @grumble.destroy\n respond_to do |format|\n format.html { redirect_to grumbles_url, notice: 'Grumble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gastronomium.destroy\n respond_to do |format|\n format.html { redirect_to gastronomia_url, notice: 'Gastronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @garnish.destroy\n respond_to do |format|\n format.html { redirect_to garnishes_url, notice: 'Garnish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giohang.destroy\n respond_to do |format|\n format.html { redirect_to giohangs_url, notice: \"Giohang was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @garantium.destroy\n respond_to do |format|\n format.html { redirect_to garantia_url, notice: 'Garantium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @garply.destroy\n respond_to do |format|\n format.html { redirect_to garplies_url, notice: 'Garply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @crag.destroy\n respond_to do |format|\n format.html { redirect_to crags_url, notice: 'Crag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jugadalot.destroy\n respond_to do |format|\n format.html { redirect_to new_jugadalot_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gameroom = Gameroom.find(params[:id])\n if @gameroom.destroy\n render json: @gameroom, status: :accepted\n else\n render json: {errors: @gameroom.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def destroy\n @cetak_gtg.destroy\n respond_to do |format|\n format.html { redirect_to cetak_gtgs_url, notice: 'Cetak gtg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goofball.destroy\n respond_to do |format|\n format.html { redirect_to goofballs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gravity.destroy\n respond_to do |format|\n format.html { redirect_to gravities_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7378508",
"0.7195424",
"0.7167964",
"0.71067554",
"0.71051896",
"0.70740837",
"0.7054732",
"0.7044149",
"0.7029028",
"0.7013696",
"0.6999828",
"0.6961992",
"0.69596744",
"0.6950693",
"0.6922792",
"0.69133353",
"0.6901223",
"0.6886419",
"0.68813634",
"0.6881043",
"0.68745077",
"0.6868631",
"0.6857124",
"0.6840994",
"0.68400604",
"0.68302745",
"0.68262124",
"0.68162906",
"0.6811271",
"0.6808455",
"0.6792742",
"0.6791339",
"0.6790027",
"0.67872584",
"0.6785697",
"0.6764573",
"0.67562246",
"0.6738917",
"0.6735847",
"0.6729251",
"0.6729251",
"0.6729251",
"0.6729251",
"0.67243725",
"0.67241925",
"0.67238253",
"0.67235374",
"0.67138344",
"0.67130774",
"0.6710165",
"0.6707912",
"0.6706994",
"0.6706771",
"0.6706455",
"0.6706269",
"0.66896117",
"0.66874564",
"0.66792",
"0.6675177",
"0.66683656",
"0.66655535",
"0.66622984",
"0.6661338",
"0.665746",
"0.66546494",
"0.66531616",
"0.6642315",
"0.66380185",
"0.66380185",
"0.6637459",
"0.6636175",
"0.6632257",
"0.6629369",
"0.6625974",
"0.6617047",
"0.6617047",
"0.6616848",
"0.6611223",
"0.6609099",
"0.66069674",
"0.66062534",
"0.660594",
"0.6604273",
"0.66014606",
"0.66009414",
"0.6600781",
"0.65979284",
"0.6596549",
"0.65948796",
"0.6593804",
"0.6590837",
"0.6590021",
"0.6585818",
"0.65781176",
"0.6577664",
"0.6577141",
"0.6576413",
"0.65763307",
"0.6575463",
"0.6570047"
] |
0.7088292
|
5
|
Use callbacks to share common setup or constraints between actions.
|
def set_gigapan
@gigapan = Gigapan.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def gigapan_params
params.require(:gigapan).permit(:name, :project, :gig_id, :description)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
TODO: deprecate TODO: parametrize to include gazetteer i.e. geographic_areas_geographic_items.where( gaz = 'some string') !! avoid loading the whole GeographicItem, just grab the bits we need.
|
def collecting_event_to_simple_json_feature(collecting_event)
base = {
'type' => 'Feature',
'properties' => {
'target' => {
'type' => 'CollectingEvent',
'id' => collecting_event.id },
'label' => label_for_collecting_event(collecting_event) }
}
if collecting_event.geographic_items.any?
geo_item_id = collecting_event.geographic_items.select(:id).first.id
query = "ST_AsGeoJSON(#{GeographicItem::GEOMETRY_SQL.to_sql}::geometry) geo_json"
base['geometry'] = JSON.parse(GeographicItem.select(query).find(geo_item_id).geo_json)
end
base
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_geographic_item\n @geographic_item = GeographicItem.find(params[:id])\n end",
"def items_as_geojson\n @model.fields.each do |field|\n next unless field.is_a?(Field::Geometry)\n\n geometry_aware_items = unpaginaged_items.reject { |it| it.data[field.uuid].blank? }\n\n return geometry_aware_items.map do |item|\n next if item.data[field.uuid][\"features\"].blank?\n\n item.data[field.uuid][\"features\"].each_with_index do |_feat, i|\n item.data[field.uuid][\"features\"][i][\"properties\"][\"id\"] = item.id\n item.data[field.uuid][\"features\"]\n end\n end\n end\n end",
"def geopos(key, member); end",
"def geo\n\t\t@hotels = Hotel.joins(:area).order(\"areas.sort\", \"sort\")\n\tend",
"def to_geo_json_string\n GeographicItem.connection.select_one(\n \"SELECT ST_AsGeoJSON(#{geo_object_type}::geometry) a \" \\\n \"FROM geographic_items WHERE id=#{id};\")['a']\n end",
"def build_geographies\n build_trip_within_area unless trip_within_area\n end",
"def geotag_me\n return true unless (item.respond_to?(:latitude) && item.latitude && item.respond_to?(:longitude) && item.longitude)\n self.latitude = item.latitude\n self.longitude = item.longitude\n end",
"def is_contained_by(column_name, *geographic_items)\n column_name.downcase!\n case column_name\n when 'any'\n part = []\n DATA_TYPES.each { |column|\n unless column == :geometry_collection\n part.push(GeographicItem.is_contained_by(column.to_s, geographic_items).to_a)\n end\n }\n # @TODO change 'id in (?)' to some other sql construct\n GeographicItem.where(id: part.flatten.map(&:id))\n\n when 'any_poly', 'any_line'\n part = []\n DATA_TYPES.each { |column|\n unless column == :geometry_collection\n if column.to_s.index(column_name.gsub('any_', ''))\n part.push(GeographicItem.is_contained_by(column.to_s, geographic_items).to_a)\n end\n end\n }\n # @TODO change 'id in (?)' to some other sql construct\n GeographicItem.where(id: part.flatten.map(&:id))\n\n else\n q = geographic_items.flatten.collect { |geographic_item|\n GeographicItem.reverse_containing_sql(column_name, geographic_item.to_param,\n geographic_item.geo_object_type)\n }.join(' or ')\n where(q) # .not_including(geographic_items)\n end\n end",
"def get_containing_geography\n return self.geography\n end",
"def geo; end",
"def area\n GeographicItem.where(id:).select(\"ST_Area(#{GeographicItem::GEOGRAPHY_SQL}, false) as area_in_meters\").first['area_in_meters']\n end",
"def find\n set_user_and_user_areas\n @areas = Area.find_all_by_geom([[params[:min_y], params[:min_x]], \n [params[:max_y], params[:max_x]]])\n @map = Variable.new(\"map\")\n end",
"def to_simple_json_feature\n base = {\n 'type' => 'Feature',\n 'properties' => {}\n }\n\n if geographic_items.any?\n geo_item_id = geographic_items.select(:id).first.id\n query = \"ST_AsGeoJSON(#{GeographicItem::GEOMETRY_SQL.to_sql}::geometry) geo_json\"\n base['geometry'] = JSON.parse(GeographicItem.select(query).find(geo_item_id).geo_json)\n end\n base\n end",
"def geo\n fetch('creature.bird.geo')\n end",
"def geographies\n codes = geography_codes.map(&:first)\n codes.each_with_object({}) do |code, hash|\n hash[code] = OnsOpenApi.context(context_name).geographies(code)\n end\n end",
"def build_geographies\n build_start_or_end_area unless start_or_end_area\n build_trip_within_area unless trip_within_area\n end",
"def items_near_location(long, lat)\n long = long.to_f\n lat = lat.to_f\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.000025)\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.00006) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.002) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 10.0) if nearby_items.empty?\n return nearby_items\n end",
"def loc_geographic\n FACTORY.unproject(self.loc)\n end",
"def geography_columns!; end",
"def fetch_heir_geographic\n return if bpldc_url.blank?\n\n auth_data = Curator::ControlledTerms::AuthorityService.call(path: bpldc_url, path_prefix: '/geomash')\n\n return if auth_data.blank? || auth_data&.fetch(:hier_geo, {}).blank?\n\n hier_geo_attrs = auth_data[:hier_geo].dup\n\n if auth_data.dig(:non_hier_geo, :value).blank?\n hier_geo_attrs = Curator::Parsers::GeoParser.normalize_tgn_hgeo(hier_geo_attrs)\n return TgnHierGeo.new(**hier_geo_attrs)\n end\n\n other_geo_value = auth_data[:non_hier_geo][:value]\n other_geo_value << \" (#{geographic.area_type})\" if geographic.area_type.present?\n\n hier_geo_attrs[:other] = other_geo_value\n hier_geo_attrs = Curator::Parsers::GeoParser.normalize_tgn_hgeo(hier_geo_attrs)\n\n TgnHierGeo.new(**hier_geo_attrs)\n end",
"def geodatos\n end",
"def geographic_item_params\n params.require(:geographic_item).permit(:point, :line_string, :polygon, :multi_point, :multi_line_string, :multi_polygon, :geometry_collection, :created_by_id, :updated_by_id)\n end",
"def geographic_names\n return @geographic_names if !@geographic_names.nil?\n @geographic_names ||= geographic_area.geographic_name_classification.delete_if{|k,v| v.nil?}\n @geographic_names ||= {}\n end",
"def analysePolygon(geojson, data_sources = [\"protected_areas\"])\n self.query_area_km2 = 0\n self.query_area_carbon_kg = 0\n self.save\n\n #convert geojson to wkt\n wkt = GeomHelper.geojson_to_wkt geojson\n query = [{:id => self.id, :the_geom => wkt}].to_json\n\n data_sources.each { |source|\n case source\n when \"coral\"\n url = \"http://localhost:4567/marine_search/coral\"\n field_setter = \"query_area_coral_km2=\"\n when \"mangroves\"\n url = \"http://localhost:4567/marine_search/mangroves\"\n field_setter = \"query_area_mangrove_km2=\"\n when \"sea_grass\"\n url = \"\"\n field_setter = \"query_area_sea_grass_km2=\"\n else\n next\n end\n\n res = nil\n begin\n res = JSON.parse Net::HTTP.post_form(URI.parse(url),:data => query).body\n rescue\n next\n end\n next unless res\n if res.include? \"error\"\n msg = \"Error fetching data from #{source} data source: \" + res[\"error\"]\n puts msg\n logger.error msg\n next\n end\n\n val = 0\n res[\"results\"].each{|item|val += item[\"overlapped_area\"].to_f}\n self.send field_setter, val\n self.save\n }\n\n if data_sources.include?( \"protected_areas\" )\n ok = true\n begin\n # call API\n url = \"http://protectedplanet.net/api2/geo_searches\"\n res = Net::HTTP.post_form(URI.parse(url),:data => query).body\n res = JSON.parse res\n rescue\n ok = false\n end\n\n if ok\n # populate DB with results\n res[\"results\"].each do |item|\n # This will be returned multiple times, but... it seems to be the only way to get it, other than calculating\n # locally. (Would that be so bad?.)\n self.query_area_km2 = item[\"query_area_km2\"].to_f\n self.query_area_carbon_kg = item[\"query_area_carbon_kg\"].to_f\n self.save\n\n item[\"protected_areas\"].each do |s|\n #ds = s['data_standard']\n #wkt = ds[\"GEOM\"]\n site = Site.create :tenement_id => id,\n :wdpaid => s['wdpaid'],\n :image => s['image'],\n :encoded_polyline_cache => s['epl'],\n :data_standard => s['data_standard'],\n :protected_carbon_kg => s['protected_carbon_kg'],\n :protected_area_km2 => s['protected_area_km2'],\n :query_area_protected_km2 => s['query_area_protected_km2'],\n :query_area_protected_carbon_kg => s['query_area_protected_carbon_kg']\n sql = \"UPDATE sites SET the_geom=ST_GeomFromText('#{s['simple_geom']}') where id=#{site.id}\"\n Site.connection.execute sql\n end\n end\n end\n end\n end",
"def is_on_floor_bottom\n return Sketchup.active_model.get_attribute(\"GeoReference\", \"onOceanFloor\") == \"true\";\nend",
"def geographic_oregon(subject, data)\n geographic(subject, data, RDF::Vocab::DC[:spatial], {:adminCode1 => \"OR\", :countryBias => \"US\"})\n end",
"def drawn_georeferences\n message = ''\n value = params['gr_geographic_item_attributes_shape']\n if value.blank?\n @georeferences = Georeference.where('false')\n else\n feature = RGeo::GeoJSON.decode(value, json_parser: :json)\n # isolate the WKT\n geometry = feature.geometry\n this_type = geometry.geometry_type.to_s.downcase\n geometry = geometry.as_text\n\n radius = feature['radius']\n case this_type\n when 'point'\n @georeferences = Georeference.with_project_id(sessions_current_project_id)\n .joins(:geographic_item)\n .where(GeographicItem.intersecting_radius_of_wkt_sql(geometry, radius)) # TODO: likely want within_radius_of_wkt_sql\n when 'polygon'\n @georeferences = Georeference.with_project_id(sessions_current_project_id)\n .joins(:geographic_item)\n .where(GeographicItem.contained_by_wkt_sql(geometry))\n else\n end\n if @georeferences.blank?\n message = 'no objects contained in drawn shape'\n end\n render_gr_select_json(message)\n end\n end",
"def geographic_facet\n geographic_search.map { |val| val.sub(/[\\\\,;]$/, '').strip } if geographic_search\n end",
"def same_tag_bigger_geo\n above = self.geography.geography\n return [] if above.nil?\n match = Filter.where(\"geography_id = ? and has_tag_id = ?\",above.id,self.has_tag_id)\n return match if match\n return []\n end",
"def region_item\n super\n end",
"def compute_geometry_in_memory\n sites_with_location = sites.select{|x| x.lat && x.lng}\n min_lat, max_lat, min_lng, max_lng = 90, -90, 180, -180\n sites_with_location.each do |site|\n min_lat = site.lat if site.lat < min_lat\n max_lat = site.lat if site.lat > max_lat\n min_lng = site.lng if site.lng < min_lng\n max_lng = site.lng if site.lng > max_lng\n end\n set_bounding_box min_lat, max_lat, min_lng, max_lng\n end",
"def geography\n @geography ||= auxilliary_metadata(:geography, GeographyMeta)\n end",
"def geography_columns; end",
"def show\n @filter = Filter.find(params[:id])\n\n @area = @filter.polygon\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 1)\n #@listings = []\n #@listings = Listing.where(:area.in => @filter.areas)\n @listings = Listing.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n @listings_agent_ids = []\n @listings.each do |listing|\n @listings_agent_ids.push listing.agent_id\n end\n @all_agents = Agent.where(:id.in => @listings_agent_ids)\n else\n @listings = []\n @all_agents = []\n end\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 2)\n @agents = Agent.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n else\n @agents = []\n end\n\n @location = [-0.167, 51.474]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filter }\n end\n end",
"def geolocate \n Zoogle.graveyard_locator(self.graveyard)\n \"#{loc[:latitude]}, #{loc[:longitude]}\"\n end",
"def getEntitySearchWhoByboundingbox( who, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['who'] = who\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/who/byboundingbox\",params)\n end",
"def get_area_details\n response = RestClient.get \"http://www.broadbandmap.gov/broadbandmap/census/block?latitude=#{self.location_lat}&longitude=#{self.location_lng}&format=json\"\n if response.code == 200\n response = JSON.parse(response)\n self.fips_block_type = response['Results']['block'][0]['geographyType']\n self.fips_state = response['Results']['block'][0]['FIPS'][0..1]\n self.fips_county = response['Results']['block'][0]['FIPS'][2..4]\n self.fips_tract = response['Results']['block'][0]['FIPS'][5..10]\n true\n end\n false\n end",
"def get_ead_places\n @get_ead_places ||= clean_facets_array(search(\"//geogname\").map(&:text))\n end",
"def geo_factory\n @geo_factory\n end",
"def geo_factory\n @geo_factory\n end",
"def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end",
"def get_geocloud_json\n { :country => self.country, \n :geo_settings => eval(self.geo_settings),\n :ref_point => eval(self.ref_point),\n :width => self.width,\n :height => self.height,\n :map_src => \"/assets/maps/#{self.map_file}\"}.to_json\n end",
"def get_by_lat_lng\n\tend",
"def fetch_cities_from_aramex\n response = []\n zones = Spree::ShippingMethod.where(['LOWER(admin_name) like ?', '%aramex%']).map(&:zones).flatten\n if zones.map(&:country_ids).flatten.uniq.include?(params['country_code'].to_i)\n country = Spree::Country.find(params['country_code'])\n response = JSON.parse(fetch_cities(country.iso))['Cities']\n end\n respond_to do |format|\n format.json { render json: response, status: 200 }\n end\n end",
"def location\n # Retrieve info for dropdown\n @nationwide = Location.get_nationwide\n #@provinces = Location.provinces.where('id != ?', @nationwide.id).order('denorm_sort').collect {|p| [p.name.capitalize, p.id]}.insert(0, [@nationwide.name.capitalize, @nationwide.id])\n @provinces = Location.provinces.where('id != ?', @nationwide.id).order('denorm_sort')\n\n # Retrieve previously selected locations\n @curr_locations = current_user.present? ? current_user.locations.pluck(:id) : []\n\n # Get all regions for the map display \n @regions = Region.order('region_iso').all\n end",
"def index\n @apartment_geopoints = ApartmentGeopoint.all\n end",
"def ships\n MyShip.where(\"location ~= POINT(?)\", self.location)\n end",
"def restrict_objects\n get_affine_coordinates\n nodes = @xml.xpath(\"//descendant::xmlns:OMA/xmlns:OMS[attribute::cd='3Dgeo2']\")\n nodes.each do |node|\n scope.send node[\"name\"].to_sym, node\n end\n end",
"def to_geo\n GeoIngredient.new('LandmarkSet', name: name, buffer: GeoRecipe::DEFAULT_BUFFER_IN_FT)\n end",
"def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend",
"def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['what'] = what\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/what/byboundingbox\",params)\n end",
"def get_local_area_sp service, lat, long\n zipcode = Geocoder.search(\"#{lat},#{long}\").first.postal_code rescue nil\n Profile.where(\"profiles.zipcode like ? AND profiles.#{service.to_s.underscore} = ?\",\"%#{zipcode}%\", true)\n end",
"def to_georss(*args)\n xml = Geos::Helper.xml_options(*args)[0]\n xml.georss(:where) do\n xml.gml(:Point) do\n xml.gml(:pos, \"#{self.lat} #{self.lng}\")\n end\n end\n end",
"def get_nearby_food_pictures\n if params[:lat] and params[:lng]\n @restaurants = Restaurant.all\n # @buildings = Building.find( :all, :conditions => [ 'name LIKE ?', '%' + params[:q].downcase + '%'], :limit => 20)\n \n end\n\n render :json => @restaurants\n end",
"def asigna_pixi_geojson\n file = File.read(Rails.root.join('public', 'topojson', \"#{tipo.estandariza}.geojson\"))\n json = JSON.parse(file)\n json[region_id.to_s]\n end",
"def with_collecting_event_through_georeferences\n geographic_items = GeographicItem.arel_table\n georeferences = Georeference.arel_table\n g1 = georeferences.alias('a')\n g2 = georeferences.alias('b')\n\n c = geographic_items.join(g1, Arel::Nodes::OuterJoin).on(geographic_items[:id].eq(g1[:geographic_item_id]))\n .join(g2, Arel::Nodes::OuterJoin).on(geographic_items[:id].eq(g2[:error_geographic_item_id]))\n\n GeographicItem.joins(# turn the Arel back into scope\n c.join_sources # translate the Arel join to a join hash(?)\n ).where(\n g1[:id].not_eq(nil).or(g2[:id].not_eq(nil)) # returns a Arel::Nodes::Grouping\n ).distinct\n end",
"def show\n set_meta_tags title: \"#{@place.name} en Waydda\",\n description: \"Visita la tienda en línea de #{@place.name} en Waydda\"\n @available_distance = @place.available_distance?(current_or_guest_user.get_ll)\n # @place.products.paginate(page: params[:page], per_page: 30)\n @items = @place.items.includes(:recent_products).paginate(page: params[:page], per_page: 30)\n @item_arrays = @items.select { |item| item.recent_products.length > 0 }\n # @products = @place.products.where(:items_recents.with_size => 0, status: \"active\")\n @products = []\n end",
"def geographic_names\n return @geographic_names if !@geographic_names.nil?\n\n @geographic_names ||= {\n country: cached_level0_geographic_name,\n state: cached_level1_geographic_name,\n county: cached_level2_geographic_name\n }.delete_if{|k,v| v.nil?}\n\n # TODO: Once cached index is updated this should be removed, it is\n # costly for records with geographic_area_id without country, state, county\n if @geographic_names == {} && geographic_area_id\n r = get_geographic_name_classification\n set_cached_geographic_names\n end\n\n @geographic_names ||= {}\n end",
"def get_geo_transform\n @gdalfile.get_geo_transform\n end",
"def editable_locations\n if is_super_admin?\n Location.by_name\n elsif self.region\n res = []\n region.locations.each do |lok|\n res += [lok] + lok.locations\n end\n res\n elsif self.location\n [location] + self.location.locations\n else\n []\n end\n end",
"def find_geolocation_by_box(object_params)\n n_lat, e_long, s_lat, w_long = coordinates_from(object_params)\n boxes = GeolocationBox\n .only_geo_bbox(params[:resource_id])\n .where(ne_latitude: n_lat, ne_longitude: e_long, sw_latitude: s_lat, sw_longitude: w_long)\n return nil if boxes.empty?\n\n boxes.first.geolocation\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end",
"def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end",
"def load_default_location_regions\n returning OpenStruct.new do |location|\n location.edit = Radiant::AdminUI::RegionSet.new do |edit|\n edit.main.concat %w{edit_header edit_form}\n edit.form.concat %w{edit_title edit_group edit_full_address edit_website_url edit_page_path edit_latitude edit_longitude edit_manual_geocode}\n edit.form_bottom.concat %w{edit_timestamp edit_buttons}\n end\n end\n end",
"def geo_mean()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::GeoMean::GeoMeanRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def map(olympians)\n only_athletes = []\n for athlete in olympians\n if athlete[:event] == \"Atheletics\"\n only_athletes.push(athlete)\n end\nend\nreturn only_athletes\nend",
"def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend",
"def nearby_laundry_stores(address_id)\n address = Address.find(address_id)\n address.area.stores.where.not(:operations => \"Dryclean\" )\n end",
"def cities\n self.galleries.map do |g|\n g.city\n end\nend",
"def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end",
"def taggable_world_locations_container\n Rails.cache.fetch(taggable_world_locations_cache_digest, expires_in: 1.day) do\n WorldLocation.ordered_by_name.where(active: true).map { |w| [w.name, w.id] }\n end\n end",
"def same_geo_adjacencies(quantity_max = 5)\n possibles = Filter.where(\"geography_id = ?\",self.geography.id).to_a #will always return at least self\n possibles = possibles.delete_if{|filter| filter.id == self.id}\n return possibles.take(quantity_max)\n end",
"def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end",
"def geo_object\n begin\n if r = geo_object_type # rubocop:disable Lint/AssignmentInCondition\n send(r)\n else\n false\n end\n rescue RGeo::Error::InvalidGeometry\n return nil # TODO: we need to render proper error for this!\n end\n end",
"def cities\n gallaries.map{|place| place.city}\n\n end",
"def build_individual_areas\n @index.values.each do |n|\n geographic_area_type = (n.temp_area.geographic_area_type_name.blank? ? 'Unknown' : n.temp_area.geographic_area_type_name)\n n.geographic_area = GeographicArea.new(\n name: n.temp_area.name, # Clean name at this point if needed.\n data_origin: n.temp_area.source_table,\n geographic_area_type: GeographicAreaType.find_or_create_by(name: geographic_area_type),\n tdwgID: n.temp_area.tdwgID,\n iso_3166_a2: n.temp_area.iso_3166_a2,\n iso_3166_a3: n.temp_area.iso_3166_a3\n )\n end\n end",
"def create_country_specific_gon_variables\n employee_country = current_employee.present? ? current_employee.operating_country : nil\n yard_uid_management = employee_country.nil? ? nil : UidManagement.uid_manager_for(Yard, employee_country)\n gon.copartYards =\n if yard_uid_management.present?\n Yard.for_country_uid(yard_uid_management.min_number, yard_uid_management.max_number)\n .copart_yards\n .for_employee(current_employee).as_json(include_basic: 'yes', list: true)\n else\n []\n end\n gon.showYardFilter = gon.copartYards.size > 1\n gon.facilities = Facility.includes(:country).for_country(employee_country)\n .non_residential.ordered_by(\"name\", Facility::SORT_ASCENDING).as_json(include_basic: \"yes\") #this should become a current_user based scope when that is all set up\n gon.sellers = Seller.for_country(employee_country)\n .ordered_by(\"name\", Seller::SORT_ASCENDING).as_json\n gon.members = MemberResource.find_by_ids(@vehicles.map(&:member_id)\n .compact.uniq).map {|m| {id: m.id, member_name: m.full_name}} if params[:state_as_string].present? && Vehicle.is_requesting_for_post_auction_stage?(params[:state_as_string])\n gon.showSellerFilter = gon.sellers.size > 1\n end",
"def fake_product\n loc = random_city\n res=Geokit::Geocoders::GoogleGeocoder.reverse_geocode( loc)\n product = {}\n product['_geoloc'] = {\n lat: loc[0],\n lng: loc[0],\n }\n product['Price'] = rand(100)\n product[\"LastName\"] = Faker::Name.last_name\n product[\"FirstName\"] = Faker::Name.first_name\n product[\"LensType\"] = Faker::Vehicle.manufacture\n product[\"Mount\"] = Faker::StarWars.vehicle\n product[\"Brand\"] = Faker::Vehicle.manufacture\n product[\"Category\"] = random_category\n product[\"ProductName\"] = Faker::StarWars.droid\n product['createdAt'] = Time.now.to_i\n product['views'] = rand(500)\n product['popularity'] = rand(500)\n product[\"image_url\"] = \"https://d1rzxhvrtciqq1.cloudfront.net/images/listing_images/images/58104/medium/44600d-67c54f-img_1938.jpg\"\n product['unavaliable'] = calendar\n return product\nend",
"def test_query()\n shape_ds = Gdal::Ogr.open( '../../ogr/data/testpoly.shp' )\n shape_lyr = shape_ds.get_layer(0)\n\n shape_lyr.set_spatial_filter_rect(-400, 22, -120, 400 )\n assert(check_features_against_list( shape_lyr, 'FID',\n [ 0, 4, 8 ] ))\n end",
"def update_areas\n if (canonical_address = address.try(:canonical_address))\n areas = canonical_address.areas\n elsif (zip = Postcode.search(postcode))\n areas = AreaZip.where(zip: zip.zip).map(&:area)\n if Settings.geography.area_lookup.use_open_north_api\n api = OpenNorthAPI.new\n area_codes = api.get_boundaries_for_lat_lng(zip.latitude, zip.longitude)\n area_codes.each do |area_type, code|\n areas << Area.find_by(area_type: area_type, code: code)\n end\n end\n if Settings.geography.area_lookup.use_canadian_province_lookup\n canadian_province_lookup = CanadianProvinceLookup.new\n if (code = canadian_province_lookup.get_province_for_postcode(zip.zip))\n areas << Area.find_by(area_type: 'canada_province', code: code)\n end\n end\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n mosaic = Mosaic::Mosaic.find_by(postcode: postcode.upcase.delete!(' '))\n end\n\n areas = (areas ||= []).uniq\n self.areas.clear\n self.areas << (areas || [])\n\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n if mosaic\n self.mosaic_group = mosaic.mosaic_group\n self.mosaic_code = mosaic.code\n save!\n end\n\n zip_source = zip || canonical_address\n if zip_source\n update_demographic_groups(zip_source.zip)\n end\n\n lat_lng_source = canonical_address || zip\n if lat_lng_source\n self.latitude = lat_lng_source.latitude\n self.longitude = lat_lng_source.longitude\n save!\n end\n end",
"def search_geocaches(accessToken, lat, lon, count)\n # TODO return an enumerator instead\n raise ArgumentError, \"search_geocaches must be called with a block\" if not block_given?\n\n found = 0\n tmp = _search_first(accessToken, lat, lon)\n found += tmp.size\n yield tmp\n while found < count\n tmp = _search_more(accessToken, found)\n break if tmp.size == 0\n found += tmp.size\n yield tmp\n end\n end",
"def filter_locations_hk(points)\n filter_locations(points, 15.845.within(0.07), 50.21.within(0.1))\nend",
"def contains?(geo_object)\n self.geo_object.contains?(geo_object)\n end",
"def geography_codes\n gh ||= geographical_hierarchies\n @geographies_data ||= if gh.respond_to?(:geographical_hierarchy) && gh.geographical_hierarchy\n url, args = gh.geographical_hierarchy.url\n OnsOpenApi::get(url, args)\n elsif gh.respond_to?(:geographical_hierarchies) && gh.geographical_hierarchies\n url, args = gh.geographical_hierarchies.first.url\n OnsOpenApi::get(url, args)\n end\n\n if @geographies_data\n list = @geographies_data.geographical_hierarchy_list\n if list.respond_to?(:geographical_hierarchy) && list.geographical_hierarchy\n [ [list.geographical_hierarchy.id, list.geographical_hierarchy.name] ]\n elsif list.respond_to?(:geographical_hierarchies) && list.geographical_hierarchies\n list.geographical_hierarchies.map{|x| [x.id, x.name]}\n else\n []\n end\n else\n []\n end\n end",
"def same_place\n\t\tStrike.where(lat: lat, lon:lon)\n\tend",
"def all_featured_cities\n cities_featured = self.all_galleries_featured_in.map{|gallery| gallery.city}\n end",
"def site_maps\n if current_user && current_user.admin?\n Map.all\n else\n Map.active\n end\n end",
"def countries_geo_entity_stats\n countries.present? ? GeoEntityStat.where(geo_entity_id: countries.map(&:id)) : geo_entity_stats\n end",
"def regions(for_select = true)\n fetch_array_for $regions, for_select\n end",
"def cities\n self.galleries.map{|painitng| painitng.city}\n end",
"def index\n areas = if current_user.moderator?\n ProductionArea.where.not(state: 0).eager_load(:map_layer)\n else\n current_user.production_areas.eager_load(:map_layer).with_translations(I18n.locale)\n end\n @cabinet_production_areas = areas\n end",
"def getInStoreOrgs\n UI.important(\"Getting organization active organizations from DB\")\n\n begin\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n items = dynamodb_full_scan(dynamodb,\n {\n table_name: \"Organizations\",\n projection_expression: \"id, #SE, #ST\",\n expression_attribute_names: {\n \"#SE\" => \"settings\",\n \"#ST\" => \"status\"\n },\n expression_attribute_values: {\n \":p\" => \"public\",\n \":s\" => true\n },\n filter_expression: \"#SE.in_stores = :s AND #SE.listing = :p\"\n })\n\n orgs = []\n UI.important(\"Organization to BUILD:\")\n items.each do |item|\n next unless (item[\"status\"][\"active\"] == true) && \\\n (item[\"id\"] != \"bfanteam\")\n\n orgs.push(item[\"id\"])\n UI.important(item[\"id\"])\n end\n\n return orgs\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return nil\n end\nend",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def geoObject()\n return @shape ;\n end",
"def get_coordinates\n if self.country_status == 'closed'\n self.latitude = nil\n self.longitude = nil\n else\n q = self.city || ''\n q += ','+self.state if self.state\n q += ','+self.country\n begin\n self.latitude, self.longitude = Geocoder.coordinates(q)\n # We need to make sure that that no 2 projects have exactly the same\n # coordinates. If they do, they will overlap on the flash map and\n # you won't be able to click on one of them.\n while SpProject.where(['latitude = ? and longitude = ?', self.latitude, self.longitude]).first\n delta_longitude, delta_latitude = 0,0\n delta_longitude = rand(6) - 3 while delta_longitude.abs < 2\n delta_latitude = rand(6) - 3 while delta_latitude.abs < 2\n # move it over a little.\n self.longitude += delta_longitude.to_f/10\n self.latitude += delta_latitude.to_f/10\n end\n rescue => e\n Airbrake.notify_or_ignore(e, :parameters => attributes)\n end\n end\n true\n end",
"def geopos(key, member, *members)\n\t\t\t\t\tcall(\"GEOPOS\", key, member, *members)\n\t\t\t\tend",
"def geography?\n type == \"GEOGRAPHY\"\n end",
"def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n validLocations = []\n\n validLocations = Location.where(\"latitude > ? AND latitude < ? AND longitude > ? AND longitude < ?\", swlat, nelat, swlng, nelng)\n validLocations = validLocations.sort_by { |k| k[\"latitude\"] }\n validLocations = validLocations[0..49]\n\n validLocations.each do|loc|\n @locations << loc.to_hash_with_follow(user_id)\n end\n\n end",
"def fill_from_gemo\r\n end",
"def to_geo\n GeoIngredient.new('County', name: name, state: state, buffer: 0)\n end",
"def map_locations # :nologin: :norobots:\n @query = find_or_create_query(:Location)\n if @query.flavor == :all\n @title = :map_locations_global_map.t\n else\n @title = :map_locations_title.t(:locations => @query.title)\n end\n @query = restrict_query_to_box(@query)\n @timer_start = Time.now\n columns = %w(name north south east west).map {|x| \"locations.#{x}\"}\n args = { :select => \"DISTINCT(locations.id), #{columns.join(', ')}\" }\n @locations = @query.select_rows(args).map do |id, name, n,s,e,w|\n MinimalMapLocation.new(id, name, n,s,e,w)\n end\n @num_results = @locations.count\n @timer_end = Time.now\n end"
] |
[
"0.6307753",
"0.58931917",
"0.5825621",
"0.5756756",
"0.57546854",
"0.5720181",
"0.5705993",
"0.5687131",
"0.5607812",
"0.5595643",
"0.5549623",
"0.5535058",
"0.5487573",
"0.5468664",
"0.5452024",
"0.5427229",
"0.5416999",
"0.53658175",
"0.5336284",
"0.53353095",
"0.5326164",
"0.5313315",
"0.53005594",
"0.52984256",
"0.5279863",
"0.5244052",
"0.5242113",
"0.5241495",
"0.52140594",
"0.52076936",
"0.52031684",
"0.5194608",
"0.5188061",
"0.51878035",
"0.5177466",
"0.5174573",
"0.51700246",
"0.5169596",
"0.51592505",
"0.51592505",
"0.5151902",
"0.51465017",
"0.513987",
"0.5115744",
"0.5101936",
"0.50941616",
"0.5090968",
"0.50896037",
"0.5087515",
"0.5065585",
"0.50533575",
"0.5052866",
"0.5050169",
"0.50475365",
"0.50357807",
"0.503487",
"0.5030617",
"0.50272924",
"0.5021164",
"0.50172955",
"0.5014964",
"0.5011356",
"0.5001212",
"0.499249",
"0.49910587",
"0.49908373",
"0.49876887",
"0.49718124",
"0.49716586",
"0.49662164",
"0.49506927",
"0.4950424",
"0.49480343",
"0.49468723",
"0.4946137",
"0.49335447",
"0.49317247",
"0.49269226",
"0.49265143",
"0.49261543",
"0.49217644",
"0.49210402",
"0.4919339",
"0.49132913",
"0.49100032",
"0.49063915",
"0.49004397",
"0.49003276",
"0.4897338",
"0.48956653",
"0.48937225",
"0.48833543",
"0.48776448",
"0.4864901",
"0.48631844",
"0.4859461",
"0.48561093",
"0.48537982",
"0.48513314",
"0.48467824",
"0.48461032"
] |
0.0
|
-1
|
GET /comics GET /comics.json
|
def index
#debugger
notNull = Comic.where("#{sort_column} IS NOT NULL").order(sort_column + " " + sort_direction)
nulled = Comic.where("#{sort_column} IS NULL").order(sort_column + " " + sort_direction)
@comics = notNull + nulled
print @comics
#@comics = Comic.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n if request.xhr?\n respond_to do |format|\n format.json { render :nothing => true }\n end\n end\n\n if params[:search]\n @comics = Comic.search(params[:search]).arrange\n elsif params[:annual]\n @comics = Comic.where(annual: true).arrange\n else\n @comics = Comic.where(annual: false).where(volume: params[\"volume\"]).arrange\n end\n\n @percentage_owned = @comics.where(owned: true).count.to_f/@comics.count.to_f*100\n\n # if request.xhr?\n # @comics = Comic.where(volume: params[\"volume\"]).arrange.limit(1)\n # render json: @comics\n # end\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n @page_title = @comic.title\n @og_type = \"image\"\n authorize! :read_unpublished , @comic if @comic.status != \"published\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @body_style = \"comics\"\n @comics = Comic.find(:all, :order => \"last_updated DESC\", :conditions => [\"live = 1 AND published_on <= ?\", Time.now])\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @comics.to_xml }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def index\n @user = current_user\n @category = params.has_key?(:category) ? params[:category] : \"newest-oldest\"\n @comics = Kaminari.paginate_array(Search.new.filter_comics_with_category(@user, @category)).page(params[:page]).per(10)\n end",
"def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end",
"def show\n @cocktail_history = CocktailHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @cars = Car.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cars }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end",
"def index\n @clubs = Club.all\n render json: @clubs\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def index\n @pages = @comic.pages\n \n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @comming_soon = CommingSoon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comming_soon }\n end\n end",
"def index\n\t\t@clubs = Club.all\n\t\trender json: @clubs\n\tend",
"def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end",
"def index\n @competitions = Competition.paginate(:page => params[:page], :per_page => 3)\n\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def show\n @cool = Cool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cool }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def index\n @clubs = Club.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clubs }\n end\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def index\n @cicts = Cict.all\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def index\n @comments = Comment.all\n render json: @comments\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @imgcomments = Imgcomment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imgcomments }\n end\n end",
"def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @pic_spaces = PicSpace.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_spaces }\n end\n end",
"def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end",
"def index\n chapters = @project.chapters.all\n render json: { chapters: chapters }\n end",
"def index\n render json: Picture.all\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end",
"def show\n @crime = Crime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crime }\n end\n end",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def show\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def index\n @cogs = Cog.all\n end",
"def index\n @clips = Clip.all\n respond_to do |format|\n format.json { render json: @clips.to_json(:include => [:sound_board_clip_sources, :image_playing, :image_default ]) }\n format.xml { render xml: @clips }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def show\n render json: @citation\n end"
] |
[
"0.7236975",
"0.7236975",
"0.6939306",
"0.6939306",
"0.68235606",
"0.66751975",
"0.64431655",
"0.6433644",
"0.6351882",
"0.63086104",
"0.62734175",
"0.62734175",
"0.6270068",
"0.62038803",
"0.6201327",
"0.61778396",
"0.61769277",
"0.61021703",
"0.6085176",
"0.6068778",
"0.6062355",
"0.60549045",
"0.60410637",
"0.60272926",
"0.6000316",
"0.5999278",
"0.59946066",
"0.5974072",
"0.59724224",
"0.59589547",
"0.59563583",
"0.5944916",
"0.5944916",
"0.5940804",
"0.593282",
"0.5928775",
"0.5928775",
"0.5911265",
"0.59111315",
"0.590685",
"0.59003043",
"0.58967274",
"0.5889111",
"0.5885936",
"0.58767897",
"0.5875982",
"0.5861694",
"0.5856901",
"0.58525336",
"0.58509976",
"0.58500487",
"0.5849787",
"0.5849787",
"0.58455426",
"0.584424",
"0.584345",
"0.5843263",
"0.58392066",
"0.5831049",
"0.58284205",
"0.5809103",
"0.5805838",
"0.5802104",
"0.5801895",
"0.57984775",
"0.57973266",
"0.5795731",
"0.57925737",
"0.57874537",
"0.5784654",
"0.5779948",
"0.57765406",
"0.5775904",
"0.5775221",
"0.57742846",
"0.57652706",
"0.57560486",
"0.5749158",
"0.5742701",
"0.5738057",
"0.5733227",
"0.5732898",
"0.572983",
"0.5723095",
"0.5719618",
"0.5713174",
"0.5711521",
"0.5708151",
"0.5703561",
"0.5703561",
"0.5703561",
"0.5703016",
"0.56999546",
"0.56999546",
"0.5698251",
"0.5692309",
"0.5689706",
"0.5687498",
"0.56817234",
"0.568126",
"0.5679631"
] |
0.0
|
-1
|
GET /comics/1 GET /comics/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def first\n @comic = Comic.order(\"created_at ASC\").first\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def index\n if request.xhr?\n respond_to do |format|\n format.json { render :nothing => true }\n end\n end\n\n if params[:search]\n @comics = Comic.search(params[:search]).arrange\n elsif params[:annual]\n @comics = Comic.where(annual: true).arrange\n else\n @comics = Comic.where(annual: false).where(volume: params[\"volume\"]).arrange\n end\n\n @percentage_owned = @comics.where(owned: true).count.to_f/@comics.count.to_f*100\n\n # if request.xhr?\n # @comics = Comic.where(volume: params[\"volume\"]).arrange.limit(1)\n # render json: @comics\n # end\n end",
"def show\n @comic = Comic.find(params[:id])\n @page_title = @comic.title\n @og_type = \"image\"\n authorize! :read_unpublished , @comic if @comic.status != \"published\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def show\n @cocktail_history = CocktailHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def index\n @body_style = \"comics\"\n @comics = Comic.find(:all, :order => \"last_updated DESC\", :conditions => [\"live = 1 AND published_on <= ?\", Time.now])\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @comics.to_xml }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def show\n @cool = Cool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cool }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def show\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end",
"def show\n @crime = Crime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crime }\n end\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n @pictures_of_cat = PicturesOfCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end",
"def show\n @comming_soon = CommingSoon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comming_soon }\n end\n end",
"def show\n @clip = Clip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clip }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end",
"def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def show\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def show\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @scribble }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def show\n @cover_cat = CoverCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cover_cat }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def index\n @cicts = Cict.all\n end",
"def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def set_comic\n @comic = Comic.find(params[:id])\n end",
"def show\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golf_cource }\n end\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end",
"def show\n @crowd = Crowd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crowd }\n end\n end",
"def show\n @icd_chapter = IcdChapterDecorator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @icd_chapter }\n end\n end",
"def index\n @clubs = Club.all\n render json: @clubs\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def index\n render json: Picture.all\n end",
"def show\n @caricullum = Caricullum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caricullum }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @benthic_cover = BenthicCover.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benthic_cover }\n end\n end",
"def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def show\n @baby_pic = BabyPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baby_pic }\n end\n end"
] |
[
"0.7378391",
"0.7378391",
"0.6780417",
"0.6573603",
"0.6573603",
"0.65449303",
"0.65449303",
"0.64161086",
"0.63522905",
"0.63431585",
"0.6235143",
"0.62133604",
"0.62133604",
"0.6204769",
"0.618791",
"0.6186452",
"0.61771953",
"0.61668",
"0.6146813",
"0.6114282",
"0.6106884",
"0.61019415",
"0.6100114",
"0.6100114",
"0.6075172",
"0.6059712",
"0.6059712",
"0.6058898",
"0.6053367",
"0.6049847",
"0.60438627",
"0.60367167",
"0.60049415",
"0.5997582",
"0.5985325",
"0.59757805",
"0.5964689",
"0.5963757",
"0.5961895",
"0.5945035",
"0.5941766",
"0.5935184",
"0.5922112",
"0.591112",
"0.5905761",
"0.5905761",
"0.5892406",
"0.5882853",
"0.5880594",
"0.5880568",
"0.58803266",
"0.5879606",
"0.58681554",
"0.5854501",
"0.5848044",
"0.5848044",
"0.58389074",
"0.58382046",
"0.5829335",
"0.58277607",
"0.5822096",
"0.5813847",
"0.5804494",
"0.5793176",
"0.5791668",
"0.5790836",
"0.57875466",
"0.5785239",
"0.57825583",
"0.5777804",
"0.5777212",
"0.5774782",
"0.5767333",
"0.57629603",
"0.57612926",
"0.5758568",
"0.57535213",
"0.57521904",
"0.574655",
"0.57456493",
"0.57430583",
"0.57348514",
"0.5731226",
"0.5725715",
"0.57198405",
"0.57164484",
"0.571596",
"0.57104075",
"0.5709404",
"0.5705048",
"0.5701753",
"0.5701577",
"0.5699378",
"0.5696021",
"0.5695034",
"0.5694359",
"0.5694359",
"0.569427",
"0.5692811",
"0.5684506",
"0.56827074"
] |
0.0
|
-1
|
POST /comics POST /comics.json
|
def create
#ok = true
@comic = Comic.new(comic_params)
#@comic.url = @comic.check_and_fix_url
#
#if Comic.pluck(:name).include? @comic.name
if comicExists?#(@comic)
CU_ExistingComic(@comic)
#format.html { redirect_to '/comics/new', alert: "Error: Comic \"#{@comic.name}\" Already Exists"}
#ok = false
else
createNonExistingComic(@comic)
end
#end
#return
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @comic = Comic.new(comic_params)\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to root_path, notice: 'Comic was successfully created.' }\n format.json { redirect_to root_path, status: :created }\n else\n format.html { render :new }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.new(params[:comic])\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to @comic, notice: 'Comic was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.create(params[:comic_page])\n\n\n respond_to do |format|\n if @comic_page.save\n format.html { redirect_to @comic, notice: 'Comic page was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def create\n @book = Comic.new\n @comic = @user.comics.new(comic_params)\n @image = Image.new(image_params)\n @comic.image = @image\n if @comic.save\n redirect_to user_comics_path(@user)\n else\n render :new\n end\n end",
"def create\n authorize! :create , Comic\n @comic = Comic.new(comic_params)\n @comic.user_id = current_user.id\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to @comic, notice: 'Comic was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.new(comic_params)\n\n respond_to do |format|\n if @comic.save\n format.html { redirect_to comics_path({volume: @comic.volume}), notice: 'Comic was successfully created.' }\n format.json { render :show, status: :created, location: @comic }\n else\n @new_comic_form = 'true'\n format.html { render :new }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def comic_params\n params.require(:comic).permit(:title, :description, :rate, :adult, :published_at, :cover, :status)\n end",
"def create\n @comic = Comic.new(params[:comic])\n @comic.view_count = 0\n \n respond_to do |format|\n if @comic.save\n session[:comic_id] = @comic.id\n flash[:notice] = 'Comic was successfully created.'\n format.html { redirect_to new_page_path(:comic_id => @comic.alias) }\n format.xml { head :created, :location => comic_url(@comic) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comic.errors.to_xml }\n end\n end\n end",
"def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @critic = Critic.new(params[:critic])\n\n respond_to do |format|\n if @critic.save\n format.html { redirect_to @critic, notice: 'Critic was successfully created.' }\n format.json { render json: @critic, status: :created, location: @critic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @critic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comic_params\n params.require(:comic).permit(:title, :subtitle, :published_at, :author_id)\n end",
"def create\n page = Page.find(params[:page])\n @comment = page.comments.new(params[:comment])\n page.comic.comments << @comment\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to comic_path(:id => @comic.alias, :page => page.locate) }\n format.xml { head :created, :location => comment_url(@comment) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors.to_xml }\n end\n end\n end",
"def create\n @pic = Pic.new(params[:pic])\n\n respond_to do |format|\n if @pic.save\n format.html { redirect_to @pic, notice: 'Pic was successfully created.' }\n format.json { render json: @pic, status: :created, location: @pic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cog = Cog.new(cog_params)\n\n respond_to do |format|\n if @cog.save\n format.html { redirect_to @cog, notice: 'Cog was successfully created.' }\n format.json { render :show, status: :created, location: @cog }\n else\n format.html { render :new }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cool = Cool.new(params[:cool])\n\n respond_to do |format|\n if @cool.save\n format.html { redirect_to @cool, notice: 'Cool was successfully created.' }\n format.json { render json: @cool, status: :created, location: @cool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coat = Coat.new(coat_params)\n\n respond_to do |format|\n if @coat.save\n format.html { redirect_to @coat, notice: 'Coat was successfully created.' }\n format.json { render :show, status: :created, location: @coat }\n else\n format.html { render :new }\n format.json { render json: @coat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commision = Commision.new(commision_params)\n\n respond_to do |format|\n if @commision.save\n format.html { redirect_to commisions_path, notice: 'Commision was successfully created.' }\n format.json { render :show, status: :created, location: @commision }\n else\n format.html { render :new }\n format.json { render json: @commision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chemical = Chemical.new(chemical_params)\n if @chemical.save!\n render json: @chemical\n else\n render json: {errors: @chemical.errors.full_messages}\n end\n end",
"def comic_params\n params.require(:comic).permit(:name, :author, :url, :synopsis, :genre, :rating_art, :rating_story, :rating_overall, :update_schedule, :page_layout)\n end",
"def create\n @competicao = Competicao.new(params[:competicao])\n\n respond_to do |format|\n if @competicao.save\n format.html { redirect_to @competicao, notice: 'Competicao was successfully created.' }\n format.json { render json: @competicao, status: :created, location: @competicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def create\n @competent = Competent.new(params[:competent])\n\n respond_to do |format|\n if @competent.save\n format.html { redirect_to @competent, notice: 'Competent was successfully created.' }\n format.json { render json: @competent, status: :created, location: @competent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chronic = Chronic.new(chronic_params)\n\n respond_to do |format|\n if @chronic.save\n format.html { redirect_to @chronic, notice: 'Chronic was successfully created.' }\n format.json { render :show, status: :created, location: @chronic }\n else\n format.html { render :new }\n format.json { render json: @chronic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comic_params\n params.require(:comic).permit(:title, :release_date, :horizontal_image, :vertical_image)\n end",
"def create\n @clue = Clue.new(params[:clue])\n\n respond_to do |format|\n if @clue.save\n format.html { redirect_to @clue, notice: 'Clue was successfully created.' }\n format.json { render json: @clue, status: :created, location: @clue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clue = Clue.new(params[:clue])\n\n respond_to do |format|\n if @clue.save\n format.html { redirect_to @clue, notice: 'Clue was successfully created.' }\n format.json { render json: @clue, status: :created, location: @clue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @chocolate = Chocolate.new(chocolate_params)\n\n respond_to do |format|\n if @chocolate.save\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully created.\" }\n format.json { render :show, status: :created, location: @chocolate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @car = Car.new(car_params)\n\n if @car.save\n render json: @car, status: :created, location: @car\n else\n render json: @car.errors, status: :bad_request\n end\n end",
"def create\n @grocery = Grocery.new(grocery_params)\n\n if @grocery.save\n render json: @grocery, status: :created, location: @grocery\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pic = Pic.new(pic_params)\n\n respond_to do |format|\n if @pic.save\n format.html { redirect_to @pic, notice: 'Pic was successfully created.' }\n format.json { render :show, status: :created, location: @pic }\n else\n format.html { render :new }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @carpool = Carpool.new(params[:carpool])\n\n respond_to do |format|\n if @carpool.save\n format.html { redirect_to @carpool, notice: 'Carpool was successfully created.' }\n format.json { render json: @carpool, status: :created, location: @carpool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @club = Club.new(params[:club])\n\n if @club.save\n render json: @club, status: :created, location: @club\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def create\n @comment = @noticia.comments.create(comment_params)\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cow = Cow.new(cow_params)\n\n respond_to do |format|\n if @cow.save\n format.html { redirect_to @cow, notice: 'Cow was successfully created.' }\n format.json { render :show, status: :created, location: @cow }\n else\n format.html { render :new }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competition = Competition.new(params[:competition])\n\n respond_to do |format|\n if @competition.save\n format.html { redirect_to @competition, notice: 'Competition was successfully created.' }\n format.json { render json: @competition, status: :created, location: @competition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @comic = Comic.new\n authorize! :create , Comic\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testimonial = Testimonial.new(params[:testimonial])\n\n respond_to do |format|\n if @testimonial.save\n format.html { redirect_to testimonials_url, notice: 'Testimonial was successfully posted.' }\n format.json { render json: @testimonial, status: :created, location: @testimonial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ciclo = Ciclo.new(ciclo_params)\n\n respond_to do |format|\n if @ciclo.save\n format.html { redirect_to @ciclo, notice: 'Ciclo was successfully created.' }\n format.json { render :show, status: :created, location: @ciclo }\n else\n format.html { render :new }\n format.json { render json: @ciclo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cow = Cow.new(cow_params)\n\n respond_to do |format|\n if @cow.save\n format.html { redirect_to @cow, notice: 'Cow was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cow }\n else\n format.html { render action: 'new' }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apologetic = Apologetic.new(apologetic_params)\n\n respond_to do |format|\n if @apologetic.save\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @apologetic }\n else\n format.html { render action: 'new' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cocktail = Cocktail.new(params[:cocktail])\n\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully created.' }\n format.json { render json: @cocktail, status: :created, location: @cocktail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @carrito = Carrito.new(carrito_params)\n \n respond_to do |format|\n if @carrito.save\n format.html { redirect_to @carrito, notice: 'Carrito was successfully created.' }\n format.json { render :show, status: :created, location: @carrito }\n else\n format.html { render :new }\n format.json { render json: @carrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @craque = Craque.new(params[:craque])\n\n respond_to do |format|\n if @craque.save\n format.html { redirect_to @craque, notice: 'Craque was successfully created.' }\n format.json { render json: @craque, status: :created, location: @craque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @craque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @circular = Circular.new(circular_params)\n\n respond_to do |format|\n if @circular.save\n format.html { redirect_to @circular, notice: 'Circular was successfully created.' }\n format.json { render :show, status: :created, location: @circular }\n else\n format.html { render :new }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comic = Comic.find(params[:comic_id])\n @review = current_user.reviews.new(review_params)\n @review.tag_list = params[:tag_list]\n @review.comic_id = @comic.id\n p @review\n p review_params\n respond_to do |format|\n if @review.save\n format.html { redirect_to comic_path(@comic), notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clocher = Clocher.new(clocher_params)\n\n respond_to do |format|\n if @clocher.save\n format.html { redirect_to @clocher, notice: 'Clocher was successfully created.' }\n format.json { render :show, status: :created, location: @clocher }\n else\n format.html { render :new }\n format.json { render json: @clocher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n cartoon_ad = CartoonAd.create(cartoon_ad_params)\n render json: cartoon_ad\n end",
"def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end",
"def create\n @chamado = Chamado.new(params[:chamado])\n\n respond_to do |format|\n if @chamado.save\n #fmt = '/chamados/%s.json'\n #response = fmt % [@chamado.id]\n format.html { redirect_to @chamado, notice: 'Chamado was successfully created.' }\n format.html { render json: @chamado, status: :created, location: @chamado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chamado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def create_creditcard\n \n @creditcard = Creditcards.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creditcard }\n end\n end",
"def create\n @comment = Comment.new(params[:comment]) #has a hash called comment, passes initial values\n\n respond_to do |format|\n if @comment.save # Goes in here and saves it to the DB\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # coffee = Coffee.new\n # coffee.name = params[:name]\n # coffee.company = params[:company]\n # coffee.whole_bean = params[:whole_bean]\n\n # coffee = Coffee.new(name: params[:name]...)\n # coffee = Coffee.create(name: params[:name], company: params[:company], whole_bean: params[:whole_bean])\n # coffee = Coffee.new(name: params[:name], company: params[:company], whole_bean: params[:whole_bean])\n coffee = Coffee.new(coffee_params)\n if coffee.save\n render json: coffee, status: :created\n else\n render json: { message: \"invalid form\" }, status: :bad_request\n end\n end",
"def create\n @competition = Competition.new(competition_params)\n\n respond_to do |format|\n if @competition.save\n format.html { redirect_to @competition, notice: 'Competition was successfully created.' }\n format.json { render :show, status: :created, location: @competition }\n else\n format.html { render :new }\n format.json { render json: @competition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params.present?\n Comment.create(name: params[:author], description: params[:text], rating: params[:rating])\n end\n render json: {success: \"Sucessfully Commented\"}\n end",
"def create\n @stripe = Stripe.new\n @stripe.comic = @comic\n set_image\n if @stripe.save(stripe_params.except(:image))\n render json: (render_to_string(partial: 'stripe', locals: { stripe: @stripe })), status: :created\n else\n render json: {:errors => @stripe.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def create\n @recur = Recur.new(recur_params)\n\n respond_to do |format|\n if @recur.save\n format.html { redirect_to @recur, notice: 'Recur was successfully created.' }\n format.json { render :show, status: :created, location: @recur }\n else\n format.html { render :new }\n format.json { render json: @recur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end",
"def create\n params[:competition] ||= {}\n params[:competition][\"owner_id\"] = current_user.id\n @competition = Competition.new(competition_params)\n\n respond_to do |format|\n if @competition.save\n format.html { redirect_to competitions_path, notice: 'Competition was successfully created.' }\n format.json { render :show, status: :created, location: @competition }\n else\n format.html { render :new }\n format.json { render json: @competition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @disponible = Disponible.new(disponible_params)\n\n if @disponible.save\n render json: @disponible, status: :created, location: @disponible\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end",
"def comicbook_params\n params.require(:comicbook).permit(:title, :image_url, :publisher, :artist, :writer)\n end",
"def create\n @exercice = Exercice.new(params[:exercice])\n\n respond_to do |format|\n if @exercice.save\n format.html { redirect_to @exercice, notice: 'Exercice was successfully created.' }\n format.json { render json: @exercice, status: :created, location: @exercice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @conductor = Conductor.new(params[:conductor])\n\n respond_to do |format|\n if @conductor.save\n format.html { redirect_to @conductor, notice: 'Conductor was successfully created.' }\n format.json { render json: @conductor, status: :created, location: @conductor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conductor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def create\n @hero = Hero.new(hero_params)\n\n if @hero.save\n render json: @hero, status: :created, location: @hero\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def create\n @comite = Comite.new(comite_params)\n\n respond_to do |format|\n if @comite.save\n format.html { redirect_to @comite, notice: 'Comite was successfully created.' }\n format.json { render :show, status: :created, location: @comite }\n else\n format.html { render :new }\n format.json { render json: @comite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @combustible = Combustible.new(combustible_params)\n\n respond_to do |format|\n if @combustible.save\n format.html { redirect_to combustibles_url, notice: 'Combustible Se creó correctamente.' }\n format.json { render :index, status: :created, location: @combustible }\n else\n format.html { render :new }\n format.json { render json: @combustible.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @figure = Figure.new(figure_params)\n @figure.comic_id = params[:comic_id]\n @figure.z_index = objects_quantity(@figure.comic) + 1\n\n p @figure\n\n respond_to do |format|\n if @figure.save\n @comic = @figure.comic\n # format.html { redirect_to @comic, notice: 'Figure was successfully created.' }\n # format.json { render :show, status: :created, location: @figure }\n format.json { render json: {figure_id: @figure.id}, status: :ok }\n else\n # format.html { render :new }\n # format.json { render json: @figure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n @socio.save\n format.html { redirect_to socios_url}\n end\n end",
"def create\n @carro = Carro.new(carro_params)\n\n respond_to do |format|\n if @carro.save\n format.html { redirect_to @carro, notice: 'Carro was successfully created.' }\n format.json { render :show, status: :created, location: @carro }\n else\n format.html { render :new }\n format.json { render json: @carro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(socio_params)\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, notice: 'Socio criado com sucesso.' }\n format.json { render :show, status: :created, location: @socio }\n else\n format.html { render :new }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n format.html { redirect_to @car, notice: 'Car was successfully added.' }\n format.json { render :show, status: :created, location: @car }\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidato = Candidato.new(params[:candidato])\n\n respond_to do |format|\n if @candidato.save\n format.html { redirect_to @candidato, notice: 'Candidato was successfully created.' }\n format.json { render json: @candidato, status: :created, location: @candidato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comming_soon = CommingSoon.new(params[:comming_soon])\n\n respond_to do |format|\n if @comming_soon.save\n format.html { redirect_to @comming_soon, notice: 'Comming soon was successfully created.' }\n format.json { render json: @comming_soon, status: :created, location: @comming_soon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comming_soon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_cashiero = ImageCashiero.new(image_cashiero_params)\n\n respond_to do |format|\n if @image_cashiero.save\n format.html { redirect_to @image_cashiero, notice: 'Image cashiero was successfully created.' }\n format.json { render :show, status: :created, location: @image_cashiero }\n else\n format.html { render :new }\n format.json { render json: @image_cashiero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def create\n @car = Car.new(params[:car])\n\n respond_to do |format|\n if @car.save\n format.html { redirect_to @car, notice: 'Car was successfully created.' }\n format.json { render json: @car, status: :created, location: @car }\n else\n format.html { render action: \"new\" }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testimonial = Testimonial.new(testimonial_params)\n respond_to do |format|\n if @testimonial.save\n format.html { redirect_to @testimonial, notice: 'Testimonial was successfully created.' }\n format.json { render json: @testimonial, status: :created, location: @testimonial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contato = Contato.new(contato_params)\n\n respond_to do |format|\n if @contato.save\n format.html { redirect_to @contato, flash: { success: 'Contato was successfully created.' } }\n format.json { render :show, status: :created, location: @contato }\n else\n format.html { render :new }\n format.json { render json: @contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crowd = Crowd.new(params[:crowd])\n\n respond_to do |format|\n if @crowd.save\n format.html { redirect_to @crowd, notice: 'Crowd was successfully created.' }\n format.json { render json: @crowd, status: :created, location: @crowd }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crowd.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6854384",
"0.6840256",
"0.6473725",
"0.61243963",
"0.61214525",
"0.60706306",
"0.5967187",
"0.5889738",
"0.5839897",
"0.5839897",
"0.58372587",
"0.5784615",
"0.5749311",
"0.57228714",
"0.5711935",
"0.5707214",
"0.56768405",
"0.5671031",
"0.56709206",
"0.56571716",
"0.56376123",
"0.5633028",
"0.56300247",
"0.5612634",
"0.5611893",
"0.56023145",
"0.5601491",
"0.5590149",
"0.5589614",
"0.5589614",
"0.5585552",
"0.5579515",
"0.55764",
"0.5571787",
"0.5564507",
"0.55570847",
"0.5538789",
"0.55373377",
"0.5527878",
"0.5518089",
"0.5513464",
"0.55091566",
"0.55041045",
"0.5498807",
"0.5492502",
"0.5490711",
"0.5486655",
"0.54769456",
"0.5466063",
"0.5466063",
"0.5466063",
"0.5464691",
"0.54594123",
"0.54528177",
"0.5450149",
"0.5446562",
"0.54311335",
"0.54299223",
"0.5429754",
"0.5428623",
"0.5407083",
"0.54043514",
"0.54026616",
"0.5392543",
"0.5381148",
"0.5379429",
"0.5378938",
"0.53775585",
"0.5376144",
"0.5373837",
"0.5373216",
"0.53634036",
"0.53613317",
"0.53558314",
"0.53542584",
"0.53501457",
"0.5349328",
"0.5346842",
"0.5346842",
"0.5345397",
"0.5341227",
"0.5340263",
"0.5339427",
"0.5334785",
"0.5332894",
"0.5332264",
"0.5331155",
"0.53273326",
"0.5320578",
"0.53198266",
"0.53178656",
"0.5316175",
"0.53098136",
"0.53094804",
"0.5306331",
"0.53041893",
"0.53010225",
"0.5296758",
"0.5296656",
"0.5292707"
] |
0.6116212
|
5
|
PATCH/PUT /comics/1 PATCH/PUT /comics/1.json
|
def update
#@comic.url = @comic.check_and_fix_url
if comicExists? #@comic
CU_ExistingComic(@comic)
else
updateNonExistingComic(@comic)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n if @comic.update_attributes(params[:comic])\n format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comic.update(comic_params)\n format.html { redirect_to comic_path(@comic), notice: 'Comic was successfully updated.' }\n format.json { render json: @comic }\n else\n format.html { render :edit }\n format.json { render json: @comic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cool = Cool.find(params[:id])\n\n respond_to do |format|\n if @cool.update_attributes(params[:cool])\n format.html { redirect_to @cool, notice: 'Cool was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comic.update(comic_params)\n format.html { redirect_to root_path, notice: 'Comic was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n if @comic.update_attributes(params[:comic])\n flash[:notice] = 'Comic was successfully updated.'\n format.html { redirect_to home_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comic.errors.to_xml }\n end\n end\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n if @pic.update_attributes(params[:pic])\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coat.update(coat_params)\n format.html { redirect_to @coat, notice: 'Coat was successfully updated.' }\n format.json { render :show, status: :ok, location: @coat }\n else\n format.html { render :edit }\n format.json { render json: @coat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catched.update(catched_params)\n format.html { redirect_to @catched, notice: 'Catched was successfully updated.' }\n format.json { render :show, status: :ok, location: @catched }\n else\n format.html { render :edit }\n format.json { render json: @catched.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @grocery = Grocery.find(params[:id])\n\n if @grocery.update(grocery_params)\n head :no_content\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @coffee1.update(coffee1_params)\n format.html { redirect_to @coffee1, notice: 'Coffee1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffee1 }\n else\n format.html { render :edit }\n format.json { render json: @coffee1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couch was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chocolate.update(chocolate_params)\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @chocolate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pic.update(pic_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comic.update_comic_cover_picture update_image_params[\"photo\"] unless update_image_params.nil?\n if @comic.errors.empty? && @comic.update_attributes(update_comic_params)\n redirect_to user_comics_path(@user)\n else\n render :edit\n end\n end",
"def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end",
"def update\n respond_to do |format|\n if @sick.update(sick_params)\n format.html { redirect_to @sick, notice: 'Sick was successfully updated.' }\n format.json { render :show, status: :ok, location: @sick }\n else\n format.html { render :edit }\n format.json { render json: @sick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n if @carpool.update_attributes(params[:carpool])\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cow.update(cow_params)\n format.html { redirect_to @cow, notice: 'Cow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coffeeshop.update(coffeeshop_params)\n format.html { redirect_to @coffeeshop, notice: 'Coffeeshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffeeshop }\n else\n format.html { render :edit }\n format.json { render json: @coffeeshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n put :update\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n if @comic_page.update_attributes(params[:comic_page])\n format.html { redirect_to @comic_page, notice: 'Comic page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clip = Clip.find(params[:id])\n\n respond_to do |format|\n if @clip.update_attributes(params[:clip])\n format.html { redirect_to @clip, notice: 'Clip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n if @critic.update_attributes(params[:critic])\n format.html { redirect_to @critic, notice: 'Critic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # TODO: Add cron_str updating\n respond_to do |format|\n if @chore.update_attributes(params[:chore])\n format.html { redirect_to @chore, notice: 'Chore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concern = Concern.find(params[:id])\n\n respond_to do |format|\n if @concern.update_attributes(params[:concern])\n format.html { redirect_to @concern, notice: 'Concern was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concern.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n if @clonet.update_attributes(params[:clonet])\n format.html { redirect_to @clonet, notice: 'Clonet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clonet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n if @conductor.update_attributes(params[:conductor])\n format.html { redirect_to @conductor, notice: 'Conductor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conductor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chronic.update(chronic_params)\n format.html { redirect_to @chronic, notice: 'Chronic was successfully updated.' }\n format.json { render :show, status: :ok, location: @chronic }\n else\n format.html { render :edit }\n format.json { render json: @chronic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cog.update(cog_params)\n format.html { redirect_to @cog, notice: 'Cog was successfully updated.' }\n format.json { render :show, status: :ok, location: @cog }\n else\n format.html { render :edit }\n format.json { render json: @cog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n if @competicao.update_attributes(params[:competicao])\n format.html { redirect_to @competicao, notice: 'Competicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coolstuff.update(coolstuff_params)\n format.html { redirect_to @coolstuff, notice: 'Coolstuff was successfully updated.' }\n format.json { render :show, status: :ok, location: @coolstuff }\n else\n format.html { render :edit }\n format.json { render json: @coolstuff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n if @competent.update_attributes(params[:competent])\n format.html { redirect_to @competent, notice: 'Competent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n if @commtent1.update_attributes(params[:commtent1])\n format.html { redirect_to @commtent1, notice: 'Commtent1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commtent1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foo = Foo.find(params[:id])\n\n respond_to do |format|\n if @foo.update_attributes(params[:foo])\n format.html { redirect_to @foo, notice: 'Foo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candy.update(candy_params)\n format.html { redirect_to @candy, notice: 'Candy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @candy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n if @cheer.update_attributes(params[:cheer])\n format.html { redirect_to @cheer, notice: 'Cheer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cow.update(cow_params)\n format.html { redirect_to @cow, notice: 'Cow was successfully updated.' }\n format.json { render :show, status: :ok, location: @cow }\n else\n format.html { render :edit }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testimonial = Testimonial.find(params[:id])\n\n respond_to do |format|\n if @testimonial.update_attributes(params[:testimonial])\n format.html { redirect_to testimonials_url, notice: 'Testimonial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @composer = Composer.find(params[:id])\n\n respond_to do |format|\n if @composer.update_attributes(params[:composer])\n format.html { redirect_to @composer, notice: 'Composer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @composer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @crime = Crime.find(params[:id])\n\n respond_to do |format|\n if @crime.update_attributes(params[:crime])\n format.html { redirect_to @crime, notice: 'Crime was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @candy = Candy.find(params[:id])\n\n respond_to do |format|\n if @candy.update_attributes(params[:candy])\n format.html { redirect_to @candy, :notice => 'Candy was successfully updated.' }\n format.json { render :json => @candy, :status => :updated, :candy => @candy }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @candy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n respond_to do |format|\n if @coyote.update(coyote_params)\n format.html { redirect_to @coyote, notice: 'Coyote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coyote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n if @recipy.update_attributes(params[:recipy])\n format.html { redirect_to @recipy, notice: 'Recipy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipy.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.668917",
"0.6463799",
"0.63469845",
"0.6231888",
"0.6213887",
"0.61955446",
"0.6161654",
"0.61585414",
"0.61549085",
"0.61464256",
"0.61313397",
"0.61264193",
"0.6097296",
"0.60876584",
"0.6035381",
"0.60324466",
"0.6027002",
"0.6010319",
"0.6002323",
"0.60018146",
"0.5996517",
"0.5991401",
"0.59882593",
"0.59879154",
"0.59864366",
"0.5970822",
"0.5967092",
"0.5967092",
"0.59607875",
"0.5947503",
"0.59437937",
"0.5932445",
"0.59280723",
"0.59280723",
"0.59280723",
"0.590763",
"0.5904327",
"0.59036314",
"0.5892984",
"0.58911496",
"0.58897066",
"0.5887019",
"0.58769226",
"0.5875096",
"0.5873646",
"0.5868089",
"0.586635",
"0.58559406",
"0.5845537",
"0.58442074",
"0.5842133",
"0.5841543",
"0.5828782",
"0.58283556",
"0.58257675",
"0.5824505",
"0.5824371",
"0.58240765",
"0.5820669",
"0.5816131",
"0.581584",
"0.5813469",
"0.5811342",
"0.58087015",
"0.58065534",
"0.57948774",
"0.5794164",
"0.57918733",
"0.57906955",
"0.57828313",
"0.57825446",
"0.5781461",
"0.5770157",
"0.5761535",
"0.57577264",
"0.57503164",
"0.5747634",
"0.57474875",
"0.57458436",
"0.57424",
"0.5740517",
"0.5739127",
"0.57374024",
"0.5732768",
"0.57311624",
"0.57279086",
"0.57276356",
"0.57227105",
"0.5719543",
"0.5718913",
"0.57096255",
"0.5708845",
"0.57068413",
"0.57066727",
"0.57036054",
"0.57034844",
"0.5702481",
"0.5700651",
"0.5695786",
"0.56927615",
"0.5691929"
] |
0.0
|
-1
|
I left this in here just in case, but it shouldn't be called. DELETE /comics/1 DELETE /comics/1.json
|
def destroy
@comic.destroy
respond_to do |format|
format.html { redirect_to '/', notice: "Comic \"#{@comic.name}\" was successfully deleted." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to comics_url, notice: 'Comic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cool = Cool.find(params[:id])\n @cool.destroy\n\n respond_to do |format|\n format.html { redirect_to cools_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @pic = Pic.find(params[:id])\n @pic.destroy\n\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_path({volume: @comic.volume, annual: @comic.annual}), notice: 'Comic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic_page = ComicPage.find(params[:id])\n @comic_page.destroy\n\n respond_to do |format|\n format.html { redirect_to comic_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lyric.destroy\n respond_to do |format|\n format.html { redirect_to lyrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronicle = Chronicle.find(params[:id])\n @chronicle.destroy\n\n respond_to do |format|\n format.html { redirect_to library_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duck.destroy\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n deck = Deck.find_by :id => params[:deck_id]\n @current_user = User.find_by :id => session[:user_id]\n if @current_user.id != deck.user_id\n return\n end\n\n deck.comics.delete(comic)\n deck.num_comics = deck.comics.count\n deck.save\n respond_with deck\n end",
"def destroy\n @duck.destroy\n\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cateroty.destroy\n respond_to do |format|\n format.html { redirect_to cateroties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo = Foo.find(params[:id])\n @foo.destroy\n\n respond_to do |format|\n format.html { redirect_to foos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @candy.destroy\n respond_to do |format|\n format.html { redirect_to candies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @convo = Convo.find(params[:id])\n @convo.destroy\n\n respond_to do |format|\n format.html { redirect_to convos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coat.destroy\n respond_to do |format|\n format.html { redirect_to coats_url, notice: 'Coat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail_history = CocktailHistory.find(params[:id])\n @cocktail_history.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktail_histories_url }\n format.json { head :no_content }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.html { redirect_to cursos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url, notice: 'Pic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @circular.destroy\n respond_to do |format|\n format.html { redirect_to circulars_url, notice: 'Circular was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clip = Clip.find(params[:id])\n @clip.destroy\n\n respond_to do |format|\n format.html { redirect_to clips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @client = Client.find(params[:id])\r\n @client.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to clients_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @grocery = Grocery.find(params[:id])\n @grocery.destroy\n\n head :no_content\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competent = Competent.find(params[:id])\n @competent.destroy\n\n respond_to do |format|\n format.html { redirect_to competents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @draft_pic.destroy\n respond_to do |format|\n format.html { redirect_to draft_pics_url, notice: 'Draft pic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to cows_url, notice: 'Cow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_pic.destroy\n respond_to do |format|\n format.html { redirect_to post_pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cog.destroy\n respond_to do |format|\n format.html { redirect_to cogs_url, notice: 'Cog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @caricullum = Caricullum.find(params[:id])\n @caricullum.destroy\n\n respond_to do |format|\n format.html { redirect_to caricullums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @album_owned = AlbumOwned.find(params[:id])\n @album_owned.destroy\n\n respond_to do |format|\n format.html { redirect_to album_owneds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clitem.destroy\n respond_to do |format|\n format.html { redirect_to clitems_url }\n format.json { head :no_content }\n\n end\n end"
] |
[
"0.73250973",
"0.7099454",
"0.67854434",
"0.6762957",
"0.6698964",
"0.668944",
"0.66808695",
"0.6679415",
"0.6630194",
"0.6586703",
"0.6567807",
"0.65508217",
"0.65375453",
"0.65301454",
"0.6514614",
"0.6507122",
"0.65011066",
"0.6487368",
"0.64795387",
"0.64296573",
"0.6427998",
"0.64154625",
"0.64033246",
"0.6401745",
"0.6386605",
"0.638634",
"0.63595533",
"0.6359115",
"0.6355049",
"0.63535357",
"0.63467413",
"0.63460684",
"0.63460684",
"0.6333168",
"0.6332056",
"0.63282263",
"0.6326854",
"0.6322733",
"0.6320341",
"0.6317937",
"0.631464",
"0.63087296",
"0.6300292",
"0.6300033",
"0.6299262",
"0.6292207",
"0.6287265",
"0.62780243",
"0.6276957",
"0.62721694",
"0.62708247",
"0.6270173",
"0.626969",
"0.6264174",
"0.625486",
"0.625486",
"0.625486",
"0.625486",
"0.6254074",
"0.6253625",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6253533",
"0.6252396",
"0.62492615",
"0.62476903",
"0.624364",
"0.62432057",
"0.62420833",
"0.62407565",
"0.6240339",
"0.62394476",
"0.6239313",
"0.6238922",
"0.6238587",
"0.62385386",
"0.62349385",
"0.6233758",
"0.62328756",
"0.6230636",
"0.6227499",
"0.62267554",
"0.62267554",
"0.6225142",
"0.62231153",
"0.62229776",
"0.6221677",
"0.62174827",
"0.621554",
"0.6215532",
"0.62148666",
"0.6214813",
"0.6214298",
"0.6212534"
] |
0.6795894
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_comic
@comic = Comic.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def comic_params
params.require(:comic).permit(:name, :author, :url, :synopsis, :genre, :rating_art, :rating_story, :rating_overall, :update_schedule, :page_layout)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Initialize with _name_ and _options_.
|
def initialize(name = nil, options = {})
super
options.each { |k,v| send :"#{k}=", v }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize name, *options\n @name = name\n @options = options\n end",
"def initialize(options = {})\n require_options(options, [:name])\n @name = options[:name]\n end",
"def initialize(name)\n @name = name\n @options = Hash.new\n end",
"def initialize name, options = {}\n super\n end",
"def initialize(name, options = {})\n @name = name\n @options = options\n @label = options[:label]\n @default_val = options[:default]\n @type = options[:type]\n end",
"def initialize( options, name )\n\t\t\t@name = name.gsub(/[\\r\\n]/, '')\n\t\t\t@created = DateTime.now()\n\t\t\t@updated = DateTime.now()\n\t\t\t@created_by = Etc.getlogin()\n\t\t\t@description = \"\"\n\t\t\t@vote = 1\n\t\t\t@tags = []\n\t\t\t@severity = options.severity[0]\n\t\t\t@modules = []\n\t\t\t@status = options.status[0]\n\t\tend",
"def initialize(options={})\n @name = nil\n @description = nil\n configure(options)\n end",
"def initialize(type, name, options={})\n @type, @name, @options = type, name, options.to_options\n end",
"def initialize( options={} )\n end",
"def initialize(cls, name, options)\n @cls = cls\n @name = name\n @options = options.dup\n end",
"def initialize(name, options)\n @name = name\n @options = options\n @pluralize = options[:pluralize]\n @prefix = options[:prefix]\n @suffix = options[:suffix]\n end",
"def initialize(name, options={}, result=nil)\n @name = name\n @options = options\n @result = result\n\n @options = default_options.merge(@options) if self.respond_to? :default_options\n end",
"def initialize(_options = {}); end",
"def initialize(options); end",
"def initialize(options={})\n puts \"initiliaze entry\"\n @options = OPTIONS.merge(options) \n end",
"def initialize(_name, options = EMPTY_HASH)\n super\n @type = options.fetch(:type) { raise(MissingTypeOptionError) }\n @aliases = options.fetch(:aliases, {})\n @mapper = options[:mapper]\n end",
"def initialize(name, options = {})\n @name = name\n @default = options[:default]\n @type = options[:type] || String\n end",
"def initialize(_options = {})\n end",
"def initialize\n @options = {}\n end",
"def initialize\n @options = {}\n end",
"def initialize\n @options = {}\n end",
"def initialize(options); @options = options end",
"def initialize options={}\n self.options = options\n end",
"def initialize(options)\n @superspace = options.superspace\n @name = options.name\n @version = options.version\n @summary = options.summary\n @actions = options.actions\n @options = options.options\n @examples = options.examples\n end",
"def initialize(options = {})\n @options = OPTIONS.merge(options)\n end",
"def initialize(name, options = {})\n @name = present?(name) ? name : Vedeu.focus\n @options = options\n end",
"def initialize(name, opts = {})\n @name = name\n @opts = opts\n end",
"def initialize(node_name, options)\n @node_name = node_name\n @options = options\n end",
"def initialize()\n @options = { }\n end",
"def initialize(options={})\n end",
"def initialize(options = {})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options = {})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(name, path, options={})\n @name = name\n @path = path.chomp('/')\n @options = options\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(name, *args)\n _initialize(name, args, OPTS)\n end",
"def initialize(name, options, builder:, html_options: nil)\n @builder = builder\n @template = builder.template\n\n @name = name\n @options = extract_options!(options, html_options: html_options)\n apply_input_options!\n end",
"def initialize(options = {})\n init(options)\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(name, options={})\n @name = name.to_sym\n @options = options\n @columns = []\n @indexes = []\n end",
"def initialize(name, options)\n @name = name.to_s\n @hidden = !!options[:hidden]\n @cacheable = !!options[:cacheable]\n @priority = (options[:priority] || 99).to_i\n @accepts = Regexp === options[:accepts] ? options[:accepts] : /\\A(?:#{options[:accepts]})\\Z/\n @mime = options.include?(:mime) ? options[:mime] : FRAGMENT_MIME\n @plugin = options[:plugin] || Plugin.for(self.class)\n @description = options[:description] || @plugin.description\n end",
"def initialize(options) # :nodoc:\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize options = {}\n # This is just a placeholder.\n # See parser.c for the C source code to this method.\n end",
"def initialize(options = {})\n validate_options(options)\n\n @name = options[:name]\n @run_list = Array(options[:run_list])\n @attributes = options[:attributes] || Hash.new\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = {})\n parse_options options\n end",
"def initialize(options = 0)\n @options = options\n end",
"def initialize(options = {})\n super()\n @opts = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(name = nil)\n\t\t@name = name\n\tend",
"def initialize(name = nil)\n\t\t@name = name\n\tend",
"def initialize(name, options)\n @name = name\n @options = options\n @quorums = []\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(type, name, options={})\n @type, @name, @options = type, name, options.to_options\n @short_name = (@options.delete(:short) || name).to_sym\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options)\n @options = options\n super()\n end",
"def initialize(value, name, options={})\r\n @value = value\r\n @name = name \r\n end",
"def initialize(name)\n name(name)\n end",
"def initialize(id, name: nil, **options)\n super\n end",
"def initialize(options={})\n @options = options\n end",
"def initialize(name, options = {})\n @name = name.to_s\n @previous_resolver = options.delete(:resolver)\n end",
"def initialize repo_name, options\n self.repo_name = repo_name\n self.options = options\n end",
"def initialize(name, options = {})\n @name = name\n @schema = options[:schema] || 'public'\n @arguments = Arguments.new(options[:args]) if options[:args]\n end",
"def initialize(name)\n @name = name\n @options = {}\n\n yield self if block_given?\n\n define\n end",
"def initialize(name, options = {})\n self.items = []\n self.name = name\n self.filtered = options.delete :filtered\n self.single_select = options.delete :single_select\n self.remote = options.delete :remote\n self.searchable = options.delete :searchable\n end",
"def initialize(options = {})\n super\n end",
"def initialize( label, options )\n\n @label = label\n @options = options\n @current_option = 0\n end",
"def initialize(name, options = {})\n normalized_options = {}\n normalized_options[\"Filter\"] = options[:filter] if options.has_key?(:filter)\n normalized_options[\"Action\"] = options[:action] if options.has_key?(:action)\n\n super(name, normalized_options)\n end",
"def initialize(options={})\n @init_options = options.kind_of?(Hash) ? options : {}\n end",
"def initialize options={}\n @own_options = options\n end",
"def initialize(name, options = {})\n @name = name\n options = Options.for(options).validate(:repeatable, :hop_by_hop, :modifiable)\n \n @repeatable = options.getopt([:repeatable, :multivalue, :multivalued]) || false\n @hop_by_hop = options.getopt(:hop_by_hop) || false\n @modifiable = options.getopt(:modifiable, true)\n end",
"def initialize(source, name, options)\n @name = name\n @options = options\n @source = source\n @loaded = false\n end",
"def initialize(name, options)\n assert_kind_of 'name', name, Symbol\n\n @name = name\n @options = options.dup.freeze\n @resource_naming_convention = NamingConventions::Resource::UnderscoredAndPluralized\n @field_naming_convention = NamingConventions::Field::Underscored\n end",
"def initialize(options = { })\n super(options)\n end",
"def initialize name\n\t\t\t@name = name\n\t\tend",
"def initialize(name = nil)\n\t\t@name = name;\n \tend",
"def initialize(options = {})\n [:package, :header, :relative_filename, :filename, :content, :pool].each do |field|\n send(\"#{field}=\", options[field]) if options[field]\n end\n \n end",
"def initialize(name, options = {})\n @name = name\n @options = options\n @label = options[:label]\n @default_val = options[:default]\n\n # @todo: Durran, change API in 4.0 to take the class as a parameter.\n # This is here temporarily to address #2529 without changing the\n # constructor signature.\n if default_val.respond_to?(:call)\n define_default_method(options[:klass])\n end\n end",
"def initialize(name)\n \n @name = name\n end",
"def initialize(name)\n @name = name\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @name = options[\"name\"]\n end",
"def initialize(name, *args)\n @name = name\n @options = args.extract_options!\n @iv_name = (args.first || @name).to_s.gsub('.', '_')\n @registry = []\n end",
"def initialize(options = {})\n super\n end",
"def initialize(options = {})\n super\n end",
"def initialize(name, options = {})\n self.name = name\n\t @name = name\n\t @options = options\n\t @subsets = ValueSet.new\n @recursive_subsets = ValueSet.new\n\t @distribute = options[:distribute]\n\t @dag = options[:dag]\n\t @weak = options[:weak]\n @strong = options[:strong]\n @copy_on_replace = options[:copy_on_replace]\n @embeds_info = !options[:noinfo]\n\n\t if options[:subsets]\n\t\toptions[:subsets].each(&method(:superset_of))\n\t end\n\tend"
] |
[
"0.88206035",
"0.87214524",
"0.8697182",
"0.86448467",
"0.8200587",
"0.81056595",
"0.8034961",
"0.7955008",
"0.7900337",
"0.78600705",
"0.7849325",
"0.7830291",
"0.7818841",
"0.78030527",
"0.78000236",
"0.7771051",
"0.77616984",
"0.7704742",
"0.7690857",
"0.7690857",
"0.7690857",
"0.7684953",
"0.76722175",
"0.7611584",
"0.75987476",
"0.75978345",
"0.7577456",
"0.75766915",
"0.75765955",
"0.7576322",
"0.7567205",
"0.7567205",
"0.75659853",
"0.75632966",
"0.75632966",
"0.75498056",
"0.7549566",
"0.75430155",
"0.75313675",
"0.75313675",
"0.75313675",
"0.7527376",
"0.7520211",
"0.75175655",
"0.749895",
"0.749895",
"0.749895",
"0.7493285",
"0.7484133",
"0.7475433",
"0.7475433",
"0.7475433",
"0.7475433",
"0.7475433",
"0.7475433",
"0.74729097",
"0.74640244",
"0.7459568",
"0.7451942",
"0.7451047",
"0.7447573",
"0.7447573",
"0.74394196",
"0.74372935",
"0.74372935",
"0.74372935",
"0.7414434",
"0.7411218",
"0.7411218",
"0.7411218",
"0.7410795",
"0.740996",
"0.7409802",
"0.7408421",
"0.7404133",
"0.7404055",
"0.74020004",
"0.7387198",
"0.73814183",
"0.73763835",
"0.73702043",
"0.73693806",
"0.7368658",
"0.73675",
"0.73631585",
"0.7356891",
"0.73556286",
"0.7351863",
"0.73514414",
"0.7345605",
"0.7344737",
"0.73379654",
"0.7328943",
"0.73288316",
"0.7321601",
"0.7318322",
"0.73143035",
"0.73069674",
"0.73069674",
"0.7302234"
] |
0.8440349
|
4
|
Quoted github issue name and number.
|
def to_s
"#%-3s %s" % [ number, name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def github_issue_for(author)\n github_issues[author.gh_issue_number]\n end",
"def identifier\n issue.identifier\n end",
"def issue_url(api_url)\n # \"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/322\"\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n\n # https://github.com/typed-ember/ember-cli-typescript/issues/322\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..-1]\n html_url\n end",
"def find_github_issue\n\n issue = github.branch_for_head.match(/(issue\\/\\d+)/)\n if issue\n return issue[1]\n end\n\nend",
"def issue_notes_for(name, version, issues, notes)\n notes << \"\\n### #{name} Issues resolved for #{version}\\n\\n\"\n do_references = ENV['REFERENCES']\n\n issues.reverse.each do |issue|\n if do_references\n notes << %Q{[#{issue[0]}]:#{issue[2]}\\n}\n else\n notes << %Q{- [#{issue[0]} - #{issue[1]}](#{issue[2]})\\n}\n end\n end\n notes\nend",
"def referenced_issue_number?(pr)\n return unless pr.body\n\n # Searching for issue closing keywords + issue identifier in PR's description, i.e. `fixes #1234`\n issue_number = pr.body[/(#{ISSUE_CLOSING_KEYWORDS.join('|')}) #\\d{1,}/i, 0]\n issue_number = issue_number[/#\\d{1,}/i, 0] if issue_number\n issue_number = issue_number.tr('#', '') if issue_number\n\n # Searching for issue closing keywords + issue URL in PR's description, i.e. `closes https://github.com/REPOSITORY_OWNER/REPOSITORY_NAME/issues/1234`\n issue_number = pr.body[/(#{ISSUE_CLOSING_KEYWORDS.join('|')}) https:\\/\\/github.com\\/#{REPOSITORY_OWNER}\\/#{REPOSITORY_NAME}\\/issues\\/\\d{1,}/i, 0] unless issue_number\n issue_number = issue_number.split('/').last if issue_number\n\n return issue_number\n end",
"def get_issue(number)\n github.issues.get(*github_org_repo, number)\n end",
"def item_name\n issue.title\n end",
"def issue_project_key(issue_key)\n issue_key.split('-').length > 1 ? issue_key : [current_project, issue_key].join('-')\n end",
"def issue_url(issue_id)\n \"http://jira.blurb.com/browse/#{issue_id}\"\n end",
"def getIssueId(project_id, issue_name)\n\tissue_id = \"\"\n\tproject = $client.Project.find(project_id)\n\tproject.issues.each do |issue|\n\t\tif \"#{issue.summary}\" == \"#{issue_name}\"\n\t\t\tissue_id = \"#{issue.id}\"\n\t\t\twrite_to_file(\"Story id #{issue_id} was successfully found for #{issue_name}\", \"info\")\n\t\tend\n\tend\n\treturn issue_id\nend",
"def author\n quote_of_the_day[second_to_last_index(quote_of_the_day, \"~\")..quote_of_the_day.rindex(\"~\")].gsub(/(\\A~\\s*|\\s*~\\z)/, \"\")\n end",
"def new_issue(title)\n result = YAML.load(RestClient.post(\"https://github.com/api/v2/yaml/issues/open/#{@repository}\", :login => @username,\n :token => @api_token, :title => title))\n result[\"issue\"][\"number\"]\n end",
"def issue_number\n issue_url[/\\d+\\Z/].to_i\n end",
"def github(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def issue_link(issue)\n context.link_to \"#{issue.key} - #{issue.summary}\", context.issue_path(:user => issue.project.user.username, :key => issue.project.key, :id => issue.number)\n end",
"def format_issue(issue)\n t(config.jira.format == 'one-line' ? 'issue.oneline' : 'issue.oneline',\n key: issue.key,\n summary: issue.summary,\n status: issue.status.name,\n assigned: optional_issue_property('unassigned') { issue.assignee.displayName },\n url: format_issue_link(issue.key))\n end",
"def highwire_author_format(name)\n if name.include? ','\n name.split(',').reverse.join(' ').strip\n else\n name\n end\n end",
"def github_repo\n build.repo_name.delete_prefix(\"github_\").tr(\"_\", \"/\")\n end",
"def format_flake_comment(prefix, flake_config, team_ids)\n flake_label = flake_config['label']\n flake_repo = flake_config['repo']\n org_repo = \"#{Properties['github_user']}/#{flake_repo}\"\n flake_label_query = CGI.escape(\"label:#{flake_label}\")\n issue_link = \"https://github.com/#{org_repo}/issues?q=#{flake_label_query}\"\n new_issue_link = \"https://github.com/#{org_repo}/issues/new\"\n\n \"\n#{prefix}\n - If the proposed changes in this pull request caused the job to fail, update this pull request with new code to fix the issue(s).\n - If flaky tests caused the job to fail, leave a comment with links to the GitHub issue(s) in the `#{org_repo}` repository with the [`#{flake_label}` label](#{issue_link}) that are tracking the flakes. If no issue already exists for the flake you encountered, [create one](#{new_issue_link}).\n - If something else like CI system downtime or maintenance caused the job to fail, contact a member of #{format_teams(team_ids)} to trigger the job again.\n \"\n end",
"def owner_and_repo_name(assignment_or_submission)\n assignment_or_submission.repourl.split('/')[-2..-1].join('/')[0..-5]\n end",
"def change_name_of_issue(issue_name, name_text)\n\tissue = @client.Issue.find(issue_name)\n\tissue.save({\"fields\"=>{\"summary\"=>name_text}})\nend",
"def repo_name_without_whitespace(repo_name)\n repo_name.strip\n end",
"def issue_numbers\n github_issues.keys\n end",
"def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend",
"def long_name\n [number, title].join(' ')\n end",
"def long_name\n [number, title].join(' ')\n end",
"def print_links_with_titles\n found_issues = collect_issues_from_commits\n return if found_issues.empty?\n\n message = \"## Jira issues\\n\\n\"\n if include_resolves_keyword\n message << \"| | | |\\n\"\n message << \"| --- | --- | ----- |\\n\"\n else \n message << \"| | |\\n\"\n message << \"| --- | ----- |\\n\"\n end\n\n begin\n found_issues.each do |issue_id| \n issue = obtain_issue(issue_id)\n return if issue.nil?\n description = issue.summary\n description = description.gsub(/[<|>\\[\\]]/) { |bracket| \"\\\\#{bracket}\" }\n message << \" | \"\n if include_resolves_keyword\n message << \"Resolves #{issue_id} | \"\n end\n message << \"[#{description}](#{jira_site}/browse/#{issue_id})\\n\"\n end\n rescue JIRA::HTTPError => e\n print e.message\n end\n\n markdown message\n end",
"def sanitized_title\n return Takedown::ISSUE_TITLE if takendown?\n TrackerPlugin::GH.title_without_plugin(self) || Issue::UNKNOWN_TITLE\n end",
"def format_issue i, width = columns\n return unless i['created_at']\n ERB.new(<<EOF).result binding\n<% p = i['pull_request']['html_url'] if i.key?('pull_request') %>\\\n<%= bright { no_color { indent '%s%s: %s' % [p ? '↑' : '#', \\\n*i.values_at('number', 'title')], 0, width } } %>\n@<%= i['user']['login'] %> opened this <%= p ? 'pull request' : 'issue' %> \\\n<%= format_date DateTime.parse(i['created_at']) %>. \\\n<% if i['merged'] %><%= format_state 'merged', format_tag('merged'), :bg %><% end %> \\\n<%= format_state i['state'], format_tag(i['state']), :bg %> \\\n<% unless i['comments'] == 0 %>\\\n<%= fg('aaaaaa'){\n template = \"%d comment\"\n template << \"s\" unless i['comments'] == 1\n '(' << template % i['comments'] << ')'\n} %>\\\n<% end %>\\\n<% if i['assignee'] || !i['labels'].empty? %>\n<% if i['assignee'] %>@<%= i['assignee']['login'] %> is assigned. <% end %>\\\n<% unless i['labels'].empty? %><%= format_labels(i['labels']) %><% end %>\\\n<% end %>\\\n<% if i['milestone'] %>\nMilestone #<%= i['milestone']['number'] %>: <%= i['milestone']['title'] %>\\\n<%= \" \\#{bright{fg(:yellow){'⚠'}}}\" if past_due? i['milestone'] %>\\\n<% end %>\n<% if i['body'] && !i['body'].empty? %>\n<%= indent i['body'], 4, width %>\n<% end %>\n\nEOF\n end",
"def issue(issue_id)\n url + 'issues/' + issue_id.to_s\n end",
"def issues_text\n if (issues.count > 0)\n r = \"\"\n issues.each do |issue|\n r += \", \"\n r += issue.description\n end\n r[2,r.length-2] # lose starting comma-space\n else\n \"No issues yet\"\n end\n end",
"def parse_github_ids full_document\n full_document.gsub(/%github(\\d+)/) do\n # Also works for PRs becuase GH figures that out.\n url = \"https://github.com/calacademy-research/antcat/issues/#{$1}\"\n link_to \"GitHub ##{$1}\", url\n end\n end",
"def format_quote\n\t\t@final_quote = @number.delete('\"\\\">$')\n\t\treturn @final_quote\n\tend",
"def title\n repo = (repository && repository.identifier.present?) ? \" (#{repository.identifier})\" : ''\n comm = short_comments.blank? ? '' : (': ' + short_comments)\n \"#{l(:label_revision)} #{format_identifier}#{repo}#{comm}\"\n end",
"def format_name\n [@comment[:first], @comment[:last]].join(' ')\n end",
"def name\n 'GitHub'\n end",
"def append_comment_to_other_info(other_info, str)\n if other_info.present?\n other_info += \"\\n\"\n else\n other_info = \"\"\n end\n other_info += \"MIGRATION_ISSUE: #{str}\"\n other_info\n end",
"def formatted_doi\n \"#{ENV['DOI_PREFIX']}/#{joss_id}\"\n end",
"def note_name\n name.split(/-?\\d\\z/).first\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def body_for_issue(issue)\n if issue[:site] == :github\n username = '@' + issue[:author]\n else\n username = issue[:author]\n end\n \n formatted_date = issue[:date].strftime(\"%Y-%m-%d at %H:%M (UTC)\")\n header = \"Issue originally opened by #{username} on #{formatted_date}, \"\\\n \"and migrated by the [Motherforker](https://github.com/ExplodingCabbage/motherforker).\\n\\n\"\\\n \"Original issue: #{issue[:url]}\\n\\n\"\\\n \"----------------------------------------------\\n\\n\"\n \n return header + issue[:body]\n end",
"def name_bill\n \"#{name}:#{endNumber}\"\n end",
"def github_url\n \"http://github.com/280north/cappuccino/commit/#{sha1}\"\n end",
"def get_issue_numbers_and_titles(section) \n issues_titles = []\n section.split(/\\n/).each do |line|\n issue = line[/\\* \\[#(.*?)\\]\\(/m, 1]\n title = line[/\\)\\: (.*?) - \\[@/m, 1].gsub(/\\\"/, \"\") # strip double quotations from pr titles\n issues_titles.push( { \"issue\" => issue, \"title\" => title } ) if issue && !issue.empty? && title && !title.empty?\n end \n return issues_titles\nend",
"def escaped_dependency_name\n dependency.name.gsub(\"/\", \"%2F\")\n end",
"def name_to_url(name)\n \"https://github.com/#{name}.git\"\n end",
"def git_name\n (!GitHosting.multi_repos? || identifier.blank?) ? project.identifier : identifier\n end",
"def path_to_file_on_github\n \"https://github.com/#{@repo.name}/blob/master/#{@file}#L#{@todo.line_number}\"\n end",
"def set_issue_number\n branch_name_after_slash = @name.partition('/').last\n\n # should_check_status?(branch_name_after_slash)\n\n return if !@is_issue ||\n branch_name_after_slash.to_i.zero? ||\n branch_name_after_slash.include?('.')\n\n @issue_number = branch_name_after_slash.to_i\n\n read_current_issue_status\n end",
"def describe_issue;\n puts @issue\n end",
"def card_description(bug_id)\n descr = <<TXT\nBugzilla: #{bz_markdown_link(bug_id)}\n\n---\n## Review\n- Pull Request: *URL here*\nTXT\n\n # just to avoid the trailing blank errors in the heredoc\n descr + \"- \"\nend",
"def issue_header(issue_hash)\n info = [issue_hash[:key], issue_hash[:type], print_priority(issue_hash[:priority]), print_status(issue_hash[:status])]\n [info.join(' | '), issue_hash[:summary], hr].join(\"\\n\")\n end",
"def get_github_issues\n @github_issues = octokit_client.issues(repo_name).each_with_object({}) { |issue, issues|\n issues[issue[\"number\"]] = issue\n }\n end",
"def quoted_string; end",
"def url_for_request(query)\n root = \"https://api.github.com/\"\n root + \"search/issues?q=#{query}%2Brepo%3A#{repo_owner}%2F#{repo_name}&sort=created&order=asc\"\n end",
"def create_github_issue_for(author)\n Rails.logger.info \"Creating github issue for author #{author.id}\"\n octokit_client.create_issue(repo_name, author.name, author.bio)\n end",
"def gitreponame\n g = Git.open(Dir.pwd)\n control_repo = g.config('remote.origin.url').to_s\n control_repo = control_repo.split('/')\n control_repo = control_repo[-1].chomp.split('.')\n control_repo = control_repo[0]\n output = \"\\\"control_repo\\\": \" + '\"' + control_repo + '\",'\n puts output\nend",
"def filtered_issue_id\n if value_for('issue_id').to_s =~ /\\A(\\d+)\\z/\n $1\n end\n end",
"def title_for_repo(repo)\n \"#{repo.name} #{repo.version}\"\n end",
"def git_id(id)\n\t\t\tid[0...8]\n\t\tend",
"def github_comment_repository_url(comment)\n [comment.repository, 'commit', comment.reference].join('/')\n end",
"def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end",
"def parse_commit_message!(message)\n match = message.match(/ \\(#(?<pr_number>[0-9]*)\\)?$/)\n {\n \"pr_number\" => match && match[:pr_number] ? match[:pr_number].to_i : nil\n }\nend",
"def get_github_issues github_uri\n user,project = get_github_user_project(github_uri)\n url = \"http://github.com/legacy/issues/search/#{user}/#{project}/open/number\"\n $stderr.print url,\"\\n\"\n issues = JSON.parse(Http::get_http_body(url))\n if issues == nil or issues == {}\n $stderr.print \"\\nWARNING: issues link not working!\\n\"\n issues = {\"issues\"=>[]} \n end\n $stderr.print issues['issues'].size, \"\\n\" \n issues['issues']\n end",
"def joss_id\n id = \"%05d\" % review_issue_id\n \"#{ENV['JOURNAL_ALIAS']}.#{id}\"\n end",
"def github_repo\n # GitHub allows underscores, hyphens and dots in repo names\n # but only hyphens in user/organisation names (as well as alphanumeric).\n repository_url.scan(/:([A-Za-z0-9-]+\\/[\\w.-]+)\\.git$/).join\n end",
"def display_name\n if name.blank?\n github_username\n else\n name\n end\n end",
"def github_comment_file_url(file)\n [file.scm_comment.repository, 'blob', file.scm_comment.reference, file.path].join('/')\n end",
"def project_identifier(p, length=26)\n truncate([p.shortname, p.description].join(\" - \"), :length => length)\n end",
"def title\n \"Interesting commit: #{commit.title}\"\n end",
"def send_to_github\n ExceptionHub.current_octokit.create_issue(\"#{ExceptionHub.repo_owner}/#{ExceptionHub.repo_name}\", self.title, self.description, :open_timeout => 5)\n end",
"def request_placeholder\n \"JIRA Number: HIANDEV-XXXX\nSolution: HealtheAnalytics\nTest Date: 10-May-2017\nEnvironment: Staging\nOperating System: OS-X\nAssociate ID: AA00000\nPrerequisite Evidence: N/A\"\n end",
"def format_changeset_identifier(changeset)\n changeset.revision[0, 9]\n end",
"def format_issue(issue, repo)\n splitter = /^[# ]*release note.*/i\n underlines = /^[=\\-#]+$/\n heading_prefix = repo.match('-') ? \"#{drop_prefix(repo)}: \" : ''\n\n # Start polishing the issue body into release note text\n issue_body = issue['body']&.gsub(/\\r\\n/, \"\\n\")&.strip || ' '\n\n # Attempt to split release notes from the body with the splitter\n release_note = issue_body.split(splitter, 2).last.strip\n\n # Attempt header & further content extraction, if there was no splitter\n if release_note == issue_body\n # Discard everything before the first heading\n release_note = issue_body.split(/^#/, 2).last\n # Re-add the first \"#\", if the header split worked\n release_note = \"##{release_note}\" unless release_note == issue_body\n end\n\n # Remove extraneous lines, like ==== ---- ####\n release_note.sub!(/^.*$/, '').strip! if release_note.split(\"\\n\").first&.match(underlines)\n\n # Handle underline-style headings at the top; converting to ATX-stle\n release_note.sub!(/^(.*)$\\n^.*$/, '## \\1') if release_note.split(\"\\n\")[1]&.match(underlines)\n\n # Prepend an issue title when a heading wasn't extracted\n issue_title = release_note&.match(/^#/) ? '' : \"## #{heading_prefix}#{issue['title']}\\n\\n\"\n\n puts issue.to_yaml if @options.debug\n\n state_info = if @options.preview\n state = issue['state']\n if state == 'open'\n alert = 'warn'\n included = '(will not be included) '\n merged = 'OPEN'\n else\n alert = 'note'\n included = ''\n merged = 'merged'\n end\n url = issue['html_url']\n \"State: **#{merged}** #{included}@ <#{url}>\\n{:.#{alert}}\\n\\n\"\n else\n ''\n end\n\n full_note = \"#{issue_title}#{release_note.strip}\"\n # Normalize headings to H2\n .sub(/^#+/, '##')\n .sub(/\\n\\n/, \"\\n\\n#{state_info}\")\n\n process_images(full_note)\nend",
"def link(href: nil, issue: nil)\n return \"<a href='#{href}#{issue}'>#{issue}</a>\"\n end",
"def full_journal_title\n title = journal_title\n issue = title && series_position\n issue ? \"#{title}, #{issue}\" : title\n end",
"def comment args #id, comment\n id = args.shift\n unless id\n id = ask(\"Issue Id? \", Integer)\n end\n db, row = validate_id id, true\n die \"No issue found for #{id}\" unless row\n if !args.empty?\n comment = args.join(\" \")\n else\n message \"Enter a comment (. to exit): \"\n comment = Cmdapp.get_lines\n end\n die \"Operation cancelled\" if comment.nil? or comment.empty?\n message \"Comment is: #{comment}.\"\n message \"Adding comment to #{id}: #{row['title']}\"\n _comment db, id, comment\n 0\n end",
"def getProjectName()\n\tcurl = 'git config --local remote.origin.url|sed -n \"s#.*/\\([^.]*\\)\\.git#\\1#p\"'\n\tresult = `#{curl}`\n\treturn result.strip()\nend",
"def name\r\n descr.sub(/\\n.*/m, '')\r\n end",
"def descriptive_issue_link(issue)\n self.send(\"descriptive_#{issue.class.name.underscore}_link\", issue)\n end",
"def quoted_name\n Squirm.quote_ident name\n end",
"def github_url\n \"https://github.com/#{self.nickname}\"\n end",
"def issue_comment(owner, repo, issue_number, comment)\n Issues.post(\n \"/repos/#{owner}/#{repo}/issues/#{issue_number}/comments\",\n :headers => @auth,\n :body => { :body => comment }.to_json\n )\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def uri_string_for_comments_on_pull(id)\n uri_parts(\n \"/repos/#{@github_user}/#{@github_repo}/issues/#{id}/comments\"\n ).values.join\n end",
"def release_notes\r\n changelog = File.read(CHANGELOG_FILE)\r\n match = /#\\s+(#{Regexp.quote(current_build_number)})[^\\r\\n]+[\\r\\n]+(?<text>[^#\\z]+)/.match(changelog)\r\n return \"\" if match.nil?\r\n match[:text].strip\r\nend",
"def numbername\n self.number + \" - \" + self.name\n end",
"def id_for_repo(repo)\n \"#{repo.url}##{repo.version}\"\n end",
"def proper_name\n @proper_name ||= @raw_name.lstrip.sub(CURRENT_BRANCH_REGEX, '')\n end",
"def short_bill_title(bill)\n truncate(bill['title'].gsub(/\\A\"|\"\\z/, ''), length: 95) # an unclosed quotation looks funny, so remove it\n end",
"def update_author_from_github(author, github_issue)\n Rails.logger.info \"Updating author #{author.id} from changed GitHub information\"\n unless author.update(name: github_issue[\"title\"], bio: github_issue[\"body\"], gh_last_sync: Time.now)\n Rails.logger.warn \"There was an error updating #{author.id} from changed GitHub information\"\n end\n end",
"def short_pattern\n /\n (?:^|\\W) # beginning of string or non-word char\n (?:(#{qualifier_regex})(?:\\s))? # qualifier (optional)\n (?:(#{REPOSITORY_NAME})? # repository name (optional)\n \\#|(?:GH\\-))(\\d+) # issue number\n (?=\n \\.+[ \\t]| # dots followed by space or non-word character\n \\.+$| # dots at end of line\n [^0-9a-zA-Z_.]| # non-word character except dot\n $ # end of line\n )\n /ix\n end",
"def name\n \"Volume #{volume} Issue #{number}\"\n end",
"def bug_url(bug_id)\n \"https://bugzilla.blurb.com/show_bug.cgi?id=#{bug_id}\"\n end",
"def markdown_message warning, message\n if warning.file\n github_url = github_url warning.file, warning.line\n message.gsub!(/(near line \\d+)/, \"[\\\\1](#{github_url})\") if github_url\n end\n if warning.code\n code = warning.format_code\n message.gsub(code, \"`#{code.gsub('`', '``').gsub(/\\A``|``\\z/, '` `')}`\")\n else\n message\n end\n end",
"def feed_id\n \"http://#{@account.downcase}.github.com/\"\n end",
"def bare_identifier\n resource.identifier_str.gsub(/^doi:/, '')\n end",
"def text_to_issue(issue, options={})\n title = nil\n subject = nil\n text = options[:tracker] == false ? \"##{issue.id}\" : \"#{issue.tracker} ##{issue.id}\"\n if options[:subject] == false\n title = issue.subject.truncate(60)\n else\n subject = issue.subject\n if truncate_length = options[:truncate]\n subject = subject.truncate(truncate_length)\n end\n end\n only_path = options[:only_path].nil? ? true : options[:only_path]\n s = text\n s << h(\": #{subject}\") if subject\n s = h(\"#{issue.project} - \") + s if options[:project]\n s\n end",
"def changelog_notes_id\n IssueCustomField.find_by_name('Changelog Note').id\n end",
"def q_inno(text)\n '\"' + text.to_s.gsub('\"', '\"\"') + '\"'\n end"
] |
[
"0.61163807",
"0.59911776",
"0.57983696",
"0.5769806",
"0.5714341",
"0.565807",
"0.5641154",
"0.5533708",
"0.5528854",
"0.54950106",
"0.54816645",
"0.5480701",
"0.5479317",
"0.5468885",
"0.5450055",
"0.5449838",
"0.54305357",
"0.5413904",
"0.5410304",
"0.5407806",
"0.54021114",
"0.53802073",
"0.53791684",
"0.5376917",
"0.5375435",
"0.5375056",
"0.5375056",
"0.53438157",
"0.5339333",
"0.53360283",
"0.53243816",
"0.5322839",
"0.5310951",
"0.5300659",
"0.5284818",
"0.5283584",
"0.5279887",
"0.52733755",
"0.525996",
"0.52325207",
"0.5231361",
"0.5230996",
"0.52023894",
"0.52019984",
"0.51957476",
"0.5193805",
"0.518505",
"0.5182413",
"0.5181104",
"0.51768696",
"0.5167598",
"0.51519746",
"0.51417774",
"0.513341",
"0.5126472",
"0.51196885",
"0.5118913",
"0.5118807",
"0.5112299",
"0.5108422",
"0.5107861",
"0.5105517",
"0.50998473",
"0.5089753",
"0.5078676",
"0.5074583",
"0.50669974",
"0.50661176",
"0.50657994",
"0.50623983",
"0.5057569",
"0.5053166",
"0.5046116",
"0.5039587",
"0.5028595",
"0.5027497",
"0.5023367",
"0.5019821",
"0.50196064",
"0.5016316",
"0.50132644",
"0.5008073",
"0.49875414",
"0.49783474",
"0.49759653",
"0.49745607",
"0.4972767",
"0.49706966",
"0.49702102",
"0.4968786",
"0.4967261",
"0.49646464",
"0.49623775",
"0.49623606",
"0.49549544",
"0.495044",
"0.49493483",
"0.49461466",
"0.494444",
"0.49398986",
"0.49393314"
] |
0.0
|
-1
|
Output verbose task information.
|
def verbose_output(format)
super(format)
say format % ['labels', labels.join(', ')] if labels and not labels.empty?
say format % ['project', [username, project].join('/')]
say format % ['url', url ]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verbose(*args)\n if @verbose\n $stderr.puts args\n end\n end",
"def verbose(tf=true)\n @verbose = tf\n end",
"def verbose\n \"-q\"\n end",
"def verbose( text )\n $stderr.puts text if $params[ :verbose ]\nend",
"def verbose(m)\n $stderr.puts(m) if $verbose\nend",
"def verbose\n @commands_and_opts.push OPTIONAL_OPTS[:verbose]\n self\n end",
"def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend",
"def verbose(string_to_output)\n puts string_to_output if $verbose\nend",
"def verbose!\n @verbose = true\n end",
"def verbose(tf)\n @verbose = tf\n end",
"def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end",
"def verbose!\n @actor << 'VERBOSE'\n @actor.wait\n end",
"def print_task_info(task:)\n path = task.files.first['path'].chomp(\"/tasks/#{task.files.first['name']}\")\n module_dir = if path.start_with?(Bolt::Config::Modulepath::MODULES_PATH)\n \"built-in module\"\n else\n path\n end\n @stream.puts task.to_h.merge(module_dir: module_dir).to_json\n end",
"def verbose!\n @actor << 'VERBOSE'\n end",
"def run_verbose!\n @run_verbose = true\n end",
"def verbose text\n message(text) if @options[:verbose]\n end",
"def verbose text\n message(text) if @options[:verbose]\n end",
"def dump_info_to\n \"to task #{ target_task_id } as '#{ status }'#{ ' >obsolete<' if obsolete }\"\n end",
"def verbose\n @verbose || false\n end",
"def verbose; @config[:verbose]; end",
"def verbose(string)\n if $verbose\n puts string\n end\nend",
"def verbose(value = nil)\n configure(:verbose, value)\n end",
"def verbose?\n @verbose_output\n end",
"def print_verbose(msg = '')\n $stderr.puts \"[*] #{msg}\" if self.verbose\n end",
"def verbose(msg = nil)\n say(clean_text(msg || yield)) if Gem.configuration.really_verbose\n end",
"def print_options\n puts \"\\nGeneral options (not all options are valid for all tasks):\"\n puts \"files=<pattern> - Files for the task (a pattern to match the files)\"\n puts \"talia_root=<path> - Manually configure the TALIA_ROOT path\"\n puts \" (default:autodetect)\"\n puts \"reset_rdf={yes|no} - Flush the RDF store (default:no)\"\n puts \"reset_db={yes|no} - Flush the database (default:no)\"\n puts \"config=<filename> - Talia configuration file (default: talia_core)\"\n puts \"environment=<env> - Environment for configuration (default: development)\"\n puts \"data_dir=<dir> - Directory for the data files\"\n puts \"verbose={yes|no} - Show some additional info\"\n puts \"\"\n end",
"def verbose\n variable(:scm_verbose) ? nil : \"-q\"\n end",
"def verbose_command(c)\n raise \"executor already shows all commands, maybe use `quiet` ?\" if @verbose\n print_and_execute c, resolve: false\n end",
"def say(*par)\n return unless self[:verbose]\n\n super(*par)\n end",
"def verbose(&block)\n with_verbose(true, &block)\n end",
"def verbose(&block)\n with_verbose(true, &block)\n end",
"def print_verbose(msg)\n puts msg if (@verbose) \n STDOUT.flush\n end",
"def verbose_output=(flag)\n @verbose_output = flag\n end",
"def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end",
"def task_help(shell, task_name)\n meth = normalize_task_name(task_name)\n task = all_tasks[meth]\n handle_no_task_error(meth) unless task\n\n shell.say \"Usage:\"\n shell.say \" #{banner(task)}\"\n shell.say\n class_options_help(shell, nil => task.options.map { |_, o| o })\n if task.long_description\n shell.say \"Description:\"\n shell.print_wrapped(task.long_description, :ident => 2)\n else\n shell.say task.description\n end\n end",
"def v_puts(msg)\n puts msg if @options[:verbose]\n end",
"def verbose(true_or_false = true)\n @_verbose = true_or_false\n EtherShell::ShellDsl.nothing\n end",
"def verbosity\n runopts(:verbosity) || 1\n end",
"def vputs(text)\n puts text if $verbose\nend",
"def verbose_info(message, color: :blue)\n info(message, color: color) if AIPP.options.verbose\n end",
"def verbose(message)\n add(:info, message) if verbose?\n end",
"def verbose(message)\n add(:info, message) if verbose?\n end",
"def verbose_print(text)\n @output += %(#{text}\\n)\n puts text if @verbose\n end",
"def display_task(task)\n\t\t\tsplit_task(task.name).each_with_index do |name_line, line_index|\n\t\t\t\tcol_1 = pad((task.start_time if line_index==0), 5)\n\t\t\t\tcol_2 = pad(name_line, @name_width)\n\t\t\t\tcol_3 = pad((task.elapsed_time if line_index==0), @elapsed_time_width)\n\n\t\t\t\tif task.current? and TrackingConfig[:color_current_task]\n\t\t\t\t\tcurrent_task_color = TrackingConfig[:current_task_color]\n\t\t\t\t\tcurrent_task_color = TrackingConfig.defaults[:current_task_color] unless String.colors.include? current_task_color\n\n\t\t\t\t\tcol_1 = col_1.colorize current_task_color\n\t\t\t\t\tcol_2 = col_2.colorize current_task_color\n\t\t\t\t\tcol_3 = col_3.colorize current_task_color\n\t\t\t\tend\n\n\t\t\t\tputs \"| #{col_1} | #{col_2} | #{col_3} |\"\n\t\t\tend\n\t\tend",
"def show # Show tasks method\n all_tasks.map.with_index { |l, i| \"(#{i.next}): #{l}\"} # Show all tasks array in numerical order and whether a task is completed\n end",
"def verbose=(val)\n @verbose=val\n end",
"def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend",
"def desc(*args)\n Rake.application.DescribeTask(*args)\n end",
"def verbosity\n options[:verbosity] || NONE\n end",
"def verbose\n false\n end",
"def verbose_logging; end",
"def verbose\n nil#configuration[:scm_verbose] ? nil : \"-q\"\n end",
"def add_standard_info_tasks\n desc 'Perform no action other than print the app name and tags unless quiet'\n command(:print, :in_app_dir => false) do |app|\n if Zim::Config.quiet?\n puts app\n else\n puts \"#{app}: #{Zim.current_suite.application_by_name(app).tags.inspect}\"\n end\n end\n end",
"def verbose?\n @verbose\n end",
"def print_task()\n puts @task_name\n puts \" Assigned to: #{@assigned_to}\"\n puts \" Priority: #{@priority}\"\n print \" Start Date: #{@date_start.month}/\"\n print \"#{@date_start.day}/\"\n puts \"#{@date_start.year}\"\n print \" End Date: #{@date_end.month}/\"\n print \"#{@date_end.day}/\"\n puts \"#{@date_end.year}\"\n self.get_duration\n end",
"def exp_task\n\t\texperiments.each do |e|\n\t\t\tif !e.task_desc.nil?\n\t\t\t\te.task_desc + ' '\n\t\t\tend\n\t\tend\n\tend",
"def puts_verbose(s = \"\")\n puts s if $VERBOSE\nend",
"def verbose?() @opts.verbose?; end",
"def vputs(str)\n puts str if Rake.application.options.trace\nend",
"def verbose=(value) @verbose = true; end",
"def vprint(text)\n print text if $verbose\nend",
"def to_s # Method to display completion status and description of Task\n \"#{represent_status} : #{description}\"\n end",
"def description\n\t\"This task scrapes Hoovers for company info.\"\nend",
"def display_info(job)\n unless ARGV.include? \"--silent\"\n puts \"Job #{job.id} of relative duration #{job.relative_duration} has been attributed to server #{(@id + 1)}\"\n end\n end",
"def info(msg)\n Souschef::Print.info(msg) if @opts[:verbose]\n end",
"def show_summary!\n @runopts[:show_log] = false\n end",
"def DescribeTask(*args)\n descriptionLines = []\n args.each() do |arg|\n if(arg.is_a?(String))\n descriptionLines.push(arg)\n end\n end\n @ProjectFileLoader.CurrentlyLoadedProjectFile().AddTaskDescriptions(descriptionLines)\n end",
"def verbosity\n get_value :verbosity\n end",
"def verbose?\n @verbose\n end",
"def verbose?\n @options[:verbose]\n end",
"def displayRakeTasks\n Rake.application.tasks.each do |iTask|\n log_info \"+-#{iTask.name}: #{iTask.comment}\"\n iTask.prerequisites.each do |iPrerequisiteTaskName|\n log_info \"| +-#{iPrerequisiteTaskName}\"\n end\n log_info '|'\n end\n end",
"def vprint(text)\n # Purpose: output text if global variable $verbose is set.\n # Input : String input\n # Output : stdout\n # Remarks: none\n\n if $params[:verbose]\n puts text + \"\\n\"\n end\n\nend",
"def task_status(proxmox, pve_node, task)\n status_info = proxmox_get(proxmox, \"nodes/#{pve_node}/tasks/#{task}/status\")\n \"#{status_info['status']}#{status_info['exitstatus'] ? \":#{status_info['exitstatus']}\" : ''}\"\n end",
"def be_verbose(index)\n puts \"\\n#{result_case} (#{index+1})- #{@testcase.unique_identifier} - \\\"#{@testcase.name}\\\"\"\n puts @error_message\n puts(\"Request runtime: #{@response.runtime}\")\n puts(\" More more more verbosity\\n\")\n puts(\" request method: #{@testcase.request['method']}\")\n puts(\" resource path: #{@testcase.request['path']}\")\n puts(\" request headers: #{@testcase.request['headers']}\")\n puts(\" JSON body sent: #{@testcase.request['body']}\")\n puts(\" expectation:\")\n puts(\" response status code: #{@testcase.response_expectation['status_code']}\")\n puts(\" response headers: #{@testcase.response_expectation['headers']}\")\n puts(\" response body: #{@testcase.response_expectation['body']}\")\n puts(\" result:\")\n puts(\" response status code: #{@response.code}\")\n puts(\" response headers: #{@response.headers}\")\n puts(\" response body: #{JSON.parse(@response.body) rescue nil}\")\n end",
"def verbose?\n @run_verbose ||= nil\n end",
"def verbose_print(topic, message = \"\")\n if @verbose\n Jekyll.logger.info topic, message\n end\n end",
"def verbose=(flag)\r\n self.conf[:verbose] = flag\r\n $stdout.sync = flag\r\n end",
"def verbose?\n options[:verbose]\n end",
"def taskDescription _args\n \"taskDescription _args;\" \n end",
"def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end",
"def verbose_message(msg)\n\t\t\t\tUI.message(msg) if (@verbose)\n\t\t\tend",
"def dump\n unless @obsolete then\n puts \" WorkFlow task ##{ @id } '#{ @label }':\"\n puts \" #{ @inflows.count{ |f| !f.obsolete }} incoming flows:\"\n @inflows.each_with_index do |f,i|\n puts \" (#{ i }) #{ f.dump_info_from }\" unless f.obsolete\n end\n puts \" #{ @outflows.count{ |f| !f.obsolete }} outgoing flows:\"\n @outflows.each_with_index do |f,i| \n puts \" (#{ i }) #{ f.dump_info_to }\" unless f.obsolete\n end\n end\n end",
"def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.TaskContext #{context}>\"\n end",
"def verbose?\n if @@verbose == true\n return \"Verbose output to console has been enabled.\"\n elsif @@verbose == false\n return \"Verbose output to console has not been enabled\"\n end\n\n end",
"def display_tasks\n puts \"What do you want to do? \\n\"\n puts TASKS.values\n end",
"def verbose; datastore['VERBOSE']; end",
"def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Autopilot.V1.TaskStatisticsContext #{context}>\"\n end",
"def verbose_mode?\n @output_level == :verbose\n end",
"def verbose?\n options.verbose?\n end",
"def display_tasks_and_comments\n puts \"Displaying tasks... \\n\"\n puts\n if(options.show_tasks == :tasks)\n # Get the maximum width of all task names\n all_displayable_tasks = tasks.select { |t|\n t.comment && t.name =~ options.show_task_pattern\n }\n \n #puts \"Displayable tasks: #{all_displayable_tasks}\\n\"\n \n width = all_displayable_tasks.collect { |t| t.name_with_args.length }.max || 10\n max_column = truncate_output? ? terminal_width() - name.size - width - 7 : nil\n \n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n if(projectFile.HasTasks())\n headline = \"Tasks in project file: '#{projectFile.Path().RelativePath()}'\\n\"\n puts headline\n puts \"-\" * headline.length\n puts projectFile.GetTaskDescriptions(width, max_column)\n end \n end\n else\n super\n end\n end",
"def setVerbosity(v)\n @verbose = v\n end",
"def show\n set_task_with_category_and_tags\n add_breadcrumb @task.title\n end",
"def describe(detail=0, indent=0)\n i = ' ' * indent\n lines = [\"#{i}#{name} (#{self.class}) {\"]\n @tasks.each_value { |t|\n lines << t.describe(detail, indent + 2)\n }\n lines << i + \"}\"\n lines.join(\"\\n\")\n end",
"def verbose?\n @options[:verbose]\n end",
"def inspect\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.TaskContext #{context}>\"\n end",
"def vputs(s)\n $stderr.puts s if verbose\n end",
"def verbose_mode?\n if Rake.respond_to?(:verbose)\n # Rake 0.9.x\n Rake.verbose == true\n else\n # Rake 0.8.x\n RakeFileUtils.verbose_flag != :default\n end\n end",
"def is_verbose?\n options.include?(\"-v\")\n end",
"def verbose=(v); @config[:verbose]=v; end",
"def verbose?\n @options.verbose\n end"
] |
[
"0.6805797",
"0.6682833",
"0.6673702",
"0.6655492",
"0.6652425",
"0.6562772",
"0.65565604",
"0.6542497",
"0.65342176",
"0.65135455",
"0.648419",
"0.64723253",
"0.6364623",
"0.6355578",
"0.63549256",
"0.6345793",
"0.6345793",
"0.6331571",
"0.6331177",
"0.62952346",
"0.62781775",
"0.62701136",
"0.61976933",
"0.618445",
"0.617413",
"0.61315787",
"0.6114716",
"0.6108572",
"0.6091689",
"0.6079455",
"0.6079455",
"0.607164",
"0.6061075",
"0.6049737",
"0.6042665",
"0.60168785",
"0.6015792",
"0.6002711",
"0.59943414",
"0.5982855",
"0.59802824",
"0.59802824",
"0.59761477",
"0.5966873",
"0.59398234",
"0.5921342",
"0.59131014",
"0.59077847",
"0.5903418",
"0.59023976",
"0.58976036",
"0.58968204",
"0.58962256",
"0.58883697",
"0.5874764",
"0.58683294",
"0.585924",
"0.5830128",
"0.58293676",
"0.5800875",
"0.57815486",
"0.5778811",
"0.5776587",
"0.5767719",
"0.57469803",
"0.572425",
"0.5699937",
"0.5699593",
"0.56981117",
"0.5690461",
"0.5687582",
"0.5679785",
"0.5672924",
"0.5667306",
"0.5659166",
"0.56498694",
"0.5635505",
"0.56337345",
"0.5632204",
"0.5631306",
"0.5625781",
"0.5616714",
"0.56133664",
"0.5604557",
"0.5603745",
"0.560115",
"0.55994904",
"0.55957675",
"0.5590174",
"0.5587738",
"0.558333",
"0.5582089",
"0.5579046",
"0.55710876",
"0.5569953",
"0.55687827",
"0.5562288",
"0.55591434",
"0.5526581",
"0.5506551"
] |
0.5835528
|
57
|
PATCH/PUT /nsts/1 remove 'template' from returned parameters because nonnumeric hashkeys there cause "Unpermitted parameters" errors and prohibit saving any permission records (RoR 4.1.6) Note: 'template' entry may not exist in test environment, hence try is inserted
|
def update
respond_to do |format|
params[ :network_station ][ :network_stops_attributes ].try( :delete, 'template' )
if @network_station.update( network_station_params )
format.html { redirect_to @network_station, notice: t( 'network_stations.msg.edit_ok' )}
else
format.html { render :edit }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def template_params\n params.require(:cms_template).permit(:title, :section_id, :layout_id, :path,\n :content_type, :tag_list, :system_name, :liquid_enabled, :handler, :draft).tap do |params|\n\n section_id = params.delete(:section_id).presence\n layout_id = params.delete(:layout_id).presence\n\n params[:section] = current_account.sections.find(section_id) if section_id\n # We need to handle the case when the layout_id is purposely nil\n params[:layout] = layout_id && current_account.layouts.find(layout_id)\n end\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end",
"def template_params\n params.require(:template).permit(:name)\n end",
"def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end",
"def template_detail_params\n params.fetch(:template_detail, {}).permit(:task_description, :template_id, :stage_id)\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end",
"def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end",
"def etemplate_params\n params.require(:etemplate).permit(:template_id, :template_name)\n end",
"def template_params\n params.require(:template).permit(:subject, :body, :merchant_id, :created_by, :last_updated_by)\n end",
"def service_template_params\n params.require(:service_template).permit(:name, :icon, :group_id, :user_id, :raw_config, :desc, :readme)\n end",
"def template_params\n params.require(:template).permit(:name, :content)\n end",
"def template_params\n params.permit(\n :certificate_serial,\n :identity,\n { template_contents_attributes: [:id, :template_id, :locale, :title, :content] }\n )\n end",
"def template_params\n params.require(:template).permit(:identifier, :title, :help, :publisher, :variables, :payload, :memory, :count, :last_execute_at, :created_at, :updated_at, :method, :content,:uri, :cache, :checked, :headers, :delimiter, :host, :port, :database, :username, :password, :query, :selectors, :server, :to, :cc, :bcc, :subject, :message)\n end",
"def template_params\n params.require(:template).permit(:content)\n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end",
"def cf_template_params\n params.require(:cf_template).permit(:infrastructure_id, :name, :detail, :value, :format, :params)\n end",
"def emailtemplate_params\n params[:email_template].permit!\n end",
"def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end",
"def form_template_params\n params.require(:form_template).permit(:round_id)\n end",
"def script_template_params\n params.require(:script_template).permit(:name)\n end",
"def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end",
"def lcb_template_params\n params.require(:lcb_template).permit(:code, :name, :type, :content, :owner_id, :create_uid, :write_uid, :id)\n end",
"def question_template_params\n params.require(:question_template).permit(:context_id, :name, :points_awarded)\n end",
"def question_template_params\n res = params.require(:question_template).permit(:name, :locked, answers: [])\n res[:answers] = Answer.find(res[:answers].reject { |v| v==\"\" })\n res\n end",
"def update\n restricted\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def workout_template_params\n # params.require(:workout_template).permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,:id)\n params .permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,:id)\n end",
"def template_parameter_params\n params.require(:template_parameter).permit(:name, :value, :atom_id, :param_type)\n end",
"def template_params\n params.require(:template).permit(:name, :bgUrl, :accentColor, :headerColor, :linkColor, :unvisitedLinkColor, :darkClassColor)\n end",
"def survey_template_params\n params.require(:survey_template).permit(:name, :status, :survey_type)\n end",
"def orgn_template_update\n @event.template_id = params[:template_id]\n\n if !params[:template_id]\n #redirect_to orgn_template_events_path, :flash => { :error => 'Select a template.' }\n flash[:alert] = 'Select a template.'\n render :action => :orgn_template\n return\n end\n \n @event.template_id = @event.template_id\n \n respond_to do |format|\n if @event.update(template_params)\n format.html { redirect_to event_invite_events_path }\n format.json { head :no_content }\n else\n format.html { redirect_to event_invite_events_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def task_template_params\n params.require(:task_template).permit(:title, :created_by, :location)\n end",
"def update_params\n params.require(:permission_template)\n .permit(:release_date, :release_period, :release_varies, :release_embargo,\n :visibility, :workflow_id, :metadata_context_id,\n access_grants_attributes: %i[access agent_id agent_type id])\n end",
"def template_params\n params.require(:template).permit(:title, :subject, :receiver, :content)\n end",
"def survey_template_params\n params.require(:survey_template).permit(:name, :description, :organization_id)\n end",
"def induction_template_params\n params.require(:induction_template).permit(:template_no, :description, :activity, :day, :duration, :employee_id)\n end",
"def call_template_params\n params.require(:call_template).permit(:name, :desc, :flocation, :mode)\n end",
"def request_template_params\n params.require(:request_template).permit(:name, :cpu_cores, :ram_gb, :storage_gb, :operating_system)\n end",
"def update\n respond_to do |format|\n if @template_parameter.update(template_parameter_params)\n format.html { redirect_to @template_parameter, notice: 'Template parameter was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_parameter }\n else\n format.html { render :edit }\n format.json { render json: @template_parameter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end",
"def template_rule_params\n params.require(:template_rule).permit(:id, :company, :country, :sitecode, :event_id, :template_id, :comment, :updated_at, :updated_by)\n end",
"def issue_template_params\n params.require(:issue_template).permit(:title, :description, :rating, :recommendation, :severity)\n end",
"def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_template_params\n params.require(:question_template).permit(:prompt, :response_type, :response_required)\n end",
"def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def policy_template_params\n params.require(:policy_template).permit(:name, :is_active, :body)\n end",
"def update\n template = Template.find(params[:id])\n authorize template\n begin\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n template.assign_attributes(args)\n template.links = ActiveSupport::JSON.decode(params['template-links']) if params['template-links'].present?\n if template.save\n render(json: {\n status: 200,\n msg: success_message(template, _('saved'))\n })\n else\n render(json: {\n status: :bad_request,\n msg: failure_message(template, _('save'))\n })\n end\n rescue ActiveSupport::JSON.parse_error\n render(json: {\n status: :bad_request,\n msg: format(_('Error parsing links for a %{template}'),\n template: template_type(template))\n })\n nil\n rescue StandardError => e\n render(json: {\n status: :forbidden,\n msg: e.message\n }) and return\n end\n end",
"def item_template_params\n params.require(:item_template).permit(:id, :name, :description, :item_type, :strength, :intellect, :agility, :sell_cost,:buy_cost,:purchasable, :bag_template_id, :reward_template_id,\n image_attributes:[:id, :image_content, :type],\n resist_templates_attributes:[:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature, :item_template_id],\n attack_type_template_attributes:[:id, :name, :attack, :attack_type, :crit_chance, :crit_rate, :item_template_id])\n end",
"def update_params\n { stack_name: stack.identifier }.merge(template_param).merge(options)\n end",
"def update_params\n { stack_name: stack.identifier }.merge(template_param).merge(options)\n end",
"def questionnaire_template_params\n params.require(:questionnaire_template).permit(:name, :qt_type_id, :instructions, :comments)\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def survey_item_template_params\n params.require(:survey_item_template).permit(:question_title, :description, :survey_template_id, :srvy_item_category_template_id, {survey_data_type_ids: []})\n end",
"def sets_template_params\n params.require(:sets_template).permit(:setNum, :weight, :reps, :exercise_template_id)\n end",
"def update\n respond_to do |format|\n \n #@template.creator = current_user.id\n if @template.update(template_params)\n @template.creator=current_user.id\n @template.save\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def favorite_template_params\n params.permit(:user_id, :template_id)\n end",
"def create\n\n @template = Template.find(params[:template_id])\n @template_parameter = @template.template_parameters.create(template_parameter_params)\n redirect_to template_path(@template)\n #@template_parameter = TemplateParameter.new(template_parameter_params)\n end",
"def update\n authorize @service_template\n\n respond_to do |format|\n if @service_template.update(service_template_params)\n format.html { redirect_to service_template_path(@service_template), notice: 'Service template was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_template }\n else\n format.html { render :edit }\n format.json { render json: @service_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_template_params\n params.require(:character_template).permit(:id, :name, :description, :hero_class, :hp, :mp, :haste, :strength, :intellect, :agility, :main_param,\n image_attributes: [:id, :image_content, :type],\n resist_template_attributes: [:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature],\n attack_type_templates_attributes:[:id, :name, :desc, :target, :cost_type, :cost, :attack, :attack_type, :crit_chance, :crit_rate, :_destroy],\n bag_template_attributes: [:id, :gold,\n item_templates_attributes: [:id, :name, :description, :item_type, :strength, :intellect, :agility, :sell_cost, :buy_cost, :purchasable, :_destroy,\n image_attributes: [:id, :image_content, :type],\n resist_template_attributes: [:id, :physical, :fire, :water, :earth, :holy, :necrotic, :nature],\n attack_type_template_attributes: [:id, :name, :desc, :target, :cost_type, :cost, :attack, :attack_type, :crit_chance, :crit_rate, :_destroy]\n ]])\n end",
"def template_params\n @template_params ||= TemplateParamsController.new config\n end",
"def update \n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def page_template_params(method)\n case method\n when :create, :update\n params[:page_template].permit(:name)\n when :update_content\n params[:page_template].permit(:content)\n end\n end",
"def template_photo_params\n params[:template_photo].permit(:name, :description, :title ,:photolink ,:url_image_1,:remove_url_image_1, :item_id)\n end",
"def email_template_params\n params.require(:email_template).permit(:name, :body, :org_id)\n end",
"def checklist_template_params\n params.require(:checklist_template).permit(ChecklistTemplate.safe_attributes)\n end",
"def show_template_params\n params.require(:show_template).permit(:name, :dow, :showtime, :calltime, :group_id, skill_ids: [])\n end",
"def template_params\n params.require(:email_template).permit(:body, :subject, :action_url, :body_text)\n end",
"def update\n\n respond_to do |format|\n if @template.update(template_params)\n params[:template_fields].each do |p|\n # name: p[0], val: p[1]\n field = Field.find_by(:code => p[0])\n tf = TemplateField.find_by(:field_id => field.id, :template_id => @template.id)\n tf.val = p[1]\n tf.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_updated') }\n else\n format.html { render :edit}\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @template_task = TemplateTask.find(params[:id])\n\n respond_to do |format|\n if @template_task.update_attributes(permitted_params_for_template_task)\n format.html { redirect_to template_tasks_path, notice: 'TemplateTask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attr_template.update(attr_template_params)\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_package_params\n params.require(:template_package).permit(:id,:name)\n end",
"def cv_template_params\n params.require(:cv_template).permit(:content, :for)\n end",
"def configuration_template_params\n params.require(:configuration_template).permit(:name, :description, :blueprint_objects_id,configuration_details_attributes: [:id, :configuration_template_id,\n :configuration_detail_type_id, :configuration_detail_order, :configuration_detail_data, :_destroy])\n end",
"def update\n respond_to do |format|\n if @policy_template.update(policy_template_params)\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully updated.' }\n format.json { render :show, status: :ok, location: @policy_template }\n else\n format.html { render :edit }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def replacement_params\n params.require(:replacement).permit(:label, :template_id, :value_id)\n end",
"def timetable_template_params\n params[:timetable_template].permit(:calendar_id, :beginning)\n end",
"def form_template_params\n params.permit(:name, questions: [:text, :type_id])\n end",
"def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to template_path(@template), notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end",
"def invitation_template_params\n params.require(:invitation_template).permit(:subject, :body)\n end",
"def update\n respond_to do |format|\n if @form_template.update(form_template_params)\n format.html { redirect_to @form_template, notice: 'Formularvorlage wurde erfolgreich aktualisiert' }\n format.json { render :show, status: :ok, location: @form_template }\n else\n format.html { render :edit }\n format.json { render json: @form_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @question_template.update(question_template_params)\n format.html { redirect_to @question_template, notice: 'Question template was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_template }\n else\n format.html { render :edit }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def track_template_params\n params.require(:track_template).permit(:name, :order, :course_id, :description)\n end",
"def update\n respond_to do |format|\n if @survey_template.update(survey_template_params)\n format.html { redirect_to @survey_template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_template }\n else\n @record = @survey_template\n format.html { render :edit }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_template.update_attributes(params[:admin_kpi_template])\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_template_params\n params.require(:item_template).permit(:name, :description, :category, :edible, :edible_size, :value, :is_equipment, :durability, :equip_crafting, :equip_gathering, :equip_mining, :equip_hunting, :equip_smithing, :equip_intelligence, :equip_dexterity, :equip_strength, :equip_perception, :equip_stamina, :equip_athletics, :equip_thieving, :equip_fishing, :equip_lumberjacking, :equip_stealth, :equip_wits, :recycle_ingredients)\n end",
"def company_template_params\n params.require(:company_template).permit(:company_id, :name)\n end",
"def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def rcadmin_email_template_params\n params.require(:rcadmin_email_template).permit(:template_name, :message_body)\n end",
"def doc_template_params\n params.require(:doc_template).permit(:title, :description)\n end",
"def template_library_params\n params[:template_library].permit(:title)\n end"
] |
[
"0.6794625",
"0.6715387",
"0.6703962",
"0.6687731",
"0.6676661",
"0.6643516",
"0.6575711",
"0.65139043",
"0.64831734",
"0.6481081",
"0.647267",
"0.64623845",
"0.643813",
"0.6415583",
"0.6404235",
"0.63733083",
"0.63363975",
"0.6301192",
"0.62853247",
"0.6284641",
"0.6277641",
"0.6270366",
"0.62480146",
"0.61958694",
"0.61917603",
"0.61903137",
"0.61507535",
"0.614542",
"0.6136552",
"0.612872",
"0.61228144",
"0.6114629",
"0.6086221",
"0.6079902",
"0.6065409",
"0.6065379",
"0.60543835",
"0.60412526",
"0.60275537",
"0.6023098",
"0.60229087",
"0.5997371",
"0.5996636",
"0.59912205",
"0.5986131",
"0.5978698",
"0.5971605",
"0.5970048",
"0.5952396",
"0.5927971",
"0.5922543",
"0.59224963",
"0.5919673",
"0.5919673",
"0.5896066",
"0.58889055",
"0.5877362",
"0.58730394",
"0.5869416",
"0.5868463",
"0.5848485",
"0.58320975",
"0.5829273",
"0.58223605",
"0.5812834",
"0.5798565",
"0.57952523",
"0.57786715",
"0.57743067",
"0.57722926",
"0.57698613",
"0.5768921",
"0.5762078",
"0.5762078",
"0.57332104",
"0.5732324",
"0.5731598",
"0.5729569",
"0.5724334",
"0.57197624",
"0.56997055",
"0.5698829",
"0.5697213",
"0.56909436",
"0.5686219",
"0.568514",
"0.56809944",
"0.56775075",
"0.5670371",
"0.56636345",
"0.56526506",
"0.56490964",
"0.5641474",
"0.56326073",
"0.5631458",
"0.5629051",
"0.56280607",
"0.561926",
"0.5618392",
"0.56179523",
"0.5614981"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_network_station
@network_station = NetworkStation.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def setup_signals; end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def network_station_params
params.require( :network_station ).permit(
:code, :alt_code, :curr_name, :prev_name, :transfer, :note,
network_stops_attributes:
[ :id, :_destroy, :stop_no, :code, :location_code_id, :note, :network_line_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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def txn_id
authorization
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7252171",
"0.7252171",
"0.7214979",
"0.7039693",
"0.68865967",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6734289",
"0.66869515",
"0.66867787",
"0.6679561",
"0.6537663",
"0.6526972",
"0.6526972",
"0.6521493",
"0.6478853",
"0.6440719",
"0.6440674",
"0.6419345",
"0.6401749",
"0.6333073",
"0.6327783",
"0.63196623",
"0.62885654",
"0.62746304",
"0.62443566",
"0.6237035",
"0.62151843",
"0.62151843",
"0.621027",
"0.620477",
"0.6192693",
"0.6179644",
"0.6179644",
"0.6179644",
"0.6137317",
"0.611742",
"0.611742",
"0.6106731",
"0.60959715",
"0.60941684",
"0.6093287",
"0.6078168",
"0.6077469",
"0.6076455",
"0.6076455",
"0.6075431",
"0.606338",
"0.606338",
"0.60557896",
"0.60557896",
"0.60557896",
"0.6047512",
"0.6047457",
"0.60335755",
"0.6002603",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def first_reference_id
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7252171",
"0.7252171",
"0.7214979",
"0.7039693",
"0.68865967",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6734289",
"0.66869515",
"0.66867787",
"0.6679561",
"0.6537663",
"0.6526972",
"0.6526972",
"0.6521493",
"0.6478853",
"0.6440719",
"0.6440674",
"0.6419345",
"0.6401749",
"0.6333073",
"0.6327783",
"0.63196623",
"0.62885654",
"0.62746304",
"0.62443566",
"0.6237035",
"0.62151843",
"0.62151843",
"0.621027",
"0.620477",
"0.6192693",
"0.6179644",
"0.6179644",
"0.6179644",
"0.6137317",
"0.611742",
"0.611742",
"0.6106731",
"0.60959715",
"0.60941684",
"0.6093287",
"0.6078168",
"0.6077469",
"0.6076455",
"0.6076455",
"0.6075431",
"0.606338",
"0.606338",
"0.60557896",
"0.60557896",
"0.60557896",
"0.6047512",
"0.6047457",
"0.60335755",
"0.6002603",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def second_reference_id
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.72522223",
"0.72522223",
"0.721495",
"0.7039866",
"0.68866545",
"0.6809293",
"0.6809293",
"0.6809293",
"0.6809293",
"0.67343366",
"0.6686862",
"0.6686709",
"0.6679598",
"0.65377825",
"0.6527068",
"0.6527068",
"0.6521526",
"0.64788234",
"0.64407295",
"0.6440593",
"0.64194727",
"0.64017504",
"0.6333266",
"0.6328063",
"0.6319626",
"0.62886745",
"0.6274616",
"0.62444705",
"0.6237083",
"0.6215454",
"0.6215454",
"0.6210418",
"0.6204929",
"0.61925703",
"0.6179775",
"0.6179775",
"0.6179775",
"0.6137448",
"0.61174774",
"0.61174774",
"0.61068743",
"0.609592",
"0.6094282",
"0.6093172",
"0.6078227",
"0.60776013",
"0.6076615",
"0.6076615",
"0.6075562",
"0.60634565",
"0.60634565",
"0.60559124",
"0.60559124",
"0.60559124",
"0.60476387",
"0.60475045",
"0.6033495",
"0.6002537",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988",
"0.599988"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def effective_date
created_at
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7252171",
"0.7252171",
"0.7214979",
"0.7039693",
"0.68865967",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6734289",
"0.66869515",
"0.66867787",
"0.6679561",
"0.6537663",
"0.6526972",
"0.6526972",
"0.6521493",
"0.6478853",
"0.6440719",
"0.6440674",
"0.6419345",
"0.6401749",
"0.6333073",
"0.6327783",
"0.63196623",
"0.62885654",
"0.62746304",
"0.62443566",
"0.6237035",
"0.62151843",
"0.62151843",
"0.621027",
"0.620477",
"0.6192693",
"0.6179644",
"0.6179644",
"0.6179644",
"0.6137317",
"0.611742",
"0.611742",
"0.6106731",
"0.60959715",
"0.60941684",
"0.6093287",
"0.6078168",
"0.6077469",
"0.6076455",
"0.6076455",
"0.6075431",
"0.606338",
"0.606338",
"0.60557896",
"0.60557896",
"0.60557896",
"0.6047512",
"0.6047457",
"0.60335755",
"0.6002603",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def gateway_error
message
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7252171",
"0.7252171",
"0.7214979",
"0.7039693",
"0.68865967",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6734289",
"0.66869515",
"0.66867787",
"0.6679561",
"0.6537663",
"0.6526972",
"0.6526972",
"0.6521493",
"0.6478853",
"0.6440719",
"0.6440674",
"0.6419345",
"0.6401749",
"0.6333073",
"0.6327783",
"0.63196623",
"0.62885654",
"0.62746304",
"0.62443566",
"0.6237035",
"0.62151843",
"0.62151843",
"0.621027",
"0.620477",
"0.6192693",
"0.6179644",
"0.6179644",
"0.6179644",
"0.6137317",
"0.611742",
"0.611742",
"0.6106731",
"0.60959715",
"0.60941684",
"0.6093287",
"0.6078168",
"0.6077469",
"0.6076455",
"0.6076455",
"0.6075431",
"0.606338",
"0.606338",
"0.60557896",
"0.60557896",
"0.60557896",
"0.6047512",
"0.6047457",
"0.60335755",
"0.6002603",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404"
] |
0.0
|
-1
|
Override in your plugin if needed
|
def gateway_error_code
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def plugin_setup!; end",
"def overrides; end",
"def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def plugin(name); end",
"def plugin_manager; end",
"def special\n override\n end",
"def private; end",
"def run\n super\n end",
"def run\n super\n end",
"def tag; raise 'Override this method'; end",
"def plugins=(_arg0); end",
"def extra; end",
"def extended(*) end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def after_initialize(plugins); end",
"def around_hooks; end",
"def proxy\n super\n end",
"def load_plugins; end",
"def use(*)\n super\n end",
"def plugin_hash; end",
"def source(override); end",
"def supercommand!() __supercommand__ end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def before_each\n super if defined?(super)\n end",
"def set_functions\n super\n end",
"def plugin_manager=(_arg0); end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def exec\n super\n end",
"def implementation; end",
"def implementation; end",
"def before_all\n super if defined?(super)\n end",
"def blog_on_upgrade(plugin)\r\n end",
"def initialize()\n # override parent\n end",
"def plugin_id; end",
"def wrapper; end",
"def main\n super\n return self\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize settings\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def super_method; end",
"def before_run; end",
"def _add(plugin); end",
"def add(plugin); end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.7252171",
"0.7252171",
"0.7214979",
"0.7039693",
"0.68865967",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6809317",
"0.6734289",
"0.66869515",
"0.66867787",
"0.6679561",
"0.6537663",
"0.6526972",
"0.6526972",
"0.6521493",
"0.6478853",
"0.6440719",
"0.6440674",
"0.6419345",
"0.6401749",
"0.6333073",
"0.6327783",
"0.63196623",
"0.62885654",
"0.62746304",
"0.62443566",
"0.6237035",
"0.62151843",
"0.62151843",
"0.621027",
"0.620477",
"0.6192693",
"0.6179644",
"0.6179644",
"0.6179644",
"0.6137317",
"0.611742",
"0.611742",
"0.6106731",
"0.60959715",
"0.60941684",
"0.6093287",
"0.6078168",
"0.6077469",
"0.6076455",
"0.6076455",
"0.6075431",
"0.606338",
"0.606338",
"0.60557896",
"0.60557896",
"0.60557896",
"0.6047512",
"0.6047457",
"0.60335755",
"0.6002603",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404",
"0.59997404"
] |
0.0
|
-1
|
authorization was the old name (reserved on PostgreSQL) make sure we support both column names for backward compatibility
|
def authorization=(auth)
write_attribute(column_for_attribute('authorization').name, auth)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_column\n end",
"def database_field_names\n [\"user_id\", \"assignment_id\"]\n end",
"def quote_column_name(name) #:nodoc:\n name.to_s =~ /[A-Z]/ ? \"\\\"#{name}\\\"\" : quote_oracle_reserved_words(name)\n end",
"def apply_devise_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end",
"def valid_column_names\n all_valid_column_names = (self.respond_to?(:column_names) ? self.column_names : (self.respond_to?(:fields) ? self.fields.keys : []))\n all_valid_column_names - %w(created_at updated_at)\n end",
"def authenticated?(column, token)\n self[column] == token ? true : false\n end",
"def column_name; end",
"def real_column; end",
"def escape_col(name)\n raise \"Possible SQL injection hack: '#{name}'.\" unless name.to_s.match(/\\A[A-z\\d_]+\\Z/)\n return name\n end",
"def column_names\n raise NotSupportedError\n end",
"def sid_column\n end",
"def authorization_mode; end",
"def authorization; end",
"def remote_query_column_types\n raise \"You must override `remote_query_column_types' in your class\"\n end",
"def exsiting_columns_for_audit\n columns_for_audit & self.column_names\n end",
"def user_column\n IdMethods::USER_COLUMN\n end",
"def chooseColumnAlias\n @metadata.chooseColumnAlias\n end",
"def sharded_column\n @sharded_column\n end",
"def sql_modes; end",
"def audit_columns(*columns)\n cattr_accessor :_audit_columns\n self._audit_columns = columns.map(&:to_s) & valid_column_names\n end",
"def user_column_headers\n %i(id first_name last_name email created_at updated_at).freeze\n end",
"def quote_column_if_needed(column)\n column.to_s =~ /\\A[a-z0-9_]+\\z/ ? column : connection.quote_column_name(column)\n end",
"def column_name\n name.to_sym\n end",
"def has_roles_mask_accessors?\n active_record_table_exists? && column_names.include?(roles_attribute_name.to_s) || super\n end",
"def query_columns\n explicit_columns\n end",
"def quote_column_name(name)\n name.to_s\n end",
"def has_roles_mask_accessors?\n active_record_table? && column_names.include?(roles_attribute_name.to_s) || super\n end",
"def host_authorization=(_arg0); end",
"def host_authorization=(_arg0); end",
"def sortable_columns\n @sortable_columns ||= ['Passport.name']\n end",
"def quote_table_name(name)\n quote_column_name(name)\n end",
"def stradivari_type(column_name)\n raise NotImplementedError\n end",
"def chooseColumn\n @metadata.chooseColumn\n end",
"def supports_named_column_constraints?\n true\n end",
"def column_sql\n column_sql_format.gsub(\"{table}\", quoted_table_name).gsub(\"{column}\", quoted_column_name)\n end",
"def authentication_type=(_arg0); end",
"def quote_column_name_or_expression(name) # :nodoc:\n name = name.to_s\n case name\n # if only valid lowercase column characters in name\n when /^[a-z][a-z_0-9$#]*$/\n \"\\\"#{name.upcase}\\\"\"\n when /^[a-z][a-z_0-9$#-]*$/i\n \"\\\"#{name}\\\"\"\n # if other characters present then assume that it is expression\n # which should not be quoted\n else\n name\n end\n end",
"def authentication_type; end",
"def protect_column!\n write_raw \"\\x1bV\"\n end",
"def user_column_fields\n %i(id first_name last_name email created updated).freeze\n end",
"def quote_column_if_needed(column); end",
"def sanitize_columns!\n column_names = @db_connection.schema(@current_name, {:schema => @target_schema}).map{ |s| s[0].to_s }\n sanitize(column_names)\n end",
"def host_authorization; end",
"def host_authorization; end",
"def quote_column_name(name) #:nodoc:\r\n %Q(\"#{name}\")\r\n end",
"def quote_returning_column_names(table_ref, pk, action)\n returning_columns = []\n returning_columns << pk if suppress_composite_primary_key(pk)\n returning_columns += ApplicationRecord.custom_returning_columns(table_ref, action)\n returning_columns.map { |column| quote_column_name(column) }\n end",
"def allowed_keys\n field_names - [id_column]\n end",
"def column_params\n params.require(:column).permit(:name, :ident)\n end",
"def synthetic_columns\n @columns ||= [:id]\n end",
"def quote_identifier_append(sql, name)\n name = (table_mappings[name.to_sym] || name) if name.respond_to?(:to_sym)\n super(sql, name)\n end",
"def boolean_expr safe_column_name\n safe_column_name\n end",
"def capable_auth_types; end",
"def authorization_mode=(mode); end",
"def thriver_params\n params.require(:thriver).permit(User.column_names)\n end",
"def valid_column?(column_name)\n column_name && self.class.sortable_attributes.include?(column_name)\n end",
"def column \n \"ANY\"\n end",
"def columns(table_name, name = nil) end",
"def expected_columns; end",
"def type_authorization!()\n @type = TAC_PLUS_AUTHOR\n end",
"def validate_column(column)\n unless column.is_a?(Symbol) || column.is_a?(Arel::Nodes::SqlLiteral)\n column = column.to_s\n unless /\\A\\w+(\\.\\w+)?\\z/i.match(column)\n warn \"[groupdate] Non-attribute argument: #{column}. Use Arel.sql() for known-safe values. This will raise an error in Groupdate 6\"\n end\n end\n column\n end",
"def permission_mapping\n super.merge(\n {\n 'index_role_screen' => 'index',\n 'index_role_field' => 'index',\n 'index_user_screen' => 'index',\n 'index_user_field' => 'index',\n 'fetch_row' => 'index'\n }\n )\n end",
"def synthetic_column(name)\n name = name.to_sym\n raise \"Column #{name.inspect} already configured\" if synthetic_columns.include?(name)\n synthetic_columns.push name\n attr_reader name\n end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def method_missing(header, *args)\n\t header = header.to_sym\n\t if HEADER.include? header #If columns is allowed else print stacktrace\n\t \targs.first[HEADER[header]]\n\t else\n\t p \"#{header} method is missing! Column does not exist or not allowed.\"\n\t end\n \tend",
"def sql_for_columns; @sql_for_columns end",
"def quote_column_name(name)\n %[\"#{name.to_s.gsub('\"', '\"\"')}\"]\n end",
"def quote_column_name(name) #:nodoc:\n '[' + name.to_s + ']'\n end",
"def quote_column_name(name) #:nodoc:\n \"\\\"#{name}\\\"\"\n #query(\"SELECT QUOTE_IDENT('#{name}')\")[0][0]\n end",
"def sys_admin_params\n params.require(:sys_admin).permit(Admin.column_names)\n end",
"def arel_attribute(column_name, table = arel_table)\n super\n end",
"def role; end",
"def role; end",
"def def_bad_column_accessor(column)\n overridable_methods_module.module_eval do\n define_method(column){self[column]}\n define_method(\"#{column}=\"){|v| self[column] = v}\n end\n end",
"def def_bad_column_accessor(column)\n overridable_methods_module.module_eval do\n define_method(column){self[column]}\n define_method(\"#{column}=\"){|v| self[column] = v}\n end\n end",
"def treat_reserved_as_conflict; end",
"def auth_param; end",
"def validate_query_table_column(query, table, column_name, allowed)\n validate_query(query)\n validate_table(table)\n validate_name(column_name, allowed)\n end",
"def user_columns\n case current_user.role\n # Admin\n when 0\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"mee_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"semester\", \"true\"]]\n # Academic\n when 2\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"level\", \"true\"],[\"mee_lead\", \"true\"],[\"uni_module\", \"true\"],[\"module_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"programmes\", \"true\"],[\"semester\", \"true\"]]\n # Technician\n when 1\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"last_risk_assessment\", \"true\"],[\"mee_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"semester\", \"true\"],[\"technician\", \"true\"]]\n end\n end",
"def encrypted_column?(attribute)\n encrypted_columns.include?(attribute)\n end",
"def check_query_def\n # check if filters match possible column names\n cn = columns.collect { |c| c[:id] }\n @query_def.filters.each_pair do |f,v|\n raise Cuca::ApplicationException.new(\"Unknown column in filters: #{f}\") unless cn.include?(f)\n end\n \n return if @query_def.order_by == ''\n # check if order_by is a valid column\n raise Cuca::ApplicationException.new(\"Unknown sort order: #{@query_def.order_by}\") \\\n unless cn.include?(@query_def.order_by)\n end",
"def preconditions\n ActiveRecord::VERSION::MAJOR >= 6 &&\n Helper.postgresql? &&\n primary_field? &&\n column.sql_type.to_s.match(TARGET_COLUMN_TYPE)\n end",
"def authorizable_ransackable_attributes\n if Ransack::SUPPORTS_ATTRIBUTE_ALIAS\n column_names + _ransackers.keys + _ransack_aliases.keys +\n attribute_aliases.keys\n else\n column_names + _ransackers.keys + _ransack_aliases.keys\n end.uniq\n end",
"def authorization_params\n params.require(:authorization).permit(:user_id, :authorizer_id, :room_id, :date_register, :date_expiration)\n end",
"def user_sort_column\n institution_sort = SortableTable::SortColumnDefinition.new('tenant_id')\n name_sort = SortableTable::SortColumnCustomDefinition.new('name',\n asc: 'last_name asc, first_name asc',\n desc: 'last_name desc, first_name desc')\n role_sort = SortableTable::SortColumnDefinition.new('role')\n login_time_sort = SortableTable::SortColumnDefinition.new('last_login')\n sort_table = SortableTable::SortTable.new([name_sort, institution_sort, role_sort, login_time_sort])\n sort_table.sort_column(params[:sort], params[:direction])\n end",
"def columns\n Proc.new do\n <<-SQL\n id integer primary key autoincrement,\n sample_id integer, --foreign key to reference the original revision\n \n --these are all true contemporaneous of the edit, post or pre-edit may be different\n account_creation timestamp(20), --this should be the entry in the logevents call, but if we exceed the max number of requests, we won't get it\n account_lifetime integer, --this is the lifetime of the account in seconds\n edits_last_second integer, --want a figure to show recent activity do buckets instead\n edits_last_minute integer,\n edits_last_hour integer,\n edits_last_day integer,\n edits_last_week integer,\n edits_last_month integer,\n edits_last_year integer,\n total_edits integer,\n --rights_grant_count \n --rights_removal_count\n --groups string,\n FOREIGN KEY(sample_id) REFERENCES irc_wikimedia_org_en_wikipedia(id) --these foreign keys probably won't be enforced b/c sqlite doesn't include it by default--TODO this foreign table name probably shouldn't be hard coded\nSQL\n end\n end",
"def authorization(*args, &block); end",
"def sql_state; end",
"def column_params\n params.require(:column).permit(:name)\n end",
"def column_attrs\n attrs = {}\n\n attrs[\"Last Name\"] = :last_name\n attrs[\"First Name\"] = :first_name\n attrs[\"Email\"] = :email\n attrs[\"Institution\"] = \"try(:professional_org_lookup, 'institution')\"\n attrs[\"College\"] = \"try(:professional_org_lookup, 'college')\"\n attrs[\"Department\"] = \"try(:professional_org_lookup, 'department')\"\n attrs[\"Account Created Date\"] = \"self.created_at.try(:strftime, \\\"%D\\\")\"\n attrs[\"ID\"] = :id\n attrs[\"LDAP_UID\"] = :ldap_uid\n attrs[\"Approved/Activated?\"] = \"self.approved? ? \\\"Y\\\" : \\\"N\\\"\"\n attrs[\"Overlord?\"] = \"self.catalog_overlord? ? \\\"Y\\\" : \\\"N\\\"\"\n\n attrs\n end",
"def table_modifier_in_create(o)\n # A table cannot be both TEMPORARY and UNLOGGED, since all TEMPORARY\n # tables are already UNLOGGED.\n if o.temporary\n \" TEMPORARY\"\n elsif o.unlogged\n \" UNLOGGED\"\n end\n end",
"def change\n add_column :patients, :email, :string\n add_column :patients, :age, :integer\nend",
"def valid_alter_table_options( type, options )\n type.to_sym != :primary_key\n end",
"def target_sql_mode=(_arg0); end",
"def sort_column\n User.column_names.include?(params[:sort]) ? params[:sort] : \"login\"\n end"
] |
[
"0.5971746",
"0.57667255",
"0.57075953",
"0.5650925",
"0.56270224",
"0.5616921",
"0.55897886",
"0.55709803",
"0.5557525",
"0.555246",
"0.5485987",
"0.54859143",
"0.5479747",
"0.5457133",
"0.5437254",
"0.5431934",
"0.5423345",
"0.5406831",
"0.53949785",
"0.53318673",
"0.52892053",
"0.528727",
"0.5262946",
"0.52510494",
"0.5249463",
"0.52309823",
"0.52276796",
"0.5226657",
"0.5226657",
"0.52241975",
"0.5221845",
"0.5219543",
"0.5218098",
"0.5209972",
"0.52017695",
"0.51973164",
"0.5196049",
"0.51725125",
"0.51558185",
"0.5154627",
"0.5151632",
"0.5145364",
"0.5136749",
"0.5136749",
"0.51286167",
"0.512698",
"0.51225436",
"0.51216894",
"0.5108657",
"0.5106843",
"0.50951934",
"0.50759935",
"0.5070122",
"0.5067448",
"0.5065317",
"0.5065166",
"0.506342",
"0.5058188",
"0.5052765",
"0.5049566",
"0.50291383",
"0.5021598",
"0.5019412",
"0.5019412",
"0.5019412",
"0.5019412",
"0.5019412",
"0.5019412",
"0.5019412",
"0.50136673",
"0.5009143",
"0.5007326",
"0.49956304",
"0.49944162",
"0.49937865",
"0.4993466",
"0.49881777",
"0.49881777",
"0.49821925",
"0.49821925",
"0.49811244",
"0.49747217",
"0.49729505",
"0.4972412",
"0.49665612",
"0.4961373",
"0.49605447",
"0.4958511",
"0.49583808",
"0.4958025",
"0.49561405",
"0.49463722",
"0.4937025",
"0.49362552",
"0.4930559",
"0.49295884",
"0.49278766",
"0.49230933",
"0.4922651",
"0.49158925"
] |
0.5549644
|
10
|
The Game Initializing variables
|
def new_game
set_player
if human_player?
start_message(:welcome)
set_grid
puts
set_bombs
else #non-human
start_message(:robot_game)
@robot = Robot.new()
@grid_size = @robot.grid_size
@num_bombs = @robot.num_bombs
end
@play_again = true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def game_setup\n end",
"def game_init\r\n state(0)\r\n @game_deck.create_new_deck\r\n @player_deck = {}\r\n @dealer_deck = {}\r\n @player.points = 0\r\n @dealer.points = 0\r\n end",
"def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end",
"def start\n $game_variables[VAR] = {}\n $game_variables[VAR2] = {}\n @load_hash = nil\n @load_item_hash = nil\n @item_amounts = {}\n save_turn_data\n end",
"def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend",
"def main_variable\r\n super\r\n main_battledata # Setup Battle Temp Data & Interpreter\r\n main_troopdata # Setup Troop Data\r\n # Initialize wait count\r\n @wait_count = 0\r\n end",
"def initialize_game\n setup_boards\n end",
"def initialize\r\n @player_number = 1\r\n @turn = 0\r\n @draw = false # set the game to a draw\r\n @finished = false # bool value to end the game\r\n $arr =[false,false,false,false,false,false,false,false,false] # array to hold which value is occupied in the grid\r\n $letter_grid =[['','',''],['','',''],['','','']] # grid so that letters can be placed inside by the user\r\n end",
"def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end",
"def initialize\n @name_boy = default_male_name\n @name_girl = default_female_name\n $game_switches[Yuki::Sw::Gender] = @playing_girl = false\n $game_variables[Yuki::Var::Player_ID] = @id_boy = rand(0x3FFFFFFF)\n @id_girl = (@id_boy ^ 0x28F4AB4C)\n @start_time = Time.new.to_i\n @play_time = 0\n @badges = Array.new(6 * 8, false)\n @region = 0\n @game_version = PSDK_CONFIG.game_version\n @current_version = PSDK_Version rescue 0\n @time_counter = 0\n load_time\n end",
"def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end",
"def initialize(*args)\n super\n @game = Game.new\n\n @changelog = self.load_changelog\n\n @mods = config[:mods]\n @channel_name = config[:channel]\n @settings_file = config[:settings]\n @games_dir = config[:games_dir]\n\n @idle_timer_length = config[:allowed_idle]\n @invite_timer_length = config[:invite_reset]\n\n @idle_timer = self.start_idle_timer\n\n @game_timer_minutes = nil\n @game_timer = nil\n end",
"def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def setup\n @potential_plays = [\"rock\", \"paper\", \"scissors\"]\n @win_counter = Hash[\"P1\",0, \"P2\",0]\n end",
"def defaults\n state.flash_at ||= 0\n state.zombie_min_spawn_rate ||= 60\n state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate\n state.zombies ||= []\n state.killed_zombies ||= []\n\n # Declares player as a new entity and sets its properties.\n # The player begins the game in the center of the screen, not moving in any direction.\n state.player ||= state.new_entity(:player, { x: 640,\n y: 360,\n attack_angle: 0,\n dx: 0,\n dy: 0 })\n end",
"def initialize (money, life, fights, respect)\n #The health bar of the player, when the health gets down to 0 the player loses.\n @life = life\n #The wealth that the player has amassed throughout the game.\n @money = money\n #Respect that the player has earned winning fights in the game\n @respect = respect\n #Number of fight events that the player has won.\n @fights = fights\n #List of states for the game.\n @states = []\n\tend",
"def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game => self})\n\tend",
"def initialize()\n @sides = DEFAULTS[:sides]\n @num_dice = DEFAULTS[:num_dice]\n @players = DEFAULTS[:players]\n @speed = DEFAULTS[:speed]\n @target_score = DEFAULTS[:target_score]\n end",
"def initialize_globals(game)\n\n $available_letters = \"abcdefghijklmnopqrstuvwxyz\".split(\"\")\n $missed_letters = []\n\n if game.downcase == \"back\" \n\t$is_get_level = true\n\n elsif game.downcase == \"restart\"\n\t$is_get_level = false\n end\n\n $is_eof_game = false\n $guessed_word = [\"_\"]\n $word = \"\"\nend",
"def initialize_game\n p '########################################################################################'\n p '########################################################################################'\n p 'Bienvenu dans le Tic-Tac-Toe !'\n p 'Le plateau se décrit de la manière suivante :'\n p ' 1 | 2 | 3 '\n p ' ----------'\n p ' 4 | 5 | 6 '\n p ' ----------'\n p ' 7 | 8 | 9 '\n p 'A chaque tour, un des joueurs doit séléctionner la case ou il veut rentrer son symbole.'\n p 'Le premier joueur est les ronds, le second est les croix.'\n p 'Le jeu commence une fois que chaque joueur a inscrit son prénom.'\n p '########################################################################################'\n p '########################################################################################'\n @nb_tour = 1\n end",
"def initialize\n @screen = Game_Screen.new\n @interpreter = Game_Interpreter.new(0, true)\n @map_id = 0\n @display_x = 0\n @display_y = 0\n create_vehicles\n end",
"def init()\n\t$numCharges = 0\n\t$numGiftCards = 0\n\t$giftCardAmount = 0\n\t$discountPercentage = 0\n\t$total = 0\n\t$labor = 0\nend",
"def initialize\n\t\t@grid = Board.new\n\t\t@player_1 = Player.new\n\t\t@player_2 = Player.new\n\t\t@game_status = true #true means game is still playing\n\t\tassign_players\n\tend",
"def initialize (window, x, y)\n # Establishes a sprite for the palyer\n @image = Gosu::Image.new(window, \"media/Starfighter.bmp\", false)\n # Initializes the x,y and last position\n @x, @y = x, y\n @lastPosX = @lastPosY = @lastShot = 0\n # Initializes x-y-velocity\n @vel_x = @vel_y = 0\n # Stores instance of window\n @window = window\n # Establishes constant velocity for x and y directions\n @VELOCITY = 3\n # Boolean which measures if the ship is dead or not\n @isKill = false\n end",
"def initialize()\n original_dir = Dir.pwd\n Dir.chdir(__dir__)\n\n classes_before = ObjectSpace.each_object(Class).to_a\n Dir[\"../model/game/*\"].each {|file|\n require_relative file\n }\n Dir.chdir(original_dir)\n\n classes_after = ObjectSpace.each_object(Class).to_a\n @modes_loaded = classes_after - classes_before\n\n @game_started = false\n @observer_views = []\n @players = []\n @clients_players = Hash.new\n @board = nil\n @clients_board = nil\n @player_playing = nil\n @clients_player_playing_index = nil\n @AI_players = 0\n # http://docs.ruby-lang.org/en/2.0.0/Hash.html\n @game_history = Hash.new(-1)\n @turn = 1\n @online_mode = false\n @player_name = nil\n @player_id = 1\n @save_requests_received = Hash.new(0)\n @turn_which_save_was_requested = -1\n @continuing_game = false\n end",
"def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end",
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def setup\n\t\tsuper\n\t\t@x = 400\n\t\t@y = 300\n\t\t#@image = Gosu::Image[\"Ship.png\"]\n\t\t self.input = {\n\t\t \tholding_left: :left,\n\t\t \tholding_right: :right,\n\t\t \tholding_up: :up,\n\t\t \tholding_down: :down,\n\t\t \tspace: :fire\n\t\t }\n\t\t@speed = 10\n\t\t@angle = 0\n\t\t@animation = Chingu::Animation.new(:file => \"flame_48x48.bmp\")\n\t\t@animation.frame_names = { :still =>0..1, :up =>2..5, :fire =>6..7}\n# :still =>0..1, :fire =>6..7, :up =>2..5\n\t\t@frame_name = :still\n\t\t@last_x, @last_y = @x, @y\n\tend",
"def at_init\n\n\t\tend",
"def initialize # Demande les paramètres aux joueurs\n puts \"Welcome to the BDX Tic-Tac-Toe ! Have fun with our progZ !\"\n @p_one = Player.new\n @p_one.infos\n @p_two = Player.new\n @p_two.infos\n @board_game = Board.new\n end",
"def initialize()\r\n\t\t@time = Timer.new # the time the user has made\r\n\t\t@penalty = Penalty.new # the penalty time on the map\r\n\t\tself.reset()\r\n\tend",
"def initialize\n greeting\n init_players\n end",
"def init(msg)\n msg.reply('Game starting! You have 5 tries! Submit an answer by using $game guess followed by a number!'.freeze)\n @started = true\n @random_number = rand(100)\n @tries = 0\n end",
"def initialize\n\t\tsystem \"clear\"\n\t\tputs \"Lets play hangman!\"\n \t\t@guess_count = 0\n \t\t@game_status = false\n \t\t@guessed_letters=[]\n \t\t@guessing_word=[]\n \tend",
"def initialize\n @next_scene = nil\n @map_bgm = nil\n @map_bgs = nil\n @common_event_id = 0\n @in_battle = false\n @battle_proc = nil\n @shop_goods = nil\n @shop_purchase_only = false\n @name_actor_id = 0\n @name_max_char = 0\n @menu_beep = false\n @last_file_index = 0\n @debug_top_row = 0\n @debug_index = 0\n @background_bitmap = Bitmap.new(1, 1)\n end",
"def initialize settings={:x => 0, :y => 0, :width => 0, :height => 0, :life => 1, :depth => 0}\n\t\t\ts = {:x => 0, :y => 0, :width => 0, :height => 0, :life => 1, :depth => 0}.merge! settings\n\t\t\tUtil.hash_to_var(s, [:x, :y, :width, :height, :life, :depth], self)\n\t\t\t@@game.add self\n\t\tend",
"def initialize # utilise la classe player pour demander les infos aux joueurs et la classe baord pour lancer la tipar\n puts \" The Houmous Project présente Morbac\"\n @player_one = Player.new\n @player_one.informations\n @player_two = Player.new\n @player_two.informations\n @boboard = Board.new\n end",
"def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end",
"def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend",
"def init\n self.current_time ||= 1800\n self.setting_time ||= 1800\n self.enabled ||= true\n self.state ||= false\n self.mode ||= 'auto'\n end",
"def defaults args\n fiddle args\n args.state.enemy.hammers ||= []\n args.state.enemy.hammer_queue ||= []\n args.state.tick_count = args.state.tick_count\n args.state.bridge_top = 128\n args.state.player.x ||= 0 # initializes player's properties\n args.state.player.y ||= args.state.bridge_top\n args.state.player.w ||= 64\n args.state.player.h ||= 64\n args.state.player.dy ||= 0\n args.state.player.dx ||= 0\n args.state.enemy.x ||= 800 # initializes enemy's properties\n args.state.enemy.y ||= 0\n args.state.enemy.w ||= 128\n args.state.enemy.h ||= 128\n args.state.enemy.dy ||= 0\n args.state.enemy.dx ||= 0\n args.state.game_over_at ||= 0\nend",
"def initialize\r\n\t\t# another way of making an array\r\n\t\t@words = %w\"learning lollipop education image computer mobile january february friday flower beauty light earth machine book\r\n\t\tnews yahoo google internet bangladesh india america cricket football friday sunday sunny\"\r\n\t\t@chances_left = 5\r\n\r\n\t\t@game_over = false\r\n\r\n\t\t\r\n\tend",
"def initialize_current_gfx(game_type)\r\n @last_selected_gametype = game_type\r\n # reset the title\r\n initial_board_text\r\n \r\n ##initialize a current local game\r\n init_local_game(game_type)\r\n end",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def initalize\n @deck = Deck.new\n @player = Player.new\n @dealer = Dealer.new\n end",
"def initialize_game\n @winner = false\n @players = DiceGame::Players.new\n @score_table = DiceGame::ScoreTable.new\n @dice = DiceGame::Dice.new\n\n count ||= ask('Please enter number of players, max 3'.yellow)\n @score_table.initialize_scores(@players.number_of_players(count.to_i))\n start_game\n end",
"def initialize\n super\n init_conditions\n init_indexes\n @index = $game_temp.last_menu_index\n @index = 0 if @index >= @image_indexes.size\n @max_index = @image_indexes.size - 1\n @quiting = false # Flag allowing to really quit\n @entering = true # Flag telling we're entering\n @counter = 0 # Animation counter\n @in_save = false\n @mbf_type = @mef_type = :noen if $scene.is_a?(Scene_Map)\n end",
"def initialize\n @imgs = {}\n @global_imgs = {}\n @tilesets = {}\n @global_tilesets = {}\n @sounds = {}\n @global_sounds = {}\n @songs = {}\n @global_songs = {}\n @fonts = {}\n @global_fonts = {}\n\n @prefix = File.expand_path(File.dirname($0)) + '/data/'\n @img_dir = 'img/'\n @tileset_dir = 'tileset/'\n @sound_dir = 'sound/'\n @song_dir = 'song/'\n @font_dir = 'font/'\n @separator = '_'\n @retro_images = false\n end",
"def initialize_players\n\n end",
"def set_game_variables\n\t\tword = @dictionary.random_word\n\t\t@answer_array = word.split('')\n\t\t@blank_word_array = []\n\t\tword.length.times do \n\t\t\t@blank_word_array << \"_\"\n\t\tend\n\t\t@guess_counter = 6\n\t\t@incorrect_array = []\n\tend",
"def initialize_current_gfx(nome_game)\n @log.debug \"**** bot: initialize current gfx #{nome_game}\"\n #p self.app_settings\n select_engine(nome_game)\n #@current_game_gfx = eval(@game_to_play[:class_name]).new()\n # override @game_bot_name only to use a test robot. For a game GameBasebot is enought\n # simply add the new game to @all_games_bots\n \n @current_game_gfx = eval( @game_bot_name ).new #GameBasebot.new\n @current_game_gfx.set_game_info(@game_to_play[:core_name],\n @game_to_play[:alg_name], @game_to_play[:key],\n @game_to_play[:nalgfx_name],\n @login_name)\n @current_game_gfx.net_controller = @control_net_conn\n @current_game_gfx.join_game = @join_game\n #p self.app_settings\n end",
"def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end",
"def initialize( )\n\t\t\t@squares = Hash.new\n\t\t\t@turn = :white\n\t\t\t@en_passant = nil\n\t\t\t\n\t\t\tsetup\n\t\tend",
"def init\n\nend",
"def init_for_battle\n super\n self.song_count = 0\n initialize_anger\n end",
"def Init()\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(game)\n\n array = CompresseGrid.compresse(game)\n @tree = array[0]\n @tent = array[1]\n @grass = array[2]\n\t\t@white = array[3]\n\n\t\t@game = game\n\n\tend",
"def init_public_members\n super\n @trigger = 0\n @list = nil\n @starting = false\n if $game_map.effectus_event_starting == self\n $game_map.effectus_event_starting = nil\n end\n end",
"def init_gamedata\r\n file = File.open(@filename, \"r\")\r\n @time_stamp = file.mtime\r\n @characters = Marshal.load(file)\r\n @frame_count = Marshal.load(file)\r\n @game_system = Marshal.load(file)\r\n @game_switches = Marshal.load(file)\r\n @game_variables = Marshal.load(file)\r\n @total_sec = @frame_count / Graphics.frame_rate\r\n file.close\r\n end",
"def initialize\n @e_tanks = 4\n\n # alive (true) ; defeated (false)\n @bubble_man = false\n @air_man = false\n @quick_man = false\n @wood_man = false\n @crash_man = false\n @flash_man = false\n @metal_man = false\n @heat_man = false\n end",
"def defaults args\n fiddle args\n\n args.state.tick_count = args.state.tick_count\n args.state.bridge_top = 128\n args.state.player.x ||= 0 # initializes player's properties\n args.state.player.y ||= args.state.bridge_top\n args.state.player.w ||= 64\n args.state.player.h ||= 64\n args.state.player.dy ||= 0\n args.state.player.dx ||= 0\n args.state.player.r ||= 0\n args.state.game_over_at ||= 0\n args.state.animation_time ||=0\n\n args.state.timeleft ||=0\n args.state.timeright ||=0\n args.state.lastpush ||=0\n\n args.state.inputlist ||= [\"j\",\"k\",\"l\"]\nend",
"def initialize\n @rooms = { #defines the rooms available for use on each floor\n :upstairs => [\"Master Bedroom\", \"A Guest Room\", \"Tower\", \"Balcony\", \"Observatory\", \"The Hole Room\"],\n :main => [\"Kitchen\", \"Library\", \"Study\", \"Dining Room\", \"Living Room\", \"Vault\"],\n :downstairs => [\"Furnace Room\", \"Chapel\", \"Storage Room\", \"The Pit\"]\n }\n\n @used_rooms = []\n @omen_count = 0 #Omens are a game event that change the story line. Once the omen count reaches 10 the haunt starts\n @player = Character.new\n intro #script\n entry_hall(\"Main Hallway\")\n game\n end",
"def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end",
"def set_initial_values\n now = Time.now\n @first_seen ||= now\n @last_activity ||= now\n @total_connections ||= 0\n @total_time ||= 0\n @money ||= 0\n @donations ||= 0\n @rank ||= 0\n @colour ||= :ansi\n @muffled ||= false\n @history ||= History.new\n @aliases ||= {}\n @ignoring ||= {}\n @ignoring_ips ||= {}\n @drug_strength ||= 0\n @alcohol_units ||= 0\n @onduty = @onduty.nil? ? true : @onduty\n end",
"def initialize \n @letter_count = 0 \n @game_is_over = false\n end",
"def initialize\n super(RESOLUTION[0], RESOLUTION[1], {:update_interval => UP_MS_DRAW, :fullscreen => ISFULLSCREEN})\n $program = self # global pointer to window creation object\n controls_init # prep the input controls scheme manager\n gl_version = glGetString(GL_VERSION).to_s\n gl_version = gl_version.split(' ')\n @openGL_version = Gem::Version.new(gl_version[0])\n puts(\"Using OpenGL version: #{@openGL_version} On a #{gl_version[1]} Driver Version: #{gl_version[2]}\")\n puts(\"*\" * 70)\n @@active_state = Map.new( { :level => \"\" } )\n end",
"def defaults\n state.tile_size = 64\n state.gravity = -0.2\n state.previous_tile_size ||= state.tile_size\n state.x ||= 0\n state.y ||= 800\n state.dy ||= 0\n state.dx ||= 0\n state.world ||= []\n state.world_lookup ||= {}\n state.world_collision_rects ||= []\n end",
"def initialize\n @width = 800\n @width_tiles = @width / 32\n @height = 640\n @height_tiles = @height / 32\n @keys = []\n super(@width, @height, fullscreen = false)\n self.caption = \"Aetheris\"\n\n @spell = Gosu::Image.new(Utils.image_path_for(\"explosion\"), rect: [0, 0, 32 * 3, 32 * 3])\n @spell_cooldown = 0\n @game_name = Gosu::Image.from_text(\"Aetheris\", 100)\n @player = Player.new(self)\n @npc = NPC.new\n @player.warp(300, 200)\n @visibility = { fog: 3 }\n @map = Gosu::Image.new(\"images/map.jpg\")\n @low_grass = @map.subimage(32, 32 * 2, 22, 22)\n @camera = Camera.new(x: 0, y: 0, width: WIDTH, height: HEIGHT)\n @interacting = false\n @spell_avalanche_of_fire = nil\n end",
"def init args\n\n # Create the various objects\n args.state.world = World.new args\n args.state.player = Player.new args\n args.state.turrets = Array.new\n args.state.bullets = Array.new\n\nend",
"def init(num_users)\n (1..num_users).each do |i|\n $score_board[i] = 0\n $user_is_in_game[i] = false\n end\nend",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize args\n\n # Build the scrolling backdrop - for now, the backdrop is split in half because of Reasons.\n divide = args.grid.center_x.div( BACKDROP_WIDTH ) * BACKDROP_WIDTH\n @backdropl_spr = AhnSprite.new \"backdrop\", divide, args.grid.h\n 0.step( args.grid.h, BACKDROP_HEIGHT ).each do |row|\n 0.step( ( divide ) + BACKDROP_WIDTH, BACKDROP_WIDTH ).each do |col|\n @backdropl_spr.sprites << { x: col, y: row, w: BACKDROP_WIDTH, h: BACKDROP_HEIGHT, path: \"sprites/backdrop.png\" }\n end\n end\n @backdropl_spr.x = 0\n\n @backdropr_spr = AhnSprite.new \"backdrop\", args.grid.w - divide, args.grid.h\n 0.step( args.grid.h, BACKDROP_HEIGHT ).each do |row|\n 0.step( ( args.grid.w - divide ) + BACKDROP_WIDTH, BACKDROP_WIDTH ).each do |col|\n @backdropr_spr.sprites << { x: col, y: row, w: BACKDROP_WIDTH, h: BACKDROP_HEIGHT, path: \"sprites/backdrop.png\" }\n end\n end\n @backdropr_spr.x = divide\n\n # Set up the world; leave the player empty, update will spawn him/her\n @player = nil\n @lives = 3\n @player_bullets = []\n\n # Remember the epoch we started at, to trigger enemies at the right time\n @epoch = args.state.tick_count\n @enemy_idx = 0\n @enemy = []\n @enemy_bullets = []\n\n end",
"def initialize\n @mode = game_set_mode\n @turn_obj = Turn.new\n @solution_obj = Solution.new\n @human_solution_obj = HumanSolution.new\n @computer_solve_obj = ComputerSolver.new\n end",
"def initialize\n super\n @op_hand = Array.new\n @my_hand = Array.new\n @unseen = Array.new\n @op_lands = Hash.new\n @discards = Hash.new\n @my_lands = Hash.new\n Game::LANDS.each do |land|\n @op_lands[land] = Array.new\n @discards[land] = Array.new\n @my_lands[land] = Array.new\n end\n moveover\n gameover\n end",
"def post_init\n end",
"def init_public_members\r\n @id = 0\r\n @x = 0\r\n @y = 0\r\n @real_x = 0\r\n @real_y = 0\r\n @tile_id = 0\r\n @character_name = \"\"\r\n @character_index = 0\r\n @move_speed = 4\r\n @move_frequency = 6\r\n @walk_anime = true\r\n @step_anime = false\r\n @direction_fix = false\r\n @opacity = 255\r\n @blend_type = 0\r\n @direction = 2\r\n @pattern = 1\r\n @priority_type = 1\r\n @through = false\r\n @bush_depth = 0\r\n @animation_id = 0\r\n @balloon_id = 0\r\n @transparent = false\r\n end",
"def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end",
"def initialize\r\n\t super(0,Graphics.height-WIN_HEIGHT,Graphics.width,WIN_HEIGHT)\r\n\t @x, @y, @i = 10, 50, 0\r\n\t @party_size = $game_party.all_members.size\r\n contents.font.size = FONT_SIZE\r\n\t self.back_opacity = WIN_OPACITY\r\n self.opacity = FRAME_OPACITY\r\n @actor_hp = []\r\n @actor_mp = []\r\n\t fhiz_hud\r\n\t check_visible\r\n end",
"def setup(numPlayers, myIndex, suspects, locations, weapons)\n @@numPlayers = numPlayers\n @myIndex = myIndex\n @suspects = suspects.clone\n @locations = locations.clone\n @weapons = weapons.clone\n @cards = Array.new\n @inGame = true\n end",
"def initialize level\n\t\t@tile_size = 32\n\t\t@level = level + 1\n\t\t@num_enemies = 0\n\t\tloadlevel\n\t\tloadgraphics\n\t\tinterpret\n\t\tcreate_tiles\n\t\tfind_player_index\n\t\t@travel = 0\n\tend",
"def initialize\n super(640, 400, false)\n self.caption = 'Tennis Game'\n\n @player = Player.new(self)\n @player2 = Player2.new(self)\n @help = TextBox.new(self, \"Press O to activate 2P\", 193, 500)\n @bot = Bot.new(self)\n @ball = Ball.new(self)\n @wall = Wall.new(self)\n @score = Score.new(self)\n @twoplayer = false\n @game_over = false\n\n @music = Gosu::Song.new('media/rick.ogg')\n # @music.play(true)\n end",
"def initialize \n\t\t@alive #checking they're alive\n\t\t\tputs \"I am alive\"\n\t\t@health=150 #initialize that all mammals start at 150\n\t\tself\n\tend",
"def initialize(window)\n @terrain = Gosu::Image::load_tiles(window, \"media/Terrain.png\", TILE_WIDTH, TILE_HEIGHT * 2, true)\n @window = window\n\n @level = 0\n\n @start_x = 0\n @start_y = 0\n\n load_level(\"levels/level0.lvl\")\n end",
"def initialize\n self.player_hash = {}\n self.user_hash = {}\n self.playing_user_names=[]\n self.started = false\n self.disks_for_each_player=4#default\n self.shuffle_names = true\n end",
"def initialize\n # kosong\n end",
"def init; end",
"def init_vars\n FLAGS.each do |position, flag|\n flag_set = ((@bits >> position) & 0x1) == 1\n instance_variable_set \"@#{flag}\", flag_set\n end\n end",
"def initialize\n @board = Board.new\n @choice = \"\"\n @current_player = \"P1\"\n @current_marker = 'X'\n @is_game_over = false\n @is_draw = false\n @replay = \"\"\n end",
"def init_private_members\r\n @original_direction = 2 # Original direction\r\n @original_pattern = 1 # Original pattern\r\n @anime_count = 0 # Animation count\r\n @stop_count = 0 # Stop count\r\n @jump_count = 0 # Jump count\r\n @jump_peak = 0 # Jump peak count\r\n @locked = false # Locked flag\r\n @prelock_direction = 0 # Direction before lock\r\n @move_succeed = true # Move success flag\r\n end",
"def init_public_members\n @id = 0\n @x = 0\n @y = 0\n @real_x = 0.0\n @real_y = 0.0\n @tile_id = 0\n @character_name = \"\"\n @character_index = 0\n @move_speed = 4\n @move_frequency = 6\n @walk_anime = true\n @step_anime = false\n @direction_fix = false\n @opacity = 255\n @blend_type = 0\n @direction = 2\n @pattern = 1\n @priority_type = 1\n @through = false\n @bush_depth = 0\n @animation_id = 0\n @balloon_id = 0\n @transparent = false\n end",
"def create_game_objects\n rm_extender_create_game_objects\n $game_self_vars = Hash.new\n $game_labels = Hash.new\n $game_self_labels = Hash.new\n end",
"def initialize(name1)\r\n @player1=Player1.new(name1)\r\n @grid=Grid.new()\r\n @grid.pretty_print\r\n puts \"\\nYour game is ready!!!\\n\\n\"\r\n game \r\nend",
"def initialize\n\t\t@health_info = { previous_health: PLAYER_MAX_HEALTH, heal_amount: 0 }\n\t\t@@look_comfort = 0\n\t\t@look = []\n\tend",
"def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end"
] |
[
"0.75058055",
"0.72825646",
"0.70464706",
"0.69853884",
"0.6897375",
"0.68816274",
"0.6853908",
"0.68532187",
"0.67991763",
"0.67762667",
"0.6768738",
"0.6742645",
"0.67201793",
"0.6716709",
"0.669451",
"0.66864234",
"0.668188",
"0.6669605",
"0.66691023",
"0.6663216",
"0.66483325",
"0.6619817",
"0.6610696",
"0.6609462",
"0.6595144",
"0.6563654",
"0.65604895",
"0.65571314",
"0.6555797",
"0.65548426",
"0.6552819",
"0.6551925",
"0.6547418",
"0.65363187",
"0.65323913",
"0.65314287",
"0.6528939",
"0.65071046",
"0.64931184",
"0.649248",
"0.6483693",
"0.647114",
"0.64703643",
"0.64637667",
"0.6448996",
"0.6448825",
"0.64352137",
"0.642751",
"0.6422788",
"0.64216983",
"0.64076394",
"0.6404994",
"0.64029014",
"0.63990074",
"0.638019",
"0.63669586",
"0.6363048",
"0.6361366",
"0.6361366",
"0.6361366",
"0.6361366",
"0.6352221",
"0.6350877",
"0.6343549",
"0.6341759",
"0.6336423",
"0.63353896",
"0.63350374",
"0.6313218",
"0.6311305",
"0.63057303",
"0.6303048",
"0.6300011",
"0.6278546",
"0.62715644",
"0.6265093",
"0.6265093",
"0.6265093",
"0.6263346",
"0.62601495",
"0.6256936",
"0.62496185",
"0.624398",
"0.62366223",
"0.62348104",
"0.62295187",
"0.62281346",
"0.62277615",
"0.6226711",
"0.62238294",
"0.62185407",
"0.62184083",
"0.6213961",
"0.62102693",
"0.62080264",
"0.62071097",
"0.62059575",
"0.6200126",
"0.61956865",
"0.61955744",
"0.6195545"
] |
0.0
|
-1
|
Checks if the value of the resource placeholder has been set yet.
|
def set_yet?
!!@resource_lock.synchronize { defined? @resource }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_defined_resource?\n nil\n end",
"def is_placeholder?(fieldname)\n self.class.placeholders.include?(fieldname.to_sym)\n end",
"def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def validate_presence(key, value)\n add_templated_error(key, \"Setting, '#{template.name_for(key)}', is required\") if value.blank?\n end",
"def missing_translation_placeholder field\n evaluate_localization_option!(:placeholder, field)\n end",
"def definition_required?\n # We have to distinguish the false value from the non\n # existence of the variable. Therefore the ||= operator\n # can't help us.\n if @definition_required.class.kind_of?(NilClass)\n\t @definition_required = true\n else\n @definition_required\n end\n end",
"def value_present?\n !@value.nil?\n end",
"def exists?\n get_lxd_config_value(resource[:config]) != nil\n end",
"def url_filled?\n !url.blank?\n end",
"def is_set?(resource)\n value_is_set?(resource)\n end",
"def has_value?\n false\n end",
"def is_place_holder?()\n return rel_path.nil?\n end",
"def placeholder(placeholderText)\n @placeholder = placeholderText.nil? ? nil : placeholderText.to_s\n end",
"def valid?\n !(@variable.nil? || @attribute.nil?)\n end",
"def valid?\n !( @definition.nil? && @uri.nil? )\n end",
"def has_hint?\n hint.present?\n end",
"def has_hint?\n hint.present?\n end",
"def valid?\n not @local_id.nil?\n end",
"def field_supplied( field )\n return false if field.blank?\n return false if BLANK_PLACEHOLDERS.include?( field )\n return true\n end",
"def exists?\n @property_hash and [:running, :pending].include?(@property_hash[:ensure])\n end",
"def valid?\n raise_error(@resource['error']) if ok? || error?\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n\n success = validator\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for the keycloak server to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice(\"Failed to find resource #{resource[:test_key]}=#{resource[:test_value]} at #{resource[:test_url]}; sleeping 2 seconds before retry\")\n sleep 2\n success = validator\n end\n\n unless success\n Puppet.notice(\"Failed to find resource #{resource[:test_key]}=#{resource[:test_value]} at #{resource[:test_url]} within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def name_exists?\n ensure_data_loaded\n return false unless @exist\n unless @data['name'].nil?\n Puppet.debug \"Deployment found: #{@resource[:name]}\"\n return true\n end\n Puppet.debug \"No deployment matching #{@resource[:name]} found.\"\n false\n end",
"def loaded?(resource)\n resource.instance_variable_defined?(instance_variable_name)\n end",
"def defined?(value_key)\n true\n end",
"def hint?\n !defined?(@hint) || @hint\n end",
"def resource?\n !@grpc.nil?\n end",
"def resource?\n !@gapi_json.nil?\n end",
"def exists? force: false\n return resource_exists? if force\n # If we have a value, return it\n return @exists unless @exists.nil?\n # Always true if we have a gapi_json object\n return true if resource?\n resource_exists?\n end",
"def has_value?\n true\n end",
"def resource_ready(value)\n case value\n when :absent\n not @state[:keyspaces].include?(resource[:name])\n when :present\n @state[:keyspaces].include?(resource[:name])\n when :ready\n @state[:keyspaces].include?(resource[:name]) and @resource[:tables] and include_all?(@resource[:tables], @state[:tables])\n end\n end",
"def exists?\n thumbnail_method.present? ||\n (thumbnail_field && thumbnail_value_from_document.present?) ||\n default_thumbnail.present?\n end",
"def exists?\n thumbnail_method.present? ||\n (thumbnail_field && thumbnail_value_from_document.present?) ||\n default_thumbnail.present?\n end",
"def previously_defined?\n @previously_defined\n end",
"def variable?\n !@variable_id.nil?\n end",
"def defined?\n false\n end",
"def resource_full?\n resource? && @grpc.definition && !@grpc.definition.empty?\n end",
"def setting_provided?(key)\n !settings[key].nil?\n end",
"def empty_required_value?( value )\n required? && value.nil?\n end",
"def valid?\n return false if @image.nil?\n return false if @image_id.nil?\n return false if @name.nil?\n return false if @ready.nil?\n return false if @restart_count.nil?\n return true\n end",
"def presence\n blank? ? nil : @value\n end",
"def is_required(resource_type)\n result = false\n is_required = property.is_required\n if is_required and value.blank?\n result = true\n errors.add(:value, \"of the field cannot be blank\")\n end\n result\n end",
"def is_empty(value)\n return @mappings.path_exists(value)\n end",
"def required\n !!parameter[:required]\n end",
"def valid?\n !@target.nil? or !@catalog_target.nil? or !@local_id.nil?\n end",
"def resource_present?(type, title)\n !!catalog.resource(type, title)\n end",
"def initialized?\n !@data.nil?\n end",
"def has_resource?(name)\n @resources.has_key?(name)\n end",
"def exist?\n @resource.exist?\n end",
"def provided?(name)\n\t\t\t\tname = name.to_sym\n\t\t\t\t(@options[name] || {})[:value] != nil\n\t\t\tend",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def use_placeholder_loader?\n !self[:instance_specific] && !self[:eager_graph]\n end",
"def exists?\n prepare_environment\n load_template(@data['serverProfileTemplateUri'], 'new_profile')\n return @resource_type.find_by(@client, @data).any? if resource['ensure'].to_sym == :absent\n super([nil, :found, :get_available_targets, :get_available_networks, :get_available_servers, :get_compliance_preview,\n :get_messages, :get_profile_ports, :get_transformation, :absent])\n end",
"def loaded?(resource)\n assert_kind_of 'resource', resource, source_model\n\n resource.instance_variable_defined?(instance_variable_name)\n end",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def missing?\n @missing\n end",
"def task_defined?(task_name) \n lookup(task_name) != nil\n end",
"def valid?\n metadata && id && name rescue false\n end",
"def resource?\n !reference?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def unbound?\n !variables.empty? && variables.values.all?(&:unbound?)\n end",
"def valid?\n placeholders.size == placeholders.uniq.size\n end",
"def exists?\n # Always true if the object is not set as reference\n return true unless reference?\n # If we have a value, return it\n return @exists unless @exists.nil?\n ensure_grpc!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def exists?\n # Always true if the object is not set as reference\n return true unless reference?\n # If we have a value, return it\n return @exists unless @exists.nil?\n ensure_grpc!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def undefined?\n true\n end",
"def has_title?\n @title != nil\n end",
"def failed_resource?\n @failed_resource ||= false\n end",
"def value_loaded?(name)\n !self.instance_variable_get(\"@#{name}\").nil?\n end",
"def must_have_value?\n return false\n end",
"def pixi_post?\r\n !pixan_id.blank?\r\n end",
"def valid?\n value.present? && uri.present?\n end",
"def unknown?\n @value.nil?\n end",
"def stripped?\n @resource.nil?\n end",
"def defined_any?\n cassette_records.size > 0\n end",
"def available_variable?(name)\n # if the current scope is already using the variable, it's\n # unavailable.\n return false if variable?(name)\n\n # if any of the child scopes reference the variable as a\n # parent variable, it's not available.\n !any_child_references_parent_variable?(name)\n end",
"def valid?(resource)\n value = resource.validation_property_value(attribute_name)\n\n boolean_type?(resource) ? !value.nil? : !DataMapper::Ext.blank?(value)\n end",
"def image_url_provided?\n !self.image_url.blank?\n end",
"def empty?()\n return true if @state == RedXmlResource::STATE_EMPTY\n return false\n end",
"def ensure_value_exists!(k)\n @values[k] = nil unless @values.has_key?(k)\n end",
"def ready?\n !@values.any? { |observable, value| value.nil? }\n end",
"def requires_placeholder_type_specifiers?\n true\n end",
"def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end",
"def ready?\n !@values.any? { |observable, value| value.nil? }\n end",
"def valid?\n (ip.nil? || name.nil?) ? false : true\n end",
"def generate_immediate_notification? \n\t submitted && ((not defined? @submitted_value_on_load) || (not @submitted_value_on_load) )\n end",
"def win?\n\t\t@placeholder == @secret_word\n\tend",
"def exists?\n @property_hash[:ensure] == :present\n end",
"def exists?\n @property_hash[:ensure] == :present\n end",
"def exists?\n @property_hash[:ensure] == :present\n end",
"def exists?\n @property_hash[:ensure] == :present\n end",
"def valid?\n !project_id.nil? && !credentials.nil?\n end",
"def has_delayed_default?\n has_default? && TaskArguments.delayed_argument?(default)\n end",
"def has_empty_option?()\n empty = self['emptyName']\n return (not (empty.nil? or empty.empty?))\n end",
"def setting_exists?(header, name)\n !!find_setting(header, name)\n end",
"def set_present\n set_value( true )\n end",
"def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end",
"def present?\n !blank?\n end",
"def picture_missing?\n self.image.url.include?(\"https://profilepicturesdp.com/wp-content/uploads/2018/06/default-good-youtube-profile-pictures-3.jpg\")\n end"
] |
[
"0.6281598",
"0.59835535",
"0.5972937",
"0.59416115",
"0.58103603",
"0.5802725",
"0.57957435",
"0.5691157",
"0.56776327",
"0.56732917",
"0.5642177",
"0.5588255",
"0.5586867",
"0.552094",
"0.5505273",
"0.5489662",
"0.5489662",
"0.5480142",
"0.5452378",
"0.5446339",
"0.5435332",
"0.54257387",
"0.5423002",
"0.54154587",
"0.5409991",
"0.540457",
"0.53942686",
"0.5389369",
"0.5383405",
"0.5382563",
"0.5382068",
"0.53779423",
"0.53779423",
"0.5372531",
"0.53724194",
"0.536588",
"0.53646314",
"0.53593206",
"0.53531176",
"0.5352314",
"0.53482145",
"0.534513",
"0.53269607",
"0.53247267",
"0.53171957",
"0.5314886",
"0.53136426",
"0.53054976",
"0.53052753",
"0.53048795",
"0.53006023",
"0.52946424",
"0.5289019",
"0.5286456",
"0.5286309",
"0.5273781",
"0.5272184",
"0.5270922",
"0.5265934",
"0.5264668",
"0.5264668",
"0.5264668",
"0.52598536",
"0.52535474",
"0.5249782",
"0.5249782",
"0.524343",
"0.5239587",
"0.52363545",
"0.52359545",
"0.5222004",
"0.5221735",
"0.52213347",
"0.52204067",
"0.5217774",
"0.5216599",
"0.52041143",
"0.5203099",
"0.52027637",
"0.52011615",
"0.52005124",
"0.5199476",
"0.5188398",
"0.5185916",
"0.5185561",
"0.51827586",
"0.51732427",
"0.517314",
"0.51703656",
"0.51699775",
"0.51699775",
"0.51699775",
"0.5166251",
"0.51619434",
"0.5160123",
"0.5160029",
"0.5153756",
"0.5153697",
"0.5153625",
"0.5152103"
] |
0.6769206
|
0
|
Checks if the attempt to read the resource has been terminated.
|
def terminated?
!!@resource_lock.synchronize { @terminated }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def closed_read?() end",
"def ready_for_read?\n begin\n connected? && IO.select([socket], nil, nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def closed_read?\n end",
"def terminated?\n terminated\n end",
"def closed_read?()\n #This is a stub, used for indexing\n end",
"def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end",
"def terminated?\n instance.status == \"TERMINATED\"\n end",
"def terminated?\n self.state.name == \"terminated\"\n end",
"def read_timeout_exceeded?\n @read_timeout_ms && duration_since_received > @read_timeout_ms\n end",
"def terminated?\n async && async.terminated?\n end",
"def terminated?\n !(status =~ /terminated/).nil?\n end",
"def terminated?\n !(status =~ /terminated/).nil?\n end",
"def terminated?\n !(status =~ /terminated/).nil?\n end",
"def terminated?\n !! @status\n end",
"def read?\n !@read.nil?\n end",
"def finished_reading?; @finished_read; end",
"def read_data_available?(timeout = 0)\n (rh, wh, eh) = IO::select([@io], nil, nil, timeout)\n ! rh.nil?\n end",
"def alive?\n if Kernel::select([ self ], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def read?\n status.read?\n end",
"def read_operation_finished!(retval, resource)\n return unless resource.class.is_protectable?\n Thread.current[:performing_get] = false\n end",
"def failed_write\n begin\n @sock.wait_readable\n rescue ArgumentError # IO Selector Exception\n return true\n end\n false\n end",
"def try_P\n begin\n @mutex.synchronize do\n @count_pout.read_nonblock 1\n end\n return true\n rescue Errno::EAGAIN\n return false\n end\n end",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def alive?\n return false if closed?\n\n if IO.select([self], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def alive?\n return false if closed?\n\n if IO.select([self], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def finish_reading!\n @finished_read = true\n end",
"def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end",
"def wait_readable_or_timeout; end",
"def closed?\n io.closed?\n end",
"def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end",
"def closed?\n io.closed?\n end",
"def closed?\n @io.closed?\n end",
"def termination?\n false\n end",
"def terminate?\n !@terminate.nil?\n end",
"def terminateable?\n puts \"Test for terminable\" ; true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def read?\n (status == READ)\n end",
"def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end",
"def haspdueof?; return !@pdus[\"EOF\"].nil? end",
"def ready_for_write?\n begin\n @write_buffer.length > 0 && IO.select(nil, [socket], nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def closed?\n @connection.closed?\n end",
"def reading?\n status.received?\n end",
"def has_read_data?(timeout = nil)\n\n # Allow a timeout of \"0\" that waits almost indefinitely for input, this\n # mimics the behavior of Rex::ThreadSafe.select() and fixes some corner\n # cases of unintentional no-wait timeouts.\n timeout = 3600 if (timeout and timeout == 0)\n\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and\n (rv[0][0] == fd))\n true\n else\n false\n end\n rescue ::Errno::EBADF, ::Errno::ENOTSOCK\n raise ::EOFError\n rescue StreamClosedError, ::IOError, ::EOFError, ::Errno::EPIPE\n # Return false if the socket is dead\n return false\n end\n end",
"def terminated?\n return (@chain_threads.list.empty? and @chain_threads.enclosed?)\n end",
"def eof?\n raise IOError, 'not opened for reading' if closed?\n @total == @size && @buffer.empty?\n end",
"def terminated?\n infobase.send(:infobase_wrapper).session_get(id).empty?\n end",
"def discarded?\n finished? && error.present?\n end",
"def failed_resource?\n @failed_resource ||= false\n end",
"def read?\n self.status == 'read'\n end",
"def eof?\n\t\t\t\tfill_read_buffer if !@eof && @read_buffer.empty?\n\t\t\t\t\n\t\t\t\treturn @eof && @read_buffer.empty?\n\t\t\tend",
"def might_have_data?\n @state.to_s =~ /finished|aborted|running/\n end",
"def connected?\n\t\t\t\treturn false if @io.closed?\n\t\t\t\t\n\t\t\t\t# If we can wait for the socket to become readable, we know that the socket may still be open.\n\t\t\t\tresult = to_io.recv_nonblock(1, MSG_PEEK, exception: false)\n\t\t\t\t\n\t\t\t\t# Either there was some data available, or we can wait to see if there is data avaialble.\n\t\t\t\treturn !result.empty? || result == :wait_readable\n\t\t\t\t\n\t\t\trescue Errno::ECONNRESET\n\t\t\t\t# This might be thrown by recv_nonblock.\n\t\t\t\treturn false\n\t\t\tend",
"def closed?\n @connection.nil?\n end",
"def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end",
"def eof?\n not busy?\n end",
"def has_been_read?\n @data_read\n end",
"def attempt_read\n # Return false if we have nothing else to read\n return false if @native_channel.eof\n\n # Attempt to read from stdout/stderr\n @session.blocking_call { read_stream(STREAM_DATA) }\n @session.blocking_call { read_stream(STREAM_EXTENDED_DATA) }\n\n # Return true always\n true\n end",
"def eof?\n @read >= @size\n end",
"def alive_check!\n raise \"Has been destroyed.\" if self.destroyed?\n raise \"No 'io_out'.\" unless @io_out\n raise \"No 'io_in'.\" unless @io_in\n raise \"'io_in' was closed.\" if @io_in.closed?\n raise \"No listen thread.\" unless @thr_listen\n #raise \"Listen thread wasnt alive?\" unless @thr_listen.alive?\n\n return nil\n end",
"def finished?\n self.closed?()\n end",
"def end_of_stream?\n @next_chunk.nil?\n end",
"def failure?\n finished? and !!exception and !timeout?\n end",
"def locked?\n !!read\n end",
"def terminating?\n !(status =~ /shutting/).nil?\n end",
"def terminating?\n !(status =~ /shutting/).nil?\n end",
"def terminating?\n !(status =~ /shutting/).nil?\n end",
"def dropped?\n return (@terminate_count != nil)\n end",
"def timeout?\n finished? and exception.kind_of?(TimeoutError)\n end",
"def terminated?\n return false if status != 'terminated'\n children.each_value do |child|\n return false unless child.terminated?\n end\n return true\n end",
"def closed?\n socket.closed?\n end",
"def closed?\n socket.closed?\n end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def destroyed?\n return true if !@pid && !@io_out && !@io_in && !@io_err && @main == nil\n return false\n end",
"def closed?\n @socket.closed?\n end",
"def is_read\n return @is_read\n end",
"def closed?\n @socket.nil?\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read_blocked\n end",
"def finished?\n @buffer.size == @size\n end",
"def check_finish\n if @finished_publishing && @pending_hash.empty?\n if @exception_count == 0\n do_stop\n else\n check_retry\n end\n end\n end",
"def closed?\n !@socket || @socket.closed?\n end",
"def terminated?\n !emit_value?\n end",
"def poll\n buffer_size = @outstanding.size\n read_handshake unless handshake_seen?\n connection.handle(read_message, self)\n true\n rescue Errno::EAGAIN\n @outstanding.size != buffer_size\n rescue PeerError, EOFError => error\n log \"dropping connection: #{error.message}\"\n sessions.delete self\n begin\n connection.send_data error, io\n io.close\n rescue\n end\n true\n end",
"def read_access_check\n resource_check('read')\n end",
"def read_access_check\n resource_check('read')\n end",
"def read_access_check\n resource_check('read')\n end",
"def open?\n @data_bytes[1] != 0\n end",
"def readable?\n return @access_mode != Pho::UNAVAILABLE\n end",
"def closed?\n @socket.nil? or @socket.closed?\n end",
"def closed?\n return false\n end"
] |
[
"0.69412136",
"0.683393",
"0.6718201",
"0.66746604",
"0.6557179",
"0.64754516",
"0.645448",
"0.6434888",
"0.64260674",
"0.6363099",
"0.6356087",
"0.6356087",
"0.6356087",
"0.6344195",
"0.6330458",
"0.6299704",
"0.62796926",
"0.6244833",
"0.6233195",
"0.6221297",
"0.621574",
"0.6169086",
"0.6123828",
"0.61038816",
"0.61038816",
"0.6099733",
"0.60932404",
"0.6085435",
"0.60816854",
"0.60573375",
"0.60559416",
"0.60559416",
"0.6044236",
"0.60341907",
"0.6031847",
"0.5993411",
"0.59888643",
"0.5978613",
"0.5960602",
"0.5960602",
"0.5960602",
"0.59563327",
"0.59529316",
"0.59463984",
"0.5946117",
"0.59330595",
"0.59330595",
"0.59330595",
"0.59330595",
"0.59330595",
"0.59179974",
"0.5917593",
"0.59169877",
"0.59033793",
"0.5879614",
"0.5869477",
"0.5857288",
"0.58494836",
"0.58422196",
"0.5841807",
"0.5838228",
"0.583464",
"0.58324856",
"0.58262557",
"0.5813915",
"0.579413",
"0.5790438",
"0.5784932",
"0.57605577",
"0.5756464",
"0.57307416",
"0.572754",
"0.57002103",
"0.56879646",
"0.56879646",
"0.56879646",
"0.568682",
"0.56816566",
"0.5657761",
"0.5642279",
"0.5640216",
"0.5639516",
"0.56324065",
"0.5617188",
"0.56170624",
"0.561704",
"0.5612556",
"0.56050396",
"0.5599156",
"0.55934405",
"0.5587806",
"0.55826956",
"0.5582313",
"0.5571658",
"0.5571658",
"0.5571658",
"0.5567551",
"0.5559117",
"0.5557053",
"0.55466795"
] |
0.7574514
|
0
|
Sets the value for the resource, making it available for all waiting and following reads. Resource values can only be set once. Calling this method on a terminated resource is ineffective.
|
def resource=(resource)
set_or_terminate do
@resource = resource
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_resource value\n instance_variable_set(resource_name, value)\n end",
"def set!(resource, value)\n resource.instance_variable_set(instance_variable_name, value)\n end",
"def set_value(*args)\n raise ReadOnlyRecord if readonly?\n resource.set_value(*args)\n end",
"def resource=(value)\n @resource = value\n end",
"def resource=(value)\n @resource = value\n end",
"def resource=(value)\n @resource = value\n end",
"def resource=(value)\n @resource = value\n end",
"def resource=(value)\n @resource = value\n end",
"def resource=(value)\n @resource = value\n end",
"def set(resource, value)\n value = set_value(resource, input_to_stored_value(resource, value))\n\n if options.key?(:deprecated)\n Chef.deprecated(:property, options[:deprecated])\n end\n\n if value.nil? && required?(resource_action(resource))\n raise Chef::Exceptions::ValidationFailed, \"#{name} is a required property\"\n else\n value\n end\n end",
"def set(value)\n @read.close\n @write.write value\n end",
"def set_Resources(value)\n set_input(\"Resources\", value)\n end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def call(resource, value = NOT_PASSED)\n if NOT_PASSED == value # see https://github.com/chef/chef/pull/8781 before changing this\n get(resource)\n else\n set(resource, value)\n end\n end",
"def resource=(record)\n instance_variable_set(\"@#{resource_name}\", record)\n end",
"def assign_resource(value = nil)\n value ||= authorize(resource_class.find(params[:id]))\n instance_variable_set(\"@#{resource_name}\", value)\n end",
"def set(new_value = nil)\n @mutex.synchronize do\n Kernel.raise(Complete) if @complete\n @complete = true\n @value = new_value\n @waiter.resume_all_indefinitely\n end\n nil\n end",
"def set!(resource, value)\n hook_value(resource, value) unless value.kind_of? Hooker\n super\n end",
"def set_resource\n @setting = Setting.first!\n end",
"def []=(resource_name, value)\n case\n when store.respond_to?(:write)\n store.write key_for(resource_name), value\n when store.respond_to?(:[]=)\n store[key_for(resource_name)] = value\n when store.respond_to?(:set)\n store.set key_for(resource_name), value\n end\n end",
"def state=(arg)\n resource.state = arg\n end",
"def resource=(v)\n @resource = v.to_s\n if USE_STRINGPREP\n @resource = IDN::Stringprep.nodeprep(@resource)\n end\n end",
"def ensure=(value)\n debug \"Call: ensure=(#{value})\"\n debug \"Waiting for HAProxy backend: '#{@resource[:name]}' to change its status to: '#{value}'\"\n @resource[:count].times do\n stats_reset\n if self.status == value\n debug get_haproxy_debug_report\n return true\n end\n sleep @resource[:step]\n end\n debug get_haproxy_debug_report\n fail \"Timeout waiting for HAProxy backend: '#{@resource[:name]}' status to become: '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def resource=(new_resource)\n instance_variable_set(:\"@#{resource_name}\", new_resource)\n end",
"def set_resource\n instance_variable_set(\"@#{resource_name}\", load_resource)\n end",
"def use(value)\r\n begin\r\n self.set(value)\r\n yield\r\n ensure\r\n self.restore\r\n end\r\n end",
"def value=(val)\n mutex.lock\n @value = val\n ensure\n mutex.unlock\n end",
"def setValue(value)\n @current = value\n self.limitCurrentValue\n end",
"def value=(value); self.data.value = value; end",
"def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end",
"def reset(resource)\n reset_value(resource)\n end",
"def set!(value)\n @mutex.synchronize do\n old_value = @value\n @value = value\n @full_condition.signal\n apply_deref_options(old_value)\n end\n end",
"def set_value( value )\n @value = value \n end",
"def set(value)\n @mutex.synchronize { @value = value }\n end",
"def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end",
"def set_availability(name,value)\n\t\tlock_name = \"#{name}_inventory\"\n\t\tSidekiq.redis do |connection|\n\t\t\tRedis::Semaphore.new(\"#{lock_name}\", redis: connection) do \t\t# product level lock\n\t\t\t\tconnection.hset(\"inventory\", name, value)\n\t\t\tend\n\t\tend\n\tend",
"def singleton_resource=(new_value)\n @singleton_resource = new_value unless const_defined?(:SingletonResource)\n end",
"def release_value\n # this doesn't really change the value, it only removes the force flag\n put_value(0, VpiIntVal, nil, VpiReleaseFlag)\n end",
"def value=(value)\n @block = nil\n @value = value\n end",
"def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end",
"def property(name, value)\n @resource.set_property name, value\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.find_by_id(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def setValue(value)\n @value = value\n end",
"def set_value(value)\n @value = value\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def set(value)\n execute_only(:set, value)\n end",
"def set(value)\n # Set a name for looking up associated options like the event.\n name = self.class.value_name(value)\n\n call = self.class.value_option(name, :call) || :none\n\n if call == :instead\n call_valuemethod(name, value)\n elsif call == :none\n # They haven't provided a block, and our parent does not have\n # a provider, so we have no idea how to handle this.\n self.fail \"#{self.class.name} cannot handle values of type #{value.inspect}\" unless @resource.provider\n call_provider(value)\n else\n # LAK:NOTE 20081031 This is a change in behaviour -- you could\n # previously specify :call => [;before|:after], which would call\n # the setter *in addition to* the block. I'm convinced this\n # was never used, and it makes things unecessarily complicated.\n # If you want to specify a block and still call the setter, then\n # do so in the block.\n devfail \"Cannot use obsolete :call value '#{call}' for property '#{self.class.name}'\"\n end\n end",
"def resource_id=(value)\n @resource_id = value\n end",
"def resource_id=(value)\n @resource_id = value\n end",
"def resource_id=(value)\n @resource_id = value\n end",
"def value=(new_value)\n\t\t@value = new_value\n\t\tinform_obeservers\n\tend",
"def value=(value)\n return unless @run.initialized?\n @file = nil\n @remote_file = false\n @value = value\n end",
"def set_content(value)\n @document = Nokogiri::XML(value)\n @state = RedXmlResource::STATE_UNCOMMITED if @document #Resource can now be stored in database\n end",
"def value=(value)\n @value = value\n @value_set = true\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource_ivar(object) # rubocop:disable Naming/AccessorMethodName\n instance_variable_set resource_ivar, object\n end",
"def value= value\n\t\t@value = value\n\t\trefresh\n\tend",
"def resource=(new_resource)\n @resource = @resource.merge(new_resource)\n end",
"def set_to(value)\n @native.set_current_value(value)\n end",
"def set(value)\n value\n end",
"def set_resource(resource = nil)\n\t\t\t\tresource ||= resource_class.find_by(id: params[:id])\n\t\t\t\tif !resource\n\t\t\t\t\trespond_with_error(resource_name + \" med id \" + params[:id] + \" hittades inte\", :not_found)\n\t\t\t\tend\n\t\t\t\tinstance_variable_set(\"@#{resource_name}\", resource)\n\t\t\tend",
"def set_value new_value\n if validate_value new_value\n @value = new_value\n end\n end",
"def write_state(value)\n resource.send \"#{self.class._state_property.to_s}=\", value.path\n end",
"def set(value)\n old_value = refresh(value)\n handle_event :type => :change, :old_value => old_value, :value => @value if old_value != @value\n old_value\n end",
"def save_to_node\n node.set[:sysctl][:values][@new_resource.name] = @new_resource.value if @new_resource.save == true\nend",
"def set_resource(resource = nil)\n resource ||= resource_class.find_by!(id: params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def resource_access=(value)\n @resource_access = value\n end",
"def resource_access=(value)\n @resource_access = value\n end",
"def set_resource_item\n @resource_item = ResourceItem.find(params[:id])\n end",
"def leave_default_initialization!(retval, resource, value)\n return unless resource.class.is_protectable?\n if Thread.current[:initializing_default_values]\n Thread.current[:initializing_default_values] = false\n end\n end",
"def set_value\n @value = Value.find(params[:id])\n end",
"def set_resource\n @user = current_user\n @resource = Resource.find(params[:id])\n end",
"def set_resource(resource = nil)\n # find a resource by its friendly_id\n if class_of_resource.column_names.include?(\"slug\")\n resource ||= class_of_resource.friendly.find(params[:id])\n else\n resource ||= class_of_resource.find_by_id(params[:id])\n end\n\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def set=(value)\n @queue << \"set #{value}\"\n end",
"def resource_reference=(value)\n @resource_reference = value\n end",
"def set_resource(resource = nil)\n resource ||= resource_class_name.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end",
"def set_resource\n @model || set_model # Why?\n instance_variable_set(resource, @model.find(params[:id])) if @model\n end",
"def set_resource(resource_key, id, object)\n resource_cache(resource_key)[id] = object\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.friendly.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def set_resource\n instance_variable_set(resource, @model.find(params[:id]))\n end",
"def value=(value)\n @value = value\n end",
"def set(v)\n @val = v\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end",
"def set_resource\n @resource = Resource.find(params[:id])\n end"
] |
[
"0.72403574",
"0.68676233",
"0.6639322",
"0.66252065",
"0.66252065",
"0.66252065",
"0.66252065",
"0.66252065",
"0.66252065",
"0.65304106",
"0.6301355",
"0.6183286",
"0.617703",
"0.6166355",
"0.61495435",
"0.60249215",
"0.599486",
"0.5960514",
"0.59299654",
"0.5875267",
"0.58664453",
"0.58327544",
"0.5797709",
"0.5789939",
"0.5771436",
"0.57650054",
"0.57575285",
"0.57332665",
"0.56788963",
"0.5674495",
"0.56743145",
"0.567128",
"0.56434226",
"0.56240916",
"0.5603124",
"0.55985796",
"0.5578575",
"0.5571933",
"0.5565872",
"0.55534196",
"0.55439085",
"0.5534707",
"0.55304044",
"0.5507635",
"0.5483151",
"0.5475919",
"0.5463515",
"0.5463515",
"0.5446159",
"0.5442321",
"0.5439436",
"0.5439436",
"0.5439436",
"0.54266274",
"0.5425118",
"0.5419496",
"0.54144275",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.5406842",
"0.54068184",
"0.5393422",
"0.5384457",
"0.53843695",
"0.53784907",
"0.5378003",
"0.5368027",
"0.5351829",
"0.5330357",
"0.5328854",
"0.5315776",
"0.5313749",
"0.5313749",
"0.53038716",
"0.53003657",
"0.5295755",
"0.5295601",
"0.5291758",
"0.52917403",
"0.52800316",
"0.52731216",
"0.52694607",
"0.5263779",
"0.5262326",
"0.52533615",
"0.5248148",
"0.52464044",
"0.52453685",
"0.52396715",
"0.52396715",
"0.52396715"
] |
0.6815968
|
2
|
Terminates the attempt to read the resource early, causing those waiting and any following reads to raise a FutureResource::Terminated exception. Subsequently calling this method again is ineffective.
|
def terminate
set_or_terminate do
@terminated = true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_operation_finished!(retval, resource)\n return unless resource.class.is_protectable?\n Thread.current[:performing_get] = false\n end",
"def stop_read\n return self if @closed\n error = check_result ::Libuv::Ext.read_stop(handle)\n reject(error) if error\n self\n end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def finish\n release_read_pool_connection\n end",
"def finish_reading!\n @finished_read = true\n end",
"def finish\n disconnect_read_pool!\n end",
"def terminated?\n !!@resource_lock.synchronize { @terminated }\n end",
"def synchronize\n unless lock\n current_lock = read\n\n err = \"Resource #{current_lock['id']} locked by #{current_lock['client_name']}\"\n err << \" since #{current_lock['time']} (PID #{current_lock['process_id']})\"\n\n raise ResourceLocked.new(err)\n end\n\n yield\n\n unlock\n rescue => ex\n ex = ex.respond_to?(:cause) ? ex.cause : ex\n\n unless ex.is_a?(ResourceLocked)\n unlock if unlock_on_failure\n end\n\n abort(ex)\n end",
"def wait\n t = @ractor.take\n yield(self) if block_given?\n t\n rescue Ractor::ClosedError\n raise ErrorTerminated, \"ticker stopped\"\n end",
"def done_read\n raise NotImplementedError\n end",
"def close_reader\n @reader.close unless @reader.closed?\n end",
"def close_read() end",
"def close_read() end",
"def close_read() end",
"def stop(resource)\n\t\tdata = self.find(resource)\n\t\tdata.count -= 1\n\t\t\n\t\tif data.count < 0\n\t\t\traise \"Freed data where you shouldn't have. Can't have negative resource count.\" \n\t\tend\n\tend",
"def read_blocked\n end",
"def close_read(*) end",
"def wait\n\t\t\t\twrapper = Async::IO::Generic.new(@input)\n\t\t\t\twrapper.read(1)\n\t\t\tensure\n\t\t\t\t# Remove the wrapper from the reactor.\n\t\t\t\twrapper.reactor = nil\n\t\t\tend",
"def wait_readable_or_timeout; end",
"def close\n @lock.synchronize do\n return if @shut_down || !@started\n @shut_down = true\n @started = false\n end\n @io_reactor.stop.get\n self\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def release(resource)\n\t\t\t\t\t# A resource that is not good should also not be reusable.\n\t\t\t\t\t# unless resource.closed?\n\t\t\t\t\t\treuse(resource)\n\t\t\t\t\t# else\n\t\t\t\t\t# \tretire(resource)\n\t\t\t\t\t# end\n\t\t\t\tend",
"def end(resource)\n end",
"def read_neverblock(*args)\r\n\t\tres = \"\"\n\t\tbegin\n\t\t\traise Timeout::Error if Fiber.current[:exceeded_timeout]\n\t\t\t@immediate_result = read_nonblock(*args)\n\t\t\tres << @immediate_result\n\t\trescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EINTR\n \t\tattach_to_reactor(:read)\n \t\tretry\r\n\t\tend\n\t\tres\r\n end",
"def closed_read?() end",
"def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end",
"def stop\n @lock.synchronize do\n if @state == PENDING_STATE\n Future.resolved(self)\n elsif @state != STOPPED_STATE && @state != CRASHED_STATE\n @state = STOPPING_STATE\n @unblocker.unblock\n @stopped_promise.future\n else\n @stopped_promise.future\n end\n end\n end",
"def finished_reading?; @finished_read; end",
"def release(resource)\n\t\t\t\t@available << resource\n\t\t\t\t\t\n\t\t\t\tif task = @waiting.pop\n\t\t\t\t\ttask.resume\n\t\t\t\tend\n\t\t\tend",
"def reader(cancellation)\n lambda do |tick|\n next puts('reader interrupted') if cancellation.cancelled?\n\n data = File.read('/dev/urandom', 1024).tap { sleep 0.2 }\n [tick, data]\n end\nend",
"def retry\n @channel_control.release\n end",
"def finished\n if @io\n ObjectSpace.undefine_finalizer(self) # remove usb closer finalizer\n @io.close\n @io = nil\n end\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def read!\n\t\t\t\t\tread\n\t\t\trescue\n\t\t\t\tnil\n\t\t\tend",
"def release(resource); end",
"def consume_readable(&callback)\n synchronize do\n bool = callback.call\n if @nonblock_readable != bool\n @nonblock_readable = bool\n readable_resource.signal\n end\n end\n end",
"def terminate\n\t\traise NotImplementedError\n\tend",
"def close\n @reader.close\n end",
"def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end",
"def resource(resource, on_force_finish_callback)\n @resources[resource] = on_force_finish_callback\n Fiber.yield\n @resources.delete(resource)\n end",
"def within_preserved_state\n lock.synchronize do\n begin\n interactor.stop if interactor\n @result = yield\n rescue Interrupt\n # Bring back Pry when the block is halted with Ctrl-C\n end\n\n interactor.start if interactor && running\n end\n\n @result\n end",
"def wait_for_completion\n until terminated? do\n Kernel.sleep(Gosen::DeploymentRun::POLLING_TIME)\n @deployment_resource.reload\n end\n raise Gosen::Error.new(\"Deployment error: #{@deployment_resource['output']}\") if @deployment_resource['status'] == 'error'\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def pop\n @queue.pop(true)\n rescue ThreadError\n if closed?\n raise ClosedQueue if @raise_exception.true?\n return nil\n else\n sleep\n retry\n end\n end",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def each_remote_read_then_finish\n return enum_for(:each_remote_read_then_finish) unless block_given?\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n\n receive_and_check_status\n ensure\n set_input_stream_done\n end",
"def interrupt?; end",
"def test_cannot_acquire_if_closed\n pool = ResourcePool.new\n def pool.isOpen; false; end\n\n assert_nothing_raised { pool.acquire }\n end",
"def close\n @lock.synchronize do\n return if @closed\n\n begin\n @wakeup.close\n rescue IOError\n end\n\n begin\n @waker.close\n rescue IOError\n end\n\n @closed = true\n end\n end",
"def next(stop_result = Stop.singleton)\n if read_fd.closed?\n stop_result\n else\n Marshal.load(read_fd)\n end\n end",
"def test_read_against_timeout_with_other_thread\n thread = Thread.new do\n sleep 0.1 while true\n end\n\n listen do |_|\n hiredis.connect(\"localhost\", DEFAULT_PORT)\n hiredis.timeout = 10_000\n\n assert_raises Errno::EAGAIN do\n hiredis.read\n end\n end\n ensure\n thread.kill\n end",
"def closed_read?\n end",
"def terminate\n raise NotImplementedError\n end",
"def with_resource_timeout(temp_timeout)\n prev_read_timeout = @read_timeout\n\n begin\n # C-ext reads this directly, writer method will configure\n # properly on the client but based on my read--this is good enough\n # until we get https://github.com/brianmario/mysql2/pull/955 in\n @read_timeout = temp_timeout\n yield\n ensure\n @read_timeout = prev_read_timeout\n end\n end",
"def disable_until_finished_or_interrupted; end",
"def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend",
"def terminate_connection\n @intentionally_closed = true\n close_connection\n end",
"def destroy(resource_name)\n if ! advance? then return self end\n @@logger.debug \"Destroying resource: #{resource_name}.\"\n result = {:destroy => resource_name}\n args = {:action => :destroy}\n resource = @resourcer.get resource_name\n destroyed = @mutator.destroy(resource_name, resource)\n destroyed.harp_script = @harp_script\n if destroyed.output? (args)\n result[:output] = destroyed.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n return self\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def delete\n if(resource.exist?)\n resource.lock_check if resource.supports_locking?\n resource.delete\n else\n NotFound\n end\n end",
"def busy_handler( &block ) # :yields: resource, retries\n SQLite::API.busy_handler( @handle, block )\n end",
"def ready_for_read?\n begin\n connected? && IO.select([socket], nil, nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def readfromsocket\n loop do\n if(@socket.eof?)\n break\n else\n begin\n queueingWithNotify(@socket.gets)\n rescue StandardError,SocketError,IOError\n break\n end\n end\n end\n \n @recvthread=nil\n self.close\n Thread.current.exit\n end",
"def closed_read?()\n #This is a stub, used for indexing\n end",
"def resume\n return if @cancelled\n begin\n @cancellation_handler = @initiation_task.call\n rescue Exception => e\n backtrace = AsyncBacktrace.create_from_exception(self.backtrace, e)\n e.set_backtrace(backtrace.backtrace) if backtrace\n @parent.fail(self, e)\n end\n end",
"def terminate() end",
"def run_interrupted; end",
"def terminate\n @thread.raise Zoidberg::DeadException.new('Instance in terminated state', object_id)\n end",
"def readline\n @handle ||= fs.s3.interface.get_object(fs.bucket(path), fs.key_path(path)).each\n begin\n @handle.next\n rescue StopIteration, NoMethodError\n @handle = nil\n raise EOFError.new(\"end of file reached\")\n end\n end",
"def open_for_read\n self.eof_flag = false\n open_data_for_read\n end",
"def close\r\n @peek_buffer = nil\r\n reset_read_point\r\n end",
"def handle_timeout\n pop_outstanding_request\n nil\n end",
"def stop\n NSQ.logger.info(\"#{self}: Reader stopping...\")\n @stopped = true\n @selector.wakeup\n @subscriber_mutex.synchronize do\n @subscribers.each_value {|subscriber| subscriber.stop}\n end\n end",
"def terminate!\n @terminated = true\n @thread.kill if @thread\n ensure\n safe_release!\n end",
"def terminate\n @@terminated = true\n end",
"def lounge\n self.resource = @resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n yield(:success,resource) if block_given?\n end",
"def drain\n # while resp = self.read(0.05)\n\n while resp = self.read(0.005) # not sure how low I can go here, this really speeds things up.\n end\n end",
"def graceful_close!\n @mutex.lock\n begin\n return if @graceful or @closed\n logger.debug { \"#{self.class}##{__method__} gracefully closing\" }\n @graceful = true\n @cond.broadcast\n ensure\n @mutex.unlock rescue nil\n end\n nil\n end",
"def dispose\n begin\n @lock.synchronize do\n while instance = @available.pop\n instance.close\n end\n\n @condition.wait(@lock) if @used.size > 0\n end\n end until empty?\n end",
"def close\n @closed = true\n @stream_fiber = nil\n nil\n end",
"def quit\n @retry, @resignin = nil\n end",
"def synchronize_read\n lock_read\n begin\n yield\n ensure\n unlock_read\n end\n end",
"def def_read_timeout\n 10\n end",
"def def_read_timeout\n 10\n end",
"def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end",
"def load_current_resource\n @current_resource ||= Chef::Resource::Download.new(r.name)\n @current_resource.path(r.path)\n\n if ::File.exist?(@current_resource.path)\n @current_resource.checksum(checksum(@current_resource.path))\n if @current_resource.checksum == r.checksum\n @current_resource.exist = true\n else\n @current_resource.exist = false\n end\n else\n @current_resource.exist = false\n end\n @current_resource\n end",
"def raw_stop\n with_provider_object do |instance|\n instance.actions.stop\n instance.wait_for! do\n sdk_update_status(instance)\n instance.stopped?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end",
"def raw_stop\n with_provider_object do |instance|\n instance.actions.stop\n instance.wait_for! do\n sdk_update_status(instance)\n instance.stopped?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end",
"def readpartial(maxlen, outbuf=nil)\n read_nonblock(maxlen, outbuf)\n rescue IO::WaitReadable\n block_until_readable\n retry\n end",
"def block_until_read_lock!\n begin\n path = [root_lock_path, next_lowest_write_lock_name].join('/')\n logger.debug { \"SharedLocker#block_until_read_lock! path=#{path.inspect}\" }\n @zk.block_until_node_deleted(path)\n rescue NoWriteLockFoundException\n # next_lowest_write_lock_name may raise NoWriteLockFoundException,\n # which means we should not block as we have the lock (there is nothing to wait for)\n end\n\n @locked = true\n end",
"def terminate\n @should_terminate = true\n end",
"def cancel\n raise PlatformNotSupported if ChildProcess.windows?\n if busy?\n @process.send_signal 'INT'\n mark_cancel\n # read until the cancel marker\n raw_output = \"\"\n until raw_output =~ /#{@cancel_marker}/\n begin\n raw_output = @io_read.read_nonblock(1024)\n rescue Errno::EAGAIN\n sleep 0.1\n end\n yield if block_given?\n end\n @busy = false\n end\n end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end"
] |
[
"0.6313525",
"0.6302894",
"0.5948366",
"0.5670646",
"0.56399935",
"0.5611662",
"0.5587354",
"0.54236096",
"0.53959966",
"0.53703856",
"0.5328364",
"0.53035897",
"0.53035897",
"0.53035897",
"0.52897453",
"0.5253308",
"0.52225",
"0.52181906",
"0.5212663",
"0.5163929",
"0.5138219",
"0.5134725",
"0.51252896",
"0.5114378",
"0.50976145",
"0.5080749",
"0.50790364",
"0.50044864",
"0.49911076",
"0.49809825",
"0.4924188",
"0.49143153",
"0.48961443",
"0.48832068",
"0.48718643",
"0.4850924",
"0.4850056",
"0.4845654",
"0.48393774",
"0.48202935",
"0.4820177",
"0.481031",
"0.48096362",
"0.47939515",
"0.4793127",
"0.47854757",
"0.47818977",
"0.47764605",
"0.4776162",
"0.4763618",
"0.47492868",
"0.4746093",
"0.4745622",
"0.474076",
"0.4737778",
"0.4737506",
"0.47353753",
"0.47239307",
"0.47176027",
"0.47079417",
"0.4692357",
"0.46900737",
"0.46859828",
"0.46828476",
"0.4680171",
"0.4675788",
"0.46754506",
"0.4672768",
"0.46724075",
"0.46690717",
"0.46659136",
"0.4654829",
"0.4651784",
"0.46432066",
"0.4639063",
"0.46387294",
"0.46355367",
"0.462899",
"0.4627807",
"0.4615216",
"0.46094012",
"0.4606913",
"0.46067053",
"0.460629",
"0.460629",
"0.46006906",
"0.45954022",
"0.4594745",
"0.4594745",
"0.45938802",
"0.4592442",
"0.45888498",
"0.4582416",
"0.45689443",
"0.45689443",
"0.45689443",
"0.45689443",
"0.45689443",
"0.45689443",
"0.45689443"
] |
0.49876937
|
29
|
Syntax: [[id]] .Name [align=left|center|right,alt=alt_text,type] (optional) .... literal ....
|
def literal(node)
artwork_attributes = {
align: node.attr("align"),
type: node.attr("type"),
name: node.title,
alt: node.attr("alt"),
}
# NOTE: html escaping is performed by Nokogiri
artwork_content = "\n" + node.lines.join("\n") + "\n"
ret = noko do |xml|
if node.parent.context != :example
figure_attributes = {
anchor: node.id,
}
xml.figure **attr_code(figure_attributes) do |xml_figure|
# xml_figure.artwork artwork_content, **attr_code(artwork_attributes)
xml_figure.artwork **attr_code(artwork_attributes) do |a|
a.cdata artwork_content
end
end
else
# xml.artwork artwork_content, **attr_code(artwork_attributes)
xml.artwork **attr_code(artwork_attributes) do |a|
a.cdata artwork_content
end
end
end
ret
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def alignment(name)\n {\n \"left\" => -1,\n \"center\" => 0,\n \"right\" => 1\n }[name.to_s]\n end",
"def initialize(id, options = { })\n @id = id\n\n @alignment = options[:alignment] || :center\n @data_comparator = options[:data_comparator] || Proc.new { |a, b| a <=> b }\n @data_to_s = options[:data_to_s] || Proc.new { |o| o.to_s }\n @label = options[:label] || id\n @padding = options[:padding] || \" \"\n @width = options[:width] || label.length\n end",
"def %(name)\n self.label = name\n self\n end",
"def anchor(name)\n mark_anchor(name).left(lambda {\n s=scene.target[self.index]\n case self.name\n when 'bottom' then s.left;\n when 'top' then s.left;\n when 'center' then s.left;\n when 'left' then nil;\n else\n s.left+s.shape_radius\n end\n }).right(lambda {\n s=scene.target[self.index]\n self.name()=='left' ? s.right+s.shape_radius : nil\n }).top(lambda {\n s=scene.target[self.index]\n case self.name\n when 'left' then s.top;\n when 'right' then s.top;\n when 'center' then s.top;\n when 'top' then nil;\n else\n s.top+s.shape_radius\n end\n }).bottom(lambda {\n s=scene.target[self.index]\n self.name()=='top' ? s.bottom+s.shape_radius : nil\n }).text_align(lambda {\n case self.name\n when 'left' then 'right';\n when 'bottom' then 'center';\n when 'top' then 'center';\n when 'center' then 'center';\n else\n 'left'\n end\n }).text_baseline( lambda {\n case self.name\n when 'right' then 'middle';\n when 'left' then 'middle';\n when 'center' then 'middle';\n when 'bottom' then 'top';\n else\n 'bottom'\n end\n \n })\n end",
"def css_id name\n attr \"##{name}\"\n end",
"def termdef(name)\n element(name, {:name => name, :class=>:term}, 'a')\n end",
"def id(name)\n h = horizontals_cur\n component = @components[name]\n\n if component\n @vertical.add(@valign, component, GroupLayout::DEFAULT_SIZE, @height, @max)\n h.add(@halign, component, GroupLayout::DEFAULT_SIZE, @width, @max)\n elsif name != \"_\"\n raise \"Cell named '#{name}' does not have a component set during build.\"\n end\n end",
"def name_for(_name, _id=nil)\n n = \"#{@object_name}[#{_name}]\"\n n += \"[#{_id}]\" if _id\n end",
"def text_id\n \"#{name} (##{id})\"\n end",
"def tk_add\n \"add planet #{id} - 10 #{x} #{y} 0\\n\" +\n \"param #{id} 0 #{size}\\n\" +\n \"param #{id} 1 #{-size}\\n\" +\n \"param #{id} 2 #{color}\\n\" +\n \"param #{id} 3 #{name}\"\n end",
"def show(text,align={ :align=> :show_left })\n set RGhost::Show.new(text.to_s,align) \n end",
"def tag_name=(_arg0); end",
"def tag(name); end",
"def name(*) end",
"def name(*) end",
"def notation(name); end",
"def set_box_name(id, name)\n @names[id] = name.to_s\n end",
"def spot_attrasgn_for_name\n nd_recv, mid, nd_args = @node.children\n *nd_args, _nd_last_arg, _nil = nd_args.children\n fetch_line(nd_recv.last_lineno)\n if mid == :[]= && @snippet.match(/\\G[\\s)]*(\\[)/, nd_recv.last_column)\n @beg_column = $~.begin(1)\n args_last_column = $~.end(0)\n if nd_args.last && nd_recv.last_lineno == nd_args.last.last_lineno\n args_last_column = nd_args.last.last_column\n end\n if @snippet.match(/[\\s)]*\\]\\s*=/, args_last_column)\n @end_column = $~.end(0)\n end\n elsif @snippet.match(/\\G[\\s)]*(\\.\\s*#{ Regexp.quote(mid.to_s.sub(/=\\z/, \"\")) }\\s*=)/, nd_recv.last_column)\n @beg_column = $~.begin(1)\n @end_column = $~.end(1)\n end\n end",
"def rcpname(id); det.link(:text, \"#{id}\"); end",
"def label\n \"#{@name} (#{@id})\"\n end",
"def show(id)\n\t\tset_attribute_property(id, 'style', DISPLAY, INLINE)\n\tend",
"def align; end",
"def align; end",
"def name\n return text_get(0, id)\n end",
"def name _args\n \"name _args;\" \n end",
"def caption\n (self[\"name\"] || self[\"label\"] || self[\"description\"] || \"##{id}\")\n end",
"def caption\n (self[\"name\"] || self[\"label\"] || self[\"description\"] || \"##{id}\")\n end",
"def quoted_identifier(name)\n \"[#{name}]\"\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def ident\n \"<Command name=#{name}>\"\n end",
"def named(name)\n NamedMarkup.new self, name\n end",
"def image(name, html_options = {})\n %Q{<img src=\"img/#{name}.png\" alt=\"#{name}\" #{%Q{id=\"#{html_options[:id]}\"} if html_options[:id]} #{%Q{class=\"#{html_options[:class]}\"} if html_options[:class]} #{%Q{style=\"#{html_options[:style]}\"} if html_options[:style]}/>}\n end",
"def anchor\n \"p#{id}\"\n end",
"def statictext\n h1 { a @text, :href=>R(Index), :style=>ítext-align:centerí}\n end",
"def text_id\n \"#{title} (#{color})\"\n end",
"def identifier; end",
"def identifier; end",
"def add_entity(name, attributes)\n @lines ||=[]\n #@lines.push \"==[[\\##{name}]]==\"\n @lines.push \"==[[#{name.downcase}]]==\"\n @lines.push \"{|border=\\\"0\\\" cellpadding=\\\"2\\\" width=\\\"40%\\\"\"\n _add_cell(name, CELL_CLASS_NAME_STYLE)\n @lines.push \"|-\"\n attributes.each{|attribute|\n _add_cell(attribute)\n @lines.push \"|-\"\n }\n @lines.push \"|}\"\n @lines.push \"<br/>\"\n end",
"def interface_name(class_def)\n \t_IDENTIFIER5 = nil\n\n\n\n\n # 55:7: IDENTIFIER\n _IDENTIFIER5 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.add_interface(_IDENTIFIER5.text) \n\n\n\n end",
"def id2name() end",
"def id2name() end",
"def alt\n attr 'alt'\n end",
"def label(x, y, text, attributes = nil)\n %[<text font-size=\"#{FONT_SIZE}\" font-family=\"Verdana\" fill=\"#333333\" text-anchor=\"middle\" x=\"#{x}\" y=\"#{y + FONT_SIZE / 2}\"#{' ' + attributes if attributes}>#{text}</text>\\n]\n end",
"def id\n name\n end",
"def id\n name\n end",
"def start_element(name, attrs = [])\n values = attrs.to_h\n return if name != 'String'\n token = values['CONTENT']\n @text << token\n @words << {\n word: token,\n coordinates: s_coords(values)\n }\n end",
"def attr(name); end",
"def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"def lex_en_expr_labelarg; end",
"def lex_en_expr_labelarg; end",
"def lex_en_expr_labelarg; end",
"def tag(name)\n if $crossover then \"_CTX_K_S_#{name}_\" else \"TEXMFSTART.#{name}\" end\nend",
"def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end",
"def label(attribute_name, *args); end",
"def name(size:, region:); end",
"def label\n @name.to_s.empty? ? @id : @name\n end",
"def method_missing(id, *args)\n name = id.id2name\n case args.length\n when 1\n\tset_string(name, args.join)\n when 0\n\tset_string(name)\n end\n end",
"def alt_content_tag(name, *args, &block)\n options = args.extract_options!\n name = FreightTrain.tag(name)\n content = block_given? ? capture(&block) : args.first\n content_tag(name, content, options)\n #content_tag(name, *args, &block)\n end",
"def method_missing(id, *args)\n flat_args = args.map(&:inspect).map(&:to_s).join ', '\n \"#{name}.#{id}#{flat_args.empty? ? '' : \"(#{flat_args})\"}\"\n end",
"def attribute(name); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def initialize( id, name )\n\t\t@id = Integer( id )\n\t\t@name = name.to_sym\n\tend",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def attr_name\n parameters.first.jump(:ident).first.to_sym\n end",
"def unique_format_name\n title + \" (#{id || \"?\"})\"\n end",
"def name\n\t\tself.content\n\tend",
"def name() title; end",
"def name() title; end",
"def tag_label(name)\r\n if @labels.key? name\r\n raise \"repeated label #{name} within section #{@name}\"\r\n else\r\n @labels[name] = @origin+@cursor+@org_offset\r\n end\r\n end",
"def name\n text_get(6, @id)\n end",
"def lex_en_expr_labelarg=(_arg0); end",
"def lex_en_expr_labelarg=(_arg0); end",
"def lex_en_expr_labelarg=(_arg0); end",
"def settextalign(*)\n super\n end",
"def id\n name\n end",
"def indentify\n 'name'\n end",
"def indentify\n 'name'\n end",
"def indentify\n 'name'\n end"
] |
[
"0.57412064",
"0.57412064",
"0.57412064",
"0.56997204",
"0.56843936",
"0.567324",
"0.5632415",
"0.5589984",
"0.5535927",
"0.55332196",
"0.54671764",
"0.5391818",
"0.5376751",
"0.5333054",
"0.5301582",
"0.5292479",
"0.5283695",
"0.5283695",
"0.526049",
"0.5246276",
"0.5226997",
"0.5203867",
"0.5194931",
"0.5170419",
"0.5127789",
"0.5127789",
"0.5113846",
"0.5111363",
"0.51075095",
"0.51075095",
"0.51068413",
"0.5082631",
"0.5082631",
"0.5082631",
"0.5077714",
"0.5070925",
"0.5070577",
"0.50654745",
"0.50608826",
"0.505399",
"0.50476354",
"0.50476354",
"0.504712",
"0.50443804",
"0.5043243",
"0.5043243",
"0.50324684",
"0.5031723",
"0.5031483",
"0.5031483",
"0.5004821",
"0.5001287",
"0.49974883",
"0.4991905",
"0.4991905",
"0.4991905",
"0.4991487",
"0.49873894",
"0.49853182",
"0.49841028",
"0.49805465",
"0.49744985",
"0.49720198",
"0.49587545",
"0.49569166",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49550107",
"0.49486005",
"0.49420816",
"0.49420816",
"0.49420816",
"0.49408647",
"0.4939288",
"0.4938291",
"0.4936167",
"0.4936167",
"0.49300578",
"0.49273023",
"0.49268413",
"0.49268413",
"0.49268413",
"0.4924064",
"0.49229267",
"0.49213314",
"0.49213314",
"0.49213314"
] |
0.0
|
-1
|
stem is treated as literal, but with center alignment
|
def stem(node)
artwork_attributes = {
align: node.attr("align") || "center",
type: node.attr("type"),
name: node.title,
alt: node.attr("alt"),
}
# NOTE: html escaping is performed by Nokogiri
artwork_content = "\n" + node.lines.join("\n") + "\n"
ret = noko do |xml|
if node.parent.context != :example
figure_attributes = {
anchor: node.id,
}
xml.figure **attr_code(figure_attributes) do |xml_figure|
# xml_figure.artwork artwork_content, **attr_code(artwork_attributes)
xml_figure.artwork **attr_code(artwork_attributes) do |a|
a.cdata artwork_content
end
end
else
# xml.artwork artwork_content, **attr_code(artwork_attributes)
xml.artwork **attr_code(artwork_attributes) do |a|
a.cdata artwork_content
end
end
end
ret
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def basic_stem\n # undo some euphonic changes so that we can recover\n # the basic stem\n form = @first_form.sub(/(?:μμαι)$/,'πμαι') # palatal\n form = form.sub(/(?:σμαι)$/,'τμαι') # dental\n form = form.sub(/(?:ουμαι)$/,'εομαι') # future contracted deponents\n\n # now remove the ending\n form.sub(/(?:ω|ον|α|ομαι|μαι|ην)$/,'')\n end",
"def stem(node)\n artwork_attributes = {\n anchor: node.id,\n align: node.attr(\"align\") || \"center\",\n type: \"ascii-art\",\n name: node.title,\n alt: node.attr(\"alt\"),\n }\n\n # NOTE: html escaping is performed by Nokogiri\n artwork_content = \"\\n\" + node.lines.join(\"\\n\") + \"\\n\"\n\n noko do |xml|\n if node.parent.context != :example\n xml.figure do |xml_figure|\n # xml_figure.artwork artwork_content, **attr_code(artwork_attributes)\n xml_figure.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n else\n # xml.artwork artwork_content, **attr_code(artwork_attributes)\n xml.artwork **attr_code(artwork_attributes) do |a|\n a.cdata artwork_content\n end\n end\n end\n end",
"def cut_stem(word, suffix)\n stem_length = word.length - suffix.length\n word[0...stem_length]\n end",
"def stem\n _response_word.fetch(\"stem\", nil)\n end",
"def stem_each(ary)\n ary.map { |term| @stemmer.stem(term) }\n end",
"def center(text, space = \"\")\n if space == 'puts'\n puts\n print \" \"*((178-text.chomp.size)/2)\n print text\n puts\n elsif space == 'align_middle'\n print \" \"*((178-text.chomp.size)/2)\n print text\n else\n puts \"\\n\\n\\n\"\n print \" \"*((178-text.chomp.size)/2)\n print text\n puts\n end\nend",
"def center(p0, padstr=\"\") end",
"def align_center\n self.center(LENGTH)\n end",
"def center() \r\n # sine_1M = sin( 1.0 * @ma )\r\n # sine_2M = sin( 2.0 * @ma )\r\n # sine_3M = sin( 3.0 * @ma )\r\n # sine_4M = sin( 4.0 * @ma )\r\n # sine_5M = sin( 5.0 * @ma )\r\n # e = eccentricity_Earth()\r\n # sine_1M * ( 2.0 * e - e**3 * 1.0/4.0 + 5/96.0 * e**5 ) + \r\n # sine_2M * ( 5.0/4.0 * e**2 - 11/24.0 * e**4 ) + \r\n # sine_3M * ( 13.0/12.0 * e**3 - 43/64.0 * e**5 ) +\r\n # sine_4M * 103.0/96.0 * e**4 +\r\n # sine_5M * 1097.0/960.0 * e**5 \r\n # sine_1M * ( 1.914602 - @ta * ( 0.004817 + @ta * 0.000014 )) + +\r\n # sine_2M * ( 0.019993 - @ta * 0.000101 ) + +\r\n # sine_3M * 0.000289\r\n eqc( @ma, @ta )\r\n end",
"def center_me(string)\n puts string.center(50)\nend",
"def center(string)\n string.center(100)\n end",
"def align_text_center(text_object)\n text_object.x = (Window.width - text_object.width) / 2\n end",
"def center_of(str)\n p str.size.odd? ? str[str.size / 2] : str[(str.size / 2) - 1..(str.size / 2)]\nend",
"def center_of(str)\n middle_range = (str.length/2 -1..str.length/2 )\n middle_index = str.length / 2\n index = str.length.odd? ? middle_index : middle_range\n str[index]\nend",
"def center_of(str)\n if str.length.odd?\n str[str.length / 2]\n else\n str[str.length / 2 - 1, 2] # this sets length of 2 char from position\n end\nend",
"def center_of(str)\n str.length.odd? ? str[str.length / 2] : str[(str.length / 2) - 1, 2]\nend",
"def each_term\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tyield term.stem\n\t\t\tend\n\t\tend",
"def stem_token_deviance( filter_count=nil )\n list = get_all_tokens_deviance( filter_count ).map! {|e| e[1] }\n return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n\t#list = get_all_tokens_deviance.map! {|e| e[1] }\n\t#return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n end",
"def center_of(str)\n str.chars.size.odd? ? str.slice(str.chars.length/2, 1) : str.slice(str.chars.length/2-1, 2)\nend",
"def center_with_strlen(strlen)\n linefill_length = TermInfo.screen_size[1]\n len = linefill_length - strlen\n len = 0 if len < 0\n \" \" * (len / 2) + self\n end",
"def centerx; return self[0]+(self[2].div(2)); end",
"def center_of(str)\n mid_point = str.size / 2.0\n if str.size.odd?\n str[mid_point]\n else \n str[(mid_point - 1), 2]\n end\nend",
"def center_of(str)\n str.size.odd? ? str[str.size/2] : str[str.size/2 - 1..str.size/2]\nend",
"def add_stem( name, display_name = nil )\n # TODO What if names.size != display_names.size?\n names = name.split ':'\n display_names = display_name.nil? ? names.clone.split : display_name.split(':')\n\n name, display_name = names.shift, display_names.shift\n\n child = JGrouper::Stem.find self.name.empty? ? name : [ self.name, name ].join(':') # TODO Yuck\n child = JGrouper::Stem.from_grouper @grouper_stem.addChildStem(name, display_name) if child.nil?\n\n # TODO What if child can't be created?\n child = child.add_stem( names.join(':'), display_names.join(':') ) unless names.empty?\n yield child if block_given?\n child\n end",
"def center\n end",
"def stem(data)\n if data\n words = data.split(/[+,_]|%20/) # split on '+', '_', or '%20'\n tokens = []\n\n words.each do |word|\n tokens.push(Lingua.stemmer(word, :language => \"en\"))\n end\n\n tokens.join(\",\")\n else\n \"Error: need input\"\n end\n end",
"def stem_tokens(tokens)\n stem_list = []\n\n # Looping through the list and finding the stem word for each word\n for word in tokens\n word = word[/\\w*/]\n s = word.stem\n stem_list.push(s)\n end\n\n return stem_list\nend",
"def possible_stems(word, suffix)\n myaso.stems.select cut_stem(word, suffix)\n end",
"def center_of(string)\n half = (string.length / 2) - 1\n center = string[(string.length / 2)] if string.length.odd?\n center = string[half..half+1] if string.length.even?\n center\nend",
"def center_of(string)\n array = string.chars\n if array.size.odd?\n array[array.length/2]\n else\n array[(array.length/2 -1)..array.length/2].join\n end \nend",
"def center_of(str)\n half_point = str.size / 2 \n \n if str.size.odd?\n str[half_point]\n else\n str[half_point-1,2]\n end\nend",
"def center_of(string)\n if string.size.odd?\n p string[string.size / 2] # no need: string[(string.size - 1) / 2], since/2 get an integer\n else\n p string[(string.size / 2 - 1), 2]\n end\nend",
"def center_of(string)\n middle = string.size/2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend",
"def stem_token_count\n list = get_all_tokens_count.map! {|e| e[1] }\n return Stat.stem(list)\n end",
"def lemma\n # TODO Return @string.stem\n @word.downcase\n end",
"def center_of(str)\ncharacters = str.chars\naverage = characters.size / 2\nif characters.size.even?\ncharacters[average - 1] + characters[average]\nelse\ncharacters[average]\nend\nend",
"def aligned_text_position\n end",
"def middle_initial\n middlename.to_s[0]\n end",
"def center_of(string)\n index = string.size/2\n if string.size.odd?\n string[index]\n else\n string[index - 1, 2]\n end\nend",
"def center_of(str)\n new_str = ''\n if str.length.odd?\n new_str = str[str.length / 2]\n else\n new_str = str[(str.length / 2) - 1] + str[str.length / 2] \n end\n p new_str\nend",
"def use_stemming?\n if @emphasis[:stemming]\n begin\n require 'fast_stemmer'\n true\n rescue LoadError\n false\n end\n else\n false\n end\n end",
"def center\n self - mean\n end",
"def middle_name\n self[:MiddleInitial]\n end",
"def center_of(string)\n middle = string.size / 2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend",
"def center_of(string)\n center = string.length / 2\n\n if string.length.odd?\n string[center]\n else\n \"#{string[center - 1]}#{string[center]}\"\n end\nend",
"def center_of(string)\n middle_index = string.size / 2\n\n if string.size.odd?\n string[middle_index]\n else\n string[middle_index - 1] + string[middle_index]\n end\nend",
"def center_of(string)\n size = string.size\n mid = size / 2\n \n size.odd? ? string[mid] : string[mid - 1] + string[mid]\nend",
"def test_stemming\n data = []\n File.foreach(File.expand_path(File.dirname(__FILE__))+\"/porter2_testdata.txt\") do |line| \n data << line.chomp.split(/ /).reject { |e| e.empty? }\n end\n\n data.each do |input|\n word, stem = input\n assert_equal stem, PorterStemmer::Porter2.stem(word)\n end\n end",
"def feminine_name; end",
"def center_of(str)\n count = str.size\n middle = count / 2\n count.odd? ? str[middle] : str[middle-1..middle]\nend",
"def center_of(string)\n char = ''\n if string.size.odd?\n char << string[string.size / 2]\n else\n char << string[(string.size / 2) - 1, 2]\n end\nend",
"def center_of(string)\n center = ''\n\n if string.size.even?\n center = string[string.size/2 - 1 .. string.size/2]\n else\n center = string[string.size/2]\n end\n center\nend",
"def master_shrink(text)\n center = text.layout.options[:center]\n text.layout.options[:center] -= 0.1 if center > 0.1\n text.layout.apply\n end",
"def center_of(str)\n return str[str.size/2] if str.size.odd?\n return str[(str.size/2)-1] + str[(str.size/2)]\nend",
"def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index -1, 2]\n end\nend",
"def middle\n termarray = [@major.subject.label, @major.predicate.label, @minor.subject.label, @minor.predicate.label]\n middle = nil\n if self.three_term?\n termarray.detect do |term|\n if termarray.count(term) == 2\n middle = Term.new(term)\n end\n end\n else\n middle = \"Error: this is not a three term syllogism\"\n end\n middle\n end",
"def center(width)\n spaces_needed = width - self.print_width\n left_side = spaces_needed / 2\n right_side = spaces_needed - left_side\n (\" \" * left_side) << self << (\" \" * right_side)\n end",
"def test_stemming\n data = []\n current_dir = File.expand_path(File.dirname(__FILE__))\n voc_file = File.new(current_dir+\"/porter1_vocabulary.txt\", \"r\")\n out_file = File.new(current_dir+\"/porter1_output.txt\", \"r\")\n while ((word = voc_file.gets) && (stem = out_file.gets)) \n data << [word.chop, stem.chop]\n end\n voc_file.close\n out_file.close\n\n data.each do |input|\n word, stem = input\n assert_equal stem, PorterStemmer::Porter1.stem(word)\n end\n end",
"def center_of(string)\n if string.size.odd?\n index1 = string.size / 2\n elsif string.size.even?\n index1 = string.size / 2\n index2 = (string.size / 2) - 1\n end\n\n new_string = []\n string_array = string.chars\n if string.size.odd?\n new_string << string_array[index1]\n elsif string.size.even?\n new_string << string_array[index2]\n new_string << string_array[index1]\n end\n new_string.join\nend",
"def center_of(string)\n half_size = string.size / 2\n case \n when string.size.odd? then string[half_size]\n when string.size.even? then string[half_size - 1, 2] \n end\nend",
"def center_of(str)\n middle = (str.length/2)\n if str.length.odd?\n str[middle]\n else\n str[(middle-1)..middle]\n end\nend",
"def center_of(str)\n sz = str.size\n sz.even? ? str[sz / 2 - 1, 2] : str[sz / 2]\nend",
"def center_of(string)\n quotient, remainder = (string.size - 1).divmod(2)\n string.slice(quotient, remainder + 1)\nend",
"def stem_porter\n\n # make a copy of the given object and convert it to a string.\n w = self.dup.to_str\n \n return w if w.length < 3\n \n # now map initial y to Y so that the patterns never treat it as vowel\n w[0] = 'Y' if w[0] == ?y\n \n # Step 1a\n if w =~ /(ss|i)es$/\n w = $` + $1\n elsif w =~ /([^s])s$/ \n w = $` + $1\n end\n\n # Step 1b\n if w =~ /eed$/\n w.chop! if $` =~ MGR0 \n elsif w =~ /(ed|ing)$/\n stem = $`\n if stem =~ VOWEL_IN_STEM \n w = stem\n\tcase w\n when /(at|bl|iz)$/ then w << \"e\"\n when /([^aeiouylsz])\\1$/ then w.chop!\n when /^#{CC}#{V}[^aeiouwxy]$/o then w << \"e\"\n end\n end\n end\n\n if w =~ /y$/ \n stem = $`\n w = stem + \"i\" if stem =~ VOWEL_IN_STEM \n end\n\n # Step 2\n if w =~ SUFFIX_1_REGEXP\n stem = $`\n suffix = $1\n # print \"stem= \" + stem + \"\\n\" + \"suffix=\" + suffix + \"\\n\"\n if stem =~ MGR0\n w = stem + STEP_2_LIST[suffix]\n end\n end\n\n # Step 3\n if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/\n stem = $`\n suffix = $1\n if stem =~ MGR0\n w = stem + STEP_3_LIST[suffix]\n end\n end\n\n # Step 4\n if w =~ SUFFIX_2_REGEXP\n stem = $`\n if stem =~ MGR1\n w = stem\n end\n elsif w =~ /(s|t)(ion)$/\n stem = $` + $1\n if stem =~ MGR1\n w = stem\n end\n end\n\n # Step 5\n if w =~ /e$/ \n stem = $`\n if (stem =~ MGR1) ||\n (stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)\n w = stem\n end\n end\n\n if w =~ /ll$/ && w =~ MGR1\n w.chop!\n end\n\n # and turn initial Y back to y\n w[0] = 'y' if w[0] == ?Y\n\n w\n end",
"def middle_sign(words)\n length_words = words.size\n if length_words.odd?\n words[length_words / 2]\n else\n words[length_words / 2 - 1..length_words / 2]\n end\nend",
"def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index - 1, 2]\n end\nend",
"def master_equal(text)\n text.layout.options[:center] = 0.5\n text.layout.apply\n end",
"def stem(word)\n stems = []\n\n FFI::MemoryPointer.new(:pointer) do |output|\n count = Hunspell.Hunspell_stem(self,output,word.to_s)\n ptr = output.get_pointer(0)\n\n if count > 0\n stems = ptr.get_array_of_string(0,count)\n end\n end\n\n return stems.map { |word| force_encoding(word) }\n end",
"def center_of(string)\n middle = (string.size - 1) / 2.0\n string[middle.floor..middle.ceil]\nend",
"def center_of(string)\n if string.size.odd?\n middle_character = string[string.size / 2]\n else\n middle_characters = string[string.size / 2 - 1, 2]\n end\nend",
"def norm_term( t )\n t.sub( @lead_squote, RSQMARK ).\n gsub( @term_rejects, UNDERSCORE )\n end",
"def center_of(string)\n string_length = string.size\n string_center = string_length / 2\n \n if string_length.odd?\n string[string_center]\n else\n string[(string_center - 1)..string_center]\n end\nend",
"def center_of(string)\n midpoint = string.size / 2\n string.length.odd? ? string[midpoint] : string[midpoint - 1..midpoint]\nend",
"def bosh_stemcell_name(stemcell_type)\n tags = [bosh_provider]\n tags << \"stable\" if stemcell_type == \"stable\" unless openstack?\n bosh_stemcells_cmd = \"bosh public stemcells --tags #{tags.join(',')}\"\n say \"Locating bosh stemcell, running '#{bosh_stemcells_cmd}'...\"\n `#{bosh_stemcells_cmd} | grep ' bosh-stemcell-' | grep -v pre | awk '{ print $2 }' | sort -r | head -n 1`.strip\n end",
"def center_of(string)\n str_length = string.size\n middle = \"\"\n \n return string if str_length < 3\n \n if str_length.odd?\n middle = string[str_length / 2, 1]\n else\n middle = string[(str_length / 2) - 1, 2]\n end\n \n middle\nend",
"def settextalign(*)\n super\n end",
"def center\n\t\ttop_right_vert / 2\n\tend",
"def center_of(string)\n length = string.length\n\n case length % 2\n when 1 then string[length / 2]\n else string[(length /2) - 1, 2]\n end\nend",
"def center_of(str)\n index = str.size / 2\n str.size.even? ? str[index - 1, 2] : str[index]\nend",
"def tv_set_norm _norm\n send_cmd(\"tv_set_norm #{_norm}\")\n end",
"def run_stembuild\n vmdk_file = find_file_by_extn(@output_directory, \"vmdk\")\n cmd = \"stembuild -vmdk \\\"#{vmdk_file}\\\" -v \\\"#{Stemcell::Manifest::Base.strip_version_build_number(@version)}.#{Time.now.getutc.to_i}\\\" -output \\\"#{@output_directory}\\\"\"\n puts \"running stembuild command: [[ #{cmd} ]]\"\n `#{cmd}`\n end",
"def three_star_line(inner_spaces, total_width)\n inner_stars = \"*\" + \" \"*inner_spaces + \"*\" + \" \"*inner_spaces + \"*\"\n inner_stars.center(total_width)\nend",
"def border\n puts \"--------------------------------\".center(75)\nend",
"def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end",
"def render_center(content)\n nrows, ncols = winsize\n\n ''.tap do |str|\n nlines = content.count(\"\\n\")\n row = [1, 1 + (nrows - nlines)/2].max\n content.each_line.with_index do |line, i|\n col = [1, 1 + (ncols - ansi_length(line.chomp))/2].max\n str << cursor_at(row + i, col) + line\n end\n end \nend",
"def center_of(string)\n middle = string.length / 2\n string.length.even? ? string.slice(middle - 1, 2) : string.slice(middle)\nend",
"def print_to_center(message)\nputs message.center(50)\nend",
"def center_of(str)\n midpoint = str.length / 2\n if str.length.even?\n str[midpoint - 1..midpoint]\n else\n str[midpoint]\n end\nend",
"def middle_word(text)\n words = text.split\n return '' if words.size <= 1\n\n words[words.size / 2]\nend",
"def white_middle(var)\n return \"║ #{var} ║\"\n\tend",
"def centerx=(x); self[0] = x - (self[2].div(2)); return x; end",
"def lfmi()\n return last + \" \" + first + \" \" + middle[0] \n end",
"def centre\n value.center(width, options[:pad])\n end",
"def mark_word dw, idx, dir\n dw.dir = get_direction_in_text dir\n dw.place = calculate_coordinate_in_grid idx\n end",
"def center(size)\n (@raw_columns - size) / 2\n end",
"def aligned\n case align\n when :right then text.rjust(width, ' ')\n when :centre then text.center(width, ' ')\n else text.ljust(width, ' ')\n end\n end",
"def center!\n @ob.center\n self\n end",
"def recenter!(k=3)\n old_center = @center\n # Reset center and return distance moved\n @center = Point.avg(@points,k)\n # puts \"#{old_center.word_array}\\n#{@center.word_array}\"\n return old_center.dist_to(center,k) \n end",
"def letter_spacing\n @info[:spacing]\n end",
"def initialize(stemmer = Polecat::SimpleStemmer.new)\n unless stemmer.respond_to? :stem\n raise ArgumentError, 'stemmer does not know #stem'\n end\n @stemmer = stemmer\n end"
] |
[
"0.6699699",
"0.60383385",
"0.59679097",
"0.5814321",
"0.5809986",
"0.55365324",
"0.5517084",
"0.5498824",
"0.5474269",
"0.543687",
"0.5369819",
"0.529048",
"0.5272716",
"0.5222548",
"0.5206372",
"0.5190653",
"0.5181427",
"0.51806927",
"0.51749367",
"0.5174347",
"0.5164812",
"0.5162559",
"0.5144438",
"0.51423013",
"0.5132744",
"0.5130037",
"0.5127675",
"0.50949395",
"0.5091179",
"0.50869864",
"0.50788546",
"0.50783795",
"0.5071673",
"0.5070543",
"0.50652814",
"0.50643003",
"0.50623155",
"0.5057573",
"0.50574344",
"0.5049968",
"0.5048626",
"0.5044789",
"0.5041109",
"0.5040065",
"0.50342625",
"0.5029521",
"0.50259763",
"0.5023412",
"0.5018432",
"0.50167096",
"0.5013588",
"0.49958378",
"0.49913168",
"0.49889565",
"0.49855974",
"0.49840564",
"0.4983244",
"0.49791852",
"0.49776685",
"0.49773932",
"0.49763462",
"0.49754784",
"0.49740422",
"0.49704278",
"0.49662545",
"0.49651045",
"0.49591315",
"0.49461472",
"0.4932953",
"0.49305812",
"0.4917045",
"0.49143088",
"0.49131918",
"0.49118987",
"0.48947474",
"0.48802465",
"0.48721412",
"0.4871523",
"0.48684135",
"0.4864841",
"0.48562226",
"0.48527494",
"0.48435652",
"0.48411483",
"0.48346698",
"0.48343065",
"0.48310038",
"0.48115474",
"0.4807436",
"0.4798378",
"0.47958216",
"0.47952512",
"0.47883558",
"0.47882146",
"0.478339",
"0.4779705",
"0.4776016",
"0.47715914",
"0.4768582",
"0.4762976"
] |
0.58835864
|
3
|
Syntax: = Title Author :HEADER ABSTRACT NOTE: note [NOTE] .Title (in preamble) ==== Content ==== [NOTE] (in preamble) [NOTE,source=name] (in body) .Title ==== Content ====
|
def admonition(node)
result = []
if node.parent.context == :preamble
note_attributes = {
# default title provided: title is mandatory
title: (node.title.nil? ? "NOTE" : node.title),
}
note_contents = HTMLEntities.new.decode([paragraph1(node)].flatten.join("\n"))
result << noko do |xml|
xml.note **attr_code(note_attributes) do |xml_note|
xml_note << note_contents
end
end
else
cref_attributes = {
anchor: node.id,
source: node.attr("source"),
}
# remove all formatting: cref content is pure text
cref_contents = flatten_rawtext(node)
cref_contents = [cref_contents].flatten.join("\n")
warn <<~WARNING_MESSAGE if node.blocks?
asciidoctor: WARNING (#{node.lineno}): comment can not contain blocks of text in XML RFC:\n #{node.content}
WARNING_MESSAGE
result << noko do |xml|
if node.parent.context !~ /table|example|paragraph|section/
xml.t do |xml_t|
xml_t.cref **attr_code(cref_attributes) do |xml_cref|
xml_cref << cref_contents
end
end
else
xml.cref **attr_code(cref_attributes) do |xml_cref|
xml_cref << cref_contents
end
end
end
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_doxy_header\n r = @remark.dup\n # Change the remark init for Doxygen\n r[0] = \"/*!\"\n r.insert(1,\"@defgroup #{@filename} #{@style} #{@filename}\")\n if @style == :emboss\n r = removeDoubleAt(r)\n end\n\n buf = r.join(\"\\n\")+\"\\n\"\n buf\n end",
"def parse_footnote_definition; end",
"def author; end",
"def headline; end",
"def head \n meta_author \"Kane Baccigalupi\"\n end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def doc_preamble(title, user, repository, template)\n doc_preamble = <<~DOC\n # Project: #{title}\n\n This is the GitHub repository for the project you named \"#{repository}\", generated from the \"#{template}\" website template at [yax.com](https://yax.com).\n\n From here, deploy your website for free hosting. Just click a button to deploy your website to [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), or [Render.com](https://render.com/). During the process, you will create a second repo for deployment. Name it what you like; I suggest \"#{repository}-deploy\".\n\n [](https://app.netlify.com/start/deploy?repository=https://github.com/#{user.login}/#{repository})\n\n [](https://vercel.com/import/project?template=https://github.com/#{user.login}/#{repository})\n\n [](https://render.com/deploy)\n \n For help, open a GitHub issue and mention [DanielKehoe](https://github.com/DanielKehoe) or email [support@yax.com](mailto:support@yax.com?subject=[GitHub]%20#{repository}).\n \n ## Stackless newsletter\n \n It is early days for Yax. If you are curious about what we are doing, go to [stackless.community](https://stackless.community/) and sign up for the newsletter, all about Yax and building websites without frameworks or build tools.\n \n\n DOC\n end",
"def preamble\n @preamble\n end",
"def title(_content)\n raise NotImplementedError\n end",
"def header\n \"*#{super}*\"\n end",
"def title!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 41 )\n\n type = TITLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 176:9: 'title'\n match( \"title\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 41 )\n\n end",
"def intro()\n show do\n title \"Introduction - Illumina RNA Seq Library Prep\"\n separator\n note \"This is the first step in the: <a href=https://support.illumina.com/downloads/truseq_stranded_total_rna_sample_preparation_guide_15031048.html>Illumina TruSeq Stranded Total RNA with RiboZero Guide</a>\"\n note \"In this protocol, you will be depleting the abundant ribosomal RNA from your sample.\"\n note \"Then, you will be chemically fragmenting the depleted RNA, since the Illumina platform is optimized for short reads.\"\n note \"<b>1.</b> Deplete riboRNA\"\n note \"<b>2.</b> Isolate & Wash Depleted RNA\"\n note \"<b>3.</b> Chemically Fragment RNA\"\n end\n end",
"def heading\n render_citation(@document)\n end",
"def title!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n type = TITLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 323:8: 'title'\n match( \"title\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end",
"def fileHeader(fname, curDate, misc=\"\")\r\n fname = File.basename(fname, \".gdl\")\r\n header = <<EOF\r\n/* **************************************************************************\r\n * File: #{fname}.gdl\r\n *\r\n * Guideline source generated #{curDate}\r\n * #{misc}\r\n *\r\n * *************************************************************************/\r\n\r\n\r\nEOF\r\n\r\n return header\r\n end",
"def note\n <<-ENDNOTE\n NOTE: Start date - #{@contact.start_date}\n ENDNOTE\n end",
"def notes; end",
"def notes; end",
"def notes; end",
"def build_title\n if title.blank?\n lines = body.strip.gsub(/\\r\\n/, \"\\n\").split(/\\n/)\n if lines.first.match(/\\A# (.*)\\Z/)\n self.title = $1\n lines.shift\n self.body = lines.join(\"\\n\").strip\n end\n end\n end",
"def docufy(src,i)\n m = /RM_[A-z0-9]+/.match(src[i])\n name = m[0]\n name = name.sub(\"RM_\",\"RedisModule_\")\n proto = src[i].sub(\"{\",\"\").strip+\";\\n\"\n proto = proto.sub(\"RM_\",\"RedisModule_\")\n proto = linebreak_proto(proto, \" \");\n # Add a link target with the function name. (We don't trust the exact id of\n # the generated one, which depends on the Markdown implementation.)\n puts \"<span id=\\\"#{name}\\\"></span>\\n\\n\"\n puts \"### `#{name}`\\n\\n\"\n puts \" #{proto}\\n\"\n puts \"**Available since:** #{$since[name] or \"unreleased\"}\\n\\n\"\n comment = \"\"\n while true\n i = i-1\n comment = src[i]+comment\n break if src[i] =~ /\\/\\*/\n end\n comment = markdown(comment)\n puts comment+\"\\n\\n\"\nend",
"def title=(text); end",
"def title=(text); end",
"def note_tag(text); end",
"def title\n @note.title\n end",
"def footnote_content; end",
"def title\n raise NotImplementedError, 'Subclasses must implement a title method.'\n end",
"def header; end",
"def header; end",
"def header; end",
"def body\n if author\n \"**#{author}**: #{text}\"\n else\n text\n end\n end",
"def name() title; end",
"def name() title; end",
"def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end",
"def base_docstring; end",
"def contstruct_readme\n config = template.config\n\n s = []\n s << \"# %s - %s\" % [config[:name], config[:summary]]\n s << \"## SYNOPSIS\"\n s << Array(usage).join(\"\\n\")\n s << \"## DESCRIPTION\"\n s << config[:description]\n s << \"## COPYRIGHT\"\n s << config[:copyright]\n s.join(\"\\n\\n\")\n end",
"def description_section(title, body)\n \"[#{sane title}]: #{sane body}\"\n end",
"def start_footnote(attributes)\n @mode = \"footnote|#{@mode}\"\n end",
"def title?; end",
"def pandoc_title_block( headers )\n title_block = \"\"\n headers.each do | header |\n if header[0].casecmp(\"title\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"author\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"date\") == 0\n title_block << \"% \" + header[1] + \"\\n\\n\"\n headers.delete( header )\n end\n end\n return title_block\n end",
"def note_for ref\n @note_order << ref\n\n label = @note_order.length\n\n \"{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]\"\n end",
"def section_title(title)\n end",
"def parse_footnote_marker; end",
"def header(title)\n \n clear = %x[clear]\n puts clear\n \n puts \" +++++++++++ +++++++++ ++++ \" \n puts \" +++++++++++++ +++++++++ +++ \" \n puts \" +++++++++++++++ +++++++++ ++ \" \n puts \" +++++++++++++++++ +++++++++ + \" \n puts \" +++++++++++++++++++ +++++++++ \" \n puts \" +++++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++++ +++++++++ +++++\" \n puts \" +++++++++++++++ +++++++++ \" \n puts \" +++++++++++++ +++++++++ http://ofxAddons.com/\" \n puts \" +++++++++++ +++++++++ http://openframeworks.cc/\"\n \n puts \"\"\n puts \" - #{title}\"\n puts \"\"\n puts \"\"\n \n end",
"def header article\n \"title, summary, source, date, guid, isPermaLink\"\n end",
"def intro()\n show do\n title \"Stitching Fragments by Overlap Extention (SOE)\"\n separator\n note \"In this protocol you will be guided in preparing an SOE reaction.\"\n note \"This method takes advantage of DNA fragments that have overlapping sequences.\"\n note \"The overlapping fragments will act as primers themselves and polymerize to create the desired amplicon.\"\n note \"<b>1.</b> Gather materials and fill with KAPA Master Mix\"\n note \"<b>2.</b> Add fragments in either equimolar ratios or similar mass - OPTIMIZE WHICH TO USE\"\n note \"<b>3.</b> Setup thermocycler conditions for SOE\"\n note \"<b>4.</b> Transfer samples from stripwells to labelled microfuge tubes for storage.\"\n end\n end",
"def heading\n\t\tname\n\tend",
"def heading\n\t\tname\n\tend",
"def header\n end",
"def name; title end",
"def metadata_comment_title(structure)\n \"#{(structure.highlighted_comment || structure.comments.last).title} (#{structure.comments_count} avis)\"\n end",
"def title\n end",
"def intro()\n show do\n title \"Introduction - RNA Quality Control\"\n separator\n note \"In this protocol you will prepare <a href=https://www.labviva.com/pub/static/frontend/Ueg/new/en_US/images/docs/HB-2326-001_1105695_IAS_QX_RNA_Quality_Control_0117_WW.pdf>RNA samples for analysis on the QIAxcel Bioanalyzer</a>.\"\n note \"1. Gather materials and reagents\"\n note \"2. Mix and place samples on thermocycler\"\n note \"3. Dilute\"\n end\n end",
"def docstring; end",
"def docstring; end",
"def note label\n #foottext = \"rdoc-label:foottext-#{label}:footmark-#{label}\"\n\n #ref.replace foottext if ref = @unlinked_notes.delete(label)\n\n @notes[label] = foottext\n\n #\"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] \"\n end",
"def tex_header(lang, gender, barcode)\n # writes yaml header on texing\n s = \"\\\\head{#{title(lang)}}{#{barcode}}\\n\\n\"\n s << \"#{intro(lang)}\\n\\n\"\n s << \"\\\\vspace{0.8mm}\"\n s << \"\\\\dataline{#{I18n.t(:title)}}\"\n s << \"{#{I18n.t(:lecturer)[gender]}}{#{I18n.t(:term)}}\\n\"\n s << \"\\\\vspace{-2.5mm}\"\n s\n end",
"def comments_section_title\r\n 'What are people saying?'\r\n end",
"def heading\n\t\tif self.discussed.nil?\n\t\t\tself.title\n\t\telse\n\t\t\t\"Comments\"\n\t\tend\n\tend",
"def titleIdentifier\n titleIdentifier = title + ' / ' + author\n titleIdentifier\n end",
"def add_title\n @bib.title.to_bibtex @item\n end",
"def initialize\n super(TITLE, DESCRIPTION, true)\n end",
"def onBriefingNotes _args\n \"onBriefingNotes _args;\" \n end",
"def header=(_arg0); end",
"def extract_default_title\n\t\treturn self.name unless self.readme&.table_of_contents&.first\n\t\ttitle = self.readme.table_of_contents.first.text\n\t\ttitle ||= self.name\n\tend",
"def render_latex_header(opts = {})\n opts[:title] ||= \"Questionnaire\"\n s = \"\\\\documentclass[10pt,a4paper, titlepage]{article}\\n\" +\n \"\\\\usepackage[utf8]{inputenc}\\n\" +\n \"\\\\usepackage[german]{babel}\\n\" +\n \"\\\\usepackage{amsmath}\\n\" +\n \"\\\\usepackage{amsfonts}\\n\" +\n \"\\\\usepackage{amssymb}\\n\" +\n \"\\\\usepackage{makeidx}\\n\" +\n \"\\\\usepackage{graphicx}\\n\" +\n \"\\\\usepackage{lmodern}\\n\" +\n \"\\\\usepackage{booktabs}\\n\" +\n \"\\\\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}\\n\"\n s += \"\\\\author{#{l opts[:author]}}\\n\" if opts[:author]\n s += \"\\\\title{#{l opts[:title]}}\\n\" if opts[:title]\n s += \"\\\\date{#{l opts[:date]}}\\n\" if opts[:date]\n s += \"\\\\begin{document}\\n\" +\n \"\\\\maketitle\\n\" +\n \"\\\\tableofcontents\\n\" +\n \"\\\\clearpage\\n\"\n s\n end",
"def title\n repo = (repository && repository.identifier.present?) ? \" (#{repository.identifier})\" : ''\n comm = short_comments.blank? ? '' : (': ' + short_comments)\n \"#{l(:label_revision)} #{format_identifier}#{repo}#{comm}\"\n end",
"def header(_content)\n raise NotImplementedError\n end",
"def title_name; end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def handle_title(name, attrs) \n \n end",
"def synopsis_note\n note = @strip['note']\n syn = @strip['synopsis']\n if note.nil?\n syn\n else\n \"#{syn} #{note}\"\n end\n end",
"def get_title(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"Where\")\n title = description.split(\"Where\")[0]\n # Title must fit on single line\n title.gsub!(\"\\n\", \" \").strip!\n title\n else\n super(n)\n end\n else\n super(n)\n end\n end",
"def annotate_header header, fname\n genome = genome_from_fname fname\n\n \"#{genome}____#{header}\"\n end",
"def head_title(title)\n content_for :head_title, title\n end",
"def emphasis; end",
"def title\n @tagline unless name?\n end",
"def header(progname = nil, &block)\n add(6, nil, progname, &block)\n end",
"def header(progname = nil, &block)\n add(6, nil, progname, &block)\n end",
"def title()\n @markdown_document.title()\n end",
"def description\n <<~EOS\n Curator's note:\n\n #{researcher_note}\n\n Original commit message:\n\n #{commit.description}\n\n EOS\n end",
"def head\n HEADER\n end"
] |
[
"0.6261203",
"0.61933917",
"0.6066417",
"0.60462946",
"0.6005541",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.59782726",
"0.5955347",
"0.59171045",
"0.58876455",
"0.5878372",
"0.58663636",
"0.58574337",
"0.5848133",
"0.5847878",
"0.58375823",
"0.5773556",
"0.57680994",
"0.57680994",
"0.57680994",
"0.5767766",
"0.57473075",
"0.57414055",
"0.57414055",
"0.5735887",
"0.5727516",
"0.57257503",
"0.5702998",
"0.56987154",
"0.56987154",
"0.56987154",
"0.5691601",
"0.569125",
"0.569125",
"0.56792164",
"0.5678357",
"0.56782037",
"0.56356424",
"0.5625877",
"0.5622752",
"0.5621058",
"0.5611366",
"0.559839",
"0.55975085",
"0.5596732",
"0.55733335",
"0.55729026",
"0.55676633",
"0.55676633",
"0.55564976",
"0.55475205",
"0.553756",
"0.5537111",
"0.55366594",
"0.5533585",
"0.5533585",
"0.55321854",
"0.55203074",
"0.5516148",
"0.55143815",
"0.55103594",
"0.5501069",
"0.54908776",
"0.5486021",
"0.5484793",
"0.54780215",
"0.5457587",
"0.5435064",
"0.5421351",
"0.54052913",
"0.54038495",
"0.54038495",
"0.54038495",
"0.53967243",
"0.5384422",
"0.5382138",
"0.53812075",
"0.53807265",
"0.5359028",
"0.5355665",
"0.53530943",
"0.53530943",
"0.5346734",
"0.5344628",
"0.5337957"
] |
0.0
|
-1
|
Syntax: [[id]] .Title [align,alt,suppresstitle] ==== Example ====
|
def example(node)
figure_attributes = {
anchor: node.id,
align: node.attr("align"),
alt: node.alt,
title: node.title,
'suppress-title': node.attr("suppress-title"),
# TODO: is 'suppress-title' the correct attribute name?
}
# TODO iref
seen_artwork = false
noko do |xml|
xml.figure **attr_code(figure_attributes) do |xml_figure|
node.blocks.each do |b|
case b.context
when :listing, :image, :literal, :stem
xml_figure << send(b.context, b).join("\n")
seen_artwork = true
else
# we want to see the para text, not its <t> container
if seen_artwork
xml_figure.postamble do |postamble|
postamble << b.content
end
else
xml_figure.preamble do |preamble|
preamble << b.content
end
end
end
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def title(*args)\n @title = args[0] if args.present?\n @title\n end",
"def title\n [id, name].join(' ')\n end",
"def title(title=\"\")\n self.tag('title', title)\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def handle_title(name, attrs) \n \n end",
"def title(*args, &block)\n element.title(*args, &block)\n end",
"def title(val)\n args_def.title = val\n end",
"def title=(text); end",
"def title=(text); end",
"def display_title(element)\n # Interface method\n end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def title; end",
"def show_title\n h2 { h @title.titles }\n text gs_title(@title)\n sources = []\n sources << a('Anime News Network Encyclopdia', :href => \"http://www.animenewsnetwork.com/encyclopedia/anime.php?id=#{@title.ann_id}\") unless @title.ann_id.nil?\n sources << a('AniDB', :href => \"http://anidb.net/perl-bin/animedb.pl?show=anime&aid=#{@title.anidb_id}\") unless @title.anidb_id.nil?\n \n unless sources.empty?\n p { \"View #{h @title.title} in #{sources.join(\", \")}.\" }\n end\n end",
"def display_title\n \"**#{title}**\"\n end",
"def short_title\n title\n end",
"def titleText _args\n \"titleText _args;\" \n end",
"def name; title end",
"def title_name; end",
"def title\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def section_title(title)\n end",
"def title(title)\n @title = title\n end",
"def name() title; end",
"def name() title; end",
"def title?; end",
"def title(title = nil)\n @title = title if title\n @title\n end",
"def title a_title = nil\n content_for :title, a_title\n end",
"def title(title)\n @title=title\n end",
"def augmented_title\n return self.title\n end",
"def title\n \"#{@artist} - #{@name} (#{@length})\"\n end",
"def title_comp=(_arg0); end",
"def title\n name\n end",
"def title\n name\n end",
"def identifier_string\n title\n end",
"def identifier_string\n title\n end",
"def title\n self.class.title(nil, params)\n end",
"def title\n @descriptive_detail.title\n end",
"def full_title\n \"#{namespace}:#{title}\"\n end",
"def tooltip_for_title(id)\n %Q{\n <script type='text/javascript'>\n var element = $(\"#{id}\");\n new Tooltip(element, element.title);\n </script>\n }\n end",
"def title(args = {}, &block)\n build_sub_component config(:card_title, :h5), :title, args, &block\n end",
"def name\n method_missing(:title)\n end",
"def format_title(what,options)\n what\n end",
"def title_full\n \"#{djs} - #{@title}\"\n end",
"def title(*args)\n strings = args.map do |arg|\n if arg.is_a?(Array) && arg.size >= 2\n link_to(*arg)\n else\n h(arg.to_s)\n end\n end\n html_title args.reverse.map {|s| (s.is_a?(Array) ? s.first : s).to_s}\n content_tag('h2', strings.join(' » ').html_safe)\n end",
"def title(*args)\n strings = args.map do |arg|\n if arg.is_a?(Array) && arg.size >= 2\n link_to(*arg)\n else\n h(arg.to_s)\n end\n end\n html_title args.reverse.map {|s| (s.is_a?(Array) ? s.first : s).to_s}\n content_tag('h2', strings.join(' » ').html_safe)\n end",
"def title(*args)\n strings = args.map do |arg|\n if arg.is_a?(Array) && arg.size >= 2\n link_to(*arg)\n else\n h(arg.to_s)\n end\n end\n html_title args.reverse.map {|s| (s.is_a?(Array) ? s.first : s).to_s}\n content_tag('h2', strings.join(' » ').html_safe)\n end",
"def captioned_title\n %(#{@caption}#{title})\n end",
"def title_comp; end",
"def title(opts = {}, &block)\n build_sub_component :h5, :title, opts, &block\n end",
"def title\n raise NotImplementedError, 'Subclasses must implement a title method.'\n end",
"def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end",
"def title\n #givea the instance title\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def display\n\t\ttitle\n\tend",
"def title\n self.summary\n end",
"def title\n Element.attr self, 'title'\n end",
"def h_title(text)\n\t\tcontent_for :title, text\n\tend",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def title(value = nil, options = nil)\n end",
"def title(title)\n content_for(:title, title)\n end",
"def write_title_formula(title, data_id, horiz = nil, font = nil) # :nodoc:\n @writer.tag_elements('c:title') do\n # Write the c:tx element.\n write_tx_formula(title, data_id)\n # Write the c:layout element.\n write_layout\n # Write the c:txPr element.\n write_tx_pr(horiz, font)\n end\n end",
"def html_title(*args)\n if args.empty?\n title = @html_title || []\n title.reject(&:blank?).join(' - ')\n else\n @html_title ||= []\n @html_title += args\n end\n end",
"def title\n @info[:Title]\n end",
"def title(*arguments, &block)\n @plugin_title = arguments.first if arguments.length > 0\n @plugin_title\n end",
"def title=(args)\n unless args.is_a?(String) || args.is_a?(Array)\n raise ArgumentError, \"You must provide a string or an array. You provided #{args.inspect}\"\n end\n args = Array(args)\n if args.first.is_a?(String)\n return if args == [''] \n args.each do |title_name|\n self.title_attributes = [{value: title_name, title_type: \"Program\"}]\n end\n else\n descMetadata.title=args\n end\n end",
"def title(*args)\n strings = args.map do |arg|\n if arg.is_a?(Array) && arg.size >= 2\n link_to(*arg)\n else\n h(arg.to_s)\n end\n end\n content_tag('h2', strings.join(' » ').html_safe)\n end",
"def title\n \"#{artist.name} - #{name} [#{release.catalog_number}]\"\n end",
"def title=(value)\n\t\t\t@title = value\n\t\tend",
"def title(cont, class_name)\n div = @doc.at_css \"div[@class='row title #{class_name}']//a\"\n div.content = cont\n end",
"def title_for(**options)\n\t\t\t\t\tif title = options[:title]\n\t\t\t\t\t\treturn title\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t# Generate a title from a field name:\n\t\t\t\t\tif field_name = field_for(**options)\n\t\t\t\t\t\t# Remove postfix \"_id\" or \"_ids\":\n\t\t\t\t\t\treturn Strings::to_title(field_name.to_s.sub(/_ids?/, ''))\n\t\t\t\t\tend\n\t\t\t\tend",
"def\n get_title()\n @title\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || \"\"\n end",
"def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end",
"def title\n @title\n end"
] |
[
"0.6894373",
"0.68846774",
"0.6882232",
"0.68730336",
"0.68730336",
"0.68730336",
"0.6825738",
"0.6797054",
"0.6765199",
"0.67333245",
"0.67333245",
"0.67314374",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.67284244",
"0.6674267",
"0.6633897",
"0.66238624",
"0.66185725",
"0.65902686",
"0.654176",
"0.65408045",
"0.65144265",
"0.65144265",
"0.65144265",
"0.651317",
"0.6496488",
"0.64962626",
"0.64962626",
"0.6482352",
"0.6481389",
"0.6480021",
"0.64788496",
"0.645461",
"0.64544004",
"0.64423424",
"0.64235854",
"0.64235854",
"0.64192075",
"0.64192075",
"0.64026356",
"0.63885033",
"0.6372439",
"0.6354629",
"0.63543725",
"0.63500226",
"0.6342751",
"0.6337917",
"0.6334953",
"0.6334953",
"0.6334953",
"0.63342625",
"0.63261104",
"0.630857",
"0.6307259",
"0.6305175",
"0.6298037",
"0.6294388",
"0.6294388",
"0.6294388",
"0.6294388",
"0.6294388",
"0.6294388",
"0.6294388",
"0.62824917",
"0.6279291",
"0.62702316",
"0.62636286",
"0.6261805",
"0.62602603",
"0.62479925",
"0.6240019",
"0.62355185",
"0.62336946",
"0.6233384",
"0.6229006",
"0.6225687",
"0.62225646",
"0.6217545",
"0.62112904",
"0.62036425",
"0.6195466",
"0.61921924",
"0.61921924",
"0.6191644",
"0.6190464"
] |
0.0
|
-1
|
Syntax: .name [source,type,src=uri] (src is mutually exclusive with listing content) (v3) [source,type,src=uri,align,alt] (src is mutually exclusive with listing content) (v2) code
|
def listing(node)
sourcecode_attributes = {
align: node.attr("align"),
alt: node.alt,
name: node.title,
type: node.attr("language"),
src: node.attr("src"),
}
# NOTE: html escaping is performed by Nokogiri
sourcecode_content =
sourcecode_attributes[:src].nil? ? "\n" + node.lines.join("\n") + "\n" : ""
noko do |xml|
if node.parent.context != :example
figure_attributes = {
anchor: node.id,
}
xml.figure **attr_code(figure_attributes) do |xml_figure|
# xml_figure.artwork sourcecode_content, **attr_code(sourcecode_attributes)
xml_figure.artwork **attr_code(sourcecode_attributes) do |a|
a.cdata sourcecode_content
end
end
else
# xml.artwork sourcecode_content, **attr_code(sourcecode_attributes)
xml.artwork **attr_code(sourcecode_attributes) do |a|
a.cdata sourcecode_content
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def src; end",
"def src; end",
"def src; end",
"def source_name\n 'Archives & Manuscripts'\n end",
"def src_verb\n @src\n end",
"def set_name(name, source: :custom)\n @name = name\n @source = SOURCES.include?(source) ? source.to_sym : :custom\n end",
"def formatted_file_list(title, source_files); end",
"def support_multiple_source?; end",
"def name\n source.longname\n end",
"def source_list(label, *list)\n _logger.warn \"Duplicate source_list '#{label}'\" if @result.source_lists.has_key?(label)\n @result.source_lists[label] += list\n end",
"def listing(node)\n sourcecode_attributes = {\n anchor: node.id,\n align: nil,\n alt: nil,\n name: node.title,\n type: node.attr(\"language\"),\n src: node.attr(\"src\"),\n }\n\n # NOTE: html escaping is performed by Nokogiri\n sourcecode_content =\n sourcecode_attributes[:src].nil? ? \"\\n\" + node.lines.join(\"\\n\") + \"\\n\" : \"\"\n\n noko do |xml|\n if node.parent.context != :example\n xml.figure do |xml_figure|\n # xml_figure.sourcecode sourcecode_content, **attr_code(sourcecode_attributes)\n xml_figure.sourcecode **attr_code(sourcecode_attributes) do |a|\n a.cdata sourcecode_content\n end\n end\n else\n # xml.sourcecode sourcecode_content, **attr_code(sourcecode_attributes)\n xml.sourcecode **attr_code(sourcecode_attributes) do |a|\n a.cdata sourcecode_content\n end\n end\n end\n end",
"def srcs(name, extras = {})\n class_exec do\n attr_reader name\n register_job_argument(name, :srcs, extras)\n end\n end",
"def embed(src, mime_type, label)\nend",
"def annotate_sources\n item_names.each do |source_name|\n with_valid_source source_name do |source_card|\n tag_with_report_type source_card\n tag_with_company source_card\n tag_with_year source_card\n end\n end\nend",
"def full_source=(_arg0); end",
"def source() end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def sources\n %w[\n sample_source\n ]\nend",
"def source_helper(source_location, name = T.unsafe(nil)); end",
"def source_location(*); end",
"def source_location(*); end",
"def link_standard_from_code(to, from)\n to.source = from.container.url\n to.id = from.id\n to.uri = from.uri\n to.prefix = from.container.id\n to.title = from.title\n to.description = from.description\n to.pattern = from.pattern\nend",
"def source(filename); end",
"def adapt_source(source); end",
"def update!(**args)\n @inline_source = args[:inline_source] if args.key?(:inline_source)\n end",
"def thumbnail(name)\n name_li(name).link(:title=>\"View this item\").image.src\n end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source=(_arg0); end",
"def source_files; end",
"def source_type(source)\n return \"<div class='source'><img src='https://www.bungie.net/#{source['icon']}' title='#{source['sourceName']}' class='image'><div class='text'><span class='title'>#{source['sourceName']}</span><span class='desc'>#{source['description']}</span></div></div>\".html_safe\n end",
"def add_doc_specific_attributes(filepath, is_src, attributes); end",
"def alt_content_tag(name, *args, &block)\n options = args.extract_options!\n name = FreightTrain.tag(name)\n content = block_given? ? capture(&block) : args.first\n content_tag(name, content, options)\n #content_tag(name, *args, &block)\n end",
"def docufy(src,i)\n m = /RM_[A-z0-9]+/.match(src[i])\n name = m[0]\n name = name.sub(\"RM_\",\"RedisModule_\")\n proto = src[i].sub(\"{\",\"\").strip+\";\\n\"\n proto = proto.sub(\"RM_\",\"RedisModule_\")\n proto = linebreak_proto(proto, \" \");\n # Add a link target with the function name. (We don't trust the exact id of\n # the generated one, which depends on the Markdown implementation.)\n puts \"<span id=\\\"#{name}\\\"></span>\\n\\n\"\n puts \"### `#{name}`\\n\\n\"\n puts \" #{proto}\\n\"\n puts \"**Available since:** #{$since[name] or \"unreleased\"}\\n\\n\"\n comment = \"\"\n while true\n i = i-1\n comment = src[i]+comment\n break if src[i] =~ /\\/\\*/\n end\n comment = markdown(comment)\n puts comment+\"\\n\\n\"\nend",
"def collectible_source decorator, options={}\n if decorator.object.class == Feed\n feed_entries_status decorator.object\n elsif decorator.object.class == List\n 'compiled by '.html_safe + homelink(decorator.object.owner, options)\n elsif (decorator.object.respond_to?(:site) && decorator.object.site)\n 'source: '.html_safe + homelink(decorator.object.site, options)\n end\n end",
"def source(options = {})\r\n end",
"def reg_fp; /src\\=\\\"(.+)/; end",
"def reg_fp; /src\\=\\\"(.+)/; end",
"def compute_asset_extname(source, options = T.unsafe(nil)); end",
"def filename= name\n #This is a stub, used for indexing\n end",
"def data(name, ext, content, private_gist)\n return {\n 'file_ext[gistfile1]' => ext ? ext : '.txt',\n 'file_name[gistfile1]' => name,\n 'file_contents[gistfile1]' => content\n }.merge(private_gist ? { 'action_button' => 'private' } : {}).merge(auth)\n end",
"def sources_list_dl(sources, opts)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n if opts.download\n Storage.instance.download_sources\n else\n IO.instance.sources_print(sources.sources)\n end\n end",
"def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end",
"def src\n params['src']\n end",
"def sources(*srcs)\n @recipe.sources << srcs.flatten.compact\n end",
"def inspect_source(*args)\n super(*args, source_file)\n end",
"def srcs!(name, extras = {})\n class_exec do\n attr_reader name\n register_job_argument(name, :isrcs, extras)\n eval(\"def #{name}!; @deltas[:#{name}]; end\") # rubocop:disable Security/Eval\n end\n end",
"def source_type; end",
"def sources(opts)\n if opts.edit\n path = File.expand_path(Config.instance.options['sources']['path'])\n Config.instance.open_file(path)\n else\n sources = Sources.instance\n sources.parse(@sources)\n sources_list_dl(sources, opts)\n end\n end",
"def put_together_name(full_or_part)\n tag = :\"description_#{full_or_part}_title_#{source_type}\"\n user_name = begin\n user.legal_name\n rescue StandardError\n \"?\"\n end\n args = {\n text: source_name,\n user: user_name\n }\n if full_or_part == :full\n args[:object] = parent.format_name\n elsif source_name.present?\n tag = :\"#{tag}_with_text\"\n end\n tag.l(args)\n end",
"def parse_source_file_definition(data, defs={})\n return if defs.empty?\n defs.each do |_def|\n data[_def.url] = { 'title' => '', 'config' => {} } if data[_def.url].nil?\n record = { 'url' => _def.url, 'title' => _def.get_props[\"@title\"], 'content' => '' }\n if _def.get_props['@params'] then\n record['params'] = []\n _def.get_props['@params'].each_pair do |k,v|\n record['params'] << [k,v]\n end\n end\n record['content'] = _def.get_props['@content'].gsub(/\\n/,'<br/>') if _def.get_props['@content']\n if _def.get_props['@description'] then\n data[_def.url]['title'] = _def.get_props['@description']\n end\n data[_def.url]['config'][_def.method] = record\n end\n data\n end",
"def display_source_file(doc_info)\n <<~SRC_FILE_TXT\n Source file::\n #{doc_info.src_file}\n SRC_FILE_TXT\n end",
"def update!(**args)\n @src = args[:src] if args.key?(:src)\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def meta name, opts = {}, &block\n Base.sources.current_load_source.templates.add name, opts, block\n end",
"def source_name=(value)\n @source_name = value\n end",
"def annotate_sources\n item_names.each do |source_name|\n with_valid_source source_name do |source_card|\n add_report_type source_card\n add_company source_card\n end\n end\nend",
"def show_titlesource(result)\n item = result.fetch('Items', []).find { |item|\n item['Group'].downcase == \"src\"\n }\n item.present? ? processAPItags(item['Data'].to_s).html_safe : ''\n end",
"def initialize(src = 'm')\n @src = src\n end",
"def read_src name\n IO.readlines('../src/' + name).collect{|c| \"\\t\" + c}\nend",
"def format_source(source); end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @predefined_source = args[:predefined_source] if args.key?(:predefined_source)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @predefined_source = args[:predefined_source] if args.key?(:predefined_source)\n end",
"def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end",
"def fix_sources doc, srcdir, destdir, serverdir, tag='img', attr='src', &bl\n\tputs \"\\tFixing #{tag} tags' #{attr} attribute\"\n\n\ttags = doc.css(tag)\n\tpostregex = %r{https?://[^/]*posterous.com/}\n\ttags.each do |img|\n\t\tnext unless img[attr] =~ postregex\n\n\t\tshortname = img[attr].split('/').last.split('.scaled').first\n\t\text = shortname.split('.').last.downcase\n\t\tputs \"\\t#{tag}: #{shortname}\"\n\n\t\tif block_given?\n\t\t\timg[attr] = yield img, img[attr]\n\t\telse\n\t\t\tif srcdir == nil\n\t\t\t\t# Download the file\n\t\t\t\tputs \"\\t\\tDownloading #{shortname}\"\n\t\t\t\tFile.open(File.join(destdir, shortname), \"w\") do |file|\n\t\t\t\t\tfile.write(URI.parse(img[attr]).read)\n\t\t\t\tend\n\t\t\t\tin_img = shortname\n\t\t\telse\n\t\t\t\t# Find matching files\n\t\t\t\tmatches = Dir.entries(srcdir).select {|imgfile|\n\t\t\t\t\timgfile.downcase.end_with?(ext) &&\n\t\t\t\t\t\timgfile.gsub(/\\s+/, '_').include?(shortname.split('.').first)\n\t\t\t\t}\n\n\t\t\t\tif matches.length == 0\n\t\t\t\t\tmatches = Dir.entries(srcdir).select {|imgfile|\n\t\t\t\t\t\timgfile.gsub(/\\s+/, '_').include?(shortname.split('.').first)\n\t\t\t\t\t}\n\t\t\t\t\tif matches.length == 0\n\t\t\t\t\t\tputs \"\\n\\n\\n########\\nNo match found for #{img[attr]} in #{srcdir}\\n########\\n\\n\"\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif matches.length > 1\n\t\t\t\t\treduced = matches.select {|imgfile|\n\t\t\t\t\t\timgfile.include?(shortname)\n\t\t\t\t\t}\n\t\t\t\t\tif reduced.length == 1\n\t\t\t\t\t\tmatches = reduced\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"\\n\\n\\n########\\nMore than one match found for #{shortname}:\"\n\t\t\t\t\t\tputs matches\n\t\t\t\t\t\tputs \"You will need to double-check #{tag} tags in #{filename}\\n\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tin_img = matches.first\n\n\t\t\t\tputs \"\\t\\tUsing #{in_img} for #{shortname}\"\n\n\t\t\t\t# Copy the file into the destination directory\n\t\t\t\tFileUtils.cp(File.join(srcdir, in_img), destdir)\n\t\t\tend\n\n\t\t\t# Update the tag's attribute\n\t\t\timg[attr] = EscapeUtils.escape_uri(File.join(serverdir, in_img))\n\t\tend\n\n\t\t# Remove a link wrapping the image, if one exists\n\t\tparent = img.parent\n\t\tif parent.node_name == 'a' && parent['href'] =~ postregex\n\t\t\tputs \"\\t\\tRemoving parent link: #{parent['href']}\"\n\t\t\tparent.replace(img)\n\t\tend\n\tend\nend",
"def url(*args)\n if [:thumb, :content].include?(args.first)\n send(\"url_#{args.first.to_s}\")\n else\n file.url(*args)\n end\n end",
"def source= string\n #This is a stub, used for indexing\n end",
"def source\n ap get_source\n end",
"def audio_tag(*sources); end",
"def formatted_source_file(source_file); end",
"def update!(**args)\n @is_vulgar = args[:is_vulgar] if args.key?(:is_vulgar)\n @leading_text_type = args[:leading_text_type] if args.key?(:leading_text_type)\n @snippet_html = args[:snippet_html] if args.key?(:snippet_html)\n @snippet_type = args[:snippet_type] if args.key?(:snippet_type)\n @source = args[:source] if args.key?(:source)\n @tidbits = args[:tidbits] if args.key?(:tidbits)\n @trailing_ellipsis = args[:trailing_ellipsis] if args.key?(:trailing_ellipsis)\n end",
"def git_sources=(_arg0); end",
"def git_sources=(_arg0); end",
"def file_desc\n \"Files (#{file_ext(',')})\"\n end",
"def src\n read_attr :src\n end",
"def load_snippet(name, group)\n path = File.expand_path name, snippet_path(group)\n File.read path\n end",
"def load_snippet(name, group)\n path = File.expand_path name, snippet_path(group)\n File.read path\n end",
"def process(src)\n super\n @format = case src.parser.to_s\n when 'RDoc::Parser::PerlPOD'\n 'perl'\n when 'RDoc::Parser::C'\n 'c'\n when 'RDoc::Parser::Simple'\n 'text'\n else\n 'ruby'\n end\n\n @last_modified = src.last_modified\n @absolute_name = src.absolute_name\n @full_name = src.full_name\n end",
"def source_info\n source_file = audio? ? to_mp3 : full_filename\n info = {:member => member, :filename => source_file}\n info[:parent_id] = self.id\n yield info, (audio? ? Audio : WebVideo)\n end",
"def source\n return @source if @source\n WHITELIST_REGEXES.each_pair do |name, reg|\n if source_url =~ reg\n @source = name\n break\n end\n end\n @source\n end",
"def src\n\t\tnode['src']\n\tend",
"def command_sources(str_opts)\n command :sources do |c|\n c.syntax = 'budik sources [options]'\n c.summary = @str_sources.summary\n c.description = @str_sources.description\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--download', str_opts.download\n c.option '-e', '--edit', str_opts.download\n c.action { |_args, opts| Command.new(:sources, opts) }\n end\n end"
] |
[
"0.5884463",
"0.5884463",
"0.5884463",
"0.5857464",
"0.5756046",
"0.573369",
"0.5717702",
"0.5715123",
"0.5586649",
"0.55852306",
"0.5555276",
"0.5536255",
"0.5463415",
"0.54070485",
"0.536807",
"0.53174645",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5281589",
"0.5275221",
"0.5273689",
"0.5269328",
"0.5269328",
"0.5253101",
"0.5226998",
"0.52050537",
"0.51905036",
"0.51877564",
"0.51847637",
"0.51847637",
"0.51847637",
"0.51847637",
"0.51847637",
"0.5177058",
"0.5175805",
"0.5161255",
"0.51534057",
"0.51106966",
"0.5108917",
"0.5098899",
"0.50957274",
"0.50957274",
"0.509274",
"0.5072922",
"0.50524473",
"0.50519776",
"0.505156",
"0.5051069",
"0.5050273",
"0.5048247",
"0.5047363",
"0.5036217",
"0.5022627",
"0.5020528",
"0.50049335",
"0.500282",
"0.50004023",
"0.4993115",
"0.49895537",
"0.4989317",
"0.49863318",
"0.49823624",
"0.4974321",
"0.49720874",
"0.49672785",
"0.4967262",
"0.4967262",
"0.49663374",
"0.49647406",
"0.49635625",
"0.49633643",
"0.49599501",
"0.4958817",
"0.49585527",
"0.49553424",
"0.49549374",
"0.49549374",
"0.49527705",
"0.49422967",
"0.49286312",
"0.49286312",
"0.49218053",
"0.49115485",
"0.49079493",
"0.49003726",
"0.4900117"
] |
0.53896815
|
14
|
Increments win Used for winkeeping after game ends Inputs: none Outputs: none
|
def increment_win_score
PlayerModelContracts.invariant(self)
@score = @score + 1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def increment_win\n self.games_won += 1 \n increment_games_played\n end",
"def player_win\n @player_win += 1\n end",
"def win?\n if won_game?\n @games_won += 1\n won_set\n return true\n end\n end",
"def win\n @streak += 1\n end",
"def win\n @score += 1\n end",
"def win\n @score += 1\n end",
"def win_actions\n @i.cls\n @i.show_balance(@user)\n @i.show_cards(@open, @user, @croupier)\n @i.winner_msg(@user, @croupier, @winner) if @winner == @user || @winner == @croupier\n @i.winner_msg(@user, @croupier, @draw) if @winner == @draw\n\n # balance\n @winner.balance += @bank if @winner == @user || @winner == @croupier\n if @winner == @draw\n @user.balance += 10\n @croupier.balance += 10\n end\n # play again\n if check_end\n @i.cls\n @winner = nil\n @bank = 0\n @open = false\n @loser = nil\n # start new game\n else\n # exit from the program\n @again = false\n end\n end",
"def winGame\n @victory = true\n if @level == 2\n @win = true\n end\n end",
"def mark_win!\n # update point tables\n if @winner && @looser\n game.point_tables.create(winner_id: winner, looser_id: looser, started_at: game.started_at, ended_at: Time.zone.now, result: 'won')\n game.update_status(Game::WIN)\n end\n\n # reset board!\n reset_board!\n\n # reset winner and looser histories!\n @winner = false\n @looser = false\n\n true\n end",
"def win?\n while true\n @board.render(false)\n @player.get_input\n move_valid?\n if @board.board == @board.winningboard\n render(true)\n puts \"Congratulations!\"\n exit\n end\n end\n end",
"def check_win\n\t\t\tif win\n\t\t\t\tputs \"\\n You win!\" \n\t\t\telse\n\t\t\t\t# shows how many turns remain\n\t\t\t\tputs \"\\n You have #{TURNS - @turns} turns left\"\n\t\t\tend\n\t\tend",
"def win(credits=nil)\n @credits += credits if credits\n puts self.class.message(:win).colorize :green\n end",
"def win\n\t\tputs \"Player #{@myIndex} made a correct accusation and has won the game!\"\n\tend",
"def win\r\n\t\tfor i in 1..@mines do\r\n\t\t\tx=@mine[i].x\r\n\t\t\ty=@mine[i].y\r\n\t\t\t\r\n\t\t\tremove_pic(@field[x][y])\r\n\t\t\tadd_pic(@field[x][y],F_flag)\r\n\t\tend\r\n\t\t\r\n\t\t@start_button.remove(@actual_face)\r\n\t\t@actual_face=@image[Win]\r\n\t\t@start_button.add(@actual_face)\r\n\t\t\r\n\t\t@game_status=FINISHED\r\n\t\t\r\n\t\t@fenster.show_all\n\t\tif @closed_fields==@mines and !@endless_time #won\r\n\t\t\tprozent=(@progress_bar.fraction * 100) / @time_multiplicator\r\n\t\t\t\r\n\t\t\tnew_highscore(@max_time - (@actual_time - @start_time),prozent)\r\n\t\tend\r\n\tend",
"def increment_game\n change_turn\n @turn += 1 if @player_to_move == \"w\"\n end",
"def check_win\n if @game_board.return_count == 5 and @timer.return_time >= 0\n @win = true\n end\n if @game_board.return_count < 5 and @timer.return_time == 0\n @lose = true\n end\n end",
"def update_winners\n return true if draw?\n winner.wins_count.increment\n Player.rank.incr(winner.id)\n looser.loose_count.increment\n true\n end",
"def victory\n @wins += 1\n end",
"def win_game\n clear_message_box\n @ui.place_text('THY QUEST IS OVER!'.center(20),1,2)\n (0..36).each do |i|\n hero_direction = POS_TURN.rotate!(i <=> 16)[0]\n @ui.place_text(DungeonOfDoom::CHAR_PLAYER[hero_direction], @cur_x+2, @cur_y+6, DungeonOfDoom::C_WHITE_ON_RED)\n sleep 0.1\n @ui.refresh\n end\n ask_question(\"THY SCORE=#{((@treasure*10)+(@gold_count*@stats[:experience])+@stats[:strength]+\n @stats[:vitality]+@stats[:agility]).round}\",MSG_KEY)\n end",
"def won_game(player)\n if player.advantage\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n elsif player.points > 3 and player.opponent.points < 3\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n end\n end",
"def win?\n\t\tif @win_condition == @pegs[2]\n\t\t\tputs \"\\nCongratulations! You have solved this Tower of Hanoi! Would you like to start over? Please enter 'y' for yes or 'n' for no!\"\n\t\t\tresponse = gets.chomp.downcase\n\t\t\tplay_again?(response)\n\t\tend\n\t\tputs \"\\nPlease make your next move!\"\n\t\tmove_input\n\tend",
"def win\n end",
"def win\n end",
"def congrats_winner(turn_winner) #UX\n if turn_winner == nil\n puts\n sleep 1\n puts \"\\nIt's a tie! EVERYBODY WINS!\\n\" \n sleep 1 \n else\n puts\n sleep 1\n puts \"You win that round, #{turn_winner}!\"\n sleep 1\n end\n end",
"def record_won_ball!\n @points += 1\n win?\n end",
"def player_won\n\t\tputs \"\\nCongratulations! your have won!\"\n\t\tself.player_record[\"Wins\"] += 1\n\tend",
"def set_won?\n if @games_won == 6 && @opponent.games_won < 5\n @sets_won += 1\n @games_won = 0\n @opponent.games_won = 0\n end\n if @games_won == 7 && @opponent.games_won < 7\n @sets_won += 1\n @games_won = 0\n @opponent.games_won = 0\n end\n end",
"def win!(payoff)\n\t\t@balance.balance += Integer((1.0 + payoff)*@bet)\n\t\t@bet = 0\n\tend",
"def win_or_lose\n if game_data.guesses_remaining.zero?\n puts File.read('./views/you_dead')\n puts File.read('./views/dead')\n elsif game_data.letters_left_to_guess == []\n puts File.read('./views/winscreen')\n else\n # allows us to break recursion if we are testing\n @test_cond == false ? Turn.new(game_data) : true\n end\n end",
"def player_win\n @player.won_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end",
"def draw\n if (!@win and @lose) or (@frameCounter == 0 and @game_board.return_count < 5 and @timer.return_time == 0)\n draw_lose\n elsif (@win and !@lose)\n draw_win\n elsif (!@win and !@lose)\n draw_background\n @game_board.draw_board\n @timer.draw \n end\n end",
"def set_games_won()\n @score_count.set_games_won()\n end",
"def win_pts\n self.score += 1\n end",
"def win?\n if @player1.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player2.name} wins!\"\n sleep(1)\n elsif @player2.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player1.name} wins!\"\n sleep(1)\n else\n turn\n end\n end",
"def record_won_ball!\n # Check to see if a win-point results in a win-game outcome. \n if @points > 3 && @points >= @opponent.points + 2\n @game_points += 1\n \n record_won_game!\n reset_points\n\n else\n @points +=1 \n end \n end",
"def winner\n puts \"██╗ ██╗██╗███╗ ██╗███╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██║ ██║██║████╗ ██║████╗ ██║██╔════╝██╔══██╗\"\n sleep(1)\n puts \"██║ █╗ ██║██║██╔██╗ ██║██╔██╗ ██║█████╗ ██████╔╝\"\n sleep(1)\n puts \"██║███╗██║██║██║╚██╗██║██║╚██╗██║██╔══╝ ██╔══██╗\"\n sleep(1)\n puts \"╚███╔███╔╝██║██║ ╚████║██║ ╚████║███████╗██║ ██║\"\n sleep(1)\n puts \" ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n restart_game\nend",
"def check_winner\n if win_state == CHECK\n if players[0].get_hand_score >= players[1].get_hand_score\n self.win_state = LOSS\n else\n self.win_state = WIN\n end\n end\n\n if win_state == WIN\n self.wins = wins + 1 \n puts \"Good win! You're now at #{wins} wins and #{losses}.\"\n else\n self.losses = losses + 1\n puts \"Better luck next time. You're now at #{wins} wins and #{losses} losses.\"\n end\n end",
"def win\n if @guess == $code_strings\n puts Rainbow(\"You win!\").color(:green)\n @board.draw\n true\n else\n false\n end\n end",
"def win; end",
"def nextRound\n retval = false\n if @game_parameters[ @GAME_STATE ] == @STATE_GOING\n if @game_parameters[ @GAME_CURRENT_ROUND ] < @game_parameters[ @GAME_NUM_ROUNDS ]\n @game_parameters[ @GAME_CURRENT_ROUND ] += 1\n oneRound( nil, nil, nil, @channel, nil )\n retval = true\n else\n # No more rounds in the game. GAME OVER.\n\n put \"Game over.\"\n\n @game_parameters[ @GAME_STATE ] = @STATE_NONE\n\n # Reward game winner.\n\n high_score = 0\n high_wins = 0\n @players.each_value do |data|\n if data[ @PLAYER_WINS ] > high_wins\n high_wins = data[ @PLAYER_WINS ]\n end\n if data[ @PLAYER_SCORE ] > high_score\n high_score = data[ @PLAYER_SCORE ]\n end\n end\n\n $reby.log \"highs: #{high_wins} #{high_score}\"\n\n winners = Array.new\n @players.each do |nick, data|\n if @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_WINS\n if data[ @PLAYER_WINS ] == high_wins\n winners.push nick\n $reby.log \"Adding winner: #{nick}\"\n end\n elsif @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_POINTS\n if data[ @PLAYER_SCORE ] == high_score\n winners.push nick\n $reby.log \"Adding winner: #{nick}\"\n end\n end\n if @score[ nick ] == nil\n # New player\n addScoreRecord( nick )\n end\n @score[ nick ][ @SCORE_GAMES_PLAYED ] += 1\n end\n\n win_reason = \"nothing\"\n if @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_WINS\n win_reason = \"#{high_wins} wins\"\n elsif @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_POINTS\n win_reason = \"#{high_score} points\"\n end\n if winners.length > 1\n put \"A #{winners.length}-way tie for the win!\"\n put \"#{winners.join( ', ' )} each had #{win_reason}.\"\n else\n put \"#{winners[ 0 ]} is the game winner with #{win_reason}.\"\n end\n\n other_scores = \"Other scores: \"\n @players.each do |nick, data|\n next if winners.include?( nick )\n case @game_parameters[ @GAME_WIN_CRITERION ]\n when @WINBY_WINS\n score_str = data[ @PLAYER_WINS ]\n when @WINBY_POINTS\n score_str = data[ @PLAYER_SCORE ]\n end\n other_scores += \"#{nick}: #{score_str} \"\n end\n put other_scores\n\n if winners.length == 1\n @score[ winners[ 0 ] ][ @SCORE_GAMES_WON ] += 1\n else\n winners.each do |winner|\n @score[ winner ][ @SCORE_GAMES_TIED ] += 1\n end\n end\n\n saveScores\n\n end\n end\n return retval\n end",
"def check_win(player_symbol)\n if horizontal?(player_symbol) || vertical?(player_symbol) || diagonal?(player_symbol)\n @@win = true\n puts \"\\nPlayer #{player_symbol} wins! Re-run the program to play again.\"\n exit\n end\n end",
"def add_win(game)\r\n self.wins += 1\r\n self.games << game\r\n end",
"def win \n return 'Win!'\n end",
"def run\n play_round until game_over?\n puts \"#{winner} wins!\"\n end",
"def play\nturn until over?\nif won?\n puts \"Congratulations #{winner}!\"\nelsif draw? == true\n puts \"Game over! Thanks for playing.\"\nend\nend",
"def easy_win(player)\n win if player.points == 4 && player.opponent.points < 3\n end",
"def game_over?\n if victory?\n @@score[\"Player #{@other_player.mark}\"] += 1\n puts \"\\nBehold the winner - the #{@other_player}!!!\\n\"\n # show_score\n show_score\n true\n elsif @turns == 9\n @@score[:draws] += 1\n puts \"\\nIt's a draw!\\n\"\n # show_score\n show_score\n true\n else\n false\n end\n end",
"def set_win_lose_draw(tictactoe, result)\n if result == \"win\"\n tictactoe.players[0].win += 1\n tictactoe.players[1].lose += 1\n elsif result == \"lose\"\n tictactoe.players[0].lose += 1\n tictactoe.players[1].win += 1\n else\n tictactoe.players[0].draw += 1\n tictactoe.players[1].draw += 1\n end\n end",
"def win\n # horizontal win\n winner = horizontal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Vertical win (way harder to test for)\n winner = vertical_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Diagonal win\n winner = diagonal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # If the board is full and there are no declared winners\n\n if full?\n victory(\"Nobody\")\n return \"tie\"\n end\n return false\n end",
"def start_game\n puts 'GAME STARTED'\n until @is_game_over\n @count_turns += 1\n @board.draw_board\n @board.update_board(@controller.get_input)\n game_over?\n end\n puts @count_turns\n end_game\n end",
"def game_win\n puts 'Congratulations! You win!'\n puts \"Your guess: #{@guess}\"\n puts \"Secret code: #{@secret_code}\"\n play_again?\n end",
"def win_round\n interface.win_round\n player.win_round\n croupier.lost_round\n overall_result\n end",
"def record_won_set!\n reset_points\n reset_game_points \n \n @set_points +=1\n end",
"def track_p1_wins(winner)\n if winner == 1\n return 1\n else\n return 0\n end\nend",
"def win(player)\n\tgreeting\n puts \"---------------------\"\n show_grid\n puts \"\"\n puts \"G A M E O V E R\"\n puts \"\"\n\tif player == $computer_piece\n\t\tputs \"The computer wins!\"\n\telse\n\t\tputs \"You won the game!\"\n\tend\n\tputs \"\"\n\tputs \"---------------------\"\n\texit\nend",
"def lengthwin\n puts \"You have six cards, and are under 21. Congratulations, you win.\"\n restart\n end",
"def win\n winning_move(@computer_mark)\n end",
"def set_other_games_won()\n @score_count.set_other_games_won()\n end",
"def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end",
"def win(player)\n player.win(@bank)\n\n player\n end",
"def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end",
"def round_end\n # evaluate winner and add to his/her win count\n winner = players.detect{|player| player.lives > 0}\n winner.wins += 1\n\n # round end score and message\n puts \"------------------ROUND OVER------------------\".yellow\n puts \" #{winner.name}\" + \" won Round #{round_count} with #{winner.score} points!\"\n puts \"----------------------------------------------\".yellow\n puts \"\"\n puts \"Current Scores:\"\n scoreboard\n puts \"----------------------------------------------\".yellow\n\n # end the round\n puts \"Press any key to continue or 'q' to end game\"\n response = gets.chomp.downcase\n response == \"q\"\n end",
"def winning?(game)\n if game.word == game.progress\n puts \"You won! Yaaaaay!!\"\n exit\n end\nend",
"def dealer_win\n @dealer_win += 1\n end",
"def win?\n sleep(3)\n check_points\n end",
"def check_win\r\n\t\tif @guess_word == @secret_word \r\n\t\t\t@is_over = true \r\n\t\t\tputs \"Congrats! You won!\"\r\n\t\telse\r\n\t\t\tfalse \r\n\t\tend \r\n\r\n\t\tif @num_guess == 0 \r\n\t\t\t@is_over = true\r\n\t\t\tputs \"No more tries! You have lost.\"\r\n\t\telse \r\n\t\t\tfalse\r\n\t\tend \r\n\tend",
"def win()\n\t return false if (self.score.nil? or self.opponent.score.nil?)\n\t self.score() ? self.score().to_i > self.opponent.score().to_i : false\n\tend",
"def finishGame\n if @roundsWon > @roundsLost\n puts \"You won the game!\"\n @gamesWon += 1\n else\n puts \"You lost the game :(\"\n @gamesLost += 1\n end\n puts \"Games Won: #{@gamesWon}. Ganes Lost: #{@gamesLost}\"\n requestNewGame()\n end",
"def win?\n false\n end",
"def play\n until over?\n turn\n end\n\n if draw?\n puts \"Cat's Game!\"\n elsif WIN_COMBINATIONS.include?(won?)\n puts \"Congratulations #{winner}!\"\n end\nend",
"def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end",
"def hero_win\n puts \"#{monster.name} defeated! You gain #{monster.experience} experience.\"\n hero.update(experience: hero.experience + monster.experience)\n reward\n end",
"def winning_move\n simulate_move(@player_num)\n end",
"def win_game\n @win.each do |m|\n if @board[m[0]].strip == @board[m[1]] && @board[m[1]] == @board[m[2]]\n @winner = true\n end\n end\n @winner\n end",
"def start_game\n player_random = select_player_random\n cont = 1\n until @players[0].cards.empty?\n puts \"Ronda #{cont}\"\n round(player_random)\n player_random = whoWinRound(player_random)\n puts \"------------Ganador de la ronda #{cont} ------------------\"\n puts \"Nombre: #{@players[player_random].name}, Con\"\n puts \"Carta: #{@players[player_random].card_thrown.number} , #{@players[player_random].card_thrown.type}\"\n save_card_into_player_win(@players[player_random])\n cont += 1\n end\n who_win\n\n end",
"def won_set(player)\n if player.games_won >= 6 and player.opponent.games_won < 5\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n elsif player.games_won == 7\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n end\n end",
"def win(amount)\n @stack += amount\n end",
"def record_won_game!\n if @game_points >= 5 && @game_points >= @opponent.game_points + 2\n\n record_won_set!\n end\n end",
"def play(board)\n count = 0\n while !over?(board)\n turn(board, current_player(board))\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n return\n elsif draw?(board)\n puts \"Cats Game!\"\n return\n end\n end\n if won?(board)\n puts \"Congratulations #{winner(board)}!\"\n return\n elsif draw?(board)\n puts \"Cats Game!\"\n return\n end\nend",
"def play\n reset\n loop do\n break if @guesses == 0 || @win == true\n status_message\n enter_number\n evaluation_message\n end\n lose_message if @guesses == 0 && @win == false\n end",
"def play_round\n print_board\n\n until won?\n begin\n new_turn\n location = gets.chomp\n\n # End the game if the player inputs it\n return -1 if %w[quit exit q].include?(location)\n\n next unless validate_location(location)\n rescue OccupiedSlotError\n puts \"#{location} is already filled. Please choose another location.\"\n\n # Increment to let the same player try again.\n increment_player_idx\n retry\n ensure\n print_board\n end\n\n next unless @free_slots.zero? && !won?\n\n puts \"Looks like it's a draw! Press enter to play again.\"\n clear_board\n next\n end\n\n # Reset the board at the end of the game\n clear_board\n\n # Increment the number of games played\n @num_games_played += 1\n\n # Increment score and return winning player\n @players[@current_player_idx].increment_score\n @players[@current_player_idx]\n end",
"def wins_ball(winner)\n # TODO: Think it's gross to pass an integer instead of a player object?\n # Then reimplement this method!\n winner.points += 1\n end",
"def won?()\r\n\t\twin_game = false\r\n\t\t\r\n\t\tif()\r\n\t\t win_game = true\r\n\t end\r\n\t\t\r\n\t\treturn win_game\r\n\tend",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cats Game!\"\n end\nend",
"def win?\n\n end",
"def game_over(won)\n if won\n puts 'The code has been broken! Game over'\n else\n puts 'The code could not be broken! Game over'\n end\n end",
"def check_if_won\n\t\tif @word_hidden == @answer_word\n\t\t\t@game_over = 1\n\t\tend\n\t\t@game_over\n\tend",
"def play(board)\nnum_of_turns = 0\n until num_of_turns == 9 || over?(board) == true\n turn(board)\n num_of_turns += 1\n end\n if over?(board) == true && won?(board) == \"X\"\n puts \"Congratulations X!\"\n elsif\n over?(board) == true && won?(board) == \"O\"\n puts \"Congratulations O!\"\n elsif\n over?(board) == true && won?(board) != true\n puts \"Cats Game!\"\n else\n\n end\nend",
"def play\r\n turn until over?\r\n \r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n \r\n else\r\n puts \"Cat's Game!\"\r\n end\r\nend",
"def check_and_manage_winner\n if codebreaker_wins?\n manage_codebreaker_winning_guess\n else manage_codemaker_wins\n end\n end",
"def play\n puts\n puts (\"This is game number #{@@game_count}.\").red\n if starter == 1\n round(@player1, @player2)\n else\n round(@player2, @player1)\n end\n while play_again == \"Yes\"\n @@game_count += 1\n puts\n puts (\"This is game number #{@@game_count}.\").red\n if winner_player1 == true\n round(@player2, @player1)\n elsif winner_player2 == true\n round(@player1, @player2)\n else\n if starter == 1\n round(@player1, @player2)\n else\n round(@player2, @player1)\n end\n end\n end\n puts (\"Then goodbye, it was nice to play with you!\").green\n end",
"def play\n\t\t\twhile !win && @turns < TURNS\n\t\t\t\tturn\n\t\t\tend\n\t\t\t# counter increments at start of turn, so must be less than max turns\n\t\t\tif win\n\t\t\t\tplay_again\n\t\t\telse\n\t\t\t\tputs \"\\n Sorry, you ran out of turns. The word was #{@secret_word}\"\n\t\t\t\tplay_again\n\t\t\tend\n\t\tend",
"def play()\n c=1\n p=\"X\"\n while !over?()\n turn()\n end\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cats Game!\"\n else\n end\nend",
"def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end",
"def end_of_the_game\n @display.throw(self)\n puts \"THIS IS THE END OF THE GAME\"\n puts ''\n if @current_board.boardcase_array.any? { |boardcase| boardcase.status == nil } == false\n puts 'I am afraid this a DRAW T_T'\n else\n puts \"Wow! #{@player_turn.name} you did win this one\"\n @player_turn == @player_one ? (@score_player_one += 1) : (@score_player_two += 1)\n end\n puts \"#{@player_one.name} :#{@score_player_one} victories\"\n puts \"#{@player_two.name} :#{@score_player_two} victories\"\n puts ''\n puts ''\n print \"DO YOU WANT TO TRY AGAIN? Y/n\"\n choice = gets.chomp\n exit unless choice == \"Y\"\n end",
"def set_winner(team)\n if team.win\n self.status = 'finished'\n self.save\n end\n end",
"def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end",
"def win\n @music.stop if @sonido\n \n GAME_OBJECTS.each(&:destroy_all)\n pop_game_state\n push_game_state(Level2.new(player_name: @player_name, score: @score, sonido: @sonido, difficulty: @difficulty))\n end",
"def win(val)\n\t\t@wallet.add(val)\n\tend",
"def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else draw?\n puts \"Cat's Game!\"\n end\n end"
] |
[
"0.7681577",
"0.75918454",
"0.7335115",
"0.73269624",
"0.73058426",
"0.73058426",
"0.7224948",
"0.7085366",
"0.7077967",
"0.7058915",
"0.7056516",
"0.70169574",
"0.69771343",
"0.6951223",
"0.6947319",
"0.6934118",
"0.6929806",
"0.6914083",
"0.6828248",
"0.6826664",
"0.67973435",
"0.6795745",
"0.6795745",
"0.6743329",
"0.674211",
"0.67419446",
"0.67409825",
"0.67376655",
"0.66648215",
"0.665489",
"0.6652128",
"0.6614954",
"0.65892714",
"0.6583892",
"0.65832543",
"0.65768707",
"0.65702313",
"0.6562786",
"0.65625894",
"0.65438557",
"0.6533936",
"0.6520806",
"0.65146875",
"0.649414",
"0.64710075",
"0.6470296",
"0.6460118",
"0.6457363",
"0.6446109",
"0.64279187",
"0.6427889",
"0.64208066",
"0.64195555",
"0.64135486",
"0.64057815",
"0.6395171",
"0.6394267",
"0.63931537",
"0.6393147",
"0.639033",
"0.6387038",
"0.6383785",
"0.6383498",
"0.63774633",
"0.6374262",
"0.6369662",
"0.63590115",
"0.6349232",
"0.63432324",
"0.6343219",
"0.63399017",
"0.6338968",
"0.6336093",
"0.6333201",
"0.63329285",
"0.63272786",
"0.6317415",
"0.6292657",
"0.6277221",
"0.62758297",
"0.62673914",
"0.6267159",
"0.62661606",
"0.62649673",
"0.626495",
"0.62546724",
"0.6251802",
"0.62448835",
"0.6242231",
"0.62382245",
"0.62379044",
"0.62347627",
"0.6223074",
"0.62210315",
"0.6218859",
"0.6204327",
"0.6194839",
"0.61901635",
"0.6180583",
"0.61767167"
] |
0.6958537
|
13
|
Decides move for player Used for game processes Inputs: none Outputs: none
|
def set_move(x)
PlayerModelContracts.invariant(self)
@move = x
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_player_turn\n\t\tself.current_player = \"Computer\"\n\t\tindicate_player_turn\n\t\tplayer_good_move= self.get_good_move\n\t\tchange_state(player_symbol, player_good_move)\n\t\tplayer_good_move\n\tend",
"def player_move(player)\n if player_one == player\n player_one_move\n elsif player_two == player\n player_two_move\n else\n nil\n end\n end",
"def player_move\n player_position = gets.chomp\n player_position = player_position.split(' ')\n if player_position[0] == 'flag'\n flag_map(player_position[1], player_position[2])\n elsif player_position[0] == 'unflag'\n unflag_map(player_position[1], player_position[2])\n else\n player_choice(player_position[0], player_position[1])\n end\n display_board\n \n show_board if game_over == true \n\n end",
"def process_inputs_player_movement\n # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right)\n if inputs.keyboard.key_up.right\n state.dx = 0\n elsif inputs.keyboard.key_up.left\n state.dx = 0\n end\n\n # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys\n if inputs.keyboard.key_held.right\n state.dx = 3\n elsif inputs.keyboard.key_held.left\n state.dx = -3\n end\n\n # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard\n if inputs.keyboard.key_held.space\n state.dy = 5\n end\n end",
"def winning_move\n simulate_move(@player_num)\n end",
"def move(player, x, y)\n\n end",
"def player_move\n\t \tvalid_move = false\n\t \twhile !valid_move\n\t \t\tdisplay_game\n\t \t\trow_choice = 0\n\t \t\tstick_choice = 0\n\t\t # get the user selections\n\t\t valid_input = false\n\t\t puts \"Enter the row (1-#{@current_config.length}): \"\n\t\t row_choice = gets.chomp.to_i - 1\n\t\t puts \"Enter the number of sticks (1-#{@current_config[row_choice]}): \"\n\t\t stick_choice = gets.chomp.to_i \n\t\t valid_move = validate_move row_choice, stick_choice, true # validate selections\n\t \tend\n\tend",
"def turn\n player_1.move(input)\n # if valid_move?(input) != true; \n # puts \"invalid move\"\n # player_2.move(input)\n # if valid_move?(input) != true; \n # puts \"invalid move\"\n # end\n end",
"def ask_player_for_move(current_player)\n puts\n puts \"#{@current_player.name}, it's your move:\"\n @move = gets.chomp.capitalize.to_s\n # puts @move\n self.validate_move(@move)\n next_turn\n end",
"def process_move(player, move)\n return 1 unless validate_move?(move)\n @board[move] = @computer_symbol if player == :computer\n @board[move] = @player_symbol if player == :player\n move\n end",
"def turn\n input = current_player.move(board)\n\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end",
"def player_move\n\n move = TTY::Prompt.new\n\n choices = []\n @options = []\n @rooms.each do |room|\n @options << room.id\n choices << { name: room.name, value: room.id } unless room.id == @current_room_id\n end\n\n input = move.select(slow_type(\"Where would you like to move to?\"), choices)\n\n pause(0.3)\n\n if @options.include?(input) && find_room_by_id(@current_room_id).isLocked\n slow_type(\"#{find_room_by_id(@current_room_id).name} is locked, you'll need to find a way out\") \n\n elsif @options.include?(input) && find_room_by_id(input.to_i).isLocked\n slow_type(\"You cannot get to #{find_room_by_id(input.to_i).name}. it is currently locked\")\n\n else @options.include?(input) && !find_room_by_id(@current_room_id).isLocked\n\n @current_room_id = input\n slow_type(\"\\nYou have moved to #{find_room_by_id(@current_room_id).name}\")\n slow_type(\"#{find_room_by_id(@current_room_id).description}\")\n additional_text\n\n end\n end",
"def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end",
"def current_player_move\n @on_move == HUMAN_PLAYER ? human.move : computer.move\n end",
"def do_move x,y\n return unless is_valid_move(x,y)\n @field[x][y].player = @player\n unless (w = check_winner).nil?\n on_game_won w.first.player, w\n end\n\n @player = @player == 1 ? 2 : 1\n if gameover?\n @player = 0\n on_gameover\n end\n end",
"def turn\n # move_value = current_player.move(board)\n # if !board.valid_move? move_value\n # turn\n # else\n # board.update(move_value, current_player)\n # move_value\n # end\n # end\n\n input = current_player.move(board)\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end",
"def ask_player_for_move(current_player)\n played=false\n while not played\n puts \"player\" +current_player +\"where would you like to play your move:=\"\n move=gets.to_i-1\n col= move % @board.size\n row=(move-col) / @board.size\n\n if validate_position(row,col)\n @board[row][col]=current_player\n played=true\n end\n end\n end",
"def handle_input\n return unless player # can happen when spawning\n return if player.should_fall? || @dialog\n if move = move_for_keypress\n @conn.send_move player_id, move\n # also creates a delta in the engine\n end\n end",
"def moves\n end",
"def move(board)\n board.display_board\n print \"Enter move for Player #{@id.to_s} (#{@piece}): \"\n position = gets.to_i\n return {position: position, piece: @piece} if board.valid_position?(position)\n puts \"Invalid position.\"\n move(board)\n end",
"def moves\n\n end",
"def move\n potential_move ||= winning_move\n potential_move ||= living_move\n potential_move ||= random_move\n end",
"def move\n\t\t'moved passed'\n\tend",
"def get_move\n render\n puts \"Move FROM?\"\n from = gets.chomp\n \n # quit program if player types quit\n exit if from.downcase == \"quit\"\n\n from = from.to_i - 1 #convert user input into usable integer index\n \n puts \"Move TO?\"\n to = gets.chomp\n \n # quit program if player types quit\n exit if to.downcase == \"quit\"\n \n to = to.to_i - 1 #convert user input into usable integer index\n\n if valid_move?(from, to)\n play_move(from, to)\n \n else\n puts \"\\n\\n__________\"\n puts \"\\nNOT VALID. Try again :)\"\n get_move\n end\n end",
"def get_player_move\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n loop do #Loop forever\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Prompt the player to select a move\r\n puts \"\\aTo make a move, type one of the following and press Enter:\\n\\n\"\r\n print \"[Rock] [Paper] [Scissors]: \"\r\n \r\n @choice = STDIN.gets #Collect the player's answer\r\n @choice.chop! #Remove any extra characters appended to the string\r\n \r\n #Terminate the loop if valid input was provided\r\n break if @choice =~ /Rock|Paper|Scissors|R|r|P|p|S|s/i \r\n \r\n end \r\n \r\n #Convert the player move to upper case and return it to the calling \r\n #statement\r\n return @choice.upcase\r\n \r\n end",
"def update(params)\n params[:player][:id].to_i == player1.id ? player = player1 : player = player2 # identify player\n space = params[:space]\n\n if self.game_type == 'hvh'\n self.make_human_move(player, space)\n self.switch_player(player) # sends next 'current player' to front end\n elsif self.game_type == 'hvc'\n if player == player1\n # This will be true every time except for when player2 (computer), starts the game\n self.make_human_move(player, space)\n end\n unless self.game_is_over(self.board)\n # in hvc gameplay, unless human move ends the game:\n # computer move is made every time human player makes a move\n self.make_computer_move(player2)\n self.switch_player(player2) # switch back to player 1\n end\n elsif self.game_type == 'cvc'\n self.make_computer_move(player)\n self.switch_player(player) # sends next 'current player' to front end\n end\n end",
"def Move(player, start, stop)\r\n end",
"def get_player_move\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n loop do #Loop forever\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to select a move\r\n puts \"To make a move, type one of the following and press Enter:\\n\\n\"\r\n puts \"\\a\"\r\n print \"[Rock] [Paper] [Scissors]: \"\r\n\r\n @choice = STDIN.gets #Collect the player's answer\r\n @choice.chop! #Remove any extra characters appended to\r\n #the string\r\n\r\n #accept input of r or R and convert string to Rock\r\n if @choice =~ /r|R/\r\n then @choice = \"Rock\"\r\n end\r\n\r\n #accept input of p or P and convert string to Paper\r\n if @choice =~ /p|P/\r\n then @choice = \"Paper\"\r\n end\r\n\r\n #accept input of s or S and convert string to Scissors\r\n if @choice =~ /s|S/\r\n then @choice = \"Scissors\"\r\n end\r\n\r\n #Terminate the loop if valid input was provided\r\n break if @choice =~ /Rock|Paper|Scissors/i\r\n\r\n end\r\n\r\n #Convert the player move to upper case and return it to the calling\r\n #statement\r\n return @choice.upcase\r\n\r\n end",
"def ask_player_for_move(current_player)\n\n # Player has not made a valid move yet\n played = false\n move = -1\n\n # Keep processing until a valid move is obtained\n while not played\n \n loop do\n\n # Ask the player for a move\n puts \"Player \" + current_player + \": Enter a move (1-9):\"\n\n # Get the player's response, convert the string to an integer\n move = gets.to_i - 1\n\n # Stop looping if the move is in range\n break if (move >= 0 and move <= 8)\n\n end\n\n # ----------------------------------------\n # Column Index ->\n # 0 1 2\n # +- - - - - -+\n # | 1 | 2 | 3 | 0 Row Index\n # +- - - - - -+ |\n # | 4 | 5 | 6 | 1 v\n # +- - - - - -+\n # | 7 | 8 | 9 | 2\n # +- - - - - -+\n #\n # move = \"8\".to_i - 1 = 8 - 1 = 7\n # @board.size = 3\n # col = 7 % 3 = 1\n # row = (7 - 1) / 3 = 6 / 3 = 2\n # (row, col) = (2, 1) = cell #8\n # ----------------------------------------\n\n # Convert the number 1-9 into a column 0-2\n # i.e., determine the column index\n column = move % @board.size\n\n # Convert it into a row\n # i.e., determine the row index\n row = (move - column) / @board.size\n\n # Valid position; i.e., valid coordinates?\n # (3. Make sure the move is valid)\n if validate_position(row, column)\n\n # Yes, move the player's piece to this position\n # (4. Store the current move)\n @board[row][column] = current_player\n\n # Success, the player's turn is complete\n played = true\n\n end\n\n end\n\n end",
"def update_move\n if !@ch.moving? && @moves.size > 0\n @moves.shift if proccess_move(@moves[0])\n end\n end",
"def turn\n move_input = current_player.move\n if !board.valid_move?(move_input) # if #valid_move false\n puts \"That is not a valid move. Please try again.\\n\"\n turn\n else\n board.update(move_input,current_player)\n board.display\n end\n end",
"def play\n\t\t# This will return the move that the player will take. This will come\n\t\t# from a move generator for the AI\n\t\t# The ai player will require the ai_type to be passed through\n\t\t# TODO: To be changed possibly based off of the main gameplay code. Look\n\t\t# \t\tinto the player_lobby code\n\n\t\tai_type = Settings.instance.game_mode\n\t\tif ai_type == :Connect4\n\t\t\t@ai_object = AI_Connect4.new(@game, 2, @current_chip)\n\t\telsif ai_type == :TOOT\n\t\t\t# make it that otto object\n\t\t\t@ai_object = AI_OTTO.new(@game, 1, @current_chip)\n\t\t\t@ai_object.player_goal = @goal\n\t\tend\n\n\t\t#pre\n\t\tassert game.is_a?(Game)\n\n\t\t# AI will get the next position, will be determined based on the difficulty setting\n\t\t@current_column = @ai_object.getBestScore()\n\t\tif @ai_object.is_a?(AI_OTTO)\n\t\t\t# random value\n\t\t\ttemp_num = rand(2)\n\t\t\tif temp_num == 0\n\t\t\t\tup()\n\t\t\tend\n\t\tend\n\t\tdrop()\n\t\tfinished()\n\n\t\t#post\n\t\tassert @current_column.is_a?(Numeric)\n\tend",
"def player_move\n puts \"ENTER YOUR SHOSEN LOCATION BETWEEN 1..9\"\n @position = gets.chomp.to_i\n end",
"def turn\n input = current_player.move(board)\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n board.display\n turn\n end\n end",
"def move\n \n end",
"def move\n \n end",
"def user_move(org,dest)\n if @board.moves(HUMAN_PLAYER).include?([org[0],org[1],dest[0],dest[1]])\n @board.move(org,dest) \n # increment human player score if capture move\n @score[HUMAN_PLAYER] += 1 if (dest[0] - org[0]).abs == 2\n true\n else\n false\n end\n end",
"def moving!\n end",
"def turn(player)\n if player == 'X'\n print \"\\nPlayer X turn >> \"\n @x_move = gets.chomp\n elsif player == 'O'\n print \"\\nPlayer O turn >> \"\n @o_move = gets.chomp\n end\n end",
"def update(user_input, player)\n if valid_move?(user_input) == true\n cells[user_input.to_i - 1] = player.token\n end # if - valid_move?\n end",
"def set_player_move?(player, move)\n if possible_plays.include?(move)\n player.move = move\n true\n else\n false\n end\n end",
"def move_player(member)\n refresh\n @move_update.clear if member.x == @x and member.y == @y\n @start_moving = false if @move_update.size <= 1\n return if moving?\n return unless need_update(member)\n move = @move_update.shift\n eval(move) if move != nil\n end",
"def process_computer_turn\n \tself.current_player = @player\n \tputs \"My Move, playing #{computer_symbol}\"\n \tcomputer_move = self.get_computer_move\n \tchange_state(computer_symbol,computer_move)\n \tcomputer_move\n end",
"def check_player\n if self.moves == nil or self.moves.length % 2 == 0\n @current_player = 1\n else\n @current_player = 2\n end \n end",
"def start_game \n ask_player_for_move(@current_player)\n determine_winner\n end",
"def move\n\n end",
"def get_good_move\n loop do\n\t\t @player_move = self.get_player_move\n break if @current_state[@player_move].nil?\n puts \"That position is taken. Try another.\"\n end\n @player_move\n end",
"def moves\n raise SecurityError(\"Player Moves Have Been Implemented\")\n end",
"def turn_to_player\n diffx = @x - $game.player.x\n diffy = @y - $game.player.y\n down = diffy < 0\n left = diffx > 0\n right = diffx < 0\n up = diffy > 0\n if down\n @direction = 2\n elsif up\n @direction = 8\n elsif left\n @direction = 4\n elsif right\n @direction = 6\n end\n end",
"def chooseMove\r\n\t\tprint \"\\nEnter your move human: \"\r\n\t\tmove = gets.chomp.to_i\r\n\t\treturn move\r\n\tend",
"def do_move()\n\n loop do\n # prompt or retreive for initial position\n if @first_move\n initialPos = prompt_for_postion(\"[#{@name}] Initial position: \")\n else\n initialPos = @last_location\n end\n\n # prompt for new position\n newPos = prompt_for_postion(\"[#{@name}] New position: \")\n\n # complete action using positions\n action = @current_board.action(newPos, initialPos, @colour)\n\n # respond to action result\n case (action)\n when :E, :P\n @first_move = true\n @last_location = [0,0]\n return action\n when :A, :W\n @last_location = newPos\n @first_move = false\n return action\n end\n end\n end",
"def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend",
"def get_move\n STDOUT.print(\"\\tPlayer #{self.name}/#{self.type} -- \" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect}\" +\n \" // side: #{@move_side.inspect}\\n\") if $VERBOSE\n # play center\n if rand(2) > 0 && !@move_center.empty? # plus some randomness for IA vs IA\n # maybe a problem - if it the only valid move!\n m = _play_center\n return m if m > 0\n end\n # play opposite corner\n if !@move_corner.empty?\n m = _find_free_opp_corner\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying corner...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n # play opposite side\n if !@move_side.empty?\n m = _find_free_side\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying side...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n raise ArgumentError,\n \"No more move to play for #{self.name} / #{self.type} /\\n\" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect} // side: #{@move_side.inspect}\"\n end",
"def move(pos, player)\n #Special case for negamax to reset board as recursively pops back up\n if player == '-' then\n @bo[pos] = '-'\n end\t\n #Check validity of move\n\tif isValidMove(pos) then\n\t\t@bo[pos] = player\n\telse\n puts \"Invalid Move\"\n\t\treturn nil\n\tend\n end",
"def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif direction == \"S\"\n\t\t\t@y -= 1\n\t\telsif direction == \"E\"\n\t\t\t@x += 1\n\t\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend",
"def ask_for_move\n puts\n puts @Player1 + \"! What is your move?\"\n move1 = assign_play_value(gets.chomp.downcase)\n puts\n puts @Player2 + \", what is YOUR move?\"\n move2 = assign_play_value(gets.chomp.downcase)\n return move1, move2\n end",
"def turn\r\n current_player = self.current_player\r\n #Ask the user for, and obtain, their move, a position between 1-9.\r\n print \"#{current_player}, enter your move (1-9): \"\r\n move_index = gets.chomp\r\n print \"\\n\"\r\n \r\n #Translate user input to valid index\r\n move_index = self.input_to_index(move_index)\r\n \r\n #Check if user input is valid move\r\n valid = false\r\n while !valid do\r\n if self.valid_move?(move_index)\r\n #If valid, make the move and display the board.\r\n self.move(move_index, current_player)\r\n self.display_board\r\n valid = true\r\n else\r\n #If invalid, ask for a new move until a valid move is received.\r\n puts \"That is not a valid move.\"\r\n print \"#{current_player}, enter your move (1-9): \"\r\n move_index = gets.chomp\r\n print \"\\n\"\r\n move_index = self.input_to_index(move_index)\r\n end\r\n end\r\n end",
"def update_player(player, input)\n # This line checks which command has been specified, and sets the specified\n # player's last_move or living_cells value to the given input as a string\n # (as a result of the .join method)\n input.shift == 'move' ? player.last_move = input.join : player.living_cells = input.join\n # This prints out the Player object after the above actions have taken place\n p player\n end",
"def process_pathfinding_movement\n return clear_pathfinding_moves if trigger_movement_key?\n return clear_pathfinding_moves if @pathfinding_goal && adjacent?(@pathfinding_goal.x, @pathfinding_goal.y)\n return if moving?\n return unless @pathfinding_moves.size > 0 && @move_poll.empty?\n @move_poll << @pathfinding_moves.shift\n @followers.move if self.is_a?(Game_Player)\n interpret_move\n end",
"def move; end",
"def move; end",
"def move(players, player_turn,mdice,snakes_ladders,board_size,players_name)\n puts \"#{players} .. #{players_name[player_turn]} your current position is #{players[player_turn]} its your turn to play so through a dice by press Enter\"\n mthrough_dice = gets.chomp.to_i \n my_val = throw_dice(mdice=6)\n puts \"#{players_name[player_turn]} you got this number #{my_val}\"\n new_position = players[player_turn] + my_val\n if snakes_ladders.has_key?(new_position)\n puts \"#{players_name[player_turn]} you got #{ (my_val.to_i - players_name[new_position].to_i) < 0 ? 'snakes' : 'ladder' }.... so your new position #{snakes_ladders[new_position]} \"\n new_position = snakes_ladders[new_position] \n else \n puts \"#{players_name[player_turn]} your new position #{new_position} \"\n end \n return player_turn if new_position >= board_size \n players[player_turn] = new_position\n next_player = (player_turn + 1) % players.length\n move(players, next_player,mdice,snakes_ladders,board_size,players_name)\n end",
"def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end",
"def update_self_movement\n return if $game_system.story_mode?\n if !@pathfinding_moves.empty?\n process_pathfinding_movement\n #elsif BattleManager.valid_battler?(self) && @current_target\n # chase_target\n elsif near_the_screen? && @stop_count > stop_count_threshold\n case @move_type\n when 1; move_type_random\n when 2; move_type_toward_player\n when 3; move_type_custom\n end\n end\n end",
"def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end",
"def input args\n if args.inputs.keyboard.space # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.keyboard.left # if left key is pressed\n args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)\n # dx is either set to current dx or the negative max run speed (which would be -10),\n # whichever has a greater value\n args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)\n elsif args.inputs.keyboard.right # if right key is pressed\n args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)\n # dx is either set to current dx or max run speed (which would be 10),\n # whichever has a lesser value\n args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\nend",
"def update_player_movement\r\n # Move player in the direction the directional button is being pressed\r\n case Input.dir4\r\n when 2\r\n move_down\r\n when 4\r\n move_left\r\n when 6\r\n move_right\r\n when 8\r\n move_up\r\n end\r\n end",
"def make_player_move!(player_move_position)\n self.game_data[player_move_position] = \"O\"\n self.player_move_count += 1\n self.save!\n end",
"def ask_move\n puts \"#{current_player.name}: Enter a number between 1 and 9\"\n print \">\"\n end",
"def first_move\n computer.move if @first_player == COMPUTER_PLAYER\n @on_move = HUMAN_PLAYER\n end",
"def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end",
"def valid_move?( player_input )\n player_input.to_i >= 1 && player_input.to_i <= 9 && !taken?( player_input )\n end",
"def player_select_valid_piece_destination\n puts \"Where would you like to move this piece?\"\n response = player_select_coordinates\n end",
"def player_turn()\n\t\t\tputs \"\\nPlace your mark: \"\n\t\t\t\n\t\t\twhile true\n\t\t\t\tinput = gets.chomp.to_i\n\t\t\t\tif self.valid_move?(@player, input)\t\t# validates that input is correct\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tputs \"That position is either already used or invalid\"\n\t\t\t\t\tputs \"Please enter a number between 1 and 9 \"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@board.print_board\t\t# print the status of the board at the end of a turn\n\t\t\t\n\t\t\treturn self.check_end_status\n\t\tend",
"def ask_player_for_move(player)\n print \"#{player} - enter your next move (row, column): \"\n row_col = gets.chomp\n row, col = row_col.split(\",\").map {|row_or_col| row_or_col.to_i }\n end",
"def go!\n send_position_to_engine\n move_piece(bestmove)\n end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def move_type_avoid_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n\n # What if they follow more aggressively on harder difficulty?\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_away_from_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"def make_move(player)\n while true \n from, to = player.get_move\n break if valid_move?(from, to, player)\n puts \"Invalid move\"\n end\n move_piece(from, to)\n end",
"def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end",
"def try_turn\n print \"\\nPlayer #{@player.to_s.capitalize}'s command: \"\n input = gets.chomp\n outcome = if is_raw_command?(input) then try_command(input) # Returns :(no_)load, :(no_)save, :(no_)draw, :quit\n elsif is_raw_move?(input) then try_move(input) # Returns :(no_)move, :check(mate), :stalemate, :draw\n else :unknown_input end\n end",
"def turn\n #asks for user input, converts input to integer\n puts \"Enter the position you like to play (1-9): \"\n user_input = gets.strip\n\n #if move is valid, accepts move as index and displays new board\n if valid_move?(user_input)\n token=current_player\n move(user_input, token)\n display_board\n else\n turn\n end\n end",
"def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"def make_move(player)\n # clone the board state, because the training data must have the state before the move and the move itself.\n previous_state = @board.state.clone\n position = player.select_move(@board)\n @board.state[position] = player.value\n player.moves << position\n puts \"#{player.stone} set on #{position}\" if @display_output\n move = [0] * 9\n move[position] = player.value\n return [previous_state, move].flatten\n end",
"def turn\n player = current_player\n current_move = player.move(@board)\n\n if !@board.valid_move?(current_move)\n # Game turn asks for input again after a failed validation\n turn\n else\n # Game turn changes to player 2 after the first turn\n puts \"Turn: #{@board.turn_count+1}\\n\"\n @board.display\n @board.update(current_move, player)\n puts \"#{player.token} moved #{current_move}\"\n @board.display\n puts \"\\n\\n\"\n end\n end",
"def input_move(db, cur_position)\r\n\tprint \"Enter a move for #{cur_player(db, cur_position)} in standard chess notation, or HELP for help: \"\r\n\tmove = gets.chomp.downcase\r\n\treturn move\r\nend",
"def control(player_choice) \n if @game_over == false\n @game.make_move(@game.current_player, player_choice) \n if @game.win? \n @game.print_grid\n puts print_name(@game.win?) + \" gets \" + pink(\"cake\") + \", the loser will not be \" + pink(\"reformated into cake ingredients.\")\n @game_over = true\n elsif @game.tie? \n @game.print_grid\n puts \"It seems that you are both \" + pink(\"equally dumb\") + \". And probably \" + pink(\"equally flamable.\")\n @game_over = true\n else \n if @game_mark == \"player\" \n assign_player\n start_turn\n elsif @game_mark == \"AI\" \n \n if @game.current_player == \"O\" \n assign_player \n @AI.make_move \n elsif @game.current_player == \"X\" \n assign_player \n start_turn \n end\n else \n raise \"Game mark Error\".inspect\n end\n end\n end\n end",
"def living_move\n simulate_move(opponent)\n end",
"def get_move\n print \"#{@name}, please choose r, p, or s: \" \n @move = gets.chomp.downcase\n until is_move_valid(@move) do\n puts \"Sorry, that's not a valid move!\"\n @move = gets.chomp.downcase\n end\n @move\n end",
"def get_player_move\n\t\tplayer_input = \"\"\n\t\tloop do\n \t\tputs \"Enter your move in form (Row A-C)(Col 1-3)\"\n \tplayer_input = gets.chomp\n \tbreak if BOARD.include?(player_input)\n \tend\n\t\tplayer_input.to_sym\n\tend",
"def current_player_moves\r\n current_player.play(board)\r\n end",
"def play\n \n puts \"#{current_player.to_s} has randomly been selected as the first player\"\n puts \"pls enter a number between 1 and 9 to make your move\"\n\n board.formatted_grid\n \n invalid_stdout = \"Ignoring this invalid step, pls try again.\"\n while human_move = gets.chomp\n valid_step = false\n if human_move =~ /\\d/ #only 1-9 number\n x, y = human_move_to_coordinate(human_move)\n valid_step = board.set_cell(x, y, current_player)\n end\n \n #ignore those invalid steps\n unless valid_step \n puts invalid_stdout\n next\n end\n\n if board.game_over\n puts game_over_message\n # board.formatted_grid\n return\n else\n switch_players\n puts solicit_move\n end\n end\n end",
"def moving?; @moving; end",
"def moving?; @moving; end",
"def turn \n player = current_player\n puts \"Player '#{player}' enter a move [1-9]\"\n input = gets.chomp \n index = input_to_index(input)\n if valid_move?(index)\n move(index,player)\n display_board\n else \n turn\n end\n end",
"def receive_move_by_player\n\t\t@game = Game.find_by_id(params[:game_id])\n\t\tdo_move_by_player params[:drop_zone]\n\t\t\t\t\n\t\thandle_response_display true\n\tend",
"def next_move(bot_pos_x, bot_pos_y, princess_position)\n case\n when princess_position[0] - bot_pos_x < 0 then move = 'UP'\n when princess_position[0] - bot_pos_x > 0 then move = 'DOWN'\n when princess_position[1] - bot_pos_y < 0 then move = 'LEFT'\n when princess_position[1] - bot_pos_y > 0 then move = 'RIGHT'\n end\n move\nend",
"def moved(player_position)\n if player_position = @location\n @player = false\n end\n end",
"def choose_move(player, check)\n\t\t@viable_move = false\n\t\tfinish = nil\n\t\tstart = get_space(player, check, \"start\", nil)\n\t\tif start == \"save\"\n\t\t\tsave_game\n\t\t\tstart = nil\n\t\tend\n\t\tfinish = get_space(player, check, \"finish\", start) unless start == nil\n\t\tif finish != nil\n\t\t\t@board.move(start, finish)\n\t\t\t@viable_move = true\n\t\tend\n\tend",
"def get_move\n @players[0].get_move(@board)\n end",
"def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n\n # What if they follow more aggressively on harder difficulty?\n\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n\n end"
] |
[
"0.750346",
"0.74568945",
"0.7428433",
"0.74217033",
"0.73897845",
"0.73579556",
"0.7349643",
"0.73016775",
"0.72183794",
"0.7216171",
"0.72144985",
"0.721321",
"0.7207159",
"0.71711147",
"0.7113225",
"0.70810413",
"0.70735765",
"0.7042229",
"0.6987059",
"0.69794863",
"0.69732213",
"0.69481575",
"0.6918832",
"0.69003665",
"0.68739164",
"0.6870453",
"0.68397593",
"0.6837282",
"0.68287617",
"0.6826151",
"0.6823742",
"0.6819589",
"0.6802853",
"0.67941445",
"0.67937064",
"0.67937064",
"0.67900014",
"0.67731607",
"0.677014",
"0.6750947",
"0.67448366",
"0.6741391",
"0.67257017",
"0.6719956",
"0.670882",
"0.6704796",
"0.66985494",
"0.669599",
"0.6694482",
"0.6693357",
"0.6687299",
"0.6664737",
"0.6662291",
"0.66606045",
"0.6644752",
"0.66428924",
"0.6641695",
"0.6636302",
"0.6628238",
"0.6625763",
"0.6625763",
"0.66227674",
"0.66152364",
"0.661406",
"0.6612931",
"0.6606503",
"0.6599044",
"0.6581269",
"0.65750647",
"0.6572564",
"0.656891",
"0.6566485",
"0.65662926",
"0.6558576",
"0.6555815",
"0.65501547",
"0.65398544",
"0.65374607",
"0.65321887",
"0.65275896",
"0.65243506",
"0.6516638",
"0.65146244",
"0.6510872",
"0.6505668",
"0.64984536",
"0.6495219",
"0.6494198",
"0.6490838",
"0.6490421",
"0.6486662",
"0.64810175",
"0.64788634",
"0.64788634",
"0.64784193",
"0.647762",
"0.6468872",
"0.6460111",
"0.6455892",
"0.6455787",
"0.6453656"
] |
0.0
|
-1
|
A peak is an array element which is larger than its neighbours. More precisely, it is an index P such that 0 A[P + 1]. For example, the following array A: ``` A[0] = 1 A[1] = 5 A[2] = 3 A[3] = 4 A[4] = 3 A[5] = 4 A[6] = 1 A[7] = 2 A[8] = 3 A[9] = 4 A[10] = 6 A[11] = 2 ``` has exactly four peaks: elements 1, 3, 5 and 10. You are going on a trip to a range of mountains whose relative heights are represented by array A, as shown in a figure below. You have to choose how many flags you should take with you. The goal is to set the maximum number of flags on the peaks, according to certain rules. Flags can only be set on peaks. What's more, if you take K flags, then the distance between any two flags should be greater than or equal to K. The distance between indices P and Q is the absolute value |P Q|. For example, given the mountain range represented by array A, above, with N = 12, if you take: two flags, you can set them on peaks 1 and 5; three flags, you can set them on peaks 1, 5 and 10; four flags, you can set only three flags, on peaks 1, 5 and 10. You can therefore set a maximum of three flags in this case. Write a function: ``` def solution(a) ``` that, given a nonempty zeroindexed array A of N integers, returns the maximum number of flags that can be set on the peaks of the array. For example, the following array A: ``` A[0] = 1 A[1] = 5 A[2] = 3 A[3] = 4 A[4] = 3 A[5] = 4 A[6] = 1 A[7] = 2 A[8] = 3 A[9] = 4 A[10] = 6 A[11] = 2 ``` the function should return 3, as explained above. Assume that: N is an integer within the range [1..200,000]; each element of array A is an integer within the range [0..1,000,000,000]. Complexity: expected worstcase time complexity is O(N); expected worstcase space complexity is O(N), beyond input storage (not counting the storage required for input arguments). Elements of input arrays can be modified.
|
def solution(a)
peaks = find_peaks(a)
return 0 if peaks.empty?
min_flags = 1
max_flags = Math.sqrt(a.length).ceil + 1
while min_flags != max_flags
mid_flags = min_flags + ((max_flags-min_flags)/2.0).ceil
if check(peaks, mid_flags)
min_flags = mid_flags
else
max_flags = mid_flags-1
end
end
return max_flags
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution(a)\n nexxt = next_peak(a)\n f = 1 # can we set f flags?\n max_flags = 0\n # (f-1) * f = max distance between first and last flags\n while (f - 1) * f <= a.size\n pos = 0\n flags_so_far = 0\n while pos < a.size && flags_so_far < f\n pos = nexxt[pos]\n break if pos == -1\n flags_so_far += 1\n pos += f\n end\n max_flags = [max_flags, flags_so_far].max\n f += 1\n end\n max_flags\nend",
"def peak_finder(arr)\n peaks = []\n arr.each_with_index do |num, i|\n neighbors = []\n [i-1,i+1].each {|idx| neighbors << arr[idx] if arr[idx] && idx > 0}\n peaks << num if peak?(num, neighbors)\n end\n peaks\nend",
"def peak_finder(arr)\n \n peaks = [] # peaks store the resulting array with the peaks\n\n peaks<< arr[0] if arr[0]>arr[1] # we check for the first element\n\n \n\n \n arr[1..-2].each_with_index do |num, id| # ... and loop starting from the second - till the one before the last\n peaks << num if num>arr[id] && num>arr[id+2] # we check the peak condition \n # important: the ids are from the sub-array arr[1..-2]. The original array has one element more in each edge\n # so arr[id] is actually checking one number to the left (-1) in the orignal array arr\n end\n\n peaks<<arr[-1] if arr[-1]>arr[-2] # we check for the last one\n\n peaks\nend\n\n\np peak_finder([1, 3, 5, 4]) # => [5]\np peak_finder([4, 2, 3, 6, 10]) # => [4, 10]\np peak_finder([4, 2, 11, 6, 10]) # => [4, 11, 10]\np peak_finder([1, 3]) # => [3]\np peak_finder([3, 1]) # => [3]\n\n\n",
"def peak_finder(arr)\n peaks = []\n\n arr.each_with_index do |num, idx|\n left = arr[idx - 1]\n right = arr[idx + 1]\n if idx.zero? && num > right\n peaks << num\n elsif idx == arr.length - 1 && num > left\n peaks << num\n elsif num > left && num > right\n peaks << num\n end\n end\n\n peaks\nend",
"def peak_finder(arr)\n peaks =[]\n arr.each_with_index do |curr, i|\n left = arr[i - 1]\n right = arr[i + 1]\n \n if i == 0 && curr > right\n peaks << curr\n elsif i == arr.length - 1 && left < curr\n peaks << curr\n elsif left < curr && curr > right\n peaks << curr\n end\n end \n\n peaks\nend",
"def find_peaks(a)\n peaks = [false]\n (1..a.size - 2).each do |i|\n if a[i] > a[i - 1] && a[i] > a[i + 1]\n peaks << true\n else\n peaks << false\n end\n end\n peaks\nend",
"def peak_finder(arr)\n peaks = []\n (0..arr.length-1).each do |i|\n if i == 0\n peaks << arr[i] if arr[i] > arr[i+1]\n elsif i == arr.length-1\n peaks << arr[i] if arr[i] > arr[i-1]\n else\n peaks << arr[i] if arr[i] > arr[i+1] && arr[i] > arr[i-1]\n end\n end\n peaks\nend",
"def peak_index_in_mountain_array(a)\n peak_idx = nil\n peak = nil\n a.each_with_index do |n, idx|\n peak_idx = idx if peak_idx == nil\n peak = n if peak == nil\n if n > peak\n peak_idx = idx\n peak = n\n end\n end\n peak_idx\nend",
"def peak_finder(arr)\n peaks = []\n\n arr.each_with_index do |el, i|\n if el == arr.first && el > arr[i + 1]\n peaks << el\n elsif el == arr.last && el > arr[i - 1]\n peaks << el\n elsif el > arr[i - 1] && el > arr[i + 1]\n peaks << el\n end\n end\n\n peaks\nend",
"def peak_indices(target_frequency, sample_size)\n i = (target_frequency.to_f / RATE * sample_size).round\n (i-SUM_DISTANCE_FROM_PEAK..i+SUM_DISTANCE_FROM_PEAK).to_a\nend",
"def solution(a)\n _N = a.length\n \n peaks = Array.new()\n \n i = 1\n \n while i < _N -1 do\n if a[i - 1] < a[i] && a[i] > a[i + 1]\n peaks.push(i)\n i += 2\n else\n i += 1\n end\n end\n \n blocks = peaks.length\n \n while blocks > 0\n if _N % blocks != 0\n blocks -= 1\n next\n end\n \n itemsPerBlock = _N / blocks\n\n blocksDetected = 0\n \n for peak in peaks\n if peak / itemsPerBlock == blocksDetected\n blocksDetected += 1\n end\n end\n \n if blocksDetected == blocks\n return blocks\n else\n blocks -= 1\n end\n end\n\n return 0\nend",
"def find_peaks(array)\n peaks = []\n # Deal with first element \n if array[0] > array[1]\n peaks << array[0]\n end\n\n # Deal with middle elements\n for i in 1..array.length-2\n if array[i] > array[i+1] and array[i] > array[i-1] \n peaks << array[i]\n end \n end \n \n # Deal with last element\n if array[-1] > array[-2]\n peaks << array[-1]\n end\n return peaks \nend",
"def find_peak_element(arr)\n return 0 if arr.length < 3\n\n max_peak = 0\n\n i = 1\n while i < arr.length - 1\n is_peak = arr[i] > arr[i - 1] && arr[i] > arr[i + 1]\n unless is_peak\n i += 1\n next\n end\n\n left_id = i - 2\n left_id -= 1 while left_id >= 0 && arr[left_id] < arr[left_id + 1]\n\n right_id = i + 2\n right_id += 1 while right_id < arr.length && arr[right_id] < arr[right_id - 1]\n\n length = right_id - left_id - 1\n max_peak = [max_peak, length].max\n i = right_id\n end\n max_peak\nend",
"def top_peaks(n)\n\t\treturn array_ranked_descending(intensities_array)[0..(n-1)]\n\tend",
"def search(array)\n\n # iterate through the array until the peak is found, or until iteration is complete\n for x in array\n # if element is the first in the array and is a peak, return index of peak\n if array.index(x) == 0 && x > array[array.index(x) + 1]\n return array.index(x)\n # if element is the last in the array and is a peak, return index of peak\n elsif array.index(x) == array.length - 1 && x > array[array.index(x) - 1]\n return array.index(x)\n # if element == peak, return index of element\n elsif x > array[array.index(x) - 1] && x > array[array.index(x) + 1]\n return array.index(x)\n end\n end\n\n # if no peak is found, return nil\n return nil\n\nend",
"def valid_mountain_array(a)\n peak = a.max\n return false if a.length < 3 || a[0] == peak || a[-1] == peak\n prev = nil\n reached_peak = false\n \n a.each do |n|\n if prev.nil?\n prev = n\n elsif n >= prev && reached_peak || n <= prev && !reached_peak\n return false\n else\n prev = n\n end\n \n reached_peak = true if n == peak\n end\n true\nend",
"def find_peaks(xs)\n out = []\n state = :peak_nil\n peak = nil\n\n xs.size.times do |i|\n x = xs[i]\n next_x = xs[i+1]\n\n if next_x.nil?\n if state == :peak_off\n out << (peak << x)\n end\n break\n end\n\n case state\n when :peak_nil\n if x < next_x\n peak = [x]\n state = :peak_in\n end\n when :peak_in\n if x < next_x\n peak = [x]\n else\n peak << x\n if x > next_x\n state = :peak_off\n end\n end\n when :peak_off\n out << (peak << x)\n state = :peak_nil\n else\n raise \"🔥 bad state (#{state})\"\n end\n end\n\n out\nend",
"def max_markers\n @max_markers ||= arg ? arg.to_i : MAX_MARKERS\n end",
"def find_peak_times(days, num_peaks=4)\n days.map do |day| \n find_daily_peak_times(day, num_peaks)\n end\n end",
"def solution(a)\n if a.count >= 3\n distances = []\n last = nil\n (1...a.count - 1).each { |i|\n if a[i] > a[i - 1] and a[i] > a[i + 1]\n distances << i - last if last\n last = i\n end\n }\n puts distances.inspect\n \n (distances.count + 1).downto(1) { |flags|\n return flags if distances.all? { |d| d >= flags }\n }\n end\n 0\nend",
"def find_peak(nums)\n start_ind = 1\n last_ind = nums.size - 2\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] < nums[mid - 1]\n last_ind = mid\n elsif nums[mid] < nums[mid + 1]\n start_ind = mid\n else\n last_ind = mid\n end\n\n # if nums[mid] < nums[mid + 1]\n # start_ind = mid\n # else\n # last_ind = mid\n # end\n end\n nums[start_ind] < nums[last_ind] ? last_ind : start_ind\nend",
"def solution(a)\n sea_slices = find_slices(a.map(&:zero?))\n mountain_slices = find_slices(a.map(&:nonzero?), true)\n best = 0\n (a.length - 1).times do |i|\n if sea_slices[i] && mountain_slices[i + 1]\n best = [best, sea_slices[i] + mountain_slices[i + 1]].max\n end\n end\n best\nend",
"def solution(a)\n return a.count(a.max)\nend",
"def kadanes_algorithm(array)\n maxEndingHere = array[0]\n maxSoFar = array[0]\n array.slice(1..-1).each do |num|\n maxEndingHere = [num, maxEndingHere + num].max\n maxSoFar = [maxSoFar, maxEndingHere].max\n end\n return maxSoFar\nend",
"def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to eq(1000)\n end",
"def selector(evidence)\n a=Array.new\n max=0\n maxIndex=0\n for i in 0..9\n if(evidence.getOffSet.include?(i))\n next\n end\n a[i] = p7(i,evidence)\n #puts 'P(' + i.to_s + ') = '+ (a[i]).to_s\n end\n max(a,0)\n return a\nend",
"def find_index_of_set_containing(peak)\n i = -1\n @sets.each_with_index do |item, index|\n i = index if item.any? { |subset| subset == peak }\n end\n i\nend",
"def find_max_upper_dia(matrix, x, y, count)\n if count > 4\n return 1\n end\n\n return safe_access(x, y, matrix) * find_max_upper_dia(matrix, x+1, y-1, count+1)\nend",
"def solution(n, a)\n max = 0\n counters = Array.new(n, max)\n a.each do |counter|\n if counter == n + 1\n counters.fill(max)\n else\n counters[counter - 1] += 1\n max = counters[counter - 1] if counters[counter - 1] > max\n end\n end\n counters\nend",
"def max_pair\n @max_pair ||= pairs.inject(0) do |max, (pairee, pairs)|\n [pairs.inject(0) do |max, (pairer, count)|\n [pairee == pairer ? 0 : count, max].max\n end, max].max\n end\n end",
"def find_max_length(a)\n\tmax = 0\t\n\tfor i in 0..a.size-2 do\n\t\tcount_0 = 0\n\t\tcount_1 = 0\n\t\tcurrent_max = 0\n\t\tfor j in i..a.size-1 do\n\t\t\tif a[j] == 0\n\t\t\t\tcount_0 = count_0+1\n\t\t\telsif a[j] == 1\n\t\t\t\tcount_1 = count_1+1\n\t\t\tend\n\t\t\tif count_0 == count_1\n\t\t\t\tcurrent_max = count_0+count_1\n\t\t\tend\n\t\tend\n\t\tif current_max > max\n\t\t\tmax = current_max\n\t\tend\n\tend\n\tmax\nend",
"def find_max(array)\n max = 0\n array.each do |subarray|\n subarray.each_cons(4) do |chunk|\n product = quad_product(chunk)\n max = product if product > max\n end\n end\n max\n end",
"def find_peak_element(nums)\n i = 0\n while i < (nums.length) - 1\n if nums[i] > nums[i+1]\n return i\n end\n i+=1\n end\n return (nums.length) -1\nend",
"def kadanes_algorithm(arr)\n unless arr.all? { |ele| ele < 0 }\n max_so_far = 0\n max_ending = 0\n arr.each do |ele|\n max_ending = max_ending + ele\n max_ending = 0 if max_ending < 0\n max_so_far = max_ending if max_ending > max_so_far\n end\n else\n max_so_far = arr.max\n end\n puts max_so_far\nend",
"def peak()\n #YOUR WORK HERE\n end",
"def max_range(array)\n \nend",
"def find_peak_element(arr)\n n = arr.size\n if(arr[0] > arr[1])\n return arr[0]\n end\n if(arr[n-1] > arr[n-2])\n return arr[n-1]\n end\n l = 1\n h = n-2\n while(l<=h)\n mid = l + (h-l)/2\n if(arr[mid-1] < arr[mid] && arr[mid] > arr[mid+1])\n return arr[mid]\n elsif arr[mid+1] > arr[mid]\n l=mid-1\n else\n l=mid+1\n end \n end\nend",
"def count_assigned_ions_for_top_peaks(n)\n\t\tcounter = 0\n\t\ttop_peaks = top_peaks(n)\n\t\t[assigned_yions_intensities_array, assigned_bions_intensities_array].each do |array|\n\t\t\tarray.each_with_index do |row, i|\n\t\t\t\trow.each_with_index do |value, j|\n\t\t\t\t\tif j > 0 && row[j] && top_peaks.include?(row[j])\n\t\t\t\t\t\tcounter += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn counter\n\tend",
"def solution(a)\n # first and last positions are excluded for the double slice\n a[0] = 0\n a[-1] = 0\n\n #get the sum of maximum subarray, from the left to the right direction\n max_from_left = []\n max_ending = 0\n a.each do |v|\n max_ending = [0, max_ending + v].max\n max_from_left << max_ending\n end\n \n #get the sum of maximum subarray, from the right to the left direction\n max_from_right = []\n max_ending = 0\n a.reverse.each do |v|\n max_ending = [0, max_ending + v].max\n max_from_right << max_ending\n end\n max_from_right.reverse!\n\n # when comparing both directions excludes the i index and take the maximum double slice value.\n n = a.size\n max_double_slice = 0\n for i in 1..n-2\n max_double_slice = [max_double_slice, max_from_left[i - 1] + max_from_right[i + 1]].max\n end\n\n max_double_slice\n\nend",
"def optimized_solution(arr, window)\n num_times = arr.length - window + 1\n\n (0...num_times).each do |i|\n sub = arr[i...i + window]\n min, max = sub.min, sub.max\n range = max - min\n current_max = range if current_max.nil? || range > current_max\n arr.shift\n end\n current_max\nend",
"def find_more_primes\n candidates_max = @known_primes.last * 2\n candidates = ((@max_checked + 1)..candidates_max).step(2).to_a\n sieving_primes = primes_to_sieve(candidates_max)\n\n offsets = Array.new(sieving_primes.size) do |i|\n (-(candidates.first + sieving_primes[i]) / 2) % sieving_primes[i]\n end\n\n sieving_primes.zip(offsets).each do |prime, offset|\n while offset < candidates.size do\n candidates[offset] = nil\n offset += prime\n end\n end\n\n @known_primes += candidates.compact\n @max_checked = candidates_max\n end",
"def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend",
"def solution(a)\n numbers = a.sort\n (0..numbers.length-3).each do |index|\n triplet = numbers[index..index + 2]\n max_value = triplet.max\n sum = triplet.min(2).inject(&:+)\n\n return 1 if sum > max_value\n end\n\n 0\nend",
"def sub_max(array)\n so_far = array[0]\n max_point = array[0] # [0] -2 and [1] 1 sum -1, number 1\n\n array.each do |number|\n # to find the max between the two values:\n max_point = max((number + max_point), number)\n so_far = max(max_point, so_far)\n end\n\n return so_far\nend",
"def overlay_length(front, back)\n cur_max = 0\n abs_max = 0\n 0.upto(front.size - 1) do |i|\n 0.upto(back.size - 1) do |j|\n break if front[i+j] != back[j] || i+j > front.size\n cur_max += 1\n end\n abs_max = [cur_max, abs_max].max if (i+cur_max == front.size) || (cur_max == back.size)\n cur_max = 0\n end\n abs_max\n end",
"def corgi_golden_age(arr)\n\tmax_subset_sum = 0\n\tmax_i = 0\n\tmax_j = 0\n\tsum = 0\n\ti = 0\n\tj=i+1\n\twhile i < arr.length\n\t\twhile j < arr.length\n\t\t\tsum = arr[i]+arr[j]\n\t\t\tif sum > max_subset_sum\n\t\t\t\tmax_subset_sum = sum\n\t\t\t\tmax_i = i\n\t\t\t\tmax_j = j\n\t\t\tend\n\t\t\tj+=1\n\t\tend\n\t\ti+=1\n\tend\n\treturn [max_i, max_j]\n\nend",
"def alg4(max_value)\n perimeters = Hash.new 0\n (6..max_value/2).each do |p_sub|\n p = p_sub * 2\n (p_sub-1..3).each do |a|\n b = p * (p - 2*a) / (2.0 * (p-a))\n # avoid double counting\n break if b > a\n\n if b > 0 && b == b.to_i\n #puts \"debug: adding perimeter #{p} = #{a} + #{b} + ...\"\n perimeters[p] += 1\n end\n end\n end\n return perimeters\nend",
"def number_of_top_x_peaks_matching_assigned_ions(n)\n\t\tcounter = 0\n\t\ttop_peaks_hash = {}\n\t\ttop_peaks = top_peaks(n)\n\t\ttop_peaks.each do |peak|\n\t\t\ttop_peaks_hash[peak] = nil\n\t\tend\n\t\t[assigned_yions_intensities_array, assigned_bions_intensities_array].each do |array|\n\t\t\tarray.each_with_index do |row, i|\n\t\t\t\trow.each_with_index do |value, j|\n\t\t\t\t\tif j > 0 && row[j] && top_peaks_hash.has_key?(row[j])\n\t\t\t\t\t\tcounter += 1\n\t\t\t\t\t\ttop_peaks_hash.delete(row[j])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn counter\n\tend",
"def opt_max_sum(arr)\n result = -1000\n (0...arr.length).each do |start|\n sum = 0\n (1..arr.length).each do |size|\n if start + size > arr.length\n break\n end\n sum += arr[start + size - 1]\n if sum > result\n result = sum\n end\n end\n end\n return result\nend",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 if a.length == 3\n range = a[1...-1]\n min = Float::INFINITY\n max_ending = 0\n range.inject(0) do |max, y|\n if max_ending + y > 0\n max_ending += y\n if min == Float::INFINITY\n max = [max, max_ending].max\n min = y\n else\n min = y if y < min\n max = [max, max_ending - min].max\n end\n else\n max_ending = 0\n min = Float::INFINITY\n end\n max\n end\nend",
"def find_lis_brute_force array\n max_count = -1\n # Generate all the possible sets. This is done by generating all binary numbers from 1 to 2^n.\n # The presence of a 0 in the binary number at a position will grant entry to the element at that position to the set\n for i in 1..((2**array.count) - 1)\n itr = array.count - 1\n set = []\n while i > 0\n if i%2 == 1\n set << array[itr]\n end\n i = i/2\n itr -= 1\n end\n max_count = max(max_count, evaluate(set))\n end\n return max_count\nend",
"def max_value(our_array)\n\treference = -100000\n\tour_array.each do |number|\n\t\tif number > reference\n\t\t\treference = number\n\t\tend\n\tend\n\treference\nend",
"def find_max(array)\n max_difference = 0\n for i in 0..array.length - 1 do\n for j in i + 1..array.length - 1 do\n difference = (array[i] - array[j]).abs\n if difference > max_difference\n max_difference = difference\n end\n end\n end\n max_difference\n end",
"def solution(n, a)\n counter = [0] * n\n counter_max, max = 0, 0\n\n a.each do |c|\n i = c-1\n\n if c == n + 1\n counter_max = max\n else\n # should ensure start number after max_counter applied\n counter[i] = counter_max if counter[i] < counter_max\n counter[i] += 1\n\n max = [max, counter[i]].max\n end\n end\n\n # should ensure start number after max_counter applied\n counter.map { |c| [c, counter_max].max }\nend",
"def get_peaks scan\n return nil unless scan \n scan.to_s =~ /\\<peaks\\s.*\\>(\\w+)\\<\\/peaks\\>/\n return $1\n\n pks = [[],[]]; \n if (!@isMzData) then \n pkelm = scan.at('peaks')\n sym = @@BYTEORDER[pkelm[:byteorder]]\n sym.upcase! if (pkelm[:precision].to_i > 32)\n data = Base64.decode64(pkelm.inner_text())\n if (pkelm[:compressiontype] == 'zlib')\n data = Zlib::Inflate.inflate(data)\n end\n tmp = data.unpack(\"#{sym}\")\n tmp.each_index do |idx|\n if (idx % 2 == 0 ) then \n pks[0].push(tmp[idx])\n else\n pks[1].push(tmp[idx])\n end\n end\n else\n # first, get mz array data\n tmp = scan.search('mzArrayBinary/data')\n sym = @@BYTEORDER[tmp.attr('endian')]\n sym.upcase! if (tmp.attr('precision').to_i > 32)\n pks[0] = Base64.decode64(tmp.text()).unpack(sym)\n # mz = Base64.decode64(tmp.text).unpack(sym)\n #now for the intensity array\n tmp = scan.search('intenArrayBinary/data')\n sym = @@BYTEORDER[tmp.attr('endian')]\n sym.upcase! if (tmp.attr('precision').to_i > 32)\n pks[1] = Base64.decode64(tmp.text()).unpack(sym)\n # int = Base64.decode64(tmp.text).unpack(sym)\n end\n pks\n end",
"def optimized_max_range(array, window_size)\n stack = StackQueue.new\n highest_difference = nil\n\n until stack.size == window_size\n stack.enqueue(array.shift)\n end\n\n until array.empty?\n if highest_difference.nil? || (stack.max - stack.min) > highest_difference\n highest_difference = stack.max - stack.min\n end\n\n stack.dequeue\n stack.enqueue(array.shift)\n end\n\n if (stack.max - stack.min) > highest_difference\n highest_difference = stack.max - stack.min\n end\n\n highest_difference\nend",
"def pickingNumbers(a)\n my_h = Hash.new(0)\n a.each do |elem|\n my_h[elem] = a.select {|x| (elem-x).abs < 2}\n end\n my_h.max_by {|i,v| v.size}[1].size - 1\nend",
"def is_peak()\n @time.hour.between?(7,8) || @time.hour.between?(17,19)\n end",
"def birthdayCakeCandles(n, ar)\n tallest = ar.max\n (ar.select {|val| val < tallest }).length\nend",
"def slow_max_slice(a)\n max_slice = 0\n prefix = prefix_sum(a)\n a.size.times do |p|\n for q in p..(a.size - 1)\n sum = prefix[q + 1] - prefix[p]\n max_slice = [max_slice, sum].max\n end\n end\n max_slice\nend",
"def maxSubArraySum(a)\n maxint =(2**(0.size * 8 -2) -1)\n msf = -maxint - 1\n max_end = 0\n \n for i in (0..a.length-1)\n max_end = max_end + a[i] \n if (msf < max_end)\n msf = max_end\n end\n \n if (max_end < 0) \n max_end = 0 \n end\n end\n return msf\nend",
"def windowed_max_range(array, w)\nend",
"def how_many(value)\n lo = 0\n hi = @array.length - 1\n mid = lo + (hi - lo) / 2\n\n # ordinary binary search\n # while both bounds hasn't reach each other\n while (lo <= hi) and @array[mid] != value\n # divide the range where the value could be\n mid = lo + (hi - lo) / 2\n if value < @array[mid] then\n hi = mid - 1\n elsif value > @array[mid] then\n lo = mid + 1\n end\n end\n\n # if didn't find the value with the binary search\n if @array[mid] != value\n return 0\n end\n\n hi_index = find_bounds @array, hi, lo, mid, value, :HI\n lo_index = find_bounds @array, hi, lo, mid, value, :LO\n\n hi_index - lo_index + 1\n end",
"def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend",
"def find_max_consecutive_ones(nums)\n counter = 0\n max = 0\n \n nums.each do |num|\n if num == 0\n counter = 0\n else\n counter += 1\n if counter > max\n max = counter\n end\n end \n end\n max\nend",
"def maxima(num = 1)\r\n Digiproc::DataProperties.maxima(self.magnitude, num)\r\n end",
"def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend",
"def find_max\n loc = find_max_locator and loc.value\n end",
"def max_windowed_range_slow(array, window_size)\n current_max_range = 0\n i = 0\n \n while array[i + window_size - 1] \n min = array[i..(i + window_size - 1)].min \n max = array[i..(i + window_size - 1)].max\n range = (max - min)\n current_max_range < range ? current_max_range = range : current_max_range\n i += 1\n end \n p current_max_range\nend",
"def solution(a)\n \n max = 0\n # write your code in Ruby 2.2\n max if a.nil? || a.length == 0\n \n if a.length < 4\n max = 1\n a.each do |item|\n max = max * item\n end\n max\n end\n \n # order first => nlogn + left and right edge max three\n a.sort!\n \n # - - -\n # + + +\n if a[0] >= 0 || a[-1] <= 0 || a[1] >= 0\n max = a[-1] * a[-2] * a[-3]\n max\n end\n \n # n = 4\n max = a[0] * a[1] * a[2]\n max = [max,a[0] * a[1] * a[-1]].max\n max = [max,a[0] * a[-2] * a[-1]].max\n max = [max,a[-3] * a[-2] * a[-1]].max\n max\n end",
"def max_range(array)\r\n\r\n array.max - array.min # max and min methods used\r\nend",
"def calc_all_day_max\n max = 0\n @events_all_day = []\n (0..(num_days-1)).each do |day|\n count = 0\n day_events = []\n if !events[day].nil?\n events[day].each do |event|\n if event.all_day\n count = count + 1\n day_events << event\n end\n end\n end\n if count > max\n max = count\n end\n @events_all_day << day_events\n end\n max\n end",
"def max_sum_no_consecutive(array)\n return if array.size = 0\n\n global_max = array[0]\n current_max = array[0]\n\n for i in 1..array.size - 1\n \n end\nend",
"def problem_77a\n primes = Primes.upto(100)\n\n # off is the offset in the prime array, we can work down :-)\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1 if (a & primes).length == a.uniq.length\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n m = 0\n (2..100).each do |num|\n break if (m = solve.call([1] * num,0,num-1)) > 5000\n puts \"#{num} => #{m}\"\n end\n m\nend",
"def max_offset\n input.max_offset\n end",
"def count_zones(peaks)\n zones = []\n\n peaks.each do |peak|\n visited = []\n queue = [peak]\n\n while queue.length > 0 do\n vertex = queue.shift\n visited << vertex\n vertex.children.each do |child|\n unless visited.include?(child)\n queue << child\n end\n end\n end\n\n zones << visited.length\n\n end\n\n zones\n\n end",
"def solution(arr, pond_width, max_jump_d)\n # returns 0 if frog can jump directly across the pond\n return 0 if pond_width <= max_jump_d\n # returns 0 if frog can jump to first leaf and then from first leaf\n # to the other side of the pond\n return 0 if arr[0] <= max_jump_d && (pond_width - arr[0]) <= max_jump_d\n\n prev_pos = 0\n arr.each_with_index do |pos, time|\n if (pos - prev_pos) <= max_jump_d && pos > prev_pos\n prev_pos = pos\n return time if pond_width - prev_pos <= max_jump_d\n end\n end\n\n # frog is unable to reach the other side and returns -1\n return -1\nend",
"def windowed_max_range(array, window_size)\n # debugger\n current_max_range = -1\n range = (array.length + 1) - window_size\n i = 0\n while i < range\n window = array[i...window_size+i]\n diff = window.max - window.min\n current_max_range = diff if diff > current_max_range\n i += 1\n end\n current_max_range\nend",
"def solution(a)\n puts \"a:#{a}\"\n a.each_with_index do |elem, idx|\n next if idx ==0\n bidx = [idx - 6, 0].max\n last_6_max = a[bidx..(idx-1)].max\n a[idx] += last_6_max\n # puts \"a:#{a}\"\n end\n a[-1]\n end",
"def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend",
"def compute_score_max(pointer)\n file_info = (pointer.is_a?(FileInfo) ? pointer : pointer.file_info)\n result_score_max = 0\n lst_index_names = [ :base_name, :size, :date ]\n lst_index_names << :ext if (!File.extname(file_info.base_name).empty?)\n lst_index_names.each do |index_name|\n result_score_max += COEFFS[index_name]\n end\n lst_crc = (pointer.is_a?(FileInfo) ? pointer.crc_list : pointer.segment.crc_list)\n result_score_max += (COEFF_BLOCK_CRC_SEQUENCE + COEFFS[:block_crc]) * lst_crc.size\n result_score_max += COEFFS[:segment_ext] * (pointer.is_a?(FileInfo) ? pointer.segments.size : 1)\n (pointer.is_a?(FileInfo) ? pointer.segments : [ pointer.segment ]).each do |segment|\n result_score_max += COEFF_SEGMENT_METADATA * segment.metadata.size\n end\n\n return result_score_max\n end",
"def maxima\n return Features.maxima(@data)\n end",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def find_extreme_values(array = [])\n raise 'array should include only integers' unless array.all?(Numeric)\n\n raise 'array length should be more or equel to 9' if array.length < 9\n\n array_filtered = array.sort.uniq\n arraay_middle_el = (array_filtered.length / 2) - 1\n extreme_values = { smallest: [], middle: [], greatest: [] }\n (0..2).each do |i|\n extreme_values[:smallest] << array_filtered[i]\n extreme_values[:middle] << array_filtered[arraay_middle_el + i]\n extreme_values[:greatest] << array_filtered[-1 - i]\n end\n puts 'smallest values: ' + extreme_values[:smallest].join(', ')\n puts 'middle values: ' + extreme_values[:middle].join(', ')\n puts 'greatest values: ' + extreme_values[:greatest].join(', ')\nend",
"def eleven\n max = 0\n matrix = read_file\n height = matrix.length\n width = matrix[0].length\n\n for i in 0..height\n for j in 0..width\n if (temp = max_fn(find_max_hor(matrix, i, j, 1), find_max_ver(matrix, i, j, 1), find_max_lower_dia(matrix, i, j, 1), find_max_upper_dia(matrix, i, j, 1))) > max\n max = temp\n end \n end\n end\n return max \nend",
"def peak\n\t\tif not @next_token\n\t\t\t@next_token = read_token\n\t\tend\n\t\treturn @next_token\n\tend",
"def primes_up_to(max)\n repository = (0..max).collect{true} #=> Create flag array\n limit = (max ** 0.5) #=> establish search limit\n\n for index in 2..limit #=> search through flag aray\n next if !repository[index]\n num = (index * 2)\n while num <= max #=> unflag multiples of primes\n repository[num] = false\n num += index\n end\n end\n\n # => convert numbers into arrays\n primes = repository.collect.with_index do |flag, value|\n value if flag\n end\n\n # return cleaned array\n primes.shift\n primes.shift\n primes.compact\nend",
"def solution(a)\n min_index = nil\n max_index = nil\n\n a.each_with_index do |num, index|\n if index < a.length-1\n if num > a[index + 1]\n min_index = index\n break\n end\n end\n end\n\n reversed_array = a.reverse\n\n reversed_array.each_with_index do |num, index|\n if index < reversed_array.length-1\n if num < reversed_array[index + 1]\n max_index = a.length - index - 1\n break\n end\n end\n end\n\n if min_index.nil? && max_index.nil?\n return 0\n end\n\n until a.sort == a[0...min_index] + a[min_index..max_index].sort + a[max_index+1..-1]\n minimum_in_sub = a[min_index..max_index].sort.first\n maximum_in_sub = a[min_index..max_index].sort.last\n\n new_min_index = a[0...min_index].reverse.index(a[0...min_index].reverse.find{|n| n >= minimum_in_sub})\n\n if new_min_index\n min_index = min_index - new_min_index - 1\n end\n\n new_max_index = a[max_index+1..-1].index(a[max_index+1..-1].find{|n| n <= maximum_in_sub})\n\n if new_max_index\n max_index = max_index + new_max_index + 1\n end\n end\n\n max_index - min_index + 1\nend",
"def find_daily_peak_times(daily_time_periods, num_peaks)\n peaks = []\n daily_time_periods.size.times {|i| peaks << [daily_time_periods[i].size, i]}\n peaks.sort.reverse.slice(0, num_peaks).sort {|a,b| a[1]<=>b[1]}\n end",
"def find_maximum_subarray(arr, low, high)\n if high == low or arr.length == 0\n return low, high, arr[low]\n else\n mid = (low + high)/2\n left_low, left_high, left_sum =\n find_maximum_subarray(arr, low, mid)\n right_low, right_high, right_sum =\n find_maximum_subarray(arr, mid + 1, high)\n cross_low, cross_high, cross_sum =\n find_maximum_crossing_subarray(arr, low, mid, high)\n if left_sum >= right_sum and left_sum >= cross_sum\n return left_low, left_high, left_sum\n elsif right_sum >= left_sum and right_sum >= cross_sum\n return right_low, right_high, right_sum\n else\n return cross_low, cross_high, cross_sum\n end\n end\n end",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def largest_range(arr)\n best_range = []\n longest_length = 0\n nums = {}\n\n arr.each do |num|\n nums[num] = true\n end\n\n arr.each do |num|\n next unless nums[num]\n\n nums[num] = false\n current_length = 1\n left = num - 1\n right = num + 1\n\n while nums[left]\n nums[left] = false\n current_length += 1\n left -= 1\n end\n\n while nums[right]\n nums[right] = false\n current_length += 1\n right += 1\n end\n\n if current_length > longest_length\n longest_length = current_length\n best_range = [left + 1, right - 1]\n end\n end\n best_range\nend",
"def max_candidates\n return @max_candidates\n end",
"def max_area_improved(height)\n i = 0\n j = height.length - 1\n area = 0\n while(i < j)\n area = [area, (j-i) * [height[i], height[j]].min].max\n height[i] < height[j] ? (i+= 1) : (j-=1)\n end\n area\nend",
"def pe66v5()\n\tprintf \"Using meathod pe66v5 \\n\";\n\tda = [2]\n\t3.upto(1000) do |d|\n\t\tif((d ** 0.5) % 1 != 0) then \n\t\t\tda.push(d)\n\t\tend\n\t\t\n\tend\n\tda.each do |d|\n\t\tprintf \"%d \",d\n\tend\n\tprintf \"\\n\"\n\tmax = 0;\n\ttotal = 0;\n\tda.each do |d|\t\n\t\t1.upto(10000) do |x|\n\t\t\t1.upto(10000) do |y|\n\t\t\t\ttotal = d * (y ** 2 ) + 1\n\t\t\t\tif(total != x ** 2 ) then next end\n\t\t\t\tif(x > max) then\n\t\t\t\t\tmax = x\n\t\t\t\t\tprintf \"Found x = %d d = %d y = %d\\n\",x,d,y\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend",
"def maxseq_indexes(*args)\n # total now means \"total value, where they start, where they finish\"\n total = start = finish = 0\n # current too\n current = curr_start = curr_finish =0\n args.each_with_index do |el,idx|\n if current+el >= 0\n current+=el\n curr_finish = idx\n else\n current = 0\n curr_start = idx+1\n end\n if current >= total\n total = current\n start = curr_start\n finish = curr_finish\n end\n end\n total.zero? ? [] : args[start..finish] \nend",
"def quality_of guesses\n pcnt = Hash.new 0 # tracks number of times a peg tallies\n\n # Look for exact matches first.\n guesses.zip(@pegs).each {|guess,peg| pcnt[peg] += 1 if peg == guess}\n exactly = pcnt.values.reduce(:+) || 0 # use stuff we learnt\n\n # Now count close matches.\n guesses.each {|peg| pcnt[peg] += 1 if (@pegs.include? peg) &&\n (pcnt[peg] < @pmax[peg])}\n nearly = pcnt.length == 0? 0 : pcnt.values.reduce(:+) - exactly\n\n [exactly, nearly]\n end",
"def find_max_value(array)\nx = 0 \n array.length.times { |index|\n if array[index] > x \n x = array[index]\n end\n }\n x\n end",
"def max_area(height)\r\n max_area = 0\r\n height.each_with_index do |start, idx1|\r\n height.each_with_index do |finish, idx2|\r\n if idx2 > idx1\r\n area = [start, finish].min * (idx2 - idx1) \r\n max_area = area if area > max_area\r\n end\r\n end\r\n end\r\n max_area\r\nend",
"def max_area_of_island(grid)\n return 0 if grid.empty?\n w, h = grid[0].length, grid.length\n max = 0\n (0...h).each do |i|\n (0...w).each do |j|\n if grid[i][j] == 1\n max = [max, search(grid, i, j)].max\n end\n end\n end\n max\nend"
] |
[
"0.72533923",
"0.66104174",
"0.6574849",
"0.63505656",
"0.62534386",
"0.6224907",
"0.6141785",
"0.6076366",
"0.59294224",
"0.58392936",
"0.58202827",
"0.57658553",
"0.5696571",
"0.5521911",
"0.5462099",
"0.540951",
"0.5368209",
"0.5274806",
"0.52329034",
"0.5222797",
"0.5207767",
"0.520663",
"0.51523274",
"0.5131383",
"0.5122737",
"0.51095647",
"0.5073886",
"0.5059518",
"0.50307286",
"0.5027827",
"0.5011448",
"0.49959448",
"0.49723417",
"0.49664512",
"0.4951909",
"0.495138",
"0.4945209",
"0.49383566",
"0.48848164",
"0.48673818",
"0.48582512",
"0.48368162",
"0.48349896",
"0.48236468",
"0.47988838",
"0.4795745",
"0.47945523",
"0.47909096",
"0.4773986",
"0.47726065",
"0.4755472",
"0.47547805",
"0.47539642",
"0.4749061",
"0.47404563",
"0.47397426",
"0.47330323",
"0.47320694",
"0.47312737",
"0.47229627",
"0.47088838",
"0.47077772",
"0.46996427",
"0.46845382",
"0.46815246",
"0.46695584",
"0.46555606",
"0.46530133",
"0.46467796",
"0.46461877",
"0.46440092",
"0.46433902",
"0.46407446",
"0.4633676",
"0.46305728",
"0.46304175",
"0.4622263",
"0.46212846",
"0.4619242",
"0.4615373",
"0.46134055",
"0.4606266",
"0.46060506",
"0.46052006",
"0.46051905",
"0.46045017",
"0.4597428",
"0.45961437",
"0.45954105",
"0.45845678",
"0.45735246",
"0.4572696",
"0.45667872",
"0.45634264",
"0.45611",
"0.4559483",
"0.4557863",
"0.45563507",
"0.45554337",
"0.4550925"
] |
0.7654614
|
0
|
helper functions could refactor into mixins, but meh.
|
def sum roll
roll.reduce &:+
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def custom; end",
"def custom; end",
"def private; end",
"def wrapper; end",
"def common\n \n end",
"def define_helpers; end",
"def overrides; end",
"def mixins(*scopes); end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def extended(*) end",
"def implementation; end",
"def implementation; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def extra; end",
"def special\n override\n end",
"def abstract!; end",
"def methods() end",
"def generic?; true; end",
"def weber; end",
"def stuff\n end",
"def who_we_are\r\n end",
"def processor; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def operations; end",
"def operations; end",
"def schubert; end",
"def method_731(base); end",
"def mix\n #future code\n end",
"def abstract?; end",
"def inherited(base); end",
"def intensifier; end",
"def included; end",
"def delegating_method; end",
"def define_name_helpers; end",
"def super_method; end",
"def spice; end",
"def traits; end",
"def anchored; end",
"def specialty; end",
"def suivre; end",
"def overload; end",
"def my955; end",
"def jack_handey; end",
"def yield; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def magic_mixin(mod)\n # Add the passed module to the inherits_from class variable\n inherits_from = nil\n begin\n inherits_from = self.class_variable_get(\"@@inherits_from\")\n rescue NameError\n inherits_from ||= []\n end\n inherits_from << mod.to_sym\n self.class_variable_set(:@@inherits_from,inherits_from)\n \n # Do the actually class extension using class_exec\n self.class_exec do\n # Grab the module name from the last entry of inherits_from\n # class variable. This is done because class_exec doesn't\n # include the calling methods local variables.\n @@current_mod = @@inherits_from.last\n @@current_mod.to_s.classify.constantize.extend_class(self)\n end\n end",
"def third_party_processors; end",
"def helper(*args, &block); end",
"def mixin_specific_behaviour\n raise \"Roles require a name\" if self.name.nil?\n Rails.logger.info(\"Seeing if #{self.name} has a mixin...\")\n begin\n mod = \"barclamp_#{barclamp.name}\".camelize.to_sym\n return self unless Module::const_defined?(mod)\n mod = Module::const_get(mod)\n [\"role\",\n self.name].map{|m|m.tr(\"-\",\"_\").camelize.to_sym}.each do |m|\n return self unless mod.const_defined?(m)\n mod = mod.const_get(m)\n return self unless mod.kind_of?(Module)\n end\n Rails.logger.info(\"Extending #{self.name} with #{mod}\")\n self.extend(mod)\n rescue\n # nothing for now, this code is going away\n end\n end",
"def instance_helper\n\tend",
"def super_class; end",
"def super_class; end",
"def functions\n\n end",
"def romeo_and_juliet; end",
"def invention; end",
"def identify; end",
"def base; self; end",
"def calls; end",
"def calls; end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend",
"def transformations; end",
"def scientist; end",
"def superclass() end",
"def ignores; end",
"def implemented_in; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def helper_class=(_arg0); end",
"def include; end",
"def include; end",
"def dispatch\n raise NotImplementedError\n end",
"def mitch_hedberg; end",
"def doManipulation(contents); raise \"Abstract Exception: doManipulation must be extended\"; end",
"def extended( hooked_instance )\n\n super if defined?( super )\n \n end",
"def base_class; end",
"def isolated; end",
"def isolated; end",
"def for_cop(cop); end",
"def inherited(klass); end",
"def inherited(klass); end"
] |
[
"0.6485137",
"0.6485137",
"0.6485137",
"0.6479026",
"0.6479026",
"0.62635756",
"0.62088186",
"0.6166786",
"0.61273384",
"0.61226386",
"0.6112465",
"0.6062371",
"0.6062371",
"0.6062371",
"0.6041702",
"0.60400856",
"0.60400856",
"0.60001475",
"0.5954442",
"0.5954442",
"0.5954442",
"0.5954442",
"0.5820773",
"0.5791774",
"0.57836777",
"0.5776628",
"0.5737814",
"0.57328755",
"0.5657491",
"0.56324995",
"0.5627189",
"0.5611221",
"0.5611221",
"0.5611221",
"0.5611221",
"0.5609472",
"0.5609472",
"0.55946386",
"0.5589758",
"0.5573676",
"0.55660295",
"0.5553499",
"0.5552594",
"0.55501324",
"0.5548029",
"0.5545079",
"0.55281997",
"0.55203813",
"0.5518841",
"0.55185306",
"0.55100715",
"0.55089766",
"0.55023754",
"0.54975885",
"0.5477648",
"0.5416627",
"0.54120725",
"0.54120725",
"0.54120725",
"0.5410422",
"0.54041904",
"0.5401208",
"0.53862065",
"0.5382911",
"0.5382098",
"0.5382098",
"0.53815967",
"0.5379335",
"0.53732646",
"0.5368769",
"0.53581744",
"0.53548425",
"0.53548425",
"0.53506744",
"0.53427845",
"0.53380114",
"0.5332426",
"0.53316873",
"0.5329962",
"0.53265953",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5325892",
"0.5324984",
"0.53215396",
"0.53215396",
"0.5314882",
"0.53084934",
"0.530229",
"0.52972645",
"0.52816945",
"0.52801526",
"0.52801526",
"0.5270941",
"0.52634215",
"0.52634215"
] |
0.0
|
-1
|
callseq: File.mime( string ) > string or array See also: File::magic and File::type
|
def mime(path)
magic(path, Magic::MIME)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end",
"def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end",
"def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end",
"def mime_type\n MIME_TYPES[@file_type]\n end",
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime(path)\n MIME::Types.type_for(expand path).first\n end",
"def type(path)\n magic(path, Magic::MIME_TYPE)\n end",
"def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend",
"def mime_type\n metadata[\"mime_type\"]\n end",
"def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end",
"def mime_from_file(filepath)\n # moved here, as mimemagic can cause installation issues\n require 'mimemagic'\n require 'mimemagic/version'\n require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')\n # check magic number inside file (empty string if not found)\n detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s\n # check extension only\n if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)\n Log.log.debug(\"no conversion for #{detected_mime}, trying extension\")\n detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s\n end\n detected_mime=nil if detected_mime.empty?\n Log.log.debug(\"mimemagic: #{detected_mime.class.name} [#{detected_mime}]\")\n return detected_mime\n end",
"def negotiate_mime(order); end",
"def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end",
"def file_set_mime_type\n file_set.mime_type.first\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def get_mime_type(file)\n if !file.nil?\n extension = File.extname(file)\n return Rack::Mime::MIME_TYPES[extension] || 'text/plain'\n end\n \n return 'text/plain'\n end",
"def mime\n @mime ||= MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end",
"def mime_type(*args, **_arg1, &block); end",
"def _mime_type\n if defined? @_mime_type\n @_mime_type\n else\n guesses = ::MIME::Types.type_for(extname.to_s)\n\n # Prefer text mime types over binary\n @_mime_type = guesses.detect { |type| type.ascii? } || guesses.first\n end\n end",
"def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end",
"def mime_type\n Rack::Mime.mime_type(extname)\n end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def _extract_mime_type_with_mime_types(io)\n if filename = extract_filename(io)\n mime_type = MIME::Types.of(filename).first\n mime_type.to_s if mime_type\n end\n end",
"def mime_type\n @metadata[:mime_type]\n end",
"def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type.empty? ? nil : type.first\n end",
"def mime_type\n @mime_type ||= Rack::Mime.mime_type(\".#{ext}\")\n end",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def mime_type\n @attributes[:mime_type]\n end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def mimetype\n mtype = MIME::Types.of(@filename).first\n if (mtype)\n mimetype = MIME::Type.simplified(mtype)\n end\n mimetype\n end",
"def mime_type=(_); end",
"def content_mime_type; end",
"def test_abbrev_mime_type\n fm = FileMagic.mime\n assert_match(/\\Aapplication\\/vnd.ms-/, fm.file(path_to('excel-example.xls')))\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mime_type_of(f)\n MIME::Types.of(f).last || default_mime_type\n end",
"def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end",
"def mime_type\n meta['mime_type'] || app.mime_type_for(ext)\n end",
"def mime_for_file(file)\n path = file.is_a?(File) ? file.path : file\n MIME::Types.type_for(path)[0] || 'application/octet-stream'\n end",
"def mime_exts\n config[:mime_exts]\n end",
"def mime_type\n @metadata[:mime_type] || Mime::Type.lookup_by_extension(s3obj.content_type || ::File.extname(filename)[1..-1])\n end",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def extract_mime_type(path)\n mime = MimeMagic.by_magic(File.open(path))\n mime ? mime.type : 'text/plain'\n end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def mime\n mimes = []\n self.class.ancestors.each do |parent|\n if parent.const_defined? 'MIMES'\n parent.const_get('MIMES').each do |mime|\n unless mimes.include? mime\n mimes << mime\n end\n end\n end\n end\n mimes\n end",
"def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end",
"def mime_type\n _mime_type ? _mime_type.to_s : 'text/plain'\n end",
"def mime(*flags, &block)\n open(:mime, *flags, &block)\n end",
"def mime_type(mt=nil)\n @_mime_type = mt unless mt.nil?\n @_mime_type\n end",
"def additional_mime_types\n [\n MIME::Type.new( 'text/plain' ) { |t| t.extensions = %w[ rb rdoc rhtml md markdown ] },\n ]\n end",
"def mime_types\n {image: ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff'],\n pdf: ['application/pdf', 'application/x-pdf'],\n audio: ['audio/mpeg', 'audio/mp4', 'audio/x-aiff', 'audio/ogg', 'audio/vorbis', 'audio/vnd.wav'],\n video: ['video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv']}\n end",
"def mime_type\n @mime_type ||= message.mime_type\n end",
"def mime_subtype\n mime_type.split(/\\//)[1]\n end",
"def mime_type\n Blob.mime_type(self.name)\n end",
"def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end",
"def mime_type\n MIME_TYPE\n end",
"def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def content_type\n self.file_content_type\n end",
"def mime\n @mime ||= if meta?\n YAML_MIME\n else\n mime = MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end\n end",
"def mime_type file_name\n mime_types = MIME::Types.of(file_name)\n mime_type = mime_types.empty? ? \"application/octet-stream\" : mime_types.first.content_type\n end",
"def content_type\n file.try(:content_type)\n end",
"def mime_type\n return @mime_type\n end",
"def mime_type\n\t\tsuffix_without_dot = extname ? extname.sub(/\\A\\./){''}.downcase : nil\n\n\t\tMechanize::Util::DefaultMimeTypes[suffix_without_dot]\n\tend",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def mimetype\n return @mimetype if defined? @mimetype\n\n type = metadata['Content-Type'].is_a?(Array) ? metadata['Content-Type'].first : metadata['Content-Type']\n\n @mimetype = MIME::Types[type].first\n end",
"def mime_find(mime)\n MIME_MAP[mime] || {:name => \"Unknown file type\", :icon_key => \"misc_file\"}\n end",
"def guess_mime_type(path)\n return nil\n #test behaviour on windows before using this\n type = `file #{path} -ib 2> /dev/null`.chomp\n type.blank? ? nil : type\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def mime_type(type)\n roda_class.mime_type(type)\n end",
"def get_mime_type(path)\n return false unless path.include? '.'\n filetype = path.split('.').last\n\n return case\n when [\"html\", \"htm\"].include?(filetype)\n \"text/html\"\n when \"txt\" == filetype \n \"text/plain\"\n when \"css\" == filetype\n \"text/css\"\n when \"js\" == filetype\n \"text/javascript\"\n when [\"png\", \"jpg\", \"jpeg\", \"gif\", \"tiff\"].include?(filetype)\n \"image/#{filetype}\"\n when [\"zip\",\"pdf\",\"postscript\",\"x-tar\",\"x-dvi\"].include?(filetype)\n \"application/#{filetype}\"\n else false\n end\n end",
"def mime_types(type)\n mime_types = {\n yaml: \"application/x-yaml\",\n json: \"application/json\"\n }\n mime_types[type.to_sym]\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def identify_type(path)\n return nil unless path\n return Rack::Mime.mime_type(File.extname(path)) unless File.size? path\n\n # @type [String] mime\n mime, charset = detect_mime path\n charset = detect_charset(path) if mime =~ %r{^text/} && charset !~ /^utf/\n\n [mime, charset]\n end",
"def mime_types(*types)\n types.flatten.each do |t|\n @mime_types << t\n end\n @mime_types\n end",
"def ext\n Rack::Mime::MIME_TYPES.invert[data_content_type]\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end",
"def mime\n self.class.mime(self)\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def mime_type(media_type = nil)\n types = MIME::Types.type_for(path)\n return if types.empty?\n if media_type\n media_type = media_type.to_s\n media_types = types.select { |m| m.media_type == media_type }\n if media_types.length > 1\n sub_types = media_types.select { |m| m.sub_type == format }\n media_types = sub_types if sub_types.any?\n end\n types = media_types if media_types.any?\n end\n types.first.content_type if types.any?\n end",
"def mime_type\n if source.present?\n source.mime_type\n end\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend",
"def content_type\n @mime_type\n end",
"def dor_file_mimetype\n public_xml_doc.xpath('//contentMetadata/resource/*/@mimetype').map(&:text)\n end",
"def mime_type\n return content_type\nend",
"def filename_to_mimetype(filename)\n if !filename\n return nil\n end\n if filename.match(/\\.([^.]+)$/i)\n lext = $1.downcase\n if $file_extension_to_mime_type.include?(lext)\n return $file_extension_to_mime_type[lext]\n end\n end\n return nil\nend",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def mime(attrs, *mimes)\n mimes = mimes.map(&:to_s)\n Array(attrs).each do |attr|\n magic = MimeMagic.by_magic(@object.send(attr))\n unless magic && (mimes & [magic.type, magic.mediatype, magic.subtype]).any?\n error(attr, \"should be of type #{mimes.join(' or ')}\")\n end\n end\n end"
] |
[
"0.7542645",
"0.74431837",
"0.74249846",
"0.7394399",
"0.73165077",
"0.72394323",
"0.72394323",
"0.72394323",
"0.72394323",
"0.72184753",
"0.7176577",
"0.7176577",
"0.7176577",
"0.71424216",
"0.71355206",
"0.7130608",
"0.7127985",
"0.7120794",
"0.7098829",
"0.70859224",
"0.70401406",
"0.7035942",
"0.70349175",
"0.70118946",
"0.7010591",
"0.70047945",
"0.70041937",
"0.6998308",
"0.69800013",
"0.697924",
"0.6978832",
"0.6967374",
"0.6965102",
"0.69600797",
"0.6954666",
"0.6940821",
"0.6927583",
"0.69204754",
"0.69202065",
"0.69184524",
"0.691613",
"0.69052804",
"0.6884344",
"0.68828297",
"0.68828297",
"0.68828297",
"0.68807423",
"0.68781966",
"0.6867631",
"0.6863863",
"0.6853913",
"0.68428147",
"0.6840714",
"0.6836424",
"0.68327415",
"0.6827013",
"0.6825694",
"0.6808334",
"0.68081653",
"0.679567",
"0.6793187",
"0.67760813",
"0.67692065",
"0.6768223",
"0.6767626",
"0.67674524",
"0.67632747",
"0.676098",
"0.6753832",
"0.67516613",
"0.6747857",
"0.6739342",
"0.67375386",
"0.6729724",
"0.6725257",
"0.6712952",
"0.6702795",
"0.66863394",
"0.6685047",
"0.66760516",
"0.666776",
"0.6660202",
"0.665393",
"0.6648529",
"0.66370946",
"0.66336846",
"0.6630888",
"0.66150045",
"0.66121936",
"0.6590381",
"0.6585793",
"0.65855926",
"0.65839314",
"0.6575567",
"0.65632594",
"0.6552776",
"0.6550579",
"0.6546439",
"0.65453756",
"0.65425"
] |
0.77118236
|
0
|
callseq: File.type( string ) > string or array See also: File::magic and File::mime
|
def type(path)
magic(path, Magic::MIME_TYPE)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def ftype() File.ftype(path) end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def type t\n @files = @files.select { |file| File.exist?(file) && File.ftype(file) == t}\n self\n end",
"def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end",
"def ftype\n :file\n end",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def file_type(file_path)\n return 'file' if File.file? file_path\n return 'directory' if File.directory? file_path\n return 'unknown'\n end",
"def file_type\n FILE_TYPES[@file_type]\n end",
"def fileType path\n\t\tif File.ftype(path) == 'file'\n\t\t\ttrue\n\t\telse\n\t\t\tputs \"The given path isn't file.\"\n\t\t\texit\n\t\tend\n\tend",
"def file_type\n case raw_file_type\n when 'f'\n :file\n when 'd'\n :directory\n when 'L'\n :symlink\n when 'D'\n :device\n when 'S'\n :special\n end\n end",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def file?\n type == :file\n end",
"def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def content_type\n self.file_content_type\n end",
"def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end",
"def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def check_file_type\n `file #{@desktop_image}`.sub(/^.*: /,'').split.first.downcase\n end",
"def content_type\n file.try(:content_type)\n end",
"def document_type\n FileUtility.get_file_type(@file_name)\n end",
"def ftype(path)\n path = expand_path(path)\n begin\n str = self.stat('-c', '%F', path).strip\n case str\n when /no such file or directory/i\n raise Errno::ENOENT, \"#{self}:#{path} does not exist\"\n when 'regular file'\n 'file'\n when 'regular empty file'\n 'file'\n when 'directory'\n 'directory'\n when 'character special file'\n 'characterSpecial'\n when 'block special file'\n 'blockSpecial'\n when /link/\n 'link'\n when /socket/\n 'socket'\n when /fifo|pipe/\n 'fifo'\n else\n raise RuntimeError, \"unknown filetype #{str}\"\n end\n rescue\n raise RuntimeError, \"stat #{self}:#{path} failed - #{str}\"\n end\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def type\n @type ||= File.extname(path)[1..-1]\n end",
"def ftype() File.ftype( expand_tilde ) end",
"def file_name_type(item = nil)\n fd = get_file_data(item)\n file = file_upload_data(fd)\n file = file&.dig(:metadata, :filename) and return [file, :uploader]\n file = pending_file_name(fd) and return [file, :name]\n file = pending_file_url(fd) and return [file, :url]\n ['ENCODED', :data] if encoded_file_data(fd) # TODO: don't handle this yet\n end",
"def file_type(file_name)\n return file_name[file_name.rindex(\".\") + 1, file_name.size]\n end",
"def file_set_mime_type\n file_set.mime_type.first\n end",
"def mime_type\n MIME_TYPES[@file_type]\n end",
"def file_type(property: 'file')\n params.dig property, :type\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end",
"def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end",
"def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end",
"def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end",
"def content_type\n @content_type || file.content_type\n end",
"def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end",
"def mime_type(*args, **_arg1, &block); end",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def file_type\n attachments.order(position: 'asc').first.file_type\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 'application/pdf'\n end",
"def ftype() end",
"def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end",
"def detect_file_type(tempfile)\n tempfile.rewind\n MagicBytes.read_and_detect(tempfile).tap { tempfile.rewind }\n end",
"def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def valid_file_type filename\n # avoid hacks that break out of single quotes echoed to shell\n filename.gsub!(\"'\", '')\n `file '#{filename}'`.split(':').last.downcase =~ Regexp.union(*valid_file_types)\n end",
"def file_type(file_name)\n File.exname( file_name ).gsub( /^\\./, '').downcase\n end",
"def determine_file_type\n return \"pfile\" if image? and (@filename =~ /^P.....\\.7/) != nil\n return \"pfile\" if (@filename =~ /^P.....\\.7\\.summary/) != nil\n return \"geifile\" if image? and (@filename =~ /^I\\.\\d*/) != nil\n return \"scan_archive_h5_json\" if (@filename =~ /^ScanArchive_.{10,}.h5.json/) != nil\n return \"dicom\" if image? and (@filename =~ /^P.....\\.7/) == nil\n return nil\n end",
"def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def type_for(filename, platform = false)\r\n # call the original method\r\n type = mime_type_for(filename, platform)\r\n \r\n if type.empty? then\r\n case File.extname(filename)\r\n when '.cod'\r\n type = MIME::Type.from_array('application/vnd.rim.cod', 'cod', '8bit', 'linux')\r\n when '.apk'\r\n type = MIME::Type.from_array('application/vnd.android.package-archive', 'apk', '8bit', 'linux')\r\n when '.aetx'\r\n type = MIME::Type.from_array('application/x-aetx', 'aetx', '8bit', 'linux')\r\n when '.xap'\r\n type = MIME::Type.from_array('application/x-silverlight-app', 'xap', '8bit', 'linux')\r\n end\r\n end\r\n return type\r\n end",
"def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type.empty? ? nil : type.first\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end",
"def mimetype\n process_upload\n return @file.file.file.content_type\n end",
"def _extract_mime_type_with_mime_types(io)\n if filename = extract_filename(io)\n mime_type = MIME::Types.of(filename).first\n mime_type.to_s if mime_type\n end\n end",
"def filetype\n if options.filetype.to_sym == :dot then :none else options.filetype.to_sym end\n end",
"def type_from_detector\n begin\n ContentTypeDetector.new(@file.path).detect\n rescue Exception => e\n \"\"\n end\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def file_type\n if is_ography?\n :ography\n else\n :tei_content\n end\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def mimetype\n mtype = MIME::Types.of(@filename).first\n if (mtype)\n mimetype = MIME::Type.simplified(mtype)\n end\n mimetype\n end",
"def identify_type(path)\n return nil unless path\n return Rack::Mime.mime_type(File.extname(path)) unless File.size? path\n\n # @type [String] mime\n mime, charset = detect_mime path\n charset = detect_charset(path) if mime =~ %r{^text/} && charset !~ /^utf/\n\n [mime, charset]\n end",
"def mime_type(type)\n roda_class.mime_type(type)\n end",
"def type_for(filename, platform = false)\n types = Array(filename).flat_map { |fn|\n @extension_index[File.basename(fn.chomp.downcase).gsub(/.*\\./o, '')]\n }.compact.sort { |a, b| a.priority_compare(b) }.uniq\n\n if platform\n MIME.deprecated(self, __method__,\n \"using the platform parameter\")\n types.select(&:platform?)\n else\n types\n end\n end",
"def types(file, line, col); end",
"def types(file, line, col); end",
"def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend",
"def mime_type\n metadata[\"mime_type\"]\n end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def mime_type=(_); end",
"def guessed_safe_content_type\n return unless path\n\n type = Marcel::Magic.by_path(original_filename).to_s\n type if type.start_with?('text/') || type.start_with?('application/json')\n end",
"def get_file_type\n\n @image.uploads.each do |upload|\n filename_arr = upload.content_type.to_s.split('/')\n @image.file_type = filename_arr[1].upcase\n end\n\n end",
"def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end",
"def mime_type file_name\n mime_types = MIME::Types.of(file_name)\n mime_type = mime_types.empty? ? \"application/octet-stream\" : mime_types.first.content_type\n end",
"def get_content_type file\n mime_type = MIME::Types.type_for(file.original_filename)\n return mime_type.first ? mime_type.first : nil\n end",
"def parser_type_for_filename(filename); end",
"def file_mimetype\n @descriptive_detail.file_mimetype\n end",
"def categorize filename\n [filetype(filename), fileclass(filename)]\nend",
"def filetype\n raise \"#{self.class} requires file_path to be set\" unless @file_path\n @filetype ||= Puppet::Util::FileType.filetype(:flat).new(@file_path)\n end",
"def mime_type\n Rack::Mime.mime_type(extname)\n end",
"def mime_type_of(f)\n MIME::Types.of(f).last || default_mime_type\n end",
"def file_base_type(path)\r\n \t\tfile_name = File.basename(path)\r\n \t\textension = File.extname(file_name)\r\n \t\tfile_name = file_name[0, file_name.length - extension.length]\r\n \t\t(File.extname(file_name)[1..-1]).to_sym\r\n end",
"def is_file?\n !file_type.empty?\n end"
] |
[
"0.7810919",
"0.7664052",
"0.7617552",
"0.7554582",
"0.7528531",
"0.74807364",
"0.7411001",
"0.73469263",
"0.73169863",
"0.7284074",
"0.72270966",
"0.7192171",
"0.71877134",
"0.7185103",
"0.7174584",
"0.70732903",
"0.7056606",
"0.7052238",
"0.70429844",
"0.70163965",
"0.6995836",
"0.6979953",
"0.69721997",
"0.6965302",
"0.69621885",
"0.6909684",
"0.68992656",
"0.68891895",
"0.68891895",
"0.68891895",
"0.6887486",
"0.68737227",
"0.6871838",
"0.6867182",
"0.6864331",
"0.6861443",
"0.6829516",
"0.68268126",
"0.6824816",
"0.68240505",
"0.6800783",
"0.6780275",
"0.6770507",
"0.6738737",
"0.6728688",
"0.67123044",
"0.6712074",
"0.6702727",
"0.66960716",
"0.6690076",
"0.6685343",
"0.66804737",
"0.6674911",
"0.6674911",
"0.6674911",
"0.6674911",
"0.66556275",
"0.66516227",
"0.6648025",
"0.66470754",
"0.6637761",
"0.6637276",
"0.6636193",
"0.6631016",
"0.66309947",
"0.6628958",
"0.6618508",
"0.66127664",
"0.65984815",
"0.65866834",
"0.65866834",
"0.65866834",
"0.65860677",
"0.658278",
"0.6562588",
"0.65519905",
"0.65465444",
"0.6544375",
"0.65432346",
"0.65388805",
"0.6531349",
"0.6531349",
"0.6529371",
"0.6520441",
"0.6509216",
"0.6502714",
"0.6491598",
"0.6490918",
"0.6482343",
"0.6475042",
"0.64749646",
"0.6464312",
"0.64635736",
"0.64581",
"0.64563507",
"0.6455165",
"0.64501524",
"0.64430064",
"0.64329404",
"0.64242035"
] |
0.7004709
|
20
|
callseq: File.magic > string or array See also: Filemime and Filetype
|
def magic
self.class.magic(self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end",
"def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end",
"def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end",
"def by_magic(io); end",
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def mime(path)\n magic(path, Magic::MIME)\n end",
"def content_type\n self.file_content_type\n end",
"def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end",
"def ftype() File.ftype(path) end",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def ftype\n :file\n end",
"def source_file_type_permitted?(magic_bytes_file_info)\n PERMITTED_SOURCE_FILE_EXTENSIONS.include?(magic_bytes_file_info.ext)\n end",
"def type(path)\n magic(path, Magic::MIME_TYPE)\n end",
"def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end",
"def file_type\n case raw_file_type\n when 'f'\n :file\n when 'd'\n :directory\n when 'L'\n :symlink\n when 'D'\n :device\n when 'S'\n :special\n end\n end",
"def mime_from_file(filepath)\n # moved here, as mimemagic can cause installation issues\n require 'mimemagic'\n require 'mimemagic/version'\n require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')\n # check magic number inside file (empty string if not found)\n detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s\n # check extension only\n if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)\n Log.log.debug(\"no conversion for #{detected_mime}, trying extension\")\n detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s\n end\n detected_mime=nil if detected_mime.empty?\n Log.log.debug(\"mimemagic: #{detected_mime.class.name} [#{detected_mime}]\")\n return detected_mime\n end",
"def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def sample_file_ext(ext)\n if ext.is_a?(Array)\n ext[0]\n elsif ext\n ext\n else\n 'bin'\n end\n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def file_set_mime_type\n file_set.mime_type.first\n end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\n end",
"def mime_type\n metadata[\"mime_type\"]\n end",
"def check_magics(file)\r\n if file.respond_to? :read\r\n check_magics_type(file, @magics)\r\n else\r\n open(file) {|f| check_magics_type(f, @magics) }\r\n end\r\n end",
"def mime_type\n MIME_TYPES[@file_type]\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def detect_file_type(tempfile)\n tempfile.rewind\n MagicBytes.read_and_detect(tempfile).tap { tempfile.rewind }\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def test_abbrev_mime_type\n fm = FileMagic.mime\n assert_match(/\\Aapplication\\/vnd.ms-/, fm.file(path_to('excel-example.xls')))\n end",
"def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend",
"def extract_content_type(new_file)\n content_type = nil\n\n File.open(new_file.path) do |fd|\n data = fd.read(1024) || \"\"\n content_type = filemagic.buffer(data)\n end\n\n content_type\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def content_type\n file.try(:content_type)\n end",
"def mime_type\n @metadata[:mime_type]\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end",
"def file_type\n FILE_TYPES[@file_type]\n end",
"def read_magic(data)\n magic = ''\n (0 .. 2).each do |byte|\n magic << data.get_varint(byte * 8, 8).chr\n end\n\n if magic.bytesize != 3 || magic[0,2] != MAGIC\n fail InputStreamError, \"Invalid compress(1) header \" +\n \"(expected #{MAGIC.unpack('h*')}, got #{magic[0,2].unpack('h*')})\"\n end\n\n bits = magic.getbyte(2)\n @max_code_size = bits & MASK_BITS\n @block_mode = ( ( bits & MASK_BLOCK ) >> 7 ) == 1\n end",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def check_file_type\n `file #{@desktop_image}`.sub(/^.*: /,'').split.first.downcase\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def ext\n file.extension.downcase\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def file_mimetype\n @descriptive_detail.file_mimetype\n end",
"def all_by_magic(io); end",
"def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend",
"def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end",
"def file?\n type == :file\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def negotiate_mime(order); end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def mime\n @mime ||= MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end",
"def mime_exts\n config[:mime_exts]\n end",
"def file(filename)\n File.stat(filename)\n raise(TypeError, \"filename must not be nil\") if filename.nil?\n FFI::Libmagic.magic_file(_cookie, filename)\n end",
"def guessed_safe_content_type\n return unless path\n\n type = Marcel::Magic.by_path(original_filename).to_s\n type if type.start_with?('text/') || type.start_with?('application/json')\n end",
"def determine_file_type\n return \"pfile\" if image? and (@filename =~ /^P.....\\.7/) != nil\n return \"pfile\" if (@filename =~ /^P.....\\.7\\.summary/) != nil\n return \"geifile\" if image? and (@filename =~ /^I\\.\\d*/) != nil\n return \"scan_archive_h5_json\" if (@filename =~ /^ScanArchive_.{10,}.h5.json/) != nil\n return \"dicom\" if image? and (@filename =~ /^P.....\\.7/) == nil\n return nil\n end",
"def mime_type\n @attributes[:mime_type]\n end",
"def file_extension(extension = T.unsafe(nil)); end",
"def content_type\n @content_type || file.content_type\n end",
"def file_exts\n [].concat(viewed_exts).concat(edited_exts).concat(convert_exts).concat(fill_forms_exts)\n end",
"def ftype() File.ftype( expand_tilde ) end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def mimetype\n process_upload\n return @file.file.file.content_type\n end",
"def filetype?(mask)\n return true if mode & 0170000 == mask\n return false\n end",
"def software_mm_comp_file_types\n %w[b f g i]\n end",
"def mime_type\n Blob.mime_type(self.name)\n end",
"def mime_type(*args, **_arg1, &block); end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end",
"def get_file_extension(arr)\n\nend",
"def type t\n @files = @files.select { |file| File.exist?(file) && File.ftype(file) == t}\n self\n end",
"def dor_file_mimetype\n public_xml_doc.xpath('//contentMetadata/resource/*/@mimetype').map(&:text)\n end",
"def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end",
"def mime\n @mime ||= if meta?\n YAML_MIME\n else\n mime = MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end\n end",
"def document_type\n FileUtility.get_file_type(@file_name)\n end",
"def content_mime_type; end",
"def accept_file(file, name, kind)\n logger.debug \"FileHelper is accepting file: filename=#{file.filename}, name=#{name}, kind=#{kind}\"\n\n fm = FileMagic.new(FileMagic::MAGIC_MIME)\n mime = fm.file file.tempfile.path\n logger.debug \"#{name} has MIME type: #{mime}\"\n\n valid = true\n\n case kind\n when 'image'\n accept = [\"image/png\", \"image/gif\", \"image/bmp\", \"image/tiff\", \"image/jpeg\", \"image/x-ms-bmp\"]\n when 'code'\n accept = [\"text/x-pascal\", \"text/x-c\", \"text/x-c++\", \"text/plain\", \"text/\"]\n when 'document'\n accept = [ # -- one day\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n # --\"application/msword\",\n \"application/pdf\" ]\n valid = pdf_valid? file.tempfile.path\n else\n logger.error \"Unknown type '#{kind}' provided for '#{name}'\"\n return false\n end\n\n # result is true when...\n mime.start_with?(*accept) && valid\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def magic\n MAGIC + (\n (@max_code_size & MASK_BITS) |\n (@block_mode ? MASK_BLOCK : 0)\n ).chr\n end",
"def mod_type file\n\tcompression = %x{dd if=\"#{file}\" bs=4 count=1} \n\tif compression == \"#!/b\" \n\t\treturn \"cloop\"\n\telsif compression == \"hsqs\"\n\t\treturn \"squashfs\"\n\telse\n\t\treturn \"none\"\n\tend\nend",
"def ftype() end",
"def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end",
"def mime_type\n meta['mime_type'] || app.mime_type_for(ext)\n end",
"def get_file_extension(mime_type)\n '.' + MimeMagic.new(mime_type).extensions.first || ''\n end",
"def file_ext extension\n response_object.mime extension\n end"
] |
[
"0.8050705",
"0.79735523",
"0.7314728",
"0.6879629",
"0.6850248",
"0.6607502",
"0.6577473",
"0.6484097",
"0.6313551",
"0.6275934",
"0.62666005",
"0.6253369",
"0.6248617",
"0.62164223",
"0.62084174",
"0.61802435",
"0.6175531",
"0.61569625",
"0.6151903",
"0.6148018",
"0.61208785",
"0.6105953",
"0.6105953",
"0.6105953",
"0.6098787",
"0.6082182",
"0.6072554",
"0.6065073",
"0.60615826",
"0.60362095",
"0.60181797",
"0.6008528",
"0.6004585",
"0.5996389",
"0.5991433",
"0.59895796",
"0.5987914",
"0.5976752",
"0.5976142",
"0.5965386",
"0.5965386",
"0.5965386",
"0.5965386",
"0.5954625",
"0.5954625",
"0.5954625",
"0.5951097",
"0.5949848",
"0.5944896",
"0.59414154",
"0.5930616",
"0.59302247",
"0.59263104",
"0.59215456",
"0.5908359",
"0.58965313",
"0.58668673",
"0.5858114",
"0.58512306",
"0.5845765",
"0.5839753",
"0.5824506",
"0.5821609",
"0.58052963",
"0.5799421",
"0.57942104",
"0.5792851",
"0.5772791",
"0.57722545",
"0.5761227",
"0.57605875",
"0.5755376",
"0.57552475",
"0.57519627",
"0.57518655",
"0.5750835",
"0.5742712",
"0.5721597",
"0.5703933",
"0.5703662",
"0.5701029",
"0.5700217",
"0.56996566",
"0.5684693",
"0.5679646",
"0.5679152",
"0.5677353",
"0.56771487",
"0.56706184",
"0.5668132",
"0.56595504",
"0.5659269",
"0.565703",
"0.56535894",
"0.5649732",
"0.5646383",
"0.5646098",
"0.5642123",
"0.5639161",
"0.56369627",
"0.5636304"
] |
0.0
|
-1
|
callseq: File.mime > string or array See also: Filemagic and Filetype
|
def mime
self.class.mime(self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end",
"def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end",
"def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end",
"def mime_type\n MIME_TYPES[@file_type]\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime(path)\n magic(path, Magic::MIME)\n end",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def file_set_mime_type\n file_set.mime_type.first\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end",
"def mime_type\n metadata[\"mime_type\"]\n end",
"def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end",
"def content_type\n self.file_content_type\n end",
"def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end",
"def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def mime_type\n @metadata[:mime_type]\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def negotiate_mime(order); end",
"def content_type\n file.try(:content_type)\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def mime_type\n @attributes[:mime_type]\n end",
"def _extract_mime_type_with_mime_types(io)\n if filename = extract_filename(io)\n mime_type = MIME::Types.of(filename).first\n mime_type.to_s if mime_type\n end\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def type(path)\n magic(path, Magic::MIME_TYPE)\n end",
"def mime_type(*args, **_arg1, &block); end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type.empty? ? nil : type.first\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def content_mime_type; end",
"def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end",
"def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end",
"def mime_type=(_); end",
"def mime_exts\n config[:mime_exts]\n end",
"def mime_from_file(filepath)\n # moved here, as mimemagic can cause installation issues\n require 'mimemagic'\n require 'mimemagic/version'\n require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')\n # check magic number inside file (empty string if not found)\n detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s\n # check extension only\n if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)\n Log.log.debug(\"no conversion for #{detected_mime}, trying extension\")\n detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s\n end\n detected_mime=nil if detected_mime.empty?\n Log.log.debug(\"mimemagic: #{detected_mime.class.name} [#{detected_mime}]\")\n return detected_mime\n end",
"def ftype\n :file\n end",
"def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def mime_type\n return @mime_type\n end",
"def mime_type\n Rack::Mime.mime_type(extname)\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def mime_type\n Blob.mime_type(self.name)\n end",
"def mime_type\n @mime_type ||= Rack::Mime.mime_type(\".#{ext}\")\n end",
"def mimetype\n mtype = MIME::Types.of(@filename).first\n if (mtype)\n mimetype = MIME::Type.simplified(mtype)\n end\n mimetype\n end",
"def mime_type_of(f)\n MIME::Types.of(f).last || default_mime_type\n end",
"def _mime_type\n if defined? @_mime_type\n @_mime_type\n else\n guesses = ::MIME::Types.type_for(extname.to_s)\n\n # Prefer text mime types over binary\n @_mime_type = guesses.detect { |type| type.ascii? } || guesses.first\n end\n end",
"def get_mime_type(file)\n if !file.nil?\n extension = File.extname(file)\n return Rack::Mime::MIME_TYPES[extension] || 'text/plain'\n end\n \n return 'text/plain'\n end",
"def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end",
"def mime_type\n meta['mime_type'] || app.mime_type_for(ext)\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend",
"def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def mime\n @mime ||= MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end",
"def mime_type\n MIME_TYPE\n end",
"def mime_type\n _mime_type ? _mime_type.to_s : 'text/plain'\n end",
"def mime_types\n [].tap do |result|\n @parts.each do |part|\n result << part.content_type\n end\n end\n end",
"def mime_for_file(file)\n path = file.is_a?(File) ? file.path : file\n MIME::Types.type_for(path)[0] || 'application/octet-stream'\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mimetype(file)\n mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)\n if mime_type.size == 0\n mime_type = MIME::Types['text/plain'] \n end\n mime_type\n end",
"def mime_type\n @mime_type ||= message.mime_type\n end",
"def file_mimetype\n @descriptive_detail.file_mimetype\n end",
"def mime(path)\n MIME::Types.type_for(expand path).first\n end",
"def content_type\n @content_type || file.content_type\n end",
"def ext\n Rack::Mime::MIME_TYPES.invert[data_content_type]\n end",
"def mime(*flags, &block)\n open(:mime, *flags, &block)\n end",
"def mime_types\n {image: ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff'],\n pdf: ['application/pdf', 'application/x-pdf'],\n audio: ['audio/mpeg', 'audio/mp4', 'audio/x-aiff', 'audio/ogg', 'audio/vorbis', 'audio/vnd.wav'],\n video: ['video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv']}\n end",
"def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end",
"def mime_type\n @metadata[:mime_type] || Mime::Type.lookup_by_extension(s3obj.content_type || ::File.extname(filename)[1..-1])\n end",
"def additional_mime_types\n [\n MIME::Type.new( 'text/plain' ) { |t| t.extensions = %w[ rb rdoc rhtml md markdown ] },\n ]\n end",
"def mime_type file_name\n mime_types = MIME::Types.of(file_name)\n mime_type = mime_types.empty? ? \"application/octet-stream\" : mime_types.first.content_type\n end",
"def dor_file_mimetype\n public_xml_doc.xpath('//contentMetadata/resource/*/@mimetype').map(&:text)\n end",
"def mime_type(type)\n roda_class.mime_type(type)\n end",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def mime_type(mt=nil)\n @_mime_type = mt unless mt.nil?\n @_mime_type\n end",
"def get_mime_type_from_ext(extension)\n extension[0]=''\n types = [\n { :ext => \"txt\", :mime_type => \"text/plain\" },\n { :ext => \"ini\", :mime_type => \"text/plain\" },\n { :ext => \"sln\", :mime_type => \"text/plain\" },\n { :ext => \"cs\", :mime_type => \"text/plain\" },\n { :ext => \"js\", :mime_type => \"text/plain\" },\n { :ext => \"config\", :mime_type => \"text/plain\" },\n { :ext => \"vb\", :mime_type => \"text/plain\" },\n { :ext => :\"jpg\", :mime_type => \"image/jpeg\" },\n { :ext => \"jpeg\", :mime_type => \"image/jpeg\" },\n { :ext => \"bmp\", :mime_type => \"image/bmp\" },\n { :ext => \"csv\", :mime_type => \"text/csv\" },\n { :ext => \"doc\", :mime_type => \"application/msword\" },\n { :ext => \"docx\", :mime_type => \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" },\n { :ext => \"gif\", :mime_type => \"image/gif\" },\n { :ext => \"html\", :mime_type => \"text/html\" },\n { :ext => \"pdf\", :mime_type => \"application/pdf\" },\n { :ext => \"png\", :mime_type => \"image/png\" },\n { :ext => \"ppt\", :mime_type => \"application/vnd.ms-powerpoint\" },\n { :ext => \"pptx\", :mime_type => \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" },\n { :ext => \"xls\", :mime_type => \"application/vnd.ms-excel\" },\n { :ext => \"xlsx\", :mime_type => \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" },\n { :ext => \"xml\", :mime_type => \"application/xml\" },\n { :ext => \"zip\", :mime_type => \"application/x-zip-compressed\" },\n { :ext => \"wav\", :mime_type => \"audio/wav\" },\n { :ext => \"eml\", :mime_type => \"message/rfc822\" },\n { :ext => \"mp3\", :mime_type => \"audio/mpeg\" },\n { :ext => \"mp4\", :mime_type => \"video/mp4\" },\n { :ext => \"mov\", :mime_type => \"video/quicktime\" }\n ]\n mime = types.find {|x| x[:ext] == extension}\n\n unless mime.nil? || mime.empty?\n \"application/octet-stream\"\n end\n mime[:mime_type]\n end",
"def test_abbrev_mime_type\n fm = FileMagic.mime\n assert_match(/\\Aapplication\\/vnd.ms-/, fm.file(path_to('excel-example.xls')))\n end",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def extract_mime_type(path)\n mime = MimeMagic.by_magic(File.open(path))\n mime ? mime.type : 'text/plain'\n end",
"def content_type\n @mime_type\n end",
"def mime_subtype\n mime_type.split(/\\//)[1]\n end",
"def get_content_type file\n mime_type = MIME::Types.type_for(file.original_filename)\n return mime_type.first ? mime_type.first : nil\n end",
"def mimetype\n return @mimetype if defined? @mimetype\n\n type = metadata['Content-Type'].is_a?(Array) ? metadata['Content-Type'].first : metadata['Content-Type']\n\n @mimetype = MIME::Types[type].first\n end",
"def mime_type\n if source.present?\n source.mime_type\n end\n end",
"def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end",
"def ftype() File.ftype(path) end",
"def mime\n @mime ||= if meta?\n YAML_MIME\n else\n mime = MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end\n end",
"def mime_type\n return content_type\nend",
"def get_file_extension(mime_type)\n '.' + MimeMagic.new(mime_type).extensions.first || ''\n end",
"def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def test_mime_types\n assert_kind_of(DataTypes::SimpleText, @test_records[0])\n assert_kind_of(DataTypes::SimpleText, @test_records[1])\n assert_equal(\"text/plain\", @test_records[0].mime_type)\n assert_equal(\"text/plain\", @test_records[1].mime_type)\n end"
] |
[
"0.7563617",
"0.74829465",
"0.74785864",
"0.74753207",
"0.73759013",
"0.73037463",
"0.73037463",
"0.73037463",
"0.72820413",
"0.72820413",
"0.72820413",
"0.72820413",
"0.7242281",
"0.7200188",
"0.7178128",
"0.71707565",
"0.7161022",
"0.71564525",
"0.71232355",
"0.7103876",
"0.7055174",
"0.7047856",
"0.70360065",
"0.7034331",
"0.7031597",
"0.70295125",
"0.7015055",
"0.7013312",
"0.70024216",
"0.6986122",
"0.6983838",
"0.69810754",
"0.69694465",
"0.6964791",
"0.6956661",
"0.6932974",
"0.6921426",
"0.6911168",
"0.69094956",
"0.69090843",
"0.6907411",
"0.6882046",
"0.6876596",
"0.68714976",
"0.6862693",
"0.68473816",
"0.6830928",
"0.68287563",
"0.6818281",
"0.68100065",
"0.6799815",
"0.67936903",
"0.679303",
"0.67877674",
"0.6786196",
"0.67727256",
"0.67623705",
"0.67479926",
"0.67436516",
"0.6741639",
"0.67333025",
"0.67294014",
"0.6719985",
"0.67144656",
"0.6706689",
"0.67001945",
"0.67001945",
"0.67001945",
"0.669736",
"0.6695632",
"0.66910625",
"0.6680671",
"0.6671064",
"0.6660262",
"0.66483563",
"0.6645258",
"0.6638753",
"0.6631309",
"0.6626126",
"0.6624736",
"0.6616146",
"0.66117245",
"0.6610309",
"0.660968",
"0.6604798",
"0.66009367",
"0.65977484",
"0.65942454",
"0.658748",
"0.65669256",
"0.65619236",
"0.6556003",
"0.65435034",
"0.6540389",
"0.65401846",
"0.65288967",
"0.65287983",
"0.652672",
"0.6512915",
"0.65019816",
"0.64995193"
] |
0.0
|
-1
|
callseq: File.type > string or array See also: Filemagic and Filemime
|
def type
self.class.type(self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ftype\n :file\n end",
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def type t\n @files = @files.select { |file| File.exist?(file) && File.ftype(file) == t}\n self\n end",
"def content_types_provided\n [ [ FILE_EXTENSION_CONTENT_TYPES[file_extension], :file_contents ] ]\n end",
"def content_type\n self.file_content_type\n end",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def file?\n type == :file\n end",
"def ftype() File.ftype(path) end",
"def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\n end",
"def file_type\n case raw_file_type\n when 'f'\n :file\n when 'd'\n :directory\n when 'L'\n :symlink\n when 'D'\n :device\n when 'S'\n :special\n end\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def file_name_type(item = nil)\n fd = get_file_data(item)\n file = file_upload_data(fd)\n file = file&.dig(:metadata, :filename) and return [file, :uploader]\n file = pending_file_name(fd) and return [file, :name]\n file = pending_file_url(fd) and return [file, :url]\n ['ENCODED', :data] if encoded_file_data(fd) # TODO: don't handle this yet\n end",
"def file_type\n FILE_TYPES[@file_type]\n end",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def file_set_mime_type\n file_set.mime_type.first\n end",
"def mime_type\n MIME_TYPES[@file_type]\n end",
"def file_type(file_path)\n return 'file' if File.file? file_path\n return 'directory' if File.directory? file_path\n return 'unknown'\n end",
"def content_type\n file.try(:content_type)\n end",
"def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end",
"def fileType path\n\t\tif File.ftype(path) == 'file'\n\t\t\ttrue\n\t\telse\n\t\t\tputs \"The given path isn't file.\"\n\t\t\texit\n\t\tend\n\tend",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end",
"def mime_type(*args, **_arg1, &block); end",
"def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end",
"def ftype() end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def check_file_type\n `file #{@desktop_image}`.sub(/^.*: /,'').split.first.downcase\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def mime_type=(_); end",
"def document_type\n FileUtility.get_file_type(@file_name)\n end",
"def file_type(property: 'file')\n params.dig property, :type\n end",
"def content_type\n @content_type || file.content_type\n end",
"def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end",
"def file_type\n attachments.order(position: 'asc').first.file_type\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 'application/pdf'\n end",
"def filetype\n if options.filetype.to_sym == :dot then :none else options.filetype.to_sym end\n end",
"def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end",
"def file_field; end",
"def file_type\n if is_ography?\n :ography\n else\n :tei_content\n end\n end",
"def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend",
"def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend",
"def file_mimetype\n @descriptive_detail.file_mimetype\n end",
"def is_file?\n !file_type.empty?\n end",
"def mime_type(file)\n type = nil\n\n if (file =~ /\\.(.+?)$/)\n type = ExtensionMimeTypes[$1.downcase]\n end\n\n type || \"text/plain\"\n end",
"def file_type(file_name)\n return file_name[file_name.rindex(\".\") + 1, file_name.size]\n end",
"def file_fields\n self.fields.select { |field| field.type == :file }\n end",
"def type(path)\n magic(path, Magic::MIME_TYPE)\n end",
"def ftype() File.ftype( expand_tilde ) end",
"def determine_file_type\n return \"pfile\" if image? and (@filename =~ /^P.....\\.7/) != nil\n return \"pfile\" if (@filename =~ /^P.....\\.7\\.summary/) != nil\n return \"geifile\" if image? and (@filename =~ /^I\\.\\d*/) != nil\n return \"scan_archive_h5_json\" if (@filename =~ /^ScanArchive_.{10,}.h5.json/) != nil\n return \"dicom\" if image? and (@filename =~ /^P.....\\.7/) == nil\n return nil\n end",
"def mime_type\n metadata[\"mime_type\"]\n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def valid_file_type filename\n # avoid hacks that break out of single quotes echoed to shell\n filename.gsub!(\"'\", '')\n `file '#{filename}'`.split(':').last.downcase =~ Regexp.union(*valid_file_types)\n end",
"def mime_types\n @mime_types ||=\n request_files.transform_values do |file|\n file.hasMimeType || 'application/octet-stream'\n end\n end",
"def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end",
"def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def ftype(path)\n path = expand_path(path)\n begin\n str = self.stat('-c', '%F', path).strip\n case str\n when /no such file or directory/i\n raise Errno::ENOENT, \"#{self}:#{path} does not exist\"\n when 'regular file'\n 'file'\n when 'regular empty file'\n 'file'\n when 'directory'\n 'directory'\n when 'character special file'\n 'characterSpecial'\n when 'block special file'\n 'blockSpecial'\n when /link/\n 'link'\n when /socket/\n 'socket'\n when /fifo|pipe/\n 'fifo'\n else\n raise RuntimeError, \"unknown filetype #{str}\"\n end\n rescue\n raise RuntimeError, \"stat #{self}:#{path} failed - #{str}\"\n end\n end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type.empty? ? nil : type.first\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def file_extension(extension = T.unsafe(nil)); end",
"def file_desc\n \"Files (#{file_ext(',')})\"\n end",
"def get_file_extension(arr)\n\nend",
"def sample_file_ext(ext)\n if ext.is_a?(Array)\n ext[0]\n elsif ext\n ext\n else\n 'bin'\n end\n end",
"def mimetype\n process_upload\n return @file.file.file.content_type\n end",
"def detect_file_type(tempfile)\n tempfile.rewind\n MagicBytes.read_and_detect(tempfile).tap { tempfile.rewind }\n end",
"def file_type(file_name)\n File.exname( file_name ).gsub( /^\\./, '').downcase\n end",
"def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end",
"def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end",
"def get_file_type\n\n @image.uploads.each do |upload|\n filename_arr = upload.content_type.to_s.split('/')\n @image.file_type = filename_arr[1].upcase\n end\n\n end",
"def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end",
"def file?() end",
"def _extract_mime_type_with_mime_types(io)\n if filename = extract_filename(io)\n mime_type = MIME::Types.of(filename).first\n mime_type.to_s if mime_type\n end\n end",
"def mime_type\n Blob.mime_type(self.name)\n end",
"def file_field(method, options = T.unsafe(nil)); end",
"def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end",
"def file_exts\n [].concat(viewed_exts).concat(edited_exts).concat(convert_exts).concat(fill_forms_exts)\n end"
] |
[
"0.7380949",
"0.721798",
"0.7198722",
"0.7054854",
"0.70208824",
"0.70204157",
"0.7010009",
"0.7002336",
"0.7000757",
"0.70005023",
"0.696111",
"0.69410896",
"0.6927309",
"0.6914402",
"0.6897258",
"0.6879546",
"0.6879546",
"0.6879546",
"0.68399996",
"0.67951524",
"0.6784325",
"0.674223",
"0.6670591",
"0.6665733",
"0.66653275",
"0.66546714",
"0.6630986",
"0.6623242",
"0.6616988",
"0.6615916",
"0.6609833",
"0.6609833",
"0.6609833",
"0.6609833",
"0.65999657",
"0.65973425",
"0.6580717",
"0.6575476",
"0.65314096",
"0.65270054",
"0.6493494",
"0.6479803",
"0.6479803",
"0.6479803",
"0.6478487",
"0.64755094",
"0.64755094",
"0.64755094",
"0.64755094",
"0.64755094",
"0.64755094",
"0.6464229",
"0.6444418",
"0.6441197",
"0.64322746",
"0.64266104",
"0.6405103",
"0.6394485",
"0.63854355",
"0.6382793",
"0.6335508",
"0.63291204",
"0.6317191",
"0.63095623",
"0.63082767",
"0.6303775",
"0.6293949",
"0.62906367",
"0.6288835",
"0.6287637",
"0.62869096",
"0.6257989",
"0.6256825",
"0.6252692",
"0.6249979",
"0.62470466",
"0.62405485",
"0.6237472",
"0.6223215",
"0.6213709",
"0.6210989",
"0.6208615",
"0.6204738",
"0.6198115",
"0.618987",
"0.6186651",
"0.61790246",
"0.61762905",
"0.6171389",
"0.6171357",
"0.6169771",
"0.6168499",
"0.6161772",
"0.6161331",
"0.6157583",
"0.61504865",
"0.614665",
"0.6141924",
"0.6138195",
"0.61331326",
"0.6122795"
] |
0.0
|
-1
|
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
|
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n 'uploads'\n end",
"def store_dir\n \"uploads\"\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}_#{mounted_as.to_s.pluralize}\"\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\n \"#{Rails.root}/public/uploads/\"\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end",
"def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}\"\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end"
] |
[
"0.7866728",
"0.7627961",
"0.7622453",
"0.7617947",
"0.75755876",
"0.7489533",
"0.7486212",
"0.745419",
"0.745419",
"0.745419",
"0.7400106",
"0.7400106",
"0.7400106",
"0.7400106",
"0.7400106",
"0.7384553",
"0.73647314",
"0.73579544",
"0.7357193",
"0.7348791",
"0.73412323",
"0.73392576",
"0.7337771",
"0.7337771",
"0.73354405",
"0.7331368",
"0.7314064",
"0.73034793",
"0.7285861",
"0.7285861",
"0.7284493",
"0.72770333",
"0.72769254"
] |
0.0
|
-1
|
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
|
def extension_whitelist
%w[jpg jpeg png]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png pdf)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_allowlist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n Spotlight::Engine.config.allowed_upload_extensions\n end",
"def extensions_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg JPG jpeg JPEG gif GIF png PNG)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png JPG JPEG GIF PNG)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\r\n %w(jpg jpeg png)\r\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_whitelist\n %w[txt csv xls xlsx doc docx gif jpg jpeg png bmp svg pdf ppt pptx]\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end"
] |
[
"0.815735",
"0.81485915",
"0.81485915",
"0.81485915",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.81240284",
"0.8091994",
"0.8091994",
"0.8091994",
"0.8089476",
"0.7996949",
"0.79354835",
"0.79354835",
"0.7915553",
"0.78382766",
"0.7815379",
"0.7743408",
"0.771986",
"0.76947504",
"0.7685283",
"0.7685283",
"0.76821804",
"0.76784134",
"0.76660407",
"0.76660407",
"0.7656301",
"0.7656301",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.7649628",
"0.76328605",
"0.7630705",
"0.7630705",
"0.7630705",
"0.7630124",
"0.7626016",
"0.7626016",
"0.7626016",
"0.7614476"
] |
0.81230646
|
17
|
Sum of two points
|
def bbpAdd(first_point, second_point)
cxp(first_point.x + second_point.x, first_point.y + second_point.y)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum_values\n points.sum\n end",
"def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end",
"def sum(x,y)\r\n\t x + y\r\n\tend",
"def sum(x, y)\n\nend",
"def getSum ( x , y )\n\tsum = x + y\n\treturn sum\nend",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def sum\n [@r,@g,@b].inject(:+)\n end",
"def get_sum(a, b)\n [a,b].reduce(&:+)\nend",
"def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end",
"def calc_distance(point1, point2, summ = 0)\n point1.each.with_index do |a, index|\n summ += (a - point2[index])**2\n end\n Math.sqrt(summ)\n end",
"def sum(x,y)\n return x + y\nend",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end",
"def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end",
"def sum_ints(x,y)\n\tx + y\nend",
"def +(other)\n raise TypeError, \"Addition between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x + other.x, self.y + other.y)\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def distance(point2)\n end",
"def sum num1, num2\n\ttotal = num1 + num2\n\treturn total\nend",
"def sum(number, other)\n number + other\n end",
"def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def pega_soma(v1,v2)\r\n v1 + v2\r\nend",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def points\n @results.inject(0.0) { |t, r| t += r.points }\n end",
"def plus(iva,ivb)\n return sum([iva,ivb]) \n end",
"def sum_two(x, y)\n x + y\nend",
"def sum; end",
"def + (point)\n self.class.new(x + point.x, y + point.y)\n end",
"def sum(a, b)\n\n\tsum = a + b #=> zwroci nam sume zmiennych a i b\n\nend",
"def sum a, b\n return a + b\nend",
"def sum a, b\n a + b\nend",
"def addittion(x, y)\n return (x + y)\nend",
"def + (other); \n if(self && other)\n i = self.i + other.i\n j = self.j + other.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n end\n end",
"def sum\n self.inject(:+)\n end",
"def add_2(x, y)\n x + y\n end",
"def suma(dato1,dato2)\n return dato1 + dato2\nend",
"def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end",
"def sum_these_numbers(x,y)\n sum = x + y\n puts sum\nend",
"def sum_square(x, y)\n\tx**2 + y**2\nend",
"def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend",
"def total_points\n if self.has_paid?\n sum = 0\n self.bets.each { |b| sum+=b.points }\n self.answers.each { |a| sum+=a.points }\n sum\n else\n -1\n end\n end",
"def add(y)\n @x + y\n end",
"def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end",
"def sum(addends)\n addends.inject(0, :+)\n end",
"def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end",
"def sum_of(a,b)\n\treturn a + b\nend",
"def sum_double(x, y)\n x == y ? (x+y)*2 : x+y\nend",
"def add_positions(pos1, pos2)\n\t[pos1[0] + pos2[0], pos1[1] + pos2[1]]\nend",
"def +(y)\n @x + y\n end",
"def add_positions(pos1, pos2)\r\n\t[pos1[0] + pos2[0], pos1[1] + pos2[1]]\r\nend",
"def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend",
"def sum\n\t\treturn self.reduce(:+)\n\tend",
"def x_add_y\n x = @x.content\n y = @y.content\n z = Array.new @x.length, 0\n\n carry = 0\n\n # claulate x + y = z\n @x.length.times do |i|\n tmp = x[i] + y[i] + carry\n z[i] = tmp % 2\n carry = tmp / 2\n end\n\n @z.content = z\n end",
"def sum(n1, n2)\n n1 + n2\nend",
"def +(other)\n unless other.is_a?(Transformation)\n raise(Error::Transformation::Sum,\n \"Incompatible summand types (each must be a Transformation)\")\n end\n if self.to != other.from\n raise(Error::Transformation::Sum,\n \"Incompatible summand types (units don't match)\")\n end\n Transformation.new(from, other.to, @ops + other.ops)\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def sum\n reduce(0, &:+)\n end",
"def sum x,y \n puts x+y \nend",
"def sumOfXBelowY(x, y)\n y = y - 1\n tmp = y.div(x)\n return x*(tmp*tmp+tmp)/2\nend",
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def sum(x, y)\n puts x + y\nend",
"def +(other)\n case other\n when Point\n Point.new(x + other.x, y + other.y)\n when Numeric\n Point.new(x + other, y + other)\n when Array\n self + Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def get_sum(a,b)\n a, b = [a, b].minmax\n [*a..b].inject(:+)\nend",
"def +(point)\n\t\t\t\tx = nil\n\t\t\t\ty = nil\n\t\t\t\t\n\t\t\t\tif !@x.nil? || !point.x.nil?\n\t\t\t\t\tx = @x.to_i + point.x.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif !@y.nil? || !point.y.nil?\n\t\t\t\t\ty = @y.to_i + point.y.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tself.class.new(x, y)\n\t\t\tend",
"def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end",
"def sum (a, b)\n a + b\nend",
"def xxx(x, y)\n sum = 0\n\n x.each_index do |i|\n sum += (x[i] * y[i])\n end\n\n sum\nend",
"def +(p)\n Pair.new(@x + p.x, @y + p.y)\n end",
"def +(other)\n Vector.new(@x + other.x, @y + other.y)\n end",
"def add_to_point(other)\n check_group! other\n\n # Assertions:\n # raise \"point given (#{point.inspect}) does not belong to #{group.name}\" if !group.include?(point)\n # raise \"point (#{inspect}) does not belong to #{group.name}\" if !group.include?(self)\n\n # Rules 1 and 2\n return other if infinity?\n return self if other.infinity?\n\n # Rule 3\n return group.infinity if x == other.x && y == field.mod(-other.y)\n\n # Rule 4\n if x != other.x\n gamma = field.mod((other.y - y) * field.inverse(other.x - x))\n sum_x = field.mod(gamma * gamma - x - other.x)\n sum_y = field.mod(gamma * (x - sum_x) - y)\n return self.class.new(group, sum_x, sum_y)\n end\n\n # Rule 5\n return double if self == other\n\n raise \"Failed to add #{inspect} to #{other.inspect}: No addition rules matched.\"\n end",
"def point_sum(point_kind)\n mark = Mark.find_by_user_id_and_point_kind_id(self.id, point_kind.id)\n mark == nil ? 0 : mark.point_sum\n end",
"def addition( vector2 )\n i = @i + vector2.i\n j = @j + vector2.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n \n return vectorAdd \n end",
"def sum_pair(ints, sum)\nend",
"def points_to_add_between(p0, p1, min_res)\n dist = distance(p0, p1)\n [((dist / min_res).floor - 1).to_i, 0].max\n end",
"def get_total_points\n @event_points + @performance_points + @enhance_points\n end",
"def points\n votes.sum(:value)\n end",
"def points\n votes.sum(:value)\n end",
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def absolute_sum(num_one, num_two)\r\n # your code goes here\r\n\r\n num_one.abs + num_two.abs\r\nend",
"def soma_numeros (x, y)\r\n x + y\r\nend",
"def sum\n turn[0] + turn[1]\n end",
"def add point\n self.x += point.x\n self.y += point.y\n self\n end",
"def add_2(x, y)\nend",
"def add!(p)\n@x += p.x\n@y += p.y\nself\nend",
"def add(other)\n @x = @x + other.x\n @y = @y + other.y\n @z = @z + other.z\n self\n end",
"def simple_points(frames)\n all_rolls(frames).sum\n end",
"def summator(x, y)\n p x + y\nend",
"def +(other)\n self.class.new(self.x + other.x, self.y + other.y, self.z.to_i + other.z.to_i)\n end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def array_addition_calc(array1, array2)\n array1.zip(array2).map &:sum \nend",
"def sum_region(row1, col1, row2, col2)\n @sums[row2 + 1][col2 + 1] - @sums[row1][col2 + 1] - @sums[row2 + 1][col1] + @sums[row1][col1]\n end",
"def add!(other)\n @x += other.x\n @y += other.y\n @angle = rad2deg(Math.atan2(@y, @x))\n @length = Math.sqrt(@x * @x + @y * @y)\n end",
"def dot(other)\n raise TypeError, \"Scalar (dot) product between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n x * other.x + y * other.y\n end",
"def sum_double(a, b)\n\t\tif (a != b)\n\t\t\ta+b\n\t\telse\n\t\t\t2 * (a + b)\n\t\tend\n\tend",
"def sum(a, b)\n return a + b\nend",
"def sum(a, b)\n return a + b\nend",
"def plus(x, y)\n\nend",
"def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end",
"def +(other)\n combine_with(other) do |_variant, a, b|\n (a || 0) + (b || 0)\n end\n end"
] |
[
"0.70840424",
"0.7049677",
"0.70164245",
"0.69328505",
"0.6901057",
"0.6747664",
"0.668223",
"0.6625355",
"0.658151",
"0.657161",
"0.6542451",
"0.65013677",
"0.6471253",
"0.6466453",
"0.6465137",
"0.63754845",
"0.6365447",
"0.6365235",
"0.63542783",
"0.63294595",
"0.632331",
"0.6305859",
"0.62901926",
"0.6268217",
"0.62592393",
"0.6257408",
"0.62529445",
"0.62440854",
"0.62294644",
"0.6213422",
"0.6197964",
"0.61901766",
"0.61759603",
"0.6165108",
"0.6149772",
"0.6135718",
"0.61303604",
"0.6129432",
"0.60917646",
"0.609113",
"0.6086497",
"0.6080829",
"0.6065968",
"0.6063038",
"0.6059265",
"0.6048924",
"0.6033281",
"0.601608",
"0.600436",
"0.5997873",
"0.5983995",
"0.5981759",
"0.5971539",
"0.5970779",
"0.59692574",
"0.5963567",
"0.59608597",
"0.5948709",
"0.5946293",
"0.5945967",
"0.59449524",
"0.59104073",
"0.59057856",
"0.59028465",
"0.58976525",
"0.58968145",
"0.5894892",
"0.5893514",
"0.5884428",
"0.58829916",
"0.58795214",
"0.5876426",
"0.58761775",
"0.58676094",
"0.5867143",
"0.58645236",
"0.5863807",
"0.5863807",
"0.585725",
"0.58552635",
"0.5843689",
"0.58406365",
"0.583881",
"0.58360076",
"0.5835115",
"0.58282524",
"0.58275366",
"0.5825543",
"0.5816651",
"0.581144",
"0.58107716",
"0.58082926",
"0.58019",
"0.5796381",
"0.57963085",
"0.5796307",
"0.5796307",
"0.57916534",
"0.5780612",
"0.5776782"
] |
0.6542036
|
11
|
Difference of two points
|
def bbSub(first_point, second_point)
bbp(first_point.x - second_point.x, first_point.y - second_point.y)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def diff((x1, y1), (x2, y2))\n [x1 - x2, y1 - y2]\nend",
"def getDiff ( x , y )\n\tdiff = x - y\n\treturn diff\nend",
"def -(other)\n raise TypeError, \"Subtract between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x - other.x, self.y - other.y)\n end",
"def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end",
"def differences_between_arrays(first_points, second_points)\n YquotesSignalTools.truncate_to_shortest!(first_points, second_points)\n differences = []\n first_points.each_with_index { |fp, index| differences << fp - second_points[index] }\n differences\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def -(other)\n Vector.new(@x - other.x, @y - other.y)\n end",
"def -(p)\n Pair.new(@x - p.x, @y - p.y)\n end",
"def subtract(x,y)\r\n x - y \r\nend",
"def difference\n end",
"def distance(point2)\n end",
"def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end",
"def -(other)\n case other\n when Point\n Point.new(x - other.x, y - other.y)\n when Numeric\n Point.new(x - other, y - other)\n when Array\n self - Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def squared_difference(x,y)\n 0.0 + (x-y)**2\n end",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def -(other)\n Coord.new(@x - other.x, @y - other.y)\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def -(p)\n Point.new(@x - p.x, @y - p.y)\n end",
"def - other\n [ self[0] - other[0], self[1] - other[1] ]\n end",
"def diff_x\n self.x - @last_x\n end",
"def Point2dDotDifference(arg0, arg1, arg2)\n ret = _invoke(1610743819, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def diff(other)\n Distance.diff_total(self, other, true)\n end",
"def distance_between(point1, point2)\n (point1 - point2).mag\n end",
"def delta\n @end_point - @start_point\n rescue\n 0\n end",
"def Point2dSubtract(arg0, arg1)\n ret = _invoke(1610743817, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def subt(x, y)\n x - y\nend",
"def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end",
"def subtract(t1,t2) ##revisar name\n\t\treturn (t1-t2).to_i\n\tend",
"def distance(p1,p2)\ndelta_x = p1[0] - p2[0]\ndelta_y = p1[1] - p2[1]\n\nMath.sqrt(delta_x ** 2 + delta_y **2)\n\nend",
"def subtract a, b\n\ta - b\nend",
"def subtract(a, b)\n difference = a - b\n return difference\nend",
"def angle_diff(angle1, angle2)\n end",
"def subtract_point \n\t\t@lives -= 1\n\tend",
"def subtract_them(a, b)\n return a - b\n end",
"def - other\n other.is_a?(Vips::Image) ?\n subtract(other) : linear(1, Image.smap(other) { |x| x * -1 })\n end",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def - (other); \n if(self && other)\n i = other.i - self.i \n j = other.j - self.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n end\n end",
"def difference(other)\n self.class.from_a(to_a - other.to_a)\n end",
"def subtract(n1, n2)\n difference = n1 - n2\n return difference\nend",
"def difference(other)\n self.class.from_a(to_a - other.to_a)\n end",
"def -(other_vector)\n Vector.new @x - other_vector.x, @y - other_vector.y\n end",
"def subtract(a, b)\n\treturn a - b\nend",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def difference(number1, number2)\n return number1 - number2\nend",
"def array_diff(a, b)\n a - b\nend",
"def array_diff(a, b)\n a - b\nend",
"def Point3dDotDifference(arg0, arg1, arg2)\n ret = _invoke(1610743843, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def gradient(point1,point2)\n ((point1[1] - point2[1]).to_f/(point1[0] - point2[0]))\nend",
"def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end",
"def distance(a, b)\n Math.sqrt(((a.x - b.x) ** 2) + ((a.y - b.y) ** 2).abs)\n end",
"def delta(v1, v2)\n if block_given?\n v1 = yield(v1)\n v2 = yield(v2)\n end\n return (v1 - v2).abs\n end",
"def coeficiente(p1,p2)\n return p2.abs.subPoint(p1.abs)\n end",
"def diff_y\n self.y - @last_y\n end",
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend",
"def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end",
"def euclid point1, point2\n\treturn Math.sqrt((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2)\nend",
"def absolute_distance(point_1, point_2)\n Math.sqrt((point_1.first - point_2.first) ** 2 + (point_1.last - point_2.last) ** 2)\n end",
"def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end",
"def setpoint_diff\n\t\treturn self[\"setpoint_diff\"]\n\tend",
"def sub(rhs)\n Vector2.new(@x - rhs.x, @y - rhs.y)\n end",
"def difference(a, b)\n intersection(a, negate(b))\n end",
"def -(rhs)\n Vektor[*zip(rhs).map {|x,y| x-y}]\n end",
"def difference(dt1,dt2)\n f = (dt1-dt2)\n (f*f.denominator).abs\nend",
"def point_differential\r\n self.home_score-self.away_score\r\n end",
"def distance(x1,y1,x2,y2)\n return ((x2 - x1)**2 + (y2 - y1)**2)**0.5\nend",
"def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend",
"def -(a)\n diff = Vector.new\n self.each_index{|k| diff[k] = self[k]-a[k]}\n diff\n end",
"def difference(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#difference not defined.\"\n end",
"def to_point\n CGPoint.new(first, second)\n end",
"def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end",
"def diff2; end",
"def a\n @a ||= self.p1.y - self.p2.y\n end",
"def difference\n square_of_sum - sum_of_squares\n end",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def diff\n @start_position - @position\n end",
"def calculate_center_difference\n calculate_distance(@last_center.features, @center.features)\n end",
"def diff(x=v1.length - 1, y=v2.length - 1)\n return [] if x < 0 && y < 0\n return diff(x-1, y) << Display.deleted(v1[x]) if y < 0\n return diff(x, y-1) << Display.added(v2[y]) if x < 0\n if v1[x] == v2[y]\n diff(x-1, y-1) << v1[x]\n elsif lcs[[x-1, y]] >= lcs[[x, y-1]]\n diff(x-1, y) << Display.deleted(v1[x])\n else\n diff(x, y-1) << Display.added(v2[y]) \n end\n end",
"def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end",
"def difference\n return square_of_sums - sum_of_squares\n end",
"def diff_x\n @spr_battler.x - x\n end",
"def diff_x\n @spr_battler.x - x\n end",
"def distance_to(other)\n point.distance_to(other)\n end",
"def mod_sub (a, b)\n self.mod_add a, Ecc::Point.new(b.x, -b.y)\n end",
"def distance(a,b)\n\t(a-b).abs\nend",
"def distance(x1, y1, x2, y2)\n Math.sqrt((y2 - y1)**2 + (x2 - x1)**2)\n end",
"def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end",
"def shifted_diff(first, second)\n return -1\nend",
"def length\n points_distance(@x1, @y1, @x2, @y2)\n end",
"def subtract (number1, number2)\n number1 - number2\n end",
"def test_distance_to_point2\n point1 = Point.new(0, 0)\n point2 = Point.new(3, 4)\n assert_equal 5, point1.distance_to(point2)\n end",
"def -(vector2)\n end",
"def subtract (a,b)\n return a-b\nend",
"def difference(other)\n new(to_ary - other)\n end",
"def difference\n square_of_sums - sum_of_squares\n end",
"def difference\n square_of_sums - sum_of_squares\n end",
"def subtract(other)\n clone.subtract! other\n end"
] |
[
"0.7477098",
"0.7296633",
"0.71629554",
"0.7102015",
"0.69926345",
"0.6833792",
"0.67878914",
"0.6768763",
"0.6748308",
"0.6662865",
"0.6645195",
"0.66310036",
"0.6612947",
"0.6609563",
"0.65847516",
"0.6561378",
"0.6554383",
"0.65494126",
"0.6448317",
"0.643624",
"0.6423279",
"0.64227766",
"0.6353776",
"0.6335032",
"0.63174975",
"0.62764466",
"0.6275981",
"0.62618697",
"0.6261058",
"0.62599427",
"0.6249987",
"0.6244539",
"0.6242349",
"0.6235071",
"0.6230296",
"0.6208266",
"0.61893123",
"0.6188711",
"0.61713564",
"0.6168999",
"0.61421806",
"0.61383426",
"0.61346704",
"0.61338556",
"0.612174",
"0.612174",
"0.61092883",
"0.61072695",
"0.6105025",
"0.61045235",
"0.6100563",
"0.60987955",
"0.6098653",
"0.6098135",
"0.6092971",
"0.6085857",
"0.60768163",
"0.6074667",
"0.60734105",
"0.60707325",
"0.60699356",
"0.6067132",
"0.6040393",
"0.6038238",
"0.6016316",
"0.60107535",
"0.5992983",
"0.5983978",
"0.59621966",
"0.5954854",
"0.59336334",
"0.59306294",
"0.59117985",
"0.59087956",
"0.59053314",
"0.58894515",
"0.58894515",
"0.58894515",
"0.58894515",
"0.5882361",
"0.58771163",
"0.5859429",
"0.58469194",
"0.58368224",
"0.583665",
"0.583665",
"0.58363545",
"0.5829841",
"0.5825416",
"0.5823792",
"0.5823512",
"0.5822817",
"0.58198977",
"0.58089113",
"0.5808829",
"0.5808498",
"0.58037704",
"0.58017516",
"0.58014107",
"0.58014107",
"0.57930386"
] |
0.0
|
-1
|
Point multiplied by factor
|
def bbpMult(first_point, factor)
bbp(first_point.x * factor, first_point.y * factor)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scale(factor)\n Point.new(self.x * factor, self.y * factor)\n end",
"def scale(factor)\n x = x2 - x1\n y = y2 - y1\n Line.new(p1, Point.new(x1 + (x * factor), y1 + (y * factor)))\n end",
"def *(coef)\n Point.new(@x * coef, @y * coef)\n end",
"def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end",
"def scale factor\n Vector.new factor * @x, factor * @y, factor * @z\n end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def pt___x(n, y); ptdist(n, 1.0 - y); end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def *(scalar)\n raise TypeError, \"Multiplication between Point and #{ scalar.class } is not defined\" unless scalar.is_a?(Numeric)\n Point.new(x * scalar, y * scalar)\n end",
"def scale(f)\n @x *= f\n @y *= f\n self\n end",
"def factor\n @factor ||= reference_factor * reference_units.inject(Rational(1,1)){|f, (ru, exp)| f * (ru.factor**exp)}\n end",
"def pt__X_(n, y); ptdist(n, 0.5 + y); end",
"def scale_factor(point, view)\n\n px_to_length(view)/view.pixels_to_model(1, point)\n\n end",
"def scaled_point\n val = self.class.base.new(@value * self.class.size)\n val.kind_of?(ScaledPoint) ? val : val.scaled_point\n end",
"def pow base, p\n base ** p\n end",
"def draw_point(x, y, mul, col)\n Line.new(\n x1: CENTER_X + x * mul, y1: CENTER_Y - y * mul,\n x2: CENTER_X + 1 + x * mul, y2: CENTER_Y + 2 - y * mul,\n width: 1,\n color: col,\n z: 20\n )\n end",
"def scale!(*amount)\n x, y, z = amount.extract_vector3i!\n\n self.x, self.y, self.z = self.x*x, self.y*y, self.z*z\n self\n end",
"def multiply!(x=1,y=1,z=1)\n if x.kind_of? Numeric\n set(@x*x, @y*y, @z*z)\n elsif x.point3_like?\n multiply! x.x, x.y, x.z\n else\n raise_no_conversion x\n end\n end",
"def frac(vector) \n @xyz2abc * vector.to_v \n end",
"def gain_points(delta)\n self.points_gained += delta\n max_points = 100\n\n # Total points must not exceed 100\n if points_base + points_gained > max_points\n delta -= max_points - (points_base + points_gained)\n self.points_base = max_points - points_gained\n end\n\n # Increase the multiplier\n gain_multiplier delta\n end",
"def scale(by)\n @x = @x * by\n @y = @y * by\n @z = @z * by\n self\n end",
"def pnormal__X_(y); pnormalxXX_(y + 0.5); end",
"def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end",
"def pi_product\n self.inject{|a,b| a*b}\n end",
"def /(scalar)\n raise TypeError, \"Dividing between Point and #{ scalar.class } is not defined\" unless scalar.is_a?(Numeric)\n Point.new(x / scalar, y / scalar)\n end",
"def ptx__x(n, y); ptdist(n, 1.0 - y / 2.0); end",
"def factor\n @factor if valid?\n end",
"def scale(factor_x, factor_y=factor_x, &rendering_code); end",
"def Multiply(val)\n self.value *= val\n end",
"def mul(factors)\n view.update_many(\"$mul\" => collect_operations(factors))\n end",
"def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end",
"def multiply\n inject(1) { |p,x| p * x }\n end",
"def *(factor)\n if factor.is_a?(Numeric)\n Money.new(amount * factor, base_currency)\n else\n raise TypeError\n end\n end",
"def pnormal___x(y); pnormalxXX_(1.0 - y); end",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def perp\n self.class.new( -@y, @x )\n end",
"def k(x,y)\n x * y\n end",
"def multiplier\n\t\tif self.cards_left >= self.hand.game.rule.line5_min && self.cards_left <= self.hand.game.rule.line5_max\n\t\t\tself.points = self.cards_left * self.hand.game.rule.line5_multiplier\n\t\telsif self.cards_left >= self.hand.game.rule.line4_min && self.cards_left <= self.hand.game.rule.line4_max\n\t\t\tself.points = self.cards_left * self.hand.game.rule.line4_multiplier\n\t\telsif self.cards_left >= self.hand.game.rule.line3_min && self.cards_left <= self.hand.game.rule.line3_max\n\t\t\tself.points = self.cards_left * self.hand.game.rule.line3_multiplier\n\t\telsif self.cards_left >= self.hand.game.rule.line2_min && self.cards_left <= self.hand.game.rule.line2_max\n\t\t\tself.points = self.cards_left * self.hand.game.rule.line2_multiplier\n\t\telsif self.cards_left >= self.hand.game.rule.line1_min && self.cards_left <= self.hand.game.rule.line1_max\n\t\t\tself.points = self.cards_left * self.hand.game.rule.line1_multiplier\n\t\telsif self.cards_left == 0\n\t\t\tself.points = 0\n\t\tend\n\tend",
"def rm_edgy_x() (ppu_x * reg_radius).round + 5 end",
"def magSq\n @x*@x + @y*@y\n end",
"def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend",
"def pnormalx__x(y); pnormalxXX_(1.0 - y/2.0); end",
"def mod_mult (p, n)\n q = p\n r = Point.new Float::INFINITY, Float::INFINITY\n\n while n > 0\n if n % 2 == 1\n r = self.mod_add r, q\n end\n\n q = self.mod_add q, q\n n = (n / 2).floor\n end\n r\n end",
"def mult(x,y)\n\tx * y\nend",
"def multiply(y)\n @x * y\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def *(value)\n mul(value) ;\n end",
"def products_at_point(x,y)\n -1.upto(1) do |j|\n -1.upto(1) do |k|\n unless (j == 0 && k == 0)\n product = 1\n 0.upto(ADJACENT - 1) do |factor|\n row = x + j * factor\n col = y + k * factor\n next if row < 0 || col < 0 || row >= GRID_SIZE || col >= GRID_SIZE\n product *= @grid[row][col]\n fin = factor == ADJACENT - 1\n @largest_product = product if fin && product > @largest_product\n end\n end\n end\n end\n end",
"def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end",
"def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end",
"def doubling_points(points, mode)\n result = mode.round points.all\n result *= 2 if @mode.instance_of? DoubleMode\n result *= 4 if @mode.instance_of? RedoubleMode\n\n result\n end",
"def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend",
"def new_point(p)\n case p\n when :infinity\n infinity\n when Array\n x, y = p\n Point.new(self, x, y)\n when Integer\n generator.multiply_by_scalar(p)\n else\n raise ArgumentError, \"Invalid point specifier #{p.inspect}.\"\n end\n end",
"def scale_by num\n min = 0.001\n num = min if num < min and num > -min\n self.x = self.x / num\n self.y = self.y / num\n self\n end",
"def point_per_non_movie_seat_row(seat_row)\n Math.exp(-((1.0/venueRows)*(seat_row.to_f+1))) \n end",
"def multiplier\n Misc.pos_neg_read_multip(pos,neg,read)\n end",
"def multiply!(axis=origin,real=1)\r\n if axis.kind_of? Quaternion\r\n multiply!(axis.axis,axis.real)\r\n elsif axis.point3_like?\r\n r = (@real*real)-@axis.dot(axis)\r\n p3 = axis.scale r\r\n qp3 = @axis.scale real\r\n cross = @axis.cross axis\r\n a = p3.add!(qp3).add!(cross)\r\n set(a,r)\r\n else\r\n raise_no_conversion axis\r\n end\r\n self\r\n end",
"def /(scalar)\n Vector.new @x / scalar.to_f, @y / scalar.to_f\n end",
"def product_of_factorization(prime_factors)\n answer = 1\n prime_factors.each do |prime, exponent|\n answer *= prime**exponent\n end\n answer\nend",
"def c2f_x(x)\n x / zoom + x_orig\n end",
"def prod(x,y)\n x*y\nend",
"def f2c_x(x)\n (x - x_orig) * zoom\n end",
"def p; @p.nil? ? p=sqrt(x**2+y**2) : @p; end",
"def update(point)\n\t\t\n\tend",
"def update(point)\n\t\t\n\tend",
"def predict(x)\n x * @slope\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def *(factor)\n ExpressionValue.new(@level, @constant * factor, @symbol)\n end",
"def step\n @x = @x + @vx\n @y = @y + @vy\n self\n end",
"def dot(other)\n raise TypeError, \"Scalar (dot) product between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n x * other.x + y * other.y\n end",
"def multiply(x,y) \n\tx * y\t\nend",
"def add_to_point point\n add_to_point! point.dup\n end",
"def divide_by(iFactor)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points].each do |ioPoint|\n ioPoint[1] /= iFactor\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end",
"def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end",
"def factor=(val)\n @factor = val\n reset\n end",
"def multiply(x, y)\n return x.to_f * y\nend",
"def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end",
"def power(x,y)\n x**y\nend",
"def multiply(x, y)\n return x * y * 37\n x * y\nend",
"def factor\n FACTOR_ERROR.call unless @factor.respond_to? :call\n @_factor ||= @factor.call(self)\n end",
"def points_formula(coeficient,number_of_teams,position, opponents)\n if position == 0\n return 0\n end\n opponent_rating = 0\n opponents.each do |opponent|\n opponent_rating += opponent.rating\n end\n opponent_rating /= Player.all_ratings\n \tp = (\n coeficient.to_f * number_of_teams.to_f / position * opponent_rating.to_f\n ).round 2\n p*100\n end",
"def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end",
"def gain_a_point\n\n self.score += 1\n\n end",
"def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend",
"def proportional(error)\n return @kp*error\n end",
"def zoom_factor\n Zif.position_math(:fdiv, [@cur_w, @cur_h], zoom_unit)\n end",
"def *(other)\n case other\n when Point\n x * other.x + y * other.y\n when Numeric\n Point.new(x * other, y * other)\n when Array\n self * Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def proc_factor(factor)\n Proc.new { |x| x * factor }\nend",
"def mul(factors)\n prepare_atomic_operation do |ops|\n process_atomic_operations(factors) do |field, value|\n factor = value.__to_inc__\n current = attributes[field]\n new_value = (current || 0) * factor\n process_attribute field, new_value if executing_atomically?\n attributes[field] = new_value\n ops[atomic_attribute_name(field)] = factor\n end\n { \"$mul\" => ops } unless ops.empty?\n end\n end",
"def translate_pos(given)\n Zif.add_positions(Zif.position_math(:mult, given, zoom_factor), pos)\n end",
"def points\n @results.inject(0.0) { |t, r| t += r.points }\n end",
"def points; end",
"def expand(center, point, beta=2.0)\n reflect center, point, beta\n end",
"def matte_point(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n pixel = f.pixel_color(x, y)\n pixel.alpha = TransparentAlpha\n f.pixel_color(x, y, pixel)\n f\n end",
"def multiply(x,y)\n\tx*y\nend",
"def points() \n\t\t(self.wins()*3+self.draws()) \n\tend",
"def multiplier_score(multiplier)\n\tself.score * multiplier\nend",
"def power(curr_value, to_power)\n curr_value**to_power\nend"
] |
[
"0.71792924",
"0.6601084",
"0.6558638",
"0.64490765",
"0.6261095",
"0.6114768",
"0.59567356",
"0.59541464",
"0.5940515",
"0.58077586",
"0.578164",
"0.5767612",
"0.5767228",
"0.57645124",
"0.57616186",
"0.576158",
"0.57607454",
"0.5730416",
"0.5685717",
"0.56726146",
"0.5641882",
"0.56406224",
"0.56372154",
"0.5631343",
"0.56187856",
"0.56061715",
"0.5597633",
"0.55840296",
"0.55839753",
"0.55732894",
"0.55693483",
"0.55601025",
"0.5557623",
"0.5544316",
"0.5526884",
"0.55219173",
"0.551922",
"0.5475421",
"0.5469887",
"0.5457562",
"0.54466254",
"0.54440236",
"0.54423165",
"0.5433451",
"0.5433297",
"0.54186887",
"0.54186887",
"0.54186887",
"0.5404078",
"0.5392705",
"0.53816193",
"0.5379481",
"0.5373317",
"0.5372348",
"0.5367773",
"0.53676456",
"0.5366039",
"0.5359715",
"0.53496236",
"0.5347335",
"0.5342049",
"0.5341425",
"0.5335511",
"0.5322982",
"0.5322262",
"0.5318327",
"0.5318327",
"0.531556",
"0.5308876",
"0.529354",
"0.52933663",
"0.5285589",
"0.52680975",
"0.5267655",
"0.52659357",
"0.52643913",
"0.5261309",
"0.526072",
"0.52567536",
"0.52493614",
"0.524867",
"0.5247569",
"0.5246178",
"0.524525",
"0.524487",
"0.5243052",
"0.52372944",
"0.5236583",
"0.5235986",
"0.523325",
"0.5230484",
"0.5224857",
"0.5221356",
"0.52208966",
"0.52201676",
"0.52156174",
"0.52151054",
"0.52138174",
"0.52090925",
"0.52032226"
] |
0.6186709
|
5
|
Midpoint between two points
|
def bbpMidPoint(first_point, second_point)
bbpMult(bbpAdd(first_point, second_point), 0.5)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def midpoint\n Point.new((x1 + x2) / 2, (y1 + y2) / 2)\n end",
"def midpoint(other)\n raise TypeError, \"Midpoint between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n\n Point.new(\n (self.x + other.x) / 2,\n (self.y + other.y) / 2\n )\n end",
"def mid\n mid_of_x = (@p2.x - @p1.x) / 2 + @p1.x\n mid_of_y = (@p2.y - @p1.y) / 2 + @p1.y\n BPoint.new(mid_of_x, mid_of_y)\n end",
"def midpoint u, v\n (u.add v).scale 0.5\n end",
"def midpoint(point)\n la, lo = Ubiquity::Geoformulas.midpoint self.lat, self.lon, point.lat, point.lon\n self.class.new la, lo\n end",
"def center(other_point)\n Point.new((self.x + other_point.x)/2.0, (self.y + other_point.y)/2.0)\n end",
"def mid x,y\n x + (y-x)/2\nend",
"def get_midpoint(point)\n Point.new(*to_a.zip(point.to_a).map { |a, b| (a + b) / 2.0 })\n end",
"def midpoint\n\t\t(@startrange+@endrange)/2\n\tend",
"def x_center\r\n (@x1 + (@x2 - @x1) / 2).round\r\n end",
"def orthodrome_midpoint(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n x = cola2 * Math.cos(dlon)\n y = cola2 * Math.sin(dlon)\n\n lat = Math.atan2(sila1+sila2, Math.sqrt((cola1+x)**2 + y*y)) / RAD_PER_DEG\n lon = lon1 + Math.atan2(y,cola1+x) / RAD_PER_DEG\n\n [lat,lon]\n end",
"def find_midpoint(addr1,addr2)\n dlong = addr2[1] - addr1[1]\n bx = Math.cos(addr2[0]) * Math.cos(dlong)\n by = Math.cos(addr2[0]) * Math.sin(dlong)\n latmid = Math.atan2((Math.sin(addr1[0]) + Math.sin(addr2[0])), Math.sqrt(( Math.cos(addr1[0])+bx)**2 + by**2))\n longmid = addr1[1] + Math.atan2(by, Math.cos(addr1[0]) + bx)\n return [latmid, longmid]\n end",
"def centerOn(x, y)\r\n hwidth=((@x2-@x1)/2).ceil.abs\r\n hheight=((@y2-@y1)/2).ceil.abs\r\n @x2=x+hwidth\r\n @y2=y+hheight\r\n @y1=y-hheight\r\n @x1=x-hwidth\r\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def center\n Point.new(x: @x, y: @y)\n end",
"def center_on x,y,w,h\n x = x - w / 2\n y = y - h / 2 \n return x,y \n end",
"def random_point_around(point1, point2)\n half_way = [point2.first - point1.first, point2.last - point1.last]\n half_way = [half_way.first/2.0, half_way.last/2.0]\n center = [point1.first + half_way.first, point1.last + half_way.last]\n\n random_part = rand_scale( rotate90(half_way) )\n [center.first + random_part.first, center.last + random_part.last]\n end",
"def midbottom; return self.centerx, self.bottom; end",
"def to_point\n CGPoint.new(first, second)\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def midleft; return self[0], self.centery; end",
"def line_point_distance(line_start, line_end, point)\n top = ((line_end.y - line_start.y) * point.x) -\n ((line_end.x - line_start.x) * point.y) +\n (line_end.x * line_start.y) - \n (line_end.y * line_start.x)\n bottom = ((line_end.y - line_start.y) ** 2 +\n (line_end.x - line_start.x) ** 2) ** 0.5\n return (top / bottom).abs\n end",
"def fortress_center_point\n return Point.new((fortress_x_size / 2).truncate, (fortress_y_size / 2).truncate)\n end",
"def center\r\n Point.from_x_y((lower_corner.x + upper_corner.x)/2,(lower_corner.y + upper_corner.y)/2)\r\n end",
"def get_new_point(lat1, lon1, lat2, lon2, distance)\n\n length = RoadRollerHelper.get_line_length(lat1, lon1, lat2, lon2)\n fraction_length = distance/length\n\n lat_new = lat1 + fraction_length * (lat2-lat1)\n lon_new = lon1 + fraction_length * (lon2-lon1)\n\n return lat_new, lon_new\n end",
"def center(p)\n ret = Pair.new\n @p.each { |p| ret = ret + p }\n return ret/p.length\n end",
"def center_point_of(points)\n dims = points.first.size\n bb = calc_bb_for_points(points)\n dims.map do |i|\n bb[i] + (bb[dims + i] - bb[i]) / 2\n end\n end",
"def centerx; return self[0]+(self[2].div(2)); end",
"def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end",
"def midtop; return self.centerx, self[1]; end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def mid\n (min + max) / 2\n end",
"def calculate_distance(point_a, point_b)\n to_radians = proc { |x| x * Math::PI / 180 }\n lat_a = to_radians.call(point_a.latitude / COORD_FACTOR)\n lat_b = to_radians.call(point_b.latitude / COORD_FACTOR)\n lon_a = to_radians.call(point_a.longitude / COORD_FACTOR)\n lon_b = to_radians.call(point_b.longitude / COORD_FACTOR)\n delta_lat = lat_a - lat_b\n delta_lon = lon_a - lon_b\n a = Math.sin(delta_lat / 2)**2 +\n Math.cos(lat_a) * Math.cos(lat_b) +\n Math.sin(delta_lon / 2)**2\n (2 * RADIUS * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))).to_i\nend",
"def intersect point1, point2, a1, b1, x1, x2\n a2 = (point2.latitude - point1.latitude)/(point2.longitude-point1.longitude)\n b2 = point1.latitude - a2*point1.longitude\n x = (b2-b1)/(a1-a2)\n x3 = point1.longitude < point2.longitude ? point1.longitude : point2.longitude\n x4 = point1.longitude > point2.longitude ? point1.longitude : point2.longitude\n x >= x1 && x <= x2 && x >= x3 && x <= x4\n end",
"def distance(point2)\n end",
"def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end",
"def ellipsoidal_distance(point, a = 6_378_137.0, b = 6_356_752.3142)\n # TODO: Look at https://github.com/rbur004/vincenty/blob/master/lib/vincenty.rb\n # and https://github.com/skyderby/vincenty_distance/blob/master/lib/vincenty.rb\n # as reference, or just choose to depend on one of them?\n f = (a - b) / a\n l = (point.lon - lon) * DEG2RAD\n\n u1 = Math.atan((1 - f) * Math.tan(lat * DEG2RAD))\n u2 = Math.atan((1 - f) * Math.tan(point.lat * DEG2RAD))\n sin_u1 = Math.sin(u1)\n cos_u1 = Math.cos(u1)\n sin_u2 = Math.sin(u2)\n cos_u2 = Math.cos(u2)\n\n lambda = l\n lambda_p = 2 * Math::PI\n iter_limit = 20\n\n while (lambda - lambda_p).abs > 1e-12 && --iter_limit > 0\n sin_lambda = Math.sin(lambda)\n cos_lambda = Math.cos(lambda)\n sin_sigma = \\\n Math.hypot((cos_u2 * sin_lambda), (cos_u1 * sin_u2 - sin_u1 * cos_u2 * cos_lambda))\n\n return 0 if sin_sigma == 0 # coincident points\n\n cos_sigma = sin_u1 * sin_u2 + cos_u1 * cos_u2 * cos_lambda\n sigma = Math.atan2(sin_sigma, cos_sigma)\n sin_alpha = cos_u1 * cos_u2 * sin_lambda / sin_sigma\n cos_sq_alpha = 1 - sin_alpha * sin_alpha\n cos2_sigma_m = cos_sigma - 2 * sin_u1 * sin_u2 / cos_sq_alpha\n\n # equatorial line: cos_sq_alpha=0\n cos2_sigma_m = 0 if cos2_sigma_m.nan?\n\n c = f / 16 * cos_sq_alpha * (4 + f * (4 - 3 * cos_sq_alpha))\n lambda_p = lambda\n lambda = l + (1 - c) * f * sin_alpha * (sigma + c * sin_sigma *\n (cos2_sigma_m + c * cos_sigma * (-1 + 2 * cos2_sigma_m *\n cos2_sigma_m)))\n end\n\n return NaN if iter_limit == 0 # formula failed to converge\n\n usq = cos_sq_alpha * (a * a - b * b) / (b * b)\n a_bis = 1 + usq / 16_384 * (4096 + usq * (-768 + usq * (320 - 175 * usq)))\n b_bis = usq / 1024 * (256 + usq * (-128 + usq * (74 - 47 * usq)))\n delta_sigma = b_bis * sin_sigma * (cos2_sigma_m + b_bis / 4 *\n (cos_sigma * (-1 + 2 * cos2_sigma_m * cos2_sigma_m) - b_bis / 6 *\n cos2_sigma_m * (-3 + 4 * sin_sigma * sin_sigma) * (-3 + 4 *\n cos2_sigma_m * cos2_sigma_m)))\n\n b * a_bis * (sigma - delta_sigma)\n end",
"def absolute_distance(point_1, point_2)\n Math.sqrt((point_1.first - point_2.first) ** 2 + (point_1.last - point_2.last) ** 2)\n end",
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def midright; return self.right, self.centery; end",
"def center\n total_x, total_y = 0, 0\n\n for i in 0...@points.length\n total_x += @points[i].getX\n total_y += @points[i].getY \n end\n\n @aver_x = total_x / @points.length\n @aver_y = total_y / @points.length \n\n return @aver_x, @aver_y \n end",
"def distance_between(point1, point2)\n (point1 - point2).mag\n end",
"def compute_center\n x_center = center_value(@points, :x)\n y_center = center_value(@points, :y)\n [x_center, y_center]\n end",
"def initial_distance(start_point, end_point)\n long1 = start_point.location.x\n long2 = end_point.location.x\n lat1 = start_point.location.y\n lat2 = end_point.location.y\n dtor = Math::PI/180\n r = 6378.14*1000\n\n rlat1 = lat1 * dtor\n rlong1 = long1 * dtor\n rlat2 = lat2 * dtor\n rlong2 = long2 * dtor\n\n dlon = rlong1 - rlong2\n dlat = rlat1 - rlat2\n\n a = (Math::sin(dlat/2)**2) + Math::cos(rlat1) * Math::cos(rlat2) * (Math::sin(dlon/2)**2)\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n d = r * c\n end",
"def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def distance(p0,p1,p2)\r\n if p1.lat == p2.lat and p1.lng == p2.lng\r\n out = Math.sqrt(((p2.lat - p0.lat)**2) + ((p2.lng - p0.lng)**2))\r\n else\r\n u = ((p0.lat - p1.lat)*(p2.lat - p1.lat)+(p0.lng - p1.lng)*(p2.lng - p1.lng))/\r\n (((p2.lat - p1.lat)**2) + ((p2.lng - p1.lng)**2))\r\n if u <= 0\r\n out = Math.sqrt( ((p0.lat - p1.lat)**2 ) + ((p0.lng - p1.lng)**2) )\r\n end\r\n if u >= 1\r\n out = Math.sqrt(((p0.lat - p2.lat)**2) + ((p0.lng - p2.lng)**2))\r\n end\r\n if 0 < u and u < 1\r\n out = Math.sqrt( ((p0.lat-p1.lat-u*(p2.lat-p1.lat))**2) +\r\n ((p0.lng-p1.lng-u*(p2.lng-p1.lng))**2) )\r\n end\r\n end\r\n return out\r\n end",
"def ellipsoidal_distance(point, a = 6378137.0, b = 6356752.3142)\r\n deg_to_rad = 0.0174532925199433\r\n \r\n f = (a-b) / a\r\n l = (point.lon - lon) * deg_to_rad\r\n \r\n u1 = Math.atan((1-f) * Math.tan(lat * deg_to_rad ))\r\n u2 = Math.atan((1-f) * Math.tan(point.lat * deg_to_rad))\r\n sinU1 = Math.sin(u1)\r\n cosU1 = Math.cos(u1)\r\n sinU2 = Math.sin(u2)\r\n cosU2 = Math.cos(u2)\r\n \r\n lambda = l\r\n lambdaP = 2 * Math::PI\r\n iterLimit = 20\r\n \r\n while (lambda-lambdaP).abs > 1e-12 && --iterLimit>0\r\n sinLambda = Math.sin(lambda)\r\n cosLambda = Math.cos(lambda)\r\n sinSigma = Math.sqrt((cosU2*sinLambda) * (cosU2*sinLambda) + (cosU1*sinU2-sinU1*cosU2*cosLambda) * (cosU1*sinU2-sinU1*cosU2*cosLambda))\r\n \r\n return 0 if sinSigma == 0 #coincident points\r\n \r\n cosSigma = sinU1*sinU2 + cosU1*cosU2*cosLambda\r\n sigma = Math.atan2(sinSigma, cosSigma)\r\n sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma\r\n cosSqAlpha = 1 - sinAlpha*sinAlpha\r\n cos2SigmaM = cosSigma - 2*sinU1*sinU2/cosSqAlpha\r\n \r\n cos2SigmaM = 0 if (cos2SigmaM.nan?) #equatorial line: cosSqAlpha=0\r\n\r\n c = f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha))\r\n lambdaP = lambda\r\n lambda = l + (1-c) * f * sinAlpha * (sigma + c * sinSigma * (cos2SigmaM + c * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)))\r\n end\r\n return NaN if iterLimit==0 #formula failed to converge\r\n\r\n uSq = cosSqAlpha * (a*a - b*b) / (b*b)\r\n a_bis = 1 + uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)))\r\n b_bis = uSq/1024 * (256+uSq*(-128+uSq*(74-47*uSq)))\r\n deltaSigma = b_bis * sinSigma*(cos2SigmaM + b_bis/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)- b_bis/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)))\r\n \r\n b*a_bis*(sigma-deltaSigma)\r\n end",
"def test_distance_to_point_left_below\n point1 = Point.new(3, 4)\n point2 = Point.new(0, 0)\n assert_equal 5, point1.distance_to(point2)\n end",
"def distance_from_line_segment(point_a,point_b)\n\n # Define the line as the vector between two points\n line_vector = point_b - point_a\n \n # Define a second vector representing the distance between self and the line start\n point_vector = self - point_a\n\n # Determine if self falls within the perpendicular 'shadow' of the line by calculating\n # the projection of the point vector onto the line.\n #\n # The dot product divided by the magnitude of the line gives the absolute projection\n # of the point vector onto the line.\n #\n # Dividing again by the line magnitude gives the relative projection along the line, \n # i.e. the ratio of the projection to the line. Values between 0-1 indicate that the\n # point falls within the perpendicular shadow.\n #\n projection_ratio = line_vector.dot(point_vector) / line_vector.magnitude ** 2\n\n if projection_ratio >= 1\n # The point is beyond point b, calculate distance to point b\n distance = (point_b - self).magnitude\n elsif projection_ratio <= 0\n # The point is beyond point a, calculate distance to point a\n distance = (point_a - self).magnitude\n else\n # The point is in the shadow of the line, return the perpendicular distance\n distance = line_vector.cross(point_vector).magnitude / line_vector.magnitude\n end\n\n return distance.abs\n end",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def intersection_point(segment)\n # numerator = (line.point1.y - point1.y) * (line.point1.x - line.point2.x) -\n # (line.point1.y - line.point2.y) * (line.point1.x - point1.x)\n # denominator = (point2.y - point1.y) * (line.point1.x - line.point2.x) -\n # (line.point1.y - line.point2.y) * (point2.x - point1.x)\n #\n # t = numerator.to_f / denominator\n #\n # x = point1.x + t * (point2.x - point1.x)\n # y = point1.y + t * (point2.y - point1.y)\n #\n # Point.new(x, y)\n\n x1, y1, x2, y2 = point1.x, point1.y, point2.x, point2.y\n x3, y3, x4, y4 = segment.point1.x, segment.point1.y, segment.point2.x, segment.point2.y\n\n x12 = x1 - x2\n x34 = x3 - x4\n y12 = y1 - y2\n y34 = y3 - y4\n\n c = x12 * y34 - y12 * x34\n\n raise Exception.new('Segments are parallel.') if c.zero?\n\n a = x1 * y2 - y1 * x2\n b = x3 * y4 - y3 * x4\n\n x = (a * x34 - b * x12) / c\n y = (a * y34 - b * y12) / c\n\n Point.new(x, y)\n end",
"def y_center\r\n (@y1 + (@y2 - @y1) / 2).round\r\n end",
"def center(point, transformation)\n\t point = transformation.transform(point) if transformation\n\t [10, format_value(point.x), 20, format_value(point.y)]\n\tend",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def center\n a, b, c, d = @points\n\n Geom::Point3d.new(\n (a.x + b.x + c.x + d.x) / 4,\n (a.y + b.y + c.y + d.y) / 4,\n (a.z + b.z + c.z + d.z) / 4\n )\n end",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def map_center_coordinate(top_left:, bottom_right:)\n row = (top_left.row + bottom_right.row) / 2.0\n column = (top_left.column + bottom_right.column) / 2.0\n zoom = (top_left.zoom + bottom_right.zoom) / 2.0\n\n Coordinate.new(row, column, zoom)\n end",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def getRoomMidPoint()\n\t\tif @room \n\t\t\treturn (@room[0] + @room[2] / 2).floor, (@room[1] + @room[3] / 2).floor\n\t\telse\n\t\t\treturn false \n\t\tend\n\tend",
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def middle\n midpoint = list.length / 2\n end",
"def incenter\n return @incenter if defined?(@incenter)\n\n s = self.sides\n l = [1, 2, 0].map { |i| s[i].length }\n p = l.sum\n\n x_arr = self.vertices.map { |v| v.x / p }\n y_arr = self.vertices.map { |v| v.y / p }\n\n x = l[0] * x_arr[0] + l[1] * x_arr[1] + l[2] * x_arr[2]\n y = l[0] * y_arr[0] + l[1] * y_arr[1] + l[2] * y_arr[2]\n\n @incenter = Point.new(x, y)\n @incenter\n end",
"def right\n @x_min + @y_min\n end",
"def centerx=(x); self[0] = x - (self[2].div(2)); return x; end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def test_centroid_of_three_points\n points = [\n Geokit::LatLng.new(0, -45),\n Geokit::LatLng.new(0, 45),\n Geokit::LatLng.new(90, 0)\n ]\n expected = Geokit::LatLng.new(35.26438, 0)\n actual = Geokit::LatLng.centroid(points)\n assert_in_delta expected.lat, actual.lat, 0.00005\n assert_in_delta expected.lng, actual.lng, 0.00005\n\n points = [\n Geokit::LatLng.new(0, -45),\n Geokit::LatLng.new(0, 45),\n Geokit::LatLng.new(-90, 0)\n ]\n expected = Geokit::LatLng.new(-35.26438, 0)\n actual = Geokit::LatLng.centroid(points)\n assert_in_delta expected.lat, actual.lat, 0.00005\n assert_in_delta expected.lng, actual.lng, 0.00005\n end",
"def OffsetFromClosestPointToOrigin ()\n\t\toffset = @radius - Math.sqrt(0.5 * @radius**2)\n\t\treturn offset,offset\n\tend",
"def intersectPoint p\n if real_close_point(x,y,p.x,p.y) then self\n else NoPoints.new\n end\n end",
"def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend",
"def recenter!\n xa = 0\n old_center = @center\n #Sum up all points\n @points.each do |point|\n xa += point\n end\n #Average out data \n xa /= points.length\n #Reset center and return distance moved\n @center = xa\n return (old_center - center).abs\n end",
"def distance_from_line(point_a,point_b)\n \n # Define the line as the vector between two points\n line_vector = point_b - point_a\n\n # Define a second vector representing the distance between self and the line start\n point_vector = self - point_a\n\n # The magnitude of the cross product is equal to the area of the parallelogram described\n # by the two vectors. Dividing by the line length gives the perpendicular distance.\n (line_vector.cross(point_vector).magnitude / line_vector.magnitude).abs\n end",
"def distance(pt)\n raise ArgumentError unless is_point?(pt)\n return sqrt((pt.first - @xy.first) ** 2 + (pt.last - @xy.last) ** 2)\n end",
"def test_distance_to_point_right_below\n point1 = Point.new(0, 4)\n point2 = Point.new(3, 0)\n assert_equal 5, point1.distance_to(point2)\n end",
"def left\n Point.new(@x - 1, @y)\n end",
"def left\n Point.new(@x - 1, @y)\n end",
"def distance_between(point1, point2)\n earth_radius_in_meters = 6371000\n radian_per_degree = Math::PI/180\n\n # Delta latitudes and longitudes in radians.\n delta_lat = (point2[0] - point1[0]) * radian_per_degree\n delta_lng = (point2[1] - point1[1]) * radian_per_degree\n\n lat1 = point1.first * radian_per_degree\n lat2 = point2.first * radian_per_degree\n\n a = Math.sin(delta_lat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(delta_lng / 2) ** 2\n b = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1 - a))\n\n earth_radius_in_meters * b\n end",
"def intersection_center(other)\n p0 = center\n p1 = other.center\n a = distance_to_chord other\n d = center.distance other.center\n (p1 - p0).scale(a/d) + p0\n end",
"def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end",
"def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end",
"def calc_center_point(aArray)\r\nend",
"def asMapPoint\n # MKMapPointForCoordinate(self.asCLPoint)\n MKMapPointMake(@latitude, @longitude)\n end",
"def start_point\n o = st_start_point\n [o.y, o.x]\n end",
"def right\n Point.new(@x + 1, @y)\n end",
"def right\n Point.new(@x + 1, @y)\n end",
"def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end",
"def computeMidMovePoint()\n# dist = computeDistance(@targetPosition, @ballPosition)\n dist = (@targetPosition.getX() - @ballPosition.getX()).abs() + (@targetPosition.getY() - @ballPosition.getY()).abs()\n \n dX = (@targetPosition.getX() - @ballPosition.getX()) / dist\n dY = (@targetPosition.getY() - @ballPosition.getY()) / dist\n moveX = @ballPosition.getX() - dX * @@odLopty\n moveY = @ballPosition.getY() - dY * @@odLopty\n \n movePositionTmp = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(moveX, moveY, 0)\n\n agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance()\n movePosition = agentModel.relativize(movePositionTmp)\n \n moveDist = movePositionTmp.getXYDistanceFrom(@agentPosition)\n ballDist = @ballPosition.getXYDistanceFrom(@agentPosition)\n \n# if ((@ballPosition.getPhi() - movePositionTmp.getPhi()).abs() < 0.1 && moveDist > ballDist)\n# puts \"BP: \"+@ballPosition.getX().to_s+\", \"+@ballPosition.getY().to_s\n# puts \"MID: \"+movePositionTmp.getX().to_s+\", \"+movePositionTmp.getY().to_s\n# if dX > dY\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() + 1.5 * dY,\n# movePositionTmp.getY() - 1.5 * dX,\n# 0)\n# else\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() - 1.5 * dY,\n# movePositionTmp.getY() + 1.5 * dX,\n# 0)\n# end\n# \n# movePosition = agentModel.relativize(newMP)\n# \n# @indirectMove = true\n# end\n \n return movePosition\n end",
"def distance_of_point_to_line(point, line, point_on_line)\n (point - point_on_line).dot((line).normal_unit).abs\n end",
"def geographic_center(points)\n\n # convert objects to [lat,lon] arrays and remove nils\n points.map!{ |p| p.is_a?(Array) ? p : p.to_coordinates }.compact\n\n # convert degrees to radians\n points.map!{ |p| [to_radians(p[0]), to_radians(p[1])] }\n\n # convert to Cartesian coordinates\n x = []; y = []; z = []\n points.each do |p|\n x << Math.cos(p[0]) * Math.cos(p[1])\n y << Math.cos(p[0]) * Math.sin(p[1])\n z << Math.sin(p[0])\n end\n\n # compute average coordinate values\n xa, ya, za = [x,y,z].map do |c|\n c.inject(0){ |tot,i| tot += i } / c.size.to_f\n end\n\n # convert back to latitude/longitude\n lon = Math.atan2(ya, xa)\n hyp = Math.sqrt(xa**2 + ya**2)\n lat = Math.atan2(za, hyp)\n\n # return answer in degrees\n [to_degrees(lat), to_degrees(lon)]\n end",
"def find_center(side)\n position = side / 2\n position = position - 1 if side.even?\n [position, position]\nend",
"def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end",
"def center size\n x = self.x + (size.width / 2.0)\n y = self.y + (size.height / 2.0)\n CGPoint.new(x, y)\n end",
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def test_distance_to_point_left_up\n point1 = Point.new(3, 0)\n point2 = Point.new(0, 4)\n assert_equal 5, point1.distance_to(point2)\n end",
"def slope(pos1, pos2)\n (pos2.y - pos1.y) / (pos2.x - pos1.x)\nrescue ZeroDivisionError\n nil\nend",
"def angle_at(point)\n Point.angle(centre, point)\n end",
"def add_point(point)\n # again, as with add_bbox(), we do not know whether to add the point\n # \"to the left\" or \"to the right\". So we do it three times:\n # as is, 360 to the left, 360 to the right, and choose the one\n # which minimizes the new side length\n @north = [@north, point[\"lat\"].to_f].max\n @south = [@south, point[\"lat\"].to_f].min\n lng = point[\"lng\"].to_f\n @east, @west = optimize_east_west_add(lng, lng)\n normalize\n end"
] |
[
"0.8508576",
"0.80477166",
"0.7704671",
"0.7538842",
"0.7477937",
"0.73577017",
"0.7282672",
"0.72093225",
"0.70915",
"0.6840581",
"0.6816888",
"0.6744878",
"0.6712868",
"0.6542915",
"0.63738495",
"0.63495123",
"0.62969947",
"0.61883813",
"0.6124088",
"0.6112509",
"0.60887444",
"0.6079041",
"0.604513",
"0.60239315",
"0.6023617",
"0.6000453",
"0.59670615",
"0.59447575",
"0.58967686",
"0.5889963",
"0.58815384",
"0.5877653",
"0.58632416",
"0.5817963",
"0.58131623",
"0.5798682",
"0.57952505",
"0.578481",
"0.5783018",
"0.5769353",
"0.5752228",
"0.5749487",
"0.57327306",
"0.5725701",
"0.57159275",
"0.5685246",
"0.5676397",
"0.5673313",
"0.5668495",
"0.5668291",
"0.56674737",
"0.5656976",
"0.56567496",
"0.56550497",
"0.56387514",
"0.5625526",
"0.56207156",
"0.56053877",
"0.56018573",
"0.5601809",
"0.5593809",
"0.5588304",
"0.55817616",
"0.5573615",
"0.55652213",
"0.5558288",
"0.5556815",
"0.55549014",
"0.5543606",
"0.5537447",
"0.55155003",
"0.5515419",
"0.55135256",
"0.5513492",
"0.5513236",
"0.551183",
"0.5497961",
"0.5497961",
"0.548391",
"0.54835564",
"0.5475539",
"0.5473414",
"0.54585636",
"0.5448473",
"0.5443746",
"0.5440127",
"0.5440127",
"0.54339737",
"0.54267734",
"0.54204464",
"0.541757",
"0.5411011",
"0.54041415",
"0.5395415",
"0.5394971",
"0.5382574",
"0.5376691",
"0.5376422",
"0.53746307",
"0.5364114"
] |
0.737605
|
5
|
Product of two points
|
def bbpDot(first_point, second_point)
first_point.x * second_point.x + first_point.y * second_point.y
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getProd ( x , y )\n\tprod = x * y\n\treturn prod\nend",
"def prod(x,y)\n x*y\nend",
"def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend",
"def dot(other)\n raise TypeError, \"Scalar (dot) product between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n x * other.x + y * other.y\n end",
"def k(x,y)\n x * y\n end",
"def pi_product\n self.inject{|a,b| a*b}\n end",
"def multiply(x, y)\n product = x*y\nend",
"def dotProduct(doc1, doc2)\n _common_tokens = findCommonTokens(doc1.keys, doc2.keys)\n _dot_product = 0.0\n\n _common_tokens.each do |token|\n _dot_product += doc2[token] * doc1[token]\n end\n return _dot_product\n end",
"def multiplyPolys(poly1, poly2)\n newPoly = poly1.*(poly2)\n\n newPoly = modX(newPoly, 2)\n newPoly = reduce(newPoly)\n newPoly = modX(newPoly, 2)\n \n newPoly\n end",
"def dot_product(vector2)\n self.class.dot_product(self, vector2)\n end",
"def multiply(x,y) \n\tx * y\t\nend",
"def calculate_product(a,b)\n a*b\nend",
"def multiply(x, y)\n\tx * y\nend",
"def products_at_point(x,y)\n -1.upto(1) do |j|\n -1.upto(1) do |k|\n unless (j == 0 && k == 0)\n product = 1\n 0.upto(ADJACENT - 1) do |factor|\n row = x + j * factor\n col = y + k * factor\n next if row < 0 || col < 0 || row >= GRID_SIZE || col >= GRID_SIZE\n product *= @grid[row][col]\n fin = factor == ADJACENT - 1\n @largest_product = product if fin && product > @largest_product\n end\n end\n end\n end\n end",
"def product(num1, num2)\n num1 * num2\nend",
"def getDotProduct(w1,w2)\n product = 0.0\n # Iterate over shorter list since missing values are considered 0\n if w2.size < w1.size\n temp = w2\n w2 = w1\n w1 = temp\n end \n # Compute the dot product.\n w1.keys.each do |key|\n if w1.key?(key) && w2.key?(key) \n product += w1[key] * w2[key] \n end\n end\n product\n end",
"def __inner_product(other)\n\t\tt = 0\n\t\tsize.times do |k|\n\t\t\tt += __get(k) * other.__get(k)\n\t\tend\n\t\treturn t\n\tend",
"def multi_pol(a, b, n)\n\tproduct = Array.new(2*n -1) {0}\n\n\tfor i in 0...n\n\t\tfor j in 0...n\n\t\t\tproduct[i+j] = product[i+j] + a[i] * b[j]\n\t\tend\n\tend\n\n\tproduct\nend",
"def multiply(y)\n @x * y\n end",
"def dotProduct(doc1, doc2)\n common_tokens(doc1.keys, doc2.keys).inject(0.0) do |dot_product, token|\n dot_product + doc2[token] * doc1[token]\n end\n end",
"def *(a)\n if a.class == Vector # inner product\n product = 0\n self.each_index{|k| product += self[k]*a[k]}\n else\n product = Vector.new # scalar product\n self.each_index{|k| product[k] = self[k]*a}\n end\n product\n end",
"def mult(x,y)\n\tx * y\nend",
"def multiply(x,y)\n\tx*y\nend",
"def mul(rhs)\n Vector2.new(@x * rhs, @y * rhs)\n end",
"def vector_product(y_index, x_index, y_vector, x_vector)\n\n product = 1\n velocity = y_vector == 0 && x_vector == 0 ? 0 : 3\n\n cells = get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells.each { |cell| product *= cell.val }\n\n return product\nend",
"def cross_product(vector2)\n self.class.cross_product(self, vector2)\n end",
"def bbpCompMult(first_point, second_point)\n\n bbp(first_point.x * second_point.x, first_point.y * second_point.y)\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end",
"def product(other)\n Product.new(self, other)\n end",
"def multiply (x,y)\n return x * y\nend",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def *(b)\n Check.ensure_symbolic b\n Check.matrix_product self, b\n case b \n when Array\n __column_vector_prod(b) \n when Matrix \n __matrix_prod(b)\n else\n map { |v| v * b}\n end\n end",
"def Point2dDotProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743812, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def multiply (x, y)\n x * y\nend",
"def scalar_product( array1, array2 )\n\t\tif array1 == nil or array2 == nil; return 0.0; end\n\t\t\n\t\tif array1.length == 0 or array2.length == 0; return 0.0; end\n\t\t\t\t\n\t\tarray_less = array1\n\t\tarray_more = array2\n\t\tif array1.length > array2.length\n\t\t\tarray_less = array2\n\t\t\tarray_more = array1\n\t\tend\n\t\tsum = 0.0\n\t\tarray_less.each_with_index do |value1, index|\n\t\t\tif value1 == nil; return 0.0; end\n\t\t\tvalue2 = array_more[index]\n\t\t\tsum += value1 * value2\n\t\tend\n\t\treturn sum\n\tend",
"def xxx(x, y)\n sum = 0\n\n x.each_index do |i|\n sum += (x[i] * y[i])\n end\n\n sum\nend",
"def dot_product(a,b)\n # matrix_a = Vector[*a]\n # matrix_b = Vector[*b]\n return false if a.length != b.length\n matrix_a = Vector.elements(a, copy = true)\n matrix_b = Vector.elements(b, copy = true)\n p matrix_a.inner_product(matrix_b)\nend",
"def multiply(x, y)\n x * y\nend",
"def multiply(x,y)\n x * y\nend",
"def multiply(x,y)\n x * y\nend",
"def product\n inject(nil) { |mul, x| mul ? mul * x : x }\n end",
"def GF_product_p(a, b)\n (a.polynomial * b.polynomial).to_byte\nend",
"def product\n reduce(1, &:*)\n end",
"def product\n if block_given?\n inject(1) { |a,b| a*(yield b) }\n else\n inject(1) { |a,b| a*b }\n end\n end",
"def multiply(x,y)\n x*y\nend",
"def multiply(x,y)\n x*y\nend",
"def multiply(x,y)\n x*y\nend",
"def dot(x1, y1, x2, y2)\n x1 * x2 + y1 * y2\n end",
"def Point2dDotProduct(arg0, arg1)\n ret = _invoke(1610743811, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def multiply(x, y)\n x * y\nend",
"def multiply(x, y)\n x * y\nend",
"def multiply\n inject(1) { |p,x| p * x }\n end",
"def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end",
"def *(other)\n case other\n when Point\n x * other.x + y * other.y\n when Numeric\n Point.new(x * other, y * other)\n when Array\n self * Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def multiply(a, b)\r\n a * b\r\n end",
"def * other\n result = Polynomial.new\n @coeffs.each_with_index do |c, i|\n result.plus! other.scale(c).shift(i)\n end\n result\n end",
"def multiply_all_pairs(arr1, arr2)\n p arr1.product(arr2).map { |num1, num2| num1 * num2 }.sort\nend",
"def cross_product(vector)\n x * vector.y - y * vector.x\n end",
"def product(other)\n product_graph = Graph.new\n self.vertices.each do |v1|\n other.vertices.each do |v2|\n product_graph << Vertex.new({:g1_vertex => v1, :g2_vertex => v2})\n end\n end\n self.edges.each do |e1|\n e1_vertices = e1.vertices\n other.edges.each do |e2|\n if e1.type == e2.type\n e2_vertices = e2.vertices\n source = product_graph.vertices.find {|v| v.g1_vertex == e1_vertices[0] and v.g2_vertex == e2_vertices[0]}\n destination = product_graph.vertices.find {|v| v.g1_vertex == e1_vertices[1] and v.g2_vertex == e2_vertices[1]}\n product_graph.connect source, destination\n source = product_graph.vertices.find {|v| v.g1_vertex == e1_vertices[0] and v.g2_vertex == e2_vertices[1]}\n destination = product_graph.vertices.find {|v| v.g1_vertex == e1_vertices[1] and v.g2_vertex == e2_vertices[0]}\n product_graph.connect source, destination\n end\n end\n end\n product_graph.vertices.reject! {|v| v.neighbours.empty?} \n product_graph\n end",
"def multiply(x, y)\n return x.to_f * y\nend",
"def multiply_all_pairs2(arr1, arr2)\n arr1.product(arr2).map { |a, b| a * b }.sort\nend",
"def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end",
"def multiply(n1, n2)\n return n1*n2\n end",
"def dotProduct(l1, l2)\n\toutput = []\n\tfor i in 0 ... l1.size\n\t\tsum = 0\n\t\tfor j in 0 ... l2.size\n\t\t\tsum += l1[i][j] * l2[j]\n\t\tend\n\t\toutput << sum\n\tend\n\n\treturn output\nend",
"def multiply(x, y)\n return x * y * 37\n x * y\nend",
"def multiply(a, b)\n\t\treturn a*b\n\tend",
"def dot(other)\n @x * other.x + @y * other.y + @z * other.z\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def dot(other) \n return (@x * other.x) + (@y * other.y) + (@z * other.z)\n end",
"def cross_product(nv2)\n [self[1]*nv2[2]-self[2]*nv2[1], self[2]*nv2[0]-self[0]*nv2[2], self[0]*nv2[1]-self[1]*nv2[0]]\n end",
"def pairwise_product(other)\n result = []\n each_index {|i| result << self[i]*other[i] }\n return result\n end",
"def Point3dDotProductXY(arg0, arg1)\n ret = _invoke(1610743842, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def dot(rhs)\n @x * rhs.x + @y * rhs.y\n end",
"def *(other)\n if other.respond_to? :x and other.respond_to? :y and other.respond_to? :z\n self.class.new(self.x.to_f * other.x.to_f, self.y.to_f * other.y.to_f, self.z.to_f * other.z.to_f)\n elsif other.respond_to? :to_a\n self * self.class.from_array(other.to_a)\n else\n self.class.new(self.x.to_f * other.to_f, self.y.to_f * other.to_f, self.z.to_f * other.to_f)\n end\n end",
"def multiply a,b\n a*b\nend",
"def Point3dDotProduct3PointsXY(arg0, arg1, arg2)\n ret = _invoke(1610743840, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def multiply_two_numbers( x, y )\n x * y\nend",
"def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |x,y| x * y }.sort\nend",
"def Point2dCrossProduct(arg0, arg1)\n ret = _invoke(1610743809, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dDotProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743839, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def multiply(a, b)\nend",
"def to_multipoint\n point1, point2 = self.to_utm \n GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([ [ point1.e, point1.n ], [ point2.e, point2.n ] ])\n end",
"def Point2dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743810, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ScalarMultiplication( scalaire ) \n i = @i * scalaire\n j = @j * scalaire\n \n pt = Point2D.new(i, j)\n vectorMultiSca = Vector2D.new( 0, 0 )\n vectorMultiSca.initializeWithPoint( pt )\n \n return vectorMultiSca \n end",
"def mul(a, b)\n res = []\n res << a[0]*b[0] + a[1]*b[2]\n res << a[0]*b[1] + a[1]*b[3]\n res << a[2]*b[0] + a[3]*b[2]\n res << a[2]*b[1] + a[3]*b[3]\n res\nend",
"def multiply(a,b)\n\treturn a * b\nend",
"def multiply(first_matrix, second_matrix)\n x = first_matrix[0][0] * second_matrix[0][0] + first_matrix[0][1] * second_matrix[1][0]; \n y = first_matrix[0][0] * second_matrix[0][1] + first_matrix[0][1] * second_matrix[1][1]; \n z = first_matrix[1][0] * second_matrix[0][0] + first_matrix[1][1] * second_matrix[1][0]; \n w = first_matrix[1][0] * second_matrix[0][1] + first_matrix[1][1] * second_matrix[1][1]; \n \n first_matrix[0][0] = x; \n first_matrix[0][1] = y; \n first_matrix[1][0] = z; \n first_matrix[1][1] = w; \n end",
"def double_product(a, b)\n\tcoefficient_one = a[0]\n\texponent_one = a[1]\n\tvariable_one = a[2]\n\n\tcoefficient_two = b[0]\n\texponent_two = b[1]\n\tvariable_two = b[2]\n\n\tcoefficient_three = 2 * coefficient_one * coefficient_two\n\n\tif variable_one == 1\n\t\texponent_three = 1\n\n\t\tif exponent_two > 1\n\t\t\tproduct = \"#{coefficient_three}#{variable_two}^#{exponent_two}\"\n\t\telse\n\t\t\tproduct = \"#{coefficient_three}#{variable_two}\"\n\t\tend\n\n\t\treturn product\n\tend\n\n\tif variable_two == 1\n\t\texponent_three = 1\n\n\t\tif exponent_one > 1\n\t\t\tproduct = \"#{coefficient_three}#{variable_one}^#{exponent_one}\"\n\t\telse\n\t\t\tproduct = \"#{coefficient_three}#{variable_one}\"\n\t\tend\n\n\t\treturn product\n\tend\n\n\tif variable_one == variable_two\n\t\tvariable_three = variable_one\n\t\texponent_three = exponent_one + exponent_two\n\t\tproduct = \"#{coefficient_three}#{variable_three}^#{exponent_three}\"\n\n\t\treturn product\n\telse\n\t\tif exponent_one == 1 && exponent_two == 1\n\t\t\tvariable_exponent = \"#{variable_one}#{variable_two}\"\n\t\telsif exponent_one == 1\n\t\t\tvariable_exponent = \"#{variable_one}#{variable_two}^#{exponent_two}\"\n\t\telsif exponent_two == 1\n\t\t\tvariable_exponent = \"#{variable_one}^#{exponent_one}#{variable_two}\"\n\t\telse\n\t\t\tvariable_exponent = \"#{variable_one}^#{exponent_one}#{variable_two}^#{exponent_two}\"\n\t\tend\n\n\t\tproduct = \"#{coefficient_three}#{variable_exponent}\"\n\n\t\treturn product\n\tend\nend",
"def sum_difference_product\n # your code goes here\nend",
"def test_cross_product\n\t\tassert_equal((Geometry::cross_product(Vector[0,0,1],Vector[1,0,0])),Vector[0,1,0]) # test an explicit cross product\n\tend",
"def mul!(rhs)\n @x *= rhs\n @y *= rhs\n self\n end",
"def multiply(a, b)\n\ta * b\nend",
"def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |num1, num2| num1 * num2 }.sort\nend",
"def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end",
"def on_mul(ast_node, context)\n left, right = *ast_node\n\n return on_call_number(context, left) * on_call_number(context, right)\n end",
"def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend",
"def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend",
"def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend",
"def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend",
"def multiply_all_pairs(arr_1, arr_2)\n arr_1.product(arr_2).map { |arr| arr.reduce(&:*) }.sort\nend",
"def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |sub_arr| sub_arr.reduce(:*) }.sort\nend"
] |
[
"0.7308916",
"0.7084603",
"0.69739026",
"0.6577019",
"0.64812785",
"0.6440238",
"0.64103115",
"0.63741994",
"0.6356592",
"0.6330616",
"0.6283095",
"0.62825435",
"0.62636197",
"0.6260396",
"0.62590814",
"0.6253562",
"0.6214709",
"0.6209915",
"0.6187029",
"0.6185448",
"0.6179232",
"0.6175428",
"0.616156",
"0.61427516",
"0.61413",
"0.6117245",
"0.61045",
"0.609885",
"0.6092442",
"0.60841495",
"0.60774374",
"0.60540843",
"0.6048312",
"0.60477877",
"0.60331494",
"0.6031574",
"0.60119134",
"0.5994584",
"0.59940207",
"0.59940207",
"0.5987523",
"0.5981306",
"0.5968998",
"0.5965516",
"0.5963529",
"0.5963529",
"0.5963529",
"0.59583664",
"0.5954167",
"0.595025",
"0.595025",
"0.5948632",
"0.5947668",
"0.59144056",
"0.59092075",
"0.5908899",
"0.59052855",
"0.5877351",
"0.58686113",
"0.5868342",
"0.58460695",
"0.58422166",
"0.5839307",
"0.58360183",
"0.5830894",
"0.58126223",
"0.5809848",
"0.5800489",
"0.5774692",
"0.5744868",
"0.5734645",
"0.5732634",
"0.57203245",
"0.5717297",
"0.5709176",
"0.5700694",
"0.569764",
"0.5696653",
"0.56958956",
"0.5686554",
"0.5681892",
"0.5679615",
"0.5679077",
"0.56767166",
"0.566882",
"0.5658688",
"0.5655709",
"0.5654701",
"0.5652615",
"0.56508064",
"0.5646011",
"0.5643706",
"0.56408155",
"0.5639472",
"0.56361383",
"0.56250685",
"0.56250685",
"0.56250685",
"0.56250685",
"0.5623416",
"0.5622118"
] |
0.0
|
-1
|
Cross product of two points
|
def bbpCross(first_point, second_point)
first_point.x * second_point.y - first_point.y * second_point.x
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cross_product(vector)\n x * vector.y - y * vector.x\n end",
"def cross(v)\n (@x * v.y) - (@y * v.x)\n end",
"def cross(v)\n (v.y * x) - (v.x * y)\n end",
"def cross(o, p)\n ((p.x - o.x) * (self.y - o.y) - (p.y - o.y) * (self.x - o.x)).round(CROSS_PRODUCT_ROUNDING)\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end",
"def cross( vector )\n (@x * vector.y) - (@y * vector.x)\n end",
"def cross (a, b, c)\n return (b[0]-a[0])*(c[1]-a[1]) - (c[0]-a[0])*(b[1]-a[1])\nend",
"def Point2dCrossProduct(arg0, arg1)\n ret = _invoke(1610743809, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross_product(vector2)\n self.class.cross_product(self, vector2)\n end",
"def Point2dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743810, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def two_point_crossover(other)\n point_crossover(other, 2)\n end",
"def one_point_crossover(other)\n point_crossover(other, 1)\n end",
"def cross_product(nv2)\n [self[1]*nv2[2]-self[2]*nv2[1], self[2]*nv2[0]-self[0]*nv2[2], self[0]*nv2[1]-self[1]*nv2[0]]\n end",
"def Point3dCrossProduct(arg0, arg1)\n ret = _invoke(1610743835, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross(vector)\n end",
"def Point3dCrossProductXY(arg0, arg1)\n ret = _invoke(1610743838, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dCrossProductXY(arg0, arg1)\n ret = _invoke(1610744158, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610744157, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dCrossProduct3PointsXY(arg0, arg1, arg2)\n ret = _invoke(1610743837, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross(other)\n new_x = (@y * other.z) - (@z * other.y)\n new_y = (@z * other.x) - (@x * other.z)\n new_z = (@x * other.y) - (@y * other.x)\n\n self.class.new(new_x, new_y, new_z)\n end",
"def cross(other)\n c_x = @y * other.z - @z * other.y\n c_y = @z * other.x - @x * other.z\n c_z = @x * other.y - @y * other.x\n Vector3f.new(c_x,c_y,c_z)\n end",
"def Point3dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743836, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_cross_product\n\t\tassert_equal((Geometry::cross_product(Vector[0,0,1],Vector[1,0,0])),Vector[0,1,0]) # test an explicit cross product\n\tend",
"def cross v\n x = @y * v.z - @z * v.y\n y = @z * v.x - @x * v.z\n z = @x * v.y - @y * v.x\n Vector.new x, y, z\n end",
"def crossProduct( vector2 )\n @angle = self.getAngleOf2Vector(vector2)\n @lenght = @length * vector2.length * @angle\n return 0\n end",
"def Vector3dCrossProduct(arg0, arg1)\n ret = _invoke(1610744156, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross_product x\r\n Vector.Raise ErrDimensionMismatch if size != 3\r\n Vector.Raise ErrDimensionMismatch if x.size != 3\r\n\r\n c = Array.new\r\n\r\n c[0] = @elements[1]*x[2] - @elements[2]*x[1]\r\n c[1] = @elements[2]*x[0] - @elements[0]*x[2]\r\n c[2] = @elements[0]*x[1] - @elements[1]*x[0]\r\n\r\n Vector.elements(c)\r\n end",
"def crossPointsAround\n [KBPoint.new.init([x+1,y]),KBPoint.new.init([x-1,y]),KBPoint.new.init([x,y-1]),KBPoint.new.init([x,y+1])]\n end",
"def cross(b,c)\n unless b.size == 3 and c.size == 3\n raise \"Vectors must be of length 3\"\n end\n Vector[b[1]*c[2] - b[2]*c[1], b[2]*c[0] - b[0]*c[2], b[0]*c[1] - b[1]*c[0]]\n end",
"def cross!(x=1/sqrt3,y=1/sqrt3,z=1/sqrt3)\n if x.kind_of? Numeric\n set((@y*z)-(@z*y), (@z*x)-(@x*z), (@x*y)-(@y*x))\n elsif x.point3_like?\n if y.kind_of? Numeric\n cross! x.x, x.y, x.z\n elsif y.point3_like?\n set(x).cross!(y)\n else\n raise_no_conversion y\n end\n else\n raise_no_conversion x\n end\n end",
"def cross(a, b)\n return a.map{|i| b.map{|j| \"#{i}#{j}\" }}.flatten\nend",
"def cross!(*args)\n vx, vy, vz = args.extract_vector3i!\n self.x, self.y, self.z = y * vz - z * vy, z * vx - x * vz, x * vy - y * vx\n self\n end",
"def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end",
"def cross(*v)\n self.dup.cross! *v\n end",
"def cross_normal(other)\n cross(other).normalize\n end",
"def cross(v1, v2)\n dx, dy = v2[0] - v1[0], v2[1] - v1[1]\n cr = [] # array containing intersections\n\n if dx == 0 and dy ==0 then\n\tnc = 0\n elsif dx == 0 then\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n elsif dy == 0 then\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n else\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy \n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n end\n return cr\n end",
"def normal\n u = (a.subtract b).normalize\n v = (c.subtract b).normalize\n u.cross v\n end",
"def dot(other)\n raise TypeError, \"Scalar (dot) product between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n x * other.x + y * other.y\n end",
"def curveto(cp1x, cp1y, cp2x, cp2y, x, y)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x, y)\n end",
"def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend",
"def cross( otherVector )\n\t\t\traise TypeError,\n\t\t\t\t\"wrong argument type '%s': Expected an ODE::Vector\" % otherVector.class.name unless\n\t\t\t\totherVector.is_a?( ODE::Vector )\n\t\t\traise ArgumentError, \"Can only cross 3rd-order vectors\" unless\n\t\t\t\tself.size == 3 and otherVector.size == 3\n\n\t\t\tself.class.new( [@elements[1]*otherVector[2] - @elements[2]*otherVector[1],\n\t\t\t\t\t\t\t @elements[2]*otherVector[0] - @elements[0]*otherVector[2],\n\t\t\t\t\t\t\t @elements[0]*otherVector[1] - @elements[1]*otherVector[0]])\n\t\tend",
"def cross(array2)\n self.inject([]){ |array, first| array2.inject(array) {|array, second| array << [first, second]} } \n end",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def cross_length(other)\n # cross(other).magnitude\n\n # It is more efficient to not create a new Vector object since we are only returning \n # a scalar value \n new_x = (@y * other.z) - (@z * other.y)\n new_y = (@z * other.x) - (@x * other.z)\n new_z = (@x * other.y) - (@y * other.x)\n\n Math.sqrt(new_x ** 2 + new_y ** 2 + new_z ** 2)\n end",
"def getProd ( x , y )\n\tprod = x * y\n\treturn prod\nend",
"def * other\n result = Polynomial.new\n @coeffs.each_with_index do |c, i|\n result.plus! other.scale(c).shift(i)\n end\n result\n end",
"def cross(s1,s2)\n if rand() < Crossprob\n # Choose a random point to perform crossover:\n loc = 1+rand(s1.length-1)\n t1 = s1[0..loc-1] + s2[loc..-1]\n t2 = s2[0..loc-1] + s1[loc..-1]\n else\n t1 = s1\n t2 = s2\n end\n return t1,t2\nend",
"def dot(other)\n @x * other.x + @y * other.y + @z * other.z\n end",
"def dot(other) \n return (@x * other.x) + (@y * other.y) + (@z * other.z)\n end",
"def Point2dDotProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743812, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def create_cross_array(start)\n cross_array =[\n Point.new(start.x-1, start.y),\n Point.new(start.x+1, start.y),\n Point.new(start.x, start.y-1),\n Point.new(start.x, start.y+1),\n ]\n return cross_array\n end",
"def dot(x1, y1, x2, y2)\n x1 * x2 + y1 * y2\n end",
"def k(x,y)\n x * y\n end",
"def dot_product(a,b)\n # matrix_a = Vector[*a]\n # matrix_b = Vector[*b]\n return false if a.length != b.length\n matrix_a = Vector.elements(a, copy = true)\n matrix_b = Vector.elements(b, copy = true)\n p matrix_a.inner_product(matrix_b)\nend",
"def cross_phase other\n complex2 other, :cross_phase\n end",
"def Point2dDotProduct(arg0, arg1)\n ret = _invoke(1610743811, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def twopoint_crossover(parent1, parent2, percent1, percent2)\n point1 = parent1.size * percent1/100.0\n point2 = parent1.size - parent1.size * percent2/100.0\n parent1[point1..point2] = parent2[point1..point2]\n parent1\n end",
"def normal(a, b)\n [a[1]*b[2]-a[2]*b[1],\n a[2]*b[0]-a[0]*b[2],\n a[0]*b[1]-a[1]*b[0]]\nend",
"def dot_product(vector2)\n self.class.dot_product(self, vector2)\n end",
"def quadratic_curve(x1, y1, x2, y2)\n [x1.value, y1.value, x2.value, y2.value]\n end",
"def bbpCompMult(first_point, second_point)\n\n bbp(first_point.x * second_point.x, first_point.y * second_point.y)\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def dotProduct( vector2 )\n i = @i * vector2.i\n j = @j * vector2.j\n \n pt = Point2D.new(i, j)\n vectorDotProduct = Vector2D.new( 0, 0 )\n vectorDotProduct.initializeWithPoint( pt )\n \n return vectorDotProduct \n \n #@length = Math.sqrt( i**2 + j**2 )\n #@angle = Math.acos( Math.sqrt( @length / ( @length ) ) \n #@direction\n end",
"def pairwise_product(other)\n result = []\n each_index {|i| result << self[i]*other[i] }\n return result\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def ScalarMultiplication( scalaire ) \n i = @i * scalaire\n j = @j * scalaire\n \n pt = Point2D.new(i, j)\n vectorMultiSca = Vector2D.new( 0, 0 )\n vectorMultiSca.initializeWithPoint( pt )\n \n return vectorMultiSca \n end",
"def curve(cp1x, cp1y, cp2x, cp2y, x1, y1, x2, y2)\n beginpath(x1, y1)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x2, y2)\n endpath\n end",
"def coordinates\n row_values.product(col_values)\n end",
"def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end",
"def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end",
"def point_crossover(other, n)\n indexes = (0...self.size).to_a # Insieme degli indici possibili\n points = [] # Insieme di punti di taglio del crossover\n n.times { points.push(indexes.delete_at(rand(indexes.size))) } # Prende casualmente n indici (diversi) possibili e li include in points\n a, b = self, other \n son_str = (0...self.size).map do |i|\n a, b = b, a if points.include?(i) # Se incontra un punto di crossover effettua uno swap\n a[i] # Elemento da includere in son\n end\n son_str\n end",
"def *(coef)\n Point.new(@x * coef, @y * coef)\n end",
"def vector_to(point2)\n end",
"def distance_from_line(point_a,point_b)\n \n # Define the line as the vector between two points\n line_vector = point_b - point_a\n\n # Define a second vector representing the distance between self and the line start\n point_vector = self - point_a\n\n # The magnitude of the cross product is equal to the area of the parallelogram described\n # by the two vectors. Dividing by the line length gives the perpendicular distance.\n (line_vector.cross(point_vector).magnitude / line_vector.magnitude).abs\n end",
"def multiply_vectors(vector1, vector2 = vector1)\n vector1 * vector2.covector\n end",
"def Point3dDotProductXY(arg0, arg1)\n ret = _invoke(1610743842, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dDotProduct3PointsXY(arg0, arg1, arg2)\n ret = _invoke(1610743840, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dDotProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743839, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def *(other)\n Vector.new(other * @x, other * @y)\n end",
"def intersect( v1, v2 )\n b1, b2 = bound( v1 ), bound( v2 )\n cr = []\n if b1 && b2 then\n\tres = 0\n elsif b1 then\n\tcr = cross( v1, v2 )\n\tres =1\n elsif b2 then \n\tcr = cross( v1, v2 )\n\tres =2\n else\n\tcr = cross( v1, v2 )\n\tif cr.size == 2 then\n\t res = 3\n\telse\n\t res = 4\n\tend\n end\n return res, cr\n end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def cross_join(other)\n join(other, join_type: :cross)\n end",
"def Vector3dDotProductXY(arg0, arg1)\n ret = _invoke(1610744161, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cartesian(other)\n _deserializer = Spark::Serializer::Cartesian.new(self.deserializer, other.deserializer)\n\n new_jrdd = jrdd.cartesian(other.jrdd)\n RDD.new(new_jrdd, context, serializer, _deserializer)\n end",
"def Point3dDotProduct(arg0, arg1)\n ret = _invoke(1610743841, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dTripleProduct(arg0, arg1, arg2)\n ret = _invoke(1610743844, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def multiplyPolys(poly1, poly2)\n newPoly = poly1.*(poly2)\n\n newPoly = modX(newPoly, 2)\n newPoly = reduce(newPoly)\n newPoly = modX(newPoly, 2)\n \n newPoly\n end",
"def bbpDot(first_point, second_point)\n\n first_point.x * second_point.x + first_point.y * second_point.y\n end",
"def dot(rhs)\n @x * rhs.x + @y * rhs.y\n end",
"def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end",
"def to_point\n CGPoint.new(first, second)\n end",
"def prod(x,y)\n x*y\nend",
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end",
"def -(p)\n Pair.new(@x - p.x, @y - p.y)\n end",
"def dot(other)\n self * other\n end",
"def bbpAdd(first_point, second_point)\n\n cxp(first_point.x + second_point.x, first_point.y + second_point.y)\n end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def transmogrifier (a,b,c)\n (a*b)^c\n end",
"def *(other)\n case other\n when Point\n x * other.x + y * other.y\n when Numeric\n Point.new(x * other, y * other)\n when Array\n self * Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end"
] |
[
"0.7621995",
"0.74743664",
"0.7448689",
"0.7314974",
"0.7309704",
"0.7298706",
"0.7286029",
"0.7272254",
"0.7260169",
"0.71171284",
"0.708602",
"0.69460326",
"0.6912055",
"0.68573916",
"0.68549883",
"0.6843125",
"0.67658925",
"0.67485726",
"0.6732876",
"0.6725993",
"0.672469",
"0.6674961",
"0.66712475",
"0.66402423",
"0.6603191",
"0.65575325",
"0.65562916",
"0.64648134",
"0.6427691",
"0.642608",
"0.632885",
"0.62929595",
"0.6265507",
"0.6208136",
"0.6200558",
"0.6107673",
"0.5973743",
"0.5906253",
"0.5904591",
"0.581193",
"0.5799111",
"0.57789713",
"0.5767975",
"0.57383585",
"0.57309115",
"0.5720176",
"0.56931853",
"0.56738895",
"0.5644398",
"0.5605892",
"0.55742854",
"0.55633426",
"0.55329585",
"0.5510241",
"0.55007887",
"0.54972225",
"0.54871476",
"0.54107857",
"0.5410329",
"0.53869206",
"0.5383919",
"0.53622305",
"0.5360228",
"0.53593767",
"0.53573364",
"0.53459406",
"0.5339645",
"0.5338895",
"0.5325929",
"0.5325929",
"0.53168124",
"0.53103185",
"0.5306481",
"0.52833265",
"0.52663004",
"0.52655023",
"0.5260226",
"0.5240313",
"0.52269876",
"0.5223908",
"0.52181745",
"0.5210275",
"0.52034056",
"0.5194436",
"0.5189995",
"0.5187837",
"0.5167993",
"0.51544684",
"0.5127331",
"0.5125671",
"0.51156723",
"0.511023",
"0.5106963",
"0.5101069",
"0.50981194",
"0.5097652",
"0.5084925",
"0.5083579",
"0.5066207",
"0.50603706"
] |
0.7336678
|
3
|
Perpendicular of point, rotated 90 degrees counterclockwise
|
def bbpPerp(point)
bbp(-point.y, point.x)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def perpendicular\n Vector2d.new(-@y, @x)\n end",
"def perpendicular\n Vector2d.new(-y, x)\n end",
"def unit_perpendicular_vector(options={})\n return [self[1], -self[0]].unit_vector if options[:counter_clockwise]\n [-self[1], self[0]].unit_vector\n end",
"def perpendicular_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n # any two lines in R^2 intersect, so blindly making\n # a line through p in an orthogonal direction will work\n Line.new(point, point + self.direction.orthogonal_direction.to_point)\n end",
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def Vector3dUnitPerpendicularXY(arg0)\n ret = _invoke(1610744176, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def perpendicular?( vector2 )\n if( dotProduct( vector2 ) == 0 )\n return true\n else\n return false\n end\n end",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def perpendicular?(vector2)\n end",
"def perpendicular_segment(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n return point if self.contains?(point)\n \n l = self.perpendicular_line(point)\n p = Line.new(self.p1, self.p2).intersection(l).first\n\n Segment.new(point, p)\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def Point2dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743831, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743881, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610744182, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def direction\n self.vector.normalize\n end",
"def perpendicular_to?(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n self.direction.dot(other.direction) == 0\n end",
"def inverseDeg!(point)\r\n inverse!(point)\r\n point.x *= Proj4::RAD_TO_DEG\r\n point.y *= Proj4::RAD_TO_DEG\r\n point\r\n end",
"def perp\n Vect2.new(-@y, @x)\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def clockwise points\n ul = Struct.new(:x, :y).new 0, 0\n upper_left = points.min_by { |point| distance point, ul }\n until points.first == upper_left\n points = points.rotate\n end\n points\n end",
"def angle_at(point)\n Point.angle(centre, point)\n end",
"def direction(p0, p1, p2)\n return (p0.x-p1.x)*(p2.y-p1.y) - (p2.x-p1.x)*(p0.y-p1.y)\n end",
"def calc_point_rotated_relative(x,y, theta)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n theta = conv_degree_to_radian(theta)\r\n xr= Math.cos(theta)*x - Math.sin(theta)*y \r\n yr = Math.sin(theta)*x + Math.cos(theta)*y \r\n pRes = CNCPoint.new(xr,yr)\r\nend",
"def normal_vector a_point\n i_point = Point.new()\n i_point.add_object(self)\n plane = Plane.new.add_object(a_point).add_object([self, :normal])\n i_point.add_object(plane)\n Vector.new i_point, a_point\n end",
"def direction\n @direction ||= Vector.new(p2.x - p1.x, p2.y - p1.y)\n end",
"def rotate_around_point(angle, point)\n Point.new(x - point.x, y - point.y).rotate_around_origin(angle) + point\n end",
"def normal(p)\n return (p - @centre).unit\n end",
"def position_along_axis(axis, point)\n axis.dot(point)\n end",
"def normalizePoint(point, normalizer)\n x = point[0] + normalizer[0]\n y = point[1] + normalizer[1]\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x +360 : x\n x = x >= 180 ? x +360 : x\n return [x,y]\n end",
"def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end",
"def rotate_point(x, y, z, cx, cy, cz, angle_x, angle_y, angle_z)\n\t\tx -= cx ; y -= cy; z -= cz\n\n\t\t# rotate around x axis\n\t\tac = Math.cos(angle_x) ; as = Math.sin(angle_x)\n\t\ty2 = y * ac - z * as\n\t\tz2 = z * ac + y * as\n\t\ty = y2\n\t\tz = z2\n\n\t\t# rotate around y axis\n\t\tac = Math.cos(angle_y) ; as = Math.sin(angle_y)\n\t\tx2 = x * ac - z * as\n\t\tz2 = z * ac + x * as\n\t\tx = x2\n\t\tz = z2\n\n\t\t# rotate around z axis\n\t\tac = Math.cos(angle_z) ; as = Math.sin(angle_z)\n\t\ty2 = y * ac - x * as\n\t\tx2 = x * ac + y * as\n\t\ty = y2\n\t\tx = x2\n\n\t\tx += cx ; y += cy; z += cz\n\t\treturn x, y, z\n\tend",
"def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end",
"def polar_point_from(cartesian_point)\n x = cartesian_point.x\n y = cartesian_point.y\n\n r = Math.sqrt((x * x) + (y * y))\n theta = Math.atan2(y, x)\n\n # :Point is the version 2.0.0 point, so it takes r and theta\n Point.new(r, theta)\nend",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end",
"def inverse(x0, y0, z0)\n theta1 = theta2 = theta3 = 0.0\n theta_1 = calc_angle_yz(x0, y0, z0)\n theta_2 = calc_angle_yz(x0*COS_120 + y0*SIN_120, y0*COS_120-x0*SIN_120, z0) # rotate coords to +120 deg\n theta_3 = calc_angle_yz(x0*COS_120 - y0*SIN_120, y0*COS_120+x0*SIN_120, z0) # rotate coords to -120 deg\n\n [theta_1.round(3), theta_2.round(3), theta_3.round(3)]\n end",
"def dir_from_points(x1, y1, x2, y2)\n VECTOR_DIRECTIONS[[x2-x1, y2-y1]].first\n end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def t2pv(v)\n v.direction - 0.5 * PI\n end",
"def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end",
"def clockwise_distance_from_noon point, origin\n x, y = point[:x] - origin[:x], -(point[:y] - origin[:x])\n if x == 0\n return y >= 0 ? 0 : 1\n end\n radians = Math.atan(x.to_f / y) / Math::PI\n if y < 0\n radians += 1\n elsif x < 0\n radians += 2\n end\n radians\nend",
"def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end",
"def dist point\n point = point.pos(false) if point.is_a? Atom\n (point.to_v- @p).to_a * @normal / @normal.magnitude\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def Point3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610743866, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def inverseDeg(point)\r\n inverseDeg!(point.dup)\r\n end",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def dotProduct( vector2 )\n i = @i * vector2.i\n j = @j * vector2.j\n \n pt = Point2D.new(i, j)\n vectorDotProduct = Vector2D.new( 0, 0 )\n vectorDotProduct.initializeWithPoint( pt )\n \n return vectorDotProduct \n \n #@length = Math.sqrt( i**2 + j**2 )\n #@angle = Math.acos( Math.sqrt( @length / ( @length ) ) \n #@direction\n end",
"def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def unit_vector(p1, p2)\n x = p2[0] - p1[0]\n y = p2[1] - p1[1]\n normalize_vector([x,y])\n end",
"def getDirectionWith2Point(point1, point2)\n radian = Math.atan( point1.distanceY(point2) / point1.distanceX(point2) )\n return radianToDegre( radian )\n end",
"def side(p_)\n px_ = p_.x\n py_ = p_.y\n (@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)\n end",
"def forwardDeg!(point)\r\n point.x *= Proj4::DEG_TO_RAD\r\n point.y *= Proj4::DEG_TO_RAD\r\n forward!(point)\r\n end",
"def udot( vector )\n unit.dot( vector.unit )\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def norm\r\n (@real * @real) + @axis.modulus\r\n end",
"def angle_to other_point\n Geometry.angle_to self, other_point\n end",
"def vector_to_direction(x, y)\n return 8 if y > 0 && x == 0\n return 2 if y < 0 && x == 0\n return 6 if x > 0 && y == 0\n return 4 if x < 0 && y == 0\n return 7 if y > 0 && x < 0\n return 1 if y < 0 && x < 0\n return 9 if y > 0 && x > 0\n return 3 if y < 0 && x > 0\n return 0\n end",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def cross(o, p)\n ((p.x - o.x) * (self.y - o.y) - (p.y - o.y) * (self.x - o.x)).round(CROSS_PRODUCT_ROUNDING)\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def rotate( vector )\n\t\t\t(self.inverse * self.class.new(vector) * self ).vec \n\t\tend",
"def distance(point)\n Math.hypot(point.x - x, point.y - y)\n end",
"def Point3dSmallerAngleBetweenUnorientedVectorsXY(arg0, arg1)\n ret = _invoke(1610743863, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def surfacedirection(face)\n vect = face.normal\n hvector = Geom::Vector3d.new(0, 0, 1)\n ang = hvector.angle_between vect\n return ang\nend",
"def pinv_left\n (transpose * self).inv * transpose\n end",
"def roll_to(x, y)\n\n\t\t@end_point[0]\t= x - @x_center\n\t\t@end_point[1]\t= y - @y_center\n\n\n\t\t# Not enough change in the vectors to have an action ?\n\t\tif (@end_point[0] - @start_point[0]).abs < TOL and (@end_point[1] - @start_point[1]).abs < TOL then\n\t\t\treturn\n\t\tend\n\n\n\t\t# Compute the ending vector from the surface of the ball to its center :\n\t\tdistance = @end_point[0] * @end_point[0] + @end_point[1] * @end_point[1]\n\n\t\tif distance > @radius * @radius then\n\t\t\t@end_point[2]\t= 0\n\t\telse\n\t\t\t@end_point[2]\t= Math.sqrt(@radius * @radius - distance)\n\t\tend\n\n\n\t\t# Take the cross product of the two vectors. r = s X e :\n\t\t@rotation[1]\t= @start_point[1] * @end_point[2] - @start_point[2] * @end_point[1]\n\t\t@rotation[2]\t= -@start_point[0] * @end_point[2] + @start_point[2] * @end_point[0]\n\t\t@rotation[3]\t= @start_point[0] * @end_point[1] - @start_point[1] * @end_point[0]\n\n\n\t\t# Use atan for a better angle. If you use only cos or sin, you only get half\n\t\t# the possible angles, and you can end up with rotations that flip around near\n\t\t# the poles.\n\n\t\t# cos(a) = (s . e) / (||s|| ||e||)\n\t\tcos_angle\t=\t@start_point[0] * @end_point[0] +\t\t# (s . e)\n\t\t\t\t\t\t@start_point[1] * @end_point[1] +\n\t\t\t\t\t\t@start_point[2] * @end_point[2]\n\n\t\ts\t\t\t= Math.sqrt(@start_point[0] * @start_point[0] +\n\t\t\t\t\t\t\t\t@start_point[1] * @start_point[1] +\n\t\t\t\t\t\t\t\t@start_point[2] * @start_point[2])\n\n\t\te\t\t\t= Math.sqrt(@end_point[0] * @end_point[0] +\n\t\t\t\t\t\t\t\t@end_point[1] * @end_point[1] +\n\t\t\t\t\t\t\t\t@end_point[2] * @end_point[2])\n\n\t\tcos_angle\t= cos_angle.quo(s).quo(e)\n\n\t\t# sin(a) = ||(s X e)|| / (||s|| ||e||)\n\t\tsin_angle\t= Math.sqrt(@rotation[1] * @rotation[1] +\t\t# ||(s X e)||\n\t\t\t\t\t\t\t\t@rotation[2] * @rotation[2] +\n\t\t\t\t\t\t\t\t@rotation[3] * @rotation[3])\n r\t\t\t= sin_angle # keep this length in lr for normalizing the rotation vector later.\n\n\t\tsin_angle\t= sin_angle.quo(s).quo(e)\n\n\t\t# GL rotations are in degrees :\n\t\trotation[0] = Math.atan2 (sin_angle, cos_angle) * RADIANS_TO_DEGREES\n\n\n\t\t# Normalize the rotation axis :\n\t\t@rotation[1] = @rotation[1].quo(r);\n\t\t@rotation[2] = @rotation[2].quo(r);\n\t\t@rotation[3] = @rotation[3].quo(r);\n\n\tend",
"def Vector3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610744172, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def orientation\n p1, p2, p3 = *convex_sub_polygon\n det = (p2[0]-p1[0])*(p3[1]-p1[1]) - (p3[0]-p1[0])*(p2[1]-p1[1])\n @orientation ||= (det < 0)? 1 : -1\n end",
"def barycentric(v)\n if contains(v)\n v0 = @points[:b] - @points[:a]\n v1 = @points[:c] - @points[:a]\n v2 = v - @points[:a]\n \n d00 = v0.dot_product(v0)\n d01 = v0.dot_product(v1)\n d11 = v1.dot_product(v1)\n d20 = v2.dot_product(v0)\n d21 = v2.dot_product(v1)\n \n denom = d00 * d11 - d01 * d01\n \n v = (d11 * d20 - d01 * d21) / denom\n w = (d00 * d21 - d01 * d20) / denom\n u = 1.0 - v - w\n \n [v.round(2), w.round(2), u.round(2)]\n else\n return nil\n end\n end",
"def perp\n self.class.new( -@y, @x )\n end",
"def rotate!(angle, *args)\n x, y, z = if args.length == 1 then [args[0].x, args[0].y, args[0].z]\n elsif args.length == 3 then [args[0], args[1], args[2]]\n elsif args.length == 4 then raise \"Four dimensional vector rotation is not yet implemented\"\n else raise \"Expected either a Vector3d or x, y and z arguments\"\n end\n\n\n # Calculate the sine and cosine of the angle once\n costheta = cos(angle)\n sintheta = sin(angle)\n\n # Find the new x position of the rotated vector\n rx = (costheta + (1 - costheta) * x * x) * self.x +\n ((1 - costheta) * x * y - z * sintheta) * self.y +\n\t ((1 - costheta) * x * z + y * sintheta) * self.z\n\n\t# Find the new y position for the new rotated point\n ry = ((1 - costheta) * x * y + z * sintheta) * self.x +\n\t (costheta + (1 - costheta) * y * y) * self.y +\n\t ((1 - costheta) * y * z - x * sintheta) * self.z\n\n\t# Find the new z position for the new rotated point\n\trz = ((1 - costheta) * x * z - y * sintheta) * self.x +\n\t ((1 - costheta) * y * z + x * sintheta) * self.y +\n\t (costheta + (1 - costheta) * z * z) * self.z\n\n self.x, self.y, self.z = rx, ry, rz\n self\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def calculate_norm_and_orientation\n x, y = @components.values\n @norm = Math.sqrt( x**2 + y**2 )\n @orientation = calculate_orientation\n end",
"def angle_from other_point\n Geometry.angle_from self, other_point\n end",
"def calc_point_rotated_abs(x,y, angle)\r\n# - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n curr_angle = calc_angle(0,0,x,y)\r\n rel_amt = angle - curr_angle\r\n return calc_point_rotate_relative(x,y,rel_amt)\r\nend",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def dot v\n @x*v.x + @y*v.y\n end",
"def angle_between v\n pdotp = perpdot(v)\n dotp = dot(v)\n Math.atan2(pdotp, dotp)\n end",
"def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end",
"def calc_point_from_angle(cx, cy, angle, length)\r\n # - - - - - - - - - - - - - - - - - - - - -\r\n #System.Convert.ToInt32(System.Convert.ToDouble(originX) * Math.Cos(radians)), originY + #System.Convert.ToInt32(System.Convert.ToDouble(originY) * Math.Sin(radians)))\r\n # radians = (90 - angle) * degree_to_radian;\r\n if (angle > 360) \r\n angle = angle % 360\r\n end #if\r\n #print \"(cx=\", cx, \" cy=\", cy, \" angle=\", angle, \", length=\", length, \")\\n\"\r\n\r\n #if (angle > 360)\r\n # angle = angle % 360.0\r\n\r\n \r\n quad = 1\r\n tang = angle\r\n\r\n## if (angle == 9999)\r\n## if (angle == 0)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 90)\r\n## return CNCPoint.new(cx + length, cy)\r\n## elsif(angle == 180)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle == 270)\r\n## return CNCPoint.new(cx - length, cy)\r\n## elsif(angle == 360)\r\n## return CNCPoint.new(cx, cy - length)\r\n## elsif (angle > 90)\r\n## quad = 2\r\n## tang -= 90\r\n## elsif (angle > 180)\r\n## quad = 3\r\n## tang -= 180\r\n## elsif (angle > 270)\r\n## quad = 4\r\n## tang -= 180\r\n## end #else\r\n## end # 99999\r\n## #print \"tang = \", tang, \" quad=\", quad, \"\\n\"\r\n##\r\n\r\n radians = conv_degree_to_radian(tang -90)\r\n\r\n\r\n new_x = cx + Math.cos(radians) * (length)\r\n new_y = cy + Math.sin(radians) * (length)\r\n\r\n #print \"(new_x = \", new_x, \" new_y=\", new_y, \")\\n\"\r\n##\r\n## if (angle == 9999)\r\n## case quad\r\n## when 1\r\n## # nothing needs to be done\r\n## when 2\r\n## # x is ok\r\n## #new_y = 0 - new_y\r\n## when 3\r\n## new_x = 0 - new_x\r\n## new_y = 0 - new_y\r\n## when 4\r\n## new_x = 0 - new_x\r\n## end\r\n## end # 9999\r\n##\r\n\r\n aRes = CNCPoint.new(new_x, new_y)\r\n return aRes\r\n end",
"def euclidian_distance(point)\n Math.hypot((point.x - x),(point.y - y))\n end",
"def cross( vector )\n (@x * vector.y) - (@y * vector.x)\n end",
"def angle\n Math.atan2( @y, @x )\n end",
"def rotate_around_origin(angle)\n sin_of_angle = Math.sin(angle)\n cos_of_angle = Math.cos(angle)\n\n Point.new(\n x * cos_of_angle - y * sin_of_angle,\n x * sin_of_angle + y * cos_of_angle\n )\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end",
"def Point3dAngleBetweenVectorsXY(arg0, arg1)\n ret = _invoke(1610743862, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend"
] |
[
"0.84725606",
"0.8445147",
"0.79070705",
"0.7387362",
"0.726888",
"0.6961713",
"0.69616884",
"0.69308436",
"0.6876227",
"0.6759432",
"0.6744622",
"0.65205276",
"0.6508336",
"0.62611634",
"0.6167133",
"0.5951923",
"0.5915763",
"0.5875389",
"0.57905275",
"0.57902783",
"0.57866347",
"0.57641923",
"0.57554",
"0.5730116",
"0.5702149",
"0.5689111",
"0.5650811",
"0.5642702",
"0.56035155",
"0.5594563",
"0.558375",
"0.55770844",
"0.557534",
"0.55673903",
"0.5553663",
"0.55332315",
"0.55281186",
"0.5523874",
"0.5505712",
"0.5505712",
"0.5499754",
"0.54957324",
"0.549109",
"0.5488763",
"0.5416667",
"0.5410261",
"0.53975654",
"0.5328831",
"0.5317365",
"0.529615",
"0.52655566",
"0.52605116",
"0.52605116",
"0.52539766",
"0.52363795",
"0.52361095",
"0.5232978",
"0.5230437",
"0.5216163",
"0.5216163",
"0.52160186",
"0.52109045",
"0.51975495",
"0.518179",
"0.51651317",
"0.5161486",
"0.5161431",
"0.51612324",
"0.51459426",
"0.5142049",
"0.5137369",
"0.51327264",
"0.51306933",
"0.512727",
"0.51045996",
"0.5101543",
"0.50998354",
"0.50857544",
"0.50819516",
"0.50778073",
"0.50709707",
"0.50633067",
"0.5063034",
"0.5048625",
"0.50397694",
"0.50362307",
"0.5024633",
"0.50218433",
"0.50203174",
"0.5012139",
"0.4997014",
"0.49962658",
"0.4995475",
"0.49875653",
"0.49767488",
"0.4973306",
"0.4968262",
"0.49511343",
"0.49492052",
"0.49461463",
"0.49447557"
] |
0.0
|
-1
|
Perpendicular of v, rotated 90 degrees clockwise
|
def bbpRPerp(point)
bbp(point.y, -point.x)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def perpendicular\n Vector2d.new(-@y, @x)\n end",
"def perpendicular\n Vector2d.new(-y, x)\n end",
"def unit_perpendicular_vector(options={})\n return [self[1], -self[0]].unit_vector if options[:counter_clockwise]\n [-self[1], self[0]].unit_vector\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def perpendicular?( vector2 )\n if( dotProduct( vector2 ) == 0 )\n return true\n else\n return false\n end\n end",
"def perpendicular?(vector2)\n end",
"def t2pv(v)\n v.direction - 0.5 * PI\n end",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end",
"def Vector3dUnitPerpendicularXY(arg0)\n ret = _invoke(1610744176, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def perpendicular_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n # any two lines in R^2 intersect, so blindly making\n # a line through p in an orthogonal direction will work\n Line.new(point, point + self.direction.orthogonal_direction.to_point)\n end",
"def Point3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743881, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def Point2dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610743831, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dAreVectorsPerpendicular(arg0, arg1)\n ret = _invoke(1610744182, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def angle_between v\n pdotp = perpdot(v)\n dotp = dot(v)\n Math.atan2(pdotp, dotp)\n end",
"def cross(v)\n (@x * v.y) - (@y * v.x)\n end",
"def barycentric(v)\n if contains(v)\n v0 = @points[:b] - @points[:a]\n v1 = @points[:c] - @points[:a]\n v2 = v - @points[:a]\n \n d00 = v0.dot_product(v0)\n d01 = v0.dot_product(v1)\n d11 = v1.dot_product(v1)\n d20 = v2.dot_product(v0)\n d21 = v2.dot_product(v1)\n \n denom = d00 * d11 - d01 * d01\n \n v = (d11 * d20 - d01 * d21) / denom\n w = (d00 * d21 - d01 * d20) / denom\n u = 1.0 - v - w\n \n [v.round(2), w.round(2), u.round(2)]\n else\n return nil\n end\n end",
"def cross(v)\n (v.y * x) - (v.x * y)\n end",
"def dot v\n @x*v.x + @y*v.y\n end",
"def cross v\n x = @y * v.z - @z * v.y\n y = @z * v.x - @x * v.z\n z = @x * v.y - @y * v.x\n Vector.new x, y, z\n end",
"def dot(v)\n @x * v.x + @y * v.y\n end",
"def dot v \n @x * v.x + @y * v.y + @z * v.z\n end",
"def direction\n self.vector.normalize\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def udot( vector )\n unit.dot( vector.unit )\n end",
"def rotate( vector )\n\t\t\t(self.inverse * self.class.new(vector) * self ).vec \n\t\tend",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def perpendicular_segment(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n return point if self.contains?(point)\n \n l = self.perpendicular_line(point)\n p = Line.new(self.p1, self.p2).intersection(l).first\n\n Segment.new(point, p)\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def perp\n Vect2.new(-@y, @x)\n end",
"def to_v\n Vector3.new(@x, @y, @z)\n end",
"def bisector_angle_to_x(v)\n t.angle(v) / 2 + angle_to_x(v)\n end",
"def dotProduct( vector2 )\n i = @i * vector2.i\n j = @j * vector2.j\n \n pt = Point2D.new(i, j)\n vectorDotProduct = Vector2D.new( 0, 0 )\n vectorDotProduct.initializeWithPoint( pt )\n \n return vectorDotProduct \n \n #@length = Math.sqrt( i**2 + j**2 )\n #@angle = Math.acos( Math.sqrt( @length / ( @length ) ) \n #@direction\n end",
"def normalize_vector(v)\n d = v[0]*v[0] + v[1]*v[1]\n if d != 1\n root = Math.sqrt(d)\n v[0] /= root\n v[1] /= root\n end\n v\n end",
"def unit_vector(p1, p2)\n x = p2[0] - p1[0]\n y = p2[1] - p1[1]\n normalize_vector([x,y])\n end",
"def dist(v)\n dx = v.x - @x\n dy = v.y - @y\n Math.sqrt(dx*dx + dy*dy)\n end",
"def to_v\n Vector2.new(@x, @y)\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def Point3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610743866, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross( vector )\n (@x * vector.y) - (@y * vector.x)\n end",
"def angle_to_x(v)\n case v\n when :a then 0.0\n when :b then -(t.angle(:b) + t.angle(:c))\n when :c then Math::PI - t.angle(:c)\n end\n end",
"def rotation_matrix(r, v)\n v = vector_normalize(v)\n cosr = Math.cos(r)\n sinr = Math.sin(r)\n vx, vy, vz = v\n new_matrix(4, 4, [ cosr + (1-cosr)*vx*vx, (1-cosr)*vx*vy - vz*sinr, (1-cosr)*vx*vz + vy*sinr, 0,\n (1-cosr)*vx*vy + vz*sinr, cosr + (1-cosr)*vy*vy, (1-cosr)*vy*vz - vx*sinr, 0,\n (1-cosr)*vx*vz - vy*sinr, (1-cosr)*vy*vz + vx*sinr, cosr + (1-cosr)*vz*vz, 0,\n 0, 0, 0, 1 ])\nend",
"def normal_vector a_point\n i_point = Point.new()\n i_point.add_object(self)\n plane = Plane.new.add_object(a_point).add_object([self, :normal])\n i_point.add_object(plane)\n Vector.new i_point, a_point\n end",
"def dot( vector )\n (@x * vector.at(0)) + (@y * vector.at(1))\n end",
"def degree(v)\n in_degree(v) + out_degree(v)\n end",
"def cross_product(vector)\n x * vector.y - y * vector.x\n end",
"def perpendicular_to?(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n self.direction.dot(other.direction) == 0\n end",
"def norm(v)\n len = Math.sqrt(v[0]**2 + v[1]**2)\n [v[0] / len, v[1] / len] \nend",
"def Vector3dPlanarAngleBetweenVectors(arg0, arg1, arg2)\n ret = _invoke(1610744172, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def pinv_left\n (transpose * self).inv * transpose\n end",
"def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def draw_vector(v, loc, scayl)\n push_matrix\n arrowsize = 4\n # Translate to location to render vector\n translate(loc.x, loc.y)\n stroke(255)\n # Call vector heading function to get direction (note that pointing up is a heading of 0) and rotate\n rotate(v.heading2D)\n # Calculate length of vector & scale it to be bigger or smaller if necessary\n len = v.mag * scayl\n # Draw three lines to make an arrow (draw pointing up since we've rotate to the proper direction)\n line(0, 0, len, 0)\n line(len, 0, len-arrowsize, +arrowsize/2)\n line(len, 0, len-arrowsize, -arrowsize/2)\n pop_matrix\nend",
"def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend",
"def vertex_value_coords(v)\n x, y = *polar_to_cartesian(bisector_angle_to_x(v), VERTEX_VALUE_MARGIN)\n [ @coords[v][0] + x, @coords[v][1] - y ]\n end",
"def direction\n @direction ||= Vector.new(p2.x - p1.x, p2.y - p1.y)\n end",
"def transform(vec)\n return getRotationMatrix() * vec\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def reflect_vertical\r\n self.v[:y] = -self.v[:y]\r\n end",
"def projection(vect1, vect2)\n d = vect2.dot(vect2)\n\n if 0 < d\n dp = vect1.dot(vect2)\n vect2 * (dp / d)\n else\n vect2\n end\n end",
"def rotate!(angle, *args)\n x, y, z = if args.length == 1 then [args[0].x, args[0].y, args[0].z]\n elsif args.length == 3 then [args[0], args[1], args[2]]\n elsif args.length == 4 then raise \"Four dimensional vector rotation is not yet implemented\"\n else raise \"Expected either a Vector3d or x, y and z arguments\"\n end\n\n\n # Calculate the sine and cosine of the angle once\n costheta = cos(angle)\n sintheta = sin(angle)\n\n # Find the new x position of the rotated vector\n rx = (costheta + (1 - costheta) * x * x) * self.x +\n ((1 - costheta) * x * y - z * sintheta) * self.y +\n\t ((1 - costheta) * x * z + y * sintheta) * self.z\n\n\t# Find the new y position for the new rotated point\n ry = ((1 - costheta) * x * y + z * sintheta) * self.x +\n\t (costheta + (1 - costheta) * y * y) * self.y +\n\t ((1 - costheta) * y * z - x * sintheta) * self.z\n\n\t# Find the new z position for the new rotated point\n\trz = ((1 - costheta) * x * z - y * sintheta) * self.x +\n\t ((1 - costheta) * y * z + x * sintheta) * self.y +\n\t (costheta + (1 - costheta) * z * z) * self.z\n\n self.x, self.y, self.z = rx, ry, rz\n self\n end",
"def inverse(x0, y0, z0)\n theta1 = theta2 = theta3 = 0.0\n theta_1 = calc_angle_yz(x0, y0, z0)\n theta_2 = calc_angle_yz(x0*COS_120 + y0*SIN_120, y0*COS_120-x0*SIN_120, z0) # rotate coords to +120 deg\n theta_3 = calc_angle_yz(x0*COS_120 - y0*SIN_120, y0*COS_120+x0*SIN_120, z0) # rotate coords to -120 deg\n\n [theta_1.round(3), theta_2.round(3), theta_3.round(3)]\n end",
"def direction(p0, p1, p2)\n return (p0.x-p1.x)*(p2.y-p1.y) - (p2.x-p1.x)*(p0.y-p1.y)\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def cos(v); Math.cos(v); end",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def vector_to_direction(x, y)\n return 8 if y > 0 && x == 0\n return 2 if y < 0 && x == 0\n return 6 if x > 0 && y == 0\n return 4 if x < 0 && y == 0\n return 7 if y > 0 && x < 0\n return 1 if y < 0 && x < 0\n return 9 if y > 0 && x > 0\n return 3 if y < 0 && x > 0\n return 0\n end",
"def mirror_angle_vertically!\n @angle = (180 - @angle) % 360\n end",
"def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end",
"def vertex_label_coords(v)\n x, y = *polar_to_cartesian(bisector_angle_to_x(v), VERTEX_LABEL_MARGIN)\n [ @coords[v][0] - x, @coords[v][1] + y ]\n end",
"def crossProduct( vector2 )\n @angle = self.getAngleOf2Vector(vector2)\n @lenght = @length * vector2.length * @angle\n return 0\n end",
"def subtract v\n Vector.new @x - v.x, @y - v.y, @z - v.z\n end",
"def vel=(v)\n self.mo = Vector[mo[0], *(mo[0]*v.normalize)]\n end",
"def inverseDeg!(point)\r\n inverse!(point)\r\n point.x *= Proj4::RAD_TO_DEG\r\n point.y *= Proj4::RAD_TO_DEG\r\n point\r\n end",
"def translate(vector)\n Point.new(*to_a.zip(vector.to_a).map { |a, b| a + b})\n end",
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def velocity\n x, y = dx_dy\n V[x, y]\n end",
"def directions\n vectors.map {|v| v.direction }\n end",
"def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end",
"def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end",
"def norm\r\n (@real * @real) + @axis.modulus\r\n end",
"def Point3dSmallerAngleBetweenUnorientedVectors(arg0, arg1)\n ret = _invoke(1610743857, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end",
"def vertex_value(v)\n x, y = *vertex_value_coords(v)\n label(x, y, format_angle(f.angle(v), t.angles.unit))\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def Point3dSmallerAngleBetweenUnorientedVectorsXY(arg0, arg1)\n ret = _invoke(1610743863, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def draw_vector3d(view, p, vector, color=nil, t=IDENTITY)\n return unless vector.valid? # Invalid vectors cannot be shown.\n # Project to the screen plane.\n p1 = view.screen_coords(p.transform(t))\n p2 = view.screen_coords(p.transform(t) + vector)\n p1.z = p2.z = 0\n vec = p1.vector_to(p2)\n # If the last viewed point is out of the viewport, take the viewport center.\n w = view.vpwidth\n h = view.vpheight\n if p1.x < 0 || p1.x > w || p1.y < 0 || p1.y > h\n p1 = Geom::Point3d.new(w/2, h/2, 0)\n p2 = p1 + vec\n end\n # Clip the second point if it lays outside the viewport.\n p2 = Geom.intersect_line_line([p1, vec], [[0, 0, 0], Y_AXIS]) || p2 if p2.x < 0\n p2 = Geom.intersect_line_line([p1, vec], [[w, 0, 0], Y_AXIS]) || p2 if p2.x > w\n p2 = Geom.intersect_line_line([p1, vec], [[0, 0, 0], X_AXIS]) || p2 if p2.y < 0\n p2 = Geom.intersect_line_line([p1, vec], [[0, h, 0], X_AXIS]) || p2 if p2.y > h\n # Draw the vector direction.\n view.drawing_color = color unless color.nil?\n view.draw2d(GL_LINE_STRIP, p1, p2)\n # Draw an arrow at the end of the vector.\n vec.length = 9 # pixels\n side = vec * Z_AXIS\n arrow = [p2, p2-vec-vec+side, p2-vec-vec-side]\n view.draw2d(GL_POLYGON, arrow)\n end",
"def / ( *vector_or_number ); v = Vector2d::new( vector_or_number ); Vector2d.new( @x / v.x, @y / v.y ); end",
"def drawVector(v, loc, scale)\n push_matrix\n arrowsize = 5.\n # Translate to location to render vector\n translate(loc.x,loc.y);\n # Call vector heading function to get direction (note that pointing up is a heading of 0) and rotate\n rotate(v.heading2D());\n # Calculate length of vector & scale it to be bigger or smaller if necessary\n len = v.mag()*scale\n # Draw three lines to make an arrow (draw pointing up since we've rotate to the proper direction)\n line(0,0,len,0);\n line(len,0,len-arrowsize,+arrowsize/2);\n line(len,0,len-arrowsize,-arrowsize/2);\n pop_matrix();\n end",
"def frac(vector) \n @xyz2abc * vector.to_v \n end",
"def dot(*args)\n vx, vy, vz = args.extract_vector3i!\n x * vx + y * vy + z * vz\n end",
"def voltdiv vin, r1, r2\n _vout = vin * (r2 / (r1 + r2))\nend",
"def Vector3dSmallerAngleBetweenUnorientedVectorsXY(arg0, arg1)\n ret = _invoke(1610744169, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def orientation\n p1, p2, p3 = *convex_sub_polygon\n det = (p2[0]-p1[0])*(p3[1]-p1[1]) - (p3[0]-p1[0])*(p2[1]-p1[1])\n @orientation ||= (det < 0)? 1 : -1\n end",
"def position_along_axis(axis, point)\n axis.dot(point)\n end"
] |
[
"0.80740994",
"0.7921457",
"0.7710163",
"0.7406525",
"0.7062313",
"0.67770284",
"0.6703746",
"0.6518436",
"0.6511605",
"0.6462271",
"0.64549756",
"0.6437465",
"0.6342875",
"0.6322139",
"0.6322139",
"0.62588733",
"0.625105",
"0.6206751",
"0.61886746",
"0.61436343",
"0.612333",
"0.607276",
"0.60189885",
"0.59985447",
"0.59926456",
"0.59898776",
"0.59778905",
"0.59778905",
"0.5964244",
"0.5919483",
"0.5896696",
"0.58646834",
"0.5825184",
"0.5825184",
"0.5795168",
"0.57575274",
"0.5747901",
"0.5736839",
"0.5717566",
"0.57129073",
"0.56867355",
"0.5682316",
"0.5646992",
"0.56049657",
"0.5600395",
"0.55377954",
"0.5531219",
"0.55269915",
"0.5483585",
"0.54696643",
"0.54546994",
"0.54466796",
"0.54422677",
"0.5411693",
"0.5410478",
"0.5376622",
"0.5370818",
"0.5370631",
"0.5367423",
"0.5347587",
"0.53419936",
"0.5337195",
"0.5331968",
"0.5324003",
"0.53201294",
"0.5317737",
"0.52937555",
"0.5289269",
"0.52644783",
"0.52560854",
"0.5250215",
"0.52404916",
"0.5234063",
"0.52103204",
"0.51939476",
"0.51928407",
"0.5191197",
"0.5173396",
"0.5168257",
"0.5167406",
"0.5167312",
"0.5129815",
"0.51172477",
"0.51039815",
"0.5099842",
"0.50827444",
"0.5079407",
"0.50751805",
"0.5063319",
"0.505805",
"0.5042296",
"0.5036638",
"0.5035381",
"0.5031672",
"0.5021081",
"0.5006187",
"0.49919713",
"0.49869204",
"0.49848494",
"0.49793085",
"0.497043"
] |
0.0
|
-1
|
Projection of first point over second point
|
def bbpProject(first_point, second_point)
bbpMult(second_point, bbpDot(first_point, second_point) / bbpDot(second_point, second_point))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end",
"def transform(otherProjection, point)\r\n transform!(otherProjection, point.dup)\r\n end",
"def projection(vect1, vect2)\n d = vect2.dot(vect2)\n\n if 0 < d\n dp = vect1.dot(vect2)\n vect2 * (dp / d)\n else\n vect2\n end\n end",
"def project x1, y1, a, m\n rad = a * D2R\n [x1 + Math.cos(rad) * m, y1 + Math.sin(rad) * m]\n end",
"def create_projected_point_from_projected_coord(x, y)\n Rails.logger.debug \"RgeoGeometryAdapter Creating projected point geometry from x = #{x}, y = #{y}\"\n @geometry_factory.projection_factory.point(x, y) \n end",
"def %( other )\n\t\t\treturn Projection.new( self, other )\n\t\tend",
"def vector_to(point2)\n end",
"def calculate_road p0, p1\n # unit vector pointing from p0 to p1\n n = (p1 - p0).normalize.normal_vector * ROAD_WIDTH\n \n a = p0 + n\n b = p0 - n\n c = p1 + n\n d = p1 - n\n [a, b, c, d]\n end",
"def projected_onto( vector )\n dup.project_onto!( vector )\n end",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def inqorthographicprojection\n inquiry([:double] * 6) do |*pts|\n super(*pts)\n end\n end",
"def inqorthographicprojection\n inquiry([:double] * 6) do |*pts|\n super(*pts)\n end\n end",
"def projection_distances a, b\n result = []\n\n # cache dab stuff, used a number of times\n dab = distance a,b \n dab_sqrd = dab ** 2\n dab2 = dab * 2\n\n @size.times do |i|\n if i==a\n # boundary case; projecting start pt onto itself, so distance to start is zero\n result << 0.0\n elsif i==b\n # boundary case; projecting end pt onto itself, so distance to start if full length\n result << dab\n else\n # project other point onto line between a and b\n dai = distance a,i\n dbi = distance b,i\n dist = ( dai**2 + dab_sqrd - dbi**2 ) / dab2\n# puts \"a#{a} b#{b} i#{i} dab=#{dab} dai=#{dai} dbi=#{dbi} => dist=#{dist}\"\n result << dist \n end\n end\n\n result\n end",
"def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end",
"def to_outer(point)\n transform * point\n end",
"def coord_geographic\n FACTORY.unproject(self.coord)\n end",
"def getNormalPoint(p, a, b) \n # Vector from a to p\n ap = PVector.sub(p,a)\n # Vector from a to b\n ab = PVector.sub(b,a)\n ab.normalize # Normalize the line\n # Project vector \"diff\" onto line by using the dot product\n ab.mult(ap.dot(ab))\n normalPoint = PVector.add(a,ab)\n return normalPoint\n end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def inqperspectiveprojection\n inquiry %i[double double double] do |*pts|\n super(*pts)\n end\n end",
"def inqperspectiveprojection\n inquiry %i[double double double] do |*pts|\n super(*pts)\n end\n end",
"def create_unprojected_point(x, y)\n Rails.logger.debug \"RgeoGeometryAdapter Creating unprojected point geometry from x = #{x}, y = #{y}\"\n projected_geometry = @geometry_factory.projection_factory.point(x, y)\n Rails.logger.debug \"Projected Point = #{projected_geometry.to_s}\"\n @geometry_factory.unproject(projected_geometry)\n end",
"def mid\n mid_of_x = (@p2.x - @p1.x) / 2 + @p1.x\n mid_of_y = (@p2.y - @p1.y) / 2 + @p1.y\n BPoint.new(mid_of_x, mid_of_y)\n end",
"def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end",
"def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end",
"def to_multipoint\n point1, point2 = self.to_utm \n GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([ [ point1.e, point1.n ], [ point2.e, point2.n ] ])\n end",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def to_point\n CGPoint.new(first, second)\n end",
"def mirror\n point3.mirror!\n end",
"def random_point_around(point1, point2)\n half_way = [point2.first - point1.first, point2.last - point1.last]\n half_way = [half_way.first/2.0, half_way.last/2.0]\n center = [point1.first + half_way.first, point1.last + half_way.last]\n\n random_part = rand_scale( rotate90(half_way) )\n [center.first + random_part.first, center.last + random_part.last]\n end",
"def untransformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])/@zoom + (@old_center[i] - @center[i]) + @old_center[i]\r\n end\r\n end",
"def perp\n self.class.new( -@y, @x )\n end",
"def project_onto(a)\n a * self.dot(a.normalize)\n end",
"def warp(x, y)\n @x, @y = x, y\n end",
"def warp(x, y)\n @x, @y = x, y\n end",
"def midpoint\n Point.new((x1 + x2) / 2, (y1 + y2) / 2)\n end",
"def lerp(x1, y1, x2, y2, x)\n return y1 + (x - x1) * ((y2 - y1) / (x2 - x1))\nend",
"def warp(x, y)\n\t\t@x, @y = x, y\n\tend",
"def get_new_point(lat1, lon1, lat2, lon2, distance)\n\n length = RoadRollerHelper.get_line_length(lat1, lon1, lat2, lon2)\n fraction_length = distance/length\n\n lat_new = lat1 + fraction_length * (lat2-lat1)\n lon_new = lon1 + fraction_length * (lon2-lon1)\n\n return lat_new, lon_new\n end",
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def perp\n Vect2.new(-@y, @x)\n end",
"def test_inverse_gk\n result = @proj_gk.inverse( Proj4::Point.new(@rw, @hw) ) \n assert_in_delta @lon, rad2deg(result.x), 0.000000001\n assert_in_delta @lat, rad2deg(result.y), 0.000000001\n end",
"def project_onto!( vector )\n raise \"can't modify frozen object\" if frozen?\n b = vector.unit\n @x, @y = *(b.scale(self.dot(b)))\n @hash = nil\n self\n end",
"def soustraction( vector2 )\n i = vector2.i - @i\n j = vector2.j - @j\n pt = Point2D.new(i, j)\n vectorSoust = Vector2D.new( 0, 0 )\n vectorSoust.initializeWithPoint( pt )\n \n return vectorSoust \n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def unit_vector(p1, p2)\n x = p2[0] - p1[0]\n y = p2[1] - p1[1]\n normalize_vector([x,y])\n end",
"def one_point_crossover(other)\n point_crossover(other, 1)\n end",
"def two_point_crossover(other)\n point_crossover(other, 2)\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def direction(p0, p1, p2)\n return (p0.x-p1.x)*(p2.y-p1.y) - (p2.x-p1.x)*(p0.y-p1.y)\n end",
"def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def project_to_plane\n end",
"def right\n @x_min + @y_min\n end",
"def bbpCross(first_point, second_point)\n\n first_point.x * second_point.y - first_point.y * second_point.x\n end",
"def double\n return self if infinity?\n gamma = field.mod((3 * x * x + @group.param_a) * field.inverse(2 * y))\n new_x = field.mod(gamma * gamma - 2 * x)\n new_y = field.mod(gamma * (x - new_x) - y)\n self.class.new(group, new_x, new_y)\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def eq_for_coordinates(p, s, t)\n q, r = first_point, second_point\n s, t = s.to_s+\"_to\", t.to_s + \"_to\"\n p.send(t,q)+r.send(s,q)+\"-\"+p.send(s,q)+r.send(t,q)\n end",
"def get_transformation(circ)\n p1 = get_triple\n p2 = circ.get_triple.reverse\n\n m1 = Matrix.cross_ratio(p1)\n m2 = Matrix.cross_ratio(p2).proj_inv\n\n m2 * m1\n end",
"def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end",
"def translate_to_point(*location)\n p = Point.new(*location)\n Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1)))\n end",
"def transform_all!(otherProjection, collection)\r\n collection.each do |point|\r\n transform!(otherProjection, point)\r\n end\r\n collection\r\n end",
"def test_forward_gk\n result = @proj_gk.forward( Proj4::Point.new( deg2rad(@lon), deg2rad(@lat) ) ) \n assert_in_delta @rw, result.x, 0.1\n assert_in_delta @hw, result.y, 0.1\n end",
"def Point2dInterpolate(arg0, arg1, arg2)\n ret = _invoke(1610743815, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end",
"def getAt(x1, y1, x2, y2)\n if x1 == 0 || y1 == 0\n if x1 == 0 && y1 == 0\n return @sa[y2*@width + x2]\n elsif x1 == 0 && y1 != 0\n return @sa[y2*@width + x2] - @sa[(y1-1)*@width + x2]\n else # x1 != 0 && y1 == 0\n ty2 = y2*@width\n return @sa[ty2 + x2] - @sa[y2 + (x1 - 1)]\n end\n else\n tx1, ty1, tx2, ty2 = x1-1, (y1-1)*@width, x2, y2*@width\n return @sa[ty2 + tx2] - @sa[ty1 + tx2] - @sa[ty2 + tx1] + @sa[ty1 + tx1]\n end\n end",
"def to_local(point)\n inverse * point\n end",
"def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend",
"def x_center\r\n (@x1 + (@x2 - @x1) / 2).round\r\n end",
"def center(other_point)\n Point.new((self.x + other_point.x)/2.0, (self.y + other_point.y)/2.0)\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def orthodrome_midpoint(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n x = cola2 * Math.cos(dlon)\n y = cola2 * Math.sin(dlon)\n\n lat = Math.atan2(sila1+sila2, Math.sqrt((cola1+x)**2 + y*y)) / RAD_PER_DEG\n lon = lon1 + Math.atan2(y,cola1+x) / RAD_PER_DEG\n\n [lat,lon]\n end",
"def to_chipmunk\n\t\tself.normalize!\n\t\t@points.collect { |point| vec2(point[0] - self.center_x, point[1] - self.center_y) }\n\tend",
"def create_projected_point(lng, lat)\n Rails.logger.debug \"RgeoGeometryAdapter Creating point geometry from lng = #{lng}, lat = #{lat}\"\n @geometry_factory.project(create_point(lng, lat))\n end",
"def vector\n\t\treturn [(end_lng - start_lng), (end_lat - start_lat)]\n\tend",
"def get_real_point\n pos_x = x * get_scale(:x)\n pos_y = y * get_scale(:y)\n return Point.new(pos_x, pos_y) unless (has_layer?)\n real_point = get_layer.get_real_point\n return Point.new(\n (real_point.x + pos_x),\n (real_point.y + pos_y)\n )\n end",
"def create_inverse\r\n ptr = Api.proj_coordoperation_create_inverse(self.context, self)\r\n self.class.create_object(ptr, self.context)\r\n end",
"def distance(p0,p1,p2)\r\n if p1.lat == p2.lat and p1.lng == p2.lng\r\n out = Math.sqrt(((p2.lat - p0.lat)**2) + ((p2.lng - p0.lng)**2))\r\n else\r\n u = ((p0.lat - p1.lat)*(p2.lat - p1.lat)+(p0.lng - p1.lng)*(p2.lng - p1.lng))/\r\n (((p2.lat - p1.lat)**2) + ((p2.lng - p1.lng)**2))\r\n if u <= 0\r\n out = Math.sqrt( ((p0.lat - p1.lat)**2 ) + ((p0.lng - p1.lng)**2) )\r\n end\r\n if u >= 1\r\n out = Math.sqrt(((p0.lat - p2.lat)**2) + ((p0.lng - p2.lng)**2))\r\n end\r\n if 0 < u and u < 1\r\n out = Math.sqrt( ((p0.lat-p1.lat-u*(p2.lat-p1.lat))**2) +\r\n ((p0.lng-p1.lng-u*(p2.lng-p1.lng))**2) )\r\n end\r\n end\r\n return out\r\n end",
"def projected_move\n\t\t\t\traise NotYetPlaced if been_placed.nil?\n\n\t\t\t\t_x = x\n\t\t\t\t_y = y\n\t\t\t\tcase face\n\t\t\t\twhen 'NORTH'\n\t\t\t\t\t_y += 1\n\t\t\t\twhen 'EAST'\n\t\t\t\t\t_x += 1\t\t\t\t\t\n\t\t\t\twhen 'SOUTH'\n\t\t\t\t\t_y -= 1\n\t\t\t\twhen 'WEST'\n\t\t\t\t\t_x -= 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t[_x, _y]\n\t\t\tend",
"def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end",
"def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end",
"def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end",
"def vector2 xopr = [0, 0], y = nil\n\tVec2d.new xopr, y\nend",
"def midpoint(other)\n raise TypeError, \"Midpoint between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n\n Point.new(\n (self.x + other.x) / 2,\n (self.y + other.y) / 2\n )\n end",
"def Point2dOne\n ret = _invoke(1610743821, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def intersect point1, point2, a1, b1, x1, x2\n a2 = (point2.latitude - point1.latitude)/(point2.longitude-point1.longitude)\n b2 = point1.latitude - a2*point1.longitude\n x = (b2-b1)/(a1-a2)\n x3 = point1.longitude < point2.longitude ? point1.longitude : point2.longitude\n x4 = point1.longitude > point2.longitude ? point1.longitude : point2.longitude\n x >= x1 && x <= x2 && x >= x3 && x <= x4\n end",
"def t2p(x, y)\n Vct.new(y, g_height - x)\n end",
"def apply_transform!\n @location = @dy.transformPoint( @location )\n end",
"def dir_from_points(x1, y1, x2, y2)\n VECTOR_DIRECTIONS[[x2-x1, y2-y1]].first\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def map(points)\n points\n end",
"def loc2(x,y)\n TwoDGridLocation.new x, y\nend",
"def f2c_x(x)\n (x - x_orig) * zoom\n end",
"def bbpMidPoint(first_point, second_point)\n\n bbpMult(bbpAdd(first_point, second_point), 0.5)\n end",
"def transform_all(otherProjection, collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << transform(otherProjection, point)\r\n end\r\n newcollection\r\n end",
"def calculate_projections\r\n Runtime::Projections.setup\r\n end",
"def floor\n self.class.new(x.floor, y.floor)\n end",
"def matte_point(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n pixel = f.pixel_color(x, y)\n pixel.alpha = TransparentAlpha\n f.pixel_color(x, y, pixel)\n f\n end",
"def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end",
"def other_vector(arry)\n\t\treturn [(arry[0] - first_point[0]), (arry[1] - first_point[1])]\n\tend"
] |
[
"0.71671396",
"0.6883531",
"0.6843567",
"0.65219986",
"0.60979176",
"0.5991589",
"0.5902495",
"0.5902256",
"0.58893216",
"0.5751809",
"0.5713495",
"0.5713495",
"0.57067436",
"0.57019544",
"0.5699881",
"0.56900525",
"0.56885576",
"0.5681423",
"0.56781316",
"0.56781316",
"0.5642047",
"0.5630181",
"0.5573933",
"0.557288",
"0.55721605",
"0.5567889",
"0.5541854",
"0.55275553",
"0.5517205",
"0.55048925",
"0.5469286",
"0.54680544",
"0.54595256",
"0.54595256",
"0.5441333",
"0.5425154",
"0.54125035",
"0.5411666",
"0.5382575",
"0.5367441",
"0.5366842",
"0.53623915",
"0.5351205",
"0.5347346",
"0.5339572",
"0.53272295",
"0.532429",
"0.5324099",
"0.531149",
"0.53035736",
"0.5303532",
"0.52788126",
"0.5275385",
"0.5261509",
"0.5258486",
"0.5256961",
"0.5227987",
"0.5224749",
"0.5221529",
"0.5214697",
"0.5206882",
"0.5194267",
"0.5185525",
"0.5179638",
"0.51655924",
"0.516286",
"0.5154122",
"0.5153302",
"0.5139766",
"0.51279575",
"0.51090467",
"0.5084281",
"0.50670767",
"0.50572896",
"0.5048417",
"0.5042653",
"0.50404507",
"0.5034124",
"0.50263107",
"0.5016351",
"0.50021154",
"0.50021154",
"0.49993593",
"0.49974382",
"0.49965632",
"0.49953672",
"0.49894843",
"0.49830478",
"0.49813086",
"0.49707353",
"0.49605656",
"0.49604493",
"0.4947912",
"0.4943649",
"0.4939995",
"0.4935937",
"0.4935708",
"0.4934724",
"0.49342188",
"0.49312735"
] |
0.6280238
|
4
|
Square lenght of a CGPoint
|
def bbpLengthSQ(point)
bbpDot(point, point)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def length; Math.sqrt((@x*@x)+(@y*@y)); end",
"def length\n Math.sqrt(@x * @x + @y * @y)\n end",
"def length\n Math.sqrt(x ** 2 + y ** 2)\n end",
"def length\n Math.sqrt(((x2 - x1) ** 2) + ((y2 - y1) ** 2))\n end",
"def size\n (@x2-@x1)*(@y2-@y1)\n end",
"def length_squared\n @x * @x + @y * @y\n end",
"def length_squared\n @x * @x + @y * @y\n end",
"def pixel_size; size.x * size.y; end",
"def length_squared\n @x * @x + @y * @y + @z * @z\n end",
"def length\n Math.sqrt(@x * @x + @y * @y + @z * @z)\n end",
"def num_points\n @size * @size\n end",
"def magSq\n @x*@x + @y*@y\n end",
"def length\n Math.hypot(x, y)\n end",
"def perimeter\n\n return @side_len * 4\n\n end",
"def s\n Math.sqrt(x**2 + y**2)\n end",
"def farpoint() origin + size end",
"def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end",
"def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end",
"def num_squares\n self.size ** 2\n end",
"def area_of_square(length)\n length*length\nend",
"def width\r\n return (@x2-@x1).abs\r\n end",
"def width # width of bboxpoint\n\t\tself.coords[2] - self.coords[0]\n\tend",
"def perimeter(length, width)\r\n 2 * (length + width)\r\nend",
"def perimeter(length,width)\n (2 * length) + (2 * width)\nend",
"def perimeter\n return @side_length * 4\n end",
"def perimeter(length, width)\n return (2 * (length + width))\nend",
"def calculate_length\n l = @points.enum_cons(2).inject(0) { |s, points|\n s + distance_between(*points)\n }\n\n # include distance to go from last point to first to make loop\n l + distance_between(@points[-1], @points[0])\n end",
"def get_absolute_size\n return Vector.new(@tile_size.x * @size.x, @tile_size.y * @size.y) unless @isometric\n avg = (@size.x + @size.y) * 0.5\n Vector.new (avg * @tile_size.x).to_i, (avg * @tile_size.y).to_i\n end",
"def getPerimeter\n\t\t@length + @width + @height\n\tend",
"def getPerimeter\n\t\t@length + @width + @height\n\tend",
"def euclidian_distance(point)\r\n Math.sqrt((point.x - x)**2 + (point.y - y)**2)\r\n end",
"def perimeter(length, width)\n p = (2 * (length + width))\n return p\nend",
"def perimeter\n\t\treturn @side_length * 4\n\tend",
"def real_piece_size\n piece_size + connector_size\n end",
"def size\n @points.size\n end",
"def area\n\n return @side_len * @side_len\n\n\n end",
"def calculate_coordinate(size_in_inches)\n return size_in_inches * 144\n end",
"def length\n points_distance(@x1, @y1, @x2, @y2)\n end",
"def distance(pt)\n raise ArgumentError unless is_point?(pt)\n return sqrt((pt.first - @xy.first) ** 2 + (pt.last - @xy.last) ** 2)\n end",
"def bbpLenght(point)\n\n Math.sqrt(bbpLengthSQ(point))\n end",
"def area\n return @side_length * @side_length\n end",
"def getArea()\n getWidth() * getHeight()\n end",
"def step_size\n return @box_size * Math.sqrt(2)\n end",
"def perimeter\n\t\t4 * @side_length\n\tend",
"def getArea\n getWidth() * getHeight\n end",
"def getArea\n getWidth() * getHeight\n end",
"def width\n @x1 - @x0\n end",
"def getArea\n getWidth() * getHeight\n end",
"def mag\n Math.sqrt(@x*@x + @y*@y)\n end",
"def getArea\n getWidth() * getHeight\n end",
"def euclidian_distance(point)\n Math.hypot((point.x - x),(point.y - y))\n end",
"def area_of_rectangle(width, length)\n width*length\nend",
"def size\n\t\t@w * @h\n\tend",
"def getArea\n @width * @height * @length\n end",
"def coord(x); (x*@game.height).to_i; end",
"def size\n self.points.count\n end",
"def recArea(w, h) \n w * h \nend",
"def pointsize(points)\n primitive 'font-size ' + sprintf('%g', points)\n end",
"def length\n if z\n Math.sqrt(x * x + y * y + z * z)\n elsif x && y\n Math.sqrt(x * x + y * y)\n else\n nil\n end\n end",
"def pt___x(n, y); ptdist(n, 1.0 - y); end",
"def cm2pts(x)\n (x / 2.54) * 72\n end",
"def area\n w * h\n end",
"def calc_perimeter(len, wid)\n\tperim = (len + wid) * 2\n\treturn perim\nend",
"def size\n width * height\n end",
"def area_of_rect(l, w)\n return l * w\nend",
"def distance(point)\n Math.hypot(point.x - x, point.y - y)\n end",
"def pixels\n \n return width.to_i * height.to_i\n \n end",
"def linelength(roundsign = 0)\n ll = Math.sqrt(((@point_two.x - @point_one.x)**2) + ((@point_two.y - @point_one.y)**2))\n roundsign.zero? ? ll : format(\"%.#{roundsign}f\", ll)\n end",
"def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end",
"def size\n size_dependencies = [calculated_width, calculated_height]\n if size_dependencies != @size_dependencies\n # avoid repeating calculations\n calculated_width, calculated_height = @size_dependencies = size_dependencies\n @size = org.eclipse.swt.graphics.Point.new(calculated_width, calculated_height)\n end\n @size\n end",
"def width\n self.size[:x]\n end",
"def distance_to_squared p\n dx = p.x - x\n dy = p.y - y\n dx * dx + dy * dy\n end",
"def cveclen(u)\n\tMath.sqrt(u[0,0]**2+u[1,0]**2+u[2,0]**2)\nend",
"def size\n\t\tx,y = 0,0\n\t\t@points.each do |point|\n\t\t\tx = point[0]\tif point[0] > x\n\t\t\ty = point[1]\tif point[1] > y\n\t\tend\n\t\treturn [x,y]\n\tend",
"def area(length, width)\n length * width\nend",
"def dimensions\n self.coords.count\n end",
"def area\n \t@width * @height\n end",
"def radius\n \twidth / 2\n end",
"def euclidean_distance_to(point)\n if self.dimensions != point.dimensions\n raise HonorRoll::IncompatibleDimensionsError\n end\n coord_pairs = self.coords.zip point.coords\n Math.sqrt coord_pairs.map{ |p| (p[0] - p[1])**2 }.reduce(:+)\n end",
"def n\n points.size\n end",
"def width; rect.width; end",
"def rectangleArea(h, w)\r\n h * w\r\nend",
"def in2pts(x)\n x * 72\n end",
"def centery; return self[1]+(self[3].div(2)); end",
"def area(length, width)\n a = length * width\n return a\nend",
"def point( l, container=nil )\n # Trace(\"point parameter #{l}\")\n return pointfromparameter( parameterfromlength(l), container )\n end",
"def rectangle(length:, width:)\n # now does squares!!!!\n (length.to_f * width.to_f).round(2)\n end",
"def distance_line_segment_point_squared(bx, by, cx, cy, px, py)\n\t\tmx = cx - bx\n\t\tmy = cy - by\n\t\thx = px - bx\n\t\thy = py - by\n\t\tt0 = (mx * hx + my * hy).fdiv(mx ** 2 + my ** 2)\n\t\tif t0 <= 0\n\t\telsif t0 < 1\n\t\t\thx -= t0 * mx\n\t\t\thy -= t0 * my\n\t\telse\n\t\t\thx -= mx\n\t\t\thy -= my\n\t\tend\n\t\treturn hx ** 2 + hy ** 2\n\tend",
"def coat_length; end",
"def magnitude\n Math.hypot( @x, @y )\n end",
"def size\n SizableLocation.new(location).size\n end",
"def rms\n Math.sqrt(self.square_sum/self.length)\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def area\n width() * height\n end",
"def c_radius \n Math.sqrt((@x*@x)+(@y*@y))\n end",
"def width\n dimensions()[:x]\n end",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def xy2p(x, y)\n\t\tsx = 0\n\t\tglyphs = @model.glyphs(y)\n\t\tglyphs.each_with_index do |glyph, i|\n\t\t\treturn i if sx >= x or glyph == 10\n\t\t\tsx += measure_width(sx, glyph)\n\t\tend\n\t\tglyphs.size\n\tend",
"def getArea\n\t\tgetWidth() * getHeight\n\tend"
] |
[
"0.7409897",
"0.72579277",
"0.7218393",
"0.69195276",
"0.6914367",
"0.67361933",
"0.66142017",
"0.6611512",
"0.6589725",
"0.6496464",
"0.64735883",
"0.645389",
"0.64361906",
"0.64270884",
"0.6369374",
"0.6327771",
"0.62927",
"0.62927",
"0.6279864",
"0.62714934",
"0.6251782",
"0.6248495",
"0.62241936",
"0.6222682",
"0.6219109",
"0.6186147",
"0.61657345",
"0.6133833",
"0.61135435",
"0.61135435",
"0.60616225",
"0.6040441",
"0.6028008",
"0.5992634",
"0.59869725",
"0.59799844",
"0.5976652",
"0.5970646",
"0.5955837",
"0.5949585",
"0.5931091",
"0.59269863",
"0.5912564",
"0.59090334",
"0.5897542",
"0.5897542",
"0.58961385",
"0.5896072",
"0.58957803",
"0.58912295",
"0.58864015",
"0.5863234",
"0.5843366",
"0.5842949",
"0.5824331",
"0.58139825",
"0.5796604",
"0.5796296",
"0.578974",
"0.5771505",
"0.5768428",
"0.5761371",
"0.57488793",
"0.5739149",
"0.57308495",
"0.5719302",
"0.57125586",
"0.5703385",
"0.5702976",
"0.56986165",
"0.5690028",
"0.5685605",
"0.56829596",
"0.56759936",
"0.56713724",
"0.56571156",
"0.56536746",
"0.56507295",
"0.5649327",
"0.56372386",
"0.56297195",
"0.5600776",
"0.55908936",
"0.5587559",
"0.5584324",
"0.5574858",
"0.5565342",
"0.55647314",
"0.5561455",
"0.5546852",
"0.5537651",
"0.55357534",
"0.55301386",
"0.55301386",
"0.5520732",
"0.5517386",
"0.5505342",
"0.55037814",
"0.5501206",
"0.5496483"
] |
0.5976291
|
37
|
Square distance between two points
|
def bbpDistanceSQ(first_point, second_point)
bbpLengthSQ(bbpSub(first_point, second_point))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def distance(x1, y1, x2, y2)\n Math.sqrt((y2 - y1)**2 + (x2 - x1)**2)\n end",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def distance(x1,y1,x2,y2)\n return ((x2 - x1)**2 + (y2 - y1)**2)**0.5\nend",
"def distance(a, b)\n Math.sqrt(((a.x - b.x) ** 2) + ((a.y - b.y) ** 2).abs)\n end",
"def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend",
"def distance(p1,p2)\ndelta_x = p1[0] - p2[0]\ndelta_y = p1[1] - p2[1]\n\nMath.sqrt(delta_x ** 2 + delta_y **2)\n\nend",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def distance_to_squared p\n dx = p.x - x\n dy = p.y - y\n dx * dx + dy * dy\n end",
"def distance(point2)\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def distance(p1, p2)\n\t\tc = p1.count\n\t\tt = 0\n\t\tc.times do \t|n|\n\t\t\te = (p1[n] - p2[n]) ** 2\n\t\t\tt = t + e\t\t\n\t\tend\t\n\t\tt = Math.sqrt(t)\n\tend",
"def calculate_distance(p1, p2)\r\n sum = 0\r\n for i in (0...p1.length)\r\n sum += (p1[i] - p2[i])**2\r\n end\r\n sum = sum.to_f\r\n return Math.sqrt(sum)\r\nend",
"def distance(vector2)\n Math.sqrt(distance_sq(vector2))\n end",
"def squared_difference(x,y)\n 0.0 + (x-y)**2\n end",
"def dist_to_sqr(other)\n s_copy.sub(other).dotted\n end",
"def distance(a, b)\n Integer(Math.sqrt(((b[0] - a[0])**2 + (b[1] - a[1])**2)))\n end",
"def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end",
"def dist(a1, a2)\n Math.sqrt(a1.zip(a2).map { |x| (x[1] - x[0])**2 }.reduce(:+))\n end",
"def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end",
"def distance(v1, v2)\n sum_squares = node_count.times.reduce(0.0) do |sum, i|\n d = v1[i] - v2[i]\n sum + d * d\n end\n Math.sqrt(sum_squares)\n end",
"def distance_between(p1, p2)\n Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)\n end",
"def distance_to(x, y)\n return Math.hypot(x - @x, y - @y)\n end",
"def calc_distance(x1,y1, x2,y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2) && (y1 == y2)\r\n c = 0\r\n else\r\n a = (x1 - x2).abs * 1.0\r\n b = (y1 - y2).abs * 1.0\r\n csqd = (a*a) + (b * b)\r\n c = Math.sqrt(csqd)\r\n end # else\r\n return c\r\nend",
"def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end",
"def euclidean_distance_to(point)\n if self.dimensions != point.dimensions\n raise HonorRoll::IncompatibleDimensionsError\n end\n coord_pairs = self.coords.zip point.coords\n Math.sqrt coord_pairs.map{ |p| (p[0] - p[1])**2 }.reduce(:+)\n end",
"def distance_sq(vector2)\n dx = vector2.x - @x\n dy = vector2.y - @y\n dx * dx + dy * dy\n end",
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end",
"def euclid point1, point2\n\treturn Math.sqrt((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2)\nend",
"def calc_distance(point1, point2, summ = 0)\n point1.each.with_index do |a, index|\n summ += (a - point2[index])**2\n end\n Math.sqrt(summ)\n end",
"def distance(c1,c2)\n x = c1[0] - c2[0]\n y = c1[1] - c2[1]\n y = y <= -180 ? y + 360 : y\n y = y >= 180 ? y - 360 : y\n return Math.sqrt(x*x+y*y)\n end",
"def distance2d(x = 0, y = nil)\n if !y && x.respond_to?(:x)\n x, y = x.x, x.y\n else\n y ||= 0\n end\n\n Math.sqrt((x - self.x)**2 + (y - self.y)**2)\n end",
"def s\n Math.sqrt(x**2 + y**2)\n end",
"def distance(p0,p1,p2)\r\n if p1.lat == p2.lat and p1.lng == p2.lng\r\n out = Math.sqrt(((p2.lat - p0.lat)**2) + ((p2.lng - p0.lng)**2))\r\n else\r\n u = ((p0.lat - p1.lat)*(p2.lat - p1.lat)+(p0.lng - p1.lng)*(p2.lng - p1.lng))/\r\n (((p2.lat - p1.lat)**2) + ((p2.lng - p1.lng)**2))\r\n if u <= 0\r\n out = Math.sqrt( ((p0.lat - p1.lat)**2 ) + ((p0.lng - p1.lng)**2) )\r\n end\r\n if u >= 1\r\n out = Math.sqrt(((p0.lat - p2.lat)**2) + ((p0.lng - p2.lng)**2))\r\n end\r\n if 0 < u and u < 1\r\n out = Math.sqrt( ((p0.lat-p1.lat-u*(p2.lat-p1.lat))**2) +\r\n ((p0.lng-p1.lng-u*(p2.lng-p1.lng))**2) )\r\n end\r\n end\r\n return out\r\n end",
"def euclidean(x1,x2,y1,y2,z1,z2,a1,a2)\n\t\n\tdistance= Math.sqrt(((x1 - x2) ** 2) + ((y1 - y2) ** 2) +((z1 - z2) ** 2) + ((a1 - a2) ** 2))\n\treturn distance\nend",
"def distance_between(point1, point2)\n (point1 - point2).mag\n end",
"def euclidian_distance(point)\r\n Math.sqrt((point.x - x)**2 + (point.y - y)**2)\r\n end",
"def dist(a, b)\n ax, ay, _ = a\n bx, by, _ = b\n\n (ax-bx).abs + (ay-by).abs\nend",
"def distance(a,b)\n\t(a-b).abs\nend",
"def calculateDistance(r1,c1,r2,c2)\r\n\treturn Math.sqrt(((c1-c2) ** 2 + (r1 -r2) ** 2))\r\nend",
"def absolute_distance(point_1, point_2)\n Math.sqrt((point_1.first - point_2.first) ** 2 + (point_1.last - point_2.last) ** 2)\n end",
"def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend",
"def euclidean_distance(a, b)\n Math.sqrt ( a.zip(b).map { |n| n.reduce(:-) }.map { |n| n**2 }.reduce(:+) )\nend",
"def norm_2(other)\n dot = dot(other)\n Math::sqrt(dot)\n end",
"def euclidian_distance array1, array2\n Math.sqrt(array1.zip(array2).inject(0){|a,(v1,v2)| a+(v2-v1)**2})\nend",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end",
"def euclidean_dist(c1,c2)\n Math.sqrt(c1.zip(c2).map{|p| (p[1]-p[0])**2}.reduce(:+))\n end",
"def distance(pt)\n raise ArgumentError unless is_point?(pt)\n return sqrt((pt.first - @xy.first) ** 2 + (pt.last - @xy.last) ** 2)\n end",
"def compute_hypotenuse(a, b)\n Math.sqrt(a * a + b * b)\nend",
"def dist(r1, c1, r2, c2)\r\n return Math.sqrt((c1-c2)**2 + (r1-r2)**2)\r\nend",
"def distance(a, b)\n return @distance_function.call(a, b) if @distance_function\n return euclidean_distance(a, b)\n end",
"def distance_to(p)\n x_diff = self.x-p.x\n y_diff = self.y-p.y\n return Math.sqrt(x_diff*x_diff + y_diff*y_diff)\n end",
"def euclidean_distance(s1, s2)\n d2 = 0.0\n get_features.each do |f|\n if s1.has_key? f and s2.has_key? f\n d2 += (s1[f]-s2[f])**2\n end\n end\n \n Math.sqrt(d2)\n end",
"def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end",
"def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end",
"def length_squared\n @x * @x + @y * @y\n end",
"def Point2dDistanceSquared(arg0, arg1)\n ret = _invoke(1610743813, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def distance a, b\n (a[0] - b[0]).abs + (a[1] - b[1]).abs\n end",
"def calculate_distance(point_a, point_b)\n to_radians = proc { |x| x * Math::PI / 180 }\n lat_a = to_radians.call(point_a.latitude / COORD_FACTOR)\n lat_b = to_radians.call(point_b.latitude / COORD_FACTOR)\n lon_a = to_radians.call(point_a.longitude / COORD_FACTOR)\n lon_b = to_radians.call(point_b.longitude / COORD_FACTOR)\n delta_lat = lat_a - lat_b\n delta_lon = lon_a - lon_b\n a = Math.sin(delta_lat / 2)**2 +\n Math.cos(lat_a) * Math.cos(lat_b) +\n Math.sin(delta_lon / 2)**2\n (2 * RADIUS * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))).to_i\nend",
"def get_distance(lat1, long1, lat2, long2)\n\tdistance = 0\n\tdistance = Math.sqrt((lat2 - lat1)**2 + (long2-long1)**2)\n\treturn distance\nend",
"def length_squared\n @x * @x + @y * @y\n end",
"def distance_metric(product1, product2) (get_value(product1) - get_value(product2)).abs end",
"def test_distance_to_point_right_up\n point1 = Point.new(0, 0)\n point2 = Point.new(1, 1)\n assert_equal Math.sqrt(2), point1.distance_to(point2)\n end",
"def distance(pt)\n x2, y2 = pt\n must_be_number(x2, 'pt.x')\n must_be_number(y2, 'pt.y')\n x1, y1 = xy\n hypot(x2 - x1, y2 - y1)\n end",
"def test_distance_to_point2\n point1 = Point.new(0, 0)\n point2 = Point.new(3, 4)\n assert_equal 5, point1.distance_to(point2)\n end",
"def distance_to(other)\n point.distance_to(other)\n end",
"def euclidean_distance(other)\n # Create an array of pairs by merging each element of self with the corresponding element from other,\n # calculate (a - b) ^ 2 for all pairs, where a is the first element and b is the second element,\n # add the results together and return the square root of the result\n Math.sqrt zip(other).map { |a, b| (a - b) ** 2 }.sum\n end",
"def length\n points_distance(@x1, @y1, @x2, @y2)\n end",
"def distance(features1, features2, type = :euclidian)\r\n sum = 0\r\n count_features.times do |i|\r\n sum += (features1[i] - features2[i])**2\r\n end\r\n\r\n Math::sqrt(sum)\r\n end",
"def distance(point)\n Math.hypot(point.x - x, point.y - y)\n end",
"def distance(lon1, lat1, lon2, lat2)\n Math.acos( Math.sin(lat1 * (Math::PI/180))*Math.sin(lat2*(Math::PI/180)) + Math.cos(lat1*Math::PI/180) * Math.cos(lat2*(Math::PI/180))*Math.cos((lon2 * Math::PI/180)-(lon1*Math::PI/180)) ) * 6371000\n end",
"def euclidian_distance(point)\n Math.hypot((point.x - x),(point.y - y))\n end",
"def great_circle_distance(lat1, lon1, lat2, lon2)\n \tp = 0.017453292519943295 #Pi/180\n \ta = 0.5 - Math.cos((lat2 - lat1) * p)/2 + Math.cos(lat1 * p) * Math.cos(lat2 * p) * (1 - Math.cos((lon2 - lon1) * p)) / 2\n \tresult = 12742 * Math.asin(Math.sqrt(a)) #2*R*asin...\n \treturn result * 1000 # Convert result from km to m\n end",
"def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend",
"def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend",
"def distance_between(city_1, city_2)\n Math.hypot(city_2.x - city_1.x, city_2.y - city_1.y)\nend",
"def calculate_distance(vals1, vals2)\n vals1_sum = vals1.inject(:+)\n vals2_sum = vals2.inject(:+)\n\n (0..11).map { |i| ((vals1[i].to_f/vals1_sum)-(vals2[i].to_f/vals2_sum))**2 }.inject(:+)\nend",
"def hypothenus(x, y)\n return Math.sqrt(x**2 + y**2)\nend",
"def dist first, second\n first = first.is_a? Atom ? frac(first.pos(false)) : first.to_v\n second = second.is_a? Atom ? frac(second.pos(false)) : second.to_v\n real((first - second).map{|v| v = v % 1; v > 0.5 ? 1 - v : v}).magnitude\n end",
"def distanceCalculation(x1, y1, _z1, x2, y2, z2)\n Math.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (y1 - z2)**2)\n end",
"def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end",
"def magSq\n @x*@x + @y*@y\n end",
"def distance(loc1, loc2)\n\n lat1 = loc1[0].to_f\n lon1 = loc1[1].to_f\n\n lat2 = loc2[0].to_f\n lon2 = loc2[1].to_f\n\n dLat = conv_deg_rad(lat2 - lat1)\n dLon = conv_deg_rad(lon2 - lon1)\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1/180 * Math::PI) * Math.cos(lat2/180 * Math::PI) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n\n d = 6371e3 * c #meters\n\n return d\n end",
"def jaro_distance(s1, s2)\n result = C::jaro_distance(s1, s2)\n raise(\"memory allocation error\") if result < 0.0\n result\n end",
"def distance\n diff_longitude = @longitude_b - @longitude_a\n diff_latitude = @latitude_b - @latitude_a\n\n angle_a = (Math.sin(radius_to_degree(diff_latitude)/2.0)) ** 2 +\n Math.cos(radius_to_degree(@latitude_a)) *\n Math.cos(radius_to_degree(@latitude_b)) *\n (Math.sin(radius_to_degree(diff_longitude)/2.0)) ** 2\n angle_c = 2 * Math.atan2(Math.sqrt(angle_a), Math.sqrt(1-angle_a))\n\n (EARTH_RADIUS * angle_c) / 1000 # Returns the distance in kilometers\n end",
"def distance4(*points)\n x1, y1, x2, y2 = points.flatten\n raise ArgumentError unless [x1, y1, x2, y2].all? { |e| e.is_a? Numeric }\n Math.hypot(x2 - x1, y2 - y1)\nend",
"def dist(x, y)\n z = -x-y\n [x.abs, y.abs, z.abs].max\nend",
"def hypotenuse(a, b)\n value = Math.sqrt(a.value * a.value + b.value * b.value)\n Sass::Script::Number.new(value, a.numerator_units, a.denominator_units)\n end",
"def euclideanDistance(obj1, obj2)\r\n\teuc = 0\r\n\tfor d in 0...obj1.length\r\n\t\teuc += (obj1[d] - obj2[d])**2\r\n\tend\r\n\tMath.sqrt(euc)\r\nend",
"def distance2_to(data_point)\n [@coordinates,data_point.coordinates].transpose.map do\n |arr| arr.inject { |sum, coordinate| (sum - coordinate)**2 }\n end.inject(:+)\n end",
"def distance obj\n\t\t\ta = obj.x-@x\n\t\t\tb = obj.y-@y\n\t\t\tc = Math.sqrt(a**2 + b**2)\t\n\t\tend",
"def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend",
"def squares(a, b)\n diff = (Math.sqrt(b).ceil - Math.sqrt(a).ceil)\n diff = diff + 1 if Math.sqrt(b) % 1 == 0\n # diff = diff + 1 if Math.sqrt(a) % 1 == 0\n return diff\nend",
"def sum_square(x, y)\n\tx**2 + y**2\nend",
"def distance2_to(data_point)\n [@coordinates,data_point.coordinates].transpose.map{|arr| arr.inject{|sum, coordinate| (sum - coordinate)**2}}.inject(:+)\n end",
"def distance(g0, g1)\n Math::sqrt( ((g1.lat-g0.lat).abs**2) + ((g1.lon-g0.lon).abs**2) )\n end",
"def difference\n square_of_sum - sum_of_squares\n end"
] |
[
"0.7857533",
"0.7705691",
"0.7662858",
"0.76358485",
"0.7634523",
"0.74363464",
"0.74174345",
"0.7409409",
"0.73717475",
"0.73520947",
"0.7294831",
"0.7280314",
"0.7223777",
"0.72069377",
"0.7191483",
"0.71781117",
"0.7171579",
"0.71433353",
"0.71143216",
"0.70488894",
"0.70367676",
"0.70247763",
"0.7017396",
"0.70148164",
"0.7005785",
"0.6985959",
"0.696154",
"0.6959824",
"0.69581795",
"0.69404036",
"0.6858059",
"0.68452793",
"0.6824691",
"0.68048257",
"0.6793189",
"0.67733264",
"0.6771064",
"0.6769368",
"0.6762211",
"0.67582345",
"0.675377",
"0.6743416",
"0.6727708",
"0.6722364",
"0.671268",
"0.6699717",
"0.66952956",
"0.6684862",
"0.6675584",
"0.66598856",
"0.66562694",
"0.66473454",
"0.6644581",
"0.6635981",
"0.6627568",
"0.6621899",
"0.6619653",
"0.66131383",
"0.66131383",
"0.6597851",
"0.6587049",
"0.657521",
"0.65660787",
"0.6544354",
"0.6543531",
"0.6523639",
"0.6521723",
"0.65203846",
"0.6507431",
"0.6507086",
"0.64922416",
"0.64858717",
"0.6476054",
"0.6470835",
"0.6467402",
"0.6463187",
"0.6448731",
"0.64262253",
"0.64262253",
"0.6414847",
"0.6408071",
"0.6396775",
"0.63892996",
"0.63846076",
"0.6377456",
"0.63675815",
"0.6357726",
"0.63475144",
"0.6327268",
"0.6327247",
"0.63111174",
"0.6308724",
"0.629266",
"0.6282254",
"0.6260874",
"0.62587225",
"0.6257915",
"0.62535655",
"0.6244024",
"0.62396306",
"0.6219195"
] |
0.0
|
-1
|
Distance between point an origin
|
def bbpLenght(point)
Math.sqrt(bbpLengthSQ(point))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def distance\n self.distance_from(@origin) * 1.609344\n end",
"def distance_from_origin(origin)\n calculate_distance_from_origin(origin)\n end",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def distance_to(coord)\n @vector.cross_vector.normal.dot_product(coord - @start)\n end",
"def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend",
"def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end",
"def distance_to(pt)\n if pt.is_valid?\n vect = GeoFunctions.point_minus_point(pt,@origin)\n GeoFunctions.vector_dot_product(vect, @z_axis)\n else\n nil\n end\n end",
"def distance_to(origin)\n rad_lat = to_rad(latitude)\n rad_lng = to_rad(longitude)\n\n rad_origin_lat = to_rad(origin.latitude)\n rad_origin_lng = to_rad(origin.longitude)\n\n # calculate λ- longitudinal delta\n delta_lng = rad_lng - rad_origin_lng\n # calculate φ- latitudinal delta\n delta_lat = rad_lat - rad_origin_lat\n\n # calculate central angle - σ\n central_angle = 2 * Math.asin(Math.sqrt((Math.sin(delta_lat / 2)**2) +\n (Math.cos(rad_lat) * Math.cos(rad_origin_lat) * Math.sin(delta_lng / 2)**2)))\n (central_angle * RADIUS_OF_EARTH).round(2)\n end",
"def distance(point)\n Math.hypot(point.x - x, point.y - y)\n end",
"def dist point\n point = point.pos(false) if point.is_a? Atom\n (point.to_v- @p).to_a * @normal / @normal.magnitude\n end",
"def distance_to(position)\n\t\t\tMath.sqrt((position.x - x).abs ** 2 + (position.y - y).abs ** 2)\n\t\tend",
"def distance(pt)\n raise ArgumentError unless is_point?(pt)\n return sqrt((pt.first - @xy.first) ** 2 + (pt.last - @xy.last) ** 2)\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def distance_to(p)\n x_diff = self.x-p.x\n y_diff = self.y-p.y\n return Math.sqrt(x_diff*x_diff + y_diff*y_diff)\n end",
"def euclidian_distance(point)\r\n Math.sqrt((point.x - x)**2 + (point.y - y)**2)\r\n end",
"def distance( origin, destination )\n return @graph[origin][destination]\n end",
"def distance(point2)\n end",
"def distance_to(other)\n point.distance_to(other)\n end",
"def distance obj\n\t\t\ta = obj.x-@x\n\t\t\tb = obj.y-@y\n\t\t\tc = Math.sqrt(a**2 + b**2)\t\n\t\tend",
"def distance_to(x, y)\n return Math.hypot(x - @x, y - @y)\n end",
"def euclidian_distance(point)\n Math.hypot((point.x - x),(point.y - y))\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def distance(pt)\n x2, y2 = pt\n must_be_number(x2, 'pt.x')\n must_be_number(y2, 'pt.y')\n x1, y1 = xy\n hypot(x2 - x1, y2 - y1)\n end",
"def distance_between(point1, point2)\n (point1 - point2).mag\n end",
"def distance(x1, y1, x2, y2)\n Math.sqrt((y2 - y1)**2 + (x2 - x1)**2)\n end",
"def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end",
"def distance(other)\n\t\treturn ((other.x-@x).abs + (other.y-@y).abs + (other.z-@z).abs)/2\n\tend",
"def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end",
"def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end",
"def calculate_distance_between(target)\n Math.sqrt((target.x - x)**2 + (target.y - y)**2)\n end",
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def euclidean_distance_to(point)\n if self.dimensions != point.dimensions\n raise HonorRoll::IncompatibleDimensionsError\n end\n coord_pairs = self.coords.zip point.coords\n Math.sqrt coord_pairs.map{ |p| (p[0] - p[1])**2 }.reduce(:+)\n end",
"def clockwise_distance_from_noon point, origin\n x, y = point[:x] - origin[:x], -(point[:y] - origin[:x])\n if x == 0\n return y >= 0 ? 0 : 1\n end\n radians = Math.atan(x.to_f / y) / Math::PI\n if y < 0\n radians += 1\n elsif x < 0\n radians += 2\n end\n radians\nend",
"def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def distance_from(char)\n return distance_x_from(char.x).abs + distance_y_from(char.y).abs\n end",
"def distance_to(destination)\n delta_latitude = (destination.y - y).to_rad\n delta_longitude = (destination.x - x).to_rad\n origin_lat_rad = y.to_rad\n destination_lat_rad = destination.y.to_rad\n a = Math::sin(delta_latitude/2) * Math::sin(delta_latitude/2) + \n (Math::sin(delta_longitude/2)* \n Math::sin(delta_longitude/2) * \n Math::cos(origin_lat_rad) * \n Math::cos(destination_lat_rad)\n )\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n EARTH_RADIUS * c\n end",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def distance(a, b)\n Math.sqrt(((a.x - b.x) ** 2) + ((a.y - b.y) ** 2).abs)\n end",
"def distance_to(token)\n dist = self.xloc - token.xloc\n dist.abs\n end",
"def distance_to(point)\n d=Ubiquity::Geoformulas.distance self.lat, self.lon, point.lat, point.lon\n if self.elems && self.elems.has_key?('ele') && point.elems.has_key?('ele')\n d=Ubiquity::Geoformulas.distance_correction d, self.elems['ele'], point.elems['ele']\n end\n d\n end",
"def dist other\n case other\n when Atom\n pos = other.pos(false)\n when Surface\n return other.dist(self)\n else\n pos = pos.to_v \n end\n if @units == :angstrom\n (@pos - pos).magnitude\n else\n @cell.dist(self, other)\n end\n end",
"def distance(p1,p2)\ndelta_x = p1[0] - p2[0]\ndelta_y = p1[1] - p2[1]\n\nMath.sqrt(delta_x ** 2 + delta_y **2)\n\nend",
"def distance(location)\n dx = @x - location.x\n dy = @y - location.y\n \n dx = dx * dx\n dy = dy * dy\n \n Math.sqrt(dx + dy)\n end",
"def farpoint() origin + size end",
"def dist(v)\n dx = v.x - @x\n dy = v.y - @y\n Math.sqrt(dx*dx + dy*dy)\n end",
"def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end",
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def distanceToCoord(startXPosition, startYPosition, endXPosition, endYPosition)\n if startXPosition == endXPosition and startYPosition == endYPosition\n return 0\n end\n \n return (startXPosition - endXPosition).abs + (startYPosition - endYPosition).abs\nend",
"def distance\n return 0 if self.loc == @@current_loc\n return 0 if self.loc.nil? or @@current_loc.nil?\n haversine_distance(@@current_loc,self.loc)\n end",
"def distance\n # we use memoization because calculating distance is expensive\n @distance ||= begin\n self.points.inject(nil) do |a, p|\n new_pt = p\n if a\n last_pt = Ubiquity::Point.new(a[:last_lat], a[:last_lon], {'ele' => a[:last_ele]})\n d = last_pt.to new_pt\n a[:dist] += d\n else\n a=Hash.new\n a[:dist]=0\n end\n a[:last_lat]=new_pt.lat\n a[:last_lon]=new_pt.lon\n a[:last_ele]=new_pt.elems['ele']\n a\n end[:dist]\n end\n end",
"def distance(x1,y1,x2,y2)\n return ((x2 - x1)**2 + (y2 - y1)**2)**0.5\nend",
"def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend",
"def distance_to(reference_point, guess, geometric_resolution)\n closest = do_find_one_closest_point(reference_point.to_a, guess, geometric_resolution)\n (get(closest) - reference_point).norm\n end",
"def calc_dist_between_stations(stationOrigin, stationDestination)\n\t\t\n\t\txO = Integer(stationOrigin.xPos)\n\t\tyO = Integer(stationOrigin.yPos)\n\n\t\txD = Integer(stationDestination.xPos)\n\t\tyD = Integer(stationDestination.yPos)\n\n\t\treturn Math.sqrt(((xD - xO)**2) + ((yD - yO)**2))\n\tend",
"def find_distance(point)\n p_x, p_y = point\n final_x, final_y = @maze.find_end\n ((p_x - final_x) + (p_y - final_y)).abs\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def distance_from(other)\n\t\t\trlong1 = self.longitude * D2R\n\t\t\trlat1 = self.latitude * D2R\n\t\t\trlong2 = other.longitude * D2R\n\t\t\trlat2 = other.latitude * D2R\n\t\t\t\n\t\t\tdlon = rlong1 - rlong2\n\t\t\tdlat = rlat1 - rlat2\n\t\t\t\n\t\t\ta = Math::sin(dlat/2) ** 2 + Math::cos(rlat1) * Math::cos(rlat2) * Math::sin(dlon/2) ** 2\n\t\t\tc = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\t\t\td = R * c\n\t\t\t\n\t\t\treturn d\n\t\tend",
"def distance(x = 0, y = nil, z = nil)\n if !y && x.respond_to?(:x)\n x, y, z = x.x, x.y, x.z\n else\n y ||= 0\n z ||= 0\n end\n\n Math.sqrt((x - self.x)**2 + (y - self.y)**2 + (z - self.z)**2)\n end",
"def distance(start, goal, mode = :euclidean)\n\t\tif mode == :euclidean\n\t\t\t((start[:x] - goal[:x])**2 + (start[:y] - goal[:y])**2)**0.5\n\t\telsif mode == :linear\n\t\t\t(start[:x] - goal[:x]).abs + (start[:y] - goal[:y]).abs\n\t\telsif mode == :diagonal\n\t\t\t[(start[:x] - goal[:x]).abs, (start[:y] - goal[:y]).abs].max\n\t\tend\n\tend",
"def distance(node)\n return (\n (@x - node.x) ** 2 +\n (@y - node.y) ** 2\n ) ** (0.5)\n end",
"def distance_preceding_character\r\r\n sx = distance_x_from(@preceding_character.x)\r\r\n sy = distance_y_from(@preceding_character.y)\r\r\n return Math.hypot(sx, sy)\r\r\n end",
"def distance(other)\n if other.is_a?(Point)\n return distance_between_points(self, other)\n end\n \n if other.respond_to?(:distance)\n return other.distance(self)\n end\n \n raise TypeError, \"Distance between Point and #{ other.class } is not defined\"\n end",
"def geo_dist(from, to)\n return 40000 if [from.lat, from.lon, to.lat, to.lon].any?(&:nil?)\n EARTH_DIAMETER * Math.asin(Math.sqrt(\n Math.cos(from.lat) * Math.cos(to.lat) *\n Math.sin((from.lon - to.lon)/2) ** 2 +\n Math.sin((from.lat - to.lat)/2) ** 2\n ))\nend",
"def distance_between\n # convert to coord arrays\n point1 = extract_coords([user.current_latitude, user.current_longitude])\n point2 = extract_coords([connection.current_latitude, connection.current_longitude])\n\n # convert degrees to radians\n point1 = to_radians(point1)\n point2 = to_radians(point2)\n\n # compute deltas\n dlat = point2[0] - point1[0]\n dlon = point2[1] - point1[1]\n\n a = (Math.sin(dlat / 2)) ** 2 + Math.cos(point1[0]) *\n (Math.sin(dlon / 2)) ** 2 * Math.cos(point2[0])\n c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))\n c * earth_radius\n end",
"def distance_between(city_1, city_2)\n Math.hypot(city_2.x - city_1.x, city_2.y - city_1.y)\nend",
"def distance_from_the_planet other_planet\n return (@distance_from_the_sun - other_planet.distance_from_the_sun).abs.round(2)\n end",
"def dist(x, y)\n z = -x-y\n [x.abs, y.abs, z.abs].max\nend",
"def distance2d(x = 0, y = nil)\n if !y && x.respond_to?(:x)\n x, y = x.x, x.y\n else\n y ||= 0\n end\n\n Math.sqrt((x - self.x)**2 + (y - self.y)**2)\n end",
"def distance(loc)\n x = (loc.longitude_rad-self.longitude_rad) * Math.cos((self.latitude_rad+loc.latitude_rad)/2);\n y = (loc.latitude_rad-self.latitude_rad);\n Math.sqrt(x*x + y*y) * EARTH_R;\n end",
"def distance(other_node)\n raise ArgumentError, \"A Node must be given as input.\\n Received a #{other_node.class}\" unless other_node.is_a? Node\n\n return (\n (@x - other_node.x) ** 2 +\n (@y - other_node.y) ** 2\n ) ** (0.5)\n end",
"def distance(other_vector)\n dx = @x - other_vector.x\n dy = @y - other_vector.y\n Math.sqrt(dx ** 2 + dy ** 2)\n end",
"def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end",
"def distance(origin = Ratio[1,1], config = HD::HDConfig.new)\n # Take weights from the config argument\n weights = config.prime_weights\n\t\t\t# pc_only means that we ignore octaves\n\t\t\tconfig.pc_only ? (weights[0] = 1.0) : false\n # Get the factors of the interval between self and the origin arg\n factors = (self.dup / origin).factors\n # The weights array and factors array must be the same size, because\n # otherwise there's the potential of missing weights, or untraceable\n # bugs.\n if factors.size != weights.size\n warn \"Weights and factors are not the same size!\" \n puts \"Factors size: #{factors.size}, Weights size: #{weights.size}\"\n end\n # If the Ratio in question contains a prime number factor whose weight\n # has been set to 0, then it is outside of the harmonic space, and its\n # distance is Infinity. To say that a certain prime factor \"doesn't\n # matter\" (e.g., \"octave equivalency\"), set that factor's weight to 1.\n if ((factors.ne 0) & (weights.ne 0)) != (factors.ne 0)\n return NMath.log2(0) * -1\n else \n # Calculation of the city block metric, using vectors instead of\n # iteration.\n wf = weights ** factors.abs\n NMath.log2((wf).abs[wf.ne 0.0].prod)\n end\n end",
"def calculate_distance(point_a, point_b)\n to_radians = proc { |x| x * Math::PI / 180 }\n lat_a = to_radians.call(point_a.latitude / COORD_FACTOR)\n lat_b = to_radians.call(point_b.latitude / COORD_FACTOR)\n lon_a = to_radians.call(point_a.longitude / COORD_FACTOR)\n lon_b = to_radians.call(point_b.longitude / COORD_FACTOR)\n delta_lat = lat_a - lat_b\n delta_lon = lon_a - lon_b\n a = Math.sin(delta_lat / 2)**2 +\n Math.cos(lat_a) * Math.cos(lat_b) +\n Math.sin(delta_lon / 2)**2\n (2 * RADIUS * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))).to_i\nend",
"def distance(start_point, end_point)\n result = prepare_url(start_point, end_point)\n return result[\"routes\"].first[\"legs\"].first[\"distance\"][\"value\"]/1000\n end",
"def distance(other)\n (other - self).magnitude.abs\n end",
"def dist first, second\n first = first.is_a? Atom ? frac(first.pos(false)) : first.to_v\n second = second.is_a? Atom ? frac(second.pos(false)) : second.to_v\n real((first - second).map{|v| v = v % 1; v > 0.5 ? 1 - v : v}).magnitude\n end",
"def distance_to(point3)\n Math.sqrt(((@x-point3.x)**2)+((@y-point3.y)**2)+((@z-point3.z)**2))\n end",
"def distance(vector)\n Math.sqrt((@x - vector.x)**2 + (@y - vector.y)**2)\n end",
"def distance_to(other)\n latitude_rad = to_rad(latitude)\n longitude_rad = to_rad(longitude)\n\n other_latitude_rad = other.latitude * RAD_PER_DEG\n other_longitude_rad = other.longitude * RAD_PER_DEG\n\n # Deltas, converted to rad\n delta_longitude_rad = longitude_rad - other_longitude_rad\n delta_latitude_rad = latitude_rad - other_latitude_rad\n\n distance_rad = Math.sin(delta_latitude_rad / 2)**2 +\n Math.cos(latitude_rad) * Math.cos(other_latitude_rad) * Math.sin(delta_longitude_rad / 2)**2\n\n 2 * Math.asin(Math.sqrt(distance_rad)) * EARTH_RADIUS\n end",
"def get_distance\n return Math.hypot($game_player.real_x * 32 -\\\n self.mapx, $game_player.real_y * 32 - self.mapy)\n end",
"def distance(point1, options={})\n # fill in. see other distance functions for hints.\n end",
"def distance_preceding_leader\r\r\n sx = distance_x_from($game_player.x)\r\r\n sy = distance_y_from($game_player.y)\r\r\n return Math.hypot(sx, sy)\r\r\n end",
"def distance_to(n)\n return 0 unless n\n @@cache[self.object_id][n.object_id] ||= Math.sqrt((n.x - @x)**2 + (n.y - @y)**2)\n end",
"def absolute_distance(point_1, point_2)\n Math.sqrt((point_1.first - point_2.first) ** 2 + (point_1.last - point_2.last) ** 2)\n end",
"def distance_of_point_to_line(point, line, point_on_line)\n (point - point_on_line).dot((line).normal_unit).abs\n end",
"def dist(a, b)\n ax, ay, _ = a\n bx, by, _ = b\n\n (ax-bx).abs + (ay-by).abs\nend",
"def x_distance(new_x_coord)\n x_distance = (new_x_coord - x_position).abs\n end",
"def initial_distance(start_point, end_point)\n long1 = start_point.location.x\n long2 = end_point.location.x\n lat1 = start_point.location.y\n lat2 = end_point.location.y\n dtor = Math::PI/180\n r = 6378.14*1000\n\n rlat1 = lat1 * dtor\n rlong1 = long1 * dtor\n rlat2 = lat2 * dtor\n rlong2 = long2 * dtor\n\n dlon = rlong1 - rlong2\n dlat = rlat1 - rlat2\n\n a = (Math::sin(dlat/2)**2) + Math::cos(rlat1) * Math::cos(rlat2) * (Math::sin(dlon/2)**2)\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n d = r * c\n end",
"def distance_calculator(starting_position, ending_position)\n x_change = (starting_position[0] - ending_position[0])\n y_change = (starting_position[1] - ending_position[1])\n Math.sqrt(x_change*x_change + y_change*y_change)\n end",
"def dist(line_start, stop_start, stop_finish)\n x = $mta[line_start].index(stop_start)\n y = $mta[line_start].index(stop_finish)\n return (x - y).abs \nend",
"def distance_to(cell)\n (@x - cell.x).abs + (@y - cell.y).abs\n end",
"def distance_from shooter\n (self.position - shooter.position).length\n end",
"def delta\n @end_point - @start_point\n rescue\n 0\n end",
"def distance_to(other)\n # using Spherical Law of Cosines formula to calculate 'great circle' distance\n # http://www.movable-type.co.uk/scripts/latlong.html\n # assumes a spherical moon\n # result in is metres\n lat1_r = to_rad(self.lat)\n lat2_r = to_rad(other.lat)\n delta = to_rad(other.long - self.long)\n Math.acos(\n Math.sin(lat1_r) * Math.sin(lat2_r) +\n Math.cos(lat1_r) * Math.cos(lat2_r) * Math.cos(delta)\n ) * RADIUS\n end",
"def get_point()\n bearing = rand(@bearing)\n distance = rand(@max_distance)\n Vincenty.destination(@origin[:lat], @origin[:long], bearing, distance)\n end",
"def distance position\n return -1 if contains? position\n # If POI is given instead of location, get location first\n position = position.location if PointOfInterest === position\n # Set a ridiculous min distance. Any way around this?\n min_dist = 999999999\n\n # Iterate over every edge-point (vertex)\n vertices.each_cons(2) do |vertices|\n c_v = vertices[0]\n o_v = vertices[1]\n\n r = ((c_v - o_v) * (position - o_v)) / (position - o_v).magnitude\n\n if r < 0 then dist = (position - o_v).magnitude\n elsif r > 1 then dist = (c_v - position).magnitude\n else dist = (position - o_v).magnitude ** 2 - r * (c_v - o_v).magnitude ** 2\n end\n\n min_dist = [dist, min_dist].min\n end\n min_dist\n end",
"def distanceCalculation(x1, y1, _z1, x2, y2, z2)\n Math.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (y1 - z2)**2)\n end",
"def distance(c1,c2)\n x = c1[0] - c2[0]\n y = c1[1] - c2[1]\n y = y <= -180 ? y + 360 : y\n y = y >= 180 ? y - 360 : y\n return Math.sqrt(x*x+y*y)\n end",
"def distance(p0,p1,p2)\r\n if p1.lat == p2.lat and p1.lng == p2.lng\r\n out = Math.sqrt(((p2.lat - p0.lat)**2) + ((p2.lng - p0.lng)**2))\r\n else\r\n u = ((p0.lat - p1.lat)*(p2.lat - p1.lat)+(p0.lng - p1.lng)*(p2.lng - p1.lng))/\r\n (((p2.lat - p1.lat)**2) + ((p2.lng - p1.lng)**2))\r\n if u <= 0\r\n out = Math.sqrt( ((p0.lat - p1.lat)**2 ) + ((p0.lng - p1.lng)**2) )\r\n end\r\n if u >= 1\r\n out = Math.sqrt(((p0.lat - p2.lat)**2) + ((p0.lng - p2.lng)**2))\r\n end\r\n if 0 < u and u < 1\r\n out = Math.sqrt( ((p0.lat-p1.lat-u*(p2.lat-p1.lat))**2) +\r\n ((p0.lng-p1.lng-u*(p2.lng-p1.lng))**2) )\r\n end\r\n end\r\n return out\r\n end"
] |
[
"0.8327852",
"0.8308164",
"0.7671068",
"0.7415899",
"0.7370578",
"0.7354797",
"0.73235816",
"0.724875",
"0.72459793",
"0.72086984",
"0.7202859",
"0.71280086",
"0.7115314",
"0.71111023",
"0.70862114",
"0.7076062",
"0.7064262",
"0.70288336",
"0.70276225",
"0.6999836",
"0.6985935",
"0.69772834",
"0.69680893",
"0.69150436",
"0.6869853",
"0.68571395",
"0.68515354",
"0.68120116",
"0.67857206",
"0.67659587",
"0.67594355",
"0.67399037",
"0.67328817",
"0.67316324",
"0.6728346",
"0.6726903",
"0.6721708",
"0.66982937",
"0.6695262",
"0.66803014",
"0.66727597",
"0.6651927",
"0.6626143",
"0.6621328",
"0.6575107",
"0.6573614",
"0.65523785",
"0.6534671",
"0.6532532",
"0.65311223",
"0.65308136",
"0.6517918",
"0.651018",
"0.650811",
"0.6494386",
"0.6493811",
"0.6491063",
"0.6484311",
"0.6476115",
"0.6472054",
"0.6466955",
"0.64524543",
"0.6446179",
"0.6445724",
"0.644249",
"0.6408951",
"0.64005417",
"0.63979936",
"0.6392592",
"0.6386141",
"0.63565266",
"0.63501143",
"0.6348359",
"0.6346118",
"0.63245773",
"0.6324575",
"0.63224685",
"0.6321365",
"0.62973446",
"0.6284397",
"0.62707424",
"0.62584037",
"0.62537014",
"0.62435377",
"0.62337047",
"0.6225711",
"0.6195705",
"0.6194926",
"0.61903316",
"0.61871725",
"0.6179355",
"0.61716545",
"0.61541253",
"0.6131256",
"0.6130503",
"0.61206603",
"0.60971224",
"0.6094025",
"0.60926205",
"0.60819453",
"0.607696"
] |
0.0
|
-1
|
Distance between two points
|
def bbpDistance(first_point, second_point)
bbpLenght(bbpSub(first_point, second_point))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def distance(point2)\n end",
"def distance(x1, y1, x2, y2)\n Math.sqrt((y2 - y1)**2 + (x2 - x1)**2)\n end",
"def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend",
"def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def distance(point1, point2)\n # square root of (x2-x1) squared + (y2-y1) squared\n Math.sqrt(((point2[0]-point1[0])**2)+((point2[1]-point1[1])**2))\nend",
"def distance(a, b)\n Math.sqrt(((a.x - b.x) ** 2) + ((a.y - b.y) ** 2).abs)\n end",
"def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend",
"def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend",
"def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend",
"def distance_to(other)\n point.distance_to(other)\n end",
"def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end",
"def distance_between(point1, point2)\n (point1 - point2).mag\n end",
"def distance(p1,p2)\ndelta_x = p1[0] - p2[0]\ndelta_y = p1[1] - p2[1]\n\nMath.sqrt(delta_x ** 2 + delta_y **2)\n\nend",
"def distance(x1,y1,x2,y2)\n return ((x2 - x1)**2 + (y2 - y1)**2)**0.5\nend",
"def distance point\n dx = @x - point.x\n dy = @y - point.y\n Math.sqrt(dx**2 + dy**2)\n end",
"def distance(other)\n if other.is_a?(Point)\n return distance_between_points(self, other)\n end\n \n if other.respond_to?(:distance)\n return other.distance(self)\n end\n \n raise TypeError, \"Distance between Point and #{ other.class } is not defined\"\n end",
"def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end",
"def distance_between(p1, p2)\n Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)\n end",
"def distance_to(x, y)\n return Math.hypot(x - @x, y - @y)\n end",
"def distance(p1, p2)\n\t\tc = p1.count\n\t\tt = 0\n\t\tc.times do \t|n|\n\t\t\te = (p1[n] - p2[n]) ** 2\n\t\t\tt = t + e\t\t\n\t\tend\t\n\t\tt = Math.sqrt(t)\n\tend",
"def length\n points_distance(@x1, @y1, @x2, @y2)\n end",
"def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end",
"def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend",
"def distance a, b\n (a[0] - b[0]).abs + (a[1] - b[1]).abs\n end",
"def dist(a, b)\n ax, ay, _ = a\n bx, by, _ = b\n\n (ax-bx).abs + (ay-by).abs\nend",
"def distance(pt)\n x2, y2 = pt\n must_be_number(x2, 'pt.x')\n must_be_number(y2, 'pt.y')\n x1, y1 = xy\n hypot(x2 - x1, y2 - y1)\n end",
"def distance(a,b)\n\t(a-b).abs\nend",
"def get_distance_from_point_arrays(a1, a2)\n\t\t\tp1 = geofactory.point(a1[0],a1[1])\n\t\t\tp2 = geofactory.point(a2[0],a2[1])\n\n\t\t\treturn p1.distance(p2)\n\t\tend",
"def calculate_distance(point_a, point_b)\n to_radians = proc { |x| x * Math::PI / 180 }\n lat_a = to_radians.call(point_a.latitude / COORD_FACTOR)\n lat_b = to_radians.call(point_b.latitude / COORD_FACTOR)\n lon_a = to_radians.call(point_a.longitude / COORD_FACTOR)\n lon_b = to_radians.call(point_b.longitude / COORD_FACTOR)\n delta_lat = lat_a - lat_b\n delta_lon = lon_a - lon_b\n a = Math.sin(delta_lat / 2)**2 +\n Math.cos(lat_a) * Math.cos(lat_b) +\n Math.sin(delta_lon / 2)**2\n (2 * RADIUS * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))).to_i\nend",
"def distance_between\n # convert to coord arrays\n point1 = extract_coords([user.current_latitude, user.current_longitude])\n point2 = extract_coords([connection.current_latitude, connection.current_longitude])\n\n # convert degrees to radians\n point1 = to_radians(point1)\n point2 = to_radians(point2)\n\n # compute deltas\n dlat = point2[0] - point1[0]\n dlon = point2[1] - point1[1]\n\n a = (Math.sin(dlat / 2)) ** 2 + Math.cos(point1[0]) *\n (Math.sin(dlon / 2)) ** 2 * Math.cos(point2[0])\n c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))\n c * earth_radius\n end",
"def distance\n diff_longitude = @longitude_b - @longitude_a\n diff_latitude = @latitude_b - @latitude_a\n\n angle_a = (Math.sin(radius_to_degree(diff_latitude)/2.0)) ** 2 +\n Math.cos(radius_to_degree(@latitude_a)) *\n Math.cos(radius_to_degree(@latitude_b)) *\n (Math.sin(radius_to_degree(diff_longitude)/2.0)) ** 2\n angle_c = 2 * Math.atan2(Math.sqrt(angle_a), Math.sqrt(1-angle_a))\n\n (EARTH_RADIUS * angle_c) / 1000 # Returns the distance in kilometers\n end",
"def dist(a1, a2)\n Math.sqrt(a1.zip(a2).map { |x| (x[1] - x[0])**2 }.reduce(:+))\n end",
"def dist first, second\n first = first.is_a? Atom ? frac(first.pos(false)) : first.to_v\n second = second.is_a? Atom ? frac(second.pos(false)) : second.to_v\n real((first - second).map{|v| v = v % 1; v > 0.5 ? 1 - v : v}).magnitude\n end",
"def distance(point)\n Math.hypot(point.x - x, point.y - y)\n end",
"def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend",
"def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend",
"def distance(a, b)\n Integer(Math.sqrt(((b[0] - a[0])**2 + (b[1] - a[1])**2)))\n end",
"def distance(pt)\n raise ArgumentError unless is_point?(pt)\n return sqrt((pt.first - @xy.first) ** 2 + (pt.last - @xy.last) ** 2)\n end",
"def distance(other)\n other = Point.new(other[0], other[1]) if other.is_a?(Array)\n raise TypeError, \"Distance between Line and #{ other.class } is not defined\" unless other.is_a?(Point)\n\n return 0 if self.contains?(other)\n self.perpendicular_segment(other).length\n end",
"def distance(other)\n\t\treturn ((other.x-@x).abs + (other.y-@y).abs + (other.z-@z).abs)/2\n\tend",
"def distance(point1, options={})\n # fill in. see other distance functions for hints.\n end",
"def distance_to(p)\n x_diff = self.x-p.x\n y_diff = self.y-p.y\n return Math.sqrt(x_diff*x_diff + y_diff*y_diff)\n end",
"def distance_between(city_1, city_2)\n Math.hypot(city_2.x - city_1.x, city_2.y - city_1.y)\nend",
"def distance\n # we use memoization because calculating distance is expensive\n @distance ||= begin\n self.points.inject(nil) do |a, p|\n new_pt = p\n if a\n last_pt = Ubiquity::Point.new(a[:last_lat], a[:last_lon], {'ele' => a[:last_ele]})\n d = last_pt.to new_pt\n a[:dist] += d\n else\n a=Hash.new\n a[:dist]=0\n end\n a[:last_lat]=new_pt.lat\n a[:last_lon]=new_pt.lon\n a[:last_ele]=new_pt.elems['ele']\n a\n end[:dist]\n end\n end",
"def distance\n self.distance_from(@origin) * 1.609344\n end",
"def distance(c1,c2)\n x = c1[0] - c2[0]\n y = c1[1] - c2[1]\n y = y <= -180 ? y + 360 : y\n y = y >= 180 ? y - 360 : y\n return Math.sqrt(x*x+y*y)\n end",
"def absolute_distance(point_1, point_2)\n Math.sqrt((point_1.first - point_2.first) ** 2 + (point_1.last - point_2.last) ** 2)\n end",
"def distance(a, b)\n return @distance_function.call(a, b) if @distance_function\n return euclidean_distance(a, b)\n end",
"def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end",
"def distance_from(other)\n\t\t\trlong1 = self.longitude * D2R\n\t\t\trlat1 = self.latitude * D2R\n\t\t\trlong2 = other.longitude * D2R\n\t\t\trlat2 = other.latitude * D2R\n\t\t\t\n\t\t\tdlon = rlong1 - rlong2\n\t\t\tdlat = rlat1 - rlat2\n\t\t\t\n\t\t\ta = Math::sin(dlat/2) ** 2 + Math::cos(rlat1) * Math::cos(rlat2) * Math::sin(dlon/2) ** 2\n\t\t\tc = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\t\t\td = R * c\n\t\t\t\n\t\t\treturn d\n\t\tend",
"def distance_between(point1, point2)\n earth_radius_in_meters = 6371000\n radian_per_degree = Math::PI/180\n\n # Delta latitudes and longitudes in radians.\n delta_lat = (point2[0] - point1[0]) * radian_per_degree\n delta_lng = (point2[1] - point1[1]) * radian_per_degree\n\n lat1 = point1.first * radian_per_degree\n lat2 = point2.first * radian_per_degree\n\n a = Math.sin(delta_lat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(delta_lng / 2) ** 2\n b = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1 - a))\n\n earth_radius_in_meters * b\n end",
"def test_distance_to_point2\n point1 = Point.new(0, 0)\n point2 = Point.new(3, 4)\n assert_equal 5, point1.distance_to(point2)\n end",
"def distance(p0,p1,p2)\r\n if p1.lat == p2.lat and p1.lng == p2.lng\r\n out = Math.sqrt(((p2.lat - p0.lat)**2) + ((p2.lng - p0.lng)**2))\r\n else\r\n u = ((p0.lat - p1.lat)*(p2.lat - p1.lat)+(p0.lng - p1.lng)*(p2.lng - p1.lng))/\r\n (((p2.lat - p1.lat)**2) + ((p2.lng - p1.lng)**2))\r\n if u <= 0\r\n out = Math.sqrt( ((p0.lat - p1.lat)**2 ) + ((p0.lng - p1.lng)**2) )\r\n end\r\n if u >= 1\r\n out = Math.sqrt(((p0.lat - p2.lat)**2) + ((p0.lng - p2.lng)**2))\r\n end\r\n if 0 < u and u < 1\r\n out = Math.sqrt( ((p0.lat-p1.lat-u*(p2.lat-p1.lat))**2) +\r\n ((p0.lng-p1.lng-u*(p2.lng-p1.lng))**2) )\r\n end\r\n end\r\n return out\r\n end",
"def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end",
"def distance(v1, v2)\n sum_squares = node_count.times.reduce(0.0) do |sum, i|\n d = v1[i] - v2[i]\n sum + d * d\n end\n Math.sqrt(sum_squares)\n end",
"def distance(other_vector)\n dx = @x - other_vector.x\n dy = @y - other_vector.y\n Math.sqrt(dx ** 2 + dy ** 2)\n end",
"def euclidian_distance(point)\n Math.hypot((point.x - x),(point.y - y))\n end",
"def distance(node1, node2)\n distance = 0\n self.each_edge_in_path(node1, node2) do |source, target, edge|\n distance += get_edge_distance(edge)\n end\n distance\n end",
"def euclidian_distance(point)\r\n Math.sqrt((point.x - x)**2 + (point.y - y)**2)\r\n end",
"def calculate_distance_between(target)\n Math.sqrt((target.x - x)**2 + (target.y - y)**2)\n end",
"def get_distance(lat1, long1, lat2, long2)\n\tdistance = 0\n\tdistance = Math.sqrt((lat2 - lat1)**2 + (long2-long1)**2)\n\treturn distance\nend",
"def distance(other)\n (other - self).magnitude.abs\n end",
"def calculateDistance(r1,c1,r2,c2)\r\n\treturn Math.sqrt(((c1-c2) ** 2 + (r1 -r2) ** 2))\r\nend",
"def dist(r1, c1, r2, c2)\r\n return Math.sqrt((c1-c2)**2 + (r1-r2)**2)\r\nend",
"def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end",
"def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end",
"def distance_to(position)\n\t\t\tMath.sqrt((position.x - x).abs ** 2 + (position.y - y).abs ** 2)\n\t\tend",
"def dist(x, y)\n z = -x-y\n [x.abs, y.abs, z.abs].max\nend",
"def euclidean_distance_to(point)\n if self.dimensions != point.dimensions\n raise HonorRoll::IncompatibleDimensionsError\n end\n coord_pairs = self.coords.zip point.coords\n Math.sqrt coord_pairs.map{ |p| (p[0] - p[1])**2 }.reduce(:+)\n end",
"def distance2d(x = 0, y = nil)\n if !y && x.respond_to?(:x)\n x, y = x.x, x.y\n else\n y ||= 0\n end\n\n Math.sqrt((x - self.x)**2 + (y - self.y)**2)\n end",
"def distance obj\n\t\t\ta = obj.x-@x\n\t\t\tb = obj.y-@y\n\t\t\tc = Math.sqrt(a**2 + b**2)\t\n\t\tend",
"def calculate_distance(p1, p2)\r\n sum = 0\r\n for i in (0...p1.length)\r\n sum += (p1[i] - p2[i])**2\r\n end\r\n sum = sum.to_f\r\n return Math.sqrt(sum)\r\nend",
"def distance(loc1, loc2)\n\n lat1 = loc1[0].to_f\n lon1 = loc1[1].to_f\n\n lat2 = loc2[0].to_f\n lon2 = loc2[1].to_f\n\n dLat = conv_deg_rad(lat2 - lat1)\n dLon = conv_deg_rad(lon2 - lon1)\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1/180 * Math::PI) * Math.cos(lat2/180 * Math::PI) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n\n d = 6371e3 * c #meters\n\n return d\n end",
"def distance(lon1, lat1, lon2, lat2)\n Math.acos( Math.sin(lat1 * (Math::PI/180))*Math.sin(lat2*(Math::PI/180)) + Math.cos(lat1*Math::PI/180) * Math.cos(lat2*(Math::PI/180))*Math.cos((lon2 * Math::PI/180)-(lon1*Math::PI/180)) ) * 6371000\n end",
"def distanceCalculation(x1, y1, _z1, x2, y2, z2)\n Math.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (y1 - z2)**2)\n end",
"def distance(other_node)\n raise ArgumentError, \"A Node must be given as input.\\n Received a #{other_node.class}\" unless other_node.is_a? Node\n\n return (\n (@x - other_node.x) ** 2 +\n (@y - other_node.y) ** 2\n ) ** (0.5)\n end",
"def distance_between(lat1, lon1, lat2, lon2)\n lat1_rad, lat2_rad = lat1 * RAD_PER_DEG, lat2 * RAD_PER_DEG\n lon1_rad, lon2_rad = lon1 * RAD_PER_DEG, lon2 * RAD_PER_DEG\n\n a = Math.sin((lat2_rad - lat1_rad) / 2) ** 2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin((lon2_rad - lon1_rad) / 2) ** 2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1 - a))\n\n RM * c # Delta in meters\nend",
"def distance(g0, g1)\n Math::sqrt( ((g1.lat-g0.lat).abs**2) + ((g1.lon-g0.lon).abs**2) )\n end",
"def distance_to(other)\n latitude_rad = to_rad(latitude)\n longitude_rad = to_rad(longitude)\n\n other_latitude_rad = other.latitude * RAD_PER_DEG\n other_longitude_rad = other.longitude * RAD_PER_DEG\n\n # Deltas, converted to rad\n delta_longitude_rad = longitude_rad - other_longitude_rad\n delta_latitude_rad = latitude_rad - other_latitude_rad\n\n distance_rad = Math.sin(delta_latitude_rad / 2)**2 +\n Math.cos(latitude_rad) * Math.cos(other_latitude_rad) * Math.sin(delta_longitude_rad / 2)**2\n\n 2 * Math.asin(Math.sqrt(distance_rad)) * EARTH_RADIUS\n end",
"def distance(a, b)\n if a.is_a?(String) && b.is_a?(String)\n Twins::Utilities.string_distance(a, b) * -1\n elsif a.is_a?(Numeric) && b.is_a?(Numeric)\n Twins::Utilities.numeric_distance(a, b)\n else\n raise StandardError, \"Distance can only be determined between two elements of kind 'String' or 'Numeric'\"\n end\n end",
"def line_distance(node_one, node_two)\n\t\tx_one = node_one.position[0]\n\t\tx_two = node_two.position[0]\n\n\t\ty_one = node_one.position[1]\n\t\ty_two = node_two.position[1]\n\n\t\tMath.hypot(x_one - x_two, y_one - y_two)\n\tend",
"def distance(pos2)\n return $game_map.distance(self, pos2)\n end",
"def distance(other)\n other = Point.new(other[0], other[1]) if other.is_a?(Array)\n\n if other.is_a?(Point)\n dist = BigDecimal('Infinity')\n \n sides.each do |side|\n current = side.distance(other)\n if current == 0\n return 0\n elsif current < dist\n dist = current\n end\n end\n \n return dist\n\n elsif other.is_a?(Polygon) && self.is_convex? && other.is_convex?\n return do_poly_distance(other)\n end\n\n raise TypeError, \"Distance not handled for #{ other.class }\"\n end",
"def calc_distance(point1, point2, summ = 0)\n point1.each.with_index do |a, index|\n summ += (a - point2[index])**2\n end\n Math.sqrt(summ)\n end",
"def dist point\n point = point.pos(false) if point.is_a? Atom\n (point.to_v- @p).to_a * @normal / @normal.magnitude\n end",
"def distance4(*points)\n x1, y1, x2, y2 = points.flatten\n raise ArgumentError unless [x1, y1, x2, y2].all? { |e| e.is_a? Numeric }\n Math.hypot(x2 - x1, y2 - y1)\nend",
"def distance_from_line(point_a,point_b)\n \n # Define the line as the vector between two points\n line_vector = point_b - point_a\n\n # Define a second vector representing the distance between self and the line start\n point_vector = self - point_a\n\n # The magnitude of the cross product is equal to the area of the parallelogram described\n # by the two vectors. Dividing by the line length gives the perpendicular distance.\n (line_vector.cross(point_vector).magnitude / line_vector.magnitude).abs\n end",
"def distance_metric(product1, product2) (get_value(product1) - get_value(product2)).abs end",
"def dist_to(other)\n (other - self).length\n end",
"def distance_to(other)\n Math.sqrt((0..(self.dimension_count-1)).map {|d| (other.value(d) - self.value(d)) ** 2 }.reduce(&:+))\n end",
"def geo_dist(from, to)\n return 40000 if [from.lat, from.lon, to.lat, to.lon].any?(&:nil?)\n EARTH_DIAMETER * Math.asin(Math.sqrt(\n Math.cos(from.lat) * Math.cos(to.lat) *\n Math.sin((from.lon - to.lon)/2) ** 2 +\n Math.sin((from.lat - to.lat)/2) ** 2\n ))\nend",
"def jaro_distance( s1, s2 )\n jaro_distance_internal( Input.new( s1, s2 ) )\n end",
"def dist(v)\n dx = v.x - @x\n dy = v.y - @y\n Math.sqrt(dx*dx + dy*dy)\n end",
"def distance(vector2)\n Math.sqrt(distance_sq(vector2))\n end",
"def distance2_to(data_point)\n [@coordinates,data_point.coordinates].transpose.map{|arr| arr.inject{|sum, coordinate| (sum - coordinate)**2}}.inject(:+)\n end",
"def distanceBetweenTwoPointsLatAndLongInMI(lat1, long1, lat2, long2)\n return distanceBetweenTwoPointsLatAndLongInKM(lat1, long1, lat2, long2) * 0.621371;\n end",
"def dist other\n case other\n when Atom\n pos = other.pos(false)\n when Surface\n return other.dist(self)\n else\n pos = pos.to_v \n end\n if @units == :angstrom\n (@pos - pos).magnitude\n else\n @cell.dist(self, other)\n end\n end"
] |
[
"0.8387065",
"0.8352606",
"0.83338624",
"0.8330848",
"0.81032133",
"0.8074107",
"0.80103105",
"0.80089635",
"0.79939014",
"0.7987748",
"0.7984435",
"0.79826033",
"0.7951611",
"0.7946804",
"0.7929356",
"0.7848368",
"0.7841648",
"0.78271395",
"0.7824876",
"0.7789454",
"0.7771423",
"0.7768972",
"0.7712821",
"0.76935506",
"0.76870567",
"0.7646846",
"0.75741893",
"0.75504476",
"0.7531366",
"0.7528948",
"0.7450672",
"0.74218756",
"0.7417312",
"0.7394983",
"0.735095",
"0.7342275",
"0.7341415",
"0.7335471",
"0.73351824",
"0.73351824",
"0.7307025",
"0.7303959",
"0.72938555",
"0.7286",
"0.7283431",
"0.7267201",
"0.7259867",
"0.7226813",
"0.72232556",
"0.72208625",
"0.72152567",
"0.72126114",
"0.7209406",
"0.72026384",
"0.71821326",
"0.71666145",
"0.71488357",
"0.71129125",
"0.7089739",
"0.70876914",
"0.7081358",
"0.70768696",
"0.7065228",
"0.7054252",
"0.7047874",
"0.70287746",
"0.70282876",
"0.7014164",
"0.6981023",
"0.6981023",
"0.6967956",
"0.69602376",
"0.69424176",
"0.69350946",
"0.69199306",
"0.6917487",
"0.6915926",
"0.691451",
"0.69139665",
"0.69124883",
"0.69080156",
"0.6905682",
"0.68931335",
"0.68890655",
"0.688308",
"0.6882982",
"0.6872955",
"0.6855105",
"0.6841379",
"0.68184686",
"0.68165386",
"0.68126965",
"0.6809727",
"0.68051213",
"0.679505",
"0.67902577",
"0.67861694",
"0.67811733",
"0.67754686",
"0.674957",
"0.67440766"
] |
0.0
|
-1
|
Point multiplied to a lenght of 1
|
def bbpNormalize(point)
bbpMult(point, 1.0 / bbpLenght(point))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def multiply\n inject(1) { |p,x| p * x }\n end",
"def multiply_els\n\t\tself.my_inject(:*, self[0])\n\tend",
"def multiply_els(arr)\n arr.my_inject(1, '*')\nend",
"def *(scalar)\n raise TypeError, \"Multiplication between Point and #{ scalar.class } is not defined\" unless scalar.is_a?(Numeric)\n Point.new(x * scalar, y * scalar)\n end",
"def *(coef)\n Point.new(@x * coef, @y * coef)\n end",
"def ip(p)\n (0...size).inject(0) { |sum, i| sum + @coords[i] * p[i] }\n end",
"def ip(p)\n (0...size).inject(0) { |sum, i| sum + @coords[i] * p[i] }\n end",
"def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end",
"def calc_product(ary, index, len)\n prod = 1\n print \"1\"\n ((index-(len-1))..index).each{|d| \n prod = prod * ary[d]\n print \" x #{ary[d]}\" \n }\n puts \" = #{prod}\"\n prod\nend",
"def *(value)\n mul(value) ;\n end",
"def scale(factor)\n Point.new(self.x * factor, self.y * factor)\n end",
"def productify(array)\n prods = [1] * array.length\n current = array[0]\n (1...array.length).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n current = array[-1]\n (array.length - 2).downto(0).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n\n prods\nend",
"def multiply_els(arr)\n arr.my_inject('*')\nend",
"def multiply_els(arr)\n arr.my_inject('*')\nend",
"def multiply_els(arr)\n arr.my_inject('*')\nend",
"def get_perlin_item_1d(x, array)\n array[get_perlin_int_1d(x, 0, array.length-1)]\n end",
"def get_perlin_item_1d(x, array)\n array[get_perlin_int_1d(x, 0, array.length-1)]\n end",
"def scaled_point\n val = self.class.base.new(@value * self.class.size)\n val.kind_of?(ScaledPoint) ? val : val.scaled_point\n end",
"def product(number)\n (1..number).inject(:*)\nend",
"def pi_product\n self.inject{|a,b| a*b}\n end",
"def star (points, length)\n raise \"The star must have an odd number of points\" if points % 2 == 0\n points.times do\n line length\n turn (720.0/points).degrees\n end\n end",
"def multiply_els(ray)\n ray.my_inject(1) {|prod, n| prod * n } \nend",
"def *( scalar )\n self.class.new( @x * scalar, @y * scalar )\n end",
"def multiply_els(arr)\n arr.my_inject(1, :*)\nend",
"def multiply(array)\n array.inject(:*)\nend",
"def element_times_index(numbers)\n\tfor i in 0..numbers.length-1\n numbers[i] *= i\n end\n return numbers\nend",
"def x2\n x + width\n end",
"def square!\n\t\tself.each_with_index do |elem, i|\n\t\t\tself[i] = elem * elem\n\t\tend\n\tend",
"def mul(pointer, pmodes)\n args = get_parameters(pointer, pmodes)\n @ram[args[2]] = args[0] * args[1]\n pointer + 4\n end",
"def productify(arr)\n\n up_product = 1\n up_array = []\n arr.length.times do |idx|\n up_product *= arr[idx]\n up_array << up_product\n end\n\n down_product = 1\n down_array = Array.new(arr.length)\n (arr.length - 1).downto(0) do |idx|\n down_product *= arr[idx]\n down_array[idx] = down_product\n end\n\n result = []\n arr.length.times do |idx|\n product = 1\n up_idx = idx - 1\n down_idx = idx + 1\n if up_idx >= 0\n product *= up_array[up_idx]\n end\n if down_idx < arr.length\n product *= down_array[down_idx]\n end\n result[idx] = product\n end\n\n result\n\nend",
"def product(numbers)\n if numbers.length > 0\n # inject pushes a character into every position of an\n # array, in this case multiplying each integer by the next\n numbers.inject(:*)\nelse\n return 1\nend\nend",
"def to_point\n if length == 2\n p = Point.new(*self)\n elsif length == 1\n p = self[0].clone\n end\n return p\n end",
"def multiply_els(array)\n\tarray.inject(1) { |num, item| num * item }\n\nend",
"def pt___x(n, y); ptdist(n, 1.0 - y); end",
"def multiply_els(array)\n array.my_inject(:*)\nend",
"def multiply_els(array)\n array.my_inject(:*)\nend",
"def multiply_els(array)\n array.my_inject(:*)\nend",
"def transformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])*@zoom + (@center[i] - @old_center[i])*@zoom + @old_center[i]\r\n end\r\n end",
"def scale_up(scale)\n self.side_length *= scale\n end",
"def multiply_els(arr)\n\tarr.my_inject(1) do |res, i| \n\t\tres * i \n\tend\nend",
"def multiply(x, y)\n return y if x == 1\n\n y + multiply(x - 1, y)\nend",
"def multiply(num)\n if num.length <= 0\n return 0\n elsif num.length == 1\n return num[0]\n else\n idx = 0\n result = 1\n while idx < num.length\n result *= num[idx]\n idx += 1\n end\n return result\n end\nend",
"def produto(array)\n acumulador=1\n for x in (0..array.size-1)\n acumulador=acumulador*array[x]\n end\n return acumulador\nend",
"def translate(*offset)\n p = Point.new(*offset)\n self + p\n end",
"def 😀 value\n self.map {|d| d * value}\n end",
"def *(a)\n if a.class == Vector # inner product\n product = 0\n self.each_index{|k| product += self[k]*a[k]}\n else\n product = Vector.new # scalar product\n self.each_index{|k| product[k] = self[k]*a}\n end\n product\n end",
"def product(arr)\n product = 1\n for i in 0...arr.length\n product *= arr[i]\n end\n product\nend",
"def pow base, p\n base ** p\n end",
"def multiply_els(array)\n array.my_inject(1) { |product, i| product * i }\nend",
"def multiply_els(arr)\n arr.my_inject(1) { |total, x| total * x }\nend",
"def *(x)\n if x._isNumeric\n # els = @elements.collect{|e| e * x} \n my_elems = @elements\n e_size = my_elems.size\n els = Array.new(e_size)\n for i in 0..e_size-1 do\n els[i] = my_elems[i] * x\n end\n\n Vector.elements(els, false)\n else\n matrix_cls = Matrix\n if x._kind_of?( matrix_cls )\n matrix_cls.column_vector(self) * x\n else\n cr = x.coerce(self)\n cr[0] * cr[1]\n end\n end\n end",
"def multiply_els(arr)\n arr.my_inject(:*)\nend",
"def multiply_els(arr)\n arr.my_inject(:*)\nend",
"def multiply_els(arr)\n arr.my_inject(:*)\nend",
"def multiply_els(arr)\n arr.my_inject(:*)\nend",
"def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end",
"def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end",
"def Multiply(val)\n self.value *= val\n end",
"def ptx__x(n, y); ptdist(n, 1.0 - y / 2.0); end",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = @length.times.collect do\n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def my_product(array)\n return nil if array.length == 0\n\n product = 1\n array.each do |elem|\n product = product * elem\n end\n product\nend",
"def * number\n self.class[ self.with_values do |v| v * number end ]\n end",
"def *(val)\n #result = Marshal.load(Marshal.dump(self))\n\n self.class.new(@axes.map{|vec| vec * val})\n end",
"def pow1pm1(x, y)\n (x <= -1) ? ((1 + x) ** y) - 1 : Math.exp(y * Math.log(1.0 + x)) - 1\n end",
"def product(int)\n (1..int).reduce(1,:*)\nend",
"def multiply(y)\n @x * y\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def raise_to_power(x, y)\n #every shift left is like a * 2\n #11000\nend",
"def perpdot v\n (@x * v.y) - (@y * v.x)\n end",
"def new_point(p)\n case p\n when :infinity\n infinity\n when Array\n x, y = p\n Point.new(self, x, y)\n when Integer\n generator.multiply_by_scalar(p)\n else\n raise ArgumentError, \"Invalid point specifier #{p.inspect}.\"\n end\n end",
"def gen(x, y)\n return 384 + x + (y * 8)\n end",
"def index(x, y)\n (y - 1) * width + (x - 1)\n end",
"def y(from = 0)\n self[1,2].to_i - 1 + from\n end",
"def multiply(x,y) \n\tx * y\t\nend",
"def multiply_num(arr) # The round brakets gives the starting value\n arr.inject(1) do |quot, num| #quot survive, num gets multiplied on\n quot * num\n end\nend",
"def power(arr_in)\n\treturn nil if arr_in.length != 2\n\ttotal = 1\n\tarr_in.last.times { total*= arr_in.first }\n\ttotal\nend",
"def square a\n a * a\nend",
"def kali(panjang_arr,a)\n\ttotal=1\n\t(0..(panjang_arr-1)).each do |i|\n\t\ttotal=total*a[i]\n\tend\n\treturn total\nend",
"def print_triangle2(arg)\n array = (1..arg).to_a\n dot = []\n array.map do |num|\n dot.push(\"*\" * num)\n end\n puts dot\nend",
"def current_size\n @multiplier ||= 1.0\n @multiplier *= 0.99\n [@multiplier, @multiplier]\n end",
"def to_outer(point)\n transform * point\n end",
"def centerx; return self[0]+(self[2].div(2)); end",
"def scale(factor)\n x = x2 - x1\n y = y2 - y1\n Line.new(p1, Point.new(x1 + (x * factor), y1 + (y * factor)))\n end",
"def product_array(a)\n len=a.length\n product=Array.new(len,1) # Initilaize product array elements to 1\n temp=1\n\n #Loop to store product of left elements\n for i in 0...len\n product[i]=temp\n temp*=a[i]\n end\n\n temp=1 #reset temp variable to 1\n\n #Loop to multiply stored left products with right products\n for i in (len-1).downto(0)\n product[i]*=temp\n temp*=a[i]\n end\n\n return product\nend",
"def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end",
"def products_at_point(x,y)\n -1.upto(1) do |j|\n -1.upto(1) do |k|\n unless (j == 0 && k == 0)\n product = 1\n 0.upto(ADJACENT - 1) do |factor|\n row = x + j * factor\n col = y + k * factor\n next if row < 0 || col < 0 || row >= GRID_SIZE || col >= GRID_SIZE\n product *= @grid[row][col]\n fin = factor == ADJACENT - 1\n @largest_product = product if fin && product > @largest_product\n end\n end\n end\n end\n end",
"def custom_multiply(array,number)\n new_array = []\n number.times {new_array+=array}\n return new_array\nend",
"def multiply_els(array)\n array.my_inject { |item, next_item| item * next_item }\nend",
"def multiply(chars)\n result = chars[0]\n \n for i in 1...chars.length\n result = binaryMultiply(result, chars[i])\n end\n \n result\n end",
"def multiply(x,y)\n\tx*y\nend",
"def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end",
"def multiply (array)\n\tarray.inject(1) do |result, element|\n\t\tresult * element\n\tend\nend",
"def pow1p(x, y)\n (x.abs > 0.5) ? ((1 + x) ** y) : Math.exp(y * Math.log(1.0 + x))\n end",
"def mod_mult (p, n)\n q = p\n r = Point.new Float::INFINITY, Float::INFINITY\n\n while n > 0\n if n % 2 == 1\n r = self.mod_add r, q\n end\n\n q = self.mod_add q, q\n n = (n / 2).floor\n end\n r\n end",
"def *(scalar)\n Vector.new @x * scalar, @y * scalar\n end",
"def granule(startPos, length)\n @amplitudes[startPos..startPos+length-1]\n end",
"def multiply_by x,y,n\n (1..n).map {|i| x * y**i}\nend",
"def propose(x)\n y = x.clone\n y[@index] = x[@index] + @width*(rand-0.5)\n y\n end",
"def multiplyArray (a)\n if (a.size == 0)\n return 1\n end\n\n total = 1\n\n return a.reject(&:zero?).inject(:*) # rejecting zero prevents the product from becoming zero\nend",
"def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| result << element}}\n result\nend",
"def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend"
] |
[
"0.60749066",
"0.60199714",
"0.5937578",
"0.57926774",
"0.5753992",
"0.57525074",
"0.57525074",
"0.5703181",
"0.56583667",
"0.56503755",
"0.56345004",
"0.562874",
"0.56202465",
"0.56202465",
"0.56202465",
"0.5612643",
"0.5612643",
"0.5589589",
"0.5557254",
"0.55523044",
"0.55430156",
"0.55284464",
"0.5524381",
"0.55243284",
"0.5516667",
"0.5500512",
"0.5498027",
"0.5492251",
"0.54823595",
"0.5473788",
"0.5465628",
"0.54608697",
"0.5453074",
"0.54429406",
"0.54401565",
"0.54401565",
"0.54401565",
"0.5428149",
"0.5420169",
"0.5413883",
"0.54024106",
"0.54023606",
"0.53974575",
"0.5397081",
"0.5386296",
"0.5384948",
"0.5374134",
"0.53683865",
"0.536403",
"0.53630835",
"0.5357089",
"0.53522664",
"0.53522664",
"0.53522664",
"0.53522664",
"0.53387934",
"0.53270996",
"0.53264743",
"0.5314604",
"0.52939826",
"0.5278379",
"0.527459",
"0.52635175",
"0.5260325",
"0.5259606",
"0.52583367",
"0.5249458",
"0.5249444",
"0.5233376",
"0.5231937",
"0.5227011",
"0.5224437",
"0.52193964",
"0.5217725",
"0.52160466",
"0.52151877",
"0.52098376",
"0.52084464",
"0.52078956",
"0.52073205",
"0.52045625",
"0.52032316",
"0.5196494",
"0.5196016",
"0.5194517",
"0.51936144",
"0.51931816",
"0.51925415",
"0.51924807",
"0.51909804",
"0.519054",
"0.51881796",
"0.5187877",
"0.5184259",
"0.5181758",
"0.51796836",
"0.5175897",
"0.51717645",
"0.5166849",
"0.5163945",
"0.5163879"
] |
0.0
|
-1
|
Converts radians to a normalized vector
|
def bbpForAngle(angle)
bbp(Math.cos(angle), Math.sin(angle))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalize\n mag = self.magnitude\n Vector.new @x/mag, @y/mag, @z/mag\n end",
"def normalize\n f = 1.0 / length\n Vector2.new(@x * f, @y * f)\n end",
"def normal_vector\n return @nv unless @nv.nil? \n\n nv = self.area_vector\n length = nv.abs\n\n nvv=nv.map { |e| e/length }\n def nvv.to_s\n \"NV:=(#{self[0]}, #{self[1]}, #{self[2]})\"\n end\n @nv = nvv\n end",
"def normalize_vector(v)\n d = v[0]*v[0] + v[1]*v[1]\n if d != 1\n root = Math.sqrt(d)\n v[0] /= root\n v[1] /= root\n end\n v\n end",
"def compute_normal_vector(line)\n h = line[:y2] - line[:y]\n w = line[:x2] - line[:x]\n normalize vec2(-h, w)\n end",
"def normalize\n divide(magnitude)\n end",
"def normalize\n self / self.norm\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def norm\n m = mag\n @x /= m\n @y /= m\n self\n end",
"def direction\n self.vector.normalize\n end",
"def normalize\n [@x / Math.sqrt(@x**2 + @y**2), @y / Math.sqrt(@x**2 + @y**2)]\n end",
"def udot( vector )\n unit.dot( vector.unit )\n end",
"def norm\r\n (@real * @real) + @axis.modulus\r\n end",
"def norm\n Math.sqrt((@a**2) + (@b**2) + (@c**2) + (@d**2))\n end",
"def norm(v)\n len = Math.sqrt(v[0]**2 + v[1]**2)\n [v[0] / len, v[1] / len] \nend",
"def normalize\n f = 1.0 / length\n Normal3.new(@x * f, @y * f, @z * f)\n end",
"def norm\n Math::sqrt(data.values.inject(0) { |m,v| m+v**2})\n end",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def unit_vector(p1, p2)\n x = p2[0] - p1[0]\n y = p2[1] - p1[1]\n normalize_vector([x,y])\n end",
"def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def calculate_norm_and_orientation\n x, y = @components.values\n @norm = Math.sqrt( x**2 + y**2 )\n @orientation = calculate_orientation\n end",
"def normalizePoint(point, normalizer)\n x = point[0] + normalizer[0]\n y = point[1] + normalizer[1]\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x +360 : x\n x = x >= 180 ? x +360 : x\n return [x,y]\n end",
"def vector_x max_value = 1\n max_value * Math.cos(self.to_radians)\n end",
"def real(vector) \n @abc2xyz * vector.to_v \n end",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end",
"def normalize!\n mag = magnitude\n return self if mag == 0\n self.x, self.y, self.z = self.x / mag, self.y / mag, self.z / mag\n self\n end",
"def unit_perpendicular_vector(options={})\n return [self[1], -self[0]].unit_vector if options[:counter_clockwise]\n [-self[1], self[0]].unit_vector\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def inf_norm\n self.to_a.map do |a|\n a.map do |ar|\n ar.abs\n end.inject(&:+)\n end.sort[0]\n end",
"def normalize(x)\n if x.ndim == 2\n s = Numo::SFloat::Math.sqrt((x**2).sum(axis: 1))\n x / s.reshape(s.shape[0], 1)\n elsif x.ndim == 1\n s = Numo::SFloat::Math.sqrt((x**2).sum)\n x / s\n end\nend",
"def magnitude(vector)\n\n Math::sqrt((vector.x**2) + (vector.y**2) + (vector.z**2))\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def reciprocalize\n Unit.unity / self\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def / ( *vector_or_number ); v = Vector2d::new( vector_or_number ); Vector2d.new( @x / v.x, @y / v.y ); end",
"def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend",
"def abs\r\n Math.sqrt(norm)\r\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def estimate_normal(\n p # vec3\n)\n Vec3.new(\n scene_sdf(Vec3.new(p.x + $EPSILON, p.y, p.z)) - scene_sdf(Vec3.new(p.x - $EPSILON, p.y, p.z)),\n scene_sdf(Vec3.new(p.x, p.y + $EPSILON, p.z)) - scene_sdf(Vec3.new(p.x, p.y - $EPSILON, p.z)),\n scene_sdf(Vec3.new(p.x, p.y, p.z + $EPSILON)) - scene_sdf(Vec3.new(p.x, p.y, p.z - $EPSILON))\n ).normalize\nend",
"def normal(p)\n return (p - @centre).unit\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def normal\n u = (a.subtract b).normalize\n v = (c.subtract b).normalize\n u.cross v\n end",
"def norm positions\n\t\tproduct = scalar_product( positions, positions )\n\t\treturn product > 0.0 ? Math.sqrt( product ) : 0.0\n\tend",
"def to_rad(n_decimals = nil)\n map { |e| e.to_rad(n_decimals) }\n end",
"def normalized\n @value\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def normalize(min, max, val)\n\t\t(val - min) / (max - min)\n\tend",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def normalized; end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def normalize_longitude(longitude)\n while (longitude < -180) do\n longitude += 360\n end\n\n while (longitude >= 180) do\n longitude -= 360\n end\n\n longitude\n end",
"def normalise\n gcd = x.gcd(y)\n gcd = 1 if gcd.zero?\n\n self.class.new(x / gcd, y / gcd)\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def /(*vector_or_number)\n v = Vector2d::new(vector_or_number)\n Vector2d.new(@x/v.x, @y/v.y)\n end",
"def untransformed_vector(v)\r\n v.map{|x| x/@zoom }\r\n end",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def normalx__x(z); 2.0 - normaldist(z) * 2.0; end",
"def normal_vector a_point\n i_point = Point.new()\n i_point.add_object(self)\n plane = Plane.new.add_object(a_point).add_object([self, :normal])\n i_point.add_object(plane)\n Vector.new i_point, a_point\n end",
"def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end",
"def normal___x(z); 1.0 - normaldist(z); end",
"def rlat\n # lat * PI / 180\n self.lat * 0.01745329251994\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def normalize\n normalization_factor = norm_2(self)\n return self if normalization_factor.zero?\n\n self.scale (1.0 / normalization_factor.to_f)\n end",
"def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end",
"def normalize_x x\n (x.to_f + ((@width - @height) / @height) / 2) * @width / (@width/@height)\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def norm(p=2.0)\n if p.to_f == 2.0\n Blas::nrm2(@storage)\n else\n case p.infinite?\n when 1\n self[amax]\n when -1\n abs.min\n else\n map{|i| i**p}.asum**(1.0/p)\n end\n end\n end",
"def normalize!\n\t\t\tmagnitude = self.mag\n\t\t\t@elem.collect! {|elem| elem / magnitude}\n\t\t\treturn self\n\t\tend",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def asin\n Double.new(Math.asin(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def normalize\n x_alize(true)\n end",
"def delta_radians\n @lat1_rad, @lon1_rad = from.map {|i| i.to_f * RADIUS_PER_DEG }\n @lat2_rad, @lon2_rad = to.map {|i| i.to_f * RADIUS_PER_DEG }\n [ lat2_rad - lat1_rad, lon2_rad - lon1_rad ]\n end",
"def frac(vector) \n @xyz2abc * vector.to_v \n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end",
"def fro_matrix_norm\n #float64 has to be used in any case, since nrm2 will not yield correct result for float32\n self_cast = self.cast(:dtype => :float64)\n\n column_vector = self_cast.reshape([self.size, 1])\n\n return column_vector.nrm2\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def normal_units_uri\n UrisAreEolTerms.new(self).uri(:normal_units_uri)\n end",
"def convert_to_uv(abs_value, absolute_side)\n uv_value = (((abs_value.to_f - 0.5) / (absolute_side.to_f - 1)) - 0.5) * 2.0\n end",
"def magnitude()\n _nrm2()\n end",
"def angle_between(vector2)\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def /(scalar)\n Vector.new @x / scalar.to_f, @y / scalar.to_f\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end"
] |
[
"0.7094535",
"0.6945394",
"0.688879",
"0.6802745",
"0.6721968",
"0.6713653",
"0.6513767",
"0.6475846",
"0.644692",
"0.64419466",
"0.64011836",
"0.638333",
"0.6312412",
"0.61939144",
"0.6152047",
"0.612614",
"0.6024708",
"0.595478",
"0.59516764",
"0.5936181",
"0.5890293",
"0.58751875",
"0.5807765",
"0.5807765",
"0.5807171",
"0.5759288",
"0.5745592",
"0.5733364",
"0.57097024",
"0.5708658",
"0.5696164",
"0.56753254",
"0.56474763",
"0.56443596",
"0.5641817",
"0.5632425",
"0.5619944",
"0.5608628",
"0.5594986",
"0.5594537",
"0.55652946",
"0.5560222",
"0.5555936",
"0.55424887",
"0.55353266",
"0.5515427",
"0.5510108",
"0.550821",
"0.55024594",
"0.5501466",
"0.55009943",
"0.5493443",
"0.54873985",
"0.5471432",
"0.54638416",
"0.5452324",
"0.54522836",
"0.5447638",
"0.5436635",
"0.5433541",
"0.541903",
"0.5404897",
"0.54006135",
"0.53882504",
"0.5383527",
"0.5383527",
"0.5383158",
"0.5373618",
"0.53720015",
"0.5370021",
"0.5348709",
"0.5348513",
"0.532255",
"0.5313231",
"0.5313231",
"0.53108096",
"0.53023064",
"0.52997583",
"0.5293876",
"0.52933735",
"0.5277787",
"0.52656513",
"0.5263896",
"0.52416676",
"0.5238926",
"0.52388453",
"0.52378744",
"0.5234979",
"0.52204156",
"0.52195793",
"0.52056366",
"0.52017105",
"0.5192577",
"0.51864815",
"0.5184575",
"0.51572776",
"0.5156682",
"0.51538616",
"0.51494306",
"0.5132792",
"0.5116469"
] |
0.0
|
-1
|
Converts vector to radians
|
def bbpToAngle(point)
Math.atan2(v.y, v.x)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def to_rad(angle)\n angle * Math::PI / 180\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def angle_between(vector2)\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def vector_to_angle(x_vel=@x_vel, y_vel=@y_vel)\n if x_vel == 0 && y_vel == 0\n return puts \"Zero velocity, no angle\"\n end\n if x_vel != 0 && y_vel != 0\n return puts \"Diagonal velocity (#{x_vel}x#{y_vel}), no angle\"\n end\n\n if x_vel.zero?\n (y_vel > 0) ? 180 : 0\n else\n (x_vel > 0) ? 90 : 270\n end\n end",
"def getAngleOf2Vector(vector2)\n angleRad = Math.acos( self.dotProduct( vector2 ) / ( @length * vector2.length ) )\n angle = radianToDegre( angleRad )\n \n return angle\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def to_radians(coordinates)\n coordinates.to_f * (Math::PI / 180)\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def rotate( rad )\n ca = Math.cos( rad )\n sa = Math.sin( rad )\n Vector[ ca*x - sa*y, sa*x + ca*y ]\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def test_class_method_angle_between_two_vectors_in_radians\n vector1 = MyVector[4,0]\n vector2 = MyVector[4,3]\n\n v = MyVector.angle_between_two_vectors(vector1, vector2)\n assert_equal 64.35, v\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def angle_between v\n pdotp = perpdot(v)\n dotp = dot(v)\n Math.atan2(pdotp, dotp)\n end",
"def delta_radians\n @lat1_rad, @lon1_rad = from.map {|i| i.to_f * RADIUS_PER_DEG }\n @lat2_rad, @lon2_rad = to.map {|i| i.to_f * RADIUS_PER_DEG }\n [ lat2_rad - lat1_rad, lon2_rad - lon1_rad ]\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def direction\n self.vector.normalize\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def angle_between(vector2)\n self.class.angle_between(self, vector2)\n end",
"def rotate( vector )\n\t\t\t(self.inverse * self.class.new(vector) * self ).vec \n\t\tend",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def full_angle_between(vector1, vector2, normal = Z_AXIS)\n direction = (vector1 * vector2) % normal\n angle = vector1.angle_between(vector2)\n angle = 360.degrees - angle if direction < 0.0\n angle\n end",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def axis_rotation( axis, angle ) \n\t\t\traise TypeError, \"no implicit conversion of %s to ODE::Vector\" unless\n\t\t\t\taxis.is_a?( ODE::Vector )\n\t\t\tangle = Float(angle)\n\n\t\t\tif len = axis.abs\n\t\t\t\ta = axis/len * sin( angle / 2.0 );\n\t\t\t\tself.class.new( a, cos(angle/2.0) )\n\t\t\telse\n\t\t\t\tself.class.identity\n\t\t\tend\n\t\tend",
"def magnitude(vector)\n\n Math::sqrt((vector.x**2) + (vector.y**2) + (vector.z**2))\n end",
"def udot( vector )\n unit.dot( vector.unit )\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def radians()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Radians::RadiansRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def vres_pitch_angle_gsl_vector(options)\n raise \"Velocity space vres diagnostics not found\" unless FileTest.exist? \"#@directory/#@run_name.vres\"\n vres = GSL::Vector.filescan(\"#@directory/#@run_name.vres\")\n return vres[1]\n end",
"def real(vector) \n @abc2xyz * vector.to_v \n end",
"def Vector3dPolarAngle(arg0)\n ret = _invoke(1610744183, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end",
"def atan\n math :atan\n end",
"def angle_to_x(v)\n case v\n when :a then 0.0\n when :b then -(t.angle(:b) + t.angle(:c))\n when :c then Math::PI - t.angle(:c)\n end\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def distance(vector)\n Math.sqrt((@x - vector.x)**2 + (@y - vector.y)**2)\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end",
"def map_direction_to_angle(dir)\n return $direction_map[dir]\nend",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def polar\n [abs, arg]\n end",
"def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end",
"def rlat\n # lat * PI / 180\n self.lat * 0.01745329251994\n end",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def rotate direction, origin = Vector[0,0,0], angle\n @pos.rotate!(direction.to_v,origin.to_v,angle)\n end",
"def polar_to_cartesian(angle, distance)\n [ Math.cos(angle), Math.sin(angle) ].map { |val| distance * val }\n end",
"def degree(v)\n in_degree(v) + out_degree(v)\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def calculate_deg_angle_between(target)\n calculate_rad_angle_between(target).angle_rad_to_deg_clipped\n end"
] |
[
"0.74495894",
"0.74213165",
"0.7354134",
"0.7046398",
"0.7046398",
"0.6977072",
"0.6959348",
"0.6939245",
"0.6914868",
"0.6886231",
"0.68710935",
"0.6794048",
"0.6677482",
"0.6672009",
"0.6632231",
"0.6607892",
"0.6607892",
"0.6569656",
"0.6531188",
"0.6523248",
"0.64998186",
"0.64696944",
"0.6439655",
"0.6399926",
"0.6399926",
"0.6386304",
"0.6367313",
"0.63384044",
"0.6336268",
"0.6329314",
"0.63056666",
"0.62810266",
"0.62723815",
"0.6243311",
"0.62422556",
"0.62310797",
"0.6216291",
"0.62148494",
"0.620609",
"0.6205658",
"0.62022245",
"0.61980575",
"0.6178813",
"0.61727184",
"0.6172476",
"0.6165043",
"0.6161835",
"0.6161835",
"0.61617804",
"0.6152167",
"0.61408806",
"0.6114947",
"0.61068135",
"0.6098656",
"0.60972893",
"0.6062449",
"0.605535",
"0.6043714",
"0.60207915",
"0.6006618",
"0.60041595",
"0.59734756",
"0.5955882",
"0.5955882",
"0.5935123",
"0.59199244",
"0.58815736",
"0.58679414",
"0.5829666",
"0.5814058",
"0.58086777",
"0.5791477",
"0.5782701",
"0.5761761",
"0.573244",
"0.5719242",
"0.5716408",
"0.5700784",
"0.57003284",
"0.5679806",
"0.56595",
"0.5655744",
"0.563716",
"0.563698",
"0.5631301",
"0.56311935",
"0.56225467",
"0.5594913",
"0.5594176",
"0.5591462",
"0.5589304",
"0.55865186",
"0.5574656",
"0.55727905",
"0.556452",
"0.5563434",
"0.5541856",
"0.55398023",
"0.5536124",
"0.55302316",
"0.5526788"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.