text:
package org.apache.geode.admin.internal;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;

import org.apache.logging.log4j.Logger;

import org.apache.geode.SystemFailure;
import org.apache.geode.admin.AdminException;
import org.apache.geode.admin.GemFireHealth;
import org.apache.geode.admin.GemFireHealthConfig;
import org.apache.geode.admin.GemFireMemberStatus;
import org.apache.geode.admin.RegionSubRegionSnapshot;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.Config;
import org.apache.geode.internal.admin.AdminBridgeServer;
import org.apache.geode.internal.admin.CacheInfo;
import org.apache.geode.internal.admin.DLockInfo;
import org.apache.geode.internal.admin.GemFireVM;
import org.apache.geode.internal.admin.GfManagerAgent;
import org.apache.geode.internal.admin.HealthListener;
import org.apache.geode.internal.admin.Stat;
import org.apache.geode.internal.admin.StatAlertDefinition;
import org.apache.geode.internal.admin.StatListener;
import org.apache.geode.internal.admin.StatResource;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.net.SocketCreator;

/**
 * A thread that monitors the health of the distributed system. It is kind of like a
 * {@link org.apache.geode.distributed.internal.HealthMonitorImpl}. In order to get it to place nice
 * with the rest of the health monitoring APIs, this class pretends that it is a
 * GemFireVM. Kind of hokey, but it beats a bunch of special-case code.
 *
 *
 * @since GemFire 3.5
 */
class DistributedSystemHealthMonitor implements Runnable, GemFireVM {

  private static final Logger logger = LogService.getLogger();

  /** Evaluates the health of the distributed system */
  private DistributedSystemHealthEvaluator eval;

  /** Notified when the health of the distributed system changes */
  private GemFireHealthImpl healthImpl;

  /** The number of seconds between health checks */
  private int interval;

  /** The thread in which the monitoring occurs */
  private Thread thread;

  /** Has this monitor been asked to stop? */
  private volatile boolean stopRequested = false;

  /** The health of the distributed system the last time we checked. */
  private GemFireHealth.Health prevHealth = GemFireHealth.GOOD_HEALTH;

  /**
   * The most recent OKAY_HEALTH diagnoses of the GemFire system
   */
  private List okayDiagnoses;

  /**
   * The most recent POOR_HEALTH diagnoses of the GemFire system
   */
  private List poorDiagnoses;

  ////////////////////// Constructors //////////////////////

  /**
   * Creates a new DistributedSystemHealthMonitor that evaluates the health of the
   * distributed system against the given thresholds once every interval seconds.
   *
   * @param eval Used to evaluate the health of the distributed system
   * @param healthImpl Receives callbacks when the health of the distributed system changes
   * @param interval How often the health is checked
   */
  DistributedSystemHealthMonitor(DistributedSystemHealthEvaluator eval,
      GemFireHealthImpl healthImpl, int interval) {
    this.eval = eval;
    this.healthImpl = healthImpl;
    this.interval = interval;
    this.okayDiagnoses = new ArrayList();
    this.poorDiagnoses = new ArrayList();

    ThreadGroup group = LoggingThreadGroup.createThreadGroup(
        LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITORS.toLocalizedString(),
        logger);
    String name = LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITOR_FOR_0
        .toLocalizedString(eval.getDescription());
    this.thread = new Thread(group, this, name);
    this.thread.setDaemon(true);
  }

  /**
   * Does the work of monitoring the health of the distributed system.
   */
  public void run() {
    if (logger.isDebugEnabled()) {
      logger.debug("Monitoring health of {} every {} seconds", this.eval.getDescription(),
          interval);
    }

    while (!this.stopRequested) {
      SystemFailure.checkFailure();
      try {
        Thread.sleep(interval * 1000);
        List status = new ArrayList();
        eval.evaluate(status);

        GemFireHealth.Health overallHealth = GemFireHealth.GOOD_HEALTH;
        this.okayDiagnoses.clear();
        this.poorDiagnoses.clear();

        for (Iterator iter = status.iterator(); iter.hasNext();) {
          AbstractHealthEvaluator.HealthStatus health =
              (AbstractHealthEvaluator.HealthStatus) iter.next();
          if (overallHealth == GemFireHealth.GOOD_HEALTH) {
            if ((health.getHealthCode() != GemFireHealth.GOOD_HEALTH)) {
              overallHealth = health.getHealthCode();
            }

          } else if (overallHealth == GemFireHealth.OKAY_HEALTH) {
            if (health.getHealthCode() == GemFireHealth.POOR_HEALTH) {
              overallHealth = GemFireHealth.POOR_HEALTH;
            }
          }

          GemFireHealth.Health healthCode = health.getHealthCode();
          if (healthCode == GemFireHealth.OKAY_HEALTH) {
            this.okayDiagnoses.add(health.getDiagnosis());

          } else if (healthCode == GemFireHealth.POOR_HEALTH) {
            this.poorDiagnoses.add(health.getDiagnosis());
            break;
          }
        }

        if (overallHealth != prevHealth) {
          healthImpl.healthChanged(this, overallHealth);
          this.prevHealth = overallHealth;
        }

      } catch (InterruptedException ex) {
        // We're all done
        // No need to reset the interrupted flag, since we're going to exit.
        break;
      }
    }

    eval.close();
    if (logger.isDebugEnabled()) {
      logger.debug("Stopped checking for distributed system health");
    }
  }

  /**
   * Starts this DistributedSystemHealthMonitor
   */
  void start() {
    this.thread.start();
  }

  /**
   * Stops this DistributedSystemHealthMonitor
   */
  void stop() {
    if (this.thread.isAlive()) {
      this.stopRequested = true;
      this.thread.interrupt();
      this.healthImpl.nodeLeft(null, this);

      try {
        this.thread.join();
      } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
        logger.warn(
            LocalizedMessage.create(
                LocalizedStrings.DistributedSystemHealthMonitor_INTERRUPTED_WHILE_STOPPING_HEALTH_MONITOR_THREAD),
            ex);
      }
    }
  }

  ////////////////////// GemFireVM Methods //////////////////////

  public java.net.InetAddress getHost() {
    try {
      return SocketCreator.getLocalHost();

    } catch (Exception ex) {
      throw new org.apache.geode.InternalGemFireException(
          LocalizedStrings.DistributedSystemHealthMonitor_COULD_NOT_GET_LOCALHOST
              .toLocalizedString());
    }
  }

  public String getName() {
    throw new UnsupportedOperationException("Not a real GemFireVM");
  }

  public java.io.File getWorkingDirectory() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public java.io.File getGeodeHomeDir() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public java.util.Date getBirthDate() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public Properties getLicenseInfo() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public GemFireMemberStatus getSnapshot() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public RegionSubRegionSnapshot getRegionSnapshot() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public StatResource[] getStats(String statisticsTypeName) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public StatResource[] getAllStats() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public DLockInfo[] getDistributedLockInfo() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void addStatListener(StatListener observer, StatResource observedResource,
      Stat observedStat) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void removeStatListener(StatListener observer) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void addHealthListener(HealthListener observer, GemFireHealthConfig cfg) {

  }

  public void removeHealthListener() {

  }

  public void resetHealthStatus() {
    this.prevHealth = GemFireHealth.GOOD_HEALTH;
  }

  public String[] getHealthDiagnosis(GemFireHealth.Health healthCode) {
    if (healthCode == GemFireHealth.GOOD_HEALTH) {
      return new String[0];

    } else if (healthCode == GemFireHealth.OKAY_HEALTH) {
      String[] array = new String[this.okayDiagnoses.size()];
      this.okayDiagnoses.toArray(array);
      return array;

    } else {
      Assert.assertTrue(healthCode == GemFireHealth.POOR_HEALTH);
      String[] array = new String[this.poorDiagnoses.size()];
      this.poorDiagnoses.toArray(array);
      return array;
    }
  }

  public Config getConfig() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void setConfig(Config cfg) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public GfManagerAgent getManagerAgent() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public String[] getSystemLogs() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void setInspectionClasspath(String classpath) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public String getInspectionClasspath() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public Region[] getRootRegions() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public Region getRegion(CacheInfo c, String path) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public Region createVMRootRegion(CacheInfo c, String name, RegionAttributes attrs) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public Region createSubregion(CacheInfo c, String parentPath, String name,
      RegionAttributes attrs) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void setCacheInspectionMode(int mode) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public int getCacheInspectionMode() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public void takeRegionSnapshot(String regionName, int snapshotId) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public InternalDistributedMember getId() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public CacheInfo getCacheInfo() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public String getVersionInfo() {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public CacheInfo setCacheLockTimeout(CacheInfo c, int v) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public CacheInfo setCacheLockLease(CacheInfo c, int v) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public CacheInfo setCacheSearchTimeout(CacheInfo c, int v) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public AdminBridgeServer addCacheServer(CacheInfo cache) throws AdminException {

    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public AdminBridgeServer getBridgeInfo(CacheInfo cache, int id) throws AdminException {

    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public AdminBridgeServer startBridgeServer(CacheInfo cache, AdminBridgeServer bridge)
      throws AdminException {

    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  public AdminBridgeServer stopBridgeServer(CacheInfo cache, AdminBridgeServer bridge)
      throws AdminException {

    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  /**
   * This operation is not supported for this object. Will throw UnsupportedOperationException if
   * invoked.
   */
  public void setAlertsManager(StatAlertDefinition[] alertDefs, long refreshInterval,
      boolean setRemotely) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  /**
   * This operation is not supported for this object. Will throw UnsupportedOperationException if
   * invoked.
   */
  public void setRefreshInterval(long refreshInterval) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }

  /**
   * This operation is not supported for this object. Will throw UnsupportedOperationException if
   * invoked.
   */
  public void updateAlertDefinitions(StatAlertDefinition[] alertDefs, int actionCode) {
    throw new UnsupportedOperationException(
        LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString());
  }
}


text:
int options_logic( SDL_Window* l_window, SDL_Renderer* l_renderer )
{
	// Estado de jogo selecionado
	int l_gameState = 6;

	// Textura que sera usada
	SDL_Texture* l_texture = NULL;

	// Efeito de fade in da textura
	l_gameState = fade_in_texture( "images/non_sprites/breve.png", l_window, l_renderer, l_gameState );
	if( l_gameState != -1 )
	{
		// Carrega a textura com opacidade normal
		l_texture = load_texture( "images/non_sprites/breve.png", l_window, l_renderer );
		if( l_texture == NULL )
		{
			printf( "Unable to create texture from [images/non_sprites/breve.png]! SDL Error: %s\n", SDL_GetError() );
			l_gameState = -1;
		}

		else
		{
			// Apresenta a imagem com a opacidade normal
			SDL_RenderCopy( l_renderer, l_texture, NULL, NULL );
			SDL_RenderPresent( l_renderer );
		}
	}

	// Flag de evento
	SDL_Event e;

	while( l_gameState == 6 )
	{
		while( SDL_PollEvent( &e ) != 0 )
	    {
	    	// Usuario deseja sair
			if( e.type == SDL_QUIT )
			{
				l_gameState = -1;
				break;
			}

	    	if( e.type == SDL_KEYDOWN )
			{
				switch( e.key.keysym.sym )
	    		{
	        		case SDLK_SPACE:
	        			l_gameState = 2;
	        			break;

	        		case SDLK_RETURN:
	        			l_gameState = 2;
	        			break;
				}
			}
		}
	}
	// Libera imagem carregada
	SDL_DestroyTexture( l_texture );
	l_texture = NULL;

	// Libera o renderizador
	SDL_RenderClear( l_renderer );

	return l_gameState;
}

redpajama_set_name: RedPajamaGithub


text:
(function() {
    'use strict';

    var models = {},
        views = {},
        collections = {},
        etch = {};

    // versioning as per semver.org
    etch.VERSION = '0.6.2';

    etch.config = {
        // selector to specify editable elements
        selector: '.editable',

        // Named sets of buttons to be specified on the editable element
        // in the markup as "data-button-class"
        buttonClasses: {
            'default': ['save'],
            'all': ['bold', 'italic', 'underline', 'unordered-list', 'ordered-list', 'link', 'clear-formatting', 'save'],
            'title': ['bold', 'italic', 'underline', 'save']
        }
    };

    models.Editor = Backbone.Model;

    views.Editor = Backbone.View.extend({
        initialize: function() {
            this.$el = $(this.el);

            // Model attribute event listeners:
            _.bindAll(this, 'changeButtons', 'changePosition', 'changeEditable', 'insertImage');
            this.model.bind('change:buttons', this.changeButtons);
            this.model.bind('change:position', this.changePosition);
            this.model.bind('change:editable', this.changeEditable);

            // Init Routines:
            this.changeEditable();
        },

        events: {
            'click .etch-bold': 'toggleBold',
            'click .etch-italic': 'toggleItalic',
            'click .etch-underline': 'toggleUnderline',
            'click .etch-heading': 'toggleHeading',
            'click .etch-unordered-list': 'toggleUnorderedList',
            'click .etch-justify-left': 'justifyLeft',
            'click .etch-justify-center': 'justifyCenter',
            'click .etch-justify-right': 'justifyRight',
            'click .etch-ordered-list': 'toggleOrderedList',
            'click .etch-link': 'toggleLink',
            'click .etch-image': 'getImage',
            'click .etch-save': 'save',
            'click .etch-clear-formatting': 'clearFormatting'
        },

        changeEditable: function() {
            this.setButtonClass();
            // Im assuming that Ill add more functionality here
        },

        setButtonClass: function() {
            // check the button class of the element being edited and set the associated buttons on the model
            var editorModel = this.model;
            var buttonClass = editorModel.get('editable').attr('data-button-class') || 'default';
            editorModel.set({ buttons: etch.config.buttonClasses[buttonClass] });
        },

        changeButtons: function() {
            // render the buttons into the editor-panel
            this.$el.empty();
            var view = this;
            var buttons = this.model.get('buttons');

            // hide editor panel if there are no buttons in it and exit early
            if (!buttons.length) { $(this.el).hide(); return; }

            _.each(this.model.get('buttons'), function(button){
                var $buttonEl = $('');
                view.$el.append($buttonEl);
            });

            $(this.el).show('fast');
        },

        changePosition: function() {
            // animate editor-panel to new position
            var pos = this.model.get('position');
            this.$el.animate({'top': pos.y, 'left': pos.x}, { queue: false });
        },

        wrapSelection: function(selectionOrRange, elString, cb) {
            // wrap current selection with elString tag
            var range = selectionOrRange === Range ? selectionOrRange : selectionOrRange.getRangeAt(0);
            var el = document.createElement(elString);
            range.surroundContents(el);
        },

        clearFormatting: function(e) {
            e.preventDefault();
            document.execCommand('removeFormat', false, null);
        },

        toggleBold: function(e) {
            e.preventDefault();
            document.execCommand('bold', false, null);
        },

        toggleItalic: function(e) {
            e.preventDefault();
            document.execCommand('italic', false, null);
        },

        toggleUnderline: function(e) {
            e.preventDefault();
            document.execCommand('underline', false, null);
        },

        toggleHeading: function(e) {
            e.preventDefault();
            var range = window.getSelection().getRangeAt(0);
            var wrapper = range.commonAncestorContainer.parentElement
            if ($(wrapper).is('h3')) {
                $(wrapper).replaceWith(wrapper.textContent)
                return;
            }
            var h3 = document.createElement('h3');
            range.surroundContents(h3);
        },

        urlPrompt: function(callback) {
            // This uses the default browser UI prompt to get a url.
            // Override this function if you want to implement a custom UI.

            var url = prompt('Enter a url', 'http://');

            // Ensure a new link URL starts with http:// or https://
            // before it's added to the DOM.
            //
            // NOTE: This implementation will disallow relative URLs from being added
            // but will make it easier for users typing external URLs.
            if (/^((http|https)...)/.test(url)) {
                callback(url);
            } else {
                callback("http://" + url);
            }
        },

        toggleLink: function(e) {
            e.preventDefault();
            var range = window.getSelection().getRangeAt(0);

            // are we in an anchor element?
            if (range.startContainer.parentNode.tagName === 'A' || range.endContainer.parentNode.tagName === 'A') {
                // unlink anchor
                document.execCommand('unlink', false, null);
            } else {
                // promt for url and create link
                this.urlPrompt(function(url) {
                    if(url === null) return false;
                    document.execCommand('createLink', false, url);
                });
            }
        },

        toggleUnorderedList: function(e) {
            e.preventDefault();
            document.execCommand('insertUnorderedList', false, null);
        },

        toggleOrderedList: function(e){
            e.preventDefault();
            document.execCommand('insertOrderedList', false, null);
        },

        justifyLeft: function(e) {
            e.preventDefault();
            document.execCommand('justifyLeft', false, null);
        },

        justifyCenter: function(e) {
            e.preventDefault();
            document.execCommand('justifyCenter', false, null);
        },

        justifyRight: function(e) {
            e.preventDefault();
            document.execCommand('justifyRight', false, null);
        },

        getImage: function(e) {
            e.preventDefault();

            // call startUploader with callback to handle inserting it once it is uploded/cropped
            this.startUploader(this.insertImage);
        },

        startUploader: function(cb) {
            // initialize Image Uploader
            var model = new models.ImageUploader();
            var view = new views.ImageUploader({model: model});

            // stash a reference to the callback to be called after image is uploaded
            model._imageCallback = function(image) {
                view.startCropper(image, cb);
            };

            // stash reference to saved range for inserting the image once its
            this._savedRange = window.getSelection().getRangeAt(0);

            // insert uploader html into DOM
            $('body').append(view.render().el);
        },

        insertImage: function(image) {
            // insert image - passed as a callback to startUploader
            var sel = window.getSelection();
            sel.removeAllRanges();
            sel.addRange(this._savedRange);

            var attrs = {
                'editable': this.model.get('editable'),
                'editableModel': this.model.get('editableModel')
            };

            _.extend(attrs, image);

            var model = new models.EditableImage(attrs);
            var view = new views.EditableImage({model: model});
            this._savedRange.insertNode($(view.render().el).addClass('etch-float-left')[0]);
        },

        save: function(e) {
            e.preventDefault();
            var editableModel = this.model.get('editableModel');
            editableModel.trigger('save');
        }
    });

    // tack on models, views, etc... as well as init function
    _.extend(etch, {
        models: models,
        views: views,
        collections: collections,

        // This function is to be used as callback to whatever event
        // you use to initialize editing
        editableInit: function(e) {
            e.stopPropagation();
            var target = e.target || e.srcElement;
            var $editable = $(target).etchFindEditable();
            $editable.attr('contenteditable', true);

            // if the editor isn't already built, build it
            var $editor = $('.etch-editor-panel');
            var editorModel = $editor.data('model');
            console.log($editor)
            if (!$editor.size()) {
                $editor = $('
');
                var editorAttrs = { editable: $editable, editableModel: this.model };
                document.body.appendChild($editor[0]);
                $editor.etchInstantiate({classType: 'Editor', attrs: editorAttrs});
                editorModel = $editor.data('model');
                // check if we are on a new editable
            } else if ($editable[0] !== editorModel.get('editable')[0]) {
                // set new editable

                // check
                editorModel.set({
                    editable: $editable,
                    editableModel: this.model
                });
            }

            // Firefox seems to be only browser that defaults to `StyleWithCSS == true`
            // so we turn it off here. Plus a try..catch to avoid an error being thrown in IE8.
            try {
                document.execCommand('StyleWithCSS', false, false);
            }
            catch (err) {
                // expecting to just eat IE8 error, but if different error, rethrow
                if (err.message !== "Invalid argument.") {
                    throw err;
                }
            }

            if (models.EditableImage) {
                // instantiate any images that may be in the editable
                var $imgs = $editable.find('img');
                if ($imgs.size()) {
                    var attrs = { editable: $editable, editableModel: this.model };
                    $imgs.each(function() {
                        var $this = $(this);
                        if (!$this.data('editableImageModel')) {
                            var editableImageModel =  new models.EditableImage(attrs);
                            var editableImageView = new views.EditableImage({model: editableImageModel, el: this, tagName: this.tagName});
                            $this.data('editableImageModel', editableImageModel);
                        }
                    });
                }
            }

            // listen for mousedowns that are not coming from the editor
            // and close the editor
            $('body').bind('mousedown.editor', function(e) {
                // check to see if the click was in an etch tool
                var target = e.target || e.srcElement;
                if ($(target).not('.etch-editor-panel, .etch-editor-panel *, .etch-image-tools, .etch-image-tools *').size()) {
                    // remove editor
                    $editor.remove();

                    if (models.EditableImage) {
                        // unblind the image-tools if the editor isn't active
                        $editable.find('img').unbind('mouseenter');

                        // remove any latent image tool model references
                        $(etch.config.selector+' img').data('editableImageModel', false)
                    }

                    // once the editor is removed, remove the body binding for it
                    $(this).unbind('mousedown.editor');
                }
            });

            editorModel.set({position: {x: e.pageX - 15, y: e.pageY - 80}});
        }
    });

    // jquery helper functions
    $.fn.etchInstantiate = function(options, cb) {
        return this.each(function() {
            var $el = $(this);
            options || (options = {});

            var settings = {
                el: this,
                attrs: {}
            }

            _.extend(settings, options);

            var model = new models[settings.classType](settings.attrs, settings);

            // initialize a view is there is one
            if (_.isFunction(views[settings.classType])) {
                var view = new views[settings.classType]({model: model, el: this, tagName: this.tagName});
            }

            // stash the model and view on the elements data object
            $el.data({model: model});
            $el.data({view: view});

            if (_.isFunction(cb)) {
                cb({model: model, view: view});
            }
        });
    }

    $.fn.etchFindEditable = function() {
        // function that looks for the editable selector on itself or its parents
        // and returns that el when it is found
        var $el = $(this);
        console.log('etch ' + $el)
        return $el.is(etch.config.selector) ? $el : $el.closest(etch.config.selector);
    }

    window.etch = etch;
})();


text:
/*
 * Mach Operating System
 * Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University
 * All Rights Reserved.
 *
 * Permission to use, copy, modify and distribute this software and its
 * documentation is hereby granted, provided that both the copyright
 * notice and this permission notice appear in all copies of the
 * software, derivative works or modified versions, and any portions
 * thereof, and that both notices appear in supporting documentation.
 *
 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 *
 * Carnegie Mellon requests users of this software to return to
 *
 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
 *  School of Computer Science
 *  Carnegie Mellon University
 *  Pittsburgh PA 15213-3890
 *
 * any improvements or extensions that they make and grant Carnegie Mellon
 * the rights to redistribute these changes.
 */

/*
 *	Items provided by the Mach environment initialization.
 */

#ifndef _MACH_INIT_
#define _MACH_INIT_     1

#include <mach/mach_types.h>
#include <mach/vm_page_size.h>
#include <stdarg.h>

#include <sys/cdefs.h>

/*
 *	Kernel-related ports; how a task/thread controls itself
 */

__BEGIN_DECLS
extern mach_port_t mach_host_self(void);
extern mach_port_t mach_thread_self(void);
extern kern_return_t host_page_size(host_t, vm_size_t *);

extern mach_port_t      mach_task_self_;
#define mach_task_self() mach_task_self_
#define current_task()  mach_task_self()

__END_DECLS
#include <mach/mach_traps.h>
__BEGIN_DECLS

/*
 *	Other important ports in the Mach user environment
 */

extern  mach_port_t     bootstrap_port;

/*
 *	Where these ports occur in the "mach_ports_register"
 *	collection... only servers or the runtime library need know.
 */

#define NAME_SERVER_SLOT        0
#define ENVIRONMENT_SLOT        1
#define SERVICE_SLOT            2

#define MACH_PORTS_SLOTS_USED   3

/*
 *	fprintf_stderr uses vprintf_stderr_func to produce
 *	error messages, this can be overridden by a user
 *	application to point to a user-specified output function
 */
extern int (*vprintf_stderr_func)(const char *format, va_list ap);

__END_DECLS

#endif  /* _MACH_INIT_ */


text:
// ==ORIGINAL==

interface a {
    name: string;
    age: number;
}

interface b extends a {
    color: string;
}

function /*[#|*/f/*|]*/(){
    return fetch("https://typescriptlang.org").then(res).catch(rej).then(res);
}

function res(result): b{
    return {name: "myName", age: 22, color: "red"};
}

function rej(reject): a{
    return {name: "myName", age: 27};
}

// ==ASYNC FUNCTION::Convert to async function==

interface a {
    name: string;
    age: number;
}

interface b extends a {
    color: string;
}

async function f(){
    let result: a;
    try {
        const result_1 = await fetch("https://typescriptlang.org");
        result = await res(result_1);
    } catch (reject) {
        result = await rej(reject);
    }
    return res(result);
}

function res(result): b{
    return {name: "myName", age: 22, color: "red"};
}

function rej(reject): a{
    return {name: "myName", age: 27};
}


text:
package org.tuxdevelop.spring.cloud.demo.customer.service.logic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tuxdevelop.spring.cloud.demo.customer.service.domain.Customer;
import org.tuxdevelop.spring.cloud.demo.customer.service.domain.CustomerRegistration;
import org.tuxdevelop.spring.cloud.demo.customer.service.exception.NoSuchCustomerException;
import org.tuxdevelop.spring.cloud.demo.customer.service.repository.CustomerRegistrationRepository;
import org.tuxdevelop.spring.cloud.demo.customer.service.repository.CustomerRepository;
import org.tuxdevelop.spring.cloud.demo.service.dto.customer.CustomerDTO;

@Component
public class CustomerLogicBean {

    private final CustomerRepository customerRepository;
    private final CustomerRegistrationRepository customerRegistrationRepository;

    @Autowired
    public CustomerLogicBean(final CustomerRepository customerRepository,
                             final CustomerRegistrationRepository customerRegistrationRepository) {
        this.customerRepository = customerRepository;
        this.customerRegistrationRepository = customerRegistrationRepository;
    }

    public CustomerDTO save(final CustomerDTO customerDTO) {
        final Customer customer = new Customer(customerDTO);
        customer.validatAdd();
        return customerRepository.save(customer).mapToDTO();
    }

    public CustomerDTO get(final Long customerNumber) {
        final Customer customer = customerRepository.findOne(customerNumber);
        if (customer == null) {
            throw new NoSuchCustomerException("The Customer with the customerId: " + customer + " does not exist");
        }
        return customer.mapToDTO();
    }

    public CustomerDTO searchByUserName(final String userName) {
        final CustomerRegistration customerRegistration = customerRegistrationRepository.findByCustomerLoginUserName(userName);
        final CustomerDTO customerDTO;
        if (customerRegistration != null) {
            final Long customerNumber = customerRegistration.getCustomerNumber();
            customerDTO = get(customerNumber);
        } else {
            throw new NoSuchCustomerException("The Customer with the user name: " + userName + " does not exist");
        }
        return customerDTO;
    }

    //TODO business validation
    public void delete(final CustomerDTO customerDTO) {
        customerRepository.delete(customerDTO.getId());
    }

}


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>SITNA - Ejemplo de SITNA.Map.searchFeature</title>
    <link rel="stylesheet" href="examples.css" />

Ejemplo de uso de SITNA.Map.searchFeature.

Opciones del método.

Capa<input type="text" id="capa" placeholder="Nombre capa de IDENA" value="IDENA:AGROAL_Pol_VinosPago" />

Campo<input type="text" id="campo" placeholder="Nombre campo" value="DESCRIPCIO" />

Valor<input type="text" id="valor" placeholder="Valor a encontrar" value="Pago de Otazu" />

<button id="searchBtn">Buscar</button>

<button id="removeBtn">Eliminar búsqueda</button>


text:
![screenshot](https://i.imgur.com/uZSZ5Y4.png?1)

# React Isomorphic Starterkit

Isomorphic starterkit with server-side React rendering using
[npm](https://www.npmjs.com),
[piping](https://github.com/mdlawson/piping),
[webpack](https://webpack.github.io/),
[webpack-dev-server](https://github.com/webpack/webpack-dev-server),
[koa](http://koajs.com),
[babel](http://babeljs.io),
[react](https://facebook.github.io/react),
[react-router](https://github.com/rackt/react-router),
[react-hot-loader](https://gaearon.github.io/react-hot-loader),
[react-transmit](https://github.com/RickWong/react-transmit),
[react-inline-css](https://github.com/RickWong/react-inline-css)

![version](https://img.shields.io/npm/v/react-isomorphic-starterkit.svg) ![license](https://img.shields.io/npm/l/react-isomorphic-starterkit.svg) [![Package Quality](http://npm.packagequality.com/shield/react-isomorphic-starterkit.svg)](http://packagequality.com/#?package=react-isomorphic-starterkit) ![installs](https://img.shields.io/npm/dt/react-isomorphic-starterkit.svg) ![downloads](https://img.shields.io/github/downloads/RickWong/react-isomorphic-starterkit/latest/total.svg)

## Features

- Fully automated toolchain with npm run scripts
- React 0.14 + React Router 1.0 on the client and server
- Babel 6 automatically compiles ES2015 + ES7 draft
- Auto-restarting web server with Koa and Piping
- Webpack for watching and production builds
- React Hot Loader for instant client updates
- React Transmit to preload on server and hydrate client
- InlineCss-component for styling components

It just works out-of-the-box.

## Installation

Development

```bash
git clone https://github.com/RickWong/react-isomorphic-starterkit.git
cd react-isomorphic-starterkit

npm install
npm run watch     # Yes, ONE command for server AND client development!
```

Production

```bash
NODE_ENV=production npm run build
NODE_ENV=production npm run start
```

## Usage

Run `npm run watch` in your terminal and play with `views/Main.js` to get a feel of
the server-side rendering and client-side hot updates.

## Community

Let's start one together! After you ★Star this project, follow [@Rygu](https://twitter.com/rygu)
on Twitter.

## License

BSD 3-Clause license. Copyright © 2015, Rick Wong. All rights reserved.


text:
layout: home
toc: true
---
findbugs-android Gradle plugin creates FindBugs tasks for each variant of Android application or library module

{% include toc %}

## Introduction
Static analysis tools are generous code reviewers you don't have to pay wages to, buy expensive hardware for and find issues and bugs in your code. Being built on Java, Android projects have access to many of the static analysis tools from Java ecosystem.

## Why
In order to create FindBugs report for Android projects, you need to create `FindBugs` tasks and configure them by providing paths to source code, compiled classes and classpath. It can be troublesome since Android projects can have different flavors and build types, thus requiring additional paths to be set. This plugin provides those tasks already configured for you.

In addition, the plugin automatically excludes generated classes from Android databinding library, android resource, Butterknife and Dagger 2. If you want more added to this list or want it configurable, please [open an issue](https://github.com/ChaitanyaPramod/findbugs-android/issues/new).

## Usage
Apply the plugin after the Android gradle plugin. The FindBugs tasks are already hooked to the `check` task.
```gradle
buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    // ...
    classpath 'com.chaitanyapramod.gradle:findbugs-android:1.0'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'com.chaitanyapramod.findbugs-android'

android {
  // ...
  buildTypes {
      debug {}
      release {}
  }
}
```
This would create the following Gradle tasks:
* `findbugsDebug`
* `findbugsRelease`

Note that these findbugs tasks are also hooked to `check` task.

## Configuration
Use the standard findbugs extension to configure the FindBugs tasks
{% highlight groovy %}
buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    // ...
    classpath 'com.chaitanyapramod.gradle:findbugs-android:1.0'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'com.chaitanyapramod.findbugs-android'

findbugs {
  toolVersion '3.0.1'
  ignoreFailures true
  effort 'max'
  reportLevel 'high'
  excludeBugsFilter = file("$rootProject.projectDir/config/findbugs/excludeBugsFilter.xml")
}

android {
  // ...
  buildTypes {
      debug {}
      release {}
  }
}
{% endhighlight %}

### Report Format
By default, XML reports are generated. You can add the following snippet to get HTML reports

{% highlight groovy %}
tasks.withType(FindBugs) {
    reports {
        xml.enabled = false
        html.enabled = true
    }
}
{% endhighlight %}

## Contributing
Contributions are welcome. Contributers will find looking through [Gradle sources](https://github.com/gradle/gradle/tree/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality) of the classes [`FindBugs`](https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/FindBugs.java), [`FindBugsExtension`](https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/FindBugsExtension.java) and [`FindBugsPlugin`](https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/FindBugsPlugin.java) useful.


text:
const browsers = {
  electron: require('electron-stream'),
  phantomjs: require('phantomjs-stream'),
  osx: {
    chrome: require('osx-chrome'),
    firefox: require('osx-firefox'),
    safari: require('osx-safari')
  },
  linux: {
    chrome: require('linux-chrome'),
    firefox: require('osx-firefox')
  },
  windows: {
    chrome: require('windows-chrome'),
    edge: require('windows-edge')
  }
}

module.exports = (os, browser, opts, cb) => {
  if (browser === 'electron') {
    const e = browsers.electron(opts)
    e.end(`location = '${opts.uri}';`)
    setImmediate(() => cb(null, e))
  } else if (/^phantom/.test(browser)) {
    const p = browsers.phantomjs(opts)
    p.end(`location = '${opts.uri}';`)
    setImmediate(() => cb(null, p))
  } else if (os === 'linux' && browser === 'chrome') {
    setImmediate(() => cb(null, browsers.linux.chrome(opts)))
  } else if (browsers[os] && browsers[os][browser]) {
    browsers[os][browser](opts, cb)
  } else {
    throw new Error('OS / browser combination not available')
  }
}


text:
<?php

/* AAKRStoreBundle:Default:pokaz_film.html.twig */
class __TwigTemplate_0af8989545c2fa0dcbb775d5a724b37ea7996a14819e100b9601739a28be3f65 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 1
        try {
            $this->parent = $this->env->loadTemplate("::base.html.twig");
        } catch (Twig_Error_Loader $e) {
            $e->setTemplateFile($this->getTemplateName());
            $e->setTemplateLine(1);

            throw $e;
        }

        $this->blocks = array(
            'body' => array($this, 'block_body'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "::base.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_body($context, array $blocks = array())
    {
        // line 4
        echo "

Film:

Tytuł Filmu:

<h12>";
        // line 12
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "tytul", array()), "html", null, true);
        echo "

Gatunek:

<h12>";
        // line 16
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "gatunek", array()), "html", null, true);
        echo "

Aktorzy:

<h12>";
        // line 20
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "aktorzy", array()), "html", null, true);
        echo "

Cena:

<h12>";
        // line 24
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "cena", array()), "html", null, true);
        echo "

env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "id", array()), "html", null, true);
        echo "/";
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "tytul", array()), "html", null, true);
        echo "\"> Dodaj recenzje

env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "id", array()), "html", null, true);
        echo "/";
        echo twig_escape_filter($this->env, (isset($context["idUzytkownika"]) ? $context["idUzytkownika"] : $this->getContext($context, "idUzytkownika")), "html", null, true);
        echo "/";
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["film"]) ? $context["film"] : $this->getContext($context, "film")), "cena", array()), "html", null, true);
        echo "\"> Dodaj do koszyka

Recenzje:

     ";
        // line 34
        $context['_parent'] = (array) $context;
        $context['_seq'] = twig_ensure_traversable((isset($context["recenzjeFilmu"]) ? $context["recenzjeFilmu"] : $this->getContext($context, "recenzjeFilmu")));
        foreach ($context['_seq'] as $context["_key"] => $context["recenzja"]) {
            // line 35
            echo "

";
            // line 37
            echo "                ";
            echo twig_escape_filter($this->env, $context["recenzja"], "html", null, true);
            echo "
";
            // line 39
            echo "

     ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['recenzja'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 43
        echo "

";
    }

    public function getTemplateName()
    {
        return "AAKRStoreBundle:Default:pokaz_film.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  116 => 43,  107 => 39,  102 => 37,  99 => 35,  95 => 34,  81 => 27,  75 => 26,  70 => 24,  63 => 20,  56 => 16,  49 => 12,  39 => 4,  36 => 3,  11 => 1,);
    }
}


text:
Generate PDF from HTML using PhantomJS!

Supporting *URL*, *FILE* and *STRING* formats for HTML resource.

## Why PhantomPDF?

Within the Ruby community, there is no simply way to generate *PDF* from *HTML*. You must setup dependences separate and then call some wrapped methods around. When you manage several servers or need to do migrations around, things become much more terrible!

PhantomPDF was born to simplify those. It brings simple API and easy maintenance.

**Yes, PhantomPDF is simply!** You only need to take care of your HTML layout. And then put remaining work to PhantomPDF.

## How to start?

### Installation

##### For Gemfile project
Adding following to your `Gemfile`

```ruby
gem 'phantompdf'
```

and then execute

```ruby
$ bundle
```

##### For normal project
```ruby
$ gem install phantompdf
```

That's all! Pretty simple?!

### Usage

##### Quick starts
```ruby
require 'phantompdf'

options = {
  :format => 'A4',
  :margin => '1cm'
}
output_file = '/tmp/phantompdf_google.pdf'

# for *URL* resource
url = 'http://www.google.com'
url_generator = PhantomPDF::Generator.new(url, output_file, options)
returned_file = url_generator.generate  # If output_file is valid(writable) returned_file == output_file, otherwise returned_file should be temp file of your OS.

# for *FILE* resource
file = 'file://path/to/file.html'
file_generator = PhantomPDF::Generator.new(file, output_file, options)
returned_file = file_generator.generate

# for *STRING* resource
html = '<h1>Hello, PhantomPDF!</h1>'
html_generator = PhantomPDF::Generator.new(html, output_file, options)
returned_file = html_generator.generate

# want to dynamic output?
url_generator.generate('/tmp/dynamic_phantompdf_google.pdf')  # This will output pdf file to /tmp/dynamic_phantompdf_google.pdf though you pass *output* arg when creating generator instance.
```

##### Configuration
You can configure PhantomPDF globally in your project, such as Rails' initializers principle.

```ruby
PhantomPDF.configure do |config|
  # default pdf output format, e.g. "5in*7.5in", "10cm*20cm", "A4", "Letter"
  :format            => 'A4',

  # default pdf header, formatted in [headerHeight*]headerString(HTML is supported)
  # default to 1.2cm when you omit headerHeight
  # you can use *%{pageNum}* and *%{pageTotal}* to refer current values of page
  # example: 1.2cm*<h5>PhantomPDF header %{pageNum}/%{pageTotal}
  :header            => nil,

  # default pdf footer, formatted in footerHeight*footerString(HTML is supported)
  # you can use *%{pageNum}* and *%{pageTotal}* to refer current values of page
  # example: 0.6cm*<h5>PhantomPDF header %{pageNum}/%{pageTotal}
  :footer            => nil,

  # default page margin
  :margin            => '1cm',

  # default page orientation, 'portrait' or 'landscape'
  :orientation       => 'portrait',

  # default page zoom factor
  :zoom              => 1,

  # default cookies, only used for *URL* resource
  :cookies           => {},

  # PhantomJS running timeout
  :timeout           => 90000,

  # pdf rendering timeout, increase if your HTML page is big
  :rendering_timeout => 1000
end
```

You can also configure PhantomPDF in place when needs.

```ruby
# for *URL* resource
url = 'http://www.google.com'
url_generator = PhantomPDF::Generator.new(url, output_file, options)
url_generator.options.header = '0.8cm*<h3>Configure PhantomPDF dynamic</h3>'
returned_file = url_generator.generate
```

##### APIs
```ruby
# create PhantomPDF
PhantomPDF::Generator.new(input, output=nil, options={})

# generate pdf
PhantomPDF::Generator#generate(output=>nil)

# raise PhantomPDF::RenderingError when failed to generate pdf
PhantomPDF::Generator#generate!(output=>nil)

# get generated pdf as string
PhantomPDF::Generator#to_string
```

### Contributing
If you'd like to help improve PhantomPDF or you find some bugs. You can contribute to it by following:

- Submit an issue describing your problem
- Fork your repo and work your magic
- Test your code as far as possible
- Submit a pull request when you finished hack

### License
PhantomPDF is released under [MIT license](http://www.opensource.org/licenses/MIT).

### Authors
[Spring MC](https://twitter.com/mcspring)


text:
module flexportal {
  'use strict';

  var basePath = apiHelpers.getBasePath();

  angular.module('flexportal', ['ngAnimate', 'ngTouch', 'ngSanitize', 'restangular', 'ngMaterial',
    'ui.router', 'chart.js', 'jsonFormatter', 'swaggerUi', 'ui.grid', 'ui.grid.selection',
    'ui.grid.pagination', 'ui.grid.exporter', 'ui.ace', 'ui.grid.resizeColumns',
    'ngMdIcons'])
  // Controllers
    .controller('MainCtrl', ["$scope", "$mdUtil", "$mdSidenav", "$mdBottomSheet", MainCtrl])
    .controller('ErrorController', ErrorController)
    .controller('SearchStudioController', SearchStudioController)
  // Services
    .service('indicesApi', ["$http", "$mdBottomSheet", "$q", function($http, $mdBottomSheet, $q) { return new API.Client.IndicesApi($http, null, basePath, $mdBottomSheet, $q, errorHandler); }])
    .service('searchApi', ["$http", "$mdBottomSheet", "$q", function($http, $mdBottomSheet, $q) { return new API.Client.SearchApi($http, null, basePath, $mdBottomSheet, $q, errorHandler); }])

  // Theming
    .config(function($mdThemingProvider: ng.material.IThemingProvider) {
      $mdThemingProvider.theme('default')
        .primaryPalette('blue')
        .accentPalette('grey');
    })

  // Route configuration
    .config(function($stateProvider: angular.ui.IStateProvider, $urlRouterProvider: angular.ui.IUrlRouterProvider) {
      $urlRouterProvider.otherwise("/searchstudio");

      $stateProvider

      // Session URLs
        .state('main', {
          url: "/main",
          templateUrl: "partials/main.html",
          controller: 'MainCtrl'
        })

      .state('searchStudio', {
          url: "^/searchstudio",
          parent: 'main',
          controller: 'SearchStudioController',
          templateUrl: "searchstudio.html"
        })
    });
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <name>Apache MyFaces Trinidad Examples</name>
  <description>Parent project for the Trinidad Example Projects</description>

  <parent>
    <groupId>org.apache.myfaces.trinidad</groupId>
    <artifactId>trinidad</artifactId>
    <version>1.0.13.3</version>
  </parent>

  <artifactId>trinidad-example</artifactId>
  <packaging>pom</packaging>

  <repositories>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>apache-maven-snapshots</id>
      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
    </repository>
  </repositories>

  <!-- Project dependencies -->
  <dependencies>
    <!-- Apache Trinidad -->
    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-impl</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>

  <modules>
    <module>trinidad-blank</module>
    <module>trinidad-demo</module>
  </modules>

  <profiles>
    <!--
      This profile is for preparing a release.  Execute this profile like this:

       mvn release:prepare -DprepareRelease=true
     -->
    <profile>
     <id>prepare-release</id>
     <activation>
       <property>
         <name>prepareRelease</name>
       </property>
     </activation>
     <modules>
       <module>trinidad-example-assembly</module>
     </modules>
    </profile>

    <profile>
      <id>jettyConfig</id>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf-ri.version}</version>
            <scope>compile</scope>
          </dependency>

          <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${jsf-ri.version}</version>
            <scope>runtime</scope>
          </dependency>

          <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
            <version>${jsf-myfaces.version}</version>
            <scope>compile</scope>
          </dependency>

          <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-impl</artifactId>
            <version>${jsf-myfaces.version}</version>
            <scope>runtime</scope>
          </dependency>
         </dependencies>
       </dependencyManagement>
     </profile>

    <!--
      This profile activates MyFaces as the release to use for these demos.  By default
      MyFaces is used when these examples are run in Jetty and/or used with the -PincludeJSF
      flag.  To invoke this profile, simply do not include a -Djsf= property on your maven
      command line.  Execute this profile like this:

      mvn -PjettyConfig jetty:run
    -->
    <profile>
      <id>myfaces</id>
      <activation>
        <property>
          <name>!jsf</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <!--
      This profile activates the JSF RI as the release to use for these demos.  When activated
      the JSF RI is used when these examples are run in Jetty and/or used with the
      -PincludeJSF flag.  To invoke this profile, simply do include a -Djsf=ri property on
      your maven command line.  Execute this profile like this:

      mvn -PjettyConfig -Djsf=ri jetty:run
    -->
    <profile>
      <id>jsfri</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>ri</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>javax.faces</groupId>
          <artifactId>jsf-api</artifactId>
        </dependency>
        <dependency>
          <groupId>javax.faces</groupId>
          <artifactId>jsf-impl</artifactId>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>


text:
// Module headers:
#include "box.h"
#include "constant-acceleration-mobility-model.h"
#include "constant-position-mobility-model.h"
#include "constant-velocity-helper.h"
#include "constant-velocity-mobility-model.h"
#include "gauss-markov-mobility-model.h"
#include "hierarchical-mobility-model.h"
#include "mobility-helper.h"
#include "mobility-model.h"
#include "ns2-mobility-helper.h"
#include "position-allocator.h"
#include "random-direction-2d-mobility-model.h"
#include "random-walk-2d-mobility-model.h"
#include "random-waypoint-mobility-model.h"
#include "rectangle.h"
#include "steady-state-random-waypoint-mobility-model.h"
#include "waypoint-mobility-model.h"
#include "waypoint.h"
#endif


text:
package alien4cloud.tosca;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import alien4cloud.model.components.IndexedInheritableToscaElement;
import alien4cloud.model.components.IndexedToscaElement;
import alien4cloud.component.ICSARRepositoryIndexerService;
import alien4cloud.tosca.model.ArchiveRoot;

@Component
public class ArchiveIndexer {
    @Resource
    private ICSARRepositoryIndexerService indexerService;

    /**
     * Index an archive in Alien indexed repository.
     *
     * @param archiveName The name of the archive.
     * @param archiveVersion The version of the archive.
     * @param root The archive root.
     * @param update true if the archive is updated, false if the archive is just indexed.
     */
    public void indexArchive(String archiveName, String archiveVersion, ArchiveRoot root, boolean update) {
        if (update) {
            // get element from the archive so we get the creation date.
            Map<String, IndexedToscaElement> previousElements = indexerService.getArchiveElements(archiveName, archiveVersion);
            prepareForUpdate(archiveName, archiveVersion, root, previousElements);
            // delete all previous elements and their images
            indexerService.deleteElements(previousElements.values());
        }

        performIndexing(archiveName, archiveVersion, root);
    }

    private void prepareForUpdate(String archiveName, String archiveVersion, ArchiveRoot root, Map<String, IndexedToscaElement> previousElements) {
        updateCreationDates(root.getArtifactTypes(), previousElements);
        updateCreationDates(root.getCapabilityTypes(), previousElements);
        updateCreationDates(root.getNodeTypes(), previousElements);
        updateCreationDates(root.getRelationshipTypes(), previousElements);

        if (root.getLocalImports() != null) {
            for (ArchiveRoot child : root.getLocalImports()) {
                prepareForUpdate(archiveName, archiveVersion, child, previousElements);
            }
        }
    }

    private void updateCreationDates(Map<String, ? extends IndexedInheritableToscaElement> newElements, Map<String, IndexedToscaElement> previousElements) {
        if(newElements == null) {
            return;
        }
        for (IndexedInheritableToscaElement newElement : newElements.values()) {
            IndexedToscaElement previousElement = previousElements.get(newElement.getId());
            if (previousElement != null) {
                newElement.setCreationDate(previousElement.getCreationDate());
            }
        }
    }

    private void performIndexing(String archiveName, String archiveVersion, ArchiveRoot root) {
        indexerService.indexInheritableElements(archiveName, archiveVersion, root.getArtifactTypes(), root.getArchive().getDependencies());
        indexerService.indexInheritableElements(archiveName, archiveVersion, root.getCapabilityTypes(), root.getArchive().getDependencies());
        indexerService.indexInheritableElements(archiveName, archiveVersion, root.getNodeTypes(), root.getArchive().getDependencies());
        indexerService.indexInheritableElements(archiveName, archiveVersion, root.getRelationshipTypes(), root.getArchive().getDependencies());

        if (root.getLocalImports() != null) {
            for (ArchiveRoot child : root.getLocalImports()) {
                performIndexing(archiveName, archiveVersion, child);
            }
        }
    }
}


text:
package io.silverspoon.bulldog.core.io.bus;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class BusConnection {

   private int address;
   private Bus bus;

   public BusConnection(Bus bus, int address) {
      this.bus = bus;
      this.address = address;
   }

   public Bus getBus() {
      return bus;
   }

   public int getAddress() {
      return address;
   }

   public void writeByte(int b) throws IOException {
      acquireBus();
      bus.writeByte(b);
   }

   public void writeBytes(byte[] bytes) throws IOException {
      acquireBus();
      bus.writeBytes(bytes);
   }

   public void writeString(String string) throws IOException {
      acquireBus();
      bus.writeString(string);
   }

   public byte readByte() throws IOException {
      acquireBus();
      return bus.readByte();
   }

   public int readBytes(byte[] buffer) throws IOException {
      acquireBus();
      return bus.readBytes(buffer);
   }

   public String readString() throws IOException {
      acquireBus();
      return bus.readString();
   }

   protected void acquireBus() throws IOException {
      if (!getBus().isOpen()) {
         getBus().open();
      }

      if (!getBus().isSlaveSelected(address)) {
         getBus().selectSlave(address);
      }
   }

   public OutputStream getOutputStream() throws IOException {
      acquireBus();
      return bus.getOutputStream();
   }

   public InputStream getInputStream() throws IOException {
      acquireBus();
      return bus.getInputStream();
   }
}


text:
namespace mongocxx {
MONGOCXX_INLINE_NAMESPACE_BEGIN

operation_exception::operation_exception(std::error_code ec,
                                         bsoncxx::document::value&& raw_server_error,
                                         std::string what_arg)
    : exception(ec, what_arg), _raw_server_error{std::move(raw_server_error)} {}

const stdx::optional<bsoncxx::document::value>& operation_exception::raw_server_error() const {
    return _raw_server_error;
}

stdx::optional<bsoncxx::document::value>& operation_exception::raw_server_error() {
    return _raw_server_error;
}

bool operation_exception::has_error_label(stdx::string_view label) const {
    if (!_raw_server_error) {
        return false;
    }

    libbson::scoped_bson_t error(_raw_server_error->view());
    std::string label_str{label.data(), label.size()};
    return libmongoc::error_has_label(error.bson(), label_str.c_str());
}

MONGOCXX_INLINE_NAMESPACE_END
}  // namespace mongocxx


text:
This guide assumes the following:

* Google Cloud SDK installed
* Bash or a compatible shell
* Python 3 environment
* Terraform 0.12.8+ installed
* Basic familiarity with Google Cloud Platform and Terraform

Tested on Google Cloud Shell.

1. Set the `GOOGLE_CLOUD_PROJECT` environment variable to your GCP project ID:

```bash
export GOOGLE_CLOUD_PROJECT=<your-project-id>
```

2. Ensure that the service containers are built and pushed to the GCP project's Container Registry.

If you want to use another project's registry, first complete the steps outlined in the [Deploying images from other
Google Cloud projects] documentation.

Run the following gcloud command from the directory where application source code is stored:

```bash
gcloud builds submit . --substitutions=_PROVIDER_NAME=gcp-datastore,_SHORT_SHA=$(git rev-parse --short HEAD)
```

3. [Create an instance of Cloud Firestore in Datastore mode]
4. Create a service account which will be used by Terraform, e.g.:

```bash
gcloud iam service-accounts create terraform
```

5. Create a service account key and store it securely:

```bash
gcloud iam service-accounts keys create terraform.json --iam-account=terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com
```

6. Assign Project Editor, Cloud Run Admin, Datastore Index Admin, and Storage Object Admin roles to the account. You can
remove them along with the service account once the deployment is complete.

```bash
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/editor
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/datastore.indexAdmin
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/storage.objectAdmin
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/run.admin
```

If you want Terraform to configure IAM roles for Cloud Run service account, add Project IAM Admin role as well:

```bash
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:terraform@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/resourcemanager.projectIamAdmin
```

7. Run the script to seed Cloud Datastore values:

```bash
pip3 install google-cloud-datastore # Already installed in Cloud Shell
export GOOGLE_APPLICATION_CREDENTIALS="<path to the service account key, e.g. terraform.json>"
python3 datastore-import/datastore_import.py
 ```

8. Create a Terraform variables file (e.g. `terraform.tfvars`) with the following contents:

```bash
project             = "<GCP project ID>"
gcr_project         = "<project ID of the Container Registry where images reside>"
credentials_file    = "<path to the service account key, e.g. terraform.json>"
region              = "<your GCP region>"
enable_iam          = false # Set to true if Terraform service account has Project IAM Admin role
entitlement_service = "<your OpenDES entitlements API URL, e.g. https://example.com/entitlements/v1>"

```

9. Initialize a Terraform project and run `plan` to preview the infrastructure that will be created:

```bash
terraform init
terraform plan --var-file=terraform.tfvars --out=terraform.tfplan
```

10. Apply the saved Terraform plan

```bash
terraform apply
```

At the end of this step, it will output the URLs of Cloud Run services.

11. If you didn't apply IAM changes via Terraform, configure the following roles for the service account used for OS
services:

```bash
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:osdu-gcp-sa@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/composer.user
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:osdu-gcp-sa@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/datastore.user
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member=serviceAccount:osdu-gcp-sa@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com \
    --role=roles/iam.serviceAccountTokenCreator
```

[Deploying images from other Google Cloud projects]: https://cloud.google.com/run/docs/deploying#other-projects
[Create an instance of Cloud Firestore in Datastore mode]: https://cloud.google.com/datastore/docs/quickstart


text:
A student-run organization at Binghamton University created to foster a community of individuals who solve problems through the innovative use of technology.

## Install

In addition to cloning the HackBU repository, you'll need a few things to run HackBU locally:

1. **Ruby** - Jekyll requires Ruby. If you're on a Mac, you most likely have Ruby. You can confirm this by running `ruby --version` in the command line. Follow [these instructions](https://www.ruby-lang.org/en/downloads/) to install Ruby if needed.

2. **Bundler** - Bundler is a package manager that makes versioning Ruby software like Jekyll a lot easier and is highly recommended if you're going to be building GitHub Pages sites locally. If you don't already have Bundler installed, you can install it by running the command `gem install bundler`.

3. **Jekyll** - Run the command `bundle install` in the project directory to download and install Jekyll. (Try using `sudo bundle install` if you run into problems.)

You can start the Jekyll server with `bundle exec jekyll serve --watch`. See the [Jekyll documentation ](http://jekyllrb.com/docs/home/) for more information.

## Contributing

Making a change to the website? Fork the repository (if you're not HackBU staff) and [submit a pull request through GitHub](https://help.github.com/articles/using-pull-requests)!

A HackBU staff member will review the pull request, leave comments, and decide whether or not to merge.

## License

The contents of this repository are [released under the MIT License](http://hackbu.org/LICENSE).

Contact [hello@hackbu.org](mailto:hello@hackbu.org) with questions.


text:
@interface CreateAccountViewController() <UITextFieldDelegate, UITextViewDelegate>
{
    UIView *titleContainer;
  UITextField *usernameField;
  UITextField *passwordField;
  UITextField *emailField;
  UIButton *createAccountButton;

    UIView *line1;
    UIView *line2;
    UIView *line3;
    UIView *line4;

    UIButton *backButton;

    id<CreateAccountViewControllerDelegate> __unsafe_unretained delegate;
}

@end

@implementation CreateAccountViewController

- (id)initWithDelegate:(id<CreateAccountViewControllerDelegate>)d
{
    if(self = [super init])
    {
        delegate = d;
        self.title = NSLocalizedString(@"CreateAccountTitleKey", @"");
        _ARIS_NOTIF_LISTEN_(@"MODEL_LOGGED_IN",self,@selector(dismissSelf),nil);
        _ARIS_NOTIF_LISTEN_(@"MODEL_LOGIN_FAILED",self,@selector(loginFailed),nil);
  }

    return self;
}

- (void) loadView
{
    [super loadView];
    self.view.backgroundColor = [UIColor ARISColorWhite];

    long navOffset = 66;

    titleContainer = [[UIView alloc] initWithFrame:self.navigationItem.titleView.frame];
    UIImageView *logoText = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_text_nav.png"]];
    logoText.frame = CGRectMake(titleContainer.frame.size.width/2-50, titleContainer.frame.size.height/2-15, 100, 30);
    [titleContainer addSubview:logoText];

    line1 = [[UIView alloc] initWithFrame:CGRectMake(20,navOffset+20+20+5,self.view.frame.size.width-40, 1)];
    line1.backgroundColor = [UIColor colorWithRed:(194.0/255.0) green:(198.0/255.0)  blue:(191.0/255.0) alpha:1.0];
    [self.view addSubview:line1];
    line2 = [[UIView alloc] initWithFrame:CGRectMake(20,navOffset+20+20+20+20+5, self.view.frame.size.width-40, 1)];
    line2.backgroundColor = [UIColor colorWithRed:(194.0/255.0) green:(198.0/255.0)  blue:(191.0/255.0) alpha:1.0];
    [self.view addSubview:line2];
    line3 = [[UIView alloc] initWithFrame:CGRectMake(20,navOffset+20+20+20+20+20+20+5, self.view.frame.size.width-40, 1)];
    line3.backgroundColor = [UIColor colorWithRed:(194.0/255.0) green:(198.0/255.0)  blue:(191.0/255.0) alpha:1.0];
    [self.view addSubview:line3];
    line4 = [[UIView alloc] initWithFrame:CGRectMake(20,navOffset+20+20+5,self.view.frame.size.width-40, 1)];
    line4.backgroundColor = [UIColor colorWithRed:(194.0/255.0) green:(198.0/255.0)  blue:(191.0/255.0) alpha:1.0];
    [self.view addSubview:line4];

    usernameField = [[UITextField alloc] initWithFrame:CGRectMake(20,navOffset+20,self.view.frame.size.width-40,20)];
    usernameField.font = [ARISTemplate ARISInputFont];
    usernameField.delegate = self;
    usernameField.autocapitalizationType = UITextAutocapitalizationTypeNone;
    usernameField.autocorrectionType = UITextAutocorrectionTypeNo;
    usernameField.placeholder = @"ARIS ID";
    usernameField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:usernameField];

    passwordField = [[UITextField alloc] initWithFrame:CGRectMake(20,navOffset+20+20+20,self.view.frame.size.width-40,20)];
    passwordField.font = [ARISTemplate ARISInputFont];
    passwordField.delegate = self;
    passwordField.secureTextEntry = YES;
  passwordField.placeholder = NSLocalizedString(@"PasswordKey",@"");
    passwordField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:passwordField];

    emailField = [[UITextField alloc] initWithFrame:CGRectMake(20,navOffset+20+20+20+20+20,self.view.frame.size.width-40,20)];
    emailField.font = [ARISTemplate ARISInputFont];
    emailField.delegate = self;
  emailField.placeholder = NSLocalizedString(@"EmailKey",@"");
    emailField.keyboardType = UIKeyboardTypeEmailAddress;
    emailField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:emailField];

    createAccountButton = [UIButton buttonWithType:UIButtonTypeCustom];
    createAccountButton.backgroundColor = [UIColor clearColor];
    [createAccountButton setBackgroundImage:[UIImage imageNamed:@"arrowForward"] forState:UIControlStateNormal];
    [createAccountButton setTitleColor:[UIColor ARISColorDarkBlue] forState:UIControlStateNormal];
    [createAccountButton.titleLabel setFont:[ARISTemplate ARISButtonFont]];
    createAccountButton.accessibilityLabel = @"CreateAccount";
    createAccountButton.frame = CGRectMake(self.view.frame.size.width-50, navOffset+20+20+20+20+20+20+20, 20, 20);
    [createAccountButton addTarget:self action:@selector(createAccountButtonTouched) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:createAccountButton];

    backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = CGRectMake(0, 0, 27, 27);
    [backButton setImage:[UIImage imageNamed:@"arrowBack"] forState:UIControlStateNormal];
    backButton.accessibilityLabel = @"Back Button";
    [backButton addTarget:self action:@selector(backButtonTouched) forControlEvents:UIControlEventTouchUpInside];
}

- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    self.navigationItem.titleView = titleContainer;
    [self.navigationController.navigationBar layoutIfNeeded];
  self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
    [tracker set:kGAIScreenName value:self.title];
    [tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}

- (void) viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];
    UIEdgeInsets insets;
    long navOffset = 66;
    if (@available(iOS 11.0, *)) {
        insets = self.view.safeAreaInsets;
        navOffset = insets.top;
    }

    line4.frame = CGRectMake(20,navOffset+20+20+5,self.view.frame.size.width-40, 1);
    line3.frame = CGRectMake(20,navOffset+20+20+20+20+20+20+5, self.view.frame.size.width-40, 1);
    line2.frame = CGRectMake(20,navOffset+20+20+20+20+5, self.view.frame.size.width-40, 1);
    line1.frame = CGRectMake(20,navOffset+20+20+5,self.view.frame.size.width-40, 1);

    usernameField.frame = CGRectMake(20,navOffset+20,self.view.frame.size.width-40,20);
    passwordField.frame = CGRectMake(20,navOffset+20+20+20,self.view.frame.size.width-40,20);
    createAccountButton.frame = CGRectMake(self.view.frame.size.width-50, navOffset+20+20+20+20+20+20+20, 20, 20);
    emailField.frame = CGRectMake(20,navOffset+20+20+20+20+20,self.view.frame.size.width-40,20);
}

- (void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
  [usernameField becomeFirstResponder];
}

- (void) attemptRegistration
{
    [_MODEL_ createAccountWithUserName:usernameField.text displayName:@"" groupName:@"" email:emailField.text password:passwordField.text];
}

- (void) createAccountButtonTouched
{
    [self attemptRegistration];
}

- (BOOL) textFieldShouldReturn:(UITextField *)textField
{
  if(textField == usernameField) [passwordField becomeFirstResponder];
  if(textField == passwordField) [emailField becomeFirstResponder];
  if(textField == emailField)    [self attemptRegistration];
    return YES;
}

- (void) loginFailed
{
    //[[ARISAlertHandler sharedAlertHandler] showAlertWithTitle:@"Login Failed" message:@"Username taken"];
}

- (void) backButtonTouched
{
    [self dismissSelf];
}

- (void) dismissSelf
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void) dealloc
{
    _ARIS_NOTIF_IGNORE_ALL_(self);
}

@end


text:
[![Build Status Master](https://travis-ci.org/lamont-granquist/decoplan.svg?branch=master)](https://travis-ci.org/lamont-granquist/decoplan)
[![Code Climate](https://codeclimate.com/github/lamont-granquist/decoplan/badges/gpa.svg)](https://codeclimate.com/github/lamont-granquist/decoplan)
[![Test Coverage](https://codeclimate.com/github/lamont-granquist/decoplan/badges/coverage.svg)](https://codeclimate.com/github/lamont-granquist/decoplan/coverage)
[![Issue Count](https://codeclimate.com/github/lamont-granquist/decoplan/badges/issue_count.svg)](https://codeclimate.com/github/lamont-granquist/decoplan)

this isn't usable yet.  stay tuned...


text:
_mvn()
{
   local cmds cur colonprefixes
   cmds="clean validate compile test package integration-test   \
      verify install deploy test-compile site generate-sources  \
      process-sources generate-resources process-resources      \
      eclipse:eclipse eclipse:add-maven-repo eclipse:clean      \
      idea:idea -DartifactId= -DgroupId= -Dmaven.test.skip=true \
      -Declipse.workspace= -DarchetypeArtifactId=               \
      netbeans-freeform:generate-netbeans-project               \
      tomcat:run tomcat:run-war tomcat:deploy jboss-as:deploy   \
      versions:display-dependency-updates                       \
      versions:display-plugin-updates dependency:analyze        \
      dependency:analyze-dep-mgt dependency:resolve             \
      dependency:sources dependency:tree release:prepare        \
      release:rollback release:perform --batch-mode"

   COMPREPLY=()
   cur=${COMP_WORDS[COMP_CWORD]}
   # Work-around bash_completion issue where bash interprets a colon
   # as a separator.
   # Work-around borrowed from the darcs work-around for the same
   # issue.
   colonprefixes=${cur%"${cur##*:}"}
   COMPREPLY=( $(compgen -W '$cmds'  -- $cur))
   local i=${#COMPREPLY[*]}
   while [ $((--i)) -ge 0 ]; do
      COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
   done

        return 0
} &&
complete -F _mvn mvn


text:
This helper uses [cloudHSM](https://cloud.google.com/kms/docs/hsm#create-a-key) to generate 256 [random bits](https://cloud.google.com/kms/docs/generate-random), which are [wrapped by an encryption key](https://cloud.google.com/kms/docs/encrypt-decrypt) protected by cloudHSM.
It base64 encodes the output so it can be used in a Cloud DLP de-identification template.

The keyring used for encryption must be in a region that has cloudHSM [available](https://cloud.google.com/kms/docs/locations#regional:).
This script will be run with the credential configured in the [Cloud SDK](https://cloud.google.com/sdk/docs/authorizing#authorizing_with_a_user_account) tool.

__Note:__ This helper is mainly for sample purpose. You should use your security team's recommend approach to generate and handle key material properly.

## Wrapped Key helper usage

### Install PIP

```sh
python3 -m pip install --user --upgrade pip

python3 -m pip --version
```

### Install Virtual Env

```sh
python3 -m pip install --user virtualenv
```

### Creating a virtual environment

```sh
cd helpers/wrapped-key

python3 -m venv kms_helper
```

### Activating a virtual environment

```sh
source kms_helper/bin/activate
```

### Install dependencies

```sh
pip install --upgrade pip

pip install -r requirements.txt
```

### Set default application credentials

```sh
gcloud auth application-default login
```

### Run Script

```sh
export project_id=<kms-project-id>
export location_id=<kms-location-id>
export key_ring_id=<kms-king-id>
export key_id=<kms-key-id>

python3 wrapped_key.py \
--project_id ${project_id} \
--location_id ${location_id} \
--key_ring_id ${key_ring_id} \
--key_id ${key_id}
```

OR

```sh
export crypto_key_path=<crypto-key-path>

python3 wrapped_key.py \
--crypto_key_path ${crypto_key_path}
```

The `crypto-key-path` format is `projects/PROJECT-ID/locations/LOCATION-ID/keyRings/KEY-RING-ID/cryptoKeys/KEY-ID`

**Note:** By default, the script will be executed with the account chosen in the `gcloud auth application-default login` command. If you want to run the script impersonating the Service Account, you need to use the `--service_account <service-account-email>` parameter.

```sh
export project_id=<kms-project-id>
export location_id=<kms-location-id>
export key_ring_id=<kms-king-id>
export key_id=<kms-key-id>
export service_account_email=<service-account-email>

python3 wrapped_key.py \
--project_id ${project_id} \
--location_id ${location_id} \
--key_ring_id ${key_ring_id} \
--key_id ${key_id} \
--service_account ${service_account_email}
```

OR

```sh
export crypto_key_path=<crypto-key-path>
export service_account_email=<service-account-email>

python3 wrapped_key.py \
--crypto_key_path ${crypto_key_path} \
--service_account ${service_account_email}
```

**Note:** To use this script, the user or Service Account executing it must have the **cloudkms.locations.generateRandomBytes** permission to be able to use the Cloud KMS API to encrypt and generate the wrapped key. Run the command bellow that grant the role **Cloud KMS Crypto Operator (roles/cloudkms.cryptoOperator)**, that contains the necessary permission.

If a service account is being impersonated:

```sh
gcloud projects add-iam-policy-binding <kms-project-id> \
--member="serviceAccount:<service-account-email>" \
--role="roles/cloudkms.cryptoOperator"
```

If your user is being used:

```sh
gcloud projects add-iam-policy-binding <kms-project-id> \
--member="user:<user-email>" \
--role="roles/cloudkms.cryptoOperator"
```

After generate the wrapped key, it is recommended and a good practice, to remove the role **Cloud KMS Crypto Operator (roles/cloudkms.cryptoOperator)**, to avoid grant to the user or Service Account unnecessary permissions.

If a service account is being impersonated:

```sh
gcloud projects remove-iam-policy-binding <kms-project-id> \
--member="serviceAccount:<service-account-email>" \
--role="roles/cloudkms.cryptoOperator"
```

If your user is being used:

```sh
gcloud projects remove-iam-policy-binding <kms-project-id> \
--member="user:<user-email>" \
--role="roles/cloudkms.cryptoOperator"
```


text:
package org.springframework.boot.web.embedded.tomcat;

import org.apache.coyote.AbstractProtocol;
import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.junit.jupiter.api.Test;

import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for {@link TomcatWebServer.TomcatWebServerRuntimeHints}.
 *
 * @author Sebastien Deleuze
 */
class TomcatWebServerRuntimeHintsTests {

	@Test
	void registersHints() {
		RuntimeHints runtimeHints = new RuntimeHints();
		new TomcatWebServer.TomcatWebServerRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader());
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractProtocol.class, "setPort"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractProtocol.class, "setPortOffset"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractProtocol.class, "getPort"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractProtocol.class, "getPortOffset"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractProtocol.class, "getLocalPort"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractHttp11Protocol.class, "setMaxSavePostSize"))
				.accepts(runtimeHints);
		assertThat(RuntimeHintsPredicates.reflection().onMethod(AbstractHttp11Protocol.class, "setSecure"))
				.accepts(runtimeHints);
	}

}


text:
<?php

namespace zpt\rest\test\message;

require_once __DIR__ . '/../test-setup.php';

use PHPUnit_Framework_TestCase as TestCase;
use zpt\rest\message\PhpEnvMessageBuilder;

class PhpEnvMessageBuilderTest extends TestCase
{

	protected function setUp() {
		// Mock $_SERVER variables required by PhpEnvRequestBuilder dependencies.
		$_SERVER['REQUEST_METHOD'] = 'GET';
		$_SERVER['SERVER_NAME'] = 'localhost';
		$_SERVER['SERVER_PORT'] = '80';
		$_SERVER['REQUEST_URI'] = '/index.html';
	}

	public function testParseHttpProtocolVersion() {
		$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';

		$builder = new PhpEnvMessageBuilder();
		$request = $builder->getRequest();

		$this->assertEquals('1.1', $request->getProtocolVersion());
	}

}


text:
/*
 * Portions Copyright (c) Microsoft Corporation
 */

package com.azure.cosmos.implementation.uuid;

import java.util.UUID;

/**
 * Intermediate base class for UUID generators that do not take arguments for individual
 * calls. This includes random and time-based variants, but not name-based ones.
 *
 * @since 3.0
 */
public abstract class NoArgGenerator extends UUIDGenerator
{
    public abstract UUID generate();
}


text:
package v1

import (
	"context"
	"testing"
)

func TestPullSubscriptionConversionBadType(t *testing.T) {
	good, bad := &PullSubscription{}, &PullSubscription{}

	if err := good.ConvertTo(context.Background(), bad); err == nil {
		t.Errorf("ConvertTo() = %#v, wanted error", bad)
	}

	if err := good.ConvertFrom(context.Background(), bad); err == nil {
		t.Errorf("ConvertFrom() = %#v, wanted error", good)
	}
}


text:
import { FC, memo } from 'react'

import type { TPost } from '@/spec'
import useViewing from '@/hooks/useViewing'

import { Wrapper, ViewIcon } from '../styles/desktop_view/viewing_sign'

type TProps = {
  article: TPost
}

const ViewingSign: FC<TProps> = ({ article }) => {
  const viewingId = useViewing()

  if (article.id !== viewingId) return null

  return (
    <Wrapper>
      <ViewIcon />
    </Wrapper>
  )
}

export default memo(ViewingSign)


text:
This is a pilot that demonstrates how to run a legacy KVM resource inside the Kubernetes clusters.  It borrows heavily from RancherVM.

It does not need to be installed as part of the OpenStack chart collection.

At a high level, it works like this:

-	Create a SNAT/DNAT enabled linux bridge.
-       Assign the bridge a private IP address from a small /30 subnet (controlled with VM_IP and VM_GW)
-       Plug the VM network interface into the bridge.
-       Run a dnsmasq process to allocate the VM the right nameservers, and dns search strings extracted from the parent container.  Assign the private IP address to the VM and have it use the bridges IP as its default gateway.
-       Setup SNAT/DNAT on the parent container to do 1:1 mapping of all ports, all protocols to the VM, except for TCP:5900 to allow for VNC access (can be controlled with NO_VNC environment variable).
-	At this point, VM essentially assumes Pod Assigned IP.
-       Feed any meta-data or user-data down into the VM by leveraging these ConfigMap mounts with the same name and turning them into an ISO presented to the guest.

This deviates from Rancher in that the QCOW2 source image isn't baked into the container and we do not create a pass through bridge.  Instead it is fetched at container creation time, and stored on a "shared" volume.  More thought needs to be put into security, base image upgrades to operationalize this.  The networking approach here works better for more complicated K8s CNIs, such as Calico which have complex default routes outside the subnet the container (and thus the VM) would inherit.  These setups do not work well for having the VM pose as the container directly as these types of networking configuration cannot be served with dhcp.

The kvm-manager container supports several environment variables:

- ```IMG_SOURCE``` which is an http or https URL that contains a qcow2 image.  It can also be a full path to a local file baked into the container image, e.g. "/image.qcow"
- ```IMG_TARGET``` the name to save the image above as in the shared volume.

It also supports two files, which should be mounted as config maps if using Kubernetes at ```/userdata``` and ```/metadata``` as YAML files containing, obviously meta-data and user-data as YAML that will be fed to the VM as a config-drive iso.

The "pet" version of the image, which is created using qemu-img -b to base it on the source, is stored in a separate volume dedicated to the VM itself, and named after the container hostname.

There are a few other parameters you can control as an operator:

- ```VM_IP``` is the IP address the VM should be allocated by DHCP.  The container will 1:1 NAT except for port 5900 for VNC access (defaults to 192.168.254.2)
- ```VM_GW``` is the gateway IP address the VM should use for its default route (defaults to 192.168.254.1)

There is a an example chart leveraging this contaimer image that will follow.


text:
package org.hisp.dhis.common;

import org.apache.commons.lang.BooleanUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author Morten Olav Hansen <mortenoh@gmail.com>
 */
public final class PagerUtils
{
    public static <T> List<T> pageCollection( Collection<T> col, Pager pager )
    {
        return pageCollection( col, pager.getOffset(), pager.getPageSize() );
    }

    public static <T> List<T> pageCollection( Collection<T> col, int offset, int limit )
    {
        List<T> objects = new ArrayList<>( col );

        if ( offset == 0 && objects.size() <= limit )
        {
            return objects;
        }

        if ( offset >= objects.size() )
        {
            offset = objects.isEmpty() ? objects.size() : objects.size() - 1;
        }

        if ( (offset + limit) > objects.size() )
        {
            limit = objects.size() - offset;
        }

        return objects.subList( offset, offset + limit );
    }

    public static boolean isSkipPaging( Boolean skipPaging, Boolean paging )
    {
        if ( skipPaging != null )
        {
            return BooleanUtils.toBoolean( skipPaging );
        }
        else if ( paging != null )
        {
            return !BooleanUtils.toBoolean( paging );
        }

        return false;
    }

    private PagerUtils()
    {
    }
}


text:
FIND_PATH(
      faramotics_INCLUDE_DIRS
      NAMES sceneRender.h dynamicSceneRender.h rangeSector.h rangeScan2D.h rangeImage.h
      PATHS /usr/local/include/btr-headers
)

FIND_LIBRARY(
      faramotics_LIBRARIES
      NAMES faramotics
      PATHS /usr/local/lib/btr-libs
)

IF (faramotics_INCLUDE_DIRS AND faramotics_LIBRARIES)
   SET(faramotics_FOUND TRUE)
ENDIF (faramotics_INCLUDE_DIRS AND faramotics_LIBRARIES)

IF (faramotics_FOUND)
   IF (NOT faramotics_FIND_QUIETLY)
      MESSAGE(STATUS "Found faramotics library: ${faramotics_LIBRARIES}")
   ENDIF (NOT faramotics_FIND_QUIETLY)
ELSE (faramotics_FOUND)
   IF (faramotics_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "Could not find faramotics library")
   ENDIF (faramotics_FIND_REQUIRED)
ENDIF (faramotics_FOUND)