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 |
|---|---|---|---|---|---|---|
Returns whether the application is interactive (required user input) or standalone (will run until terminates of natural causes.) Default is true; meaning the application will require user input. | def interactive?
instance.options[:interactive]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interactive?\n\t\ttrue\n\tend",
"def interactive?\n\t\tfalse\n\tend",
"def interactive?\n\t\tfalse\n\tend",
"def interactive?\n @interactive\n end",
"def interactive?\n # Default false and making subclasses figure out how to determine\n # interactiveness.\n false \n end",
... | [
"0.785899",
"0.7799633",
"0.7799633",
"0.7608303",
"0.746854",
"0.72007173",
"0.70757693",
"0.69684047",
"0.6768666",
"0.6768666",
"0.67487425",
"0.6729475",
"0.6525582",
"0.6422641",
"0.6309779",
"0.62860507",
"0.62569946",
"0.62569946",
"0.6179085",
"0.6163111",
"0.61132574... | 0.74512815 | 6 |
Returns the path to the log file. | def log
instance.options[:log]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_log\n @path_log ||= File.join(folder, 'log.txt')\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def log_path\n case Merb::Config[:log_file]\n when String th... | [
"0.83479077",
"0.8327112",
"0.8327112",
"0.8324346",
"0.8114206",
"0.79800093",
"0.7908982",
"0.79082495",
"0.7842568",
"0.7811959",
"0.7793623",
"0.7732218",
"0.7678394",
"0.7650075",
"0.7645338",
"0.76327527",
"0.7622776",
"0.76135606",
"0.75784224",
"0.7573055",
"0.7561957... | 0.0 | -1 |
Returns a boolean indicating whether the log has been configured. | def log?
log != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logging_enabled?\n !!logging_enabled\n end",
"def log?\n @log != false\n end",
"def log?\n @log != false\n end",
"def log?\n @log != false\n end",
"def configured?\n @configuration != nil\n end",
"def configured?\n true\n end",
"def log?\n ... | [
"0.7564051",
"0.7503003",
"0.7503003",
"0.7503003",
"0.7425709",
"0.73688424",
"0.7344686",
"0.73230577",
"0.7267191",
"0.7242818",
"0.7238527",
"0.71988904",
"0.71643555",
"0.68795055",
"0.6860532",
"0.6847547",
"0.68415576",
"0.6700446",
"0.6700446",
"0.6646372",
"0.6596024... | 0.76316434 | 1 |
Returns whether mouse support was enabled or disabled. | def mouse?
instance.options[:mouse]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_mouse(enable = true)\n\t\trequest = Packet.create_request('stdapi_ui_enable_mouse')\n\n\t\trequest.add_tlv(TLV_TYPE_BOOL, enable)\n\n\t\tresponse = client.send_request(request)\n\n\t\treturn true\n\tend",
"def enable_mouse(enable = true)\n\t\trequest = Packet.create_request('stdapi_ui_enable_mouse')\n... | [
"0.7116251",
"0.7116251",
"0.7009626",
"0.7009626",
"0.6825022",
"0.6778455",
"0.67144376",
"0.67072976",
"0.67072976",
"0.6642208",
"0.64730716",
"0.64441854",
"0.6404923",
"0.6321781",
"0.6320107",
"0.6320107",
"0.6309202",
"0.6308145",
"0.627824",
"0.6268673",
"0.624547",
... | 0.78489006 | 0 |
Returns whether the application will run through its main loop once or not. Default is false; meaning the application will loop forever or until terminated by the user. | def once?
instance.options[:once]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ran_main_loop?\n @ran_main_loop_p ? true : false\n end",
"def main_loop_running?\n @main_loop_thread_lock.synchronize do\n return @main_loop_running\n end\n end",
"def run_once?\n !!@run\n end",
"def auto_start?\n autostart\n end",
"def is_loop\n\n ... | [
"0.7611535",
"0.7414194",
"0.72658604",
"0.6967729",
"0.6860704",
"0.67590606",
"0.664954",
"0.64649636",
"0.64623684",
"0.6448853",
"0.64003366",
"0.63960505",
"0.63944477",
"0.6361056",
"0.6357229",
"0.63549346",
"0.63535696",
"0.6346202",
"0.6320169",
"0.6320169",
"0.63118... | 0.64612275 | 10 |
Returns a boolean indicating whether profiling has been enabled. | def profile?
instance.options[:profile]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profiling?\n @profiling\n end",
"def profiling?\n return false if test?\n false\n end",
"def enabled?\n !!configuration.enabled\n end",
"def enabled?\n !suspended\n end",
"def enable_profiling\n if current_user && CurateND::AdminConstraint.is_admin?(current_user.... | [
"0.85031825",
"0.83329207",
"0.65451086",
"0.6456618",
"0.6441102",
"0.6422072",
"0.6406604",
"0.635497",
"0.62823164",
"0.627092",
"0.6225939",
"0.6210408",
"0.61952573",
"0.61212206",
"0.61210626",
"0.61202306",
"0.61202306",
"0.61202306",
"0.61202306",
"0.611267",
"0.61102... | 0.652676 | 3 |
Returns the renderers which should receive output. | def renderers
instance.options[:renderers]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def renderer\n DirRenderer.renderers.partition {|r| !r.built_in?}.flatten.find do |r|\n r.can_render?(self) && !plugin_disabled?(r)\n end\n end",
"def printers\n return @printers\n end",
"def render_for(renderers={})\n @renderers = @renderers.merge(renderers)\... | [
"0.6508994",
"0.64511365",
"0.6198719",
"0.60217834",
"0.5933137",
"0.59107757",
"0.57832867",
"0.56539553",
"0.5584377",
"0.5567623",
"0.5567623",
"0.54825735",
"0.54778224",
"0.54296845",
"0.54173297",
"0.5396047",
"0.5355134",
"0.5340255",
"0.5337511",
"0.5290253",
"0.5283... | 0.75514686 | 1 |
Returns the root of the client application. Vedeu will execute this controller first. | def root
instance.options[:root]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root\n find_single_directory || @app_dir\n end",
"def application_root; end",
"def root\n get '/'\n end",
"def app_root; end",
"def root\n get \"/\"\n end",
"def root\n get \"/\"\n end",
"def root\n application && application.config.root\n end",
"def root\n... | [
"0.70102185",
"0.69970894",
"0.69929147",
"0.69186026",
"0.6916986",
"0.6916986",
"0.68936354",
"0.68090105",
"0.67707115",
"0.66884285",
"0.6648936",
"0.66214174",
"0.6563932",
"0.6548792",
"0.6548792",
"0.6477106",
"0.6470994",
"0.64364517",
"0.63797146",
"0.63708544",
"0.6... | 0.62671715 | 34 |
Returns the redefined setting for STDIN. | def stdin
instance.options[:stdin]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input\n @input ||= STDIN.readlines\nend",
"def get_input(name, default)\n if default\n $stderr.puts \"#{name}: #{default}\"\n default\n else\n Readline.readline(\"#{name}: \", true)\n end\nend",
"def stdinput\n @input\n end",
"def read_preference\n @read_preference ||= o... | [
"0.61234397",
"0.60901475",
"0.56438625",
"0.5436655",
"0.54355687",
"0.540185",
"0.53444415",
"0.5342412",
"0.53301203",
"0.5303748",
"0.52932453",
"0.5234175",
"0.5216389",
"0.52076054",
"0.51730126",
"0.51694226",
"0.516084",
"0.51593834",
"0.5152148",
"0.5129502",
"0.5126... | 0.527651 | 12 |
Returns the redefined setting for STDOUT. | def stdout
instance.options[:stdout]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n @out = StderrOut.new\n @location_format = :filename\n self.term_width = :detect\n end",
"def default_output\n name\n end",
"def output_format\n settings[:output_format]\n end",
"def inspect\n\t\treturn \"#<%p:%#016x formatter: %s, level: %s, output: %s>\" ... | [
"0.60792035",
"0.5679089",
"0.56503063",
"0.5614687",
"0.55603516",
"0.55414206",
"0.55352485",
"0.552989",
"0.55043614",
"0.5503451",
"0.54993564",
"0.5460305",
"0.5424924",
"0.5424924",
"0.54115295",
"0.5404623",
"0.537088",
"0.53600115",
"0.53385645",
"0.5317668",
"0.53140... | 0.5361801 | 18 |
Returns the redefined setting for STDERR. | def stderr
instance.options[:stderr]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_stderr\n $stderr = @original_stderr unless @original_stderr.nil?\n end",
"def error_mode; end",
"def re_stderr\n @logdev.re_stderr\n self\n end",
"def stderr_device\n # TODO: Find a more elegant way to access the internal log device\n @logger_stderr.instance_variable_get(:@lo... | [
"0.6253591",
"0.60084534",
"0.58104354",
"0.5795258",
"0.5755715",
"0.57440335",
"0.5678762",
"0.56595397",
"0.56595397",
"0.56595397",
"0.56595397",
"0.56587636",
"0.5657373",
"0.56494117",
"0.56427616",
"0.56298184",
"0.5593333",
"0.5551608",
"0.55033475",
"0.5458253",
"0.5... | 0.628809 | 1 |
Returns the terminal mode for the application. Default is `:raw`. | def terminal_mode
instance.options[:terminal_mode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mode\n @_mode ||= Configuration.terminal_mode\n end",
"def mode\n @mode = Vedeu.config.terminal_mode\n end",
"def raw_mode!\n Vedeu.log(\"Terminal switching to 'raw' mode\")\n\n @_mode = :raw\n end",
"def detect_mode\n if ENV['NO_COLOR'] # see https://no-color.org/\n... | [
"0.7904988",
"0.7670779",
"0.6814931",
"0.6731271",
"0.65007764",
"0.62405264",
"0.61243325",
"0.6123772",
"0.6108121",
"0.6108121",
"0.60713387",
"0.60500383",
"0.60384876",
"0.6027768",
"0.6001426",
"0.58739185",
"0.58739185",
"0.5841296",
"0.58196074",
"0.58196074",
"0.580... | 0.80960536 | 1 |
Returns the client defined width for the terminal. | def width
instance.options[:width]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width\n Terminal.width\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def terminal_width\n terminal_size.first\n end",
"def terminal_width\n return 80 unless unix?\n\n ... | [
"0.8293914",
"0.8242572",
"0.8242572",
"0.82238716",
"0.81290746",
"0.8125614",
"0.8017911",
"0.7958642",
"0.7899252",
"0.7899252",
"0.7618761",
"0.76064223",
"0.75927293",
"0.74464935",
"0.7326325",
"0.7295279",
"0.7254058",
"0.7181662",
"0.7154724",
"0.7082456",
"0.7038184"... | 0.0 | -1 |
Reset the configuration to the default values. | def reset!
instance.reset!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_config\n config.reset_to_defaults\n end",
"def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end",
"def reset\n @config = empty_config\n end",
"def reset!\n configure do |c|\n DEFAULTS.each { |k, v| c.send(\"#{k}=\", v) }\n ... | [
"0.88799036",
"0.8692362",
"0.86662024",
"0.8315323",
"0.81395775",
"0.8098934",
"0.8072545",
"0.8072173",
"0.8071301",
"0.804962",
"0.80263203",
"0.79205483",
"0.7903368",
"0.78915906",
"0.78687096",
"0.78611594",
"0.7853129",
"0.7830776",
"0.78237695",
"0.78237695",
"0.7713... | 0.0 | -1 |
Create a new singleton instance of Vedeu::Configuration. | def initialize
@options = defaults
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @configuration = Configuration.new\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def config\n @config ||= Configuration.new\n end",
"def config\n @config ||= Config.create Co... | [
"0.70378053",
"0.6923823",
"0.6923823",
"0.6820545",
"0.67101085",
"0.668072",
"0.667756",
"0.66035277",
"0.66035277",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6590977",
"0.6576828",
"0.6568761",
... | 0.0 | -1 |
Set up default configuration and then allow the client application to modify it via the configuration API. | def configure(opts = {}, &block)
@options.merge!(opts)
@options.merge!(Config::API.configure(&block)) if block_given?
Vedeu::Renderers.renderer(*@options[:renderers])
Vedeu::Configuration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugger.default_credentials\n configuration.service_name ||= Debugger.default_service_name\n configuration.service_version ||= Debugger.default_service_version\n ... | [
"0.73561203",
"0.7338565",
"0.7267254",
"0.7258693",
"0.72556376",
"0.719531",
"0.70405215",
"0.7040277",
"0.70236963",
"0.69849175",
"0.696265",
"0.69526654",
"0.69262606",
"0.6916644",
"0.6844291",
"0.6765872",
"0.6746254",
"0.6704078",
"0.6689821",
"0.6687253",
"0.66839725... | 0.0 | -1 |
Reset the configuration to the default values. | def reset!
@options = defaults
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_config\n config.reset_to_defaults\n end",
"def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end",
"def reset\n @config = empty_config\n end",
"def reset!\n configure do |c|\n DEFAULTS.each { |k, v| c.send(\"#{k}=\", v) }\n ... | [
"0.88800555",
"0.8692146",
"0.8666346",
"0.83155626",
"0.81395197",
"0.8098768",
"0.8073016",
"0.807211",
"0.8071564",
"0.80495054",
"0.8026882",
"0.79201967",
"0.7903547",
"0.7891554",
"0.78688824",
"0.7861412",
"0.78536284",
"0.7832361",
"0.7824192",
"0.7824192",
"0.7713325... | 0.7692882 | 22 |
The Vedeu default options, which of course are influenced by environment variables also. | def defaults
{
background: Vedeu::Colours::Background.coerce(:default),
base_path: base_path,
colour_mode: detect_colour_mode,
compression: true,
debug: false,
drb: false,
drb_host: nil,
drb_port: nil,
drb_height: 25,
drb_width: 80,
foreground: Vedeu::Colours::Foreground.coerce(:default),
height: nil,
interactive: true,
log: nil,
log_only: [],
mouse: true,
once: false,
profile: false,
renderers: [Vedeu::Renderers::Terminal.new],
root: nil,
stdin: nil,
stdout: nil,
stderr: nil,
terminal_mode: :raw,
width: nil,
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options\n @env || @default_options\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def set_default_options\n end",
"def default_options\n options = {}\n options[:verbose] = false\n options[:copy_only] = false\n options[:output_folder... | [
"0.6976486",
"0.6547804",
"0.6547804",
"0.6547804",
"0.64907444",
"0.64700025",
"0.6464181",
"0.6420643",
"0.63822114",
"0.6368727",
"0.6307726",
"0.6294647",
"0.6288617",
"0.626494",
"0.62587047",
"0.6183637",
"0.6183439",
"0.6138846",
"0.6123367",
"0.60798275",
"0.607958",
... | 0.0 | -1 |
Attempt to determine the terminal colour mode via $TERM environment variable, or be optimistic and settle for 256 colours. | def detect_colour_mode
case ENV['TERM']
when /-truecolor$/ then 16_777_216
when /-256color$/, 'xterm' then 256
when /-color$/, 'rxvt' then 16
else 256
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_mode\n if ENV['NO_COLOR'] # see https://no-color.org/\n 0\n elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows\n if ENV['ANSICON']\n 16\n elsif ENV['ConEmuANSI'] == 'ON'\n TRUE_COLOR\n else\n 0\n end\n elsif ENV['TERM... | [
"0.7915949",
"0.7265764",
"0.6604198",
"0.652807",
"0.6379686",
"0.63699687",
"0.63104486",
"0.6305616",
"0.63039577",
"0.6267237",
"0.62081486",
"0.6180651",
"0.61370623",
"0.6135211",
"0.60576063",
"0.6057117",
"0.5967524",
"0.5956693",
"0.58894897",
"0.5851682",
"0.584972"... | 0.86316514 | 1 |
Examples: Input: 42145 Output: 54421 Input: 145263 Output: 654321 Input: 123456789 Output: 987654321 | def descending_order(n)
digit_arr = n.to_s.chars
sorted_str = digit_arr.sort.reverse.join
sorted_num = sorted_str.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"668966489504... | [
"0.69843113",
"0.65464467",
"0.65327317",
"0.6514711",
"0.64970565",
"0.64774585",
"0.6422949",
"0.6400948",
"0.63888896",
"0.637156",
"0.6362254",
"0.6343426",
"0.6334399",
"0.63091034",
"0.6288297",
"0.6266437",
"0.6264851",
"0.6263251",
"0.6251003",
"0.6236673",
"0.6223839... | 0.0 | -1 |
Add prefixes to `css`. See `Processorprocess` for options. source://autoprefixerrails//lib/autoprefixerrails.rb9 | def process(css, opts = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_css_selectors(prefix = \"_\")\n selector_regex = /^\\s*?(?!\\/\\*)+?[^:]*?(?!:\\s)([\\.#][^,\\s]*[:]?[^\\s,])$/\n\n new_sass = \"\"\n sass.each_line do |line|\n # Skip blank lines\n next if line =~ /^\\s*$/\n\n line = line.gsub(selector_regex) do |str|\n ... | [
"0.6655071",
"0.65958965",
"0.6404755",
"0.5465714",
"0.53854775",
"0.53362274",
"0.53362274",
"0.5280919",
"0.51722693",
"0.5086901",
"0.50701565",
"0.5060259",
"0.5035136",
"0.5024731",
"0.4998104",
"0.49875155",
"0.49716932",
"0.49537235",
"0.49537235",
"0.4941586",
"0.489... | 0.43594566 | 85 |
Cache processor instances source://autoprefixerrails//lib/autoprefixerrails.rb32 | def processor(params = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_processors\n @pre_processors ||= []\n end",
"def get_processor; end",
"def third_party_processors; end",
"def call(input)\n result = @processor.process(input[:data], from: input[:filename])\n\n result.warnings.each do |warning|\n $stderr.puts \"autoprefixer: #{ warning }\"\n ... | [
"0.66768265",
"0.5839616",
"0.5751899",
"0.57363105",
"0.5627573",
"0.55058014",
"0.55043507",
"0.5494367",
"0.5424397",
"0.5408535",
"0.5322057",
"0.5322057",
"0.53166467",
"0.53166467",
"0.5312097",
"0.53086984",
"0.52889115",
"0.5236388",
"0.5196605",
"0.51599526",
"0.5159... | 0.0 | -1 |
Disable installed Autoprefixer source://autoprefixerrails//lib/autoprefixerrails.rb27 | def uninstall(assets); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_complete_css\n auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS\n end",
"def css_omit\n %w()\nend",
"def skip_libraries_installation\n self.options = options.merge(\n skip_bundle: true,\n skip_webpack_install: true\n )\nend",
"def remove_style_converter(ast_node, prop_name); end",
... | [
"0.5145327",
"0.50045955",
"0.49583158",
"0.4909696",
"0.48950148",
"0.47777626",
"0.47282246",
"0.469189",
"0.46624956",
"0.4643841",
"0.46414647",
"0.4630344",
"0.45662662",
"0.4518085",
"0.4508261",
"0.450057",
"0.4488292",
"0.44734317",
"0.44657138",
"0.44387475",
"0.4433... | 0.0 | -1 |
Return, which browsers and prefixes will be used source://autoprefixerrails//lib/autoprefixerrails/processor.rb52 | def info; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browsers(app)\n file = app.root.join('config/autoprefixer.yml')\n config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil }\n config['browsers']\n end",
"def browsers_with_prefix(prefix)\n assert_valid_prefix prefix\n prefix = \"-\" + prefix unless prefix.start_wit... | [
"0.6909379",
"0.647568",
"0.6292106",
"0.6254283",
"0.6199879",
"0.6125754",
"0.61136895",
"0.61030465",
"0.60382044",
"0.60229415",
"0.59935987",
"0.5978601",
"0.5873973",
"0.58502",
"0.57667154",
"0.5738446",
"0.57345366",
"0.5722268",
"0.57154804",
"0.56924695",
"0.5670117... | 0.0 | -1 |
Parse Browserslist config source://autoprefixerrails//lib/autoprefixerrails/processor.rb57 | def parse_config(config); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browsers(app)\n file = app.root.join('config/autoprefixer.yml')\n config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil }\n config['browsers']\n end",
"def config(app)\n file = app.root.join('config/autoprefixer.yml')\n options = file.exist? ? YAML.loa... | [
"0.6879027",
"0.6534638",
"0.613217",
"0.52195454",
"0.5178361",
"0.5107621",
"0.50844765",
"0.5071411",
"0.5048749",
"0.50294065",
"0.5007032",
"0.49981034",
"0.49699223",
"0.49381936",
"0.49378273",
"0.48712808",
"0.4830783",
"0.48236737",
"0.48210382",
"0.4811309",
"0.4799... | 0.4852996 | 16 |
Process `css` and return result. Options can be: `from` with input CSS file name. Will be used in error messages. `to` with output CSS file name. `map` with true to generate new source map or with previous map. source://autoprefixerrails//lib/autoprefixerrails/processor.rb24 | def process(css, opts = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(input)\n result = @processor.process(input[:data], from: input[:filename])\n\n result.warnings.each do |warning|\n $stderr.puts \"autoprefixer: #{ warning }\"\n end\n\n result.css\n end",
"def css_with_sourcemap\n visitor = Sass::Tree::Visitors::ToCss.new(:build_sour... | [
"0.6870795",
"0.65118253",
"0.6358648",
"0.557489",
"0.52952784",
"0.52847946",
"0.5268262",
"0.5181275",
"0.51627886",
"0.51354283",
"0.51182055",
"0.5112254",
"0.5098418",
"0.5075134",
"0.5039576",
"0.5038786",
"0.49908918",
"0.4989241",
"0.49864337",
"0.48957905",
"0.48901... | 0.56985193 | 4 |
Convert ruby_options to jsOptions source://autoprefixerrails//lib/autoprefixerrails/processor.rb99 | def convert_options(opts); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js_options; @js_opts end",
"def get_options\n {\n :cssOptimize => cssOptimize,\n :optimize=> optimize,\n :cssImportIgnore=>cssImportIgnore,\n :internStrings=>internStrings\n }\n end",
"def processor_options\n original_processor_options.mer... | [
"0.61792135",
"0.60498965",
"0.5680721",
"0.563188",
"0.5601705",
"0.5484274",
"0.54701185",
"0.5413824",
"0.5374714",
"0.533488",
"0.53296906",
"0.5264803",
"0.5241783",
"0.5236299",
"0.5236299",
"0.5215775",
"0.5215775",
"0.51932406",
"0.51687175",
"0.5165707",
"0.5147925",... | 0.5733512 | 2 |
Try to find Browserslist config source://autoprefixerrails//lib/autoprefixerrails/processor.rb114 | def find_config(file); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browsers(app)\n file = app.root.join('config/autoprefixer.yml')\n config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil }\n config['browsers']\n end",
"def config(app)\n file = app.root.join('config/autoprefixer.yml')\n options = file.exist? ? YAML.loa... | [
"0.6803433",
"0.63393396",
"0.59062755",
"0.55228573",
"0.53606707",
"0.5296112",
"0.5256362",
"0.51958066",
"0.5182029",
"0.5168096",
"0.5093473",
"0.5061724",
"0.5027596",
"0.49734545",
"0.49439138",
"0.49416706",
"0.49262425",
"0.48943204",
"0.48887393",
"0.48781016",
"0.4... | 0.0 | -1 |
Lazy load for JS library source://autoprefixerrails//lib/autoprefixerrails/processor.rb131 | def runtime; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_js_comments\n if defined?(::Rails) && Rails.application.assets.js_compressor\n compressor = Rails.application.assets.js_compressor\n compressor.processor.call(nil, self)\n else\n self\n end\n end",
"def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n... | [
"0.5887947",
"0.5690622",
"0.5674463",
"0.5661455",
"0.56005925",
"0.55708665",
"0.55465674",
"0.5528944",
"0.5512304",
"0.550271",
"0.544513",
"0.54241544",
"0.53361213",
"0.53331107",
"0.52818763",
"0.5268792",
"0.524641",
"0.52202034",
"0.5196794",
"0.51951325",
"0.5185926... | 0.0 | -1 |
Prefixed CSS after Autoprefixer source://autoprefixerrails//lib/autoprefixerrails/result.rb7 | def css; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_css_selectors(prefix = \"_\")\n selector_regex = /^\\s*?(?!\\/\\*)+?[^:]*?(?!:\\s)([\\.#][^,\\s]*[:]?[^\\s,])$/\n\n new_sass = \"\"\n sass.each_line do |line|\n # Skip blank lines\n next if line =~ /^\\s*$/\n\n line = line.gsub(selector_regex) do |str|\n ... | [
"0.72323585",
"0.60626966",
"0.60626966",
"0.5969329",
"0.5883255",
"0.56294465",
"0.55757487",
"0.546155",
"0.54114205",
"0.534699",
"0.5300816",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.52864337",
"0.... | 0.0 | -1 |
Source map of changes source://autoprefixerrails//lib/autoprefixerrails/result.rb10 | def map; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sass_embedded_generate_source_map(source_map); end",
"def sourcemap_option; end",
"def sass_generate_source_map(engine); end",
"def css_with_sourcemap\n visitor = Sass::Tree::Visitors::ToCss.new(:build_source_mapping)\n result = visitor.visit(self)\n return result, visitor.source_map... | [
"0.6164704",
"0.6111245",
"0.60253274",
"0.5938775",
"0.5935319",
"0.59054613",
"0.58746773",
"0.579281",
"0.5715215",
"0.5694923",
"0.5694923",
"0.5659876",
"0.5659876",
"0.5647667",
"0.5631749",
"0.5563739",
"0.54328203",
"0.541805",
"0.53358835",
"0.5264982",
"0.5222722",
... | 0.0 | -1 |
Stringify prefixed CSS source://autoprefixerrails//lib/autoprefixerrails/result.rb22 | def to_s; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_css_selectors(prefix = \"_\")\n selector_regex = /^\\s*?(?!\\/\\*)+?[^:]*?(?!:\\s)([\\.#][^,\\s]*[:]?[^\\s,])$/\n\n new_sass = \"\"\n sass.each_line do |line|\n # Skip blank lines\n next if line =~ /^\\s*$/\n\n line = line.gsub(selector_regex) do |str|\n ... | [
"0.64452773",
"0.6136917",
"0.61267585",
"0.61021173",
"0.60811204",
"0.6077585",
"0.6050509",
"0.6050509",
"0.5940593",
"0.59010077",
"0.5874613",
"0.58014536",
"0.5789525",
"0.5734408",
"0.5702101",
"0.56941164",
"0.56586564",
"0.56341964",
"0.5607102",
"0.5587937",
"0.5580... | 0.0 | -1 |
Warnings from Autoprefixer source://autoprefixerrails//lib/autoprefixerrails/result.rb13 | def warnings; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warn_with_prefix( msg = \"\" )\n warn \"DEPRECATION WARNING: #{msg}\"\n end",
"def _prefixes; end",
"def test_nokogiri_css\n err = assert_compile 'nokogiri-css.y'\n assert_warnings err, useless_terms: 1, rr_conflicts: 1\n assert_parser_unchanged 'nokogiri-css.y'\n end",
"def pre... | [
"0.5840586",
"0.5363",
"0.5061567",
"0.5049357",
"0.4997121",
"0.49703732",
"0.49144325",
"0.48962313",
"0.48705852",
"0.48330015",
"0.48271623",
"0.48271623",
"0.47632593",
"0.4757947",
"0.47579214",
"0.4726589",
"0.47089562",
"0.47012496",
"0.46851546",
"0.4674218",
"0.4638... | 0.44246677 | 44 |
Sprockets 2 API new and render source://autoprefixerrails//lib/autoprefixerrails/sprockets.rb60 | def render(*_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precompile_assets; end",
"def when_sprockets_available\n if !SKIP_SPROCKETS\n yield\n end\nend",
"def inline_asset(*names)\n old = sprockets.css_compressor, sprockets.js_compressor\n sprockets.js_compressor = :uglifier\n sprockets.css_compressor = :scss\n dat = names.map { |name| sprockets... | [
"0.6094103",
"0.597765",
"0.5867027",
"0.5786094",
"0.5727838",
"0.5724836",
"0.56500465",
"0.55868953",
"0.5554318",
"0.5524008",
"0.5487063",
"0.5470181",
"0.54438585",
"0.5422064",
"0.539586",
"0.5382225",
"0.5367178",
"0.53496116",
"0.53448063",
"0.5321656",
"0.5321656",
... | 0.0 | -1 |
Register postprocessor in Sprockets depend on issues with other gems source://autoprefixerrails//lib/autoprefixerrails/sprockets.rb32 | def install(env); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_processors\n []\n end",
"def post_processors\n @post_processors ||= []\n end",
"def css_compressor\n bundle_processors('text/css').detect { |klass|\n klass.respond_to?(:name) &&\n klass.name == 'Sprockets::Processor (css_compressor)'\n }\n end",
"def pre_... | [
"0.6128262",
"0.61033475",
"0.59586424",
"0.5942211",
"0.58395165",
"0.5818956",
"0.5685409",
"0.5658862",
"0.56431836",
"0.55651397",
"0.55014855",
"0.5282364",
"0.52748257",
"0.51661867",
"0.50992286",
"0.50804806",
"0.50775963",
"0.50627404",
"0.505931",
"0.49666768",
"0.4... | 0.0 | -1 |
Add prefixes to `css` source://autoprefixerrails//lib/autoprefixerrails/sprockets.rb20 | def run(filename, css); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_css_selectors(prefix = \"_\")\n selector_regex = /^\\s*?(?!\\/\\*)+?[^:]*?(?!:\\s)([\\.#][^,\\s]*[:]?[^\\s,])$/\n\n new_sass = \"\"\n sass.each_line do |line|\n # Skip blank lines\n next if line =~ /^\\s*$/\n\n line = line.gsub(selector_regex) do |str|\n ... | [
"0.6825756",
"0.58480865",
"0.5596677",
"0.5519463",
"0.5478623",
"0.54723513",
"0.54723513",
"0.5428461",
"0.540104",
"0.53973264",
"0.53844655",
"0.53753394",
"0.53001064",
"0.5286007",
"0.5261743",
"0.524444",
"0.52262986",
"0.5196774",
"0.51917",
"0.51881874",
"0.5133635"... | 0.0 | -1 |
Register postprocessor in Sprockets depend on issues with other gems source://autoprefixerrails//lib/autoprefixerrails/sprockets.rb43 | def uninstall(env); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_processors\n []\n end",
"def post_processors\n @post_processors ||= []\n end",
"def css_compressor\n bundle_processors('text/css').detect { |klass|\n klass.respond_to?(:name) &&\n klass.name == 'Sprockets::Processor (css_compressor)'\n }\n end",
"def pre_... | [
"0.61343795",
"0.6101416",
"0.59531134",
"0.5949585",
"0.587971",
"0.5793824",
"0.56757903",
"0.56562936",
"0.56275004",
"0.5517381",
"0.5498667",
"0.53118974",
"0.52360195",
"0.51864517",
"0.5090657",
"0.50817466",
"0.5044923",
"0.50406456",
"0.50389266",
"0.49527448",
"0.49... | 0.0 | -1 |
Initializes a new instance of the CustomHeader class | def initialize(arguments)
@custom_headers = Array.new
unless arguments[:file_path].nil? || arguments[:file_path].empty?
readfile(arguments[:file_path])
end
unless arguments[:name].nil? || arguments[:name].empty?
@name = arguments[:name]
end
unless arguments[:mime_type].nil? || arguments[:mime_type].empty?
@mime_type = arguments[:mime_type]
end
@content_id = arguments[:content_id]
@custom_headers = []
unless arguments[:custom_headers].nil? || arguments[:custom_headers].empty?
@custom_headers = arguments[:custom_headers]
end
unless arguments[:content].nil? || arguments[:content].empty?
@content = arguments[:content]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_header_init()\n end",
"def initialize_http_header(initheader)\n super\n set_headers_for_body\n end",
"def _initialize_headers\n {}\n end",
"def initialize(options = {})\n @options = options\n @header = options[:header]\n end",
"def initialize category\n ... | [
"0.7069955",
"0.69017094",
"0.68734324",
"0.6852061",
"0.6827997",
"0.6763529",
"0.66946536",
"0.6690373",
"0.6608821",
"0.6572565",
"0.65219516",
"0.6427233",
"0.63819337",
"0.63762355",
"0.63659817",
"0.63654476",
"0.6354623",
"0.63514835",
"0.6289881",
"0.6273751",
"0.6260... | 0.0 | -1 |
Read the specified file and get a str containing the resulting binary data. | def readfile(file_path)
@file_path = file_path
@name = File.basename(file_path)
@mime_type = get_mime_type_from_ext(File.extname(file_path))
file = File.open(file_path, "rb")
encoded_string = Base64.encode64(file.read)
@content = encoded_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\n end",
"def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\")\n f.each_line do |line|\n data ... | [
"0.7767985",
"0.7744204",
"0.77389807",
"0.76764506",
"0.7328059",
"0.7238508",
"0.7075746",
"0.69796693",
"0.6957765",
"0.6840978",
"0.68277514",
"0.67968166",
"0.67734385",
"0.6705003",
"0.66944176",
"0.66495097",
"0.6627079",
"0.66088986",
"0.65344524",
"0.64910746",
"0.64... | 0.6416177 | 28 |
Takes a file extension, minus the '.', and returns the corresponding MimeType for the given extension. | def get_mime_type_from_ext(extension)
extension[0]=''
types = [
{ :ext => "txt", :mime_type => "text/plain" },
{ :ext => "ini", :mime_type => "text/plain" },
{ :ext => "sln", :mime_type => "text/plain" },
{ :ext => "cs", :mime_type => "text/plain" },
{ :ext => "js", :mime_type => "text/plain" },
{ :ext => "config", :mime_type => "text/plain" },
{ :ext => "vb", :mime_type => "text/plain" },
{ :ext => :"jpg", :mime_type => "image/jpeg" },
{ :ext => "jpeg", :mime_type => "image/jpeg" },
{ :ext => "bmp", :mime_type => "image/bmp" },
{ :ext => "csv", :mime_type => "text/csv" },
{ :ext => "doc", :mime_type => "application/msword" },
{ :ext => "docx", :mime_type => "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
{ :ext => "gif", :mime_type => "image/gif" },
{ :ext => "html", :mime_type => "text/html" },
{ :ext => "pdf", :mime_type => "application/pdf" },
{ :ext => "png", :mime_type => "image/png" },
{ :ext => "ppt", :mime_type => "application/vnd.ms-powerpoint" },
{ :ext => "pptx", :mime_type => "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
{ :ext => "xls", :mime_type => "application/vnd.ms-excel" },
{ :ext => "xlsx", :mime_type => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
{ :ext => "xml", :mime_type => "application/xml" },
{ :ext => "zip", :mime_type => "application/x-zip-compressed" },
{ :ext => "wav", :mime_type => "audio/wav" },
{ :ext => "eml", :mime_type => "message/rfc822" },
{ :ext => "mp3", :mime_type => "audio/mpeg" },
{ :ext => "mp4", :mime_type => "video/mp4" },
{ :ext => "mov", :mime_type => "video/quicktime" }
]
mime = types.find {|x| x[:ext] == extension}
unless mime.nil? || mime.empty?
"application/octet-stream"
end
mime[:mime_type]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mimetype_from_extension(file_ext)\r\n valid_mime_types = {\r\n \"bmp\" => \"image/bmp\",\r\n \"gif\" => \"image/gif\",\r\n \"jpeg\" => \"image/jpeg\",\r\n \"jpg\" => \"image/jpeg\",\r\n \"png\" => \"image/png\"\r\n }\r\n ... | [
"0.8340346",
"0.7867955",
"0.7743258",
"0.7703464",
"0.7697924",
"0.76064",
"0.7512612",
"0.74162686",
"0.73523355",
"0.73094743",
"0.72602236",
"0.72590286",
"0.7243116",
"0.7235091",
"0.72311693",
"0.72149026",
"0.7098144",
"0.7087808",
"0.70657533",
"0.7052575",
"0.7036747... | 0.7280479 | 10 |
Add a CustomHeader to the attachment | def add_custom_header(name, value)
if name.kind_of? CustomHeader
@custom_headers.push(name)
elsif name.kind_of? String
@custom_headers.push(CustomHeader.new(name, value))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_custom_header(value)\n if value.instance_of? CustomHeaderJson\n @custom_headers.push(value)\n end\n end",
"def add_header(name, value)\n end",
"def setCustomHttpHeader(header)\n unless /^.+:.+$/.match(header)\n raise Error.new(Pdfcr... | [
"0.72370327",
"0.68789375",
"0.6770675",
"0.6708852",
"0.659193",
"0.65357",
"0.6513576",
"0.642314",
"0.63154197",
"0.6224384",
"0.59265685",
"0.58481187",
"0.5818698",
"0.58137435",
"0.5800043",
"0.5780512",
"0.5735518",
"0.5735133",
"0.5730374",
"0.5726922",
"0.5725863",
... | 0.6835978 | 2 |
Represents the Attachment as a String | def to_s
"#{@name}, #{@mime_type}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"#<#{self.class.inspect}(#{attachment_name})>\"\n end",
"def to_s\n @file.to_s\n end",
"def to_s\n @file_text\n end",
"def to_s\n @file_text\n end",
"def to_str\n @filename\n end",
"def name\n attachment.name\n end",
"def inspect\n ... | [
"0.79617786",
"0.69646347",
"0.68179035",
"0.68179035",
"0.67063075",
"0.66860205",
"0.6684484",
"0.65533376",
"0.6540408",
"0.6502132",
"0.6412219",
"0.6359773",
"0.63488597",
"0.6329455",
"0.6325604",
"0.6279575",
"0.62631744",
"0.6239195",
"0.62306917",
"0.6183978",
"0.618... | 0.70827 | 1 |
GET /tarifas/1 GET /tarifas/1.xml | def show
@tarifas = Tarifas.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @tarifas }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tipo_lancamentos = TipoLancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_lancamentos }\n end\n end",
"def show\n @tipo_vinculo = TipoVinculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.ht... | [
"0.6611034",
"0.65347433",
"0.65265346",
"0.6475856",
"0.6475464",
"0.64754367",
"0.6474112",
"0.64481735",
"0.64366114",
"0.6436377",
"0.643464",
"0.6427724",
"0.6413615",
"0.64103067",
"0.63989913",
"0.63988274",
"0.63898265",
"0.6385304",
"0.63831544",
"0.63829446",
"0.637... | 0.7439461 | 0 |
GET /tarifas/new GET /tarifas/new.xml | def new
@tarifas = Tarifas.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @tarifas }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end",
"def new\n @tservicio = Tservicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :x... | [
"0.7193035",
"0.71898395",
"0.7185879",
"0.7153766",
"0.7145487",
"0.7138322",
"0.7135436",
"0.7129469",
"0.70920223",
"0.70788026",
"0.70781255",
"0.70747286",
"0.70711845",
"0.70665693",
"0.7062387",
"0.70511985",
"0.7049408",
"0.70473796",
"0.70450765",
"0.7041942",
"0.702... | 0.78653103 | 0 |
POST /tarifas POST /tarifas.xml | def create
@tarifas = Tarifas.new(params[:tarifas])
respond_to do |format|
if @tarifas.save
flash[:notice] = 'Tarifas was successfully created.'
format.html { redirect_to(@tarifas) }
format.xml { render :xml => @tarifas, :status => :created, :location => @tarifas }
else
format.html { render :action => "new" }
format.xml { render :xml => @tarifas.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tarifas = Tarifas.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tarifas }\n end\n end",
"def create\n @tarifas_servicio = TarifasServicio.new(tarifas_servicio_params)\n\n respond_to do |format|\n if @tarifas_servicio.save\n ... | [
"0.63334435",
"0.6222863",
"0.62075955",
"0.5886238",
"0.58609736",
"0.57375246",
"0.5684854",
"0.5676212",
"0.56584096",
"0.56313324",
"0.5609841",
"0.56089234",
"0.5602563",
"0.557928",
"0.55672836",
"0.5538161",
"0.5531761",
"0.55143356",
"0.55066615",
"0.5506644",
"0.5498... | 0.69729114 | 0 |
PUT /tarifas/1 PUT /tarifas/1.xml | def update
@tarifas = Tarifas.find(params[:id])
respond_to do |format|
if @tarifas.update_attributes(params[:tarifas])
flash[:notice] = 'Tarifas was successfully updated.'
format.html { redirect_to(@tarifas) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @tarifas.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def upd... | [
"0.65757364",
"0.6441648",
"0.6123665",
"0.6032004",
"0.6014631",
"0.60115",
"0.59326005",
"0.58998877",
"0.5853577",
"0.58267653",
"0.57823783",
"0.57458484",
"0.57298297",
"0.5720079",
"0.57131314",
"0.5694692",
"0.56598544",
"0.5656274",
"0.56539905",
"0.56480175",
"0.5596... | 0.66311055 | 0 |
DELETE /tarifas/1 DELETE /tarifas/1.xml | def destroy
@tarifas = Tarifas.find(params[:id])
@tarifas.destroy
respond_to do |format|
format.html { redirect_to(tarifas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }... | [
"0.7028977",
"0.6990223",
"0.68493015",
"0.6820654",
"0.6811805",
"0.680114",
"0.67998344",
"0.67856073",
"0.67825335",
"0.6775166",
"0.677094",
"0.6770407",
"0.6770217",
"0.67671126",
"0.67662394",
"0.676394",
"0.6744263",
"0.6733172",
"0.67313904",
"0.67313904",
"0.6720583"... | 0.7418895 | 0 |
Purpose: gets a random number as the asnwer to the game Signature: nothing > nothing | def generate_new_answer
#assigns a random number from 1-100 to the cookies[:answer] hashtable
cookies[:answer] = rand(100) + 1
#call method to convert string in the hashtable to an integer
get_answer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomkey; end",
"def randomkey; end",
"def door_num\n\t\treturn rand(3)\n\tend",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end",
... | [
"0.69470114",
"0.69470114",
"0.65810156",
"0.6516824",
"0.6516745",
"0.65165603",
"0.65017873",
"0.64545286",
"0.6443716",
"0.6400639",
"0.63536537",
"0.63536537",
"0.6329588",
"0.6320666",
"0.6304798",
"0.6292121",
"0.6274475",
"0.62695885",
"0.6257591",
"0.62412584",
"0.622... | 0.0 | -1 |
Purpose: converts string from cookie hashtable to an integer Signature: nothing > integer | def get_answer
#converts the contents of the :answer key to an integer and assins it to an instance variable
@answer = cookies[:answer].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol_to_integer(key)\n\t\tkey[-2..-1].to_i\n\tend",
"def string_to_signed_integer(string)\n keys_array = string.chars\n neg = 1\n if keys_array.include?(\"-\")\n neg = -1\n keys_array.delete(\"-\")\n end\n \n if keys_array.include?(\"+\")\n keys_array.delete(\"+\")\n end\n \n accumulator ... | [
"0.6284541",
"0.6013664",
"0.59744793",
"0.590372",
"0.58602905",
"0.5845057",
"0.5814682",
"0.5814682",
"0.57681155",
"0.5767108",
"0.57296836",
"0.5726627",
"0.57228017",
"0.5696165",
"0.56931376",
"0.5670641",
"0.5666441",
"0.564218",
"0.5640962",
"0.5639431",
"0.5632836",... | 0.0 | -1 |
GET /group_events GET /group_events.json | def index
@group_events = GroupEvent.where :deleted => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_events\n @group = Group.find(params[:groupId])\n @events = @group.events\n render \"api/events/group_events\"\n end",
"def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\... | [
"0.8423404",
"0.7942482",
"0.76763254",
"0.7658886",
"0.7538284",
"0.7362862",
"0.72885567",
"0.72774035",
"0.7274078",
"0.7217501",
"0.7167964",
"0.7167015",
"0.70859504",
"0.69781077",
"0.6965752",
"0.6881921",
"0.6827681",
"0.6731926",
"0.6689752",
"0.6688349",
"0.6679507"... | 0.6279624 | 74 |
GET /group_events/1 GET /group_events/1.json | def show
@group_event = GroupEvent.find params[:id]
respond_to do |format|
format.html { render :new }
format.json { render json: @group_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_events\n @group = Group.find(params[:groupId])\n @events = @group.events\n render \"api/events/group_events\"\n end",
"def show\n @group_event = GroupEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gr... | [
"0.80241066",
"0.7781068",
"0.7565883",
"0.75191414",
"0.7460062",
"0.7250219",
"0.70384324",
"0.6891694",
"0.6865325",
"0.684201",
"0.66902626",
"0.6683239",
"0.6681606",
"0.66657126",
"0.66411114",
"0.6636252",
"0.6619168",
"0.65985674",
"0.6559769",
"0.6559007",
"0.6551211... | 0.765057 | 2 |
POST /group_events POST /group_events.json | def create
@group_event = GroupEvent.new(group_event_params)
respond_to do |format|
if @group_event.save
format.html { redirect_to @group_event, notice: 'Group event was successfully created.' }
format.json { render :show, status: :created, location: @group_event }
else
format.html { render :new }
format.json { render json: @group_event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group_event = GroupEvent.new(params[:group_event])\n\n respond_to do |format|\n if @group_event.save\n format.html { redirect_to @group_event, notice: 'Groups event was successfully created.' }\n format.json { render json: @group_event, status: :created, location: @group_even... | [
"0.76607907",
"0.7596514",
"0.73429585",
"0.7249151",
"0.71680295",
"0.71391046",
"0.70267564",
"0.67507607",
"0.6727875",
"0.6668374",
"0.6651771",
"0.66348547",
"0.66257167",
"0.66139084",
"0.65420526",
"0.6526086",
"0.6508799",
"0.64960104",
"0.64747274",
"0.646939",
"0.64... | 0.7679999 | 0 |
PATCH/PUT /group_events/1 PATCH/PUT /group_events/1.json | def update
respond_to do |format|
if @group_event.update(group_event_params)
format.html { redirect_to @group_event, notice: 'Group event was successfully updated.' }
format.json { render :show, status: :ok, location: @group_event }
else
format.html { render :edit }
format.json { render json: @group_event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.79052395",
"0.76128805",
"0.75532836",
"0.7383808",
"0.7369141",
"0.7210572",
"0.7164669",
"0.7052284",
"0.68709177",
"0.68180317",
"0.68049806",
"0.6766988",
"0.6693803",
"0.6679712",
"0.66733146",
"0.66380143",
"0.66028726",
"0.66028726",
"0.6594717",
"0.65945953",
"0.65... | 0.75193727 | 3 |
DELETE /group_events/1 DELETE /group_events/1.json | def delete
# @group_event.destroy
@group_event = GroupEvent.find params[:id]
@group_event.deleted = true
@group_event.save!
respond_to do |format|
format.html { redirect_to group_events_url, notice: 'Group event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @group_event = GroupEvent.find(params[:id])\n @group_event.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_event.destroy\n respond_to do |format|\n format.html... | [
"0.79312396",
"0.7901297",
"0.7715657",
"0.76897246",
"0.76665866",
"0.7603466",
"0.74655473",
"0.7257031",
"0.7234876",
"0.72145313",
"0.72145313",
"0.72145313",
"0.7185232",
"0.7117772",
"0.70857364",
"0.70856607",
"0.7056059",
"0.7049384",
"0.7039136",
"0.7035696",
"0.7018... | 0.7741016 | 2 |
GET /group_events/1/publish GET /group_events/1/publish.json | def publish
@group_event.published = true
begin
@group_event.save!
rescue Exception => ex
respond_to do |format|
format.json { render :json => {:errors => @group_event.errors.full_messages}, :status => 422 }
format.html { redirect_to group_events_url, notice: ex.message }
end
else
respond_to do |format|
format.html { redirect_to group_events_url, notice: 'Group event was successfully published.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish\n @event = Event.find_by_id(params[:event_id].to_i)\n if @event != nil && !@event.archived\n if !@event.published\n @event.published = true\n @event.published_date = Time.now\n if @event.save\n # send push notifications\n # send_push_notification_to_mem... | [
"0.7046523",
"0.6570648",
"0.6553778",
"0.6503953",
"0.645239",
"0.631697",
"0.631697",
"0.631697",
"0.62403786",
"0.62081283",
"0.61946356",
"0.61842644",
"0.6179885",
"0.6178765",
"0.61327875",
"0.6116769",
"0.6111745",
"0.6057187",
"0.60542345",
"0.60478944",
"0.60476506",... | 0.7469186 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_group_event
@group_event = GroupEvent.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def group_event_params
params.require(:group_event).permit(:name, :location, :description, :start_date, :duration, :deleted, :published)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
creates a new renderer instance of given id or the default one if id is not recognized | def renderer_named(id)
id == 'cool' ? CoolRenderer.new : DefaultRenderer.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_default_renderer\n r = ListRenderer.new self\n renderer(r)\n end",
"def get_renderer(name)\n begin\n class_name = name.to_s.capitalize.to_sym\n renderer = ::Hyde::Renderers.const_get(class_name)\n rescue NameError\n renderer = nil\n end\n renderer\... | [
"0.6213088",
"0.61684525",
"0.61214805",
"0.5872002",
"0.5709375",
"0.5699175",
"0.5699175",
"0.55510175",
"0.5539786",
"0.5533279",
"0.55280685",
"0.5522035",
"0.5503524",
"0.5463763",
"0.5417843",
"0.54096055",
"0.534494",
"0.53226334",
"0.5312226",
"0.5288216",
"0.5210759"... | 0.7880787 | 0 |
Restituisce true se l'array contiene altri array (es. [[1],2,3] => true) | def boolean_nested_array(array)
array.each do |slot|
return true if slot.kind_of?(Array)
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend",
"def include_array?(array)\n array.any? { |member| array?(member) }\n end",
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tgroupMaker(... | [
"0.7458098",
"0.7379841",
"0.72258526",
"0.7049583",
"0.6999908",
"0.69542456",
"0.6894341",
"0.6882627",
"0.67809975",
"0.6770511",
"0.6747358",
"0.67222947",
"0.6676707",
"0.6671731",
"0.66442484",
"0.66285926",
"0.6619986",
"0.66072136",
"0.6607144",
"0.65868145",
"0.65851... | 0.74307317 | 1 |
Conta il numero di caratteri maiuscoli in una stringa | def count_uppercase_letters(string)
return string.scan(/[A-Z]/).length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complemento\n \"#{''.rjust(286, ' ')}#{sequencial_remessa}\"\n end",
"def content_from(mesg)\n mesg.slice(6..mesg.length).split(',')\nend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\... | [
"0.6158697",
"0.5831299",
"0.5808624",
"0.5808624",
"0.5794882",
"0.57586116",
"0.5682175",
"0.5678086",
"0.5628484",
"0.56180716",
"0.5519722",
"0.5512534",
"0.5496163",
"0.5421069",
"0.5416848",
"0.5385591",
"0.5333769",
"0.53157324",
"0.52713144",
"0.52325606",
"0.52221984... | 0.0 | -1 |
costruisce un punto con coordinate (x,y) nota che non e' necessario nessun controllo sul tipo di x e y | def initialize(x, y)
@x = x
@y = y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coords; {:x => @x, :y => @y} end",
"def coord2pos(x, y)\n (y % h)*w+(x % w)\n end",
"def position\n [x, y]\n end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def coordinates\n return 166, 72\n end",
"def get_co_x_y(x,y)\n co_y... | [
"0.66822815",
"0.66366696",
"0.65286815",
"0.6525801",
"0.65213376",
"0.6403343",
"0.63754904",
"0.6372341",
"0.63282055",
"0.631036",
"0.6281243",
"0.62710327",
"0.6239597",
"0.6232951",
"0.6227",
"0.6218432",
"0.6213855",
"0.6201183",
"0.61947167",
"0.6192035",
"0.61723703"... | 0.0 | -1 |
la funzione + riceve come argomento un oggetto Point2D e restituisce un nuovo oggetto Point2D che ha come coordinate la somma delle coordinate dei due oggetti. (x1 + x2, y1 + y2) la funzione non deve alterare lo stato interno dell'oggetto, ma restituire un nuovo oggetto | def + (point)
return Point2D.new(@x + point.x, @y + point.y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end",
"def Point2dAdd(arg0, arg1)\n ret = _invoke(1610743816, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def add_line(point1, point2)\n end",
"def +(other_point)\n Point... | [
"0.6714917",
"0.63348395",
"0.62350893",
"0.61987555",
"0.6192249",
"0.61214775",
"0.6083849",
"0.600457",
"0.59969807",
"0.5988945",
"0.5925182",
"0.590834",
"0.5905427",
"0.5895979",
"0.58886397",
"0.58872885",
"0.5874775",
"0.5859913",
"0.5858302",
"0.58543277",
"0.5841083... | 0.65798247 | 1 |
Restituisce una rappresentazione testuale dell'oggetto punto, nella forma "(x,y)", senza spazi. ES: siano x = 1, y = 2.345, la funzione deve restituire "(1,2.345)" | def to_s
"(#{@x},#{@y})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"(#{x},#{y})\"\n end",
"def as_s\n\t\"(#{x}, #{y})\"\n end",
"def to_s\n \"(#{x}, #{y})\"\n end",
"def to_s\n\t\t\"(#{@x},#{@y})\"\n\tend",
"def to_s\n \"(#{ x }, #{ y })\"\n end",
"def tr_s(p0, p1) end",
"def to_s\n \"[#{@x},#{@y}]\"\n end",
"def to_s... | [
"0.5944133",
"0.58989966",
"0.56834674",
"0.5632003",
"0.56261426",
"0.5603325",
"0.5577506",
"0.5577506",
"0.55368537",
"0.5505845",
"0.537161",
"0.53576946",
"0.5338117",
"0.5278038",
"0.52739805",
"0.5217217",
"0.5214065",
"0.5193355",
"0.5187103",
"0.518464",
"0.51819956"... | 0.5628452 | 4 |
GET /measurements GET /measurements.json | def index
#getting measurements only that belong to current user account
beehives = Beehive.where(user_id: current_user.id)
@measurements = Array.new
beehives.each do |beehive|
beehive.sensors.each do |sensor|
(@measurements << sensor.measurements).flatten!
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_measurements\n render json: @data_source.measurements\n end",
"def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{for... | [
"0.8182932",
"0.76638734",
"0.7288916",
"0.7128829",
"0.7030691",
"0.69395006",
"0.69395006",
"0.69395006",
"0.6826435",
"0.6779082",
"0.66834295",
"0.65405023",
"0.6538133",
"0.65258586",
"0.6518774",
"0.65174687",
"0.6479581",
"0.6467566",
"0.64651126",
"0.6461223",
"0.6414... | 0.62790936 | 26 |
GET /measurements/1 GET /measurements/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_measurements\n render json: @data_source.measurements\n end",
"def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{for... | [
"0.7922641",
"0.74584174",
"0.7430356",
"0.712793",
"0.7073469",
"0.7012141",
"0.68787414",
"0.6842956",
"0.67900056",
"0.67900056",
"0.67900056",
"0.6696789",
"0.6695822",
"0.669237",
"0.66547334",
"0.6624081",
"0.66104716",
"0.66009676",
"0.65753645",
"0.6562094",
"0.641253... | 0.0 | -1 |
POST /measurements POST /measurements.json | def create
@measurement = Measurement.new(measurement_params)
respond_to do |format|
if @measurement.save
format.html { redirect_to @measurement, notice: 'Measurement was successfully created.' }
format.json { render json: @measurement.sensor.beehive, status: :created }
else
format.html { render :new }
format.json { render json: @measurement.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measurements_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_post ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n q... | [
"0.7463203",
"0.70944273",
"0.700902",
"0.700902",
"0.6952169",
"0.6900316",
"0.6757517",
"0.6627877",
"0.6605203",
"0.66008323",
"0.65505373",
"0.6514893",
"0.6509042",
"0.64548767",
"0.6437762",
"0.64048356",
"0.6378541",
"0.6377161",
"0.63709927",
"0.6354808",
"0.6347482",... | 0.70513076 | 2 |
PATCH/PUT /measurements/1 PATCH/PUT /measurements/1.json | def update
respond_to do |format|
if @measurement.update(measurement_params)
format.html { redirect_to @measurement, notice: 'Measurement was successfully updated.' }
format.json { render :show, status: :ok, location: @measurement }
else
format.html { render :edit }
format.json { render json: @measurement.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @measurement = Measurement.find(params[:id])\n\n respond_to do |format|\n if @measurement.update_attributes(params[:measurement])\n format.html { redirect_to body_measurement_path(@measurement), notice: 'Measurement was successfully updated.' }\n format.json { head :... | [
"0.6841076",
"0.67905056",
"0.6758602",
"0.6698196",
"0.663055",
"0.6563053",
"0.6549216",
"0.64741534",
"0.6468551",
"0.64460576",
"0.6445895",
"0.6445895",
"0.6412759",
"0.6409086",
"0.63913417",
"0.6375623",
"0.6368979",
"0.6318149",
"0.6309063",
"0.6237899",
"0.6236965",
... | 0.68162733 | 2 |
DELETE /measurements/1 DELETE /measurements/1.json | def destroy
@measurement.destroy
respond_to do |format|
format.html { redirect_to measurements_url, notice: 'Measurement was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to body_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @k_measurement.destroy\n respond_to do |forma... | [
"0.7637748",
"0.75193834",
"0.7415383",
"0.7409122",
"0.7408486",
"0.7408399",
"0.73095185",
"0.72895634",
"0.7284229",
"0.7247026",
"0.7236325",
"0.72333264",
"0.72162807",
"0.72162807",
"0.7130605",
"0.70659244",
"0.6988571",
"0.6923675",
"0.6923675",
"0.6923675",
"0.690624... | 0.7415015 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_measurement
@measurement = Measurement.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def measurement_params
params.require(:measurement).permit(:value, :datetime, :sensor_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
Sent on 3rd unsuccessful withdrawal if user doesn't have previous successful withdrawals | def unpaid_user_notification(user)
mail(to: user.email, subject: I18n.t('user_mailer.unpaid_user_notification.subject'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_withdrawals\n current_user.pretransactions.each do |p|\n withdraw_result = Operation.confirm_withdraw(p.transaction_id, p.user_id, p.user_pin, p.amount)\n # Cuando el retiro es exitoso, el webservice regresa un mensaje indicando el balance actual\n if withdraw_result.eql? \"Your curre... | [
"0.6733553",
"0.63878775",
"0.6327944",
"0.6235743",
"0.6121941",
"0.60509753",
"0.5963246",
"0.5920391",
"0.58988017",
"0.5891181",
"0.58907926",
"0.58799106",
"0.58678305",
"0.584692",
"0.58398855",
"0.583957",
"0.582293",
"0.5812043",
"0.58004665",
"0.57998264",
"0.5764046... | 0.0 | -1 |
Write a program that can calculate the sum of the first n elements of the following sequences: ``` s1 = 1 1 + 1 1 + 1 1 + //etc s2 = 1 + 2 + 3 + 4 + 5 + 6 + //etc ``` | def s1 number
number % 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_to(n)\n (1..n).reduce(0) do |sum, value|\n sum + value\n end\nend",
"def pairSumSequence(n)\n sum = 0\n\n for i in 0..n\n # pairSum calls do not exist simultabeously on\n # the call stack, so you only need O(1) space\n sum += pairSum(i, i + 1)\n puts \"sum += (#{i + i + 1}) #{i} + #{i}... | [
"0.73324776",
"0.7258862",
"0.7082886",
"0.70469147",
"0.6998515",
"0.69715536",
"0.6968662",
"0.69685775",
"0.693148",
"0.6886464",
"0.68644524",
"0.6862345",
"0.6841345",
"0.6840327",
"0.6836853",
"0.6827322",
"0.6814544",
"0.68061024",
"0.67923105",
"0.67677724",
"0.675308... | 0.0 | -1 |
TODO: This is not secure revisit asap | def login
user = User.find_by(psid: params[:id])
session[:user_id] = user.id if user.present?
redirect_to(session[:target_page] || root_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def refutal()\n end",
"def weber; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def internal; end",
"def implementation; end",
"def implementation; end",
"def identify; ... | [
"0.75111926",
"0.6355163",
"0.635301",
"0.6224968",
"0.62148684",
"0.6077722",
"0.6077722",
"0.6077722",
"0.6077722",
"0.60311574",
"0.59798783",
"0.5853978",
"0.5853978",
"0.58085704",
"0.580271",
"0.57734406",
"0.57734406",
"0.57632345",
"0.5721554",
"0.5679097",
"0.5669236... | 0.0 | -1 |
Encrypts the password with the user salt | def encrypt(password)
self.class.encrypt(password, salt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n ... | [
"0.8456925",
"0.83813494",
"0.8373668",
"0.8366289",
"0.8361539",
"0.8357302",
"0.8357302",
"0.8357302",
"0.8357302",
"0.8357302",
"0.8357302",
"0.8353389",
"0.8352614",
"0.8315463",
"0.83141565",
"0.83022135",
"0.82856274",
"0.8279945",
"0.8254098",
"0.8232162",
"0.8230575",... | 0.0 | -1 |
These create and unset the fields required for remembering users between browser closes | def remember_me
remember_me_for 2.weeks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forgets\n update_attribute(:remember_digest, nil)\n end",
"def after_save\n cookies['global_properties_for_user'] = nil\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:... | [
"0.655833",
"0.64576274",
"0.6433039",
"0.6433039",
"0.63186485",
"0.6318346",
"0.62982345",
"0.62982345",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
... | 0.0 | -1 |
Returns true if the user has just been activated. | def recently_activated?
@activated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activated?\n self.user && self.user.activated?\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_... | [
"0.82776856",
"0.7811329",
"0.7804574",
"0.7778738",
"0.7778738",
"0.77549386",
"0.77341413",
"0.7729316",
"0.7685652",
"0.76716274",
"0.7668748",
"0.7614284",
"0.759112",
"0.75275487",
"0.7495403",
"0.74625885",
"0.73862773",
"0.73260075",
"0.72826624",
"0.7257669",
"0.71833... | 0.76535165 | 63 |
where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate. | def duplicate_encode(word)
result = []
word = word.downcase.split('')
word.each do |i|
result << if word.count(i) >= 2
i.sub(i, ')')
else
i.sub(i, '(')
end
end
result.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duplicate_encode(str)\n new_str = ''\n\n str.downcase.each_char do |character|\n if str.downcase.count(character) > 1\n new_str << ')'\n else\n new_str << '('\n end\n end\n new_str\nend",
"def duplicate_encode(word)\n word.downcase.chars.map do |chr|\n word.downcase.count(chr) > 1 ... | [
"0.80510503",
"0.7961763",
"0.7932815",
"0.79112566",
"0.78377986",
"0.78319895",
"0.77161425",
"0.67686206",
"0.6620714",
"0.65373486",
"0.6508503",
"0.6480628",
"0.64460963",
"0.6311667",
"0.6274133",
"0.6259759",
"0.6243334",
"0.6242303",
"0.6231842",
"0.6226933",
"0.62259... | 0.7552216 | 7 |
Converts even/odd number of board elements to whose turn it is | def current_player
if (turn_count % 2) == 0
player = "X"
elsif (turn_count % 2) != 0
player = "O"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_turn(board)\r\n new_board = Array.new(board.size) {Array.new (board[0].size)}\r\n\r\n #iterate over each cell in the board and calculate it's value by calling next_cell_value\r\n board.each_with_index do |cells, row|\r\n cells.each_with_index do |cell, column|\r\n new_board[row][colu... | [
"0.66575634",
"0.6587966",
"0.6525364",
"0.6477624",
"0.62640435",
"0.6158583",
"0.61296207",
"0.6116276",
"0.61100966",
"0.6088177",
"0.6053388",
"0.6049237",
"0.60301656",
"0.6015554",
"0.5979818",
"0.59790826",
"0.5974737",
"0.59478664",
"0.594578",
"0.5943413",
"0.5922933... | 0.0 | -1 |
def hit! self.class.increment_counter :hits, id end | def accept_comments?
!locked?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hit\n @hits += 1\n :hit\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end",
"def inc_hit(key, options)\n if @hits[ke... | [
"0.8304819",
"0.7749748",
"0.75567895",
"0.75567895",
"0.74630153",
"0.7457225",
"0.739836",
"0.7342475",
"0.73234636",
"0.70998937",
"0.70642406",
"0.6872798",
"0.6758087",
"0.6745335",
"0.672149",
"0.672149",
"0.672149",
"0.672092",
"0.66929406",
"0.6637433",
"0.65787786",
... | 0.0 | -1 |
FIXME can we extract this to an observer or similar? | def after_post_update(post)
if post = post.frozen? ? posts.last : post
update_attributes! :last_updated_at => post.created_at,
:last_post_id => post.id,
:last_author => post.author
else
self.destroy
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callbacks; end",
"def callbacks; end",
"def event; end",
"def event; end",
"def event; end",
"def subscribed; end",
"def notifier; end",
"def notifier; end",
"def after_update; end",
"def after_update; end",
"def private; end",
"def fires_in; end",
"def on_data_changed; end",
"def on_... | [
"0.6625564",
"0.6625564",
"0.6596512",
"0.6596512",
"0.6596512",
"0.6468744",
"0.64516",
"0.64516",
"0.64264256",
"0.64264256",
"0.64211744",
"0.6409643",
"0.6319581",
"0.6312983",
"0.6279828",
"0.6279828",
"0.6279828",
"0.6279828",
"0.6279828",
"0.6279828",
"0.6279828",
"0... | 0.0 | -1 |
Path Helpers Returns the topdir of the vm | def path
File.join Fission.config.attributes['vm_dir'], "#{@name}.vmwarevm"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_level\n git.git_dir.chomp(GIT_DIR)\n end",
"def root; Pathname(__dir__).parent; end",
"def top_level\n git.git_dir.chomp(GIT_DIR)\n end",
"def search_top\n Dir.chdir(\".\")\n while File.exist?(\"#{Dir.pwd}/#{@target_app}.#{@@suffix}\")\n @top_dir = Dir.pwd.to_s\n D... | [
"0.64974153",
"0.6468744",
"0.64651304",
"0.6362081",
"0.6302365",
"0.6268175",
"0.6240816",
"0.62269646",
"0.62269646",
"0.62097895",
"0.61952484",
"0.615892",
"0.614377",
"0.6135934",
"0.6105772",
"0.6105772",
"0.6102856",
"0.6072272",
"0.6072272",
"0.60722196",
"0.6072091"... | 0.6059245 | 21 |
Returns a string to the path of the config file There is no guarantee it exists | def vmx_path
return File.join(path, "#{@name}.vmx")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n @path ||= File.dirname @config_file\n end",
"def config_path\n @config_path ||= local_config_path\n end",
"def configuration_file_path; end",
"def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \... | [
"0.82676256",
"0.8110445",
"0.8043626",
"0.7952297",
"0.7948016",
"0.792959",
"0.77991873",
"0.77798355",
"0.77635163",
"0.77607954",
"0.77564317",
"0.76727456",
"0.7666797",
"0.76605904",
"0.7643387",
"0.7615435",
"0.76090103",
"0.7600014",
"0.75726026",
"0.7517375",
"0.7501... | 0.0 | -1 |
Checks to see if a vm exists | def exists?
File.exists? vmx_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"def vm_exists?(uuid)\n end",
"def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id]... | [
"0.8354157",
"0.8354157",
"0.81666046",
"0.8128989",
"0.77670723",
"0.77669305",
"0.7680523",
"0.76046234",
"0.7496345",
"0.7443837",
"0.7411191",
"0.7406176",
"0.7355249",
"0.72899824",
"0.71954244",
"0.71849513",
"0.71566314",
"0.7108514",
"0.7025249",
"0.68629026",
"0.6783... | 0.6790197 | 20 |
Returns the state of a vm | def state
return "not created" unless self.exists?
return "suspend" if self.suspended?
return "running" if self.running?
return "not running"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end",
"def get_current_state\n execute(:get_vm_status, VmId: vm_id)\n end",
"def read_state\n output = execute(\"showvminfo\", @uuid, \"--machinereadable\")\n if output =~ /^na... | [
"0.8262602",
"0.8060688",
"0.7942942",
"0.79282784",
"0.7754078",
"0.76371753",
"0.7610324",
"0.75148004",
"0.7496442",
"0.74627566",
"0.73806226",
"0.7066245",
"0.70026124",
"0.70026124",
"0.6912022",
"0.6872066",
"0.6822447",
"0.6718823",
"0.6712355",
"0.6678839",
"0.662249... | 0.5868944 | 93 |
VM information Returns an Array of snapshot names | def snapshots
raise Fission::Error,"VM #{@name} does not exist" unless self.exists?
command = "#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1"
output = `#{command}`
raise "There was an error listing the snapshots of #{@name} :\n #{output}" unless $?.exitstatus==0
snaps_unfiltered = output.split("\n").select { |s| !s.include? 'Total snapshots:' }
snaps=snaps_unfiltered.map { |s| s.strip }
return snaps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_snapshots\n snaps = execute(:list_snapshots, VmID: vm_id)\n snaps.map { |s| s['Name'] }\n end",
"def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n ... | [
"0.7319119",
"0.71669644",
"0.7153999",
"0.6923329",
"0.67877907",
"0.67184603",
"0.6675733",
"0.6673279",
"0.66490376",
"0.6545397",
"0.64824367",
"0.6316332",
"0.6287981",
"0.622398",
"0.61647075",
"0.6128748",
"0.6089432",
"0.60887355",
"0.6086411",
"0.605722",
"0.6042591"... | 0.7733573 | 0 |
Retrieve the first mac address for a vm This will only retrieve the first auto generate mac address | def mac_address
raise ::Fission::Error,"VM #{@name} does not exist" unless self.exists?
line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)
if line.nil?
#Fission.ui.output "Hmm, the vmx file #{vmx_path} does not contain a generated mac address "
return nil
end
address=line.first.split("=")[1].strip.split(/\"/)[1]
return address
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end",
"def read_mac_address\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n return $1.to_s if line =~ /^macaddress1=\"(.+?)\"$/\n end\n\n nil\n end",
"def get_f... | [
"0.7704013",
"0.7675842",
"0.73797023",
"0.7317242",
"0.7144452",
"0.7067365",
"0.6933891",
"0.6901718",
"0.6853932",
"0.6762301",
"0.66511726",
"0.6614734",
"0.6609896",
"0.6605801",
"0.65367144",
"0.6535168",
"0.65021825",
"0.646451",
"0.6388925",
"0.63637304",
"0.6271221",... | 0.7567683 | 2 |
Retrieve the ip address for a vm. This will only look for dynamically assigned ip address via vmware dhcp | def ip_address
raise ::Fission::Error,"VM #{@name} does not exist" unless self.exists?
unless mac_address.nil?
lease=LeasesFile.new("/var/db/vmware/vmnet-dhcpd-vmnet8.leases").find_lease_by_mac(mac_address)
if lease.nil?
return nil
else
return lease.ip
end
else
# No mac address was found for this machine so we can't calculate the ip-address
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ip_address\n # Does not work for now as the vmx path is not escape correctly by fission 0.4.0\n #return raw.network_info.data.first['ip_address']\n raise ::Fission::Error,\"VM #{name} does not exist\" unless self.exists?\n \n # Use alternate method to retrieve the I... | [
"0.76284814",
"0.752667",
"0.7457153",
"0.7347785",
"0.72087175",
"0.71711296",
"0.69107574",
"0.6891406",
"0.6850987",
"0.6764583",
"0.668296",
"0.6617597",
"0.6596634",
"0.6594578",
"0.6567539",
"0.6539812",
"0.6466149",
"0.6445676",
"0.64088595",
"0.64080715",
"0.6396263",... | 0.7576724 | 1 |
Action to revert to a snapshot Returns a response object | def revert_to_snapshot(name)
raise Fission::Error,"VM #{@name} does not exist" unless self.exists?
command = "#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \"#{name}\" 2>&1"
output = `#{command}`
response = Fission::Response.new :code => $?.exitstatus
response.output = output unless response.successful?
response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revert_to_snapshot(name)\n Fission::Action::Snapshot::Reverter.new(self).revert_to_snapshot(name)\n end",
"def revert_to_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n if Fusion.running?\n message = 'It looks li... | [
"0.7438079",
"0.7389861",
"0.7338052",
"0.7275521",
"0.67530805",
"0.67072976",
"0.666179",
"0.6651446",
"0.6631841",
"0.6541021",
"0.6415363",
"0.641416",
"0.6330085",
"0.6192118",
"0.61744076",
"0.6156204",
"0.6108528",
"0.607463",
"0.6065918",
"0.60650563",
"0.6046769",
... | 0.71865606 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_employee
@employee = Employee.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def employee_params
params.require(:employee).permit(:name, :contact, :cc, :email, :admin, :password, :password_confirmation, :current_password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
Returns true if the text chunk is international, false otherwise | def international?
@international
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode?\n self.local =~ /[^\\p{InBasicLatin}]/ ? true : false\n end",
"def textual?\n properties.include?(\"textual\")\n end",
"def localize_present?\n false\n end",
"def is_international?\n internation.present?\n end",
"def text?\n [:ascii, :text].include?(type)\n ... | [
"0.6982029",
"0.67750406",
"0.65705204",
"0.64699537",
"0.6374134",
"0.63158965",
"0.62764",
"0.6249086",
"0.62488264",
"0.6231267",
"0.6218963",
"0.621181",
"0.6196331",
"0.6175422",
"0.6157065",
"0.61568975",
"0.6122454",
"0.6115466",
"0.6104696",
"0.6053358",
"0.60468656",... | 0.6834056 | 1 |
Decompresses (if necessary) and forces correct encoding | def text
txt = @text
if @compressed
txt = PngMethods::inflate(@text)
end
if @international
txt.force_encoding("UTF-8")
else
txt.force_encoding("ISO-8859-1")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decompressor; end",
"def clean\n self.encode!('UTF-8', :invalid => :replace, :undef => :replace, replace: '')\n end",
"def deflate!\n self.replace(deflate)\n end",
"def convert_encoding(content)\n return content unless content.respond_to?(:force_encoding)\n if content =~ ENCODING_LI... | [
"0.6871821",
"0.635811",
"0.6213504",
"0.60843205",
"0.60098034",
"0.59994274",
"0.59281456",
"0.5910929",
"0.5906171",
"0.5836689",
"0.5825416",
"0.5795893",
"0.5782795",
"0.57682407",
"0.57636654",
"0.5730456",
"0.57121706",
"0.5710276",
"0.57006013",
"0.5683488",
"0.568217... | 0.0 | -1 |
Prints formatted keyword and text | def report
if @language == "" && @translated_keyword == ""
puts @keyword + ": " + text
else
puts @language
puts @keyword + ", " + @translated_keyword + ": " + text
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n text = \"#{keyword} #{self.text}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end",
"def show_word\n print \"The word was: #{@word} \\n\"\n puts \"\\n\"\n end",
"def to_s\n text = \"#{keyword} #{base}... | [
"0.6458207",
"0.6131731",
"0.6064634",
"0.60563797",
"0.6001674",
"0.59674597",
"0.59522015",
"0.59356445",
"0.59262383",
"0.59262383",
"0.58965904",
"0.58951765",
"0.5876211",
"0.58717483",
"0.5829043",
"0.58243555",
"0.5814244",
"0.5812931",
"0.5806812",
"0.5766679",
"0.573... | 0.6708472 | 0 |
paginate a call to find_tagged_with klass is the tagged class tag is the tag to find count is the total number of items with that tag, if nil count_tags is called per_page is numbe rof items per page page is the page we are on order is the order to return the items in | def tag_paginator(klass, tag, count=nil, per_page=10, page=1, offset = 0, order='created_at DESC')
count ||= klass.count_tags(tag)
pager = ::Paginator.new(count, per_page) do |offset, per_page|
klass.find_tagged_with(tag, :order => order, :limit => per_page, :offset => offset)
end
page ||= 1
returning WillPaginate::Collection.new(page, per_page, count) do |p|
p.replace pager.page(page).items
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles_tagged(tag, options = {})\n tag = Tag.first(:name => tag)\n return 0 unless tag\n t = self.taggings.paginate(options.merge(:tag_id => tag.id))\n collection = t.collect{|tagging| tagging.article}\n collection = collection.delete_if{|a| !a.published?}\n \n collection.instance_variab... | [
"0.66003436",
"0.6391298",
"0.6306939",
"0.62793404",
"0.627472",
"0.6229027",
"0.62264585",
"0.6220754",
"0.6141646",
"0.60669404",
"0.6031202",
"0.59485465",
"0.5931235",
"0.59171915",
"0.58777076",
"0.58730084",
"0.58580357",
"0.58524275",
"0.5837237",
"0.58119905",
"0.580... | 0.7661707 | 0 |
format time to long style | def timelong( time )
time.strftime('%Y-%m-%d %H:%M:%S') if time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tt(time, format=:short); '13:37'; end",
"def time_str\n Time.at(time[0..-4].to_f + time[-3..-1].to_f / 1000)\n .strftime(\"%M:%S.%L\")\n end",
"def format_time(time)\n return time.strftime(\"%l:%M%p\")\n end",
"def log_fmt_timestamp(time)\n [(time/3600).to_i, (time/60 % 60).to_i... | [
"0.762114",
"0.7618584",
"0.7519751",
"0.74997866",
"0.7366242",
"0.73236287",
"0.7310665",
"0.7303636",
"0.72753733",
"0.7223913",
"0.71899843",
"0.71463454",
"0.71317875",
"0.71317875",
"0.71245646",
"0.7123734",
"0.7113938",
"0.7100749",
"0.7097445",
"0.70783395",
"0.70604... | 0.7941969 | 0 |
format time to short style | def dateshort( time )
time.strftime('%Y-%m-%d') if time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_time\n \ttime.strftime \"%b %-d\"\n end",
"def tt(time, format=:short); '13:37'; end",
"def nice_time\n Time.at(time).utc.strftime('%-M:%Ss')\n end",
"def format_time(time)\n return time.strftime(\"%l:%M%p\")\n end",
"def format_time(time)\n time = Time.at(time / 1e6, time % 1e6)\n ... | [
"0.8368692",
"0.8197481",
"0.7718258",
"0.76882726",
"0.76369214",
"0.7551316",
"0.7547099",
"0.7538783",
"0.75184894",
"0.75184894",
"0.7449861",
"0.7439442",
"0.7433301",
"0.7406357",
"0.7400615",
"0.7392176",
"0.7358878",
"0.7349641",
"0.7325983",
"0.7315013",
"0.7279062",... | 0.66973037 | 99 |
if any html request comes through then match it unless it is in the assets path | def matches?(request)
# this treats */* as html request
return false unless request.format
return false unless request.format.html?
@exceptions.each {|p|
return false if p.match request.path
}
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_site_assets\n if request.path.start_with?('/site_assets')\n render(file: 'public/404.html', status: :not_found, layout: false) && false\n else\n true\n end\n end",
"def bypass_by_path?(req)\n req.path =~ /^\\/assets/\n end",
"def route_assets?\n request.path_info.... | [
"0.70789576",
"0.705498",
"0.66981816",
"0.6649113",
"0.62439275",
"0.6172021",
"0.6107952",
"0.59929293",
"0.586222",
"0.58214074",
"0.5780096",
"0.5741709",
"0.5735169",
"0.56882286",
"0.56540173",
"0.56419224",
"0.5560882",
"0.5505301",
"0.5505267",
"0.54979676",
"0.549550... | 0.6074989 | 7 |
generate list of candidates for santas | def get_candidates(person)
cans = []
$list.each do |p|
cans.push p unless
(p == person) ||
(p['last'] == person['last']) ||
(p['santa'] != -1)
end
cans
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candidates(s)\n res = []\n candidates_helper(s, 0, res)\n res\n end",
"def find_candidates\n scout(exp: expression, depth: 0)\n end",
"def getCandidates (data, len)\n\t\tresult = Array.new\n\t\tdata.each do |s|\n\t\t\tlst = Array.new\n\t\t\tsumChars = self.charsSum (s)\n... | [
"0.7126689",
"0.639896",
"0.6343264",
"0.6273059",
"0.6236223",
"0.6201716",
"0.60970813",
"0.59484583",
"0.5913115",
"0.58924836",
"0.5738354",
"0.5721827",
"0.571328",
"0.56898034",
"0.5687055",
"0.5675722",
"0.5661004",
"0.56531656",
"0.56120485",
"0.55758554",
"0.55756474... | 0.56986624 | 13 |
This is a shameful copy from testkitchen. Without the copy, the path won't be correct. | def wright_shell_code_from_file(vars, file)
src_file = File.join(
File.dirname(__FILE__),
%w[.. .. .. support],
file + ".sh"
)
wrap_shell_code([vars, "", IO.read(src_file)].join("\n"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_path\n File.join(root_path, \"test\")\n end",
"def src_path\n File.dirname(__FILE__)\nend",
"def src_path\n File.dirname(__FILE__)\nend",
"def relative_directory; end",
"def compiled_path; end",
"def source_path; end",
"def scratch_folder()\n return File.expand_path(File.join(File.d... | [
"0.66089135",
"0.65773046",
"0.65773046",
"0.65313226",
"0.6527836",
"0.6467001",
"0.6376922",
"0.6362421",
"0.6321212",
"0.6305474",
"0.624909",
"0.624909",
"0.624909",
"0.624909",
"0.624909",
"0.624909",
"0.624909",
"0.6245399",
"0.6237702",
"0.62298626",
"0.62175685",
"0... | 0.0 | -1 |
Explicitly set the name of the exchange | def exchange_names(*names)
@_exchange_names ||= []
@_exchange_names += names.flatten.map(&:to_s)
if @_exchange_names.empty?
return [ ::ActionSubscriber.config.default_exchange ]
else
return @_exchange_names.compact.uniq
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_exchangeName (exchangeName)\n\t\texchangeMarketNames = {\"nasdaq\" => \"NMS\", \"dowjones\" => \"DJI\", \"sp\" => \"SNP\"}\n\t\texchangeMarketSymbols = {\"NMS\" => \"^IXIC\", \"DJI\" => \"^DJI\", \"SNP\" => \"^GSPC\"}\n\t\tself.exchangeName = exchangeName\n\t\tself.exchangeSymbol = exchangeMarketSymbols[ex... | [
"0.7512821",
"0.70100176",
"0.69905454",
"0.692164",
"0.68600786",
"0.6787419",
"0.6787419",
"0.6787419",
"0.6787419",
"0.6787419",
"0.6787419",
"0.6511542",
"0.6495805",
"0.6479369",
"0.6425406",
"0.6393401",
"0.6339239",
"0.6331717",
"0.629082",
"0.6271413",
"0.62706304",
... | 0.54802006 | 65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.