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 |
|---|---|---|---|---|---|---|
If you have extra params to permit, append them to the sanitizer. | def configure_sign_up_params
devise_parameter_sanitizer.for(:sign_up) << :first_name << :time_zone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
your code goes here | def begins_with_r(array)
array.each do |item|
if item[0] != "r"
return false
end
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply\n\t\t\t\t\n\t\t\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run\n end",
"def run\n \n end",
"def run\n \n end",
"def run\n end",
"def custom; end"... | [
"0.6193367",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.61824477",
"0.6169166",
"0.6124124",
"0.6124124",
"0.6094903",
"0.60627353",
"0.60627353",
"0.5983734",
"0.5979919",
"0.5979919",
"0.5897549",
"0.58... | 0.0 | -1 |
required for jenkins.rb or if there is a specific operating system in the config file | def osdeps_operating_system= (os)
raise RuntimeError, "#{self.class} needs to overwrite osdeps_operating_system="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_os\n @os = 'linux'\n end",
"def determine_os\n @os = \"linux\"\n end",
"def define_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os... | [
"0.76287353",
"0.7624725",
"0.75106484",
"0.7510308",
"0.7281973",
"0.71560764",
"0.712657",
"0.712161",
"0.709931",
"0.7088915",
"0.70624113",
"0.70041203",
"0.69971764",
"0.69747746",
"0.6944253",
"0.6944253",
"0.6936614",
"0.6892279",
"0.6872699",
"0.6868679",
"0.68657625"... | 0.6410566 | 78 |
returns an array of moved packages | def moved_packages
raise RuntimeError, "#{self.class} needs to overwrite moved_packages"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_stow_packages(pkg_name, version)\n old_versions = []\n # Iterate over directories that match name & delimiter\n Dir.glob(\"#{stow_path}/#{pkg_name}#{pkg_delim}*\") do |pkg_path|\n old_versions << File.basename(pkg_path)\n end\n unless blank?(old_versions)\n # Remove t... | [
"0.6401251",
"0.6380225",
"0.61969227",
"0.61969227",
"0.60115737",
"0.60085106",
"0.6004341",
"0.59140617",
"0.5827262",
"0.578119",
"0.577118",
"0.5768516",
"0.5743934",
"0.5743934",
"0.5685128",
"0.566619",
"0.56653416",
"0.56485325",
"0.5611497",
"0.56106037",
"0.5593413"... | 0.66300446 | 0 |
returns an autoproj package | def package(package_name)
raise RuntimeError, "#{self.class} needs to overwrite package"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend",
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def package(name)\n Packaged.instance self , name\n end",
"def find_autobuild_package(name)\n ... | [
"0.61451054",
"0.56187046",
"0.5592368",
"0.5576653",
"0.55365396",
"0.5517337",
"0.5505303",
"0.5346553",
"0.531799",
"0.530357",
"0.5294981",
"0.5290473",
"0.5280691",
"0.5273758",
"0.5257737",
"0.5219944",
"0.5219944",
"0.52057517",
"0.517844",
"0.5165238",
"0.5139926",
... | 0.0 | -1 |
returns true if pkgname is an autoproj meta package | def is_metapackage?(package_name)
raise RuntimeError, "#{self.class} needs to overwrite is_metapackage?"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end",
"def check_pkg_info\n return false if options['package_url'].nil? ||\n options['pa... | [
"0.6996032",
"0.6752778",
"0.6543276",
"0.64913464",
"0.648392",
"0.64228475",
"0.6400011",
"0.63917285",
"0.63600683",
"0.6316691",
"0.62206054",
"0.6178006",
"0.61660355",
"0.6116554",
"0.60781336",
"0.6073104",
"0.6058404",
"0.6032428",
"0.5990635",
"0.5982702",
"0.5980618... | 0.69085354 | 1 |
returns true if pkgname is to be ignored | def ignored?(package_name)
raise RuntimeError, "#{self.class} needs to overwrite ignored?"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore?(pkg)\n ignores.include?(pkg)\n end",
"def excluded?(package_name)\n package_name = validate_package_name_argument(package_name)\n\n if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)\n true\n elsif automatic... | [
"0.79493904",
"0.7710564",
"0.7631905",
"0.7506304",
"0.68551064",
"0.6830192",
"0.67682546",
"0.669084",
"0.6644329",
"0.6630181",
"0.66282696",
"0.6599829",
"0.65976524",
"0.64821243",
"0.6436557",
"0.6399372",
"0.6324904",
"0.6306445",
"0.626626",
"0.6243097",
"0.6232151",... | 0.739589 | 4 |
returns a PackageInfo from an autobuild package | def pkginfo_from_pkg(package)
raise RuntimeError, "#{self.class} needs to overwrite pkginfo_from_pkg"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end",
"def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_h... | [
"0.6974867",
"0.6186185",
"0.61762625",
"0.61434776",
"0.60839415",
"0.5983987",
"0.59585327",
"0.5948931",
"0.5947118",
"0.5900597",
"0.58723295",
"0.5872231",
"0.5805028",
"0.5804485",
"0.57755363",
"0.5742375",
"0.5738531",
"0.5738173",
"0.5720814",
"0.570821",
"0.57020646... | 0.64490074 | 1 |
returns an autobuild package from a package_name | def package_by_name(package_name)
raise RuntimeError, "#{self.class} needs to overwrite package_by_name"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end",
"def package_from_name(package_name)\n return self if package_name == self.name\n local_deps.find { |pkg| pkg.name == package_name }\n end",
"def package(name)\n if name.respond_to? :cache_pa... | [
"0.78735316",
"0.7308889",
"0.71477664",
"0.70809656",
"0.7001573",
"0.6903826",
"0.67255795",
"0.66589457",
"0.65105104",
"0.6501024",
"0.6466158",
"0.6418093",
"0.64136064",
"0.63621414",
"0.6347435",
"0.62475765",
"0.6244994",
"0.6223059",
"0.62112516",
"0.6147004",
"0.614... | 0.6379971 | 13 |
Compute all required packages from a given selection including the dependencies The selection is a list of package names The order of the resulting package list is sorted accounting for interdependencies among packages | def all_required_rock_packages(selection)
raise RuntimeError, "#{self.class} needs to overwrite all_required_rock_packages"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirement... | [
"0.6707646",
"0.6639628",
"0.66147226",
"0.6594138",
"0.65925306",
"0.6562124",
"0.65571946",
"0.65217626",
"0.64250165",
"0.64008456",
"0.6386885",
"0.6386885",
"0.6360871",
"0.6334541",
"0.62993336",
"0.6253592",
"0.6204971",
"0.61883414",
"0.6152005",
"0.61326563",
"0.6081... | 0.59888774 | 27 |
Get all required packages that come with a given selection of packages including the dependencies of ruby gems This requires the current installation to be complete since `gem dependency ` has been selected to provide the information of ruby dependencies | def all_required_packages(selection, with_rock_release_prefix = false)
raise RuntimeError, "#{self.class} needs to overwrite all_required_packages"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end",
"def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end",
"def requires\n require_items.collect(&... | [
"0.77298677",
"0.72714794",
"0.7250696",
"0.7127303",
"0.71207535",
"0.7077105",
"0.704143",
"0.7013395",
"0.6951496",
"0.68665373",
"0.6862412",
"0.68473154",
"0.68436426",
"0.6808034",
"0.6795668",
"0.6795668",
"0.6768334",
"0.6701491",
"0.66967195",
"0.6682353",
"0.6672993... | 0.0 | -1 |
Sort by package set order can be used with any packages array of objects providing a name(), that is, works with both autobuild packages and PackageInfos returns a sorted array populated from elements of packages | def sort_by_package_sets(packages, pkg_set_order)
raise RuntimeError, "#{self.class} needs to overwrite sort_by_package_sets"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_obj\n [@name, @version, Gem::Platform.sort_priority(@new_platform)]\n end",
"def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end",
"def install_order(arr)\n pair... | [
"0.6782119",
"0.6602605",
"0.65122336",
"0.6475713",
"0.64148784",
"0.6245281",
"0.6208737",
"0.61648846",
"0.6159998",
"0.60986495",
"0.6079145",
"0.60552835",
"0.6026997",
"0.6000804",
"0.5999885",
"0.59287906",
"0.59285957",
"0.5894571",
"0.58802915",
"0.5862084",
"0.58477... | 0.7360846 | 0 |
def reindex_clients clients.each do |client| client.reindex end end | def full_name
"#{self.first_name} #{self.last_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reindex!\n find(:all).each { |r| r.update_index(true) }\n end",
"def update_index\n all.nodes.each do |n|\n n.reindex!\n end\n end",
"def index_clients\n @client = Client.all\n end",
"def reindex!\n self.index = {}\n data.each do |inventory_ob... | [
"0.7028745",
"0.6918333",
"0.66513234",
"0.6604942",
"0.65419173",
"0.65223897",
"0.6456471",
"0.64374185",
"0.64249134",
"0.6419627",
"0.63946193",
"0.6315845",
"0.62801456",
"0.6267823",
"0.6266808",
"0.62400717",
"0.6228445",
"0.61617994",
"0.61147803",
"0.6020933",
"0.600... | 0.0 | -1 |
Send accumulated events into Sensu's socket, unless environment variable PROM_DEBUG is set. | def dispatch(event)
if ENV.key?('PROM_DEBUG')
log.debug("PROM_DEBUG set, not dispatching event to Sensu: #{event}")
return
end
# :nocov:
begin
s = TCPSocket.open(@sensu_address, @sensu_port)
s.puts(JSON.generate(event))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_event( data )\n\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.send( data, 0, self.multicast_address, self.port )\n\n\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\tdata[ 0, bytes ] = ''\n\t\tend\n\tend",
"def send_all(event, data)\n\t\tEM.next_tick {\n\t\t\t@sockets.each do |s|\n\t\t\t... | [
"0.6201655",
"0.6187335",
"0.58082014",
"0.58043253",
"0.57672524",
"0.57657593",
"0.5738058",
"0.5669808",
"0.566178",
"0.5636381",
"0.55153537",
"0.547652",
"0.54764295",
"0.5443656",
"0.543746",
"0.54317653",
"0.53379047",
"0.53290755",
"0.53258747",
"0.53177416",
"0.52884... | 0.6672171 | 0 |
Read Sensu address and port from environment. | def read_env_address_and_port
@sensu_address = ENV['SENSU_SOCKET_ADDRESS'] \
if ENV.key?('SENSU_SOCKET_ADDRESS')
@sensu_port = ENV['SENSU_SOCKET_PORT'].to_i \
if ENV.key?('SENSU_SOCKET_PORT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port; config[:port]; end",
"def client_port\n host_settings['client_port']\nend",
"def myservices_environment_details_host\n ENV['ENV_DETAILS'].nil? ? 'esu2v871:9080' : ENV['ENV_DETAILS']\n end",
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def raw_host_with_port; end",
"def port\n ... | [
"0.64324284",
"0.61466354",
"0.6043715",
"0.58404446",
"0.57912207",
"0.5730329",
"0.5716782",
"0.57036644",
"0.5683595",
"0.5673407",
"0.56447554",
"0.5629297",
"0.56161684",
"0.55245",
"0.5521598",
"0.5466633",
"0.5466052",
"0.5459002",
"0.5448339",
"0.5447246",
"0.54236025... | 0.8677897 | 0 |
For Using the username instead of ID in the Link | def to_param
user_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name( user )\n link_to user[\"first_name\"][0..8], link( user[\"uid\"] ), :target => \"_blank\"\n end",
"def link_to_user(user)\r\n link_to user.name, :controller => 'account', :action => 'show', :id => user\r\n end",
"def link_to_user(user)\n user ? link_to(user, user) : 'anonymous'\n end",
... | [
"0.7391369",
"0.71526986",
"0.6984948",
"0.68989664",
"0.68768334",
"0.68523574",
"0.6834267",
"0.68306136",
"0.68264514",
"0.6779108",
"0.6779108",
"0.6765808",
"0.67620105",
"0.6705892",
"0.6701352",
"0.66920763",
"0.6646694",
"0.66326654",
"0.66293615",
"0.66263187",
"0.66... | 0.0 | -1 |
false otherwise. A palindrome reads the same forward and backward. For this exercise, case matters as does punctuation and spaces. | def palindrome?(string_or_array)
string_or_array == string_or_array.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindrome?\n formatted_word = @word.gsub(/[^a-z]/, \"\")\n formatted_word == formatted_word.reverse\n end",
"def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i ... | [
"0.8517853",
"0.8423482",
"0.8407959",
"0.8342055",
"0.833046",
"0.8328235",
"0.8316713",
"0.8308034",
"0.83056885",
"0.83041453",
"0.83016706",
"0.8295299",
"0.8279736",
"0.8277247",
"0.8272708",
"0.8271468",
"0.8257173",
"0.8254461",
"0.8243656",
"0.8239175",
"0.82341474",
... | 0.0 | -1 |
GET /globus_tokens or /globus_tokens.json | def index
@globus_tokens = GlobusToken.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n @api.get(\"#{Paths::TOKENS}\")\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def get_token\n get(TOKEN_URL)\n end",
"def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n form... | [
"0.6974814",
"0.6847502",
"0.6754333",
"0.6610012",
"0.65099204",
"0.6381121",
"0.63664776",
"0.63149947",
"0.62482715",
"0.6238951",
"0.6189851",
"0.61524683",
"0.61365527",
"0.6085065",
"0.60632163",
"0.60580367",
"0.6039212",
"0.602846",
"0.6002313",
"0.5984759",
"0.589406... | 0.70435613 | 0 |
GET /globus_tokens/1 or /globus_tokens/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n @api.get(\"#{Paths::TOKENS}\")\n end",
"def index\n @globus_tokens = GlobusToken.all\n end",
"def get_token\n get(TOKEN_URL)\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def fetch_token\n response = RestClient.get \"http... | [
"0.6720647",
"0.67008835",
"0.6578392",
"0.6571308",
"0.6406819",
"0.6325369",
"0.63135105",
"0.6199053",
"0.6193317",
"0.6141175",
"0.6098541",
"0.60184",
"0.6016757",
"0.60074246",
"0.5957491",
"0.5955521",
"0.5944566",
"0.5916635",
"0.59123546",
"0.5853207",
"0.5852234",
... | 0.0 | -1 |
POST /globus_tokens or /globus_tokens.json | def create
@globus_token = GlobusToken.new(globus_token_params)
respond_to do |format|
if @globus_token.save
format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully created." }
format.json { render :show, status: :created, location: @globus_token ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_token(token)\n puts(token.to_json)\n @api.post(\"#{Paths::TOKENS}\", :body => token)\n end",
"def globus_token_params\n params.require(:globus_token).permit(:access_token, :expires_in, :body)\n end",
"def token(request)\n end",
"def create\n @token = Token.new(params[:token])... | [
"0.6457726",
"0.6397135",
"0.61262566",
"0.6043799",
"0.5970899",
"0.59197044",
"0.58563757",
"0.5831155",
"0.5829455",
"0.5815487",
"0.5781872",
"0.5781479",
"0.5777564",
"0.5756895",
"0.5752412",
"0.5726105",
"0.5702234",
"0.5689025",
"0.5674404",
"0.5670639",
"0.5669772",
... | 0.704741 | 0 |
PATCH/PUT /globus_tokens/1 or /globus_tokens/1.json | def update
respond_to do |format|
if @globus_token.update(globus_token_params)
format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully updated." }
format.json { render :show, status: :ok, location: @globus_token }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end",
"def update_token(data, token)\n base_url = flutterwave_object.base_url \n response = put_request(\"#{base_url}/tokens/#{token}\", data.to_json)\n return response\n end",
"def update\n @token = @user... | [
"0.63651603",
"0.6165193",
"0.60930705",
"0.60487264",
"0.60411566",
"0.5932071",
"0.59099835",
"0.58823305",
"0.58146465",
"0.57176846",
"0.57176846",
"0.5706656",
"0.57002777",
"0.56871086",
"0.5608996",
"0.56061226",
"0.5539444",
"0.55339545",
"0.5511773",
"0.550958",
"0.5... | 0.7029462 | 0 |
DELETE /globus_tokens/1 or /globus_tokens/1.json | def destroy
@globus_token.destroy
respond_to do |format|
format.html { redirect_to globus_tokens_url, notice: "Globus token was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @token = @user.tokens.find(params[:id])\n @user.tokens.delete(@token)\n @user.save\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json ... | [
"0.650365",
"0.6490772",
"0.6458638",
"0.6444055",
"0.6345504",
"0.634459",
"0.6266924",
"0.6229879",
"0.6224773",
"0.622254",
"0.61804026",
"0.6173886",
"0.6163432",
"0.6146661",
"0.6139132",
"0.6138591",
"0.6114884",
"0.61093926",
"0.61044353",
"0.60984045",
"0.6088365",
... | 0.7025559 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_globus_token
@globus_token = GlobusToken.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def globus_token_params
params.require(:globus_token).permit(:access_token, :expires_in, :body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
use an array to hold the fib numbers once any given the fib number is greater than limit stop .select the even numbers in the array and then .reduce it to the sum | def sum_of_even_fibonaccis2(n)
fibs = []
nth = 0
fibs[nth] = fibonacci[nth]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_even_fibonaccis(limit)\n\n holder = [1,2]\n\n while ( holder[-1] + holder[-2] ) < limit\n holder << holder[-1] + holder[-2]\n end\n\n return holder.select { |n| n.even? }.reduce(:+)\n\nend",
"def sum_of_even_fibonaccis(limit)\n # Fibonacci sequence starts with 1,2\n holder = [1,2]\n\n # Addi... | [
"0.85775036",
"0.8469088",
"0.83304024",
"0.82275647",
"0.82227796",
"0.8209696",
"0.8179367",
"0.8148927",
"0.8043802",
"0.80355006",
"0.7938257",
"0.79273313",
"0.7880461",
"0.7850168",
"0.7790345",
"0.77817625",
"0.7743216",
"0.7688723",
"0.7624452",
"0.76101524",
"0.76066... | 0.0 | -1 |
Notice that Ruby reused the "42 object with id 85" when the value was the same. => a_outer is 42 with an id of: 85 before the block. => b_outer is forty two with an id of: 15592360 before the block. => c_outer is [42] with an id of: 15592160 before the block. => d_outer is 42 with an id of: 85 before the block. Notice ... | def fun_with_ids
a_outer = 42
b_outer = "forty two"
c_outer = [42]
d_outer = c_outer[0]
a_outer_id = a_outer.object_id
b_outer_id = b_outer.object_id
c_outer_id = c_outer.object_id
d_outer_id = d_outer.object_id
puts "a_outer is #{a_outer} with an id of: #{a_outer_id} before the block."
puts "b_ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n # a, b, c, d have unique ids\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an i... | [
"0.81934536",
"0.81677824",
"0.8165855",
"0.81595045",
"0.8132096",
"0.8007693",
"0.79665035",
"0.78485155",
"0.77069616",
"0.7555854",
"0.7553532",
"0.74872124",
"0.7213446",
"0.7139801",
"0.7138095",
"0.6308421",
"0.5554547",
"0.53211415",
"0.526074",
"0.5165782",
"0.494175... | 0.71995705 | 14 |
=> a_outer is 42 with an id of: 85 before the block. => b_outer is forty two with an id of: 22190320 before the block. => c_outer is [42] with an id of: 22190300 before the block. => d_outer is 42 with an id of: 85 before the block. => a_outer id was 85 before the method and is: 85 inside the method. => b_outer id was ... | def tricky_method(a_string_param, an_array_param)
a_string_param += "rutabaga"
an_array_param << "rutabaga"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fun_with_ids2\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # object_id of the literal 42\n b_outer_id = b_outer.object_id # object_id of the string \"forty two\"\n c_outer_id = c_outer.object_id # object_id of the arra... | [
"0.85584706",
"0.8490439",
"0.8487586",
"0.8486221",
"0.84691197",
"0.8432147",
"0.84219897",
"0.83987194",
"0.8285628",
"0.82119274",
"0.8198322",
"0.8198322",
"0.8159351",
"0.8132582",
"0.81028837",
"0.8030159",
"0.7863753",
"0.7202289",
"0.60042584",
"0.5388814",
"0.533111... | 0.0 | -1 |
=> My array looks like this now: ["pumpkins", "rutabaga"] The difference lies in what Ruby does when the program executes either a String+= operation or an Array<< operation. The string operation is reassignment and CREATES A NEW STRING OBJECT. The reference to this new object is placed in the internal variable of the ... | def tricky_method_two(a_string_param, an_array_param)
a_string_param.gsub!('pumpkins', 'rutabaga')
an_array_param = ['pumpkins', 'rutabaga']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_array(arr, str) # define a method with an array and a string\n new_array = arr << str # create a new array with the array and add the string\n \n p new_array\n \nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # string is mutated\n an_arra... | [
"0.7908559",
"0.7704699",
"0.7660736",
"0.7588562",
"0.7561635",
"0.7549969",
"0.75400543",
"0.74593014",
"0.74494094",
"0.74483365",
"0.7358352",
"0.7337991",
"0.7195996",
"0.7166476",
"0.7166476",
"0.7156666",
"0.7140999",
"0.71262753",
"0.71262753",
"0.71262753",
"0.712627... | 0.0 | -1 |
=> My array looks like this now: ["pumpkins"] With the Array= assignment, our literal ['pumpkins', 'rutabaga'] array IS a new object, and we are setting the internal array variable equal to that new array literal object. Question 5 How could the unnecessary duplication in this method be removed? | def color_valid(color)
if color == "blue" || color == "green"
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutliplied(array)\nend",
"def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n # On 1.8 using 'super' breaks rspec tests :(.\n ... | [
"0.65677756",
"0.6180427",
"0.6155015",
"0.6120978",
"0.6085581",
"0.6083343",
"0.6038983",
"0.5994126",
"0.5961035",
"0.59407234",
"0.5931063",
"0.59236866",
"0.59101677",
"0.591007",
"0.58873814",
"0.5873955",
"0.5860778",
"0.5839361",
"0.58370984",
"0.58239573",
"0.582251"... | 0.0 | -1 |
params: email(admin?), status(sort by status) | def show_orders
@user = User.find_by_sql ["select * from users where email = ? and users.status = 'admin'", params[:email]]
if @user.count != 0
@orders = UsersOrder.find_by_sql ["select users_orders.id, users.email, books.title, books.genre from users_orders
LEFT JOIN users ON users_orders.user_id =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end",
"def updateOrderStatusForMail(mail)\n #get order_id of order with customer_id with key and value\n puts \"mail: #{mail}\"\n # looking for id of user which belongs to mailaddress\n #1. get customer_id by key\n customer_id = ge... | [
"0.62934554",
"0.6282426",
"0.62715137",
"0.6218373",
"0.6168136",
"0.610882",
"0.604954",
"0.5983899",
"0.5975776",
"0.59377813",
"0.59319884",
"0.59175384",
"0.5917514",
"0.5866627",
"0.58661854",
"0.5851015",
"0.58489263",
"0.5835242",
"0.5832687",
"0.5830484",
"0.5799615"... | 0.55102336 | 50 |
before_action === before_filter (latter is not yet deprecated) Note: It seems Devise handles controller stuff too, so for the moment we don't need to put anything here. Additional methods should work, but stuff like new users and signing in is already handled by devise. | def journeys
journeys = Journey.where('owner = ? AND hidden IS NULL', current_user.id)
journeys.each do |j|
date = j.date
year = Integer("20" + date[4,2])
mon = date[2,2]
day = date[0,2]
#fix cases like 02 = 2nd
if mon[0] == "0"
mon = mon[1,1]
end
if day[0] == "0"
day = day[1,1]
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter; end",
"def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def before_action \n end",
"def before_filter\n if curren... | [
"0.71008986",
"0.68945825",
"0.6850403",
"0.6849251",
"0.66201884",
"0.65465033",
"0.6542085",
"0.64197195",
"0.6374917",
"0.63641566",
"0.63354844",
"0.6314023",
"0.62780416",
"0.62488604",
"0.6237925",
"0.6216489",
"0.6215897",
"0.6141002",
"0.60661536",
"0.6054977",
"0.604... | 0.0 | -1 |
Returns a date within the specified Range. The Range can be Date or String objects. Example: min = Date.parse('19661115') max = Date.parse('19900101') Random.date(min..max) => a Date between 11/15/1996 and 1/1/1990 Random.date('19661115'..'19900101') => a Date between 11/15/1996 and 1/1/1990 | def date_between(range)
min_date = range.min.is_a?(Date) ? range.min : Date.parse(range.min)
max_date = range.max.is_a?(Date) ? range.max : Date.parse(range.max)
diff = (max_date - min_date).to_i
min_date + rand(diff)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_between (min, max)\n Predicate.new(:date_between, { min: min, max: max}) do |o|\n o >= min && o <= max\n end\n end",
"def get_start_date\n \n start_of_date_range = \"2005/01/01\" #YYYY/MM/DD\n end_of_date_range = \"2013/01/01\" #YYYY/MM/DD\n #array of all dates in range\n date_r... | [
"0.7558425",
"0.69964004",
"0.68260676",
"0.654374",
"0.654374",
"0.6537975",
"0.64115566",
"0.63960046",
"0.6286771",
"0.6280883",
"0.6237664",
"0.62217826",
"0.6199435",
"0.61981755",
"0.61960113",
"0.61845976",
"0.6180567",
"0.61477375",
"0.6092768",
"0.60652393",
"0.60336... | 0.83546555 | 0 |
create time stamped controller spreadsheet open IE or attach to existing IE session populate the spreadsheet with web support page info | def setup(file)
base_xl = (file).gsub('/','\\').chomp('rb')<<'xls'
excel = xls_timestamp(base_xl) # timestamped instance of excel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xls_timestamp(g,s_s,type=nil,rs_name=nil)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<g.t_stamp<<(\".xls\"))\r\n new_ss1 = new_ss.sub(/Tools\\\\.+\\\\/,\"result\\\\#{rs_name}\\\\\")\r\n if (type == 'ind') # driver was launched independently\r\n xl = g.new_xls(s_s,1) #open base driver ss with new excel sessio... | [
"0.71807945",
"0.62956786",
"0.57601154",
"0.55738056",
"0.55680585",
"0.556534",
"0.5552689",
"0.5515283",
"0.5466408",
"0.5369513",
"0.5309698",
"0.52556497",
"0.52367264",
"0.5232422",
"0.5230916",
"0.52247417",
"0.5198066",
"0.51905847",
"0.51815975",
"0.5135624",
"0.5130... | 0.0 | -1 |
create time stamped spreadsheet using base name connect to excel and open base workbook create instance of excel (xl) returns a nested array containing spreadsheet and script parameters | def xls_timestamp(s_s)
new_ss = (s_s.chomp(".xls")<<'_'<<Time.now.to_a.reverse[5..9].to_s<<(".xls"))
new_ss1 = new_ss.sub('driver','result')
xl = new_xls(s_s,1) #open base driver ss with new excel session
ws = xl[2] # worksheet
param = Array.new # contains no elements. just used as a place holder here
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xls_timestamp(g,s_s,type=nil,rs_name=nil)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<g.t_stamp<<(\".xls\"))\r\n new_ss1 = new_ss.sub(/Tools\\\\.+\\\\/,\"result\\\\#{rs_name}\\\\\")\r\n if (type == 'ind') # driver was launched independently\r\n xl = g.new_xls(s_s,1) #open base driver ss with new excel sessio... | [
"0.72333217",
"0.659027",
"0.64731777",
"0.6371052",
"0.63653183",
"0.61595124",
"0.598233",
"0.595309",
"0.5830057",
"0.57880074",
"0.5725439",
"0.5711408",
"0.5710881",
"0.5648192",
"0.56302893",
"0.56298536",
"0.5623531",
"0.5619475",
"0.560483",
"0.5592175",
"0.5574443",
... | 0.7089995 | 1 |
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? Do not count spaces or hyphens. For example, 342 (three hundred and fortytwo) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in c... | def in_words(n)
# n / power of 10 = leftmost digit. n % power of 10 = remaining right digits.
words = []
case n
when 0..19
words.unshift(teen(n))
when 20..99
words.unshift(tens(n))
when 100..999
words.unshift(hundreds(n))
when 1000..999_999
words.unshift(thousands(n))
end
words.join... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_counts(limit)\r\n\t# Define word for cooresponding number\r\n\tnumbers_to_words = {one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,\r\n\t\t\t\t\t\t\t\t\t\t eleven: 11, twelve: 12, thirteen: 13, fourteen: 14, fifteen: 15, sixteen: 16, seventeen: 17, eighteen: 18,... | [
"0.7947011",
"0.75092626",
"0.73813367",
"0.7328837",
"0.71809787",
"0.7142965",
"0.71293914",
"0.7121574",
"0.70916915",
"0.6979878",
"0.69694245",
"0.6926115",
"0.69181764",
"0.69076127",
"0.6890779",
"0.68777716",
"0.6838594",
"0.6807651",
"0.677008",
"0.6765634",
"0.67611... | 0.6898518 | 14 |
GET /transactions GET /transactions.xml | def index
if @account.nil?
@transactions = Transaction.all_for_account_group(@user_options.account_group)
#@transactions = Transaction.find :all, :conditions => ['credit_account_id in (select id from accounts where user_id = ?) or debit_account_id in (select id from accounts where user_id = ?)', @current_user.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def transactions\n JSON.parse(response.body).fetch('transactions')\n end",
"def getTransactions\n\t\t\n\tend",
... | [
"0.73905945",
"0.72314066",
"0.7173773",
"0.716757",
"0.7102065",
"0.70384026",
"0.6965002",
"0.6963874",
"0.6867353",
"0.684523",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
"0.6787413",
... | 0.0 | -1 |
GET /transactions/1 GET /transactions/1.xml | def show
@transaction = Transaction.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @transaction }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def gettransaction(txid)\n request :gettransaction, txid\n end",
"def transactionById\n results = HTTParty.get(... | [
"0.7277148",
"0.7061151",
"0.7012656",
"0.6955532",
"0.6946227",
"0.68618894",
"0.67483944",
"0.67483944",
"0.6711464",
"0.66969895",
"0.66969895",
"0.66968",
"0.667444",
"0.66327834",
"0.6577201",
"0.6574795",
"0.6539068",
"0.6531864",
"0.6509683",
"0.65077263",
"0.65077263"... | 0.6872075 | 9 |
GET /transactions/new GET /transactions/new.xml | def new
@transaction = Transaction.new
ttype = params[:type]
@accounts = @user_options.account_group.accounts
if @accounts.empty?
flash[:notice] = "There are currently no accounts for this account group, please add one before adding a transaction."
redirect_to new_account_path
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end",
"def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render... | [
"0.75667083",
"0.75667083",
"0.74294776",
"0.7211684",
"0.7123651",
"0.7093603",
"0.7065037",
"0.70578",
"0.70578",
"0.70578",
"0.704697",
"0.7044736",
"0.69955313",
"0.69886124",
"0.6937086",
"0.6934986",
"0.69087356",
"0.68901473",
"0.6810056",
"0.68026495",
"0.6765861",
... | 0.0 | -1 |
POST /transactions POST /transactions.xml | def create
@transaction = Transaction.new(params[:transaction])
@account = Account.find(params[:account][:id]) rescue nil
respond_to do |format|
if @transaction.save
flash[:notice] = 'Transaction was successfully created.'
format.html { @account ? redirect_to(@account) : redirect_to(tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transactions_post(opts = {})\n data, _status_code, _headers = transactions_post_with_http_info(opts)\n data\n end",
"def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \... | [
"0.68204755",
"0.66878176",
"0.6660433",
"0.656415",
"0.6548269",
"0.6531916",
"0.6283601",
"0.62825763",
"0.6271808",
"0.6238136",
"0.62264633",
"0.6192456",
"0.61809224",
"0.6164703",
"0.6140859",
"0.6136344",
"0.6128709",
"0.6122263",
"0.61222124",
"0.6106335",
"0.6064601"... | 0.61193395 | 19 |
PUT /transactions/1 PUT /transactions/1.xml | def update
@transaction = Transaction.find(params[:id])
respond_to do |format|
if @transaction.update_attributes(params[:transaction])
flash[:notice] = 'Transaction was successfully updated.'
format.html { redirect_to(transactions_url) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n ... | [
"0.64828986",
"0.6292264",
"0.6239501",
"0.623432",
"0.6131653",
"0.612898",
"0.6115157",
"0.61059135",
"0.6091981",
"0.6091981",
"0.6042491",
"0.60194075",
"0.598672",
"0.5959936",
"0.5919602",
"0.5894126",
"0.583688",
"0.58356845",
"0.5809867",
"0.5809867",
"0.5809867",
"... | 0.6153272 | 4 |
DELETE /transactions/1 DELETE /transactions/1.xml | def destroy
@transaction = Transaction.find(params[:id])
@transaction.destroy
respond_to do |format|
format.html { redirect_to(transactions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ofx_transaction.destroy\n\n head :no_content\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to(account_transactions_path(@account)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @transaction.destroy\n res... | [
"0.69875777",
"0.6934482",
"0.6894745",
"0.68470645",
"0.68137884",
"0.6780348",
"0.6780348",
"0.67132914",
"0.6713033",
"0.6693506",
"0.6670941",
"0.6650875",
"0.66431856",
"0.6611998",
"0.65827644",
"0.65675336",
"0.65675336",
"0.65675336",
"0.65675336",
"0.65675336",
"0.65... | 0.7069271 | 6 |
== script TODO: no .rb ? | def files
@files.map do |file|
if File.directory?(file)
Dir[File.join(file, '**', '*.rb')]
else
file
end
end.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def script; end",
"def script; end",
"def script=(_arg0); end",
"def usage\n\tputs \"ruby unicorn2vba.rb unicornOutputFileHere\" \nend",
"def script\n\t\tputs \"You should extend script()\"\n\tend",
"def load_script(file); end",
"def dofile(file,output)\r\n # we are using the fact that the path will be... | [
"0.7934586",
"0.7934586",
"0.66269857",
"0.6520831",
"0.65111464",
"0.6409942",
"0.62592816",
"0.62491566",
"0.61505985",
"0.61476964",
"0.61097383",
"0.61018765",
"0.6058533",
"0.605386",
"0.6053611",
"0.60386145",
"0.60239977",
"0.60239977",
"0.5978081",
"0.5973817",
"0.594... | 0.0 | -1 |
Generates the line starting with coordinate [x,y]. It calls the block to find the next position in the line. It can be used to generate snake lines if necessary. | def get_line_coords(x, y)
line = [[x,y]]
loop do
next_x, next_y = yield x, y
@box[next_x] && @box[next_x][next_y] ? line << [next_x, next_y] : break
x, y = next_x, next_y
end
line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0) < 0 ? -1 : 1 ; dx ... | [
"0.66679555",
"0.66679555",
"0.66679555",
"0.6343223",
"0.6305485",
"0.6238916",
"0.61446404",
"0.6104875",
"0.60880655",
"0.60718155",
"0.60113436",
"0.6008214",
"0.5941751",
"0.58728486",
"0.5846988",
"0.58463895",
"0.58305645",
"0.58121204",
"0.5811376",
"0.5809389",
"0.57... | 0.69364685 | 0 |
Gets the string represented by an array of coordinates. | def get_line_str(coords)
line_str = ''
coords.each{|x,y| line_str << @box[x][y]}
line_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinates\n\t coordinate_array.map(&:to_s).join(\",\")\n\tend",
"def stringify_coords(coords) # :nodoc:\n coords.map { |c| c.join(',') }\n end",
"def build_coordinates_string(coordinates)\n COORDINATES.collect do |param|\n coordinates[param]\n end.join(',')\n end",... | [
"0.8205263",
"0.7376249",
"0.71039295",
"0.6951293",
"0.6951293",
"0.6805087",
"0.6591",
"0.6564189",
"0.6493919",
"0.64008385",
"0.63897854",
"0.63897854",
"0.6381906",
"0.6376638",
"0.6374646",
"0.6354835",
"0.6306641",
"0.6293592",
"0.6277354",
"0.62730765",
"0.62689066",
... | 0.65903986 | 7 |
Replaces ? and with \w? and \w in each word so that it could be used as the regex to support wildcard letter matching. | def regexize_words(words)
words.each {|word|word.gsub!(/(\?|\*)/, '\w\1')}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regexize_words(words)\n return '' if !words.is_a?(Array) && !words.is_a?(String)\n words = [words] if words.is_a?(String)\n words = words.reject{ |w| !w.is_a?(String) || w.empty? }\n return '' if words.empty?\n words = '(?:' + words.map{ |w| \"(?:\\\\b#{Regexp.escape(w.strip)}\\\\b)\" }.join('|') + ')'\nr... | [
"0.61842364",
"0.5702262",
"0.569581",
"0.5693622",
"0.5658185",
"0.56499785",
"0.5648537",
"0.5631904",
"0.5621399",
"0.5617135",
"0.55600446",
"0.55600446",
"0.55600446",
"0.5550716",
"0.55325",
"0.5494243",
"0.54898304",
"0.54491377",
"0.54424113",
"0.5403696",
"0.5402677"... | 0.74936295 | 0 |
set the partial path for the observer | def to_partial_path()
"activities/#{target_type.downcase}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_partial_path\n @partial_path = params[:partial_path]\n end",
"def virtual_path(path, partial)\n return path unless partial\n if index = path.rindex(\"/\")\n path.insert(index + 1, \"_\")\n else\n \"_#{path}\"\n end\n end",
"def to_partial_path\n self.cla... | [
"0.76868606",
"0.6377789",
"0.6299602",
"0.624957",
"0.6177119",
"0.61719507",
"0.61224407",
"0.61192596",
"0.600344",
"0.59989005",
"0.5990171",
"0.5989909",
"0.5945604",
"0.5945604",
"0.5945604",
"0.5932419",
"0.59257174",
"0.59257174",
"0.5912433",
"0.58887243",
"0.5888724... | 0.55626136 | 48 |
Close this LogDest object and release its resources. | def close()
unless fh.nil?
# redirected.each { |rd| rd.close }
fh.close if fhmustclose
self.fh = nil
self.fhmustclose = nil
# self.redirected = []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @log_file.close\n end",
"def close\n flush\n @log.close if @log.respond_to?(:close)\n @log = nil\n end",
"def closeLog()\n @logger.close() ;\n end",
"def close\n CoreServices::asl_close_output_file(@context, @dest.to_i) if @dest\n CoreServices::asl_... | [
"0.7508477",
"0.7358225",
"0.72758704",
"0.72338986",
"0.71806467",
"0.70572823",
"0.6941046",
"0.6842373",
"0.6480738",
"0.6410555",
"0.63509434",
"0.6326071",
"0.6288261",
"0.62496614",
"0.6247229",
"0.6053666",
"0.59991723",
"0.5865725",
"0.5847772",
"0.57936174",
"0.57820... | 0.5734517 | 21 |
Return the current indentation and folding state. | def get_state() [ indent_depth, folding_depth ] end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indentation\n \" \" * @indent_size * @indent_level\n end",
"def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end",
"def indentation; end",
"def indentation; end",
"def folding_open()\n self.folding_depth += 1\n fh.... | [
"0.6402327",
"0.63563186",
"0.63514775",
"0.63514775",
"0.6074035",
"0.60485125",
"0.60046595",
"0.5922211",
"0.58951724",
"0.588321",
"0.58592373",
"0.58267236",
"0.581454",
"0.581454",
"0.581454",
"0.581454",
"0.581454",
"0.5787228",
"0.5787228",
"0.5767474",
"0.57244825",
... | 0.83331215 | 0 |
Adjust the indentation depth. Returns the indent depth BEFORE it was adjusted. | def adj_indent(adjust = 1)
old, self.indent_depth = indent_depth, (indent_depth+adjust)
self.indent_str =
(indenting == true) ? (TAB * indent_depth) : EMPTY
old
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_depth\n if depth?\n self.update_attribute(:depth, level)\n end\n self\n end",
"def correct_indentation(node); end",
"def depth\n @cur_level - @base_level + 1\n end",
"def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend",
"def indent\n @__indent__ ||= 0\n ... | [
"0.6613887",
"0.6342347",
"0.63380563",
"0.63377494",
"0.6298908",
"0.6174548",
"0.6093325",
"0.6072794",
"0.6062438",
"0.60514194",
"0.6037487",
"0.595944",
"0.59318477",
"0.59120476",
"0.5905144",
"0.59051174",
"0.58327687",
"0.5808543",
"0.5755556",
"0.57297194",
"0.570172... | 0.6862533 | 0 |
Open a folding section. Returns the folding depth BEFORE folding_open(). | def folding_open()
self.folding_depth += 1
fh.puts FOLDING_OPEN if folding and not disabled
folding_depth - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state() [ indent_depth, folding_depth ] end",
"def directive_open( line )\n # return line && line.include?( get_tag(:open) )\n if line && line.include?( get_tag(:open) ) then\n # find index pointing _after_ :open tag\n # index = line.index( get_tag(:open) ) + get_tag(:open... | [
"0.58478016",
"0.5291918",
"0.51431423",
"0.5132863",
"0.48570243",
"0.4733624",
"0.4700011",
"0.4696231",
"0.45631802",
"0.45561734",
"0.45274258",
"0.45105538",
"0.45083556",
"0.44875476",
"0.44813398",
"0.44432002",
"0.44333038",
"0.4421071",
"0.4408131",
"0.43927804",
"0.... | 0.8112801 | 0 |
icon mappers, for easy swapping | def icon_overview
"dashboard"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_icon\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip\n end",
"def setup_icon\n return unless PONY::ERRNO::check_sequence(current_act)\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip... | [
"0.7031527",
"0.69432217",
"0.6405415",
"0.6287532",
"0.61090964",
"0.60784686",
"0.6056151",
"0.5946951",
"0.58527213",
"0.5848548",
"0.5811445",
"0.58067274",
"0.57905495",
"0.5754316",
"0.5741752",
"0.5738526",
"0.57192755",
"0.57178813",
"0.57107335",
"0.57077",
"0.569674... | 0.0 | -1 |
returns the options as a hash suitable for add_index | def opts #:nodoc:
opts = {}
opts[:name] = name unless name.nil?
opts[:unique] = unique unless unique.nil?
opts[:length] = lengths unless lengths.nil?
opts[:conditions] = conditions unless conditions.nil?
opts[:expression] = ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_options options\n defaults = {\n :type => 'string',\n :indexed => true,\n :stored => false,\n :multi_valued => false,\n :required => false,\n :copy_to => nil,\n }\n index_options = {}\n defaults.each_pair do |opt_name,default|\n if options.has_key?(opt_name)... | [
"0.80307937",
"0.7666228",
"0.7292694",
"0.7051041",
"0.6997789",
"0.68699014",
"0.6676805",
"0.6676805",
"0.6676805",
"0.6676805",
"0.6676805",
"0.6661608",
"0.66598046",
"0.66419864",
"0.66419864",
"0.6602343",
"0.6588176",
"0.6558151",
"0.64816123",
"0.64816123",
"0.648161... | 0.0 | -1 |
tests if the corresponding indexes would be the same | def ==(other)
return false if other.nil?
return false unless self.name == other.name
return false unless Array.wrap(self.columns).collect(&:to_s).sort == Array.wrap(other.columns).collect(&:to_s).sort
return false unless !!self.unique == !!other.unique
return false unle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def == other\n other.is_a?( Index ) &&\n columns == other.columns &&\n canonic_opts == other.canonic_opts\n end",
"def m... | [
"0.6535243",
"0.6439782",
"0.6421621",
"0.6421101",
"0.6419309",
"0.6395746",
"0.6280987",
"0.6253959",
"0.6253959",
"0.6240753",
"0.6206842",
"0.6154226",
"0.6130009",
"0.61225605",
"0.6117712",
"0.6106797",
"0.60610366",
"0.60610366",
"0.60396105",
"0.6035586",
"0.6031137",... | 0.0 | -1 |
get the split variation | def get_split_variation(test_name)
if !cookies["split_#{test_name}"].nil?
cookies["split_#{test_name}"]
elsif !session[:split_data].nil? && !session[:split_data][test_name].nil?
session[:split_data][test_name]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variation; self[:variation]; end",
"def variation\n params[:variation]\n end",
"def get_variance\n end",
"def get_variation()\n # Check if a value has been chosen and if not, choose 50 or 100.\n if @metadata[:variations] == nil\n @metadata[:variations] = [50, 100].choose\n end\n ... | [
"0.68746",
"0.66324335",
"0.64078057",
"0.63346726",
"0.62856925",
"0.6216766",
"0.61078775",
"0.60200906",
"0.60057515",
"0.58925223",
"0.58521014",
"0.5843746",
"0.5777128",
"0.5773862",
"0.5773862",
"0.5773862",
"0.57737213",
"0.5769706",
"0.5751537",
"0.5718574",
"0.57151... | 0.6555288 | 2 |
call this in your view before your google analytics tracking snippet | def track_split_with_google_analytics(test_name, slot_number = 1)
current_variation = get_split_variation(test_name)
unless current_variation.nil?
"<script type='text/javascript'> var _gaq = _gaq || []; _gaq.push(['_setCustomVar', #{slot_number}, 'split_#{test_name}', '#{current_variation}', 1]); </scrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_google_analytics_code\n if GoogleAnalytics.defer_load\n response.body.sub! '</body>', \"#{google_analytics_code}</body>\" if response.body.respond_to?(:sub!)\n else\n response.body.sub! '<body>', \"<body>#{google_analytics_code}\" if response.body.respond_to?(:sub!)\n end\n ... | [
"0.6749112",
"0.673698",
"0.65304804",
"0.64348984",
"0.6429848",
"0.6369825",
"0.63361144",
"0.62490946",
"0.62357044",
"0.6229336",
"0.61716264",
"0.6165106",
"0.6159343",
"0.61225307",
"0.6116578",
"0.61038226",
"0.6063814",
"0.60264933",
"0.60193616",
"0.588455",
"0.58807... | 0.5867646 | 21 |
def dummy end def new | def create
device = current_user.owned_devices.create!(params_attributes)
flash[:success] = 'Successfully created device'
render_response(
redirect_path: devices_path(category: :owned)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"d... | [
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.82791334",
"0.8053541",
"0.80312127",
"0.80312127",
"0.80312127",
"0.80312127",
"0.80312127",
"0.79798305",
"0.78253907",
"0.77555907",
"0.77555907",
"0.77256304",... | 0.0 | -1 |
if a method is not defined for a particular verb or action, this will be used. | def default?
SkinnyControllers.allow_by_default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend",
"def verb\n raise NotImplementedError.new('Must override')\n end",
"def method_for(action = nil, method = nil)\n @method_for ||= (superclass.respond_to?(:method_for) ?... | [
"0.7169289",
"0.70750165",
"0.7031495",
"0.7031495",
"0.7022983",
"0.69247615",
"0.6876946",
"0.6810048",
"0.6800431",
"0.67328423",
"0.6706123",
"0.6668814",
"0.6662713",
"0.6625469",
"0.6617817",
"0.6617541",
"0.6613471",
"0.6605119",
"0.6594967",
"0.65904886",
"0.6549335",... | 0.0 | -1 |
this should be used when checking access to a single object | def read?(o = object)
default?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_can_see!(obj)\n raise Discourse::InvalidAccess.new(\"Can't see #{obj}\") unless can_see?(obj)\n end",
"def is_object()\n res = super(context,self)\n return res\n end",
"def is_a?(obj)\n __getobj__.is_a?(obj)\n end",
"def check_object(obj)\n ret = json\n ... | [
"0.6473995",
"0.6278979",
"0.6241049",
"0.6238177",
"0.6224485",
"0.61738193",
"0.61229116",
"0.6102109",
"0.61004543",
"0.60738504",
"0.60701036",
"0.60701036",
"0.6039699",
"0.60381746",
"0.5985219",
"0.59801966",
"0.5967386",
"0.59404546",
"0.59279794",
"0.5912104",
"0.591... | 0.0 | -1 |
this should be used when checking access to multilpe objects it will call `read?` on each object of the array if the operation used a scope to find records from an association, then `authorized_via_parent` could be true, in which case, the loop would be skipped. TODO: think of a way to override the authorized_via_paren... | def read_all?
return true if authorized_via_parent
# This is expensive, so try to avoid it
# TODO: look in to creating a cache for
# these look ups that's invalidated upon
# object save
accessible = object.map { |ea| read?(ea) }
accessible.all?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_nested\n @record = find_if_allowed(params[:id], :read)\n end",
"def child_acl\n [\n {\n 'privilege' => '{DAV:}read',\n 'principal' => owner,\n 'protected' => true\n },\n {\n 'privilege' => '{DAV:}write',\n 'pr... | [
"0.58500904",
"0.58041215",
"0.56830513",
"0.56222034",
"0.5562816",
"0.5537368",
"0.5445911",
"0.5401641",
"0.5393741",
"0.53171045",
"0.52759",
"0.52554834",
"0.525521",
"0.5254547",
"0.5254547",
"0.5254547",
"0.52515465",
"0.5247554",
"0.52192444",
"0.5219029",
"0.52159715... | 0.68372613 | 0 |
GET /rols/1 GET /rols/1.xml | def show
@rol = Rol.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @rol }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def... | [
"0.6118157",
"0.6118157",
"0.5941122",
"0.59244573",
"0.59233826",
"0.59158903",
"0.5838863",
"0.5810433",
"0.5808924",
"0.5762442",
"0.5751392",
"0.57127494",
"0.57078797",
"0.5707693",
"0.5700722",
"0.56819075",
"0.56763065",
"0.56648",
"0.56626946",
"0.5659165",
"0.5659165... | 0.71032786 | 1 |
GET /rols/new GET /rols/new.xml | def new
@rol = Rol.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @rol }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.err... | [
"0.72022414",
"0.7067177",
"0.68853265",
"0.6799671",
"0.67972404",
"0.6792667",
"0.67592645",
"0.67537063",
"0.6730882",
"0.6698384",
"0.6636429",
"0.6633694",
"0.6622037",
"0.6616588",
"0.6616588",
"0.6616588",
"0.6616588",
"0.6590247",
"0.6585547",
"0.65846443",
"0.6577787... | 0.79159343 | 1 |
POST /rols POST /rols.xml | def create
@rol = Rol.new(params[:rol])
respond_to do |format|
if @rol.save
format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') }
format.xml { render :xml => @rol, :status => :created, :location => @rol }
else
format.html { render :action => "new" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.err... | [
"0.6950628",
"0.6164979",
"0.59076256",
"0.5777335",
"0.5717998",
"0.57171905",
"0.5658761",
"0.5658761",
"0.5568336",
"0.55313003",
"0.5302578",
"0.5302578",
"0.52973926",
"0.5226925",
"0.51940113",
"0.5136111",
"0.51358914",
"0.5128255",
"0.51278913",
"0.51260924",
"0.50573... | 0.6684978 | 1 |
PUT /rols/1 PUT /rols/1.xml | def update
@rol = Rol.find(params[:id])
respond_to do |format|
if @rol.update_attributes(params[:rol])
format.html { redirect_to(@rol, :notice => 'Rol was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xm... | [
"0.71386456",
"0.62808794",
"0.62398434",
"0.62395734",
"0.5911937",
"0.58296406",
"0.5706345",
"0.5688722",
"0.56283903",
"0.56283903",
"0.5623921",
"0.55724114",
"0.5551198",
"0.55283445",
"0.5455258",
"0.54525435",
"0.54087836",
"0.5391634",
"0.5389028",
"0.5349875",
"0.53... | 0.68744946 | 1 |
DELETE /rols/1 DELETE /rols/1.xml | def destroy
@rol = Rol.find(params[:id])
@rol.destroy
respond_to do |format|
format.html { redirect_to(rols_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rolid = params[:id]\n Role.destroy(@rolid)\n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_a... | [
"0.64588046",
"0.64537984",
"0.63043654",
"0.6231372",
"0.61747974",
"0.6153388",
"0.6142095",
"0.61274886",
"0.60851115",
"0.607345",
"0.607345",
"0.6060952",
"0.60603064",
"0.60370386",
"0.60283357",
"0.60274565",
"0.6021817",
"0.6016675",
"0.60112804",
"0.6004829",
"0.6001... | 0.72054386 | 1 |
Notify the user of the backup operation results. `status` indicates one of the following: `:success` : The backup completed successfully. : Notification will be sent if `on_success` is `true`. `:warning` : The backup completed successfully, but warnings were logged. : Notification will be sent if `on_warning` or `on_su... | def notify!(status)
send_message(message.call(model, status: status_data_for(status)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = '[Backup::%s]' % name\n send_message(message)\n end",
"def notify!(status)\n ... | [
"0.83022225",
"0.8115682",
"0.8035099",
"0.7653947",
"0.76226187",
"0.7131452",
"0.6380589",
"0.6344476",
"0.62599",
"0.5694332",
"0.56476885",
"0.56333387",
"0.5629574",
"0.56179255",
"0.56104213",
"0.5582337",
"0.55577403",
"0.5549416",
"0.5546705",
"0.55400896",
"0.5519588... | 0.646023 | 6 |
The goal is to find the earliest time when the frog can jump to the other side of the river. | def solution(x, a)
count = 1
indices = []
while count <= x
indices << a.find_index(count)
count += 1
end
if indices.include?(nil)
-1
else
indices.sort.last
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min() time[1] end",
"def frog_jump(x, a)\n d = {}\n (1..x).each {|i| d[i] = true }\n\n min_time = -1\n len = a.length - 1\n\n (0..len).each do |sec|\n n = a[sec]\n d.delete(n) if d[n]\n if d.length == 0\n min_time = sec\n break\n end\n end\n... | [
"0.68020076",
"0.67486966",
"0.64500296",
"0.6322793",
"0.6066651",
"0.6028723",
"0.59674704",
"0.59431905",
"0.5876028",
"0.58511865",
"0.5822861",
"0.5779878",
"0.5779878",
"0.57587063",
"0.5705277",
"0.5664379",
"0.5642275",
"0.5640777",
"0.5628469",
"0.5613698",
"0.556108... | 0.0 | -1 |
compress a file and move it to the backup folder | def backup_file folder,file
@manager ||= Conf::LocalFileManager.new
newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)
file.zip! unless file.zip?
@manager.move_files [file],newp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress(src_path, archive_path)\n src_dir = File.dirname( File.expand_path( src_path ) )\n src_file = File.basename( src_path )\n archive_path = File.expand_path( archive_path )\n dest_dir = File.dirname( archive_path )\n\n puts \"src_dir: #{src_dir}\"\n puts \"src_path: #{src_path}\"\n p... | [
"0.7029616",
"0.6815202",
"0.6721034",
"0.6671892",
"0.6613445",
"0.657687",
"0.6575387",
"0.6447642",
"0.642551",
"0.6422216",
"0.63949215",
"0.63850206",
"0.6361033",
"0.6337166",
"0.6275988",
"0.625735",
"0.6233229",
"0.6220686",
"0.61998767",
"0.61751866",
"0.6136582",
... | 0.71339303 | 0 |
insertion method for a specific source | def insert_
# new files to insert
nfiles = @curr_schema.select_new_files
count = nfiles.size
Logger.<<(__FILE__,"INFO","Found #{nfiles.size} files to decode & insert for #{@curr_source.name}...");
return unless nfiles.size > 0
SignalHandler.check
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end",
"def attach(source); end",
"def add_source(source)\n all << source unless all.any? { |s| s.url == source || s.name == source.name }\n end",
"de... | [
"0.6829771",
"0.6431539",
"0.63562477",
"0.63491416",
"0.63374424",
"0.62601006",
"0.62237686",
"0.6132438",
"0.6100424",
"0.60701925",
"0.60624146",
"0.60623705",
"0.603175",
"0.6024115",
"0.60173994",
"0.59972024",
"0.5990629",
"0.5982955",
"0.5963527",
"0.5916711",
"0.5911... | 0.0 | -1 |
sequential approach rather than decode everything then insert everything it sends the switch and file to the block which will decode then insert | def iterate_over files
files.each do |file|
yield file
SignalHandler.check {
@db.close
Logger.<<(__FILE__,"WARNING","Signal SIGINT received: stopping decoding files ...")
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_\n # new files to insert\n nfiles = @curr_schema.select_new_files\n count = nfiles.size\n Logger.<<(__FILE__,\"INFO\",\"Found #{nfiles.size} files to decode & insert for #{@curr_source.name}...\");\n return unless nfiles.size > 0\n\n Sign... | [
"0.6309856",
"0.5997202",
"0.56635565",
"0.5551376",
"0.54976225",
"0.54300714",
"0.5377909",
"0.53760606",
"0.5374259",
"0.53441226",
"0.5343247",
"0.53075814",
"0.5259889",
"0.5244623",
"0.52381134",
"0.5223903",
"0.51888084",
"0.5169904",
"0.5163705",
"0.51448613",
"0.5140... | 0.47596836 | 89 |
GET /entity GET /entity.json | def index
@search = @klass.search(params[:q])
@entities = @search.result.includes(@klass::ADMIN_INCLUDES).page(params[:page])
@count = @search.result.count
@search.build_condition
respond_to do |format|
format.html # index.html.erb
format.json { render json: @entities }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse... | [
"0.75823855",
"0.75201654",
"0.7507115",
"0.7149724",
"0.69445497",
"0.6925524",
"0.68810314",
"0.68691486",
"0.68230766",
"0.6742496",
"0.6706326",
"0.6641274",
"0.6521985",
"0.645774",
"0.6422497",
"0.6411399",
"0.6407991",
"0.63794506",
"0.63794506",
"0.62808436",
"0.62499... | 0.0 | -1 |
GET /entity/1 GET /entity/1.json | def show
@entity = @klass.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @entity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end",
"def show\n @entity = Entity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n forma... | [
"0.7382582",
"0.7379729",
"0.72493464",
"0.71868736",
"0.68805516",
"0.66540146",
"0.66264147",
"0.65857345",
"0.65638226",
"0.65634507",
"0.6502313",
"0.63765836",
"0.6372421",
"0.6354498",
"0.63343877",
"0.62457335",
"0.62457335",
"0.6232261",
"0.6179839",
"0.61748034",
"0.... | 0.6757204 | 5 |
GET /entity/new GET /entity/new.json | def new
@entity = @klass.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @entity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.83444786",
"0.77972156",
"0.7673708",
"0.7581144",
"0.75669056",
"0.7471776",
"0.739064",
"0.73436695",
"0.72835374",
"0.7273284",
"0.71737635",
"0.71680695",
"0.71288955",
"0.7038358",
"0.7038358",
"0.7038358",
"0.70266515",
"0.7021943",
"0.7021473",
"0.70163125",
"0.6972... | 0.8057238 | 1 |
POST /entity POST /entity.json | def create
@entity = @klass.new(params[@klass.table_name.singularize])
respond_to do |format|
if @entity.save
format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: "#{@klass.model_name.capitalize} was successfully created." }
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end",
"def create\n @entity = Entity.new(params[:entity])\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { rende... | [
"0.8035309",
"0.71289855",
"0.70677793",
"0.69814897",
"0.69514555",
"0.6844975",
"0.67846",
"0.6664661",
"0.66111666",
"0.6587035",
"0.657915",
"0.6563162",
"0.65427953",
"0.6413452",
"0.6398687",
"0.63802665",
"0.6340329",
"0.6334677",
"0.6317732",
"0.62797606",
"0.62681746... | 0.5708385 | 84 |
PUT /entity/1 PUT /entity/1.json | def update
@entity = @klass.find(params[:id])
respond_to do |format|
if @entity.update_attributes(params[@klass.table_name.singularize])
format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: "#{@klass.model_name.capitalize} was successfully updated." }
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(entity)\n entity_id = get_id(entity);\n if entity_id.nil?\n create(entity)\n else\n put(resource_path_for_entity(entity) + \"/#{entity_id}\", entity.to_json)\n end\n end",
"def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! param... | [
"0.74229044",
"0.72337383",
"0.66664153",
"0.66406566",
"0.65877223",
"0.64905095",
"0.64310926",
"0.64102554",
"0.64021176",
"0.6388",
"0.63829696",
"0.6382936",
"0.6353384",
"0.63443035",
"0.63425696",
"0.6306256",
"0.6283912",
"0.6255696",
"0.62402546",
"0.6229396",
"0.622... | 0.57755744 | 56 |
DELETE /entity/1 DELETE /entity/1.json | def destroy
@entity = @klass.find(params[:id])
@entity.destroy
respond_to do |format|
format.html { redirect_to admin_entities_url(entity: @klass_path) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @entity = Entity.find(params[:id])\n @entity.destroy\n\n respond_to do |format|\n format.html { redirect_to entities_url }\n format.json { head :no_content }\n end\n end",
"def delete_entity(*entity)\n if entity.length > 1\n type, id = entity[0], entity[1]\n else\n... | [
"0.76068944",
"0.7589338",
"0.7492199",
"0.74920887",
"0.7202817",
"0.7202817",
"0.7202817",
"0.7194305",
"0.71826315",
"0.7176379",
"0.7156028",
"0.7155791",
"0.7008809",
"0.69910926",
"0.69721967",
"0.68656933",
"0.68540263",
"0.6846777",
"0.68382007",
"0.68377346",
"0.6837... | 0.68121254 | 27 |
=begin Add the number to an internal data structure.. :type number: Integer :rtype: Void =end | def add(number)
if @set[number]
@set[number] = @set[number]+1
else
@set[number] = 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_number(number)\n self.numbers << number\n end",
"def add(number)\n if @map.key?(number)\n @map[number] += 1\n else\n @map[number] = 1\n end\n end",
"def add(number)\n set_value(@value + number.to_i)\n end",
"def add_num(num)\n @lo.add(num)\... | [
"0.7582791",
"0.7461973",
"0.72895044",
"0.69868714",
"0.69838303",
"0.6942328",
"0.66654557",
"0.6653267",
"0.66481566",
"0.64591485",
"0.6418465",
"0.6395394",
"0.6333122",
"0.6330945",
"0.631915",
"0.63148993",
"0.62855315",
"0.6269009",
"0.6248976",
"0.62194043",
"0.61441... | 0.73469275 | 2 |
=begin Find if there exists any pair of numbers which sum is equal to the value. :type value: Integer :rtype: Boolean =end | def find(value)
@set.each do |k,v|
return true if ((value-k) == k) ? @set[value-k] > 1 : @set[value - k]
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_pair_with_sum(data, sum)\n lo = 0\n hi = data.size - 1\n test_sum = data[lo] + data[hi]\n while lo <= hi\n puts \"test_sum: #{test_sum}, data[lo]: #{data[lo]}, data[hi]: #{data[hi]}\"\n return true if test_sum == sum\n if test_sum > sum\n hi -= 1\n else\n lo += 1\n end\n tes... | [
"0.74828774",
"0.72327685",
"0.70942444",
"0.6995419",
"0.6986097",
"0.69799054",
"0.69392085",
"0.69391173",
"0.68514913",
"0.68081456",
"0.67745155",
"0.6756841",
"0.6741212",
"0.67327094",
"0.67318976",
"0.67295015",
"0.67266923",
"0.67162114",
"0.67158026",
"0.6709308",
"... | 0.7005605 | 3 |
to make sure pieces to go through other pieces (except knight), could clean up | def conflict_check(player, opponent, start, dest)
idx = player.find_piece_index(start[0], start[1])
opp_idx = opponent.find_piece_index(dest[0], dest[1])
opp_king_idx = nil
opponent.pieces.each_with_index{ |val, index| opp_king_idx = index if val.is_a? King }
copy_start = start.dup
copy_dest = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n end\n end\nend",
"def compact_pieces\n @recheck = false\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @boar... | [
"0.7332405",
"0.7161907",
"0.69368786",
"0.66186357",
"0.6570748",
"0.6511492",
"0.6466447",
"0.6409401",
"0.63781685",
"0.63770384",
"0.6326164",
"0.63201946",
"0.6308634",
"0.6265742",
"0.6260971",
"0.62131125",
"0.61990744",
"0.6192089",
"0.61863774",
"0.61805636",
"0.6177... | 0.0 | -1 |
different from document? low toms should play on 41, 43 | def low_toms
[43]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_as_master_second\r\n \r\n end",
"def microgram? = unit == 'microgram'",
"def audio; end",
"def sheetlisten()\n n=0.5\n i=0\n while i<@songstr.length-1\n case @songstr[i]\n when 'a' \n play :a\n when 'b' \n ... | [
"0.6314039",
"0.579496",
"0.5673225",
"0.56324",
"0.5620701",
"0.56098676",
"0.56085604",
"0.55823606",
"0.55765975",
"0.55461425",
"0.548949",
"0.548949",
"0.5473301",
"0.5463166",
"0.5430639",
"0.53927225",
"0.5391879",
"0.5385363",
"0.5385222",
"0.5370647",
"0.5357774",
... | 0.5760553 | 2 |
Get the code cell | def set_code_cell
@code_cell = CodeCell.find_by!(notebook: @notebook, cell_number: (params[:id].to_i - 1).to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n notebook.notebook.code_cells_source[cell_number]\n end",
"def code\r\n return @code[@index]\r\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def cod... | [
"0.78243166",
"0.74905294",
"0.6954769",
"0.6954769",
"0.6933515",
"0.6933515",
"0.69145435",
"0.68918127",
"0.6778994",
"0.6748761",
"0.6748761",
"0.67406553",
"0.6681829",
"0.6589386",
"0.6484917",
"0.64305407",
"0.64040905",
"0.62440234",
"0.624104",
"0.6154334",
"0.615193... | 0.6303159 | 17 |
This helper timestamps asset files (css, js etc). Typically used in 'skin' files to precalculate the actual path. TEMP version: just attaches the $build number. ++ | def timestamp_asset(path)
return "#{path}?t=#$app_build"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asset_timestamp(file_path)\n return nil if file_path =~ /\\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)\n public_path = self.class.public_folder if self.class.respond_to?(:public_folder)\n public_path ||= Padrino.root(\"public\") if Padrino.respond_to?(:root)\n ... | [
"0.6419433",
"0.6338564",
"0.6187573",
"0.6186875",
"0.608325",
"0.6001299",
"0.5933352",
"0.58739525",
"0.5865026",
"0.58244014",
"0.5805991",
"0.57985854",
"0.57624364",
"0.57467824",
"0.57219815",
"0.5720125",
"0.57045555",
"0.56023604",
"0.55988395",
"0.5573486",
"0.55500... | 0.7513147 | 0 |
Generate a link to a css file. | def link_css(path, media = "screen")
path = "/#{path}" unless path =~ %r{^/}
path = "#{path}.css" unless path =~ %r{\.css$}
%{<link href="#{timestamp_asset(path)}" media="#{media}" rel="Stylesheet" type="text/css" />}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def css(file)\n\t\t\t\"<link rel='stylesheet' type='text/css' href='#{file}'>\"\n\t\tend",
"def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end",
"def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end",
"def generate_css\n nee... | [
"0.79782635",
"0.79519695",
"0.79519695",
"0.7536401",
"0.7266992",
"0.718946",
"0.69582593",
"0.6823336",
"0.6636478",
"0.65815246",
"0.6544558",
"0.65318906",
"0.65318906",
"0.6505208",
"0.65002185",
"0.64736766",
"0.6457578",
"0.6413113",
"0.6407781",
"0.63952714",
"0.6357... | 0.7362136 | 4 |
Build a program that randomly generates and prints Teddy's age. To get the age, you should generate a random number between 20 and 200. Example Output Teddy is 69 years old! input => generate a random number between 20 and 200 output => print out a string that includes Teddy's generated age abstraction => set Teddy's a... | def random_age
rand(20...200)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age\n puts \"Teddy is #{rand(20...200)} years old!\"\nend",
"def teddys_age\n puts \"Teddy's age is #{rand(20..200)}\"\nend",
"def age\n puts \"Now the Gods are assigning a power to #{@name}. This is up to the Gods alone.\"\n sleep 3\n @age = rand(10..100)\n\n puts \"Attention!!!\"\n put... | [
"0.8357168",
"0.8152351",
"0.7627153",
"0.7616811",
"0.7571686",
"0.75272936",
"0.7494079",
"0.7372679",
"0.71779984",
"0.7085186",
"0.7073363",
"0.70451415",
"0.7014921",
"0.69669366",
"0.694179",
"0.68594265",
"0.68324447",
"0.68190134",
"0.67654616",
"0.6763808",
"0.673007... | 0.7187935 | 8 |
This method is not needed for PUT but I added for completeness | def do_OPTIONS(_req, res)
res['allow'] = 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,PATCH,DELETE'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n req... | [
"0.6412474",
"0.6412474",
"0.62713706",
"0.62579226",
"0.620834",
"0.6132645",
"0.6118238",
"0.61101395",
"0.60888326",
"0.6076461",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6028773",
"0.6014054",
"0.6014054",
"0.60130286",... | 0.0 | -1 |
desc: generalize the mail box means it will fetch all types of mails from the any folders params: id output: html, js | def messages
selected_label = params[:label].blank? ? 'INBOX' : params[:label]
begin
unless selected_label.blank?
@imap = WmailImapUtils.current_imap
@imap.select(selected_label)
@status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html\n\n $anterior = params[:id].to_i - 1\n $siguiente = params[:id].to_i - 1\n\n $buscar_texto = nil\n $buscar_por = nil\n\n ENV['folder'] = 'mailbox'\n load 'script/mailman_server.rb'\n\n adjuntos = ''\n\n @@messages.each do |message|\n @from = message[:from]\n @to = ... | [
"0.66852874",
"0.6354398",
"0.635118",
"0.62598985",
"0.6184302",
"0.60495585",
"0.5991633",
"0.5968701",
"0.59108365",
"0.5788751",
"0.5734764",
"0.5726455",
"0.57234687",
"0.57162946",
"0.5693383",
"0.5688671",
"0.5650533",
"0.5647265",
"0.56363064",
"0.56363064",
"0.563159... | 0.5532772 | 26 |
desc: gets the given number of mails from the given mailbox and return it to ajax call. output: js | def mails
begin
@imap = WmailImapUtils.current_imap
if not @imap.blank?
@mailbox = params['mailbox']
@min = params['min'].to_i
@max = params['max'].to_i
@total = params['total'].to_i
@imap.select(@mailbox)
@mails = @imap.fetch(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @seqno = params[:id].to_i\n @total = params[:total].to_i\n\n begin\n @imap = WmailImapUtils.current_imap\n message = @imap.fetch(@seqno, ['RFC822']).first.attr['RFC822']\n @mail = Mail.new(message)\n # get the folder list\n mailbox_list\n rescue\n ... | [
"0.6657559",
"0.6314533",
"0.60601854",
"0.6057587",
"0.5850558",
"0.5818033",
"0.5816518",
"0.5758425",
"0.5694075",
"0.5679501",
"0.5672662",
"0.56647146",
"0.56630784",
"0.56569636",
"0.555139",
"0.55461514",
"0.55458695",
"0.55357844",
"0.5534469",
"0.5509628",
"0.5497184... | 0.67748797 | 0 |
GET /banescos GET /banescos.json | def index
@pools = Banesco.all
@new_pool = Banesco.new
@new_pool.date_of = Date.today
@cierre = Cierre.new
@cierre.account = "Banesco"
render 'layouts/_cuentas_index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bancos = Banco.all\n end",
"def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @... | [
"0.73021615",
"0.72636193",
"0.68603635",
"0.677008",
"0.67218727",
"0.668826",
"0.6554973",
"0.65174794",
"0.6503707",
"0.6440454",
"0.6428013",
"0.63916284",
"0.6367049",
"0.6357187",
"0.63398516",
"0.6300535",
"0.62667626",
"0.6262769",
"0.6256097",
"0.62176734",
"0.620491... | 0.0 | -1 |
GET /banescos/1 GET /banescos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bancos = Banco.all\n end",
"def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @... | [
"0.71681106",
"0.69848055",
"0.6895911",
"0.67301",
"0.6684483",
"0.66709566",
"0.6646924",
"0.66086847",
"0.6579848",
"0.6533553",
"0.6519906",
"0.6478248",
"0.6443591",
"0.64182836",
"0.639403",
"0.639403",
"0.639403",
"0.63927794",
"0.6358207",
"0.63579464",
"0.63331276",
... | 0.0 | -1 |
POST /banescos POST /banescos.json | def create
@banesco = Banesco.new(banesco_params)
# ask_for_permission(@banesco, 'create_banesco') and return if current_user.cannot 'create_banesco'
# Calculate balance and save
last_banesco = Banesco.last
(last_banesco.nil? or last_banesco.balance.nil?) ?
@banesco.balance = @banesco.monto : ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to @banco, notice: 'Banco fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n ... | [
"0.71891385",
"0.7083018",
"0.700415",
"0.667034",
"0.64701295",
"0.64701295",
"0.6469725",
"0.6455412",
"0.64474",
"0.6425818",
"0.6394779",
"0.6388117",
"0.6362138",
"0.63445055",
"0.6334891",
"0.6315195",
"0.6286442",
"0.6280186",
"0.6265571",
"0.62350214",
"0.61757135",
... | 0.66628855 | 4 |
PATCH/PUT /banescos/1 PATCH/PUT /banescos/1.json | def update
@banesco.assign_attributes(banesco_params)
# ask_for_permission(@banesco, 'update_banesco') and return if current_user.cannot 'update_banesco'
# Extract category, if given
category = params[:banesco][:category]
unless category.nil?
@banesco.category_type, @banesco.category_id = cate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n form... | [
"0.70923454",
"0.68830425",
"0.6814519",
"0.6746583",
"0.6519432",
"0.6507125",
"0.64932615",
"0.64893126",
"0.64887595",
"0.6485025",
"0.6406043",
"0.6370937",
"0.6369637",
"0.6351071",
"0.63508564",
"0.63433",
"0.6340729",
"0.6336247",
"0.6336247",
"0.6336247",
"0.6320072",... | 0.630439 | 22 |
DELETE /banescos/1 DELETE /banescos/1.json | def destroy
# ask_for_permission(@banesco, 'destroy_banesco') and return if current_user.cannot 'destroy_banesco'
@banesco.destroy
are_saved = update_balances(@banesco)
respond_to do |format|
if are_saved.all?
format.html { redirect_to banescos_url, notice: @banesco.table_name_to_show.conc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to bancos_url, notice: 'Banco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to bancos_url... | [
"0.73250484",
"0.7219666",
"0.7186686",
"0.69688016",
"0.69528896",
"0.6925004",
"0.6890132",
"0.6866147",
"0.6860454",
"0.68331116",
"0.6820447",
"0.68099105",
"0.680553",
"0.67907786",
"0.6767117",
"0.67625",
"0.6751995",
"0.67468935",
"0.6722759",
"0.6709541",
"0.6702559",... | 0.6484778 | 70 |
Use callbacks to share common setup or constraints between actions. | def set_banesco
@banesco = Banesco.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 banesco_params
params.require(:banesco).permit(:category_id, :category_type, :monto, :balance, :cuenta, :comprobante_type, :n_factura, :description, :razon_social_id, :date_of, :forma_de_pago, :forma_de_pago_nro, :receiver)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Instantiates a new securityKubernetesPodEvidence and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.security.kubernetesPodEvidence"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.kubernetesSecretEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.amazonResourceEvidence\"\n end",
"def initialize()\n ... | [
"0.6451284",
"0.54269695",
"0.5245782",
"0.5226086",
"0.5197408",
"0.5062625",
"0.50069535",
"0.4933385",
"0.4895962",
"0.48238045",
"0.48238045",
"0.47835678",
"0.4750577",
"0.46938643",
"0.46332353",
"0.45909813",
"0.45536014",
"0.4543707",
"0.45156503",
"0.4483675",
"0.448... | 0.7090775 | 0 |
Gets the containers property value. The list of pod containers which are not init or ephemeral containers. | def containers
return @containers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end",
"def containers=(value)\n @containers = value\n end",
"def running_containers\n ... | [
"0.7452125",
"0.7156679",
"0.70323414",
"0.6928082",
"0.6864879",
"0.6786346",
"0.65040404",
"0.6441898",
"0.6315443",
"0.6179341",
"0.61598444",
"0.6098868",
"0.6062128",
"0.60589224",
"0.6013133",
"0.59717095",
"0.5927755",
"0.579219",
"0.57777846",
"0.5758342",
"0.57458967... | 0.71285844 | 2 |
Sets the containers property value. The list of pod containers which are not init or ephemeral containers. | def containers=(value)
@containers = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ephemeral_containers=(value)\n @ephemeral_containers = value\n end",
"def init_containers=(value)\n @init_containers = value\n end",
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n ... | [
"0.70891976",
"0.6731775",
"0.65368944",
"0.6155096",
"0.600326",
"0.6000397",
"0.5925121",
"0.5860609",
"0.57814556",
"0.5621611",
"0.553374",
"0.540802",
"0.5395047",
"0.5392625",
"0.5353763",
"0.5271195",
"0.51799804",
"0.516874",
"0.5147814",
"0.5061929",
"0.5038068",
"... | 0.8103989 | 0 |
Gets the controller property value. The pod controller. | def controller
return @controller
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller=(value)\n @controller = value\n end",
"def controller=(value)\n @property_flush[:controller] = value\n end",
"def controller client\n client.env[CONTROLLER_NAME]\n end",
"def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n ... | [
"0.66547716",
"0.6534098",
"0.6431632",
"0.6352281",
"0.6352281",
"0.63509214",
"0.62173706",
"0.60733",
"0.60723096",
"0.60187113",
"0.60064083",
"0.5960757",
"0.58094335",
"0.5804069",
"0.572883",
"0.5721424",
"0.5711408",
"0.56776834",
"0.56776834",
"0.5660755",
"0.5642541... | 0.65726924 | 1 |
Sets the controller property value. The pod controller. | def controller=(value)
@controller = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller=(value)\n @property_flush[:controller] = value\n end",
"def controller=(value)\n MSPhysics::Newton::BallAndSocket.set_controller(@address, value)\n end",
"def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end",
"def controller=(value)... | [
"0.78167844",
"0.70102537",
"0.68996704",
"0.68996704",
"0.67232865",
"0.67232865",
"0.6556888",
"0.64945674",
"0.6165112",
"0.5875794",
"0.5875363",
"0.5569134",
"0.55170256",
"0.54999125",
"0.5486526",
"0.5445268",
"0.5434853",
"0.54136515",
"0.53007466",
"0.524773",
"0.524... | 0.7886716 | 0 |
Gets the ephemeralContainers property value. The list of pod ephemeral containers. | def ephemeral_containers
return @ephemeral_containers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ephemeral_containers=(value)\n @ephemeral_containers = value\n end",
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end",
"def contai... | [
"0.76161",
"0.5884932",
"0.578187",
"0.5516923",
"0.54679585",
"0.538744",
"0.5291211",
"0.5060789",
"0.5046921",
"0.49621603",
"0.4917593",
"0.4904076",
"0.480965",
"0.47854877",
"0.471142",
"0.46931335",
"0.46918225",
"0.46907508",
"0.46596503",
"0.4643486",
"0.46421877",
... | 0.80097926 | 0 |
Sets the ephemeralContainers property value. The list of pod ephemeral containers. | def ephemeral_containers=(value)
@ephemeral_containers = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ephemeral_containers\n return @ephemeral_containers\n end",
"def containers=(value)\n @containers = value\n end",
"def init_containers=(value)\n @init_containers = value\n end",
"def containers\n @containers ||= Docker::... | [
"0.64774215",
"0.55380553",
"0.48167664",
"0.4680562",
"0.44575647",
"0.44331056",
"0.44293505",
"0.4305809",
"0.42976215",
"0.42909667",
"0.42610446",
"0.42297187",
"0.41875792",
"0.41623524",
"0.4154813",
"0.41231385",
"0.4112073",
"0.4110572",
"0.40862584",
"0.40834674",
"... | 0.8154758 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.