query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
d05a45284906d8b71e39b86d322eb671
GET /quiz_grades/new GET /quiz_grades/new.json
[ { "docid": "8d85f4aa32e27172761fa395c6ea5f60", "score": "0.8195363", "text": "def new\n @quiz_grade = QuizGrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quiz_grade }\n end\n end", "title": "" } ]
[ { "docid": "051d11bfe5fa54679ac3504382ecd992", "score": "0.79415745", "text": "def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end", "title": "" }, { "docid": "051d11bfe5fa54679ac3504382ecd...
2c87c0ec41464ef0da73bd06417da8f5
Sets the consumedUnits property value. The number of licenses that have been assigned.
[ { "docid": "fbb529a3be8ad2e4f3de3a8adc253ecd", "score": "0.8057671", "text": "def consumed_units=(value)\n @consumed_units = value\n end", "title": "" } ]
[ { "docid": "634917c0197288774b824cbb1f982909", "score": "0.6349864", "text": "def set_consumed_unit\n @consumed_unit = ConsumedUnit.find(params[:id])\n end", "title": "" }, { "docid": "3b6db677730d80dc256318d94ee5e268", "score": "0.6197739", "text": "def consumed_units\n ...
17965292a3cc2039752654b9d1880479
yields batches of candidates for synchronization
[ { "docid": "e14e6e21107ca8b92ac819fda761c9e3", "score": "0.7926092", "text": "def gather_candidates # TODO: rename\n Iqvoc::Sync.syncable_classes.each do |klass|\n self.class.candidates(klass).find_in_batches(:batch_size => @batch_size) do |records|\n yield records\n end\n end\n ...
[ { "docid": "6a63267b383c4436d0fee8295fa2431c", "score": "0.79202294", "text": "def gather_candidates # TODO: rename\n Iqvoc::Sync.syncable_classes.each do |klass|\n self.class.candidates(klass).find_in_batches(batch_size: @batch_size) do |records|\n yield records\n end\n end\n en...
9bb980f26de07187144ba059fe911453
Check whether this message is an attachment. In case rfc822 is true, the message's content_type also needs to match 'message/rfc822'.
[ { "docid": "72b1d722e7c2bf48051ab493ed04c9d5", "score": "0.8614026", "text": "def attachment?(rfc822 = false)\n raise(TypeError, \"Can not test multipart message for attachment.\") if multipart?\n return (!@header.filename.nil? && (!rfc822 || @header.content_type == 'message/rfc822'))\n end...
[ { "docid": "eef731d934cf6661598abb7b07bcc71d", "score": "0.7973049", "text": "def attachment?\n type == \"attachment\"\n end", "title": "" }, { "docid": "a38a5777b7adfd3218491b86858b8a16", "score": "0.7601234", "text": "def is_type_attachment?()\n\t\t\t\tif !@result.nil?\...
da9d8f81ba1cd7ca7f4d405ec2a444a6
Setup vault with the given keys for the given attributes.
[ { "docid": "fe55fb0be8668e7bfbdbd2d4e5296bde", "score": "0.7337266", "text": "def vault_attributes(keys, *attributes)\n raise(Error, 'must provide both keys name and attrs when setting up vault') unless keys && attributes\n @vault_keys = keys\n @vault_attrs = attributes\n\n ...
[ { "docid": "a7fbc410370c856e5d40fe8d56e1ba83", "score": "0.58056766", "text": "def initialise_vault\n puts 'Setting up Vault'\n hosts = instances\n initialise_vault_instance(hosts.first)\n\n hosts.each do |instance|\n throw \"Couldn't unseal #{instance}\" unless unseal(instance)\n en...
3fdac34057e64e55c1836aad79b1f34c
function to compute result
[ { "docid": "b0a414aa2b92eac26dc8c9b9b26e81c8", "score": "0.0", "text": "def convert\n if(ORIG_UNITS.eql? NEW_UNITS)\n _result = NUM_UNITS * CONV_FACTOR # treat as special case\n else\n _result = CONV_DATA[CONV_KEY] * NUM_UNITS * CONV_FACTOR\n end\nend", "title": "" } ]
[ { "docid": "d69b33fa1963a3dfb134af2551a78db3", "score": "0.68298477", "text": "def calc\n fail NotImplementedError\n end", "title": "" }, { "docid": "3482efaaf9425e5d79ce7e1d4a539cbb", "score": "0.67833894", "text": "def calculate\n scores = self.find_score\n avg = ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a371dfa63e0f152bee55c8ec1defc55f", "score": "0.0", "text": "def realtor_params\n params.require(:realtor).permit(:name, :address, :college, :realtor_url, :search)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74954116", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6956924", "text": "def strong_params\n params.require(:request).permit(param_whit...
bf437ba1e30ea9b6564c83e404efbf80
POST /flights or /flights.json
[ { "docid": "3f32d126bcf9c819f374f7f115441c4d", "score": "0.7488494", "text": "def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: \"Flight was successfully created.\" }\n format.json { render ...
[ { "docid": "e23bd3eab05128f0333002198171f886", "score": "0.7727808", "text": "def create\n @flight = Flight.new(flight_params)\n if @flight.save\n render json: {\n message: 'flight created',\n status: :ok\n }\n else\n render json: @flight.errors, status: :unprocessa...
8b289aab5be7820efde5921e9a8c80aa
GET /apps/new GET /apps/new.json
[ { "docid": "e41fd843d3df3180fc6448d95604bb32", "score": "0.64439976", "text": "def new\n @app = App.new\n #@ec2_sg_filtered = ec2_sg_filtered\n load_ec2_sg_filtered\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "titl...
[ { "docid": "20a23bba59d0a9ed4e7d6f6fd305218a", "score": "0.8068578", "text": "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "title": "" }, { "docid": "11dc3764886a45faf4f1828b597...
4dac7f5bd6cd51f9b3956850b504fee6
Display presenters who teach a subject
[ { "docid": "1a63df96bb29ea01b2ddeecfe8525e23", "score": "0.7358902", "text": "def view_presenters\n\t\t@subject = Subject.find(params[:subject_id])\n\t\t@presenters = @subject.presenters\n\tend", "title": "" } ]
[ { "docid": "bac0095c7f40b93baab47df2a861e022", "score": "0.6750647", "text": "def show\n @subjects = @teacher.subjects\n respond_with @teacher\n end", "title": "" }, { "docid": "e7400b675ca9be99ad165e3fba8b6adf", "score": "0.64340675", "text": "def show\n @manual_subject = ...
5bc39c2457ebb52e60089c3d7704dcec
Set the value of the WeightUnit input for this Choreo.
[ { "docid": "6d99872c172617a2edbdc35c9f076012", "score": "0.78316444", "text": "def set_WeightUnit(value)\n set_input(\"WeightUnit\", value)\n end", "title": "" } ]
[ { "docid": "6b897728ccf6cb76cd0864451080e1b8", "score": "0.6907767", "text": "def set_weight_unit\n @weight_unit = WeightUnit.find(params[:id])\n end", "title": "" }, { "docid": "5f97803e85b80469b441d5df46dfc084", "score": "0.625204", "text": "def weight=(w)\n raise Ar...
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "404165a9feaa8574de1b90d2e5aa9cd2", "score": "0.0", "text": "def reserve_host\n user = User.first\n reserva = Reserva.new(quantidade: 2, id_usuario: 1, id_produto: 1, rua: \"Rua alfa\", bairro: \"Tijuca\", cidade: \"Rio de Janeiro\", email_usuario: \"example@example.com\", estado: \"RJ\...
[ { "docid": "f4f01bf0c4f6341760a71d13d7b6cc72", "score": "0.7310511", "text": "def preview_email\n email = UserMailer.emailing(@emailing)\n mail_inliner = Roadie::Rails::MailInliner.new(email, Rails.application.config.roadie)\n mail = mail_inliner.execute\n\n mail.html_part.decoded.gsub /http...
a65f146182a9430a1746a09e397df9ec
bogo ops/s (real time)
[ { "docid": "f460e40a14aa0ff8715fb522f2691441", "score": "0.0", "text": "def extract_bogo_ops(string, method)\n string[/stress-ng: info: \\[\\d*\\] #{method}\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)/, 5]\n end", "title": "" } ]
[ { "docid": "00e696b3e85040d3458362322450c65e", "score": "0.6192916", "text": "def tick; end", "title": "" }, { "docid": "00e696b3e85040d3458362322450c65e", "score": "0.6192916", "text": "def tick; end", "title": "" }, { "docid": "00e696b3e85040d3458362322450c65e", "sc...
287c5526a2d721d20fde839fb2b6a1e9
Get dependencies of a supplied module from a metadata.json file to verify if the depedencies are satisfied
[ { "docid": "567b2619c86ccd75b0dc988d0fb79d69", "score": "0.67023236", "text": "def get_dependencies_from_path(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n get_dependencies_from_metadata(metadata)\n end", "title": "" } ]
[ { "docid": "90f2d02c84e1e2bdd13d8afd8e97dcf4", "score": "0.7880175", "text": "def get_dependencies_from_metadata(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n checker = DependencyChecker::MetadataChecker.new(metadata, @forge, @updated_module, @updated_mo...
f5b05ca5d37d229b9400845b6a067b71
TODO return word instead of letter (beware of affecting score) TODO merely calculate and rank words by score, in case people don't know the word
[ { "docid": "2764459ee9432863bf0ff75247d97a0e", "score": "0.0", "text": "def best_responses\n\t\tif possible_wordlist.empty?\n\t\t\t[:challenge]\n\t\telsif good_wordlist.empty?\n\t\t\t[:lose]\n\t\telsif good_wordlist.first == @env.current_letters\n\t\t\t[:call]\n\t\telse\n\t\t\tbest_response_letters\n\t\...
[ { "docid": "37ad5f0daea3473251ef9f26508d8b81", "score": "0.794223", "text": "def word_ranking(str)\n \n # return empty string if it it empty \n if str.length == 0\n return str\n # else split str to an array of words\n else\n word_arr = str.split(\" \")\n end\n \n # map...
e05fb543f2c788dbc90f9d11b02ef455
POST /servers POST /servers.xml
[ { "docid": "7aa1026cb1809197581f1ad65449e0dd", "score": "0.0", "text": "def create\n @server = Server.new(params[:server])\n if @server.server_type == 3\n @server.load_balancer = LoadBalancer.new(params[:load_balancer])\n end\n if @server.save\n @errors = false\n else\n @er...
[ { "docid": "613f348b9f3803cab5765e774687faa9", "score": "0.65314513", "text": "def create\n @servernode = Servernode.create(servernode_params)\n p = {:servernode => {:name => params[:servernode][:name],\n :status => params[:servernode][:status]}}\n RestClient.post('http://localhost:3...
a829a0dfea44c8a673536c89acadce6c
POST /volunteer_action_plans POST /volunteer_action_plans.json
[ { "docid": "288dc8a996e91da6a8afb979cebb3dd1", "score": "0.6599306", "text": "def create\n @volunteer_action_plan = VolunteerActionPlan.new(volunteer_action_plan_params[:volunteer_action_plan])\n @volunteer_action_plan.user_id = current_user.id\n\n if (volunteer_action_plan_params[:volunteer_ac...
[ { "docid": "8c797cee802f1f5ba5da15280494ad85", "score": "0.6953117", "text": "def create\n @action_plan = @goal.action_plans.build(action_plan_params)\n\n respond_to do |format|\n if @action_plan.save\n format.html { redirect_to [@goal, @action_plan], notice: 'Action plan was successfu...
862f19f8a2da966fd9d9df1f070de755
GET /event_photos/new GET /event_photos/new.xml
[ { "docid": "a39287e1419ca017e4367ed124033352", "score": "0.7422211", "text": "def new\n @event_photo = EventPhoto.new\n\n respond_to do |format|\n format.html { render :layout => \"application\" }# new.html.erb\n format.xml { render :xml => @event_photo }\n end\n end", "title": ...
[ { "docid": "4127120feeb92a76ef53f7dc556bd8a1", "score": "0.77152306", "text": "def new\n @photos = interesting\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flickr_photo }\n end\n end", "title": "" }, { "docid": "22dc31781357916f2...
18f0f8148319855c7ac2599c3d2e8fd8
Generate select and subregion option tags with the provided name. A common use of this would be to allow users to select a state subregion within a given country. See `FormOptionsHelper::subregion_select` for more information.
[ { "docid": "1a7039e250aceb3136c8c576c11250e4", "score": "0.6352396", "text": "def subregion_select(method, parent_region_or_code, options = {}, html_options = {})\n @template.subregion_select(@object_name, method, parent_region_or_code, objectify_options(options), @default_options.merge(html_opti...
[ { "docid": "e3de73d3fbd100fc35997b081eff786e", "score": "0.7638036", "text": "def subregion_select_tag(name, value, parent_region_or_code, options = {})\n options.stringify_keys!\n parent_region = determine_parent(parent_region_or_code)\n priority_regions = options.delete(:priority)...
1631f32bf1443e4dabe07397d6ecc6b2
should it be put there? should the brew_service know about the models?
[ { "docid": "6852236f8bae9a1e2c563cbe5d4a922b", "score": "0.0", "text": "def update_previous_version_of_packages(task)\n begin\n server = get_xmlrpc_client\n task.packages.each do |package|\n next if !package.can_be_shipped?\n\n # use package.get_pkg_name for SCL pack...
[ { "docid": "ae2b23f3fbc4d309480900e2e7d87020", "score": "0.62981254", "text": "def bi_service\n end", "title": "" }, { "docid": "dc3496b26f16c153a0cced0f41bc91d8", "score": "0.61148494", "text": "def service\n raise \"Abstract method service in ModelBase was called\"\n end",...
2d4053e6a063ddbe230665dbc06d7cc2
Spawn a new command and return its exit status. It will print to stdout on real time.
[ { "docid": "194e7b7cea4c1755a71dc3ebf7bbcb5f", "score": "0.74582124", "text": "def spawn_cmd(cmd)\n status = 0\n\n PTY.spawn(cmd) do |stdout, _, pid|\n # rubocop:disable Lint/HandleExceptions\n begin\n stdout.each { |line| print line }\n rescue Errno::EIO\n # End of output\n end\...
[ { "docid": "d69fed262d60835a911a9f7976428aee", "score": "0.7511319", "text": "def run_with_status(*args)\n _print_command *args\n pid = Process.spawn(*args)\n return Process.wait2(pid).last\nend", "title": "" }, { "docid": "b5d940b289ab91f69130ff2b278852bf", "score": "0.72062063...
98924901838b7dee70a8272014680dda
=> Grab the Private Images from DigitalOcean
[ { "docid": "f450f8f7a226d095655b91716f8af629", "score": "0.6719989", "text": "def images\n do_client.images.all.select do |image|\n image.public == false && image.type.casecmp('snapshot').zero?\n end.sort_by(&:id).reverse\n rescue DropletKit::Error => e\n e\n end", "title...
[ { "docid": "cfe1e5056e1c189a690dae206c30e49d", "score": "0.7146715", "text": "def get_images\n images = collect_inventory(:private_images) { gather_data_for_this_region(@sas, 'list_all_private_images') }\n rescue ::Azure::Armrest::ApiException => err\n _log.warn(\"Unable to collect Az...
5f21b6a4b9ebaec2f9d440aa50bff87d
PATCH/PUT /flrs/1 PATCH/PUT /flrs/1.json
[ { "docid": "960cf5fab54fd2da946db151beff6905", "score": "0.0", "text": "def update\n if @flr.update(flr_params)\n redirect_to @flr, notice: 'Flr was successfully updated.'\n else\n render :edit\n end\n end", "title": "" } ]
[ { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6804374", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6804374", "tex...
0058abd353a5a6286a4ab4a6730008bc
This is a GreasySpoon script. WHAT IT DOES: ==ServerScript==
[ { "docid": "06788d07173a18a804edd5ca72bbd430", "score": "0.0", "text": "def getTLD(url)\r\n\tdomain = url.gsub(/.*?\\/\\/(.*?)\\/.*/,'\\1')\r\n\ttld = domain.gsub(/.*\\.(.*\\..*)/,'\\1')\r\n\treturn tld\r\nend", "title": "" } ]
[ { "docid": "d29be81a3bb9dd4ce87ea537d2e048e4", "score": "0.7471209", "text": "def script; end", "title": "" }, { "docid": "d29be81a3bb9dd4ce87ea537d2e048e4", "score": "0.7471209", "text": "def script; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4b19a315f4b662c79f916c132ef1b66e", "score": "0.0", "text": "def meal_plan_params\n params.require(:meal_plan).permit(:name, :active, :recipe_id, { :recipe_ids => [] } )\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
8ffd672e73a099dc5708af05a2073929
Returns the application's short version and the version: ["Version:", "1.0 final (1.0)"]
[ { "docid": "118b5ccbb68d0c537d72345efa8b7be3", "score": "0.73287976", "text": "def version\n app_info_plist = OSX::NSBundle.mainBundle.infoDictionary\n \"#{app_info_plist['CFBundleShortVersionString']} (#{app_info_plist['CFBundleVersion']})\"\n end", "title": "" } ]
[ { "docid": "8d9ef42483434203f82ee5e2a08a7d17", "score": "0.7858388", "text": "def show_version\n puts \"#{App.name} (Version: #{App.version})\"\nend", "title": "" }, { "docid": "49fb77ac820d45332ff6b611a48bf93e", "score": "0.7763748", "text": "def to_s; \"ver #{full}\" end", "ti...
4f4401f0e0a297d88fe5f21a5be6bf03
temporary response behavior until this is better planned
[ { "docid": "72d0ba4cf9c185ca6b2a986e3107e07c", "score": "0.0", "text": "def destroy\n log_out! if !current_user.nil?\n render json: {}\n end", "title": "" } ]
[ { "docid": "e3e584cca2b1221eabae3bd4f9847167", "score": "0.69649243", "text": "def prepare_response\n end", "title": "" }, { "docid": "a70b87fb9875f92d059c195ac010f474", "score": "0.695085", "text": "def http_response; end", "title": "" }, { "docid": "a70b87fb9875f92d0...
5ca3788a603955dc691a521e2e13015a
Public: The tags assigned to this project, and any tags provided by any plugins operating on this project. Returns an Array of symbols representing the tags on this project.
[ { "docid": "8647443b1ae956b10bf2b77bfa3c432b", "score": "0.78677386", "text": "def all_tags\n (@tags + @plugins.flat_map { |plugin| plugin.class.tags }).map(&:to_sym).uniq\n end", "title": "" } ]
[ { "docid": "56163d23bc897cc748b09c7a13ef9671", "score": "0.80225146", "text": "def tags\n self.lib.tags.map { |r| tag(r) }\n end", "title": "" }, { "docid": "bac7582bcd18a27414a81efcfcb650b4", "score": "0.7692319", "text": "def tags\n self.plugins.keys\n end", "ti...
22fedc2d60716723d2b60a67859c05ba
GET /contract_documents GET /contract_documents.json
[ { "docid": "4642d9e481cd71ac7ffbcc6532fd8529", "score": "0.7813193", "text": "def index\n @contract_documents = ContractDocument.all\n end", "title": "" } ]
[ { "docid": "472e936da3e0e1e38213e29571d0dd90", "score": "0.71171796", "text": "def documents\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}/documents\")[\"envelopeDocuments\"]\n end", "title": "" }, { "docid": "67410aef80410e56b5268806ef994559", "score": "0.69091...
f73ed54f904ea010dc74a78c82cb2a1a
=begin file_to_save = STDIN.gets.chomp file = File.open(file_to_save,"w") if we want to write to a file, we need to open it.
[ { "docid": "de4915132e1f77a9ca6a26c9d7ee1b1d", "score": "0.0", "text": "def load_students(filename = \"students.csv\")\n file = File.open(filename, \"r\") #open file + specify that you're reading it\n file.readlines.each do |line| #read all lines into an array and iterate over it\n name, cohort = l...
[ { "docid": "c569f482eae64e2acd9a318c4cbae371", "score": "0.77447397", "text": "def input_to_file\n\tFile.open('./hello_from_ruby.txt', 'a') do |file|\n\t\tputs 'Enter text'\n\t\tuser_input = gets.chomp.to_s\n\t\tputs 'Save/read/introspect'\n\t\tsave = gets.chomp.to_s\n\t\tif save == \"save\"\n\t\t\tfile...
674640df3fbde0a05f74a7b327155845
Check whether the user has gemd an object.
[ { "docid": "ff9b86c316d12927552be206a03687ad", "score": "0.6282152", "text": "def gems?(obj)\n Recommendable.redis.sismember(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(obj.class, id), obj.id)\n end", "title": "" } ]
[ { "docid": "14e7fc83418ff4231585d639ab05072b", "score": "0.7251369", "text": "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "title": "" }, { ...
1a3ac312c46fd74fbd769b4b8941ba7f
PATCH/PUT /responses/1 PATCH/PUT /responses/1.json
[ { "docid": "1d6b5f99bfa928f2d6242ec69d1e041e", "score": "0.58892244", "text": "def update\n respond_to do |format|\n if @response.update(response_params)\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { render :show, status: :ok,...
[ { "docid": "1f43d3bdc1c01f8ec76abed4ca886162", "score": "0.6909318", "text": "def update!(**args)\n @responses = args[:responses] if args.key?(:responses)\n end", "title": "" }, { "docid": "1f43d3bdc1c01f8ec76abed4ca886162", "score": "0.6909318", "text": "def update!(...
e5b69b257a60f3d497e3d7266731631d
Preferred size of rasterised group icon.
[ { "docid": "428bc8fc3ba5d7827acc3fb83779e2b0", "score": "0.6668433", "text": "def iconsize(value)\n merge(mgiconsize: value.to_s)\n end", "title": "" } ]
[ { "docid": "88dabcbd3c7f0c92d49ab5f4548b4e64", "score": "0.7260227", "text": "def icon_size\r\n 16\r\n end", "title": "" }, { "docid": "4a2fd233716f6e3f1dbe7590e8e1fcaf", "score": "0.6980451", "text": "def icon_size\n options.fetch(:icon_size, 40)\n end", "tit...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e3d19845309d030b48a0803e13f350cb", "score": "0.0", "text": "def compra_params\n params.require(:compra).permit(:fecha, :productos, :bebidas, :estado, :tipo_pedido)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7498391", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958937", "text": "def strong_params\n params.require(:request).permit(param_white...
a60d4811b8d5000363f6c562cfd86251
Returns the value of the `virtual_functions_configuration` attribute.
[ { "docid": "ab643522d73952edd3097e6102db725f", "score": "0.83319086", "text": "def virtual_functions_configuration\n @virtual_functions_configuration\n end", "title": "" } ]
[ { "docid": "482f9c09cd3b560c0468235b27efb2bd", "score": "0.65104735", "text": "def virtual_functions=(value)\n @virtual_functions = value\n end", "title": "" }, { "docid": "ff5f8637347840e6d7ad672a5089cfca", "score": "0.60246253", "text": "def virtual_functions\n @virtua...
e4433ae7bcc6b763e6bbb8fa44d44012
Do we have both players answers locked in? do a unit test for what waiting and not waiting looks like
[ { "docid": "7ac6d7a1992828531c9811f75ef367ec", "score": "0.65321785", "text": "def status\n if player_1_hand == nil && player_2_hand == nil\n return \"input\"\n elsif player_1_hand == nil || player_2_hand == nil\n return \"waiting\"\n else\n \"complete\"\n end\n end", "tit...
[ { "docid": "22e909dff5da6ba2ae17d741b5797a6a", "score": "0.7013092", "text": "def waiting?\n status == PENDING && player2_id.nil?\n end", "title": "" }, { "docid": "a089b674edb5bd4432302ce75d6f3557", "score": "0.68997926", "text": "def waiting?\n !checked_in?\n end", "tit...
f82198e15f4145e70157d5819d4217ac
POST /explores or /explores.json
[ { "docid": "14f7fe1ad752b9f3ccf885c136bcb71a", "score": "0.0", "text": "def create\n @explore = Explore.new(explore_params)\n @explore.user_id = current_user.id\n @explore.photo.attach(params[:explore][:photo])\n\n respond_to do |format|\n if @explore.save\n format.html { redirec...
[ { "docid": "b3ffb49259341f7d5b0392850d591997", "score": "0.5892773", "text": "def expire_json1\n expire_action :json1 #action: :index, format: :json\n head :ok\n end", "title": "" }, { "docid": "d689949e845b657dc19715238d951ea3", "score": "0.57963896", "text": "def http_post_d...
57cee6ed3e9199d9755dc6a0c995fb3e
GET /api/v1/comments/1 GET /api/v1/comments/1.json
[ { "docid": "5f354bb47ba40509b011e3bce27f1fff", "score": "0.79466426", "text": "def show\n @api_v1_comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_comment }\n end\n end", "title": "" } ]
[ { "docid": "4447c95fefbb72f8a378ce8a783a58da", "score": "0.7719101", "text": "def comments\n Sifter.\n get(api_comments_url).\n fetch(\"comments\", []).\n map { |i| Sifter::Comment.new(i) }\n end", "title": "" }, { "docid": "43e1018e94df0e7d6ab78621c98262cd", "score": ...
32c732ed05a7d8731ab936e504a939d1
Test if a user can be destroyed with success.
[ { "docid": "a06ee4f9ae9d80a691dfe755f97a1dff", "score": "0.0", "text": "def test_should_destroy_user\n an_user = users(:admin)\n an_user.destroy\n assert_raise(ActiveRecord::RecordNotFound) {\n User.find(an_user.id)\n }\n end", "title": "" } ]
[ { "docid": "0ccaf1d0f88cc8f32ae745da1df1fb33", "score": "0.7660566", "text": "def allow_user_destroy?(user)\n # For now, nobody can destroy users as it is rather destructive\n return false\n end", "title": "" }, { "docid": "62f9429c9d9ce98c9c459056cac9f883", "score": "0.73753905",...
a27726ee4177a9f00ba43127fcdf45f8
PATCH/PUT /adminagentfamilies/1 PATCH/PUT /adminagentfamilies/1.json
[ { "docid": "88ba1167ba22bf8fbc5dc76ea7cbcfca", "score": "0.693938", "text": "def update\n respond_to do |format|\n if @adminagentfamily.update(adminagentfamily_params)\n format.html { redirect_to @adminagentfamily, notice: 'Adminagentfamily was successfully updated.' }\n format.jso...
[ { "docid": "8d17a6c04f6b25e52d1e987e3376c4b3", "score": "0.639902", "text": "def set_adminagentfamily\n @adminagentfamily = Adminagentfamily.find(params[:id])\n end", "title": "" }, { "docid": "2b52c2d6d57f997e7d861d3efad15a57", "score": "0.615813", "text": "def update\n r...
f813c9e62213a28c79e91546da90ab91
GET /threats GET /threats.json
[ { "docid": "75979aac5abef0511edaba2c8bf00097", "score": "0.7305039", "text": "def index\n @threats = Threat.all\n end", "title": "" } ]
[ { "docid": "fdd46b75894ef1c67a91a95d929242cb", "score": "0.69447887", "text": "def index\n @goats = Goat.all\n\n render json: @goats\n end", "title": "" }, { "docid": "ec0b23afb9d9bc3fde2779a5d7f8959c", "score": "0.68139863", "text": "def index\n @chats = Chat.all\n rend...
57582837252db90d2422d92386d4b875
GET /lexicon_groups GET /lexicon_groups.json
[ { "docid": "d8f9e136cef1a53f14772cc28028bab0", "score": "0.7705594", "text": "def index\n @lexicon_groups = @current_user.lexicon_groups.page params[:page]\n end", "title": "" } ]
[ { "docid": "4dcab50fb0459e2dd12cee6e02368124", "score": "0.68762934", "text": "def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bear...
1a2da19b5e272635e2310024f1786ad1
Find areas by bounding box. Called (Ajax) by map move event.
[ { "docid": "c5e191662b0366b2f527830b7e00b1d5", "score": "0.64700085", "text": "def find\n set_user_and_user_areas\n @areas = Area.find_all_by_geom([[params[:min_y], params[:min_x]], \n [params[:max_y], params[:max_x]]])\n @map = Variable.new(\"map\")\n end", "...
[ { "docid": "2abd3dab94314c3f7daab88d4dcf9875", "score": "0.6527285", "text": "def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end", "title": "" }, { "docid": "92e9cbf371bb43f20475904da3d956b9", ...
22343dd0a1568a816db7aec84b415aa2
Util function to build the JSON array to post the request to WAF.
[ { "docid": "79de48fe2a6547f704ee350c33c4b8d4", "score": "0.0", "text": "def message(object, method)\n opts = object.to_hash\n opts.delete(:provider)\n opts.delete(:ensure)\n opts.delete(:loglevel)\n\n opts.delete(:certificate) if method == 'PUT'\n\n #\n # Munge customer's manifest ...
[ { "docid": "5f63b396364db37d280224e5486df44a", "score": "0.66493595", "text": "def build_post_data request\n data = {\n \"clientID\" => client_id,\n \"ts\" => Time.now.to_i.to_s,\n \"verify\" => verify_string(request),\n \"type\" => \"json\"\n ...
712b89afe2b700397b56293509b2e463
GET /tournament_firsts GET /tournament_firsts.json
[ { "docid": "7bc70dc96bfb915e9a818b0d91604644", "score": "0.7237487", "text": "def index\n @tournament_firsts = current_user.tournament_firsts.order(\"id\")\n end", "title": "" } ]
[ { "docid": "e06fbfb0cf14f2b35774e861cba85b1c", "score": "0.6584429", "text": "def set_tournament_first\n @tournament_first = TournamentFirst.find(params[:id])\n end", "title": "" }, { "docid": "f54c438d2f5ab345582779bc9e84b4fd", "score": "0.6317999", "text": "def create\n ...
0040ea8aecb6931f347122933ff54efe
API endpoint to the Offers API call
[ { "docid": "718d5c33963e8357816ce62d5fb3ed70", "score": "0.6009486", "text": "def offers_url\n offers_url_part = \"/feed/v1/offers.json\"\n \"#{@@base_url}#{offers_url_part}?#{req_attributes}\"\n end", "title": "" } ]
[ { "docid": "bf8c785e716ac546f6e20bc66bf144a2", "score": "0.70462376", "text": "def endpoint\n 'https://api.bufferapp.com/1/'\nend", "title": "" }, { "docid": "c6163bd7e4e5188e65863a98b29acc70", "score": "0.66142046", "text": "def endpoint; end", "title": "" }, { "docid":...
5c8ea9dc9a5e4b540020b01608c37146
Test that the object returned by model is actually a Sketchup::Model
[ { "docid": "671a569065005591109bafec2efcf98c", "score": "0.68481445", "text": "def test_model_class_name\n erase_all()\n model = Sketchup.active_model\n edge = model.entities.add_line([0,0,0], [100,100,100])\n assert_equal(edge.model.class.to_s, \"Sketchup::Model\",\n 'Failed...
[ { "docid": "0fdcebb8d560fa58752452c56762207f", "score": "0.8585694", "text": "def test_model_returns_model_obj\n obj = Sketchup.active_model.selection\n model_obj = obj.model\n result = model_obj.class\n expected = Sketchup::Model\n assert_equal(expected, result, 'Expected does not match ...
2d243e9ee547d47a4df9b7dc701f60ca
Converts a REXML::Document with element into a true or false value.
[ { "docid": "02eef7de75d9357cc1d6f721386402fd", "score": "0.7403052", "text": "def boolean_to_true_false(xml_doc)\n string_to_true_false(xml_doc.root.elements[1].text)\n end", "title": "" } ]
[ { "docid": "ceebbedbc2cca429d75a6a82a352beef", "score": "0.753006", "text": "def xml_to_bool(node, xquery = nil)\n n = xquery ? node.xpath(xquery, ns).first : node\n return if n.nil?\n n.to_s == \"true\"\n end", "title": "" }, { "docid": "7ac51284bd27749ccec003d43f888f25", ...
16d21795bea5fadfe863819135ee7d5a
Sets the value of the `system_locale` attribute.
[ { "docid": "930f6c969ab20693d7d7b9db3c48d593", "score": "0.91050655", "text": "def system_locale=(value)\n @system_locale = value\n end", "title": "" } ]
[ { "docid": "9bf1c0ec52976216c9d91dc3e18d6d59", "score": "0.8079135", "text": "def set_system_locale\n if windows?\n # Sets the system locale for the current computer.\n # @see https://docs.microsoft.com/en-us/powershell/module/internationalcmdlets/set-winsystemlocale\n ...
d7db440a1bc10f98f3d5c01e43339643
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json
[ { "docid": "c4250827bc73c977070a2a8b9c75ca47", "score": "0.0", "text": "def update\n authors=params[:book][:author_book_ids]\n\n respond_to do |format|\n if @book.update(book_params.except(:author_book_ids))\n @book.authors.delete_all\n if authors.present?\n authors.each ...
[ { "docid": "14e83361af7c6352a945eed0a3cccad2", "score": "0.7059103", "text": "def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end", "title": "" }, { "docid": "4c970020715250be770177427135ee49", "score": "0.6981991", "te...
bd459d41decf40119a571276d8be7518
promps player for input
[ { "docid": "16db7c1d971a3579f61c2bb6684ebda7", "score": "0.0", "text": "def dealornodeal\n\t\t@output.puts \"Reply Y if you want to take the offer or N if you do not.\"\n\tend", "title": "" } ]
[ { "docid": "86158832846163a8d3a1f36766533a12", "score": "0.6846502", "text": "def perform\n ask_player_name\n select_player\n end", "title": "" }, { "docid": "87333a6d6f30b0f0c6041637d523706f", "score": "0.67582273", "text": "def prompt_players\n if @mode == '2p'\n pri...
79bc31806b717480fd47664420ebcedb
the server is getting the data and displaying on the webpage
[ { "docid": "d911f5ccacc9803eac626c557db754ca", "score": "0.0", "text": "def get_completed_tasks\n @db.execute( \"SELECT title, completed_at FROM tasks;\" )\n end", "title": "" } ]
[ { "docid": "530f434e5a0f1e4222a4de5fe4e48325", "score": "0.66380996", "text": "def accl_data\n @response = HTTParty.get(\"http://192.168.20.30/machine/data\")\n render json: @response\n end", "title": "" }, { "docid": "adfeb1e5d8b1dd440be72780ca9a9b99", "score": "0.64232...
450907841c9828363a766ba5246a8189
Define ACL policy for this group via a block. Any containers/groups/etc. referenced in the block with have this group added to the ACEs specified in the +ace_types+
[ { "docid": "226858d7784f33267eaacd230b3e19cf", "score": "0.7465008", "text": "def have_rights(*ace_types) # yields acl_policy\n debug(\"* Adding #{group_name} group to ACEs:\")\n acl_policy = AclPolicy.new(ace_types, group_name, org_objects, @authz_id_mapper)\n yield acl_polic...
[ { "docid": "825716aedefafe927bb1814c5c8eaf76", "score": "0.60257536", "text": "def add_restriction(name, condition, &default_block)\n @ACL ||= AccessControlList.new\n @ACL.add_restriction(name, condition, default_block)\n end", "title": "" }, { "docid": "74b245bc1f4c986044c702a4ce082e...
9c66a78dc2bcf4778b49b96d13fc3e2f
Return the search term for the given id, or nil
[ { "docid": "b9bedd95d1f2ecae68cde1b0e9fbaa4f", "score": "0.76038414", "text": "def search_term( search_id )\n param( search_id.sym )\n end", "title": "" } ]
[ { "docid": "91ccb7478d36a45376b9485b89a79c06", "score": "0.7332931", "text": "def find_term_by_internal_id(id)\n results = self.find_terms_where({internal_id: id}, 1)\n return results.length == 1 ? results.first : nil\n end", "title": "" }, { "docid": "e902fbf20c8899ece626d9871564da92...
5f2d2ca7794ace4f5622f7320b16e91d
def check_input() This method checks the page and returns a true if the specificed error message is in a span element following the id
[ { "docid": "b644f17736bdbc19869cf2de22f4e331", "score": "0.68518966", "text": "def chk_for_error_message?(id, message)\n return false unless (res = first(\"##{id} + span.help-block\"))\n res.has_text?(message)\n end", "title": "" } ]
[ { "docid": "aaaf8193c3660897978626577d12b4e3", "score": "0.696854", "text": "def username_email_error_div\n page.has_selector?(EMAIL_MESSAGE_DIV)\n end", "title": "" }, { "docid": "fc3299fbe5842bbbcf18ca00b7eb9155", "score": "0.68610173", "text": "def check_input\n ret = \"\...
29b3938b11b6d58ab2ed75787453d619
Finds the length of a Collatz Sequence without building it
[ { "docid": "ae73fc876d6b874e47edff84dcac84e8", "score": "0.75441283", "text": "def collatz_length(number)\n raise 'Loop detected!' if @start == number && number != 1\n\n return @memory[number] if @memory.key?(number)\n\n @memory[number] = collatz_length(next_collatz_number(number)) + 1\nend", "ti...
[ { "docid": "c7c4cd01632174887e3c9e238bc54022", "score": "0.81633896", "text": "def collatz_length\n return 0 if self < 1\n \n len = 1\n val = self\n\n while 1 != val\n val = (1 == val & 1) ? 3*val + 1 : val >> 1\n len += 1\n end\n \n len\n end", "title": "" }, { ...
5911e1e6797de95479b0ab0629d1a960
POST /flowlists POST /flowlists.xml
[ { "docid": "83b213bb1a2793fd5f01efdeb3a20f35", "score": "0.7087403", "text": "def create\n @flowlist = Flowlist.new(params[:flowlist])\n\n respond_to do |format|\n if @flowlist.save\n format.html { redirect_to(@flowlist, :notice => 'Flowlist was successfully created.') }\n forma...
[ { "docid": "9823664598bcc265e5fa94e3cb3ae798", "score": "0.6452291", "text": "def create(params)\n post('lists', params)\n end", "title": "" }, { "docid": "ad05d6d204c5f396d02afca7571df2f4", "score": "0.62850225", "text": "def create\n @task_list = TaskList.new(params[...
4c630f17bd4b9c3f9776480f44fff3e6
GET /advices/new GET /advices/new.xml
[ { "docid": "4ffdd795ac5595c39057b3b7bdab3006", "score": "0.7363735", "text": "def new\n @advice = Advice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advice }\n end\n end", "title": "" } ]
[ { "docid": "7b80b3642f9d02b74dc808533500c359", "score": "0.71968937", "text": "def new\n @advertise = Advertise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advertise }\n end\n end", "title": "" }, { "docid": "d4d8bef1b1a0864...
4a83e1b20a611e77572fca6ab3ff5046
GET /stalls or /stalls.json
[ { "docid": "9506fdb617ed2d6f555e3cec9a8add27", "score": "0.6097713", "text": "def index\n @stalls = Stall.all\n\n @stalls = @stalls.where([\"stall_name LIKE :filter\", :filter => \"%\" + params[:filter] + \"%\"]) unless params[:filter].blank?\n\n @stalls = @stalls.order(:stall_name).page(params...
[ { "docid": "f7618424ac79b2f3304a7c7d94c59589", "score": "0.70666844", "text": "def index\n @stalls = Stall.all\n end", "title": "" }, { "docid": "f7618424ac79b2f3304a7c7d94c59589", "score": "0.70666844", "text": "def index\n @stalls = Stall.all\n end", "title": "" }, ...
20152f4d12457f1bace5449bf3c1245d
Runs the input on the machine and returns a Hash describing the machine's final state after running.
[ { "docid": "5fce913a9b131be5d3ac1c9787b1a202", "score": "0.0", "text": "def feed(input)\n head = @start.to_s\n input.each_char { |symbol| head = @transitions[head][symbol] }\n accept = is_accept_state? head\n resp = {\n input: input,\n accept: accept,\n head: hea...
[ { "docid": "730ae434aeee08a40ac18dd56a352dd3", "score": "0.61794484", "text": "def hash\n state.hash\n end", "title": "" }, { "docid": "730ae434aeee08a40ac18dd56a352dd3", "score": "0.61794484", "text": "def hash\n state.hash\n end", "title": "" }, { "docid...
f576a254f736fcbad333e9283f9c7d1f
first of all, have a method to calculate everything to be used throughout the program
[ { "docid": "88de677ea233f2320f42ed73609a4a50", "score": "0.0", "text": "def calculatetotal(cards) # calculating the total of the two cards dealt, first to player then to dealer\n array = cards.map {|card| card[0]} # using the map method to lay out all the cards which are like so [[\"A\", \"S\"], [\"5\"...
[ { "docid": "50f3733b42b7b058f267c783cd6c6dd0", "score": "0.76157105", "text": "def calculated; end", "title": "" }, { "docid": "3b1962cf22cc05aa1f568f6aeaa3544f", "score": "0.75570273", "text": "def calculation\n end", "title": "" }, { "docid": "434dbd999d83021e27104533b...
9b20155248f7cf8150ff5b3eda54c788
Turn the filter hash into an array of strings in the format key:"value"
[ { "docid": "571103e7752f3b82a1aabef7486ac421", "score": "0.65287423", "text": "def parsed_search_filter\n filter = @search_options[:filter]\n filter = {} unless filter.is_a?(Hash)\n filter.symbolize_keys!\n filter.map do |k, v|\n if v.is_a?(Array)\n # OR together mult...
[ { "docid": "081ec52d3ee9fd54f2c39cba5377a646", "score": "0.68027353", "text": "def reformat(data)\n filtered_keys = Rails.application.config.filter_parameters.map{|x| x.to_s}\n result = []\n data.each do |k,v|\n if filtered_keys.include?(k.to_s)\n v = '[FILTERED]'\n ...
4e32b800220d257dab4412528eadeacb
See RFC4511 Section 4.1.9
[ { "docid": "61aa8f244e60bacbddb0be88fdf2d77c", "score": "0.0", "text": "def create_ldap_result\n result = [\n OpenSSL::ASN1::Enumerated.new(RESULT_CODE[@result]),\n OpenSSL::ASN1::OctetString.new(@matched_dn),\n OpenSSL::ASN1::OctetString.new(@diagnostic_message...
[ { "docid": "b1bedaff86551313f56476362dd8f506", "score": "0.8239029", "text": "def rfc2822; end", "title": "" }, { "docid": "b1bedaff86551313f56476362dd8f506", "score": "0.8239029", "text": "def rfc2822; end", "title": "" }, { "docid": "a5a290f6112120ef1b85ad284fd055e7", ...
8d460ad8cd08d815bdfc3a786b237e08
GET /sys_msgs GET /sys_msgs.json
[ { "docid": "f4989e89531b59f6e4df252e5b943798", "score": "0.6356505", "text": "def index\n @sys_msgs = SysMsg.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "title": "" } ]
[ { "docid": "dbc96cdcfe96d0a5cfff134d321e521f", "score": "0.6670166", "text": "def messages\n get_data('/messages')\n end", "title": "" }, { "docid": "f6f632d183f786fd8309534fd9dd64cb", "score": "0.6341819", "text": "def msgs\n data['msgs']\n end", "title": "" }, {...
d86bd4f5abced37b123f57f82fbe3a96
POST /personas POST /personas.json
[ { "docid": "2e09e4ee8e5afc829e308cdb3a82e882", "score": "0.6754367", "text": "def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'la Persona fue creada exitosamente.' }\n format.json {...
[ { "docid": "186d7eb40069b62dabf3514b2688036c", "score": "0.7360205", "text": "def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n e...
30407ade74c73d15638da06e31f047d3
Words are any sequence of nonblank characters. You may assume that the input String will always contain at least two words. =begin Understanding the problem input is a string of minimum two words output is word next to last word Examples: penultimate('last word') == 'last' penultimate('Launch School is great!') == 'is'...
[ { "docid": "8a294847476469adbf033bf274398eed", "score": "0.0", "text": "def penultimate(string)\n string.split.slice(-2)\nend", "title": "" } ]
[ { "docid": "34edf0354190fa205733158f951796d8", "score": "0.79044116", "text": "def penultimate(string)\n \n string_array = string.split(\" \")\n number_of_words = string_array.size\n \n return string if string.empty?\n \n if number_of_words == 1\n return string\n elsif number_of_words == 2\n ...
e38364fe13ce0e8d12b9b5dbf1664a94
Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes 2.bytes => 2
[ { "docid": "cd89d69b19c10515e73e70b30752a6bc", "score": "0.0", "text": "def bytes\n self\n end", "title": "" } ]
[ { "docid": "f666a03dab2811b4860f9a1257542db9", "score": "0.75260526", "text": "def exabytes; end", "title": "" }, { "docid": "6980af180368519363e7312f3b904002", "score": "0.74961793", "text": "def petabytes; end", "title": "" }, { "docid": "c84fb120febf77a37e8f101e380b3a7...
9444792d56572dbbc3bfd4abab0d468b
GET /sites/1 GET /sites/1.json
[ { "docid": "6b64b6eb02bbb0bd68e9b4459dacd389", "score": "0.0", "text": "def show\n @site = Site.find(params[:id])\n respond_to do |format|\n format.js\n format.html\n end\n \n end", "title": "" } ]
[ { "docid": "85f624b9ca21e24fec1a59dafa0c20e1", "score": "0.7546538", "text": "def index\n @sites = Site.all\n render json: @sites\n end", "title": "" }, { "docid": "1c578611b1fd3d62e827e901deee1799", "score": "0.7469465", "text": "def index\n @sites = Site.by_user(current_u...
4a24ffd65f5478ccd10ddb5764a547b7
MPD often sends data as: id: 1 title: some title id: 2 title: another title So this method comes useful.
[ { "docid": "377541df4d8f38fe6e9b789f94612dff", "score": "0.0", "text": "def key_value_pairs\n content.split(\"\\n\").map do |line|\n index = line.index(':')\n raise \"can't create key-value pair\" unless index\n key = line[0...index]\n value = line[(index + 1)..-1].strip...
[ { "docid": "59c225c5d072ee3c6503e1dc01431902", "score": "0.5935236", "text": "def id\n data[:id]\n end", "title": "" }, { "docid": "186f22693ba1e7ca10c8bfa9a3b6b50b", "score": "0.5880108", "text": "def id\n @data[\"id\"]\n end", "title": "" }, { "docid": "aff60600...
c53ca8150ba51810d29ddd7d037228fa
def profile_page if cms_page = CmsPage.where(id: self.default_cms_page_id).first return user_cms_page_path(self, cms_page) else return user_path(self) end end
[ { "docid": "67fe39de8fabc5e3f385ea646b4abcb5", "score": "0.0", "text": "def avatar_url(user)\n if user.avatar_url.present?\n user.avatar_url\n else\n default_url = \"#{root_url}images/guest.png\"\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com...
[ { "docid": "6f51c48b258615de7eb5b6de5772b9ee", "score": "0.71156764", "text": "def current_user_profile_path\n profile_path(id: current_user.id,\n first: current_user.first_name.downcase,\n last: current_user.last_name.downcase)\n end", "title": "" }, { "d...
673304d615e0f72155d832e008c84ce9
account management is purely on my projects
[ { "docid": "c1a78e7386cf29fbf81b0adc33949347", "score": "0.0", "text": "def envisage_price\n 0\n end", "title": "" } ]
[ { "docid": "9f4cd274f4684aa6e1b7dcc441637146", "score": "0.7672745", "text": "def account; end", "title": "" }, { "docid": "9f4cd274f4684aa6e1b7dcc441637146", "score": "0.7672745", "text": "def account; end", "title": "" }, { "docid": "a9b838f7c793f360703189469f3766ac", ...
d8d59975a7affe7204c6074f009e1b51
GET /loads/1 GET /loads/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "6c5d4fb54310077d44474b6342562dd7", "score": "0.7110074", "text": "def load()\n response = RestClient.get @host + \"/load\", { :accept => :json }\n return JSON.parse(response.body)\n end", "title": "" }, { "docid": "5a7ba514be2c1dccf266ea0b3b1d63cb", "score": "0.6377318...
611a4390c39cdb526c57568c9014a104
GET /my_games GET /my_games.json
[ { "docid": "784b0af244cba09a54d773a0f0649fbe", "score": "0.7056081", "text": "def index\n @my_games = MyGame.all\n end", "title": "" } ]
[ { "docid": "85856bc46f4dea8143554ac5bddfa804", "score": "0.7872967", "text": "def index\n @mygames = Mygame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mygames }\n end\n end", "title": "" }, { "docid": "5068a0ca27ae23b1d0625...
ceb9fe5456ddb3dcd64f9a73400a8157
Record that the asset has been disposed. This updates the dispostion date and the disposition_type attribute on the master record. It also sets the ServiceStatusType to 'disposed' If the user removed the disposition event, the master record is reset by removing the disposition type, disposition date and setting the ser...
[ { "docid": "2bb101f3a157619d867476a070e23402", "score": "0.6767999", "text": "def record_disposition\n Rails.logger.info \"Recording final disposition for asset = #{object_key}\"\n\n # Make sure we are working with a concrete asset class\n asset = is_typed? ? self : Asset.get_typed_asset(self)\...
[ { "docid": "19f8cc58d0bd9941dea7c05a89f8a060", "score": "0.7151449", "text": "def disposed disposition_type=nil\n asset = is_typed? ? self : Asset.get_typed_asset(self)\n\n is_disposed = asset.service_status_type == ServiceStatusType.find_by(:code => 'D')\n\n unless disposition_type.nil?\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.0", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
3c0cea336c723962096a695126867d0f
Provide a detailed, user friendly representation
[ { "docid": "5dd150a4d2a8318e6d5d2114668176cf", "score": "0.0", "text": "def inspect\n \"<Twilio.Api.V2010.TollFreeInstance>\"\n end", "title": "" } ]
[ { "docid": "7bea0b559c41a5f338754e1c5f53f1cb", "score": "0.7074551", "text": "def details \n\t\t\"#{self.id} - #{self.name.capitalize}\"\n\tend", "title": "" }, { "docid": "6143c330d598497e31bfa9b9f780219e", "score": "0.7009431", "text": "def detail\n\t\t\t\to = ''\n\t\t\t\to += \" ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "1a451f301a48c9b7929c4566a1c757dc", "score": "0.0", "text": "def expense_tracker_params\n params.require(:expense_tracker).permit(:year, :month, :income, :grocery, :mortgage, :gas, :shopping, :restaurant, :utilities, :other, :notes)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
4b76401b66000f72c52b9feb79c6aa44
return a symbol, either :include, :exclude or :exclude_and_yield, :include_and_yield or :yield (let next filter decide)
[ { "docid": "8bd2480b76684e92bbcb741eb3d6362b", "score": "0.6038339", "text": "def rule_allow_action(name)\n include_rules = self[:include].rule_list\n \n if !include_rules.blank?\n res = include_rules.matches_any?(name)\n return :include if res\n end\n exclude_rules = self[:...
[ { "docid": "568878880d3e204a460a92cf05f3ea58", "score": "0.6117834", "text": "def filter_generator\n end", "title": "" }, { "docid": "d699018ed6dada655297b9cd5e0cef73", "score": "0.5841131", "text": "def inclusion_filter; end", "title": "" }, { "docid": "22a719d671b3bd41...
a2a71e4ceb09cb25a014d9bb713b7146
`Userallergens` should return all of the ingredients this user is allergic to
[ { "docid": "8f4670dcf2f3ca7fa6b3b7fab0d1170d", "score": "0.71248686", "text": "def allergens\n self.allergy.map do |allergen|\n allergen.ingredient\n end.uniq\n end", "title": "" } ]
[ { "docid": "5f4909236b6b04cb547a831c77f3cc5e", "score": "0.8266924", "text": "def allergens\n users_allergens = Allergen.all.select { |allergen| allergen.user == self}\n users_allergens.collect {|allergen| allergen.ingredient}\n end", "title": "" }, { "docid": "394762ea6f19a6f8e85c6b6...
0ba3c8aef14a3376834914fac3c9eca9
GET /customersessions/1 GET /customersessions/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "c6ae5c32e8ab897d00cfa41f705920a0", "score": "0.7168473", "text": "def index\n @customersessions = Customersession.all\n end", "title": "" }, { "docid": "42194bc75e242f0aaae191723b459bcf", "score": "0.6497178", "text": "def set_customersession\n @customersession =...
fa5bfb75509eac8b80cfdcaf1ae06992
This is the offset from the top of the stack where this local variable lives. source://syntax_tree//lib/syntax_tree/yarv/local_table.rb84
[ { "docid": "9600a284c3d7437a52af86b144b7ed9c", "score": "0.0", "text": "def offset(index); end", "title": "" } ]
[ { "docid": "d41d57aa42a9ec3e1a4e3475871e1f45", "score": "0.6598943", "text": "def local_header_offset; end", "title": "" }, { "docid": "29d55578d39b53d4d531eefc315c27c6", "score": "0.6595641", "text": "def local_header_offset=(_arg0); end", "title": "" }, { "docid": "8fdd...
f93d96cdfc599e45a7436d955a326071
adds output requests ahead of EnergyPlus simulation
[ { "docid": "2dfe82519b485cc04352713cba451418", "score": "0.67173743", "text": "def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n result = OpenStudio::IdfObjectVector.new\n\n # use the built-in error checking\n # unless runner.validateUserArguments(argum...
[ { "docid": "129dba9341bd9f7fa03867f939b82780", "score": "0.7293903", "text": "def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n # get the last idf (just used for building name)\n workspace = runner.lastEnergyPlusWorkspace\n if workspace.empty?\n ru...
7e9277428af2830a831a67455fef355e
block_fork hard coded needs work
[ { "docid": "62e21d16f808cee6351498f3bbd2a172", "score": "0.0", "text": "def block_fork(board)\n if board.cells[0] == opponent_token && board.cells[8] == opponent_token\n return 2\n end\n if board.cells[2] == opponent_token && board.cells[6] == opponent_token\n return 2\n end\n i...
[ { "docid": "8f525a6100cfa13b19df1ac78aeb7214", "score": "0.7689432", "text": "def before_fork(&block); end", "title": "" }, { "docid": "32710dac0cd3c4ffe5d57f5584142227", "score": "0.73162097", "text": "def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend", "title": ""...
c2827689f6acc3c41990eebe8af9a29a
Look for a user's managing role and add filters for all admin sets that have permission templates that include managing roles. rubocop:disable Metrics/MethodLength rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity
[ { "docid": "280713d5d2567c4d8d9ea0733973edfb", "score": "0.6383746", "text": "def add_managing_role_search_filter(ability:, search_terms: [])\n search_terms ||= []\n # Look for managing role assignement\n managing_role = Sipity::Role.find_by(name: Hyrax::RoleRegistry::MANAGING)\n ...
[ { "docid": "cc943bd03b7d18ef791af64c359c4549", "score": "0.6569868", "text": "def admin_permissions(role)\n # If user is the overall web admin, give them the appropriate permissions,\n # Same for univerity admin\n if role == 'Website Admin'\n web_admin_permissions\n elsif role == 'Unive...
b45357e35923f36174ba3d026229d566
Find by identity_card, if identity_card presents. And staff name should match. find_staff(salary_table: salary_table, name: name) find_staff(salary_table: salary_table, name: name, identity_card: identity_card)
[ { "docid": "13c4e66c2f913be32a3e2a2e593597c9", "score": "0.750906", "text": "def find_staff(salary_table:, name:, identity_card: nil)\n staffs = salary_table.normal_corporation.normal_staffs\n\n if identity_card.present?\n staff = staffs.where(identity_card: identity_card).first\n ...
[ { "docid": "c9f7c742005445ecf5c79b9cacb80fdd", "score": "0.6648436", "text": "def find_by_names_and_company(card)\n conditions = find_by_names_and_company_conditions(card)\n if conditions[:organization]\n return nil unless organization = Organization.find_by_name(conditions.delete...
6137ed2b6e78ff40b76370c9c4c95b3f
Initializes a bind handler and adds the options common to all bind payloads, such as local port.
[ { "docid": "b5737b5de24c9799624561444c8a35ff", "score": "0.6447875", "text": "def initialize(info = {})\n\t\tsuper\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::LPORT(4444),\n\t\t\t\t#OptAddress.new('RHOST', [false, 'The target address', '']),\n\t\t\t], Msf::Handler::BeEFBind)\n\tend", "title": "" ...
[ { "docid": "74087e495162033b14f9b088efae664f", "score": "0.72287095", "text": "def configure_socket(options, env)\n bind = request_options(env)[:bind]\n return unless bind\n\n options[:bind] = {\n host: bind[:host],\n port: bind[:port]\n }\n ...
ed1a89a70d907af43f8fe08e2027df86
DELETE /relatorios/1 DELETE /relatorios/1.xml
[ { "docid": "7c0b52ae7f439c3fdd013770d08cd58c", "score": "0.6344279", "text": "def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_with @relatorio\n end", "title": "" } ]
[ { "docid": "a16b20cfba28a29ec6fc003a1d2fc660", "score": "0.6906503", "text": "def destroy\n @rel = Rel.find(params[:id])\n @rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(rels_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid":...
04b4ec1b1f3c5300b3749ce47a5f0409
Returns plain text body of email message
[ { "docid": "81f78a690da307be86657ecf4598a45b", "score": "0.0", "text": "def plain_text_body\n fail NotImplementedError\n end", "title": "" } ]
[ { "docid": "f790bf93607503da40c085bc885cc8e3", "score": "0.8518779", "text": "def body\n # TODO: unique_body?\n email_message.body.to_s\n end", "title": "" }, { "docid": "5be8c279fcb9cff6274e5eea24a42eb2", "score": "0.8398723", "text": "def plain_text_body\n message.plain_t...
6c4c266eb0d708de07a8af484c247ff2
function to choose a date
[ { "docid": "61ac28f523e35268e2194a55f4a7d753", "score": "0.6235554", "text": "def chooseData(noOfDayFromCurrentday=1)\n date = Date.today + noOfDayFromCurrentday\n targetDate = date.strftime('%d').to_i\n targetMonth = date.strftime('%B')\n targ...
[ { "docid": "f75e46dd79e6befb230f308dd3c8b0d6", "score": "0.7798731", "text": "def select_date\n date = $prompt.select(\"When did you incur this expense?\") do |menu|\n menu.choice \"Today\"\n menu.choice \"Yesterday\"\n menu.choice \"Further back in time\"\n ...
349a07c8e049751145f5bd7db2e1e1c0
method to initialize the characteristics
[ { "docid": "de3a8a35716152d0e74e8c44cf095de2", "score": "0.0", "text": "def initialize(name, founder, age)\n @name = name\n @founder = founder\n @age = age\n end", "title": "" } ]
[ { "docid": "0410377fc94787eb5c2d8bab2a5e9952", "score": "0.7007716", "text": "def initialize(record)\n attributes = record.split #here we are using the .split method to split the string of characteristics\n @name = attributes[0] #setting name to index position 0, and so on..\n @gender = attributes...
2565bd21938ac27da120dca06fefaea1
Find all http mappings registered on given tenant. Number of http mappings can be limited by providing :protocol options (:http or :https).
[ { "docid": "d59ed2ee7b17260e96ca308b240e41b9", "score": "0.63559693", "text": "def find(options = {})\n find_hsh = { tenant: @tenant }\n find_hsh[:application_protocol] = options[:protocol] if options[:protocol]\n\n HttpMapping.where(find_hsh)\n end", "title": "" } ]
[ { "docid": "7ed331d7b6be772807052e162fbd2689", "score": "0.57274437", "text": "def fetch_tenant_urls(tenant)\n tenant_urls = {}\n tenant_envs = obtain_tenant_environments\n tenant_envs.each do |envname|\n mysql_connect = mysql_api_connect(envname)\n client = mysql_conne...
eeda592f57615d519043c16f4e05982a
Convert to RFC8345 topology data
[ { "docid": "35421c5d0b499ce6b8bc24da513a3411", "score": "0.52735215", "text": "def topo_data\n {\n 'description' => @description,\n 'flag' => @flags\n }\n end", "title": "" } ]
[ { "docid": "f1ce3a89044b62e630f94fbf4415907d", "score": "0.6037806", "text": "def topo_data\n {\n 'description' => @descr,\n 'maximum-frame-size' => @max_frame_size,\n 'mac-address' => @mac_addr,\n 'eth-encapsulation' => @eth_encap,\n 'port-vlan-id' =>...
95d3b4768c434b4834f26f7582572173
Update the NSX Manager's Search Domains Modifies the list of domain names that the NSX Manager node uses to complete unqualified host names. If DHCP is configured, this method returns a 409 CONFLICT error, because DHCP manages the list of name servers.
[ { "docid": "db04195b044993036af0883e6b6c2344", "score": "0.586361", "text": "def update_node_search_domains(node_search_domains_properties, opts = {})\n data, _status_code, _headers = update_node_search_domains_with_http_info(node_search_domains_properties, opts)\n return data\n end", "...
[ { "docid": "3191c4787bfa1ac92fda2edc7bf2e14e", "score": "0.64233035", "text": "def update!(**args)\n @dns_search_domains = args[:dns_search_domains] if args.key?(:dns_search_domains)\n @dns_servers = args[:dns_servers] if args.key?(:dns_servers)\n @ntp_servers = args[:ntp_serv...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "9a88a0068e1e4ebb59e0af789f00b934", "score": "0.0", "text": "def update!(**args)\n @alarm = args[:alarm] if args.key?(:alarm)\n @response_limits = args[:response_limits] if args.key?(:response_limits)\n @support_sdk_execute = args[:support_sdk_execute] if args.key?(...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
a12927261674b1422d4aa03aa5fb2417
returns the parsed JSON representation of an instance. If the current instance is a string we assume it's JSON
[ { "docid": "cd5505a8e07293e4ce849941cf3ff4dd", "score": "0.66972333", "text": "def reparsed_from_json\n self.is_a?(String) ? JSON.parse(self) : JSON.parse(self.to_json)\n end", "title": "" } ]
[ { "docid": "d10e4c7b0a3f427aadec91ab1e49bc2e", "score": "0.6881147", "text": "def as_json\n JSON.parse self.to_json\n end", "title": "" }, { "docid": "657de2b90eee4244034a3b679cd54978", "score": "0.6540918", "text": "def to_json\n return self.class.to_json\n end", "title"...
7b3436d34f036347b34b52d994ca13a3
This definition takes care of removing urls which contain 'main_page.'
[ { "docid": "e66694f5d3a496b74d61feefbebd3885", "score": "0.6299482", "text": "def includesMainPageLink(link)\n\tlink.to_s.downcase.include?\"main_page\"\nend", "title": "" } ]
[ { "docid": "e4d6a51a2d9a90bc117ede67bd40497c", "score": "0.6387639", "text": "def cleanup_urls\n self.url = self.url.to_s.downcase\n end", "title": "" }, { "docid": "59a5d192fac83b3f05da77b419d60e3a", "score": "0.6351867", "text": "def main_pages\n @mainpages = Webpage.fin...
8fb3120b15ccc9240503c5d98a853df5
DELETE /mouvement_stocks/1 DELETE /mouvement_stocks/1.json
[ { "docid": "c85e44b13900bc905fbe089f732167cf", "score": "0.7902832", "text": "def destroy\n @mouvement_stock.destroy\n respond_to do |format|\n format.html { redirect_to mouvement_stocks_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "63b90bea78c3f39123e9d0ab09142e16", "score": "0.7772977", "text": "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to api_stocks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dee36ed462106566d79...
66d53b5c1fec24e2eb802ee8402fbb15
Visit an explicit receiver with 1 args (This is ~30% faster than calling the general method)
[ { "docid": "dba43d8a9e822c5f9c704e9eb76731f7", "score": "0.622102", "text": "def visit_this_1(receiver, thing, arg)\n if method_name = @cache[thing.class]\n return receiver.send(method_name, thing, arg)\n end\n visit_this(receiver, thing, arg)\n end", "title": "" } ]
[ { "docid": "42994f668d503442c3cc3f8119b3d4ed", "score": "0.6880814", "text": "def visit(thing, *args)\n visit_this(@receiver, thing, *args)\n end", "title": "" }, { "docid": "c5660c6cc80613600fe965593a91db6b", "score": "0.68752515", "text": "def visit(thing, *args)\n visit_thi...
84742300bbcbe66f4bd4415bd7091773
Checks if a friendship exists between two users; returns true or false if no error occured. If an error did occur, it returns the usual object. Authentication required.
[ { "docid": "30561ab8628a410daeaa530af202c94a", "score": "0.8164135", "text": "def friendship_exists?(user_a, user_b)\n response = get \"friendships/exists\", {:user_a => user_a, :user_b => user_b}\n if response.ok?\n response.data.%('friends').inner_html == 'true'\n else\n response\n ...
[ { "docid": "5fc6a326189c7ad4341db3e04123827a", "score": "0.81713873", "text": "def friendship_exists?(user_a, user_b)\n\t\treturn true if user_a == user_b\n\t\tresponse = access_token.get(\"/friendships/exists.json?user_a=#{user_a}&user_b=#{user_b}\")\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\...
f0ddb1a288ddb13152e63a08000277b8
=begin Exercise 2 add_numbers Write a function add_numbers(nums_array) that takes in an array of Fixnums and returns the sum of those numbers. Write this method recursively. Test Cases add_numbers([1,2,3,4]) => returns 10 add_numbers([3]) => returns 3 add_numbers([80,34,7]) => returns 39 add_numbers([]) => returns nil ...
[ { "docid": "0bed62860105af02ff7c4e4411a6b90f", "score": "0.77698505", "text": "def add_numbers(arr)\n #base case\n if arr.length <= 1\n return arr.first\n elsif arr.empty?\n return nil\n end\n #inductive_case\n arr[0] + add_numbers(arr[1..-1])\nend", "title": "" } ]
[ { "docid": "09c5e0f535ee69a69911abd6243bb501", "score": "0.8479601", "text": "def add_numbers(nums_array)\n return 0 if nums_array.empty?\n nums_array[0] + add_numbers(nums_array[1..-1])\nend", "title": "" }, { "docid": "f81b69a93350de24fad0a34caacd9ee4", "score": "0.83895224", ...