text:
package jobs;

import com.beust.jcommander.internal.Lists;
import com.conveyal.gtfs.GTFSFeed;
import com.conveyal.gtfs.model.CalendarDate;
import com.conveyal.gtfs.model.Entity;
import com.conveyal.gtfs.model.Frequency;
import com.conveyal.gtfs.model.Shape;
import com.google.common.collect.Maps;
import com.vividsolutions.jts.geom.Coordinate;
import datastore.AgencyTx;
import datastore.GlobalTx;
import datastore.VersionedDataStore;
import models.Snapshot;
import models.transit.*;
import org.joda.time.LocalDate;
import org.mapdb.Fun.Tuple2;
import play.Logger;
import scala.actors.threadpool.Arrays;
import utils.GeoUtils;

import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

public class ProcessGtfsSnapshotExport implements Runnable {
	private Collection<Tuple2<String, Integer>> snapshots;
	private File output;
	private LocalDate startDate;
	private LocalDate endDate;

	/** Export the named snapshots to GTFS */
	public ProcessGtfsSnapshotExport(Collection<Tuple2<String, Integer>> snapshots, File output, LocalDate startDate, LocalDate endDate) {
		this.snapshots = snapshots;
		this.output = output;
		this.startDate = startDate;
		this.endDate = endDate;
	}

	/**
	 * Export the master branch of the named agencies to GTFS. The boolean variable can be either true or false, it is only to make this
	 * method have a different erasure from the other
	 */
	public ProcessGtfsSnapshotExport(Collection<String> agencies, File output, LocalDate startDate, LocalDate endDate, boolean isagency) {
		this.snapshots = Lists.newArrayList(agencies.size());

		for (String agency : agencies) {
			// leaving version null will cause master to be used
			this.snapshots.add(new Tuple2<String, Integer>(agency, null));
		}

		this.output = output;
		this.startDate = startDate;
		this.endDate = endDate;
	}

	/**
	 * Export this snapshot to GTFS, using the validity range in the snapshot.
	 */
	public ProcessGtfsSnapshotExport (Snapshot snapshot, File output) {
		this(Arrays.asList(new Tuple2[] { snapshot.id }), output, snapshot.validFrom, snapshot.validTo);
	}

	@Override
	public void run() {
		GTFSFeed feed = new GTFSFeed();

		GlobalTx gtx = VersionedDataStore.getGlobalTx();
		AgencyTx atx = null;

		try {
			for (Tuple2<String, Integer> ssid : snapshots) {
				String agencyId = ssid.a;
				Agency agency = gtx.agencies.get(agencyId);
				com.conveyal.gtfs.model.Agency gtfsAgency = agency.toGtfs();
				Logger.info("Exporting agency %s", gtfsAgency);

				if (ssid.b == null) {
					atx = VersionedDataStore.getAgencyTx(agencyId);
				}
				else {
					atx = VersionedDataStore.getAgencyTx(agencyId, ssid.b);
				}

				// write the agencies.txt entry
				feed.agency.put(agencyId, agency.toGtfs());

				// write all of the calendars and calendar dates
				for (ServiceCalendar cal : atx.calendars.values()) {
					com.conveyal.gtfs.model.Service gtfsService = cal.toGtfs(toGtfsDate(startDate), toGtfsDate(endDate));
					// note: not using user-specified IDs

					// add calendar dates
					if (atx.exceptions != null) {
						for (ScheduleException ex : atx.exceptions.values()) {
							for (LocalDate date : ex.dates) {
								if (date.isBefore(startDate) || date.isAfter(endDate))
									// no need to write dates that do not apply
									continue;

								CalendarDate cd = new CalendarDate();
								cd.date = date;
								cd.service = gtfsService;
								cd.exception_type = ex.serviceRunsOn(cal) ? 1 : 2;

								if (gtfsService.calendar_dates.containsKey(date))
									throw new IllegalArgumentException("Duplicate schedule exceptions on " + date.toString());

								gtfsService.calendar_dates.put(date, cd);
							}
						}
					}

					feed.services.put(gtfsService.service_id, gtfsService);
				}

				Map<String, com.conveyal.gtfs.model.Route> gtfsRoutes = Maps.newHashMap();

				// write the routes
				for (Route route : atx.routes.values()) {
					// only export approved routes
					if(route.status == StatusType.APPROVED) {
						com.conveyal.gtfs.model.Route gtfsRoute = route.toGtfs(gtfsAgency, gtx);

						feed.routes.put(route.getGtfsId(), gtfsRoute);

						gtfsRoutes.put(route.id, gtfsRoute);
					}
				}

				// write the trips on those routes
				// we can't use the trips-by-route index because we may be exporting a snapshot database without indices
				for (Trip trip : atx.trips.values()) {
					if (!gtfsRoutes.containsKey(trip.routeId)) {
						Logger.warn("Trip {} has not matching route", trip);
						continue;
					}

					com.conveyal.gtfs.model.Route  gtfsRoute = gtfsRoutes.get(trip.routeId);
					Route route = atx.routes.get(trip.routeId);

					com.conveyal.gtfs.model.Trip gtfsTrip = new com.conveyal.gtfs.model.Trip();

					gtfsTrip.block_id = trip.blockId;
					gtfsTrip.route = gtfsRoute;
					gtfsTrip.trip_id = trip.getGtfsId();
					// not using custom ids for calendars
					gtfsTrip.service = feed.services.get(trip.calendarId);
					gtfsTrip.trip_headsign = trip.tripHeadsign;
					gtfsTrip.trip_short_name = trip.tripShortName;
					gtfsTrip.direction_id = trip.tripDirection == TripDirection.A ? 0 : 1;

					TripPattern pattern = atx.tripPatterns.get(trip.patternId);

					Tuple2<String, Integer> nextKey = feed.shapePoints.ceilingKey(new Tuple2(pattern.id, null));
					if ((nextKey == null || !pattern.id.equals(nextKey.a)) && pattern.shape != null && !pattern.useStraightLineDistances) {
						// this shape has not yet been saved
						double[] coordDistances = GeoUtils.getCoordDistances(pattern.shape);

						for (int i = 0; i < coordDistances.length; i++) {
							Coordinate coord = pattern.shape.getCoordinateN(i);
							Shape shape = new Shape(pattern.id, coord.y, coord.x, i + 1, coordDistances[i]);
							feed.shapePoints.put(new Tuple2(pattern.id, shape.shape_pt_sequence), shape);
						}
					}

					if (pattern.shape != null && !pattern.useStraightLineDistances)
						gtfsTrip.shape_id = pattern.id;

					if (trip.wheelchairBoarding != null) {
						if (trip.wheelchairBoarding.equals(AttributeAvailabilityType.AVAILABLE))
							gtfsTrip.wheelchair_accessible = 1;

						else if (trip.wheelchairBoarding.equals(AttributeAvailabilityType.UNAVAILABLE))
							gtfsTrip.wheelchair_accessible = 2;

						else
							gtfsTrip.wheelchair_accessible = 0;

					}
					else if (route.wheelchairBoarding != null) {
						if (route.wheelchairBoarding.equals(AttributeAvailabilityType.AVAILABLE))
							gtfsTrip.wheelchair_accessible = 1;

						else if (route.wheelchairBoarding.equals(AttributeAvailabilityType.UNAVAILABLE))
							gtfsTrip.wheelchair_accessible = 2;

						else
							gtfsTrip.wheelchair_accessible = 0;

					}

					feed.trips.put(gtfsTrip.trip_id, gtfsTrip);

					TripPattern patt = atx.tripPatterns.get(trip.patternId);

					Iterator<TripPatternStop> psi = patt.patternStops.iterator();

					int stopSequence = 1;

					// write the stop times
					for (StopTime st : trip.stopTimes) {
						TripPatternStop ps = psi.next();
						if (st == null)
							continue;

						Stop stop = atx.stops.get(st.stopId);

						if (!st.stopId.equals(ps.stopId)) {
							throw new IllegalStateException("Trip " + trip.id + " does not match its pattern!");
						}

						com.conveyal.gtfs.model.StopTime gst = new com.conveyal.gtfs.model.StopTime();
						gst.arrival_time = st.arrivalTime != null ? st.arrivalTime : Entity.INT_MISSING;
						gst.departure_time = st.departureTime != null ? st.departureTime : Entity.INT_MISSING;

						if (st.dropOffType != null)
							gst.drop_off_type = st.dropOffType.toGtfsValue();
						else if (stop.dropOffType != null)
							gst.drop_off_type = stop.dropOffType.toGtfsValue();

						if (st.pickupType != null)
							gst.pickup_type = st.pickupType.toGtfsValue();
						else if (stop.dropOffType != null)
							gst.drop_off_type = stop.dropOffType.toGtfsValue();

						gst.shape_dist_traveled = ps.shapeDistTraveled;
						gst.stop_headsign = st.stopHeadsign;
						gst.stop_id = stop.getGtfsId();

						// write the stop as needed
						if (!feed.stops.containsKey(gst.stop_id)) {
							feed.stops.put(gst.stop_id, stop.toGtfs());
						}

						gst.stop_sequence = stopSequence++;

						if (ps.timepoint != null)
							gst.timepoint = ps.timepoint ? 1 : 0;
						else
							gst.timepoint = Entity.INT_MISSING;

						gst.trip_id = gtfsTrip.trip_id;

						feed.stop_times.put(new Tuple2(gtfsTrip.trip_id, gst.stop_sequence), gst);
					}

					// create frequencies as needed
					if (trip.useFrequency != null && trip.useFrequency) {
						Frequency f = new Frequency();
						f.trip = gtfsTrip;
						f.start_time = trip.startTime;
						f.end_time = trip.endTime;
						f.exact_times = 0;
						f.headway_secs = trip.headway;
						feed.frequencies.put(gtfsTrip.trip_id, f);
					}
				}
			}

			feed.toFile(output.getAbsolutePath());
		} finally {
			gtx.rollbackIfOpen();
			if (atx != null) atx.rollbackIfOpen();
		}
	}

	public static int toGtfsDate (LocalDate date) {
		return date.getYear() * 10000 + date.getMonthOfYear() * 100 + date.getDayOfMonth();
	}
}


text:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
#endregion

namespace Particle3DSample
{
    /// <summary>
    /// Settings class describes all the tweakable options used
    /// to control the appearance of a particle system.
    /// </summary>
    public class ParticleSettings
    {
        // Name of the texture used by this particle system.
        public string TextureName = null;

        // Maximum number of particles that can be displayed at one time.
        public int MaxParticles = 100;

        // How long these particles will last.
        public TimeSpan Duration = TimeSpan.FromSeconds(1);

        // If greater than zero, some particles will last a shorter time than others.
        public float DurationRandomness = 0;

        // Controls how much particles are influenced by the velocity of the object
        // which created them. You can see this in action with the explosion effect,
        // where the flames continue to move in the same direction as the source
        // projectile. The projectile trail particles, on the other hand, set this
        // value very low so they are less affected by the velocity of the projectile.
        public float EmitterVelocitySensitivity = 1;

        // Range of values controlling how much X and Z axis velocity to give each
        // particle. Values for individual particles are randomly chosen from somewhere
        // between these limits.
        public float MinHorizontalVelocity = 0;
        public float MaxHorizontalVelocity = 0;

        // Range of values controlling how much Y axis velocity to give each particle.
        // Values for individual particles are randomly chosen from somewhere between
        // these limits.
        public float MinVerticalVelocity = 0;
        public float MaxVerticalVelocity = 0;

        // Direction and strength of the gravity effect. Note that this can point in any
        // direction, not just down! The fire effect points it upward to make the flames
        // rise, and the smoke plume points it sideways to simulate wind.
        public Vector3 Gravity = Vector3.Zero;

        // Controls how the particle velocity will change over their lifetime. If set
        // to 1, particles will keep going at the same speed as when they were created.
        // If set to 0, particles will come to a complete stop right before they die.
        // Values greater than 1 make the particles speed up over time.
        public float EndVelocity = 1;

        // Range of values controlling the particle color and alpha. Values for
        // individual particles are randomly chosen from somewhere between these limits.
        public Color MinColor = Color.White;
        public Color MaxColor = Color.White;

        // Range of values controlling how fast the particles rotate. Values for
        // individual particles are randomly chosen from somewhere between these
        // limits. If both these values are set to 0, the particle system will
        // automatically switch to an alternative shader technique that does not
        // support rotation, and thus requires significantly less GPU power. This
        // means if you don't need the rotation effect, you may get a performance
        // boost from leaving these values at 0.
        public float MinRotateSpeed = 0;
        public float MaxRotateSpeed = 0;

        // Range of values controlling how big the particles are when first created.
        // Values for individual particles are randomly chosen from somewhere between
        // these limits.
        public float MinStartSize = 100;
        public float MaxStartSize = 100;

        // Range of values controlling how big particles become at the end of their
        // life. Values for individual particles are randomly chosen from somewhere
        // between these limits.
        public float MinEndSize = 100;
        public float MaxEndSize = 100;

        // Alpha blending settings.
        [ContentSerializerIgnore]
        public BlendState BlendState = BlendState.NonPremultiplied;

        [ContentSerializer(ElementName = "BlendState")]
        private string BlendStateSerializationHelper
        {
            get { return BlendState.Name.Replace("BlendState.", string.Empty); }

            set
            {
                switch (value)
                {
                    case "AlphaBlend":       BlendState = BlendState.AlphaBlend;       break;
                    case "Additive":         BlendState = BlendState.Additive;         break;
                    case "NonPremultiplied": BlendState = BlendState.NonPremultiplied; break;

                    default:
                        throw new ArgumentException("Unknown blend state " + value);
                }
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended.BitmapFonts;
using MonoGame.Forms;
using MonoGame.Forms.Controls;
using MonoGame.Forms.Controls.Styles;
using MonoGame.Forms.Services;
using MonoGame.Forms.Anchoring;
using MonoGame.Extended;

namespace FormTest
{
    /// <summary>
    /// This is the main type for your game.
    /// </summary>
    public class Game1 : Game
    {
        #region [ Members ]
        public GraphicsDeviceManager Graphics;
        SpriteBatch spriteBatch;
        ContentManager WindowContentManager;
        public readonly int ScreenWidthStart = 1280;
        public readonly int ScreenHeightStart = 720;

        Panel myPanel;
        #endregion

        #region [ Constructor ]
        public Game1()
        {
            Graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }
        #endregion

        #region [ Init ]
        protected override void Initialize()
        {
            Graphics.PreferredBackBufferWidth = ScreenWidthStart;
            Graphics.PreferredBackBufferHeight = ScreenHeightStart;
            Graphics.ApplyChanges();

            Window.IsBorderless = false;
            Window.AllowUserResizing = false;

            // Service Provider
            ServiceProvider.Initialize(this);
            base.Initialize();
        }
        #endregion

        #region [ Load Content ]
        protected override void LoadContent()
        {

            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load Assets
            Assets.LoadContent(Content);

            // A style for buttons to use.
            ControlStyle buttonStyle = new ControlStyle(
                Assets.Button,
                Assets.ButtonHover,
                Assets.ButtonPressed,
                null,
                Rectangle.Empty
                );
            buttonStyle.FontStyle = new FontStyle(Assets.Font_MineCraftia11, Color.White);

            // Control Manager - updates / draws all controls
            WindowContentManager = new ContentManager(
                GraphicsDevice,
                new AnchoredRectangle(
                    0, 0,
                    Graphics.PreferredBackBufferWidth,
                    Graphics.PreferredBackBufferHeight
                )
            );

            // Panel:
            ControlStyle panelStyle = new ControlStyle(Assets.Panel_Bg);
            panelStyle.FontStyle = buttonStyle.FontStyle;
            panelStyle.ScrollerStyle = Assets.ScrollerStyle;

            myPanel = new Panel("Test Window", panelStyle, true, true);
            // HACKY HACK HACK - hard coding for simplicity right now
            myPanel.MoveTo(new Vector2(200, 350));
            myPanel.DragAreaOffset = new Rectangle(5, 1, 488, 25);
            myPanel.SetContentArea(40, 37, 417, 445);

            // Button:
            Button btn = new Button("Click Me", buttonStyle);
            btn.OnClicked += btn_click;
            btn.AnchorTo(myPanel, PositionType.Inside_Top_Left, 40, 75, AnchorType.Bounds);

            // Label:  will re-use the same FontStyle as buttons
            Label myLabel1 =
                new Label("Scroll Down?", buttonStyle.FontStyle);
            myLabel1.AnchorTo(btn, PositionType.Below_Left, 0, 50, AnchorType.Bounds);

            Label myLabel2 =
                new Label("-- That's All Folks! --", buttonStyle.FontStyle);
            myLabel2.AnchorTo(myLabel1, PositionType.Below_Left, 0, 150, AnchorType.Bounds);

            myPanel.ContentManager.Add(btn);
            myPanel.ContentManager.Add(myLabel1);
            myPanel.ContentManager.Add(myLabel2);

            WindowContentManager.Add(myPanel);      // Important :)

            // FPS Counter:
           // ServiceProvider.AddService(new FramesPerSecondCounter(100));

            // Dev Console
            ControlStyle styleDevConsole = new ControlStyle(Assets.DevConsole_Bg);
            styleDevConsole.FontStyle = buttonStyle.FontStyle;

            var console = new DevConsole(GraphicsDevice, Keys.OemTilde, new Panel("DevConsole", styleDevConsole));
            console.TextStartPosition = new Vector2(15, 20);

            ServiceProvider.AddService(console);

            // Cursor - note this needs to be added last
            ServiceProvider.AddService(new Cursor(this));
            ServiceProvider.GetService<Cursor>().SetCursor(Assets.Cursor);

        }
        #endregion

        #region [ Button ]
        private void btn_click(object sender, EventArgs e)
        {
        }
        #endregion

        #region [ Unload ]
        protected override void UnloadContent() { }
        #endregion

        #region [ Update ]
        protected override void Update(GameTime gameTime)
        {

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // Write FPS to console
            // string fps = ServiceProvider.GetService<FramesPerSecondCounter>().CurrentFramesPerSecond.ToString();
            //  ServiceProvider.GetService<DevConsole>().Write("FPS:  " + fps);

            // Service Provider
            ServiceProvider.Update(gameTime);

            // UPDATE CONTROL MANAGER
            WindowContentManager.Update(gameTime);

            var console = ServiceProvider.GetService<DevConsole>();

            //console.Write("Panel ContentMgr Content Area Bounds: " + myPanel.ContentManager.ContentArea.Bounds.ToString());
            //console.Write("Panel Position: " + myPanel.Position.ToString());
            base.Update(gameTime);
        }
        #endregion

        #region [ Draw ]
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(30, 30, 30));

            // DRAW CONTROL MANAGER
            WindowContentManager.Draw();

            // Service Provider:  Last so that mouse on top:
            ServiceProvider.Draw(gameTime);

            base.Draw(gameTime);
        }
        #endregion

    }
}