text:
package br.odb.libstrip;

import br.odb.gameutils.math.Vec3;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Daniel "Monty" Monteiro
 *
 */
public class TriangleMesh implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = 3375701151469728552L;

	final public List<GeneralTriangle> faces = new ArrayList<>();

	final public String name;
	private float[] cachedVertexData;
	private float[] cachedColorData;

	public void clear() {
		faces.clear();
		cachedColorData = null;
		cachedVertexData = null;
	}

	/**
	 *
	 * @param mesh
	 */
	public TriangleMesh(String name, TriangleMesh mesh) {

		this(name);

		for (GeneralTriangle face : mesh.faces) {
			faces.add(face.makeCopy());
		}
	}

	public TriangleMesh(String name) {
		this.name = name;
	}

	/**
	 *
	 */
	@Override
	public String toString() {

		StringBuilder sb = new StringBuilder();

		sb.append("<name>").append(name).append("</name>\n");

		for (GeneralTriangle isf : faces) {
			sb.append("\n").append(isf);
		}
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + faces.hashCode();
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	public Vec3 getCenter() {
		float points = 0;
		Vec3 center = new Vec3();

		for ( GeneralTriangle t : faces ) {

			center.addTo( t.x0, t.y0, t.z0 );
			center.addTo( t.x1, t.y1, t.z1 );
			center.addTo( t.x2, t.y2, t.z2 );
			points += 3.0f;
		}

		center.scale( 1.0f / points );

		return center;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if ( !( obj instanceof TriangleMesh ) ) {
			return false;
		}
		TriangleMesh other = (TriangleMesh) obj;
		if (!faces.equals(other.faces)) {
			return false;
		}
		if (name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!name.equals(other.name)) {
			return false;
		}
		return true;
	}

	public void rotateXZ( float angleDegrees ) {

		float rad = (float) ( Math.PI / 180.0f );
		float sin = (float) Math.sin( angleDegrees * rad );
		float cos = (float) Math.sin( angleDegrees * rad );

		float x;
		float z;

		for ( GeneralTriangle trig : faces ) {

			x = trig.x0 * cos - trig.z0 * sin;
			z = trig.x0 * sin + trig.z0 * cos;
			trig.x0 = x;
			trig.z0 = z;

			x = trig.x1 * cos - trig.z1 * sin;
			z = trig.x1 * sin + trig.z1 * cos;
			trig.x1 = x;
			trig.z1 = z;

			x = trig.x2 * cos - trig.z2 * sin;
			z = trig.x2 * sin + trig.z2 * cos;
			trig.x2 = x;
			trig.z2 = z;
		}

		updateVertexData();
	}

	public void translateTo(Vec3 translation) {
		Vec3 center = this.getCenter();
		translate( translation.sub( center ) );
	}

	public void scale(float scaleFactor) {
		scale( new Vec3( scaleFactor, scaleFactor, scaleFactor ) );
	}

	public void scale(Vec3 scaleFactors) {

		for ( GeneralTriangle trig : faces ) {
			trig.x0 *= scaleFactors.x;
			trig.x1 *= scaleFactors.x;
			trig.x2 *= scaleFactors.x;
			trig.y0 *= scaleFactors.y;
			trig.y1 *= scaleFactors.y;
			trig.y2 *= scaleFactors.y;
			trig.z0 *= scaleFactors.z;
			trig.z1 *= scaleFactors.z;
			trig.z2 *= scaleFactors.z;
		}

		if (cachedVertexData != null) {

			for (int c = 0; c < cachedVertexData.length; c += 9) {

				cachedVertexData[c    ] *= scaleFactors.x;
				cachedVertexData[c + 1] *= scaleFactors.y;
				cachedVertexData[c + 2] *= scaleFactors.z;

				cachedVertexData[c + 3] *= scaleFactors.x;
				cachedVertexData[c + 4] *= scaleFactors.y;
				cachedVertexData[c + 5] *= scaleFactors.z;

				cachedVertexData[c + 6] *= scaleFactors.x;
				cachedVertexData[c + 7] *= scaleFactors.y;
				cachedVertexData[c + 8] *= scaleFactors.z;
			}
		}
	}

	public void translate(Vec3 translation) {

		for ( GeneralTriangle trig : faces ) {
			trig.x0 += translation.x;
			trig.x1 += translation.x;
			trig.x2 += translation.x;
			trig.y0 += translation.y;
			trig.y1 += translation.y;
			trig.y2 += translation.y;
			trig.z0 += translation.z;
			trig.z1 += translation.z;
			trig.z2 += translation.z;
		}

		if (cachedVertexData != null) {

			for (int c = 0; c < cachedVertexData.length; c += 9) {

				cachedVertexData[c    ] += translation.x;
				cachedVertexData[c + 1] += translation.y;
				cachedVertexData[c + 2] += translation.z;

				cachedVertexData[c + 3] += translation.x;
				cachedVertexData[c + 4] += translation.y;
				cachedVertexData[c + 5] += translation.z;

				cachedVertexData[c + 6] += translation.x;
				cachedVertexData[c + 7] += translation.y;
				cachedVertexData[c + 8] += translation.z;
			}
		}
	}

	void updateVertexData() {
		GeneralTriangle t;
		cachedVertexData = new float[9 * this.faces.size()];

		for (int c = 0; c < cachedVertexData.length; c += 9) {

			t = faces.get(c / 9);
			cachedVertexData[c] = t.x0;
			cachedVertexData[c + 1] = t.y0;
			cachedVertexData[c + 2] = t.z0;

			cachedVertexData[c + 3] = t.x1;
			cachedVertexData[c + 4] = t.y1;
			cachedVertexData[c + 5] = t.z1;

			cachedVertexData[c + 6] = t.x2;
			cachedVertexData[c + 7] = t.y2;
			cachedVertexData[c + 8] = t.z2;
		}
	}

	public float[] getVertexData() {

		if (cachedVertexData == null) {
			updateVertexData();
		}

		return cachedVertexData;
	}

	public float[] getColorData() {

		if (cachedColorData == null) {

			float[] colourData;
			GeneralTriangle t;
			cachedColorData = new float[4 * this.faces.size()];

			for (int c = 0; c < faces.size(); ++c) {

				t = faces.get(c);
				colourData = t.material.mainColor.getFloatData();
				cachedColorData[(c * 4)] = colourData[ 0 ];
				cachedColorData[(c * 4) + 1] = colourData[ 1 ];
				cachedColorData[(c * 4) + 2] = colourData[ 2 ];
				cachedColorData[(c * 4) + 3] = colourData[ 3 ];
			}
		}

		return cachedColorData;
	}
}


text:
var require = require || null;
var fsAjaxer = fsAjaxer || null;
var chai = chai || null;

if (require) {

  fsAjaxer = require('../lib/ajaxer-fs');
  chai = require('chai');
}

var expect = chai.expect;

describe('#get', function() {

  it('should load a file', function(done) {
    fsAjaxer.get('./LICENSE', null, function(result) {
      expect(result).to.be.a('string');
      done();
    });
  });

});

redpajama_set_name: RedPajamaGithub


text:
namespace Aldsoft.Acord.Tests.Entities
{
    using Aldsoft.Acord.LA;
    using System;

    [Serializable]
    public class MockBook : EntityBase<MockBook>
    {
        public static MockBookBuilder CreateBuilder() { return MockBookBuilder.CreateBuilder(); }
        public static MockBookBuilder CreateBuilder(MockBook baseEntity) { return MockBookBuilder.CreateBuilder(baseEntity); }

        public string ISBN { get; set; }
        public string Title { get; set; }
    }
}


text:
package main

import (
	"fmt"
	"go/ast"
	"strings"
)

type Method struct {
	name    string
	params  []Param
	results []Param

	hasContextParam   bool
	contextParamName  string
	hasErrResult      bool
	errorResultName   string
	moreThanOneResult bool

	pkg        *Package
	file       File
	imports    []Import
	types      []Type
	interfaces []Interface
}

func createMethod(field *ast.Field, reservedNames []string, file File) Method {
	name := field.Names[0].Name
	names := append([]string{}, reservedNames...)
	names = append(names, name)
	fun, ok := field.Type.(*ast.FuncType)
	if !ok {
		return Method{
			name: name,
		}
	}

	m := Method{
		name:    name,
		params:  make([]Param, 0, fun.Params.NumFields()),
		results: make([]Param, 0, fun.Results.NumFields()),
	}

	if fun.Params != nil {
		for _, f := range fun.Params.List {
			param := createParam(f, names, "input", file)
			paramNames := param.names

			if param.typ.String() == "context.Context" {
				m.hasContextParam = true
				m.contextParamName = paramNames[0]
			}

			for _, imp := range file.pkg.imports {
				if strings.HasPrefix(param.typ.String(), fmt.Sprintf("%s.", imp.name)) {
					imp.isParam = true
				}
			}

			m.params = append(m.params, param)
			names = append(names, paramNames...)
		}
	}

	if fun.Results != nil {
		numResult := 0
		for _, f := range fun.Results.List {
			param := createParam(f, names, "output", file)
			paramNames := param.names

			if param.typ.String() == "error" {
				m.hasErrResult = true
				m.errorResultName = "err"
				if len(paramNames) > 0 {
					m.errorResultName = paramNames[0]
				}
			}

			for _, imp := range file.pkg.imports {
				if strings.HasPrefix(param.typ.String(), fmt.Sprintf("%s.", imp.name)) {
					imp.isParam = true
				}
			}

			if len(paramNames) > 0 {
				numResult += len(paramNames)
			} else {
				numResult++
			}

			m.results = append(m.results, param)
			names = append(names, paramNames...)
		}

		m.moreThanOneResult = numResult > 1
	}

	return m
}

func (m Method) usedNames() []string {
	var result []string
	result = append(result, m.name)
	for _, p := range m.params {
		result = append(result, p.names...)
	}

	for _, r := range m.results {
		result = append(result, r.names...)
	}
	return result
}

func (m Method) InterfaceMethodSpec() string {
	params := make([]string, 0, len(m.params))
	results := make([]string, 0, len(m.results))
	resultNameCount := 0

	for _, p := range m.params {
		params = append(params, p.ParamSpec())
	}

	for _, r := range m.results {
		results = append(results, r.ParamSpec())
		resultNameCount += len(r.names)
	}

	if len(m.results) > 1 || resultNameCount > 0 {
		return fmt.Sprintf("%s(%s) (%s)", m.name, strings.Join(params, ", "), strings.Join(results, ", "))
	}
	return fmt.Sprintf("%s(%s) %s", m.name, strings.Join(params, ", "), strings.Join(results, ", "))
}

func (m Method) methodArguments() string {
	var result []string
	for _, p := range m.params {
		result = append(result, p.ParamSpec())
	}

	return strings.Join(result, ", ")
}

func (m Method) methodArgumentNames() string {
	var result []string
	for _, p := range m.params {
		result = append(result, p.names...)
	}

	return strings.Join(result, ", ")
}

func (m Method) methodResults() string {
	var result []string
	for _, p := range m.results {
		result = append(result, p.ParamSpec())
	}

	return strings.Join(result, ", ")
}

func (m Method) methodResultNames() string {
	var result []string
	for _, p := range m.results {
		result = append(result, p.names...)
	}

	return strings.Join(result, ", ")
}


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

	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

	<!-- Enables the Spring MVC @Controller programming model -->
	<annotation-driven />

	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
	<resources mapping="/resources/**" location="/resources/" />

	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="suffix" value=".jsp" />
	</beans:bean>

	<context:component-scan base-package="com.hhb.hello" />

</beans:beans>


text:
package com.qf.tgp.plamtv.http;

import com.google.gson.Gson;

import org.xutils.http.app.ResponseParser;
import org.xutils.http.request.UriRequest;

import java.lang.reflect.Type;

/**
 * Created by Administrator on 2016/9/20.
 */
public class JsonParser implements ResponseParser {
    @Override
    public void checkResponse(UriRequest request) throws Throwable {

    }

    @Override
    public Object parse(Type resultType, Class<?> resultClass, String result) throws Throwable {
        return new Gson().fromJson(result, resultClass);
    }
}


text:
<?php

class Users extends CI_Controller {

    public function register() {

        $this->form_validation->set_message('in_list', '"Registration key" is incorrect.');

        $this->form_validation->set_rules('first_name', '"First Name"', 'trim|required|min_length[3]|max_length[45]');
        $this->form_validation->set_rules('last_name', '"Last Name"', 'trim|required|min_length[2]|max_length[45]');
        $this->form_validation->set_rules('email', '"Email"', 'trim|required|valid_email|max_length[45]');
        $this->form_validation->set_rules('username', '"Username"', 'trim|required|min_length[3]|max_length[30]');
        $this->form_validation->set_rules('password', '"Password"', 'trim|required|min_length[2]|max_length[255]');
        $this->form_validation->set_rules('confirm_password', '"Confirm Password"', 'trim|required|matches[password]');
        $this->form_validation->set_rules('registration_key', '"Registration key"', 'trim|required|in_list[secret_key]');

        if ($this->form_validation->run() == FALSE) {

            $data['main_view'] = 'users/register_view';
            $this->load->view('layouts/registration', $data);

        } else {

            if ($this->user_model->create_user()) {

                $this->session->set_flashdata('user_registered','User succesfully registered. Continue by logging in.');
                redirect('home/index');
            }
        }
    }

    public function login() {

        $this->form_validation->set_rules('username', '"Username"', 'trim|required|min_length[3]');
        $this->form_validation->set_rules('password', '"Password"', 'trim|required|min_length[2]');

        if ($this->form_validation->run() == FALSE) {

            $data = array(
                'errors' => validation_errors()
            );
            $this->session->set_flashdata($data);
            redirect('home');

        } else {

            $username = $this->input->post('username');
            $password = $this->input->post('password');
            $users_ID = $this->user_model->login_user($username, $password);

            if ($users_ID) {

                $user_data = array(
                    'user_ID' => $users_ID,
                    'username' => $username,
                    'logged_in' => true
                );
                $this->session->set_userdata($user_data);
                $this->session->set_flashdata('login_success','Succesfully logged in as '.$username.'.');
                $data['main_view'] = "home_view";
                $this->load->view('layouts/main', $data);

            } else {

                $this->session->set_flashdata('login_failed','Incorrect Username or Password. Please try again.');
                redirect('home/index');
            }
        }
    }

    public function logout() {

        $this->session->sess_destroy();
        redirect('home/index');
    }

}

?>


text:
require 'json'
require 'zip'
require 'fileutils'
require 'tmpdir'
require './lib/db'

class SlackImport
  def import_messages(channel, messages)
    messages.each do |m|
      m['channel'] = channel[:id]
      insert_message(m)
    end
  end

  def import_channels(channels)
    replace_channels(channels)
  end

  def import_users(users)
    replace_users(users)
  end

  # format of exported file
  #
  # exported.zip
  #
  # - channels.json
  # - users.json
  # - channel/
  #     - 2015-01-01.json
  def import_from_file(exported_file)
    dist = Dir.mktmpdir
    begin
      Zip::File.open(exported_file) do |zip|
        zip.each do |entry|
          entry.extract(dist + '/' + entry.to_s)
        end
        open(dist + '/channels.json') do |io|
          import_channels(JSON.load(io))
        end
        open(dist + '/users.json') do |io|
          import_users(JSON.load(io))
        end
        zip.each do |entry|
          # channel/2015-01-01.json
          file_name = entry.name.clone.force_encoding('UTF-8')
          if !File.directory?(dist + '/' + file_name) and file_name.split('/').size > 1
            puts "import #{file_name}"
            channel = Channels.find(name: file_name.split('/')[0]).to_a[0]
            messages = JSON.load(entry.get_input_stream)
            import_messages(channel, messages)
          end
        end
      end
    ensure
      FileUtils.rm_r(dist)
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
atg.commerce.order.edit.processor (ATG Java API)
</TITLE>

<META NAME="date" CONTENT="2013-04-01">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package atg.commerce.order.edit.processor

Class Summary

ProcApplyChanges
This processor triggers the process of applying the updates made
 to the clone order to the original order.

ProcAuthorizePaymentGroups
Applies the payment group authorization updates for any payment
 groups added, updated or removed during the Order
 modification.

ProcCloneOrderForEdit
This process creates the clone order from the original order.

ProcInitializeCloneEditState
This processor creates the CloneEditState object using the original and cloned
 order and adds it to the parameter map.

ProcInitializeReconciliation
The process initializes the reconciliation process

ProcReconcileGiftlistRepository
Deprecated. this processor has been changed to a noop.

ProcSendFulfillmentNotifications
Sends the fulfillment notifications for changes made to the order.

ProcValidateCloneOrder
This processor validates the clone order after the cloning process.

      Overview
    Package
      Class
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes


text:
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
from bangoo import __version__ as version

# TODO: django-havd==0.5.2 is not compatible with django>=1.7.7
install_requires = [
    "django==1.7.7",
    "requests",
    "django-taggit",
    "easy-thumbnails",
    "django-hvad==0.5.2",
    "django-jsonfield==0.9.13",
    "django-mptt==0.6.1",
    "django-crispy-forms",
    #"angular",
    #"django-restify",
]

standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', 'project_template', 'examplesite',
                                './dist', 'EGG-INFO', '*.egg-info')
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# Note: you may want to copy this into your setup.py file verbatim, as
# you can't import this from another package, when you don't know if
# that package is installed yet.
def find_package_data(
    where = '.', package = '',
    exclude = standard_exclude,
    exclude_directories = standard_exclude_directories,
    only_in_packages = False,
    show_ignored = False):
    """
    Return a dictionary suitable for use in ``package_data``
    in a distutils ``setup.py`` file.

    The dictionary looks like::

        {'package': [files]}

    Where ``files`` is a list of all the files in that package that
    don't match anything in ``exclude``.

    If ``only_in_packages`` is true, then top-level directories that
    are not packages won't be included (but directories under packages
    will).

    Directories matching any pattern in ``exclude_directories`` will
    be ignored; by default directories with leading ``.``, ``CVS``,
    and ``_darcs`` will be ignored.

    If ``show_ignored`` is true, then all the files that aren't
    included in package data are shown on stderr (for debugging
    purposes).

    Note patterns use wildcards, or can be exact paths (including
    leading ``./``), and all searching is case-insensitive.
    """

    out = {}
    stack = [(convert_path(where), '', package, only_in_packages)]
    while stack:
        where, prefix, package, only_in_packages = stack.pop(0)
        for name in os.listdir(where):
            fn = os.path.join(where, name)
            if os.path.isdir(fn):
                bad_name = False
                for pattern in exclude_directories:
                    if (fnmatchcase(name, pattern)
                        or fn.lower() == pattern.lower()):
                        bad_name = True
                        if show_ignored:
                            print >> sys.stderr, (
                                "Directory %s ignored by pattern %s"
                                % (fn, pattern))
                        break
                if bad_name:
                    continue
                if (os.path.isfile(os.path.join(fn, '__init__.py'))
                    and not prefix):
                    if not package:
                        new_package = name
                    else:
                        new_package = package + '.' + name
                    stack.append((fn, '', new_package, False))
                else:
                    stack.append((fn, prefix + name + '/', package, only_in_packages))
            elif package or not only_in_packages:
                # is a file
                bad_name = False
                for pattern in exclude:
                    if (fnmatchcase(name, pattern)
                        or fn.lower() == pattern.lower()):
                        bad_name = True
                        if show_ignored:
                            print >> sys.stderr, (
                                "File %s ignored by pattern %s"
                                % (fn, pattern))
                        break
                if bad_name:
                    continue
                out.setdefault(package, []).append(prefix + name)
    return out

setup(
    name="bangoo",
    namespace_packages=['bangoo'],
    version=version,
    author="Bence Lovas",
    author_email="bence.lovas@codehouse.hu",
    description="An open source content management system on the top of Django framework",
    long_description=open("README.md", 'rb').read().decode('utf-8'),
    license="MIT",
    url="http://bangoocms.com/",
    zip_safe=False,
    include_package_data=True,
    packages=find_packages(),
    package_data = find_package_data("bangoo", only_in_packages=False),
    install_requires=install_requires,
    entry_points={
        'console_scripts': [
            'start-bangoo-site=bangoo.bin.startsite:create_site'
        ]
    },
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Web Environment",
        "Framework :: Django",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        #"Programming Language :: Python :: 2.6",
        "Programming Language :: Python :: 2.7",
        #"Programming Language :: Python :: 3",
        #"Programming Language :: Python :: 3.3",
        "Topic :: Internet :: WWW/HTTP",
        "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
        "Topic :: Internet :: WWW/HTTP :: WSGI",
        "Topic :: Internet :: WWW/HTTP :: CMS",
        "Topic :: Software Development :: Libraries :: "
                                            "Application Frameworks",
        "Topic :: Software Development :: Libraries :: Python Modules",
    ])

#### sudo apt-get install libjpeg-dev


text:
class CssClasses < Array
  def initialize(*classes)
    self << classes
  end

  def <<(classes)
    if classes.is_a?(String)
      classes.split(" ").each { |c| super(c) }
    elsif classes.is_a?(Array)
      classes.flatten.compact.each { |c| self << c }
    elsif classes.is_a?(Symbol)
      self << classes.to_s
    end
  end

  def to_s
    to_a.join(" ").presence
  end
end