query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
gets the binary folder, first from .appspec then from proj given a configuration mode (default: Release) | def bin_folder configuration = 'Release'
conf['bin'] || proj.output_path(configuration)
end | [
"def get_apk_file_path(buildType, versionCode, versionName)\n if buildType == 'qa'\n suffix = \"-qa\"\n else\n suffix = \"\"\n end\n return \"app/build/outputs/apk/\"+buildType+ \"/\"+\"app_\"+versionCode+\"_\"+versionName + suffix +\".apk\"\nend",
"def apk_path(flavour, build_type)\n \"app/build... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the folder that is used to keep configuration that defaults to the current (.) directory | def conf_folder
conf['conf_folder'] || '.'
end | [
"def config_folder\n @config_folder ||= @options[:config_folder]\n end",
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def config_dir\n File.join(Dir.home, CONFIG_DIR)\n end",
"def get_uplift_config_folder\n path = File.expand_path(@... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the provider to use to calculate the directory paths to construct inside the nuget defaults to the 'defaults' provider which can be found in 'albacore/app_spec/defaults.rb' | def provider
conf['provider'] || 'defaults'
end | [
"def provider_directory\n Pathname.new(puppet_lib) + 'provider' + @name\n end",
"def provider_path\n provider_directory + \"#{@provider}.rb\"\n end",
"def default_paths\n [\n Dir.pwd,\n PoolParty::Default.poolparty_home_path,\n PoolParty::Default.base_keypair_pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the host header to use for the binding in IIS defaults to , i.e. binding to all hosts | def host_header
conf['host_header'] || '*'
end | [
"def host\n @host || @headers['host'].to_s.split(':')[0].to_s\n end",
"def requested_http_host\n @client_headers['Host']\n end",
"def host\n parse_host_header unless @host_header_parsed\n @host\n end",
"def host_on_header\n request.headers['HTTP_HOST']\n end",
"def prox... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determines whether the passed path is valid and existing | def valid_path path
path and File.exists? path
end | [
"def valid?\n File.exist?(path) && File.readable?(path)\n end",
"def valid_path?(path)\n store, _ = parse_path(path)\n include?(store)\n rescue\n false\n end",
"def path_ok?\n \t\t\tFile.exists?(self.file_path)\n \t\tend",
"def path_exists?(path)\n if(!Pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the source from the current git repository: finds the first remote and uses that as the source of the RPM | def git_source
`git remote -v`.
split(/\n/).
map(&:chomp).
map { |s| s.split(/\t/)[1].split(/ /)[0] }.
first
end | [
"def find_source(gem, source)\n case source\n when Bundler::Source::Rubygems\n GemUpdater::RubyGemsFetcher.new(gem, source).source_uri\n when Bundler::Source::Git\n source.uri.gsub(/^git/, 'http').chomp('.git')\n end\n end",
"def find_source( gem, source )\n case source\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the semver version in %M.%m.%p form or nil if a semver isn't given in the c'tor of this class. If we have gotten an explicit version in the constructor, let's assume that version should be used in front of anything else and that the calling libraries know what they are doing. | def semver_version
return @semver.format '%M.%m.%p' if @semver
nil
end | [
"def semver\n @semver ||= SemVer.parse(Publisher::VERSION)\n end",
"def semantic_version\n begin\n Semverse::Version.new(version)\n rescue Semverse::InvalidVersionFormat\n errors.add(:version, 'is formatted incorrectly')\n end\n end",
"def semver_disk_version\n v = XSemVer::SemV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if everything else fails, return the semver from disk | def semver_disk_version
v = XSemVer::SemVer.find
v.format '%M.%m.%p' if v
rescue SemVerMissingError
nil
end | [
"def semver_file\n '.semver'\n end",
"def semantic_version\n return true if version == \"master\"\n\n begin\n Semverse::Version.new(version.gsub(/\\Av/, \"\"))\n rescue Semverse::InvalidVersionFormat\n errors.add(:version, 'is formatted incorrectly')\n end\n end",
"def semver\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
step 2 All the user personal information is required, any fault return to step1 Create the user that will be save in session and removed in the last step | def step2
user = User.new
user.first_name = params[:first_name]
user.last_name = params[:last_name]
user.email = params[:username]
user.email_confirmation = params[:username_confirmation]
user.password = params[:password]
user.password_confirmation = params[:password_confirmation]
sessio... | [
"def create\n @user_step1 = UserStep1.new(user_step1_params)\n\n respond_to do |format|\n if @user_step1.save\n session[:step1_project_name]=@user_step1.project_name\n session[:step1_phase_name]=@user_step1.phase_name\n format.html { redirect_to '/resumes/new', notice: 'User step1 wa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
step 3 The subscription value is required Save in the user session the subscription that he/she choose Collect all payment info | def step3
user = session[:user]
#for v1, always this will be the subscription basic 18$, for v2 this will change
user.subscription_id = 1
end | [
"def save_subscription_change\n \n @user_payments = UserPayments.where([\"user_id=? and end_date>=?\", current_user.id,Time.zone.now])\n @plan = Plan.find_by_id(params[:user_payments][:plan_id].to_i)\n \n if @user_payments.present?\n# flash[:notice] = \"params[:user_payments][:plan_id]=#{params... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the given pool and append to attributes Note: volume_pool_name is not working in fog library version 1.7.0. This should be fixed in the next release. | def check_pool(options, attributes)
env.logger.info "Checking pool storage"
if not options.nil? and not options.empty? and not options["pool_name"].nil?
conn = ::Libvirt::open("qemu:///system")
# Checking if the pool exists and if it is active
begin
... | [
"def get_pool_attributes\n pool_type ? \"(#{get_pool_lanes_number}x#{get_pool_length_in_meters})\" : '(?)'\n end",
"def pool=(pool)\n @vserver_hash.properties.basic.pool=pool\n end",
"def volume_defined?(volume_name, pool_name)\n volume_list(pool_name).key? volume_name\n end",
"def ssdb_attr_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the volume of a new vm | def create_volume(options)
# Creating the volume is part of the server creation
end | [
"def volume_create(volume_name, virt_type, volume_size)\n commands = [\n 'virsh',\n 'vol-create-as',\n virt_type,\n volume_name,\n volume_size,\n ]\n\n debug \"Volume create: #{commands.join ' '}\"\n _output, success = run commands\n error \"Failed to create volume:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save current style to themepreviewertmp.less stylesheet This file overrides themepreviewerpublished.less | def save_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
end | [
"def apply_previewer_style(theme)\n target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-published.less')\n File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }\n reset_previewer_style\n end",
"def save_editor_settings\n Sketchup.write_default('M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save style to themepreviewerpublished.less and discard themepreviewertmp.less | def apply_previewer_style(theme)
target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-published.less')
File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }
reset_previewer_style
end | [
"def save_previewer_style(theme)\n target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')\n File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }\n end",
"def save_theme(themeName = '', acceptpublish=true)\n # make sure that veil is not enabled\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a theme provided as a hash into a properly formatted LESS file | def theme_to_less(theme)
out = "// Generated by the Express Theme Previewer\n"
if theme[:branding]
out += "\n//----------------------------------------\n"
out += "// General Branding\n"
out += "//----------------------------------------\n"
out += theme[:branding]... | [
"def save_previewer_style(theme)\n target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')\n File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }\n end",
"def apply_previewer_style(theme)\n target = Rails.root.join('frontend', 'src','app','style... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /opinions or /opinions.json | def create
@opinion = current_user.opinions.build(opinion_params)
respond_to do |format|
if @opinion.save
format.html { redirect_to root_path, notice: 'Opinion was successfully created.' }
format.json { render :show, status: :created, location: @opinion }
else
format.html { ... | [
"def create\n @opinion = @replied.opinions.build(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.json { render json: @opinion }\n else\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @op... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__13! (T__13) (in Ingredients.g) | def t__13!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 6 )
type = T__13
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 22:9: 'a'
match( 0x61 )
@state.type = type
@state.channel ... | [
"def t__13!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = T__13\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 9:9: '-'\n match(?-)\n\n \n @state.type = type\n @st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__18! (T__18) (in Ingredients.g) | def t__18!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 11 )
type = T__18
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 27:9: 'L'
match( 0x4c )
@state.type = type
@state.channel... | [
"def t__18!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = T__18\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 14:9: ','\n match( 0x2c )\n\n \n @state.type = type\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__26! (T__26) (in Ingredients.g) | def t__26!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 19 )
type = T__26
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 35:9: 'g'
match( 0x67 )
@state.type = type
@state.channel... | [
"def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 49:9: '!'\n match(?!)\n\n \n @state.type = type\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__32! (T__32) (in Ingredients.g) | def t__32!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 25 )
type = T__32
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 41:9: 'N'
match( 0x4e )
@state.type = type
@state.channel... | [
"def t__32!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n type = T__32\n channel = ANTLR3::DEFAULT_CHANNEL\n\n\n # - - - - main rule block - - - -\n # at line 30:9: '+'\n match(0x2b)\n\n\n @state.type = type\n @state.ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__36! (T__36) (in Ingredients.g) | def t__36!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 29 )
type = T__36
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 45:9: 'T'
match( 0x54 )
@state.type = type
@state.channel... | [
"def t__36!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n type = T__36\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 25:9: 'char'\n match( \"char\" )\n\n \n @state.type = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__37! (T__37) (in Ingredients.g) | def t__37!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 30 )
type = T__37
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 46:9: 't'
match( 0x74 )
@state.type = type
@state.channel... | [
"def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 49:9: '!'\n match(?!)\n\n \n @state.type = type\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__42! (T__42) (in Ingredients.g) | def t__42!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 35 )
type = T__42
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 51:9: 'U'
match( 0x55 )
@state.type = type
@state.channel... | [
"def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 49:9: '!'\n match(?!)\n\n \n @state.type = type\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule t__43! (T__43) (in Ingredients.g) | def t__43!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 36 )
type = T__43
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 52:9: 'u'
match( 0x75 )
@state.type = type
@state.channel... | [
"def t__65!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n type = T__65\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 49:9: '!'\n match(?!)\n\n \n @state.type = type\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule digit! (DIGIT) (in Ingredients.g) | def digit!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 37 )
type = DIGIT
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 136:8: '0' .. '9'
match_range( 0x30, 0x39 )
@state.type = type
... | [
"def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 352:8: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n \n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule eol! (EOL) (in Ingredients.g) | def eol!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 39 )
type = EOL
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 138:6: ( '\\r' )? '\\n'
# at line 138:6: ( '\\r' )?
alt_2 = 2
look_2_... | [
"def eol!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n\n type = EOL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 354:6: ( '\\\\r' )? '\\\\n'\n # at line 354:6: ( '\\\\r' )?\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lexer rule letter! (LETTER) (in Ingredients.g) | def letter!
# -> uncomment the next line to manually enable rule tracing
# trace_in( __method__, 40 )
type = LETTER
channel = ANTLR3::DEFAULT_CHANNEL
# - - - - main rule block - - - -
# at line 139:9: ( 'a' .. 'z' | 'A' .. 'Z' )
if @input.peek( 1 ).between?( 0x41, 0x5a... | [
"def letter!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 56 )\n\n type = LETTER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 355:9: ( 'a' .. 'z' | 'A' .. 'Z' )\n if @input.peek( 1 ).betwe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add top suggestion to cart | def add_top_suggestion_to_cart
add_to_cart(suggestions.top)
end | [
"def add_other_suggestion_to_cart(index)\n add_to_cart(suggestions.others[index], :other)\n title_element.hover # To unhover suggestion\n wait_until { !suggestion.hovered? && suggestion.added_to_cart? }\n end",
"def add_to_cart(suggestion, type = nil)\n open_suggestion(suggestion) if type == :other\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add other suggestions to cart (by index) | def add_other_suggestion_to_cart(index)
add_to_cart(suggestions.others[index], :other)
title_element.hover # To unhover suggestion
wait_until { !suggestion.hovered? && suggestion.added_to_cart? }
end | [
"def add_top_suggestion_to_cart\n add_to_cart(suggestions.top)\n end",
"def add_to_cart(suggestion, type = nil)\n open_suggestion(suggestion) if type == :other\n suggestion.add_to_cart_element.when_visible.click\n wait_until { suggestion.added_to_cart_element.visible? }\n end",
"def index\n @su... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns spec by label and remove unnecessary | def spec(label)
nbsp = Nokogiri::HTML(' ').text
@specs.row(label)[1].text.gsub(nbsp, ' ')
end | [
"def remove_tags_by_label(*labels)\n current_labels = tag_labels\n labels = labels.flatten.compact.uniq\n removed = labels.map do |label|\n next unless current_labels.include? label.to_s\n tag = Tag.find_by label: label\n remove_tagging(tag)\n tag.label\n end\n reload\n removed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add suggestion to cart | def add_to_cart(suggestion, type = nil)
open_suggestion(suggestion) if type == :other
suggestion.add_to_cart_element.when_visible.click
wait_until { suggestion.added_to_cart_element.visible? }
end | [
"def add_top_suggestion_to_cart\n add_to_cart(suggestions.top)\n end",
"def add_other_suggestion_to_cart(index)\n add_to_cart(suggestions.others[index], :other)\n title_element.hover # To unhover suggestion\n wait_until { !suggestion.hovered? && suggestion.added_to_cart? }\n end",
"def suggest_ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show_percent_column :discount show_percent_column :product, :discount | def show_percent_column(*methods)
return show_header_column(methods) if is_header
content = get_methods_percent_value(model, methods)
content_tag :td, content
end | [
"def discount_percent\n self.discount.to_f * 100\n end",
"def show_percentage\n return @show_percentage\n end",
"def get_discount_table\n @discount\n end",
"def show_perc?\n @perc\n end",
"def percentage\n \tamount / expense.cost\n end",
"def percentage_discount\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return compiler Class for machine | def target(machine='vm')
if machine == 'vm'
require 'gmpforth/vm'
end
require "gmpforth/#{machine}compiler"
GMPForth::const_get "#{machine.upcase}Compiler"
end | [
"def compiler\n guess_compiler unless @compiler\n @compiler && @compiler.class.to_sym\n end",
"def compiler_class(extension)\n if cname = compiler_setting(extension)\n compname = Compiler.register.find{ |c| c.name.split('::').last == cname }\n compiler = const_get(compname)::Compil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loop through the flip_names make vowels in a position flip the vowels to next vowel if vowel... then add 1 to index. | def letter_change
consonant = "bcdfghjklmnpqrstvwxyz"
vowel = "aeiou"
new_name = ""
letter_new = ""
split_flip_name.each do |letter|
if consonant.index(letter) != nil
letter_new = consonant[consonant.index(letter) + 1]
elsif vowel.index(letter) != nil
#addresses last vowel edge ... | [
"def split_name(swap_name)\n\t#this takes a string and makes an array of each name\n\tletters0 = swap_name[0].split(\"\")\n\tletters1 = swap_name[1].split(\"\")\n\t# puts letters0.class\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\" ]\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Action to print the advance search partial (used onl with AJAX call) Usage URL : GET /searches/print_advanced | def print_advanced
@search ||= Search.new()
render :partial => 'advanced_search', :locals => { :category => params[:cat] }
end | [
"def search_advanced\n puts 'IN SEARCH_ADVANCED #####'\n @friends = getFriendsList(session[:access_token]) #mock friends (actually just users in the database)\n #@friends = User.find(:all)\n render :partial=>\"simple_search/advanced_search_bar\", :locals=>{ :friends=>@friends }\n end",
"def quick_sea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Strip the `help` message from the original ARGV, storing whether or not it was given for later. | def strip_help_param!
@help_given = ARGV.delete('--help')
end | [
"def handle_help\n if (ARGV.length >= 1) && is_help_flag?(ARGV[0])\n puts \"Detailed Instructions on application use can be found in the README.md file.\"\n puts \"Look under the Installation heading for more information!\"\n exit\n else\n # Continue as norm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print a help message and exit. | def dump_help_and_exit!
dump_help
exit(1)
end | [
"def help_and_exit\n printer.err help_message\n exit 1\n end",
"def show_help\n puts HELP_MESSAGE\n end",
"def handle_help\n if (ARGV.length >= 1) && is_help_flag?(ARGV[0])\n puts \"Detailed Instructions on application use can be found in the README.md file.\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4>49", "51>74", "76>99"]. Idea: Add two "artificial" elements, lower 1 before the first element and upper + 1 after the last element | def missing_ranges(array, lower = 0, upper = 99)
ranges = []
i = 0
prev = lower - 1
while i <= array.size
curr = (i == array.size) ? upper + 1 : array[i]
if curr - prev > 1
ranges << get_range(prev + 1, curr - 1)
end
prev = curr
i += 1
end
ranges
end | [
"def gaps(ranges)\n if ranges.empty?\n [clone]\n elsif spanned_by?(ranges)\n []\n else\n # TODO: does not work unless min and max respond to :succ\n ranges = ranges.sort_by(&:min)\n gaps = []\n cur_point = min\n ranges.each do |rr|\n break if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
request github authorization token UserAgent is required store the token in ~/.socialcast/credentials.yml for future reuse | def authorization_token
credentials = Socialcast::CommandLine.credentials
return credentials[:scgitx_token] if credentials[:scgitx_token]
username = current_user
raise "Github user not configured. Run: `git config --global github.user 'me@email.com'`" if username.empty?
passwor... | [
"def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end",
"def get_token\n token = get_github_token(true)\n if !token || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the PRs matching the given commit hash | def pull_requests_for_commit(repo, commit_hash)
query = "#{commit_hash}+type:pr+repo:#{repo}"
say "Searching github pull requests for #{commit_hash}"
github_api_request "GET", "search/issues?q=#{query}"
end | [
"def pull_requests_for_commit(token, repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n response = RestClient::Request.new(:url => \"https://api.github.com/search/issues?q=#{query}\", :method => \"GET\", :headers =>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the PRs for a given branch | def pull_requests_for_branch(repo, branch)
head_name = "#{repo.split('/').first}:#{branch}"
github_api_request "GET", "repos/#{repo}/pulls?head=#{head_name}"
end | [
"def current_pr_for_branch(repo, branch)\n prs = pull_requests_for_branch(repo, branch)\n raise \"Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed\" if prs.size > 1\n prs.first\n end",
"def fetch_commits(branch) \n puts \"Getting commits of ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the current PR for a given branch | def current_pr_for_branch(repo, branch)
prs = pull_requests_for_branch(repo, branch)
raise "Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed" if prs.size > 1
prs.first
end | [
"def current_pr\n current_branch[%r{\\Apull/(\\d+)\\z}, 1]\nend",
"def fetch_branch\n pr_id = @pullreq_ids.values.index(@number)\n branch_name = @github_connection.get_branch_name(pr_id, @repo)\n branch_name.split('_').last.to_i\n end",
"def current_branch\n repo.branches.find(&:head... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
post a comment on an issue | def comment_on_issue(issue_url, comment_body)
github_api_request 'POST', "#{issue_url}/comments", { :body => comment_body }.to_json
end | [
"def push_comment(user, username, projectname, issue_no, comment)\n @github = github_init( user, username, projectname)\n @new_comment = @github.issues.comments.create :repo_name=> projectname, :user_name => username , :issue_id => issue_no ,:body => comment\n end",
"def add_comment_to_issue(issue, author... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a single dash before and after each odd digit. There is one exception: don't start or end the string with a dash. You may wish to use the `%` modulo operation; you can see if a number is even if it has zero remainder when divided by two. Difficulty: medium. | def dasherize_number(num)
num_string = num.to_s
idx = 0
while idx < num_string.length-1
if num_string[idx].to_i % 2 != 0
num_string.insert(idx+1, "-")
end
idx += 1
end
while num_string[idx] != "-"
if num_string[idx2].to_i % 2 == 0 && num_string[idx2+1] != "-"
puts "#{num_string[idx2]} qualifies"
... | [
"def dasherize_number(num)\n string = \"\"\n lastOdd = false\n num.to_s.chars.each_with_index do |n, i|\n if n.to_i % 2 != 0\n if i != 0 && !lastOdd\n string << '-'\n end\n string << n\n if i != num.to_s.length - 1\n string << '-'\n end\n lastOdd = true\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a request to Airship's API | def send_request(method: required('method'), path: nil, url: nil, body: nil,
content_type: nil, encoding: nil, auth_type: :basic)
req_type = case method
when 'GET'
:get
when 'POST'
:post
when 'PUT'
:put
when 'DELE... | [
"def make_request!\n # AIzaSyCqXbIkEF3_rYe6UWlxve1onhlVsVYFW4Y\n\n uri = URI.parse(\"https://www.googleapis.com/qpxExpress/v1/trips/search?key=AIzaSyCqXbIkEF3_rYe6UWlxve1onhlVsVYFW4Y\")\n\n body = {\n \"request\": {\n \"passengers\": {\n \"adultCount\": 1\n },\n \"slice\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Push Object | def create_push
Push::Push.new(self)
end | [
"def push\n end",
"def create_push\n PushNotification.push_to_user!(uid: @spot.priest.id, payload: push_payload)\n end",
"def createPushDefinition()\n\t\t\treturn PushDefinition.new(self)\n\t\tend",
"def pushes\n self[\"$push\"] ||= {}\n end",
"def queue_push(object)\n queue_item... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Scheduled Push Object | def create_scheduled_push
Push::ScheduledPush.new(self)
end | [
"def create_push\n PushNotification.push_to_user!(uid: @spot.priest.id, payload: push_payload)\n end",
"def create_push\n Push::Push.new(self)\n end",
"def get_push_job\n job = RhnLivePushJob.create!(:errata => @rhn_cdn_advisory, :pushed_by => releng_user)\n job.pub_options['push_metadata'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /snifs GET /snifs.json | def index
@snifs = Snif.all
end | [
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @sinifs = Sinif.all\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /snifs POST /snifs.json | def create
@snif = Snif.new(snif_params)
respond_to do |format|
if @snif.save
format.html { redirect_to @snif, notice: 'Snif was successfully created.' }
format.json { render :show, status: :created, location: @snif }
else
format.html { render :new }
format.json { re... | [
"def create\n @snf = Snf.new(snf_params)\n\n respond_to do |format|\n if @snf.save\n format.html { redirect_to @snf, notice: 'Snf was successfully created.' }\n format.json { render :show, status: :created, location: @snf }\n else\n format.html { render :new }\n format.js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /snifs/1 PATCH/PUT /snifs/1.json | def update
respond_to do |format|
if @snif.update(snif_params)
format.html { redirect_to @snif, notice: 'Snif was successfully updated.' }
format.json { render :show, status: :ok, location: @snif }
else
format.html { render :edit }
format.json { render json: @snif.errors,... | [
"def update\n respond_to do |format|\n if @snf.update(snf_params)\n format.html { redirect_to @snf, notice: 'Snf was successfully updated.' }\n format.json { render :show, status: :ok, location: @snf }\n else\n format.html { render :edit }\n format.json { render json: @snf.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /snifs/1 DELETE /snifs/1.json | def destroy
@snif.destroy
respond_to do |format|
format.html { redirect_to snifs_url, notice: 'Snif was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @sn = Sn.find(params[:id])\n @sn.destroy\n\n respond_to do |format|\n format.html { redirect_to sns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sifi = Si... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays +message+ inside a formatted header. | def header(message)
puts "\n"
puts '+---'
puts "| #{message}"
puts '+---'
end | [
"def header(message = nil)\n raise ArgumentError, 'No message passed to header.' unless message\n puts \"\\n\"\n puts '+---'\n puts \"| #{message}\"\n puts '+---'\nend",
"def header( msg )\n\t\tmsg.chomp!\n\t\t$stderr.puts ansi_code( 'bold', 'white', 'on_blue' ) + msg + ansi_code( 'reset' )\n\t\t$stderr.flus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When we display the animal using puts or print, the to_s method is called to pretty print an Animal | def to_s
p "Name :#{@animal_name}. Age: #{@age}. Gender: #{@gender}. Species: #{@species}. Most loved toy: #{toys.join("\n ")}. "
end | [
"def to_s\n puts \"Name: #{name}\"\n puts \"Age: #{age}\"\n puts \"Gender: #{gender}\"\n puts \"Species: #{species}\"\n puts \"Toys: #{toys}\"\n end",
"def to_s( opts = nil )\n\t\t\tpretty( opts )\n\t\tend",
"def pretty_inspect\n self.inspect\n end",
"def to_s\n #Build the s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
animate confirm password field in (slide stuff right) or out (slide stuff left) | def animate_signup(direction)
direction = (direction == :in ? :right : :left)
@in_signup_view = !@in_signup_view
[@login_button, @confirm_password_field, @confirm_password_underline].each do |moving_part|
moving_part.slide(direction, Device.screen.width)
end
end | [
"def ask_password\n @display.echo_off\n print 'Enter password (6 - 20 characters): ', false, false\n @state = :new_password\n end",
"def modal_confirm_password_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-confirmpwdfi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates if endpoint does not exist | def isEndpointPresent?
endpoint = Endpoint.find_by_id(params[:id])
if endpoint.nil?
render json: { errors:[
{
"code": "not_found",
"detail": "Requested Endpoint with ID `#{params[:id]}` does not exist"
}
]
} , status: :not_found
... | [
"def validate_endpoint(endpoint)\n begin\n Chef::Log.debug endpoint.get_endpoints\n rescue\n Chef::Log.error \"Unable to connect to the kubernetes api at #{endpoint.api_endpoint}\"\n end\n\n endpoint\n end",
"def endpoint_present?\n endpoint = Endpoint.find_by(user_id: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /api/v1/initiative_fields GET /api/v1/initiative_fields.json | def index
@api_v1_initiative_fields = Api::V1::InitiativeField.all
end | [
"def create\n @api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params)\n\n respond_to do |format|\n if @api_v1_initiative_field.save\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully created.' }\n format.json { re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /api/v1/initiative_fields POST /api/v1/initiative_fields.json | def create
@api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params)
respond_to do |format|
if @api_v1_initiative_field.save
format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully created.' }
format.json { render :show,... | [
"def index\n @api_v1_initiative_fields = Api::V1::InitiativeField.all\n end",
"def create\n @initiative = Initiative.new(initiative_params)\n\n if @initiative.save\n render json: @initiative, status: :created,\n location: api_v1_initiative_path(@initiative)\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /api/v1/initiative_fields/1 PATCH/PUT /api/v1/initiative_fields/1.json | def update
respond_to do |format|
if @api_v1_initiative_field.update(api_v1_initiative_field_params)
format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }
format.json { render :show, status: :ok, location: @api_v1_initiative_field }
el... | [
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /api/v1/initiative_fields/1 DELETE /api/v1/initiative_fields/1.json | def destroy
@api_v1_initiative_field.destroy
respond_to do |format|
format.html { redirect_to api_v1_initiative_fields_url, notice: 'Initiative field was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @api_v1_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_fields_url, notice: 'Field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.htm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the next word in the text | def next_word
return if @next > @words.length
word = @words[@next]
@next += 1
return word
end | [
"def next_word\n return unless md = get.match(FORWARD_WORD, cursor)\n self.cursor = md.offset(0).last\n end",
"def search_next_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.search_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECAS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /vendedors/actualizar_objetivos Metodo para crear nuevos Objetivos Mensuales de un Vendedor o editar su valor (Ajax request) Parametros: Mes, Anio, Vendedor, cantidad para cada Objetivo Mensual | def actualizar_objetivos
mes = params[:mes]
anio = params[:anio]
@vendedor = Vendedor.find(params[:vendedor][:id])
cantidad_op = params[:oportunidades]
cantidad_pm = params[:pruebas_manejo]
cantidad_v = params[:ventas]
cantidad_f = params[:financiaciones]
cantidad_c = params[:calidad... | [
"def create\n @objetivo = Objetivo.new(objetivo_params)\n @objetivo.mision= @mision\n\n respond_to do |format|\n if @objetivo.save\n format.html { redirect_to [@mision, @objetivo], notice: 'Objetivo was successfully created.' }\n format.json { render :show, status: :created, location: [@... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /home_vendedor Metodo que renderiza el layout del home para el usuario con rol vendedor y punto_venta Si el usuario actual tiene el rol vendedor se muestran los datos referidos a su carga y la posibilidad de abrir un modal para ingresar la carga diaria Si el usuario actual tiene el rol punto_venta se muestra un des... | def home
@sidebar = false
@footer = false
@carga_diarium = CargaDiarium.new
@tipos_objetivos = TipoObjetivo.where(tipo: 'KPI')
if current_user.has_role? :vendedor and !(current_user.has_role? :punto_venta)
@vendedor = current_user.persona.vendedors.first
else
if (current_user.has_ro... | [
"def index\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n \n if params[:accion].nil? || params[:accion] == \"consultar\"\n actividad = params[:actividad_id]\n if params[:seccion_id].nil?\n seccion = \"\"\n else\n seccion = params[:seccion_id]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /objetivos_y_carga_diaria Metodo para mostrar el valor de los Objetivos Mensuales asignados a un Vendedor en cada mes de cada anio (Ajax request) Parametros: Mes, anio, vendedor | def objetivos_y_carga_diaria
mes = params[:mes].to_i
anio = params[:anio].to_i
vendedor_id = params[:vendedor_id].to_i
vendedor = Vendedor.find(vendedor_id)
totales = Hash.new
total_ob_op = ObjetivoMensual.total_objetivos_punto_venta(anio, mes, vendedor, 7)
total_ob_pm = ObjetivoMensual.tota... | [
"def duracion\n prob = \"\"\n if params[:fechainicio_localizada] &&\n params[:fechacierre_localizada]\n fini = ::Msip::FormatoFechaHelper.fecha_local_estandar(\n params[:fechainicio_localizada],\n )\n fini = Date.strptime(fin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Summe 3 letzten ZugKomponente bestimmen TODO | def letzte_komponente
end | [
"def zuruecksetzen()\n end",
"def sichtbar_machen()\n end",
"def unsichtbar_machen()\n end",
"def zeichnen()\n if sichtbar?() \n Leinwand.gib_einzige_instanz().zeichne_kreis(self)\n end\n end",
"def zeichnen()\n if (sichtbar?)\n Leinwand.gib_einzige_instanz().zeichne_rechteck(self) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate that a context and target method have been supplied. | def validate_settings
raise "method test has no module or class context" unless @context
raise "#{@target} is not a method name" unless Symbol === @target
end | [
"def method_valid?(method_name)\n # validate method, see if we support given method in current tasks\n (current_context_task_names() + ['help']).include?(method_name)\n end",
"def assert_method(*args)\n safe_assertion do\n MethodRules.new.allow(*args).validate(request.method)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run test in the context of this case. Notice that run for TestMethod is more complex than a general TestCase. This is to ensure that the target method is invoked during the course of the test. | def run(test, &block)
target = self.target
raise_pending(test.procedure) unless test.procedure
begin
target_class.class_eval do
alias_method "_lemon_#{target}", target
define_method(target) do |*a,&b|
test.tested = true
__send__("_lemon_#{target}",... | [
"def run\n Overseer.current_test = self\n start_time = Time.now\n suite.before.call if suite.before\n begin\n @code.call\n rescue Exception => e\n errors << e\n ensure\n begin\n suite.after.call if suite.after\n rescue Exception => e\n erro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /prospectives/1 GET /prospectives/1.json | def show
@prospective = Prospective.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @prospective }
end
end | [
"def show\n @prospect = Prospect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prospect }\n end\n end",
"def show\n @prospecto = Prospecto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the status of an Order GET /api/v1/orders/status | def status
if params[:reference]
@orders = Order.where(["reference = ?", params[:reference]])
elsif params[:client_name]
@orders = Order.where(["client_name = ?", params[:client_name].downcase])
@orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)
... | [
"def get_order_status(id)\n @client.raw('get', \"/ecommerce/order-statuses/#{id}\")\n end",
"def get_status(order_id)\n send_request('GetStatus', order_id: order_id)\n end",
"def order_status(id)\n authenticated_post(\"order/status\", params: {order_id: id.to_i}).body\n end",
"def order_st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List the Orders of a Purchase Channel GET /api/v1/orders/pipeline | def pipeline
if params[:purchase_channel] && params[:status]
@orders = Order.where(["purchase_channel = ? AND status = ?", params[:purchase_channel].downcase, params[:status].downcase])
@orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)
render json: @orde... | [
"def list_orders()\n get_request('listOrders?'+get_url_parameters({})).body\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def list_orders(params = nil, headers = nil)\n get(\"/api/v1/orders\", params, headers)\n end",
"def g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A simple financial report GET /api/v1/orders/financialReport | def financialReport
result = []
channels = ActiveRecord::Base.connection.execute("select distinct purchase_channel from orders;")
channels.each do |channel|
orders_per_channel = Order.where(["purchase_channel = ?", channel['purchase_channel']])
sum_total_value = orders_pe... | [
"def index\n @financial_reports = FinancialReport.all\n end",
"def get_financials\n response = RestClient.get(\"https://api.iextrading.com/1.0/stock/#{self.ticker}/financials\")\n JSON.parse(response.body)\n end",
"def index\n @financial_reports = @company.financial_reports.annual.recent.includ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /documentocategorias/1 GET /documentocategorias/1.xml | def show
@documentocategoria = Documentocategoria.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @documentocategoria }
end
end | [
"def new\n @documentocategoria = Documentocategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentocategoria }\n end\n end",
"def index\n @doc_categories = DocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /documentocategorias/new GET /documentocategorias/new.xml | def new
@documentocategoria = Documentocategoria.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @documentocategoria }
end
end | [
"def create\n @documentocategoria = Documentocategoria.new(params[:documentocategoria])\n\n respond_to do |format|\n if @documentocategoria.save\n format.html { redirect_to(@documentocategoria, :notice => 'Documentocategoria was successfully created.') }\n format.xml { render :xml => @docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /documentocategorias POST /documentocategorias.xml | def create
@documentocategoria = Documentocategoria.new(params[:documentocategoria])
respond_to do |format|
if @documentocategoria.save
format.html { redirect_to(@documentocategoria, :notice => 'Documentocategoria was successfully created.') }
format.xml { render :xml => @documentocatego... | [
"def new\n @documentocategoria = Documentocategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentocategoria }\n end\n end",
"def create\n @document_category = DocumentCategory.new(params[:document_category])\n\n respond_to do |format... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /documentocategorias/1 PUT /documentocategorias/1.xml | def update
@documentocategoria = Documentocategoria.find(params[:id])
respond_to do |format|
if @documentocategoria.update_attributes(params[:documentocategoria])
format.html { redirect_to(@documentocategoria, :notice => 'Documentocategoria was successfully updated.') }
format.xml { head... | [
"def create\n @documentocategoria = Documentocategoria.new(params[:documentocategoria])\n\n respond_to do |format|\n if @documentocategoria.save\n format.html { redirect_to(@documentocategoria, :notice => 'Documentocategoria was successfully created.') }\n format.xml { render :xml => @docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /documentocategorias/1 DELETE /documentocategorias/1.xml | def destroy
@documentocategoria = Documentocategoria.find(params[:id])
@documentocategoria.destroy
respond_to do |format|
format.html { redirect_to(documentocategorias_url) }
format.xml { head :ok }
end
end | [
"def destroy\n @doc_category = DocCategory.find(params[:id])\n @doc_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(doc_categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document_category = DocumentCategory.find(params[:id])\n @document... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return our textilized 'body_html' field or 'html' field, depending on the 'to_html' field | def template_text
self.to_html ? self.body_html : self.body
end | [
"def html\n process_message_body if !@html\n @html\n end",
"def cleaned_up_text_body(format = false)\n # http://stackoverflow.com/a/15098459\n caller = caller_locations(1,1)[0].label\n if caller == 'receive_issue' || caller == 'receive_issue_reply'\n html_body\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds token to tree's children | def add_tree token
@tree_stack.last.children << NaryTree.new(token)
end | [
"def glue_child( token_child )\n if @tree.size > 0\n token_child.prev = @tree.last\n else\n token_child.prev = false\n end\n\n if !token_child.glue\n token_child.parent = self\n @tree << token_child\n end\n\n true\n end",
"def add_children(char)\n @childrens[char] = Node.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /enregistrements/1 GET /enregistrements/1.json | def show
@enregistrement = Enregistrement.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @enregistrement }
end
end | [
"def index\n @registrants = Registrant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registrants }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @registrations = @user.registrations\n\n respond_to do |format|\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /enregistrements/new GET /enregistrements/new.json | def new
@enregistrement = Enregistrement.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @enregistrement }
end
end | [
"def new\n @registro = Registro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro }\n end\n end",
"def new\n @registro = Registro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @regist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /enregistrements POST /enregistrements.json | def create
@enregistrement = Enregistrement.new(params[:enregistrement])
respond_to do |format|
if @enregistrement.save
format.html { redirect_to @enregistrement, notice: 'Enregistrement was successfully created.' }
format.json { render json: @enregistrement, status: :created, location: @... | [
"def create\n @registros_grupos_reflexivo = RegistrosGruposReflexivo.new(registros_grupos_reflexivo_params)\n respond_to do |format|\n if @registros_grupos_reflexivo.save\n format.html { redirect_to @registros_grupos_reflexivo, notice: 'Grupo reflexivo was successfully created.' }\n format.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /enregistrements/1 PUT /enregistrements/1.json | def update
@enregistrement = Enregistrement.find(params[:id])
respond_to do |format|
if @enregistrement.update_attributes(params[:enregistrement])
format.html { redirect_to @enregistrement, notice: 'Enregistrement was successfully updated.' }
format.json { head :no_content }
else
... | [
"def update\n respond_to do |format|\n if @regist_1.update(regist_1_params)\n format.html { redirect_to @regist_1, notice: 'Regist 1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @regist_1 }\n else\n format.html { render :edit }\n format.j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /enregistrements/1 DELETE /enregistrements/1.json | def destroy
@enregistrement = Enregistrement.find(params[:id])
@enregistrement.destroy
respond_to do |format|
format.html { redirect_to enregistrements_url }
format.json { head :no_content }
end
end | [
"def destroy\n @regist_1.destroy\n respond_to do |format|\n format.html { redirect_to regist_1s_url, notice: 'Regist 1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registre.destroy\n respond_to do |format|\n format.html { redirect_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic profile Given a panelName and the panelInfoName, it reads the table for a generic info section | def viewInfoPanel(panelName, panelInfoName = nil)
panel = @explicitWait.until{@driver.find_element(:class, panelName)}
name = panel.find_element(:css, "h1")
hTable = Hash.new
hTable["Name"] = name.text
puts name.text
if (panelInfoName != nil)
infoPanel = panel.find_element(:class, panelInfoName)
... | [
"def alert_profile_get_info(alert_profile)\n @record = @alert_profile = alert_profile\n aa = @alert_profile.get_assigned_tos\n @alert_profile_tag = Classification.find(aa[:tags].first.first.parent_id) unless aa[:tags].empty?\n @alert_profile_alerts = @alert_profile.miq_alerts.sort_by { |a| a.description... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
p bacon_upvote?('bruno mars') p bacon_upvote?('bacon') | def food_upvote?(topic)
topic == "food"
end | [
"def calculate_upvotes(story)\n upvotes = 1\n if story.downcase.include?('cat') && story.downcase.include?('bacon')\n upvotes *= 10\n elsif story.downcase.include?('cat') || story.downcase.include?('bacon')\n upvotes *= 5\n end\n upvotes\nend",
"def fruitbearing?\n if fruitbearing == true\n \"y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A helper function to build an api url for either a specific time or the latest available rates | def api_url time=nil
today = Time.now
[
"#{config.protocol}:/",
API_URL,
time && (time.year != today.year || time.yday != today.yday) ? "historical/#{time.strftime("%Y-%m-%d")}.json" : "latest.json"
].join('/') + "?app_id=#{config.app_id}"
e... | [
"def api_url(time=nil)\n today = Time.now\n [API_URL, time && (time.year != today.year || time.yday != today.yday) ? \"historical/#{time.strftime(\"%Y-%m-%d\")}.json\" : 'latest.json'].join('/')\n end",
"def api_url time=nil\n today = Time.now\n [\n \"#{conf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /port_models GET /port_models.json | def index
@port_models = PortModel.all
end | [
"def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end",
"def get_models\n\t\tam = ErAppModel.where(er_user_app_id: @ua.id)\n\t\t@status = 200\n\t\t@res = am \n\t\trender json: @res , status: @status\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /port_models POST /port_models.json | def create
@port_model = PortModel.new(port_model_params)
respond_to do |format|
if @port_model.save
format.html { redirect_to @port_model, notice: 'Port model was successfully created.' }
format.json { render action: 'show', status: :created, location: @port_model }
else
fo... | [
"def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end",
"def add_bridge_model(body={}, headers=default_headers)\n info(\"Adding the \\\"#{body['name']}\\\" Brid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /port_models/1 PATCH/PUT /port_models/1.json | def update
respond_to do |format|
if @port_model.update(port_model_params)
format.html { redirect_to @port_model, notice: 'Port model was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @port_... | [
"def update(model_name, model_id, data, options = {})\n url = get_brpm_url(model_name, model_id)\n options[\"data\"] = data\n result = Rest.put(url, options)\n result\n end",
"def update(model_name, model_id, data, options = {})\n url = rest_url(model_name, model_id)\n options[\"data\"] = data\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /port_models/1 DELETE /port_models/1.json | def destroy
@port_model.destroy
respond_to do |format|
format.html { redirect_to port_models_url }
format.json { head :no_content }
end
end | [
"def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n resp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The directory of the application ./app for 'app' architecture ./apps/APPLICATION_NAME for 'container' | def application_path
if environment.container?
applications_path.join(application_name_as_snake_case)
else
Pathname.new('app')
end
end | [
"def app_path\n Pathname.new(Dir.pwd)\n end",
"def app_root\n Pathname.new(Dir.pwd)\n end",
"def deployed_app_root\n @domain_apps_dir + APP_NAME\n end",
"def app_dir\n if name.nil?\n File.dirname(app_spec.loaded_from)\n else\n installed_spec.gem_dir\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display the automaton by using dot and ImageMagick "display", UNIXcentric | def x_visualize
require 'open3'
Open3.popen3('dot -T svg | display') do |i,o,_|
i.write to_dot
i.close
end
end | [
"def display_dot\n puts to_dot\n system \"echo '#{to_dot}' | twopi -Tps -Groot=ROOT -Goverlap=false> /tmp/dotfile.ps; gv /tmp/dotfile.ps\"\n end",
"def to_dot(display, io)\n return unless display.displayed?(self)\n\n graphics = display.graphics[self]\n bounding_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /admin/pages/1 DELETE /admin/pages/1.xml | def destroy
@page.destroy
respond_to do |format|
format.html { redirect_to(admin_pages_url) }
format.xml { head :ok }
end
website.add_log(user: current_user, action: "Deleted page: #{@page.title}")
end | [
"def destroy\n @pages = Page.find(params[:id])\n @pages.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_pages_url) }\n format.xml { head :ok }\n end\n end",
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def destroy\n @page = @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=== Synopsis Basic Middleware usage: use Footprint::Middleware Advanced Middleware usage: use Footprint::Middleware do set Logger, STDOUT end Clazz init: Footprint::Middleware.new app => === Args +app+:: Rack application instance. +block+:: Optional block, used to instance_eval (defaults to nil) === Description Initial... | def initialize(app, &block)
@app = app
set Footprint::Log::Basic, STDOUT
@app.class.send(:define_method, :logger,
Proc.new do
@env[:footprint_logger]
end)
self.instance_eval &block if block
end | [
"def middleware(&block)\n @@middleware << block\n end",
"def app(&block) # :yields:\n @app ||= Console::Application.new\n if block\n DslProxy.exec(@app, &block)\n end\n @app\n end",
"def use(middleware, *args, &block)\n @rack_middleware << [middleware, args, block]\n en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=== Synopsis Footprint:Middleware.call env => env === Args +env+:: Rack request environment. === Return +env+ returned always. === Description The current instance of the logger is set on env[:footprint_logger] and the app is called further with the enriched env. | def call(env)
env[:footprint_logger] = @logger
@app.call env
end | [
"def call(env)\n res = nil\n\n call_next = catch(:next) do\n env[@mid.opts[:middleware_env_var]] = true\n res = @mid.call(env)\n false\n end\n\n if call_next\n res = @app.call(env)\n\n if modified_headers = env.delete('roda.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=== Synopsis Basic usage: Footprint.Middleware.set Logger, STDOUT => logger === Args +clazz+:: Any Logger class that has the default Logger methods. +args+:: Optional array of arguments passed to the Logger class for initialize (defaults to nil) === Return +logger+ returned always. === Description Initialize the curren... | def set clazz, *args
@logger = clazz.send(:new, *args)
end | [
"def default_logger=(_arg0); end",
"def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end",
"def logger=(instance)\n @logger = instance\n end",
"def log_class(log_class)\n @logger_class = log_class\n end",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /guacs GET /guacs.json | def index
@guacs = Guac.all
end | [
"def index\n @cgus = Cgu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cgus }\n end\n end",
"def available_achievements\n render json: achievements\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { rende... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /guacs POST /guacs.json | def create
@guac = Guac.new(guac_params)
respond_to do |format|
if @guac.save
format.html { redirect_to @guac, notice: 'Guac was successfully created.' }
format.json { render :show, status: :created, location: @guac }
else
format.html { render :new }
format.json { re... | [
"def create\n @glucose = Glucose.new(glucose_params)\n @glucose.user = current_user unless @glucose.user_id\n\n if @glucose.save\n render json: @glucose, status: :created\n else\n render json: @glucose.errors, status: :unprocessable_entity\n end\n end",
"def create\n @uasg = Uasg.new(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /guacs/1 DELETE /guacs/1.json | def destroy
@guac.destroy
respond_to do |format|
format.html { redirect_to guacs_url, notice: 'Guac was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract from +data+ one item of +type+ | def process_data(type, data)
case type
when :boolean
MuseekBindings::BinUtils.unpack_boolean(data)
when :uint32
MuseekBindings::BinUtils.unpack_uint32(data)
when :uint64
MuseekBindings::BinUtils.unpack_uint64(data)
when :string
MuseekBindings::BinUtils.unpack_string(data)
... | [
"def pluck_sir_trevor_type(json, type) \n hash = JSON.parse(json)\n if hash.has_key?(\"data\")\n item = hash[\"data\"].select { |item| item[\"type\"] == type }\n item.first\n end\n end",
"def get_data(type)\n data = redis.get(redis_key(type))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /PicTimeLine/new To render the image/picture upload form, | def new
@pictimeline = PicTimeLine.find(:all).last || PicTimeLine.new
@pictimelines = PicTimeLine.find(:all)
render :action => :new
end | [
"def new\n @tl_image = TlImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tl_image }\n end\n end",
"def new\n @pic = Pic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pic }\n end\n en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.