text:
"""
pyggle.data
This library (PYGGEL) is licensed under the LGPL by Matthew Roe and PYGGEL contributors.

The data module holds all classes used to create, store and access OpenGL data,
like textures, display lists and vertex arrays.
"""

from .include import *
from . import view

class Texture(object):
    """An object to load and store an OpenGL texture"""
    bound = None
    _all_loaded = {}
    def __init__(self, filename=None):
        """Create a texture
           filename can be be a filename for an image, or a pygame.Surface object"""
        view.require_init()
        self.filename = filename

        self.size = (0,0)

        if type(filename) is type(""):
            self._load_file()
        else:
            self._compile(filename)

    def _get_next_biggest(self, x, y):
        """Get the next biggest power of two x and y sizes"""
        if x == y == 1:
            return x, y
        nw = 16
        nh = 16
        while nw < x:
            nw *= 2
        while nh < y:
            nh *= 2
        return nw, nh

    def _load_file(self):
        """Loads file"""
        if not self.filename in self._all_loaded:
            image = pygame.image.load(self.filename)

            self._compile(image)
            if self.filename:
                self._all_loaded[self.filename] = [self]
        else:
            tex = self._all_loaded[self.filename][0]

            self.size = tex.size
            self.gl_tex = tex.gl_tex
            self._all_loaded[self.filename].append(self)

    def _compile(self, image):
        """Compiles image data into texture data"""

        self.gl_tex = glGenTextures(1)

        size = self._get_next_biggest(*image.get_size())

        image = pygame.transform.scale(image, size)

        tdata = pygame.image.tostring(image, "RGBA", 1)

        glBindTexture(GL_TEXTURE_2D, self.gl_tex)

        xx, xy = size
        self.size = size
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, xx, xy, 0, GL_RGBA,
                     GL_UNSIGNED_BYTE, tdata)

        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)

    def bind(self):
        """Binds the texture for usage"""
        if not Texture.bound == self:
            glBindTexture(GL_TEXTURE_2D, self.gl_tex)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)
            Texture.bound = self

    def __del__(self):
        """Clear the texture data"""
        if self.filename in self._all_loaded and\
           self in self._all_loaded[self.filename]:
            self._all_loaded[self.filename].remove(self)
            if not self._all_loaded[self.filename]:
                del self._all_loaded[self.filename]
                try:
                    glDeleteTextures([self.gl_tex])
                except:
                    pass #already cleared...

class BlankTexture(Texture):
    _all_loaded = {}
    def __init__(self, size=(1,1), color=(1,1,1,1)):
        """Create an empty data.Texture
           size must be a two part tuple representing the pixel size of the texture
           color must be a four-part tuple representing the (RGBA 0-1) color of the texture"""
        view.require_init() # It seems to need init on python2.6

        self.size = size
        self.filename = repr(size)+repr(color)
        self.gl_tex = None
        if self.filename in self._all_loaded:
            tex = self._all_loaded[self.filename][0]

            self.size = tex.size
            self.gl_tex = tex.gl_tex
            self._all_loaded[self.filename].append(self)
        else:
            i = pygame.Surface(size)
            if len(color) == 4:
                r, g, b, a = color
            else:
                r, g, b = color
                a = 1
            r *= 255
            g *= 255
            b *= 255
            a *= 255
            i.fill((r,g,b,a))

            self.gl_tex = glGenTextures(1)
            self._compile(i)

            self._all_loaded[self.filename] = [self]

class DisplayList(object):
    """An object to compile and store an OpenGL display list"""
    def __init__(self):
        """Creat the list"""
        self.gl_list = glGenLists(1)

    def begin(self):
        """Begin recording to the list - anything rendered after this will be compiled into the list and not actually rendered"""
        glNewList(self.gl_list, GL_COMPILE)

    def end(self):
        """End recording"""
        glEndList()

    def render(self):
        """Render the display list"""
        glCallList(self.gl_list)

    def __del__(self):
        """Clear the display list data"""
        try:
            glDeleteLists(self.gl_list, 1)
        except:
            pass #already cleared!

class VertexArray(object):
    """An object to store and render an OpenGL vertex array of vertices, colors and texture coords"""
    def __init__(self, render_type=None, max_size=100):
        """Create the array
           render_type is the OpenGL constant used in rendering, ie GL_POLYGON, GL_TRINAGLES, etc.
           max_size is the size of the array"""
        if render_type is None:
            render_type = GL_QUADS
        self.render_type = render_type
        self.texture = BlankTexture()

        self.max_size = max_size

        self.verts = numpy.empty((max_size, 3), dtype=object)
        self.colors = numpy.empty((max_size, 4), dtype=object)
        self.texcs = numpy.empty((max_size, 2), dtype=object)

    def render(self):
        """Render the array"""
        self.texture.bind()

        glEnableClientState(GL_VERTEX_ARRAY)
        glEnableClientState(GL_COLOR_ARRAY)
        glEnableClientState(GL_TEXTURE_COORD_ARRAY)

        glVertexPointer(3, GL_FLOAT, 0, self.verts)
        glColorPointer(4, GL_FLOAT, 0, self.colors)
        glTexCoordPointer(2, GL_FLOAT, 0, self.texcs)

        glDrawArrays(self.render_type, 0, self.max_size)

        glDisableClientState(GL_VERTEX_ARRAY)
        glDisableClientState(GL_COLOR_ARRAY)
        glDisableClientState(GL_TEXTURE_COORD_ARRAY)

class FrameBuffer(object):
    """An object contains functions to render to a texture instead of to the main display.
       This object renders using FBO's, which are not available to everyone, but they are far faster and more versatile."""
    def __init__(self, size=(512,512), clear_color=(0,0,0,0)):
        """Create the FrameBuffer.
           size must be the (x,y) size of the buffer, will round up to the next power of two
           clear_color must be the (r,g,b) or (r,g,b,a) color of the background of the texture"""
        view.require_init()
        if not FBO_AVAILABLE:
            raise AttributeError("Frame buffer objects not available!")

        _x, _y = size
        x = y = 2
        while x < _x:
            x *= 2
        while y < _y:
            y *= 2
        size = x, y

        self.size = size
        self.clear_color = clear_color

        self.texture = BlankTexture(self.size, self.clear_color)

        if not bool(glGenRenderbuffersEXT):
            print("glGenRenderbuffersEXT doesn't exist")
            exit()
        self.rbuffer = glGenRenderbuffersEXT(1)
        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,
                              self.rbuffer)
        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
                                 GL_DEPTH_COMPONENT,
                                 size[0],
                                 size[1])

        self.fbuffer = glGenFramebuffersEXT(1)
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
                             self.fbuffer)
        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
                                  GL_COLOR_ATTACHMENT0_EXT,
                                  GL_TEXTURE_2D,
                                  self.texture.gl_tex,
                                  0)
        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
                                     GL_DEPTH_ATTACHMENT_EXT,
                                     GL_RENDERBUFFER_EXT,
                                     self.rbuffer)

        self.worked = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT

        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0)
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)

    def enable(self):
        """Turn this buffer on, swaps rendering to the texture instead of the display."""
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, self.fbuffer)
        r,g,b = self.clear_color[:3]
        glClearColor(r, g, b, 1)
        glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT)

        glPushAttrib(GL_VIEWPORT_BIT)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        glViewport(0,0,*self.size)
        gluPerspective(45, 1.0*self.size[0]/self.size[1], 0.1, 100.0)
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        glEnable(GL_DEPTH_TEST)

    def disable(self):
        """Turn off the buffer, swap rendering back to the display."""
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)
        glClearColor(*view.screen.clear_color)
        glPopAttrib()

    def __del__(self):
        """Clean up..."""
        try:
            glDeleteFramebuffersEXT(1, [self.fbuffer])
        except:
            pass

        try:
            glDeleteRenderbuffersEXT(1, [self.rbuffer])
        except:
            pass

class TextureBuffer(object):
    """An object contains functions to render to a texture, using the main display.
       This object renders using the main display, copying to the texture, and then clearing.
       This object is considerably slower than teh FrameBuffer object, and less versatile,
       because you cannot use these objects mid-render, if you do you will lose whatever was rendered before them!"""
    def __init__(self, size=(512,512), clear_color=(0,0,0,0)):
        """Create the FrameBuffer.
           size must be the (x,y) size of the buffer, will round up to the next power of two
               if size is greater than the display size, it will be rounded down to the previous power of two
           clear_color must be the (r,g,b) or (r,g,b,a) color of the background of the texture"""
        _x, _y = size
        x = y = 2
        while x < _x:
            x *= 2
        while y < _y:
            y *= 2
        while x > view.screen.screen_size[0]:
            x /= 2
        while y > view.screen.screen_size[1]:
            y /= 2
        size = x, y

        self.size = size
        self.clear_color = clear_color

        self.texture = BlankTexture(self.size, self.clear_color)
        self.worked = True

    def enable(self):
        """Turn on rendering to this buffer, clears display buffer and preps it for this object."""
        r,g,b = self.clear_color[:3]

        glClearColor(r, g, b, 1)
        glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT)
        glClearColor(*view.screen.clear_color)

        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        glViewport(0,0,*self.size)
        gluPerspective(45, 1.0*self.size[0]/self.size[1], 0.1, 100.0)
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        glEnable(GL_DEPTH_TEST)

    def disable(self):
        """Turn of this buffer, and clear the display."""
        self.texture.bind()
        glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0,0,self.size[0], self.size[1], 0)

        glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT)


text:
package ar.util;

import java.util.Iterator;

public final class ArrayIterator<T> implements Iterator<T> {
	private final T[] base;
	private int index=0;

	public ArrayIterator(T[] base) {this.base = base;}
	@Override public boolean hasNext() {return index < base.length;}
	@Override public T next() {return base[index++];}
	@Override public void remove() {throw new UnsupportedOperationException();}
}

redpajama_set_name: RedPajamaGithub


text:
var assert = require('chai').assert
  , load = require('../../util/load');

describe('jsr-rdb (parser)', function() {

  it('should handle keys with expiry (secs)', function(done) {
    load('expiry-secs.rdb', function(data) {
      assert.equal(data.allKeys[0]['foo'].expiry, 1374939348000);
      done();
    })
  });

})


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

$lang['version_not_supported'] = 'DevelBar ne support pas cette version de CodeIgniter, Merci de vérifier votre version %s.';
$lang['sec'] = 'sec';
$lang['request'] = 'Requettes';
$lang['method'] = 'Methode';
$lang['controller'] = 'Contrôleur';
$lang['action'] = 'Action';
$lang['function'] = 'Fonction';
$lang['parameters'] = 'Paramètres';
$lang['database'] = 'Base de données';
$lang['total_execution_time'] = "Durée totale d'exécution";
$lang['no_queries'] = 'Aucune requêtes exécutée';
$lang['benchmarks'] = 'Benchmarks';
$lang['hooks'] = 'Hooks';
$lang['libraries'] = 'Libraries';
$lang['config'] = 'Configuration';
$lang['session'] = 'Session';
$lang['helpers'] = 'Helpers';
$lang['views'] = 'Views';
$lang['models'] = 'Models';
$lang['memory_usage'] = 'Mémoire utilisée';
$lang['ci_version'] = 'CodeIgniter version : %s';
$lang['info'] = 'Info';
$lang['update_message'] = 'Mise à jour disponible : %s';
$lang['develbar_version'] = 'DevelBar version : %s';
$lang['php_version'] = 'PHP version : %s';
$lang['default_language'] = 'Langue par defaut : %s';


text:
#define GENERATE_STUBS
#include "config.h"
#include "resolve.h"
#include "scefuncs.h"
#include "uvloader.h"

/********************************************//**
 *  \brief Wrapper to allocate code memory block
 *
 *  Wrapper function to allocate code memory and
 *  return a block id.
 *  \returns Block id for code memory
 ***********************************************/
int sceKernelAllocCodeMemBlock(const char *name,    ///< Block name
                             unsigned int length)   ///< Allocate size
{
    return sceKernelFindMemBlockByAddr(uvl_alloc_code_mem(&length), 0);
}

/********************************************//**
 *  \brief Resolves UVLoader
 *
 *  This function will try its best to resolve
 *  imported function given their NIDs. UVL
 *  only uses sceLibKernel API calls which
 *  should be imported by every game.
 ***********************************************/
void
uvl_scefuncs_resolve_loader (void *anchor)  ///< Import table entry pointing to SceLibKernel
{
    // we must first find the relocated sceLibKernel base
    // by resolving the first
    resolve_entry_t kernel_base;
    // unfortunally, we can't do error checks yet so let's pray
    // it doesn't crash
    uvl_resolve_import_stub_to_entry (anchor, 0, &kernel_base);
    kernel_base.value.value &= ~1u; // unset first bit (entry is thumb code)
    #define RESOLVE_STUB(_stub, _nid) uvl_resolve_loader (_nid, kernel_base.value.ptr, _stub);

    RESOLVE_STUB(sceKernelStopUnloadModule, 0x2415F8A4);
    RESOLVE_STUB(sceKernelFindMemBlockByAddr, 0xA33B99D1);
    RESOLVE_STUB(sceKernelFreeMemBlock, 0xA91E15EE);
    RESOLVE_STUB(sceKernelGetMemBlockBase, 0xB8EF5818);
    RESOLVE_STUB(sceKernelAllocMemBlock, 0xB9D5EBDE);
    RESOLVE_STUB(sceKernelExitDeleteThread, 0x1D17DECF);
    RESOLVE_STUB(sceKernelGetModuleList, 0x2EF2581F);
    RESOLVE_STUB(sceKernelGetModuleInfo, 0x36585DAF);
    RESOLVE_STUB(sceIoWrite, 0x11FED231);
    RESOLVE_STUB(sceIoClose, 0xF5C6F098);
    RESOLVE_STUB(sceIoRead, 0x713523E1);
    RESOLVE_STUB(sceIoOpen, 0x6C60AC61);
    RESOLVE_STUB(sceIoLseek, 0x99BA173E);
    RESOLVE_STUB(sceKernelStartThread, 0xF08DE149);
    RESOLVE_STUB(sceKernelCreateThread, 0xC5C11EE7);
    RESOLVE_STUB(sceKernelLoadModule, 0xBBE82155);
    RESOLVE_STUB(sceKernelUnloadModule, 0x1987920E);
    RESOLVE_STUB(sceClibVsnprintf, 0xFA6BE467);
    RESOLVE_STUB(sceKernelWaitThreadEnd, 0xDDB395A9);

    #undef RESOLVE_STUB
}


text:
Running Discourse with Caddy is very easy. After you've installed Discourse, you need to adjust the container's configuration slightly.

`cd /var/discourse`

`sudo nano containers/app.yml`

Find the line that says `expose:' and change that section to:

```plain
expose:
  - "8080:80"   # http
# - "443:443"   # https
```

These lines map host ports to container ports. So, we set the 'real' port 8080 to map to the container's port 80. You can change `8080` to be any high port number you want. Then we disable the 443 mapping since Caddy terminates the TLS for us.

See enclosed Caddyfile for how to reverse-proxy into Discourse. Very simple, as you would expect.

After you've changed app.yml and started Caddy, restart your container:

`sudo ./launcher rebuild app`

After a few minutes your Discourse installation should be online with Caddy.


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe Feedjira::FeedUtilities do
  before(:each) do
    @klass = Class.new do
      include SAXMachine
      include Feedjira::FeedUtilities
    end
  end

  describe "preprocessing" do
    context "when the flag is not set" do
      it "does not call the preprocessing method" do
        @klass.preprocess_xml = false
        expect(@klass).to_not receive :preprocess
        @klass.parse sample_rss_feed
      end
    end

    context "when the flag is set" do
      it "calls the preprocessing method" do
        @klass.preprocess_xml = true
        expect(@klass).to receive(:preprocess).
          and_return sample_rss_feed
        @klass.parse sample_rss_feed
      end
    end
  end

  describe "instance methods" do
    it "should provide an updated? accessor" do
      feed = @klass.new
      expect(feed).to_not be_updated
      feed.updated = true
      expect(feed).to be_updated
    end

    it "should provide a new_entries accessor" do
      feed = @klass.new
      expect(feed.new_entries).to eq []
      feed.new_entries = [:foo]
      expect(feed.new_entries).to eq [:foo]
    end

    it "should provide an etag accessor" do
      feed = @klass.new
      feed.etag = "foo"
      expect(feed.etag).to eq "foo"
    end

    it "should provide a last_modified accessor" do
      feed = @klass.new
      time = Time.now
      feed.last_modified = time
      expect(feed.last_modified).to eq time
      expect(feed.last_modified.class).to eq Time
    end

    it "should return new_entries? as true when entries are put into new_entries" do
      feed = @klass.new
      feed.new_entries << :foo
      expect(feed).to have_new_entries
    end

    it "should return a last_modified value from the entry with the most recent published date if the last_modified date hasn't been set" do
      feed = Feedjira::Parser::Atom.new
      entry =Feedjira::Parser::AtomEntry.new
      entry.published = Time.now.to_s
      feed.entries << entry
      expect(feed.last_modified).to eq entry.published
    end

    it "should not throw an error if one of the entries has published date of nil" do
      feed = Feedjira::Parser::Atom.new
      entry = Feedjira::Parser::AtomEntry.new
      entry.published = Time.now.to_s
      feed.entries << entry
      feed.entries << Feedjira::Parser::AtomEntry.new
      expect(feed.last_modified).to eq entry.published
    end
  end

  describe "#update_from_feed" do
    describe "updating feed attributes" do
      before(:each) do
        # I'm using the Atom class when I know I should be using a different one. However, this update_from_feed
        # method would only be called against a feed item.
        @feed = Feedjira::Parser::Atom.new
        @feed.title    = "A title"
        @feed.url      = "http://pauldix.net"
        @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
        @feed.updated  = false
        @updated_feed = @feed.dup
      end

      it "should update the title if changed" do
        @updated_feed.title = "new title"
        @feed.update_from_feed(@updated_feed)
        expect(@feed.title).to eq @updated_feed.title
        expect(@feed).to be_updated
      end

      it "should not update the title if the same" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed).to_not be_updated
      end

      it "should update the feed_url if changed" do
        @updated_feed.feed_url = "a new feed url"
        @feed.update_from_feed(@updated_feed)
        expect(@feed.feed_url).to eq @updated_feed.feed_url
        expect(@feed).to be_updated
      end

      it "should not update the feed_url if the same" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed).to_not be_updated
      end

      it "should update the url if changed" do
        @updated_feed.url = "a new url"
        @feed.update_from_feed(@updated_feed)
        expect(@feed.url).to eq @updated_feed.url
      end

      it "should not update the url if not changed" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed).to_not be_updated
      end
    end

    describe "updating entries" do
      before(:each) do
        # I'm using the Atom class when I know I should be using a different one. However, this update_from_feed
        # method would only be called against a feed item.
        @feed = Feedjira::Parser::Atom.new
        @feed.title    = "A title"
        @feed.url      = "http://pauldix.net"
        @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
        @feed.updated  = false
        @updated_feed = @feed.dup
        @old_entry = Feedjira::Parser::AtomEntry.new
        @old_entry.url = "http://pauldix.net/old.html"
        @old_entry.published = Time.now.to_s
        @old_entry.entry_id = "entry_id_old"
        @new_entry = Feedjira::Parser::AtomEntry.new
        @new_entry.url = "http://pauldix.net/new.html"
        @new_entry.published = (Time.now + 10).to_s
        @new_entry.entry_id = "entry_id_new"
        @feed.entries << @old_entry
        @updated_feed.entries << @new_entry
        @updated_feed.entries << @old_entry
      end

      it "should update last-modified from the latest entry date" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed.last_modified).to eq @new_entry.published
      end

      it "should put new entries into new_entries" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed.new_entries).to eq [@new_entry]
      end

      it "should also put new entries into the entries collection" do
        @feed.update_from_feed(@updated_feed)
        expect(@feed.entries).to include(@new_entry)
        expect(@feed.entries).to include(@old_entry)
      end
    end

    describe "#update_from_feed" do
      let(:recent_entry_id) { 'entry_id' }
      let(:old_entry_id) { nil }

      before(:each) do
        # I'm using the Atom class when I know I should be using a different one. However, this update_from_feed
        # method would only be called against a feed item.
        @feed = Feedjira::Parser::Atom.new
        @feed.title    = "A title"
        @feed.url      = "http://pauldix.net"
        @feed.feed_url = "http://feeds.feedburner.com/PaulDixExplainsNothing"
        @feed.updated  = false
        @updated_feed = @feed.dup

        @old_entry = Feedjira::Parser::AtomEntry.new
        @old_entry.url = "http://pauldix.net/old.html"
        @old_entry.entry_id = old_entry_id
        @old_entry.published = (Time.now - 10).to_s

        @entry = Feedjira::Parser::AtomEntry.new
        @entry.published = (Time.now + 10).to_s
        @entry.entry_id = recent_entry_id
        @entry.url = "http://pauldix.net/entry.html"

        # only difference is a changed url
        @entry_changed_url = @entry.dup
        @entry_changed_url.url = "http://pauldix.net/updated.html"

        # entry with changed url must be first
        @feed.entries << @entry
        @feed.entries << @old_entry
        @updated_feed.entries << @entry_changed_url
        @updated_feed.entries << @old_entry
      end

      context "changing the url of an existing entry" do
        it "should not put the complete feed into new_entries" do
          @feed.update_from_feed(@updated_feed)
          expect(@feed.new_entries).to_not include(@entry_changed_url)
          expect(@feed.new_entries).to_not include(@old_entry)
          expect(@feed.new_entries.size).to eq 0
          expect(@feed.new_entries.size).to_not eq 2
        end
      end

      context "feed not have entry id and only difference is a url" do
        let(:recent_entry_id) { nil }
        let(:old_entry_id) { nil }

        it "should put the complete feed into new_entries" do
          @feed.update_from_feed(@updated_feed)
          expect(@feed.new_entries).to include(@entry_changed_url)
          expect(@feed.new_entries).to include(@old_entry)
          expect(@feed.new_entries.size).to eq 2
          expect(@feed.new_entries.size).to_not eq 0
        end
      end
    end

    describe 'updating with a feed' do
      let(:id_one) { '1' }
      let(:id_two) { '2' }

      let(:url_one) { 'http://example.com/post_one.html' }
      let(:url_two) { 'http://example.com/post_two.html' }

      let(:entry_one) { double 'Entry One', entry_id: id_one, url: url_one }
      let(:entry_two) { double 'Entry Two', entry_id: id_two, url: url_two }

      let(:feed_one) { Feedjira::Parser::Atom.new }
      let(:feed_two) { double 'Feed Two', entries: [entry_two] }

      before do
        stub_const("Feedjira::FeedUtilities::UPDATABLE_ATTRIBUTES", [])
        feed_one.entries << entry_one
      end

      it 'finds entries with unique ids and urls' do
        feed_one.update_from_feed feed_two
        expect(feed_one.new_entries).to eq [entry_two]
      end

      context 'when the entries have the same id' do
        let(:id_two) { id_one }

        it 'does not find a new entry' do
          feed_one.update_from_feed feed_two
          expect(feed_one.new_entries).to eq []
        end
      end

      context 'when the entries have the same url' do
        let(:url_two) { url_one }

        it 'does not find a new entry' do
          feed_one.update_from_feed feed_two
          expect(feed_one.new_entries).to eq []
        end
      end
    end
  end
end


text:
<?php
  if (is_admin_bar_showing()) {echo "

";}
?>

    <?php
    // fontello filters applied in lib/extras
      if (has_nav_menu('social_links')) :
        wp_nav_menu(['theme_location' => 'social_links', 'menu_class' => 'nav']);
      endif;
      ?>
    <a href="<?= esc_url(home_url('/')); ?>" class="brand">

    <?php if (get_page_by_title( 'Contact Us' )) : ?>

<a href="<?php echo esc_url( get_permalink( get_page_by_title( 'Contact Us' ) ) ); ?>">Contact Us

    <?php endif; ?>

      <?php
      if (has_nav_menu('primary_navigation')) :
        wp_nav_menu(['theme_location' => 'primary_navigation','menu_class' => 'nav', 'container_id' => 'top-nav-primary']);
      endif;
      ?>


text:
from django.contrib import admin

from .models import Project

admin.site.register(Project)


text:
package org.custommonkey.xmlunit;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * JUnit testcase for ElementNameAndTextQualifier
 * @see test_Diff#testRepeatedElementNamesWithTextQualification()
 */
public class test_ElementNameAndTextQualifier extends TestCase {
    private static final String TAG_NAME = "tagYoureIt";
    private static final String TEXT_A = "textA";
    private static final String TEXT_B = "textB";
    private Document document;
    private ElementNameAndTextQualifier elementNameAndTextQualifier;

    public void testSingleTextValue() throws Exception {
        Element control = document.createElement(TAG_NAME);
        control.appendChild(document.createTextNode(TEXT_A));

        Element test = document.createElement(TAG_NAME);

        assertFalse("control text not comparable to empty text",
                    elementNameAndTextQualifier.qualifyForComparison(control, test));

        test.appendChild(document.createTextNode(TEXT_A));
        assertTrue("control textA comparable to test textA",
                   elementNameAndTextQualifier.qualifyForComparison(control, test));

        test = document.createElement(TAG_NAME);

        test.appendChild(document.createTextNode(TEXT_B));
        assertFalse("control textA not comparable to test textB",
                    elementNameAndTextQualifier.qualifyForComparison(control, test));
    }

    public void testMultipleTextValues() throws Exception {
        Element control = document.createElement(TAG_NAME);
        control.appendChild(document.createTextNode(TEXT_A));
        control.appendChild(document.createTextNode(TEXT_B));

        Element test = document.createElement(TAG_NAME);
        test.appendChild(document.createTextNode(TEXT_A + TEXT_B));
        assertTrue("denormalised control text comparable to normalised test text",
                   elementNameAndTextQualifier.qualifyForComparison(control, test));
    }

    public void setUp() throws Exception {
        document = XMLUnit.newControlParser().newDocument();
        elementNameAndTextQualifier = new ElementNameAndTextQualifier();
    }

    /**
     * Constructor for test_ElementNameAndTextQualifier.
     */
    public test_ElementNameAndTextQualifier() {
        super();
    }

    /**
     * Constructor for test_ElementNameAndTextQualifier.
     * @param name
     */
    public test_ElementNameAndTextQualifier(String name) {
        super(name);
    }

    public static TestSuite suite() {
        return new TestSuite(test_ElementNameAndTextQualifier.class);
    }
}


text:
#!/bin/bash

# Run using:
#
# ./convert.sh
#
# or
#
# ./convert.sh html,pdf
#
# ...where the first argument is a comma-delimited list of formats

# Program paths
ASCIIDOCTOR=asciidoctor
FOPUB=fopub
ASCIIDOCTOR_PDF=asciidoctor-pdf

# File names
MASTER_ADOC=index.adoc
MASTER_DOCBOOK=${MASTER_ADOC/.adoc/.xml}

# Command options
mkdir -p output
SHARED_OPTIONS='-a toc=left -a stylesheet! -a numbered -a experimental -a source-highlighter=prettify -r asciidoctor-diagram -a imagesdir=images
--destination-dir=output'

cp -R images output
cp -R assets output

echo "Converting to HTML ..."
$ASCIIDOCTOR -v $SHARED_OPTIONS $MASTER_ADOC

cp -R images output
mv chapters/*.png images
rm -Rf **/.asciidoctor

exit 0


text:
using System.Threading.Tasks;
using CodeCracker.CSharp.Design.InconsistentAccessibility;
using Xunit;

namespace CodeCracker.Test.CSharp.Design
{
    using Verify = CSharpCodeFixVerifier<EmptyAnalyzer, InconsistentAccessibilityCodeFixProvider>;

    public partial class InconsistentAccessibilityTests
    {
        [Fact]
        public async Task ShouldFixInconsistentAccessibilityErrorInMethodReturnTypeAsync()
        {
            const string testCode = @"public class Dependent
{
    public DependedUpon {|CS0050:Method|}()
    {
        return null;
    }
}

    internal class DependedUpon
    {
    }";
            const string fixedCode = @"public class Dependent
{
    public DependedUpon Method()
    {
        return null;
    }
}

    public class DependedUpon
    {
    }";

            await Verify.VerifyCodeFixAsync(testCode, fixedCode).ConfigureAwait(false);
        }

        [Fact]
        public async Task ShouldFixInconsistentAccessibilityErrorInMethodReturnTypeWhenQualifiedNameAsync()
        {
            const string testCode = @"public class Dependent
{
    public Dependent.DependedUpon {|CS0050:Method|}()
    {
        return null;
    }

    internal class DependedUpon
    {
    }
}";
            const string fixedCode = @"public class Dependent
{
    public Dependent.DependedUpon Method()
    {
        return null;
    }

    public class DependedUpon
    {
    }
}";

            await Verify.VerifyCodeFixAsync(testCode, fixedCode).ConfigureAwait(false);
        }

        [Fact]
        public async Task ShouldFixInconsistentAccessibilityErrorInIndexerReturnTypeAsync()
        {
            const string testCode = @"public class Dependent
{
    public DependedUpon {|CS0054:this|}[int a]
    {
        get { return null; }
        set { }
    }
}

    internal class DependedUpon
    {
    }";
            const string fixedCode = @"public class Dependent
{
    public DependedUpon this[int a]
    {
        get { return null; }
        set { }
    }
}

    public class DependedUpon
    {
    }";

            await Verify.VerifyCodeFixAsync(testCode, fixedCode).ConfigureAwait(false);
        }

        [Fact]
        public async Task ShouldFixInconsistentAccessibilityErrorInIndexerReturnTypeWhenQualifiedNameAsync()
        {
            const string testCode = @"public class Dependent
{
    public Dependent.DependedUpon {|CS0054:this|}[int a]
    {
        get { return null; }
        set { }
    }

    internal class DependedUpon
    {
    }
}";
            const string fixedCode = @"public class Dependent
{
    public Dependent.DependedUpon this[int a]
    {
        get { return null; }
        set { }
    }

    public class DependedUpon
    {
    }
}";

            await Verify.VerifyCodeFixAsync(testCode, fixedCode).ConfigureAwait(false);
        }
    }
}


text:
package com.packt.webstore.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.packt.webstore.service.ProductService;

@Controller
@RequestMapping("/products")
public class ProductController {

	@Autowired
	private ProductService productService;

	@RequestMapping
	public String list(Model model) {
		model.addAttribute("products", productService.getAllProducts());
		return "products";
	}

	@RequestMapping("/all")
	public ModelAndView allProducts() {
		ModelAndView modelAndView = new ModelAndView();

		modelAndView.addObject("products", productService.getAllProducts());
		modelAndView.setViewName("products");
		return modelAndView;
	}

	@RequestMapping("/{category}")
	public String getProductsByCategory(@PathVariable("category") String productCategory, Model model) {
		model.addAttribute("products", productService.getProductsByCategory(productCategory));
		return "products";
	}

	@RequestMapping("/filter/{ByCriteria}")
	public String getProductsByFilter(@MatrixVariable(pathVar="ByCriteria") Map<String,List<String>> filterParams, Model model) {
		model.addAttribute("products", productService.getProductsByFilter(filterParams));
		return "products";
	}

	@RequestMapping("/product")
	public String getProductById(@RequestParam("id") String productId, Model model) {
		model.addAttribute("product", productService.getProductById(productId));
		return "product";
	}
}


text:
if(!dojo._hasResource["dijit.layout._TabContainerBase"]){
dojo._hasResource["dijit.layout._TabContainerBase"]=true;
dojo.provide("dijit.layout._TabContainerBase");
dojo.require("dijit.layout.StackContainer");
dojo.require("dijit._Templated");
dojo.declare("dijit.layout._TabContainerBase",[dijit.layout.StackContainer,dijit._Templated],{tabPosition:"top",baseClass:"dijitTabContainer",tabStrip:false,nested:false,templateString:dojo.cache("dijit.layout","templates/TabContainer.html","
\n\t

\n\t

\n\t

\n
\n"),postMixInProperties:function(){
this.baseClass+=this.tabPosition.charAt(0).toUpperCase()+this.tabPosition.substr(1).replace(/-.*/,"");
this.srcNodeRef&&dojo.style(this.srcNodeRef,"visibility","hidden");
this.inherited(arguments);
},postCreate:function(){
this.inherited(arguments);
this.tablist=this._makeController(this.tablistNode);
if(!this.doLayout){
dojo.addClass(this.domNode,"dijitTabContainerNoLayout");
}
if(this.nested){
dojo.addClass(this.domNode,"dijitTabContainerNested");
dojo.addClass(this.tablist.containerNode,"dijitTabContainerTabListNested");
dojo.addClass(this.tablistSpacer,"dijitTabContainerSpacerNested");
dojo.addClass(this.containerNode,"dijitTabPaneWrapperNested");
}else{
dojo.addClass(this.domNode,"tabStrip-"+(this.tabStrip?"enabled":"disabled"));
}
},_setupChild:function(_1){
dojo.addClass(_1.domNode,"dijitTabPane");
this.inherited(arguments);
},startup:function(){
if(this._started){
return;
}
this.tablist.startup();
this.inherited(arguments);
},layout:function(){
if(!this._contentBox||typeof (this._contentBox.l)=="undefined"){
return;
}
var sc=this.selectedChildWidget;
if(this.doLayout){
var _2=this.tabPosition.replace(/-h/,"");
this.tablist.layoutAlign=_2;
var _3=[this.tablist,{domNode:this.tablistSpacer,layoutAlign:_2},{domNode:this.containerNode,layoutAlign:"client"}];
dijit.layout.layoutChildren(this.domNode,this._contentBox,_3);
this._containerContentBox=dijit.layout.marginBox2contentBox(this.containerNode,_3[2]);
if(sc&&sc.resize){
sc.resize(this._containerContentBox);
}
}else{
if(this.tablist.resize){
this.tablist.resize({w:dojo.contentBox(this.domNode).w});
}
if(sc&&sc.resize){
sc.resize();
}
}
},destroy:function(){
if(this.tablist){
this.tablist.destroy();
}
this.inherited(arguments);
}});
}


text:
from __future__ import print_function, unicode_literals, absolute_import
import sys
from fsm.fsm import MealyMachine, State, TransitionError

__all__ = ['TCP_STATES', 'TCPMachine', 'TCP_EVENTS']

_TCP_STATES = [
    'CLOSED',
    'LISTEN',
    'SYN_RCVD',
    'ESTABLISHED',
    'SYN_SENT',
    'FIN_WAIT_1',
    'FIN_WAIT_2',
    'TIME_WAIT',
    'CLOSING',
    'CLOSE_WAIT',
    'LAST_ACK',
]

TCP_EVENTS = [
    'PASSIVE',
    'ACTIVE',
    'SYN',
    'SYNACK',
    'ACK',
    'RDATA',
    'SDATA',
    'FIN',
    'CLOSE',
    'TIMEOUT',
]

_ = {
    'none': u'Λ',
    'syn': '<syn>',
    'ack': '<ack>',
    'syn-ack': '<syn-ack>',
    'fin': '<fin>',
    'n': '<n>',
}

class InputError(Exception):
    pass

class TCPMachine(MealyMachine):
    def transition(self, input_value):
        """Transition to the next state."""
        current = self.current_state
        if current is None:
            raise TransitionError('Current state not set.')

        destination_state = current.get(input_value,
                                        current.default_transition)
        if destination_state is None:
            raise TransitionError('Cannot transition from state "%s"'
                                  ' on event "%s"' % (current.name,
                                                      input_value))
        else:
            self.current_state = destination_state
        # Added associated variable
        if input_value == 'RDATA':
            assert current.name == 'ESTABLISHED'
            current.received_count += 1
        if input_value == 'SDATA':
            assert current.name == 'ESTABLISHED'
            current.sent_count += 1

# Initialize states
TCP_STATES = {state: State(state) for state in _TCP_STATES}
TCP_MACHINE = TCPMachine('TCP')
TCP_MACHINE.init_state = TCP_STATES['CLOSED']
TCP_MACHINE.current_state = TCP_MACHINE.init_state

# Setup FSM
TCP_STATES['CLOSED'][('PASSIVE', _['none'])] = TCP_STATES['LISTEN']
TCP_STATES['CLOSED'][('ACTIVE', _['syn'])] = TCP_STATES['SYN_SENT']
TCP_STATES['LISTEN'][('SYN', _['syn-ack'])] = TCP_STATES['SYN_RCVD']
TCP_STATES['LISTEN'][('CLOSE', _['none'])] = TCP_STATES['CLOSED']
TCP_STATES['SYN_SENT'][(('CLOSE'), _['none'])] = TCP_STATES['CLOSED']
TCP_STATES['SYN_SENT'][('SYN', _['syn-ack'])] = TCP_STATES['SYN_RCVD']
TCP_STATES['SYN_SENT'][('SYNACK', _['ack'])] = TCP_STATES['ESTABLISHED']
TCP_STATES['SYN_RCVD'][('ACK', _['none'])] = TCP_STATES['ESTABLISHED']
TCP_STATES['SYN_RCVD'][('CLOSE', _['fin'])] = TCP_STATES['FIN_WAIT_1']
TCP_STATES['ESTABLISHED'][('CLOSE', _['fin'])] = TCP_STATES['FIN_WAIT_1']
TCP_STATES['ESTABLISHED'][('FIN', _['ack'])] = TCP_STATES['CLOSE_WAIT']
TCP_STATES['ESTABLISHED'][('RDATA', _['n'])] = TCP_STATES['ESTABLISHED']
TCP_STATES['ESTABLISHED'][('SDATA', _['n'])] = TCP_STATES['ESTABLISHED']
TCP_STATES['FIN_WAIT_1'][('FIN', _['ack'])] = TCP_STATES['CLOSING']
TCP_STATES['FIN_WAIT_1'][('ACK', _['none'])] = TCP_STATES['FIN_WAIT_2']
TCP_STATES['FIN_WAIT_2'][('FIN', _['ack'])] = TCP_STATES['TIME_WAIT']
TCP_STATES['CLOSING'][('ACK', _['none'])] = TCP_STATES['TIME_WAIT']
TCP_STATES['TIME_WAIT'][('TIMEOUT', _['none'])] = TCP_STATES['CLOSED']
TCP_STATES['CLOSE_WAIT'][('CLOSE'), _['fin']] = TCP_STATES['LAST_ACK']
TCP_STATES['LAST_ACK'][('ACK', _['none'])] = TCP_STATES['CLOSED']

TCP_STATES['ESTABLISHED'].received_count = 0
TCP_STATES['ESTABLISHED'].sent_count = 0

def parse_event(event):
    """Parse event from stdin, process and return message"""
    event = event.strip()
    if not event:
        return
    if event not in TCP_EVENTS:
        raise InputError('unexpected event name "%s"' % event)
    else:
        tcp = TCP_MACHINE
        output = tcp.output(event)
        tcp.transition(event)
        if tcp.current_state.name == 'ESTABLISHED':
            if event == 'RDATA':
                return 'DATA received %d' % tcp.current_state.received_count
            if event == 'SDATA':
                return 'DATA sent %d' % tcp.current_state.sent_count
        message = 'event "%s" received, output is "%s", current state is "%s"'
        message %= (event, output, tcp.current_state.name)
        return message

def print_error_message(e):
    print('%s: %s' % (e.__class__.__name__, e.message))

def main():
    """Interactive interpreter that reads event from stdin"""
    while True:
        try:
            event = sys.stdin.readline()
            if not event:
                # Break on EOF
                break
            message = parse_event(event)
            if message is not None:
                print(message)
        except KeyboardInterrupt:
            break
        except InputError, e:
            print_error_message(e)
        except TransitionError as e:
            print_error_message(e)

if __name__ == '__main__':
    main()


text:
Sample app that signs-up or logs in a user with either username/password or Facebook login.

## Note about the Sample App & Facebook
To enable Facebook login you need to provide your own value for facebook_app_id [here](./src/main/res/values/strings.xml).
We recommend that you use an existing or [create a new](https://developers.facebook.com/quickstarts/?platform=android) Facebook test app.
If you don't provide this value the sample app will still be able to register users via username & password but it will
fail with Facebook login.


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/appid_prefix" />

        <EditText
            android:id="@+id/edit_text_appid"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/uid_prefix" />

        <EditText
            android:id="@+id/edit_text_uid"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:weightSum="2" >

        <Button
            android:id="@+id/ok"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@android:string/ok"
            android:enabled="false" />

        <Button
            android:id="@+id/cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@android:string/cancel" />
    </LinearLayout>

</RelativeLayout>


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"
	default-autowire="byName">
	<context:property-placeholder location="classpath:properties/db.properties" />
	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
		destroy-method="close">
		<property name="url" value="${jdbc.db.url}" />
		<property name="username" value="${jdbc.db.username}" />
		<property name="password" value="${jdbc.db.password}" />
		<property name="driverClassName" value="${jdbc.db.driverclassname}" />
		<property name="maxActive" value="${maxActive}" />
		<property name="initialSize" value="${initialSize}" />
		<property name="maxWait" value="${maxWait}" />
		<property name="minIdle" value="${minIdle}" />
		<property name="timeBetweenEvictionRunsMillis" value="${timeBetweenEvictionRunsMillis}" />
		<property name="minEvictableIdleTimeMillis" value="${minEvictableIdleTimeMillis}" />
		<property name="validationQuery" value="${validationQuery}" />
		<property name="testWhileIdle" value="${testWhileIdle}" />
		<property name="testOnBorrow" value="${testOnBorrow}" />
		<property name="testOnReturn" value="${testOnReturn}" />
		<property name="maxOpenPreparedStatements"
			value="${maxOpenPreparedStatements}" />
	</bean>
</beans>


text:
require 'spec_helper'

feature 'EditSelectFieldValues', :redis do
  before do
    field_set = FactoryGirl.create(:location_field_set, name: 'Lakes')
    @location = FactoryGirl.create(:location, name: 'Lake Travis')
    visit "/field_sets/#{field_set.id}"
    select_field_new 'Rentals?'
    choice_new 'Positive'
    choice_new 'Negative'
    choice_field_enable
    visit "/locations/#{@location.id}"
    click_link 'Lakes'
  end
  it 'enter an initial value, then edit it' do
    expect(page).to have_content 'Rentals?'
    click_link 'select list, undefined'
    expect(page).to have_content 'Editing a select list value'
    click_link 'Cancel'
    click_link 'select list, undefined'
    select 'Positive', from: 'choice_field_gist'
    click_button 'Done'
    expect(page).to have_content 'Select list field successfully updated'
    click_link 'Positive'
    expect(page).to have_content 'Editing a select list value'
    select 'Negative', from: 'choice_field_gist'
    click_button 'Done'
    expect(page).to have_content 'Select list field successfully updated'
    expect(page).to have_content 'Negative'
  end
end


text:
'use strict';

var mongoose = require('mongoose'),
  League = mongoose.model('League'),
  Team = mongoose.model('Team'),
  Tournament = mongoose.model('Tournament'),
  Player = mongoose.model('Player'),
  User = mongoose.model('User');

/**
 * Populate database with sample application data
 */

User.find({}).remove(function() {
  User.create(
    { "teamId" : mongoose.Types.ObjectId("5341acca15183faabc000001"), "provider" : "local", "name" : "Matt Lovan", "email" : "magrelo404@gmail.com", "hashedPassword" : "M1Qx9zFJxx2vpAcmbFU7MQIccBsg9ueAWMVteZ0ZkDONROSHTRkbkHJt2pJtzjxMGyqJxhOl8xEygJoR21uPnA==", "salt" : "0fjBaORTb9knWvQLz0/Cow==", "_id" : mongoose.Types.ObjectId("5341acca15183faabc000002"), "role" : "admin", "__v" : 0 },
    function() {
      console.log('finished populating users');
    }
  );
});

Team.find({}).remove(function() {
  Team.create(
    { "__v" : 0, "_id" : mongoose.Types.ObjectId("5341acca15183faabc000001"), teamName: 'Wildcats', ownerName:'Matt Lovan'},
    function(){
      console.log('finished populating teams');
    }
  );
});

League.find({}).remove(function() {
  console.log('deleted leagues');
});

Tournament.find({}).remove(function() {
  console.log('deleted tourneys');
});

Player.find({}).remove(function() {
  console.log('deleted players');
});


text:
//  Copyright 2020 Google Inc. All Rights Reserved.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

using System.Runtime.InteropServices;

namespace NtApiDotNet.Win32.Security.Authentication
{
    /// <summary>
    /// Base class for authentication credentials.
    /// </summary>
    public abstract class AuthenticationCredentials
    {
        internal bool Mananged { get; }

        internal AuthenticationCredentials(bool managed)
        {
            Mananged = managed;
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        protected AuthenticationCredentials() : this(false)
        {
        }

        internal abstract SafeBuffer ToBuffer(DisposableList list, string package);
    }
}