text:
// ========================================================
// A convenience class to capture helpers that can be used
// (and invoked globally) to handle leaflet interactions
// It encloses the one (singleton) map instance
LUtil = {

  // reference to the single 'map' object to control
  map: null,

  // location of marker images
  imagePath : 'packages/mrt_leaflet-0.6.4/images',

  // init function to be called ONCE on startup
  initLeaflet: function(){
    $(window).resize(function() {
      $('#map').css('height', window.innerHeight - 82 - 45);
    });
    $(window).resize(); // trigger resize event
    console.log("[c/t/map.js] Initializing leaflet config");
  },

  // populates and inits map view in page
  // (element=div to populate, view=latlong for center)
  initMap: function(element, view){
    L.Icon.Default.imagePath = this.imagePath;

    // sensible defaults if nothing specified
    element = element || 'map';
    view = view || {};
    view.zoom = view.zoom || 12;
    view.latlong = view.latlong || [ 40.752998, -73.977056];

    this.map = L.map(element, {
        scrollWheelZoom : false,
        doubleClickZoom : false,
        boxZoom         : false,
        touchZoom       : false
      })
      .setView(
        view.latlong ,
        view.zoom
      );
  },

  // register event handlers
  handleEvent: function(event, callback){
    if (!event || !callback)
      return;
    // TODO: validate event and callback
    this.map.on(event, callback);
  },

  // add marker to specified point (uses default marker image)
  addMarker: function(latlng){
    return L.marker(latlng).addTo(this.map);
  },

  // remove marker from map
  removeMarker: function(marker){
    this.map.removeLayer(marker);
  },

  // remove layer
  removeLayer: function(layer){
    this.map.removeLayer(layer);
  }

};

// change tile layer
LUtil.addTileLayer = function(_layer, _attribution){
  _attribution = _attribution || "";
  L.tileLayer( _layer,{ attribution: _attribution })
    .addTo(this.map);
}
// ========================================================

// 3. Template event handling can be done here
//  Meteor can capture most DOM events -- these include
//    click, dblclick, focus, blur, change
//    mousedown, mouseup, mouseenter, mouseleave, mouseout
//    keydown, keyup, keypress
//    submit, reset
//  (DOM events: http://en.wikipedia.org/wiki/DOM_events)
//
// However, the leaflet library can extract context at the
//   click locations and surface them in its own events
//   see: http://leafletjs.com/reference.html#events
//
// To get access to those objects, we need to register handlers
// to the leaflet library's event handling framework. Do this
// by registering functions against
//   map.on('click', function(e){  -- e = leaflet event obj -- })
//
Template.map.events({
  'dblclick' : function(event, template){
    console.log("[c/t/map.js] Map was double-clicked", event);
  }
});

// 3. Template created function is called when template object is created
Template.map.created = function(){
  console.log("[c/t/map.js] Map template created");
};

// 3. Template rendering function is called each time template is rendered
//    to the screen as a view
Template.map.rendered = function() {
  console.log("[c/t/map.js] Map template rendered");

  // Initialize the map view
  LUtil.initMap();

  // Set preferred tile layer
  //    http://leaflet-extras.github.io/leaflet-providers/preview/
  LUtil.addTileLayer(
    'http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png',
    '© OpenCycleMap, © OpenStreetMap'
  );

  // Register handler functions for various events..
  LUtil.handleEvent('dblclick', function(event){
    Markers.insert({latlng: event.latlng});
  });

  // Add explicit observers to receive collection change
  // notifications and manually update map
  Markers
    .find()
    .observe({

      added: function(document) {
        var marker = LUtil.addMarker(document.latlng);
        marker.on('click', function(event) {
            LUtil.removeMarker(marker);
            Markers.remove({_id: document._id});
          });
      },

      removed: function(oldDocument) {
        layers = LUtil.map._layers;

        var key, val;
        for (key in layers) {
          val = layers[key];
          if (val._latlng && val._latlng.lat)

          if (val._latlng) {
            if (val._latlng.lat === oldDocument.latlng.lat &&
              val._latlng.lng === oldDocument.latlng.lng) {
              LUtil.removeLayer(val);
            }
          }
        }
    }
  });
};


text:
using UnityEngine;
using System.Collections;

public class RayCastTest : MonoBehaviour {

    private Layout L = new Layout(Layout.pointy, new Vector3(1f, 1f), new Vector3(0f, 0f));
    // Update is called once per frame
    void Update () {

        if (Input.GetMouseButtonDown(1))
        {
            int layer = LayerMask.NameToLayer("PlayArea");

            LayerMask lm =  1 << layer ;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit HitInfo;
            if (Physics.Raycast(ray, out HitInfo, 1000f, lm))
            {
                //Debug.Log("hit!");new Vector3( HitInfo.point.x, HitInfo.point.z, 5)

                FractionalHex h = Layout.PixelToHex(L, HitInfo.point);
                Hex MouseOverHex = FractionalHex.HexRound(h);

                DrawSolarSystemGraphics.Instance.DrawHex(MouseOverHex, "test", Color.red);

            }
        }

    }
}

redpajama_set_name: RedPajamaGithub


text:
@implementation UITextView (TFEasyCoder)

+( UITextView *)easyCoder:(UITextViewEasyCoderBlock)block{
    return [NSObject tf_execute:[self class] back:^(id ins) {
        if (block) {
            block(( UITextView *)ins);
        }
    }];
}

-( UITextView *)easyCoder:(UITextViewEasyCoderBlock)block{
    if (block) {
        __weak typeof(self) weakSelf = self;
        block(weakSelf);
    }
    return self;
}

-(UITextView  *(^)(id<UITextViewDelegate>    delegate))set_delegate{
    __weak typeof(self) weakSelf = self;
    return ^(id<UITextViewDelegate>    delegate){
        weakSelf.delegate = delegate;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSString *  text))set_text{
    __weak typeof(self) weakSelf = self;
    return ^(NSString *  text){
        weakSelf.text = text;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIFont *  font))set_font{
    __weak typeof(self) weakSelf = self;
    return ^(UIFont *  font){
        weakSelf.font = font;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIColor *  textColor))set_textColor{
    __weak typeof(self) weakSelf = self;
    return ^(UIColor *  textColor){
        weakSelf.textColor = textColor;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  textAlignment))set_textAlignment{
    __weak typeof(self) weakSelf = self;
    return ^(long long  textAlignment){
        weakSelf.textAlignment = textAlignment;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  editable))set_editable{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  editable){
        weakSelf.editable = editable;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  selectable))set_selectable{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  selectable){
        weakSelf.selectable = selectable;
        return weakSelf;
    };
}

-(UITextView  *(^)(unsigned long long  dataDetectorTypes))set_dataDetectorTypes{
    __weak typeof(self) weakSelf = self;
    return ^(unsigned long long  dataDetectorTypes){
        weakSelf.dataDetectorTypes = dataDetectorTypes;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  allowsEditingTextAttributes))set_allowsEditingTextAttributes{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  allowsEditingTextAttributes){
        weakSelf.allowsEditingTextAttributes = allowsEditingTextAttributes;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSAttributedString *  attributedText))set_attributedText{
    __weak typeof(self) weakSelf = self;
    return ^(NSAttributedString *  attributedText){
        weakSelf.attributedText = attributedText;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSDictionary *  typingAttributes))set_typingAttributes{
    __weak typeof(self) weakSelf = self;
    return ^(NSDictionary *  typingAttributes){
        weakSelf.typingAttributes = typingAttributes;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIView *  inputView))set_inputView{
    __weak typeof(self) weakSelf = self;
    return ^(UIView *  inputView){
        weakSelf.inputView = inputView;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIView *  inputAccessoryView))set_inputAccessoryView{
    __weak typeof(self) weakSelf = self;
    return ^(UIView *  inputAccessoryView){
        weakSelf.inputAccessoryView = inputAccessoryView;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  clearsOnInsertion))set_clearsOnInsertion{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  clearsOnInsertion){
        weakSelf.clearsOnInsertion = clearsOnInsertion;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIEdgeInsets  textContainerInset))set_textContainerInset{
    __weak typeof(self) weakSelf = self;
    return ^(UIEdgeInsets  textContainerInset){
        weakSelf.textContainerInset = textContainerInset;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSDictionary *  linkTextAttributes))set_linkTextAttributes{
    __weak typeof(self) weakSelf = self;
    return ^(NSDictionary *  linkTextAttributes){
        weakSelf.linkTextAttributes = linkTextAttributes;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  autocapitalizationType))set_autocapitalizationType{
    __weak typeof(self) weakSelf = self;
    return ^(long long  autocapitalizationType){
        weakSelf.autocapitalizationType = autocapitalizationType;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  autocorrectionType))set_autocorrectionType{
    __weak typeof(self) weakSelf = self;
    return ^(long long  autocorrectionType){
        weakSelf.autocorrectionType = autocorrectionType;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  spellCheckingType))set_spellCheckingType{
    __weak typeof(self) weakSelf = self;
    return ^(long long  spellCheckingType){
        weakSelf.spellCheckingType = spellCheckingType;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  keyboardType))set_keyboardType{
    __weak typeof(self) weakSelf = self;
    return ^(long long  keyboardType){
        weakSelf.keyboardType = keyboardType;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  keyboardAppearance))set_keyboardAppearance{
    __weak typeof(self) weakSelf = self;
    return ^(long long  keyboardAppearance){
        weakSelf.keyboardAppearance = keyboardAppearance;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  returnKeyType))set_returnKeyType{
    __weak typeof(self) weakSelf = self;
    return ^(long long  returnKeyType){
        weakSelf.returnKeyType = returnKeyType;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  enablesReturnKeyAutomatically))set_enablesReturnKeyAutomatically{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  enablesReturnKeyAutomatically){
        weakSelf.enablesReturnKeyAutomatically = enablesReturnKeyAutomatically;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  secureTextEntry))set_secureTextEntry{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  secureTextEntry){
        weakSelf.secureTextEntry = secureTextEntry;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSDictionary *  markedTextStyle))set_markedTextStyle{
    __weak typeof(self) weakSelf = self;
    return ^(NSDictionary *  markedTextStyle){
        weakSelf.markedTextStyle = markedTextStyle;
        return weakSelf;
    };
}

-(UITextView  *(^)(id<UITextInputDelegate>    inputDelegate))set_inputDelegate{
    __weak typeof(self) weakSelf = self;
    return ^(id<UITextInputDelegate>    inputDelegate){
        weakSelf.inputDelegate = inputDelegate;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  selectionAffinity))set_selectionAffinity{
    __weak typeof(self) weakSelf = self;
    return ^(long long  selectionAffinity){
        weakSelf.selectionAffinity = selectionAffinity;
        return weakSelf;
    };
}

//superclass pros UIScrollView
-(UITextView  *(^)(CGPoint  contentOffset))set_contentOffset{
    __weak typeof(self) weakSelf = self;
    return ^(CGPoint  contentOffset){
        weakSelf.contentOffset = contentOffset;
        return weakSelf;
    };
}

-(UITextView  *(^)(CGSize  contentSize))set_contentSize{
    __weak typeof(self) weakSelf = self;
    return ^(CGSize  contentSize){
        weakSelf.contentSize = contentSize;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIEdgeInsets  contentInset))set_contentInset{
    __weak typeof(self) weakSelf = self;
    return ^(UIEdgeInsets  contentInset){
        weakSelf.contentInset = contentInset;
        return weakSelf;
    };
}

//TF_EC_CHAIN_PROP_IMP(UITextView ,id<UIScrollViewDelegate>  ,delegate)
-(UITextView  *(^)(BOOL  directionalLockEnabled))set_directionalLockEnabled{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  directionalLockEnabled){
        weakSelf.directionalLockEnabled = directionalLockEnabled;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  bounces))set_bounces{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  bounces){
        weakSelf.bounces = bounces;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  alwaysBounceVertical))set_alwaysBounceVertical{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  alwaysBounceVertical){
        weakSelf.alwaysBounceVertical = alwaysBounceVertical;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  alwaysBounceHorizontal))set_alwaysBounceHorizontal{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  alwaysBounceHorizontal){
        weakSelf.alwaysBounceHorizontal = alwaysBounceHorizontal;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  pagingEnabled))set_pagingEnabled{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  pagingEnabled){
        weakSelf.pagingEnabled = pagingEnabled;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  scrollEnabled))set_scrollEnabled{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  scrollEnabled){
        weakSelf.scrollEnabled = scrollEnabled;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  showsHorizontalScrollIndicator))set_showsHorizontalScrollIndicator{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  showsHorizontalScrollIndicator){
        weakSelf.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  showsVerticalScrollIndicator))set_showsVerticalScrollIndicator{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  showsVerticalScrollIndicator){
        weakSelf.showsVerticalScrollIndicator = showsVerticalScrollIndicator;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIEdgeInsets  scrollIndicatorInsets))set_scrollIndicatorInsets{
    __weak typeof(self) weakSelf = self;
    return ^(UIEdgeInsets  scrollIndicatorInsets){
        weakSelf.scrollIndicatorInsets = scrollIndicatorInsets;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  indicatorStyle))set_indicatorStyle{
    __weak typeof(self) weakSelf = self;
    return ^(long long  indicatorStyle){
        weakSelf.indicatorStyle = indicatorStyle;
        return weakSelf;
    };
}

-(UITextView  *(^)(double  decelerationRate))set_decelerationRate{
    __weak typeof(self) weakSelf = self;
    return ^(double  decelerationRate){
        weakSelf.decelerationRate = decelerationRate;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  delaysContentTouches))set_delaysContentTouches{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  delaysContentTouches){
        weakSelf.delaysContentTouches = delaysContentTouches;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  canCancelContentTouches))set_canCancelContentTouches{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  canCancelContentTouches){
        weakSelf.canCancelContentTouches = canCancelContentTouches;
        return weakSelf;
    };
}

-(UITextView  *(^)(double  minimumZoomScale))set_minimumZoomScale{
    __weak typeof(self) weakSelf = self;
    return ^(double  minimumZoomScale){
        weakSelf.minimumZoomScale = minimumZoomScale;
        return weakSelf;
    };
}

-(UITextView  *(^)(double  maximumZoomScale))set_maximumZoomScale{
    __weak typeof(self) weakSelf = self;
    return ^(double  maximumZoomScale){
        weakSelf.maximumZoomScale = maximumZoomScale;
        return weakSelf;
    };
}

-(UITextView  *(^)(double  zoomScale))set_zoomScale{
    __weak typeof(self) weakSelf = self;
    return ^(double  zoomScale){
        weakSelf.zoomScale = zoomScale;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  bouncesZoom))set_bouncesZoom{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  bouncesZoom){
        weakSelf.bouncesZoom = bouncesZoom;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  scrollsToTop))set_scrollsToTop{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  scrollsToTop){
        weakSelf.scrollsToTop = scrollsToTop;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  keyboardDismissMode))set_keyboardDismissMode{
    __weak typeof(self) weakSelf = self;
    return ^(long long  keyboardDismissMode){
        weakSelf.keyboardDismissMode = keyboardDismissMode;
        return weakSelf;
    };
}

//superclass pros UIView
-(UITextView  *(^)(UIView *  maskView))set_maskView{
    __weak typeof(self) weakSelf = self;
    return ^(UIView *  maskView){
        weakSelf.maskView = maskView;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  userInteractionEnabled))set_userInteractionEnabled{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  userInteractionEnabled){
        weakSelf.userInteractionEnabled = userInteractionEnabled;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  tag))set_tag{
    __weak typeof(self) weakSelf = self;
    return ^(long long  tag){
        weakSelf.tag = tag;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  semanticContentAttribute))set_semanticContentAttribute{
    __weak typeof(self) weakSelf = self;
    return ^(long long  semanticContentAttribute){
        weakSelf.semanticContentAttribute = semanticContentAttribute;
        return weakSelf;
    };
}

-(UITextView  *(^)(CGPoint  center))set_center{
    __weak typeof(self) weakSelf = self;
    return ^(CGPoint  center){
        weakSelf.center = center;
        return weakSelf;
    };
}

-(UITextView  *(^)(CGRect  frame))set_frame{
    __weak typeof(self) weakSelf = self;
    return ^(CGRect  frame){
        weakSelf.frame = frame;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIColor *  backgroundColor))set_backgroundColor{
    __weak typeof(self) weakSelf = self;
    return ^(UIColor *  backgroundColor){
        weakSelf.backgroundColor = backgroundColor;
        return weakSelf;
    };
}

//superclass pros UIResponder
-(UITextView  *(^)(NSUserActivity *  userActivity))set_userActivity{
    __weak typeof(self) weakSelf = self;
    return ^(NSUserActivity *  userActivity){
        weakSelf.userActivity = userActivity;
        return weakSelf;
    };
}

//superclass pros NSObject
-(UITextView  *(^)(NSArray *  accessibilityElements))set_accessibilityElements{
    __weak typeof(self) weakSelf = self;
    return ^(NSArray *  accessibilityElements){
        weakSelf.accessibilityElements = accessibilityElements;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSArray *  accessibilityCustomActions))set_accessibilityCustomActions{
    __weak typeof(self) weakSelf = self;
    return ^(NSArray *  accessibilityCustomActions){
        weakSelf.accessibilityCustomActions = accessibilityCustomActions;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  isAccessibilityElement))set_isAccessibilityElement{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  isAccessibilityElement){
        weakSelf.isAccessibilityElement = isAccessibilityElement;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSString *  accessibilityLabel))set_accessibilityLabel{
    __weak typeof(self) weakSelf = self;
    return ^(NSString *  accessibilityLabel){
        weakSelf.accessibilityLabel = accessibilityLabel;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSString *  accessibilityHint))set_accessibilityHint{
    __weak typeof(self) weakSelf = self;
    return ^(NSString *  accessibilityHint){
        weakSelf.accessibilityHint = accessibilityHint;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSString *  accessibilityValue))set_accessibilityValue{
    __weak typeof(self) weakSelf = self;
    return ^(NSString *  accessibilityValue){
        weakSelf.accessibilityValue = accessibilityValue;
        return weakSelf;
    };
}

-(UITextView  *(^)(unsigned long long  accessibilityTraits))set_accessibilityTraits{
    __weak typeof(self) weakSelf = self;
    return ^(unsigned long long  accessibilityTraits){
        weakSelf.accessibilityTraits = accessibilityTraits;
        return weakSelf;
    };
}

-(UITextView  *(^)(UIBezierPath *  accessibilityPath))set_accessibilityPath{
    __weak typeof(self) weakSelf = self;
    return ^(UIBezierPath *  accessibilityPath){
        weakSelf.accessibilityPath = accessibilityPath;
        return weakSelf;
    };
}

-(UITextView  *(^)(CGPoint  accessibilityActivationPoint))set_accessibilityActivationPoint{
    __weak typeof(self) weakSelf = self;
    return ^(CGPoint  accessibilityActivationPoint){
        weakSelf.accessibilityActivationPoint = accessibilityActivationPoint;
        return weakSelf;
    };
}

-(UITextView  *(^)(NSString *  accessibilityLanguage))set_accessibilityLanguage{
    __weak typeof(self) weakSelf = self;
    return ^(NSString *  accessibilityLanguage){
        weakSelf.accessibilityLanguage = accessibilityLanguage;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  accessibilityElementsHidden))set_accessibilityElementsHidden{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  accessibilityElementsHidden){
        weakSelf.accessibilityElementsHidden = accessibilityElementsHidden;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  accessibilityViewIsModal))set_accessibilityViewIsModal{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  accessibilityViewIsModal){
        weakSelf.accessibilityViewIsModal = accessibilityViewIsModal;
        return weakSelf;
    };
}

-(UITextView  *(^)(BOOL  shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren{
    __weak typeof(self) weakSelf = self;
    return ^(BOOL  shouldGroupAccessibilityChildren){
        weakSelf.shouldGroupAccessibilityChildren = shouldGroupAccessibilityChildren;
        return weakSelf;
    };
}

-(UITextView  *(^)(long long  accessibilityNavigationStyle))set_accessibilityNavigationStyle{
    __weak typeof(self) weakSelf = self;
    return ^(long long  accessibilityNavigationStyle){
        weakSelf.accessibilityNavigationStyle = accessibilityNavigationStyle;
        return weakSelf;
    };
}

-(UITextView *(^)(id value,NSString *key))set_ValueKey{
    __weak typeof(self) weakSelf = self;
    return ^(id value,NSString *key){
        [NSObject tf_setTargetValue:weakSelf withValue:value forKey:key];
        return weakSelf;
    };
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/var/lib/tomcat6/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/var/lib/tomcat6/solr" override="true" />
</Context>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2018 Google LLC
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     https://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.
  -->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <variable
            name="clickListener"
            type="android.view.View.OnClickListener"/>
        <variable
            name="plant"
            type="com.google.samples.apps.sunflower.data.Plant"/>
    </data>

    <com.google.samples.apps.sunflower.views.MaskedCardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/card_side_margin"
        android:layout_marginEnd="@dimen/card_side_margin"
        android:layout_marginBottom="@dimen/card_bottom_margin"
        android:onClick="@{clickListener}"
        app:cardElevation="@dimen/card_elevation"
        app:cardPreventCornerOverlap="false"
        app:shapeAppearanceOverlay="@style/ShapeAppearance.Sunflower.Card">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:id="@+id/plant_item_image"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/plant_item_image_height"
                    android:contentDescription="@string/a11y_plant_item_image"
                    android:scaleType="centerCrop"
                    app:imageFromUrl="@{plant.imageUrl}"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/plant_item_title"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/margin_normal"
                    android:layout_marginTop="@dimen/margin_normal"
                    android:text="@{plant.name}"
                    android:textAppearance="?attr/textAppearanceListItem"
                    android:gravity="center_horizontal"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/plant_item_image"
                    app:layout_constraintBottom_toBottomOf="parent"
                    tools:text="Tomato"/>

            </androidx.constraintlayout.widget.ConstraintLayout>

    </com.google.samples.apps.sunflower.views.MaskedCardView>

</layout>


text:
# Code Practises

## Creating a package
All procedures and functions should reside in a package. Here is how a package is typically created:
```
CREATE OR REPLACE PACKAGE str_pkg
IS
   /* Description
   *  Author
   *  Parameter
   */
   PROCEDURE between
   ( pi_str_in   IN  VARCHAR2
   , pi_start_in IN  PLS_INTEGER
   , pi_end_in   IN  PLS_INTEGER
   , po_str_out  OUT VARCHAR2
   );
END str_pkg;
```
Next, I add only the following code to the package body:
```
CREATE OR REPLACE PACKAGE BODY str_pkg
IS
   PROCEDURE between
   ( pi_str_in   IN  VARCHAR2
   , pi_start_in IN  PLS_INTEGER
   , pi_end_in   IN  PLS_INTEGER
   , po_str_out  OUT VARCHAR2
   )
   IS
   BEGIN
     # Start your work here and comment it
     null;

   EXCEPTION
     WHEN OTHERS
     THEN
       # use your favorite logger tool here before raising an exception for system errors
       raise;
   END between;
END str_pkg;
```

## Avoid hardcoding of system variables, IDs and VARCHAR2 length
- System variables that depend on your environment should never be hardcoded in PL/SQL
- Columns that end with _ID usually contain technical IDs. Don't hardcode these in your PL/SQL, but use a procedure to get them
- Make use of %type and %rowtype. (avoid hardcoding the length of a varchar2 column)

## When writing dynamic queries, making use of "q" will lead to much more maintainable code
```
CREATE OR REPLACE PACKAGE BODY query_builder_pkg
IS

PROCEDURE dynamic_query
IS

  v_sql  VARCHAR2(1024);
  v_cnt  PLS_INTEGER;

BEGIN
  v_sql := q'[SELECT COUNT(*) FROM user_objects WHERE object_type = 'TABLE']';
  EXECUTE IMMEDIATE v_sql INTO v_cnt;
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(v_cnt) || ' tables in USER_OBJECTS.');

EXCEPTION
  WHEN OTHERS
  THEN
    # use your favorite logger tool here before raising an exception for system errors
    raise;
END dynamic_query;

END query_builder_pkg;
```

## Keep in mind: bulk operations are a LOT quicker then row-by-row processing
```
declare
  cursor get_activity
  is
    select *
    from   activity
    where  id between 1000000 and 1999999; -- 1 million records

  type activity_array is table of get_activity%rowtype;

  la_activity_rec activity_array:= activity_array();
  ts1             timestamp;

begin
  ts1:= systimestamp;
  dbms_output.put_Line ('started at '||ts1); open get_activity;

  loop
    fetch get_activity bulk collect into la_activity_rec limit 500;
    forall i in indices of la_activity_rec
      insert into activity2 values la_activity_rec(i);
    exit when get_activity%notfound;
  end loop;

  close get_activity;

  dbms_output.put_Line ('fin at '||systimestamp);
  commit;
end;
```

## If you need error handling during the bulk operation, here is an example:
```
loop
  fetch get_activity bulk collect into la_activity_rec limit 500;

  begin
    forall i in indices of la_activity_rec save exceptions insert into activity3 values la_activity_rec(i);

  exception
    when others
    then
      if sqlcode=-24381
      then
        for errno in 1..sql%bulk_exceptions.count
        loop
          dbms_output.put_line('Error in record ' ||sql%bulk_exceptions(errno).error_index||
        end loop;
      else
        raise;
      end if;
  end;

  exit when get_activity%notfound;
end loop;
close get_activity;
```

## Getting only a few rows using SQL
```
select   prod_id
,        prod_list_price
from     sh.products
order by prod_list_price
fetch first 5 rows only
;
```

## When using CASE (and you should use it instead of IF!), make sure that there is a ELSE clause
```
FUNCTION fruit_translator
( pi_letter_in IN VARCHAR2
) RETURN VARCHAR2
IS
  retval VARCHAR2(100);
BEGIN
  CASE
    WHEN pi_letter_in = 'A' THEN retval := 'Apple';
    WHEN pi_letter_in = 'B' THEN retval := 'Banana';
    ELSE retval:= '';
  END CASE;

  RETURN retval;
END fruit_translator;
```


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>LookingGlass</title>
<link rel="stylesheet" href="/static/LookingGlass.css" type="text/css">

<form id="LGLoginForm" action="/api/LLLP/connection/login" method="post">

            First
            <input type="text" name="LOGINFIRST"/>

            Last
            <input type="text" name="LOGINLAST"/>

            Password
            <input type="password" name="LOGINPASS"/>

            Grid
            <input type="text" name="LOGINGRID"/>

            Sim
            <input type="text" name="LOGINSIM"/>

        <input type="submit" value="Login"/>


text:
#ifndef M2M_INTERFACE_FACTORY_H
#define M2M_INTERFACE_FACTORY_H

#include <stdlib.h>
#include "mbed-client/m2msecurity.h"
#include "mbed-client/m2mresource.h"
#include "mbed-client/m2minterfaceobserver.h"

//FORWARD DECLARATION
class M2MDevice;
class M2MServer;
class M2MInterfaceImpl;
class M2MFirmware;

/**
 *  \brief M2MInterfaceFactory.
 *  This is a factory class that provides an interface for creating an mbed Client Interface
 *  object for an application to utilize the LWM2M features provided by the client.
 */

class  M2MInterfaceFactory {
private:
    // Prevents the use of assignment operator by accident.
    M2MInterfaceFactory& operator=( const M2MInterfaceFactory& /*other*/ );

    // Prevents the use of copy constructor by accident
    M2MInterfaceFactory( const M2MInterfaceFactory& /*other*/ );

public:

    /**
     * \brief Creates an interface object for the mbed Client Inteface. With this, the
     * client can handle client operations like Bootstrapping, Client
     * Registration, Device Management and Information Reporting.
     * \param endpoint_name The endpoint name of the mbed client.
     * \param endpoint_type The endpoint type of the mbed client, default is empty.
     * \param life_time The lifetime of the endpoint in seconds,
     *        if -1 it is optional.
     * \param listen_port The listening port for the endpoint, default is 5683.
     * \param domain The domain of the endpoint, default is empty.
     * \param mode The binding mode of the endpoint, default is NOT_SET.
     * \param stack The underlying network stack to be used for the connection,
     * default is LwIP_IPv4.
     * \param context_address The context address for M2M-HTTP, not used currently.
     * \return M2MInterfaceImpl An object for managing other client operations.
     */
    static M2MInterface *create_interface(M2MInterfaceObserver &observer,
                                              const String &endpoint_name,
                                              const String &endpoint_type = "",
                                              const int32_t life_time = -1,
                                              const uint16_t listen_port = 5683,
                                              const String &domain = "",
                                              M2MInterface::BindingMode mode = M2MInterface::NOT_SET,
                                              M2MInterface::NetworkStack stack = M2MInterface::LwIP_IPv4,
                                              const String &context_address = "");

    /**
     * \brief Creates a security object for the mbed Client Inteface. With this, the
     * client can manage Bootstrapping and Client Registration.
     * \param ServerType The type of the Security Object, bootstrap or LWM2M server.
     * \return M2MSecurity An object for managing other client operations.
     */
    static M2MSecurity *create_security(M2MSecurity::ServerType server_type);

    /**
     * \brief Creates a server object for the mbed Client Inteface. With this, the
     * client can manage the server resources used for client operations
     * such as Client Registration, server lifetime etc.
     * \return M2MServer An object for managing server client operations.
     */
    static M2MServer *create_server();

    /**
     * \brief Creates a device object for the mbed Client Inteface. With this, the
     * client can manage the device resources used for client operations
     * such as Client Registration, Device Management and Information Reporting.
     * \param name The name of the device object.
     * \return M2MDevice An object for managing other client operations.
     */
    static M2MDevice *create_device();

    /**
     * \brief Creates a firmware object for the mbed Client Inteface. With this, the
     * client can manage the firmware resources used for the client operations
     * such as Client Registration, Device Management and Information Reporting.
     * \return M2MFirmware An object for managing other client operations.
     */
    static M2MFirmware *create_firmware();

    /**
     * \brief Creates a generic object for the mbed Client Inteface. With this, the
     * client can manage its own customized resources used for registering
     * Device Management and Information Reporting for those resources.
     * \param name The name of the object.
     * \param id A unique ID for the object. It should be other than the reserved
     * LWM2M object IDs.
     * \return M2MObject An object for managing other mbed Client operations.
     */
    static M2MObject *create_object(const String &name);

    friend class Test_M2MInterfaceFactory;
};

#endif // M2M_INTERFACE_FACTORY_H


text:
package com.heapwhisperer.metrics.jvm;

import com.codahale.metrics.Gauge;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricSet;
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This metric set class alters the behavior of the {@link GarbageCollectorMetricSet},
 * which takes readings of GC counts and times that are cumulative over the life of the JVM.
 * This metric set uses gauges that represent data for a specific time interval, rather than all time.
 * It also adds an extra gauge for GC throughput, which is a convenient summary metric for JVM's.
 *
 * To calculate readings for a specific time interval, this metric set needs to maintain state
 * for previous values and non-accumulated values. To do it in a thread safe way, this metric set
 * runs a background process in a scheduled thread that updates and stores gauge readings at
 * user-specified time intervals. When clients call {@link com.codahale.metrics.Gauge#getValue()},
 * the stored readings are read (not modified), rather than calling the underlying gauges directly.
 */
public class NonAccumulatingGarbageCollectorMetricSet implements MetricSet {
    private static final Logger LOG = LoggerFactory.getLogger(NonAccumulatingGarbageCollectorMetricSet.class);
    public static final String GC_THROUGHPUT_METRIC_NAME = "GC-throughput.percent";

    private Map<String, Long> previousValues;
    private Map<String, Long> nonAccumulatingValues;
    private GarbageCollectorMetricSet garbageCollectorMetricSet;
    private ScheduledExecutorService scheduledExecutorService;
    private long interval;

    /**
     * Constructor does not take an executor service, instead deferring
     * to the default scheduled executor service provided by this class.
     *
     * @param garbageCollectorMetricSet a metric set that collects counts and times of garbage collections
     * @param interval the time interval over which to calculate non-accumulating gauge readings
     *                 for all the gauges in {@code garbageCollectorMetricSet}
     */
    public NonAccumulatingGarbageCollectorMetricSet(
            GarbageCollectorMetricSet garbageCollectorMetricSet, long interval) {
        this(garbageCollectorMetricSet, interval, null);
    }

    /**
     * Constructor sets up the scheduled executor service that runs a background task to
     * calculate non-accumulating gauge readings at periodic intervals.
     *
     * @param garbageCollectorMetricSet a metric set that collects counts and times of garbage collections
     * @param interval the time interval over which to calculate non-accumulating gauge readings
     *                 for all the gauges in {@code garbageCollectorMetricSet}
     * @param scheduledExecutorService scheduled executor service that runs the task to calculate
     *                                 non-accumulating gauge readings at a frequency determined by
     *                                 {@code interval}.
     */
    public NonAccumulatingGarbageCollectorMetricSet(
            GarbageCollectorMetricSet garbageCollectorMetricSet, long interval,
            ScheduledExecutorService scheduledExecutorService) {
        this.garbageCollectorMetricSet = garbageCollectorMetricSet;
        this.interval = interval;
        previousValues = new HashMap<String, Long>();
        nonAccumulatingValues = new ConcurrentHashMap<String, Long>();
        if (scheduledExecutorService == null) {
            BasicThreadFactory basicThreadFactory = new BasicThreadFactory.Builder()
                    .namingPattern("metrics-gc-stats-update-%d")
                    .daemon(false)
                    .priority(Thread.NORM_PRIORITY)
                    .build();
            this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(basicThreadFactory);
        } else {
            this.scheduledExecutorService = scheduledExecutorService;
        }
        scheduleBackgroundCollectionOfNonAccumulatingValues();
    }

    /**
     * Initialize the scheduled executor service that runs the task to calculate
     * non-accumulating gauge readings.
     */
    protected void scheduleBackgroundCollectionOfNonAccumulatingValues() {
        scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                try {
                    getMetricsOnSchedule();
                } catch (RuntimeException ex) {
                    LOG.error("RuntimeException thrown in NonAccumulatingGarbageCollectorMetricSet. Exception was suppressed.");
                }
            }
        }, 0, interval, TimeUnit.MILLISECONDS);
    }

    /**
     * Background process to harvest readings from the {@code garbageCollectorMetricSet},
     * which are cumulative over all time. The process updates two maps: one that stores
     * the previous values of all gauges, and one that stores the non-accumulating values
     * for those gauges (the difference between the last reading and the current reading).
     */
    private void getMetricsOnSchedule() {
        Map<String, Metric> metricMap = garbageCollectorMetricSet.getMetrics();
        for (Map.Entry<String, Metric> metricEntry : metricMap.entrySet()) {
            Gauge currentGauge = (Gauge) metricEntry.getValue();
            String currentKey = metricEntry.getKey();
            Long currentValue = (Long) currentGauge.getValue();

            // first reading of gauges will have no previous value. Simply store the current readings.
            if (previousValues.get(currentKey) == null) {
                previousValues.put(currentKey, currentValue);
                nonAccumulatingValues.put(currentKey, currentValue);
            } else {
                // subtract the previous gauge readings from the current readings, and store result
                Long difference = currentValue - previousValues.get(currentKey);
                nonAccumulatingValues.put(currentKey, difference);
                previousValues.put(currentKey, currentValue);
            }
        }
    }

    /**
     * Creates a map of non-accumulating gauges for the underlying gauges in {@code garbageCollectorMetricSet}
     * Also, add an additional gauge for GC throughput.
     *
     * @return the map of metrics that contains non-cumulative gauges
     */
    @Override
    public Map<String, Metric> getMetrics() {
        Map<String, Metric> metricMap = garbageCollectorMetricSet.getMetrics();
        Map<String, Metric> nonAccumulatingMetricMap = new HashMap<String, Metric>();

        for (final Map.Entry<String, Metric> metricEntry : metricMap.entrySet()) {
            Gauge nonAccumulatingGauge = new Gauge<Long>() {
                /**
                 * Instead of reading from the accumulating gauges in {@code garbageCollectorMetricSet},
                 * we read from the map of non-accumulating values (which is updated by the background
                 * task running in {@code scheduledExecutorService}).
                 *
                 * For reporters that call this method, it makes sense to align the frequency of
                 * those calls with the frequency of the background updates of non-accumulating
                 * gauges. For example, if a reporter calls this method every minute, then the
                 * {@code interval} setting of this metric-set should also be 1 minute. Calling
                 * this method more or less frequently does not impact the operation of this
                 * class--but the caller will either get repeated values (for more frequent calls),
                 * or will miss some values (for less frequent calls).
                 *
                 * @return the gauge value representing only the current reporting interval
                 */
                @Override
                public Long getValue() {
                    Long value = nonAccumulatingValues.get(metricEntry.getKey());
                    return value != null ? value : 0L;
                }
            };
            nonAccumulatingMetricMap.put(metricEntry.getKey(), nonAccumulatingGauge);
        }

        Gauge gcThroughputGauge = new Gauge<Double>() {
            /**
             * This gauge returns readings for garbage collector throughput. GC throughput
             * is derived from the readings of time spent by all garbage collectors in
             * the current {@code interval} of time.
             *
             * Example: for an interval of 1 minute, we have 60,000 ms of total time.
             * If we spent 200 ms on minor GC's and 100 ms on major GC's, then
             * 59,700 ms were available to the application. 59,700 / 60,000 = 99.5% GC throughput.
             *
             * @return a value between 0.0 and 100.0 that represents the garbage collector
             * throughput for the current interval (as defined by {@code interval}
             */
            @Override
            public Double getValue() {
                Double totalGCTime = 0.0;

                for (Map.Entry<String, Long> metricEntry : nonAccumulatingValues.entrySet()) {
                    if (metricEntry.getKey().endsWith("time")) {
                        totalGCTime += metricEntry.getValue();
                    }
                }

                return 100 - ((totalGCTime / interval) * 100);
            }
        };
        nonAccumulatingMetricMap.put(GC_THROUGHPUT_METRIC_NAME, gcThroughputGauge);

        return Collections.unmodifiableMap(nonAccumulatingMetricMap);
    }
}


text:
export // This is incorrect Scala but can still be highlighted correctly
export a._
export a.x // Test comment
export a.x.y.z // Test comment
export a.{x, y}
export a.{x => y}
export a.{x => } // This is incorrect Scala but can still be highlighted correctly
export a.{x => `test-name`} // Test comment
export given
export given a // Test comment
export given a.x // Test comment
export given a._
export given a.{x, y} // Test comment
export given a.{x => y}
export given a.{x => `test-name`}
  export scanUnit.scan
  export printUnit.{status => _, _}


text:
<?php use_helper('Javascript', 'I18N') ?>

<?php echo __('Media library (%1%)', array('%1%' => $current_dir_slash), 'sfMediaLibrary') ?>

      <?php echo form_tag('sfMediaLibrary/upload', 'class=float-left id=sf_asset_upload_form name=sf_asset_upload_form multipart=true') ?>
      <?php echo input_hidden_tag('current_dir', $currentDir) ?>
      <fieldset>

          <?php echo label_for('file', __('Add a file:', array(), 'sfMediaLibrary'), '') ?>

<?php echo input_file_tag('file') ?>

      </fieldset>

<?php echo submit_tag(__('Add', array(), 'sfMediaLibrary'), array (
          'name'    => 'add',
          'class'   => 'sf_asset_action_add_file',
          'onclick' => "if($('file').value=='') { alert('".__('Please choose a file first', array(), 'sfMediaLibrary')."');return false; }",
        )) ?>

      </form>

      <?php echo form_tag('sfMediaLibrary/mkdir', 'class=float-left id=sf_asset_mkdir_form name=sf_asset_mkdir_form') ?>
      <?php echo input_hidden_tag('current_dir', $currentDir) ?>
      <fieldset>

          <?php echo label_for('dir', __('Create a dir:', array(), 'sfMediaLibrary'), '') ?>

<?php echo input_tag('name', null, 'size=15 id=dir') ?>

      </fieldset>

<?php echo submit_tag(__('Create', array(), 'sfMediaLibrary'), array (
          'name'    => 'create',
          'class'   => 'sf_asset_action_add_folder',
          'onclick' => "if($('dir').value=='') { alert('".__('Please enter a directory name first', array(), 'sfMediaLibrary')."');return false; }",
        )) ?>

      </form>

      <?php include_partial('sfMediaLibrary/dirs', array('dirs' => $dirs, 'currentDir' => $currentDir, 'parentDir' => $parentDir, 'is_file' => (count($files) > 0))) ?>
      <?php include_partial('sfMediaLibrary/files', array('files' => $files, 'currentDir' => $currentDir, 'webAbsCurrentDir' => $webAbsCurrentDir, 'count' => count($dirs))) ?>


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/public/cpp/notification_utils.h"

#include "ui/gfx/vector_icon_types.h"
#include "ui/message_center/public/cpp/notification_delegate.h"

namespace ash {

std::unique_ptr<message_center::Notification> CreateSystemNotification(
    const std::string& notification_id,
    const base::string16& title,
    const base::string16& message,
    const std::string& system_component_id,
    const base::RepeatingClosure& click_callback) {
  DCHECK(!click_callback.is_null());
  std::unique_ptr<message_center::Notification> notification =
      CreateSystemNotification(
          message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, title,
          message, base::string16() /* display_source */, GURL(),
          message_center::NotifierId(
              message_center::NotifierType::SYSTEM_COMPONENT,
              system_component_id),
          message_center::RichNotificationData(),
          new message_center::HandleNotificationClickDelegate(click_callback),
          gfx::kNoneIcon,
          message_center::SystemNotificationWarningLevel::CRITICAL_WARNING);
  notification->SetSystemPriority();
  return notification;
}

std::unique_ptr<message_center::Notification> CreateSystemNotification(
    message_center::NotificationType type,
    const std::string& id,
    const base::string16& title,
    const base::string16& message,
    const base::string16& display_source,
    const GURL& origin_url,
    const message_center::NotifierId& notifier_id,
    const message_center::RichNotificationData& optional_fields,
    scoped_refptr<message_center::NotificationDelegate> delegate,
    const gfx::VectorIcon& small_image,
    message_center::SystemNotificationWarningLevel color_type) {
  DCHECK_EQ(message_center::NotifierType::SYSTEM_COMPONENT, notifier_id.type);
  SkColor color = kSystemNotificationColorNormal;
  switch (color_type) {
    case message_center::SystemNotificationWarningLevel::NORMAL:
      color = kSystemNotificationColorNormal;
      break;
    case message_center::SystemNotificationWarningLevel::WARNING:
      color = kSystemNotificationColorWarning;
      break;
    case message_center::SystemNotificationWarningLevel::CRITICAL_WARNING:
      color = kSystemNotificationColorCriticalWarning;
      break;
  }
  auto notification = std::make_unique<message_center::Notification>(
      type, id, title, message, gfx::Image(), display_source, origin_url,
      notifier_id, optional_fields, delegate);
  notification->set_accent_color(color);
  if (!small_image.is_empty())
    notification->set_vector_small_image(small_image);
  return notification;
}

}  // namespace ash


text:
import copy
import json

# third-party imports
import pytest

def _check_exits_zero(result):
    assert result.exit_code == 0

def _check_exits_non_zero(result):
    assert result.exit_code != 0

def _check_output_contains(result, match):
    assert match in result.output

def _check_output_does_not_contain(result, match):
    assert match not in result.output

@pytest.mark.integration
def test_help(runner, env):
    result = runner(["--help"], env=env)
    _check_exits_zero(result)
    _check_output_contains(result, "Usage:")

@pytest.mark.integration
def test_show(runner, env):
    result = runner(["apps", "show"], env=env)
    _check_exits_non_zero(result)
    _check_output_contains(result, "Unable to retrieve application details from marathon: does not exist.")

@pytest.mark.integration
def test_deploy_custom_template(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test.json.tmpl"
    result = runner(["apps", "deploy", "-t", _tmpl_path, "RANDOM_LABEL=some_value"], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_show_again(runner, env):
    result = runner(["apps", "show"], env=env)
    _check_exits_zero(result)
    _check_output_contains(result, '"id": "/%s"' % env['SHPKPR_APPLICATION'])

@pytest.mark.integration
def test_deploy_default_template(runner, env):
    cmd = ["apps",
           "deploy",
           "LABEL_RANDOM=some_value",
           "DOCKER_EXPOSED_PORT=8080",
           "MARATHON_HEALTH_CHECK_PATH=/"]
    result = runner(cmd, env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_show_yet_again(runner, env):
    result = runner(["apps", "show", "-a", env['SHPKPR_MARATHON_APP_ID']], env=env)
    _check_exits_zero(result)
    _check_output_contains(result, '"id": "/%s"' % env['SHPKPR_MARATHON_APP_ID'])
    _check_output_contains(result, '"RANDOM": "some_value"')

@pytest.mark.integration
def test_run(runner, env):
    result = runner(["apps", "run", "env", "ENV_TESTY_MC_TESTFACE=testy"], env=env)
    _check_exits_zero(result)
    _check_output_contains(result, "TESTY_MC_TESTFACE=testy")

@pytest.mark.integration
def test_cron_show(runner, env):
    result = runner(["cron", "show"], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_set(runner, env):
    _tmpl_path = 'tests/fixtures/templates/chronos/test-chronos.json.tmpl'
    result = runner(["cron", "set", "--template", _tmpl_path, "CHRONOS_JOB_NAME=shpkpr-test-job"], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_show_after_add(runner, env):
    result = runner(["cron", "show"], env=env)

    _check_output_contains(result, '"name": "shpkpr-test-job"')
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_run(runner, env):
    result = runner(["cron", "run", "shpkpr-test-job"], env=env)

    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_delete_tasks(runner, env):
    result = runner(["cron", "delete-tasks", "shpkpr-test-job"], env=env)

    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_delete(runner, env):
    result = runner(["cron", "delete", "shpkpr-test-job"], env=env)

    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_show_after_delete(runner, env):
    result = runner(["cron", "show"], env=env)

    _check_output_does_not_contain(result, '"name": "shpkpr-test-job"')
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_set_default_template(runner, env):
    cmd = ["cron",
           "set",
           "CHRONOS_JOB_NAME=shpkpr-test-job",
           "CHRONOS_OWNER=example@example.com",
           'CHRONOS_CMD=echo \\"Hello World!\\"']
    result = runner(cmd, env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_show_default_template_after_add(runner, env):
    result = runner(["cron", "show"], env=env)

    _check_output_contains(result, '"name": "shpkpr-test-job"')
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_delete_default_template(runner, env):
    result = runner(["cron", "delete", "shpkpr-test-job"], env=env)

    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_show_default_template_after_delete(runner, env):
    result = runner(["cron", "show"], env=env)

    _check_output_does_not_contain(result, '"name": "shpkpr-test-job"')
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_set_with_secrets(runner, env):
    _tmpl_path = 'tests/fixtures/templates/chronos/test-chronos-secrets.json.tmpl'
    result = runner(["cron", "set", "--template", _tmpl_path, "CHRONOS_JOB_NAME=shpkpr-test-job"], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_show_secrets_after_add(runner, env):
    result = runner(["cron", "show", "-j", "shpkpr-test-job"], env=env)

    env_vars = json.loads(result.output)[0].get("environmentVariables", [])
    assert {"name": "MY_SECRET", "value": "bar"} in env_vars
    _check_exits_zero(result)

@pytest.mark.integration
def test_cron_delete_secrets(runner, env):
    result = runner(["cron", "delete", "shpkpr-test-job"], env=env)

    _check_exits_zero(result)

@pytest.mark.integration
def test_bluegreen_deploy(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test-bluegreen.json.tmpl"
    result = runner(["apps", "deploy", "--strategy", "bluegreen", "-t", _tmpl_path], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_deployed(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-blue"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, "shpkpr-test/integration-test-bluegreen-blue")

@pytest.mark.integration
def test_bluegreen_deploy_with_existing_app(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test-bluegreen.json.tmpl"
    result = runner(["apps", "deploy", "--strategy", "bluegreen", "-t", _tmpl_path], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_swapped(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-green"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, "shpkpr-test/integration-test-bluegreen-green")

@pytest.mark.integration
def test_bluegreen_deploy_default_template(runner, env):
    cmd = ["apps",
           "deploy",
           "--strategy",
           "bluegreen",
           "DOCKER_EXPOSED_PORT=8080",
           "MARATHON_APP_ID=shpkpr-test/integration-test-bluegreen-default-template",
           "MARATHON_HEALTH_CHECK_PATH=/",
           "MARATHON_SERVICE_PORT=11092",
           "MARATHON_SERVICE_PORT_ALT=11093",
           "HAPROXY_VHOST=shpkpr-test-bgdt.somedomain.com"]
    result = runner(cmd, env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_default_template_deployed(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-default-template-blue"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, local_env["SHPKPR_APPLICATION"])

@pytest.mark.integration
def test_bluegreen_deploy_with_existing_app_default_template(runner, env):
    cmd = ["apps",
           "deploy",
           "--strategy",
           "bluegreen",
           "DOCKER_EXPOSED_PORT=8080",
           "MARATHON_APP_ID=shpkpr-test/integration-test-bluegreen-default-template",
           "MARATHON_HEALTH_CHECK_PATH=/",
           "MARATHON_SERVICE_PORT=11092",
           "MARATHON_SERVICE_PORT_ALT=11093",
           "HAPROXY_VHOST=shpkpr-test-bgdt.somedomain.com"]
    result = runner(cmd, env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_default_template_swapped(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-default-template-green"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, local_env["SHPKPR_APPLICATION"])

@pytest.mark.integration
def test_bluegreen_autoports_deploy(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test-bluegreen-autoports.json.tmpl"
    result = runner(["apps", "deploy", "--strategy", "bluegreen", "-t", _tmpl_path], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_autoports_deploy(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-blue"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, "shpkpr-test/integration-test-bluegreen-blue")

@pytest.mark.integration
def test_bluegreen_autoports_deploy_with_existing_app(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test-bluegreen-autoports.json.tmpl"
    result = runner(["apps", "deploy", "--strategy", "bluegreen", "-t", _tmpl_path], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_autoports_swapped(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-green"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, "shpkpr-test/integration-test-bluegreen-green")

@pytest.mark.integration
def test_bluegreen_autoports_deploy_reset(runner, env):
    _tmpl_path = "tests/fixtures/templates/marathon/test-bluegreen-autoports.json.tmpl"
    result = runner(["apps", "deploy", "--strategy", "bluegreen", "-t", _tmpl_path], env=env)
    _check_exits_zero(result)

@pytest.mark.integration
def test_ensure_bluegreen_autoports_reset(runner, env):
    local_env = copy.deepcopy(env)
    local_env["SHPKPR_APPLICATION"] = "shpkpr-test/integration-test-bluegreen-blue"

    result = runner(["apps", "show"], env=local_env)
    _check_exits_zero(result)
    _check_output_contains(result, "shpkpr-test/integration-test-bluegreen-blue")


text:
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

/*

6l is a modified version of the Plan 9 linker documented at

	http://plan9.bell-labs.com/magic/man2html/1/2l

Its target architecture is the x86-64, referred to by these tools as amd64.
It reads files in .6 format generated by 6g, 6c, and 6a and emits
a binary called 6.out by default.

Major changes include:
	- support for ELF and Mach-O binary files
	- support for segmented stacks (this feature is implemented here, not in the compilers).

Original options are listed in the link above.

Options new in this version:

-d
	Elide the dynamic linking header.  With this option, the binary
	is statically linked and does not refer to dynld.  Without this option
	(the default), the binary's contents are identical but it is loaded with dynld.
-e
	Emit an extra ELF-compatible symbol table useful with tools such as
	nm, gdb, and oprofile. This option makes the binary file considerably larger.
-H6
	Write Apple Mach-O binaries (default when $GOOS is darwin)
-H7
	Write Linux ELF binaries (default when $GOOS is linux)
-L dir1,dir2,..
	Search for libraries (package files) in the comma-separated list of directories.
	The default is the single location $GOROOT/pkg/$GOOS_amd64.

*/
package documentation


text:
var presentationApp = angular.module('presentationApp', ['ui.router', 'hljs']);

presentationApp.config(function($stateProvider, $urlRouterProvider, hljsServiceProvider) {
	$urlRouterProvider.otherwise('slides/');

	$stateProvider
		.state('slides', {
			url: '/slides/',
			templateUrl: 'partials/slides.html',
			controller: 'SlidesCtrl'
		});

	hljsServiceProvider.setOptions({
		tabReplace: '    '
	});
});