text:
package net.anotheria.moskito.webui.tracers.action;

import net.anotheria.maf.action.ActionCommand;
import net.anotheria.maf.action.ActionMapping;
import net.anotheria.maf.bean.FormBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;

/**
 * Creates a new tracer.
 *
 * @author lrosenberg
 * @since 05.05.15 16:25
 */
public class CreateTracerAction extends BaseTracersAction{
	@Override
	public ActionCommand execute(ActionMapping actionMapping, FormBean formBean, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
		String producerId = httpServletRequest.getParameter(PARAM_PRODUCER_ID);
		getTracerAPI().createTracer(producerId);
		httpServletResponse.sendRedirect("mskShowProducer?"+PARAM_PRODUCER_ID+ '=' + URLEncoder.encode(producerId, "UTF-8"));
		return null;
	}
}


text:
import { css } from '@emotion/core';
import tw, { TwStyle } from 'twin.macro';

export type Align = 'left' | 'center' | 'right';

export interface UseAlignParams {
  align?: Align;
}

export default function useJustifyContent({ align }: UseAlignParams) {
  const styles: TwStyle[] = [];

  switch (align) {
    case 'left':
      styles.push(tw`justify-start`);
      break;

    case 'center':
      styles.push(tw`justify-center`);
      break;

    default:
    case 'right':
      styles.push(tw`justify-end`);
      break;
  }

  return css(styles);
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2014 Mike Tsao <mike@sowbug.com>

// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

'use strict';

// Given a string, returns a string suitable for inserting as a data
// URL into an <img> tag.
//
// Heavily based on https://github.com/sehrgut/node-retricon.

/**
 * @constructor
 */
function Retricon() {
}

Retricon.DEFAULTS = {
  pixelSize: 10,
  bgColor: undefined,
  pixelPadding: 0,
  imagePadding: 0,
  tiles: 5,
  minFill: 0.3,
  maxFill: 0.90,
  pixelColor: 0
};

Retricon.STYLE = {
  github: {
    pixelSize: 70,
    bgColor: '#F0F0F0',
    pixelPadding: -1,
    imagePadding: 35,
    tiles: 5
  },
  gravatar: {
    tiles: 8,
    bgColor: 1
  },
  mono: {
    bgColor: '#F0F0F0',
    pixelColor: '#000000',
    tiles: 6,
    pixelSize: 12,
    pixelPadding: -1,
    imagePadding: 6
  },
  mosaic: {
    imagePadding: 2,
    pixelPadding: 1,
    pixelSize: 16,
    bgColor: '#F0F0F0'
  },
  mini: {
    pixelSize: 10,
    pixelPadding: 1,
    tiles: 3,
    bgColor: 0,
    pixelColor: 1
  },
  window: {
    pixelColor: undefined,
    bgColor: 0,
    imagePadding: 2,
    pixelPadding: 1,
    pixelSize: 16
  }
};

function brightness(r, g, b) {
  // http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
  return Math.sqrt( .241 * r * r + .691 * g * g + .068 * b * b )
}

function cmp_brightness(a, b) {
  return brightness(a[0], a[1], a[2]) - brightness(b[0], b[1], b[2]);
}

function rcmp_brightness(a, b) {
  return cmp_brightness(b, a);
}

Retricon.prototype.reflect = function(id, dimension) {
  var mid = Math.ceil(dimension / 2);
  var odd = Boolean(dimension % 2);

  var pic = [];
  for (var row = 0; row < dimension; ++row) {
    pic[row] = [];
    for (var col = 0; col < dimension; ++col) {
      var p = (row * mid) + col;
      if (col >= mid) {
        var d = mid - (odd ? 1 : 0) - col;
        var ad = Math.abs(d);
        p = (row * mid) + mid - 1 - ad;
      }
      pic[row][col] = id.pixels[p];
    }
  }
  return pic;
};

Retricon.prototype.idhash = function(str, n, minFill, maxFill) {
  var hash = CryptoJS.SHA512(str);
  var hex_hash = hash + '';
  var colors = [ hex_hash.substring(0, 6), hex_hash.substring(6, 12) ];
  colors.sort(cmp_brightness);
  var a = new ArrayBuffer(4 * 16);
  var a4 = new Uint32Array(a);
  for (var i = 0; i < hash.words.length; ++i) {
    a4[i] = hash.words[i];
  }
  var a1 = new Uint8Array(a);
  var pixels = [];
  for (var i = 0; i < hash.words.length * 4; ++i) {
    pixels.push(a1[i] & 1);
  }
  return {colors: colors, pixels: pixels};
};

Retricon.prototype.create = function(str, opts) {
  if (opts == undefined) {
    opts = {};
  }
  for (var i in Retricon.DEFAULTS) {
    if (!opts.hasOwnProperty(i)) {
      opts[i] = Retricon.DEFAULTS[i];
    }
  }

  var dimension = opts.tiles;
  var pixelSize = opts.pixelSize;
  var border = opts.pixelPadding;

  var mid = Math.ceil(dimension / 2);

  var id = this.idhash(str, mid * dimension, opts.minFill, opts.maxFill);
  var pic = this.reflect(id, dimension);
  var csize = (pixelSize * dimension) + (opts.imagePadding * 2);
  var c = document.createElement('canvas');
  c.width = csize;
  c.height = csize;
  var ctx = c.getContext('2d');

  if (opts.bgColor != undefined) {
    if (opts.bgColor[0] == '#') {
      ctx.fillStyle = opts.bgColor;
    } else {
      var col = '#' + id.colors[opts.bgColor];
      ctx.fillStyle = col;
    }
    ctx.fillRect(0, 0, csize, csize);
  }

  var drawOp = ctx.fillRect.bind(ctx);
  if (opts.pixelColor != undefined) {
    if (opts.pixelColor[0] == '#') {
      ctx.fillStyle = opts.pixelColor;
    } else {
      ctx.fillStyle = '#' + id.colors[opts.pixelColor];
    }
  } else {
    drawOp = ctx.clearRect.bind(ctx);
  }

  for (var x = 0; x < dimension; ++x) {
    for (var y = 0; y < dimension; ++y) {
      if (pic[y][x]) {
        drawOp((x * pixelSize) + border + opts.imagePadding,
               (y * pixelSize) + border + opts.imagePadding,
               pixelSize - (border * 2),
               pixelSize - (border * 2));
      }
    }
  }
  return c;
}


text:
using Racing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RacingWebScraper
{
    public interface IRacingScraper
    {
        event EventHandler<GetRaceDataAsyncCompletedEventArgs> GetRaceDataAsyncCompleted;
        Task<List<IRaceHeader>> GetHeadersAsync(DateTime dt, IProgress<BasicUpdate> progress);
        Task<List<Race>> GetRaceDataAsync(List<Dictionary<String, String>> raceData, IProgress<BasicUpdate> progress);
    }

    public class GetRaceDataCompletedEventArgs
    {
        public List<IRaceDetail> Races { get; private set; }
        public GetRaceDataCompletedEventArgs(List<IRaceDetail> races)
        {
            Races = races;
        }
    }
}


text:
<?php

class Twig_TokenParser_Set extends Twig_TokenParser
{
    /**
     * Parses a token and returns a node.
     *
     * @param Twig_Token $token A Twig_Token instance
     *
     * @return Twig_NodeInterface A Twig_NodeInterface instance
     */
    public function parse(Twig_Token $token)
    {
        $lineno = $token->getLine();
        $stream = $this->parser->getStream();
        $names = $this->parser->getExpressionParser()->parseAssignmentExpression();

        $capture = false;
        if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) {
            $stream->next();
            $values = $this->parser->getExpressionParser()->parseMultitargetExpression();

            $stream->expect(Twig_Token::BLOCK_END_TYPE);

            if (count($names) !== count($values)) {
                throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignements.", $lineno);
            }
        } else {
            $capture = true;

            if (count($names) > 1) {
                throw new Twig_Error_Syntax("When using set with a block, you cannot have a multi-target.", $lineno);
            }

            $stream->expect(Twig_Token::BLOCK_END_TYPE);

            $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
            $stream->expect(Twig_Token::BLOCK_END_TYPE);
        }

        return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag());
    }

    public function decideBlockEnd($token)
    {
        return $token->test('endset');
    }

    /**
     * Gets the tag name associated with this token parser.
     *
     * @param string The tag name
     */
    public function getTag()
    {
        return 'set';
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/osgi"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
	xsi:schemaLocation="http://www.springframework.org/schema/osgi
       http://www.springframework.org/schema/osgi/spring-osgi.xsd
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">

	<service ref="contactsService" interface="com.manning.sdmia.dataaccess.service.ContactsService"/>

	<reference id="contactsDao" interface="com.manning.sdmia.dataaccess.domain.dao.ContactsDao"/>
	<reference id="transactionManager" interface="org.springframework.transaction.PlatformTransactionManager"/>
</beans:beans>