text:
<?php

namespace TomPHP\PatchBuilder;

use TomPHP\PatchBuilder\Buffer\EditableLineBuffer;
use TomPHP\PatchBuilder\Buffer\LineBuffer;
use TomPHP\PatchBuilder\Types\LineRangeInterface;
use TomPHP\PatchBuilder\LineTracker\LineTracker;
use TomPHP\PatchBuilder\Types\OriginalLineNumber;
use TomPHP\PatchBuilder\Types\LineRange;
use TomPHP\PatchBuilder\Types\LineNumber;

class PatchBuffer
{
    /**
     * @var LineBuffer
     */
    private $original;

    /**
     * @var EditableLineBuffer
     */
    private $modified;

    /**
     * @var LineTracker
     */
    private $lineTracker;

    /**
     * @param string[] $contents
     *
     * @return PatchBuffer
     */
    public static function createWithContents(array $contents)
    {
        return new self(
            new LineBuffer($contents),
            new EditableLineBuffer($contents),
            new LineTracker()
        );
    }

    public function __construct(
        LineBuffer $original,
        EditableLineBuffer $modified,
        LineTracker $lineTracker
    ) {
        // @todo Verify contents matches

        $this->original    = $original;
        $this->modified    = $modified;
        $this->lineTracker = $lineTracker;
    }

    /**
     * @return string[]
     */
    public function getOriginalContents()
    {
        return $this->original->getContents();
    }

    /**
     * @return string[]
     */
    public function getModifiedContents()
    {
        return $this->modified->getContents();
    }

    /**
     * @param string[] $lines
     */
    public function replace(LineRangeInterface $range, array $lines)
    {
        if (empty($lines)) {
            return $this->delete($range);
        }

        $range = $this->convertIfContainsOriginalLineNumbers($range);

        $this->modified->replace($range, $lines);

        $this->lineTracker->deleteLines($range);
        $this->lineTracker->addLines($this->calculateInsertRange($range->getStart(), $lines));
    }

    /**
     * @param string[] $lines
     */
    public function insert(LineNumber $lineNumber, array $lines)
    {
        if (empty($lines)) {
            return;
        }

        $lineNumber = $this->convertIfIsOriginalLineNumber($lineNumber);

        $this->insertAtLineNumber($lineNumber, $lines);
    }

    /**
     * @param string[] $lines
     */
    public function append(LineNumber $lineNumber, array $lines)
    {
        if (empty($lines)) {
            return;
        }

        $lineNumber = $this->convertIfIsOriginalLineNumber($lineNumber);

        $lineNumber = new LineNumber($lineNumber->getNumber() + 1);

        $this->insertAtLineNumber($lineNumber, $lines);
    }

    public function delete(LineRangeInterface $range)
    {
        $range = $this->convertIfContainsOriginalLineNumbers($range);

        $this->modified->delete($range);

        $this->lineTracker->deleteLines($range);
    }

    /**
     * @return string
     */
    public function getLine($lineNumber)
    {
        $lineNumber = $this->convertIfIsOriginalLineNumber($lineNumber);

        $lines = $this->modified->getLines(LineRange::createSingleLine($lineNumber->getNumber()));

        return reset($lines);
    }

    /**
     * @return boolean
     */
    public function isModified()
    {
        return $this->original->getContents() !== $this->modified->getContents();
    }

    private function insertAtLineNumber(LineNumber $lineNumber, array $lines)
    {
        $this->modified->insert($lineNumber, $lines);

        $this->lineTracker->addLines($this->calculateInsertRange($lineNumber, $lines));
    }

    /**
     * @return LineNumber
     */
    private function convertIfIsOriginalLineNumber(LineNumber $lineNumber)
    {
        if ($lineNumber instanceof OriginalLineNumber) {
            $lineNumber = $this->lineTracker->trackLine($lineNumber);
        }

        return $lineNumber;
    }

    /**
     * @return LineRangeInterface
     */
    private function convertIfContainsOriginalLineNumbers(LineRangeInterface $range)
    {
        if ($range->getStart() instanceof OriginalLineNumber) {
            $range = $this->trackRange($range);
        }

        // @todo Throw if start and end types mismatch

        return $range;
    }

    /**
     * @return LineRange
     */
    private function trackRange(LineRangeInterface $range)
    {
        $range = new LineRange(
            $this->lineTracker->trackLine($range->getStart()),
            $this->lineTracker->trackLine($range->getEnd())
        );

        return $range;
    }

    private function calculateInsertRange(LineNumber $lineNumber, array $lines)
    {
        $start = $lineNumber->getNumber();
        $end   = $start + count($lines) - 1;

        return LineRange::createFromNumbers($start, $end);
    }
}


text:
using UnityEngine;

public class NetworkCharacter : Photon.MonoBehaviour
{
    private Vector3 correctPlayerPos = Vector3.zero; // We lerp towards this
    private Quaternion correctPlayerRot = Quaternion.identity; // We lerp towards this
    // Update is called once per frame
    void Update()
    {
        if (!photonView.isMine)
        {
            transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5);
            transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5);
        }
    }

    void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting)
        {
            // We own this player: send the others our data
            stream.SendNext(transform.position);
            stream.SendNext(transform.rotation);

            myThirdPersonController myC = GetComponent<myThirdPersonController>();
            stream.SendNext((int)myC._characterState);
        }
        else
        {
            // Network player, receive data
            this.correctPlayerPos = (Vector3)stream.ReceiveNext();
            this.correctPlayerRot = (Quaternion)stream.ReceiveNext();

            myThirdPersonController myC = GetComponent<myThirdPersonController>();
            myC._characterState = (CharacterState)stream.ReceiveNext();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
$props = parse_ini_file("properties.ini");

$consumer_key = $props['consumer_key'];
$consumer_secret = $props['consumer_secret'];

$dbServer = $props['server'];
$dbName = $props['dbname'];
$dbTable = $props['tableName'];
$user = $props['username'];
$password = $props['password'];

$homeUrl = $props['url'];
$adminEmail = $props['adminEmail'];
?>


text:
var connect = require('connect')

module.exports = function(opt) {
  var key = opt.key || 'connect.sid'
    , store = opt.store
    , keepAlive = opt.keepAlive || true
    , interval = opt.interval || 120000

  return function(client, conn) {
    var self = this
      , iid
      , sid
      , cookies

    conn.on('ready', function() {

      if (!conn.stream.socketio) return

      var id = conn.stream.socketio.id
        , request = conn.stream.socketio.manager.handshaken[id]
        , sess

      if (!request.headers.cookie) return

      cookies = connect.utils.parseCookie(request.headers.cookie)
      sid = cookies[key]
      conn.emit('session')

      store.load(sid, function(err, obj) {
        if (!err) sess = obj
      })

      if (keepAlive) {
        iid = setInterval(function() {
          if (!sess) return
          sess.reload(function() { sess.touch().save() })
        }, interval)
      }

    })

    conn.on('end', function() {
      iid && clearInterval(iid)
    })

    this.session = function(fn) {
      if ('function' !== typeof fn) return
      store.load(sid, fn)
    }

    this.cookies = function(fn) {
      if ('function' !== typeof fn) return
      fn(cookies)
    }
  }
}


text:
'use strict';

var React = require('react-native');

var {
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
  TouchableOpacity,
} = React;

var NavButton = React.createClass({

  onPress: function() {
    this.props.onPress();
  },

  render() {
    var backButton;

    if (this.props.backButtonComponent) {
      var BackButton = this.props.backButtonComponent;
      backButton = <View><BackButton /></View>
    } else {
      backButton = <Text style={styles.navbarText}>Back</Text>
    }

    var button = (this.props.useTouchableOpacity) ? (
      <TouchableOpacity onPress={this.onPress}>
        {backButton}
      </TouchableOpacity>
    ) : (
      <TouchableHighlight onPress={this.onPress} underlayColor="transparent">
        {backButton}
      </TouchableHighlight>
    );

    return button;
  }
});

var styles = StyleSheet.create({
  navbarText: {
    color: 'white',
    fontSize: 16,
    margin: 10,
    fontWeight: '600',
    textAlign: 'center',
    alignItems: 'center',
  }
});

module.exports = NavButton;


text:
describe("Time parsing: 11:00AM", function() {

	it("11:00", function() {
		el = "11:00".parseEvent();

		expect(el.startDate.toTimeString())
			.toEqual(moment().hours(11).minutes(0).seconds(0).toDate().toTimeString());
	});

	it("1:00", function() {
		el = "1:00".parseEvent();

		expect(el.startDate.toTimeString())
			.toEqual(moment().hours(1).minutes(0).seconds(0).toDate().toTimeString());
	});

	it("11:00am", function() {
		el = "11:00am".parseEvent();

		expect(el.startDate.toTimeString())
			.toEqual(moment().hours(11).minutes(0).seconds(0).toDate().toTimeString());
	});

	it("11:00 AM", function() {
		el = "11:00 AM".parseEvent();

		expect(el.startDate.toTimeString())
			.toEqual(moment().hours(11).minutes(0).seconds(0).toDate().toTimeString());
	});

	it("11:00 pm", function() {
		el = "11:00 pm".parseEvent();

		expect(el.startDate.toTimeString())
			.toEqual(moment().hours(23).minutes(0).seconds(0).toDate().toTimeString());
	});

	it("22:00 pm", function() {
		el = "22:00 pm".parseEvent();

		expect(el.startDate).toBeUndefined();
	});

	it("25:00", function() {
		el = "25:00".parseEvent();

		expect(el.startDate).toBeUndefined();
	});

});


text:
package org.spongepowered.common.mixin.core.network.play.client;

import net.minecraft.network.play.client.CPacketResourcePackStatus;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(CPacketResourcePackStatus.class)
public interface CPacketResourcePackStatusAccessor {

    @Accessor("action") CPacketResourcePackStatus.Action accessor$getAction();

}


text:
import * as React from "react";
import { ToggleButton } from "../../controls/toggle_button";
import { SpacePanelToolTip } from "./space_panel_tool_tip";
import { settingToggle } from "../actions";
import { Row, Col } from "../../ui/index";
import { BooleanMCUInputGroupProps } from "./interfaces";

export function BooleanMCUInputGroup(props: BooleanMCUInputGroupProps) {

  const {
    tooltip,
    name,
    x,
    y,
    z,
    disable,
    grayscale,
    caution,
    displayAlert,
    sourceFwConfig,
    dispatch,
  } = props;

  const xParam = sourceFwConfig(x);
  const yParam = sourceFwConfig(y);
  const zParam = sourceFwConfig(z);

  return <Row>
    <Col xs={6}>
      <label>
        {name}
        {caution &&
          <i className="fa fa-exclamation-triangle caution-icon" />}
      </label>
      <SpacePanelToolTip tooltip={tooltip} />
    </Col>
    <Col xs={2} className={"centered-button-div"}>
      <ToggleButton
        grayscale={grayscale && grayscale.x}
        disabled={disable && disable.x}
        dim={!xParam.consistent}
        toggleValue={xParam.value}
        toggleAction={() =>
          dispatch(settingToggle(x, sourceFwConfig, displayAlert))} />
    </Col>
    <Col xs={2} className={"centered-button-div"}>
      <ToggleButton
        grayscale={grayscale && grayscale.y}
        disabled={disable && disable.y}
        dim={!yParam.consistent}
        toggleValue={yParam.value}
        toggleAction={() =>
          dispatch(settingToggle(y, sourceFwConfig, displayAlert))} />
    </Col>
    <Col xs={2} className={"centered-button-div"}>
      <ToggleButton
        grayscale={grayscale && grayscale.z}
        disabled={disable && disable.z}
        dim={!zParam.consistent}
        toggleValue={zParam.value}
        toggleAction={() =>
          dispatch(settingToggle(z, sourceFwConfig, displayAlert))} />
    </Col>
  </Row>;
}


text:
require_relative File.join("..", "support", "fixtures_helper")
require_relative "../spec_helper"

describe ReactOnRails::TestHelper::WebpackAssetsStatusChecker do
  describe "#stale_generated_webpack_files" do
    let(:source_path) { source_path_for(fixture_dirname) }
    let(:generated_assets_full_path) do
      compiled_js_dir_for(fixture_dirname)
    end
    let(:webpack_generated_files) { %w[manifest.json] }
    let(:server_bundle_js_file) { File.join(generated_assets_full_path, "server-bundle.js") }
    let(:client_bundle_js_file) { File.join(generated_assets_full_path, "client-bundle.js") }
    let(:checker) do
      described_class
        .new(generated_assets_full_path: generated_assets_full_path,
             source_path: source_path,
             webpack_generated_files: webpack_generated_files)
    end

    before do
      allow(ReactOnRails::WebpackerUtils).to receive(:check_manifest_not_cached).and_return(nil)
      allow(ReactOnRails::Utils).to receive(:generated_assets_full_path).and_return(generated_assets_full_path)
    end

    context "with Webpacker" do
      before do
        allow(ReactOnRails::WebpackerUtils).to receive(:using_webpacker?).and_return(true)
      end

      context "when compiled assets with manifest exist and are up-to-date" do
        let(:fixture_dirname) { "assets_with_manifest_exist" }

        before do
          require "shakapacker"
          allow(ReactOnRails::WebpackerUtils).to receive(:manifest_exists?).and_return(true)
          allow(ReactOnRails::Utils).to receive(:bundle_js_file_path)
            .with("manifest.json")
            .and_return(File.join(generated_assets_full_path, "manifest.json"))
          allow(ReactOnRails::Utils).to receive(:bundle_js_file_path)
            .with("server-bundle.js")
            .and_return(File.join(generated_assets_full_path, "server-bundle.js"))
          touch_files_in_dir(generated_assets_full_path)
        end

        specify { expect(checker.stale_generated_webpack_files).to eq([]) }
      end

      context "when using webpacker and manifest is missing" do
        let(:fixture_dirname) { "assets_with_missing_manifest" }

        before do
          require "shakapacker"
          allow(ReactOnRails::WebpackerUtils).to receive(:manifest_exists?).and_return(false)
        end

        specify { expect(checker.stale_generated_webpack_files).to eq(["manifest.json"]) }
      end

      context "when using webpacker, a missing server bundle without hash, and manifest is current" do
        let(:webpack_generated_files) { %w[manifest.json server-bundle.js] }
        let(:fixture_dirname) { "assets_with_manifest_exist_server_bundle_separate" }

        before do
          require "shakapacker"
          allow(ReactOnRails::WebpackerUtils).to receive(:manifest_exists?).and_return(true)
          allow(ReactOnRails::WebpackerUtils).to receive(:webpacker_public_output_path)
            .and_return(generated_assets_full_path)
          allow(ReactOnRails.configuration).to receive(:server_bundle_js_file).and_return("server-bundle.js")
          allow(ReactOnRails::Utils).to receive(:bundle_js_file_path)
            .with("manifest.json")
            .and_return(File.join(generated_assets_full_path, "manifest.json"))
          allow(ReactOnRails::Utils).to receive(:bundle_js_file_path)
            .with("server-bundle.js")
            .and_raise(Webpacker::Manifest::MissingEntryError)
          touch_files_in_dir(generated_assets_full_path)
        end

        specify do
          expect(checker.stale_generated_webpack_files.first)
            .to match(/server-bundle\.js$/)
        end
      end
    end

    context "without Webpacker" do
      let(:webpack_generated_files) { %w[client-bundle.js server-bundle.js] }

      before do
        allow(ReactOnRails::WebpackerUtils).to receive(:using_webpacker?).and_return(false)
      end

      context "when compiled assets exist and are up-to-date" do
        let(:fixture_dirname) { "assets_exist" }

        before do
          touch_files_in_dir(generated_assets_full_path)
        end

        specify { expect(checker.stale_generated_webpack_files).to eq([]) }
      end

      context "when compiled assets don't exist" do
        let(:fixture_dirname) { "assets_no_exist" }

        specify do
          expect(checker.stale_generated_webpack_files)
            .to eq([client_bundle_js_file, server_bundle_js_file])
        end
      end

      context "when only server-bundle.js exists" do
        let(:fixture_dirname) { "assets_exist_only_server_bundle" }

        before do
          touch_files_in_dir(generated_assets_full_path)
        end

        specify do
          expect(checker.stale_generated_webpack_files)
            .to eq([client_bundle_js_file])
        end
      end

      context "when assets exist but are outdated" do
        let(:fixture_dirname) { "assets_outdated" }

        before { touch_files_in_dir(source_path) }

        specify do
          expect(checker.stale_generated_webpack_files)
            .to eq([client_bundle_js_file, server_bundle_js_file])
        end
      end
    end
  end

  def source_path_for(fixture_dirname)
    FixturesHelper.get_file(%W[webpack_assets #{fixture_dirname} client])
  end

  def compiled_js_dir_for(fixture_dirname)
    FixturesHelper.get_file(%W[webpack_assets #{fixture_dirname} compiled_js])
  end

  # Necessary for ensuring file mtimes of fixtures are correct
  def touch_files_in_dir(dir)
    `touch #{dir}/*`
  end
end


text:
1.1.0 / 2017-01-27
  * es6

0.9.5 / 2015-01-31
  * Merge pull request
    https://github.com/vehicle-history/npm-vehicle-history-provider-web/issues/5 from
    vehicle-history/assertions-moved-out-errors
    Assertions support and moved out errors

0.9.4 / 2015-01-29
  * Merge pull request
    https://github.com/vehicle-history/npm-vehicle-history-provider-web/issues/4 from
    vehicle-history/fixed-example-compare

0.9.3 / 2015-01-29
  * Merge pull request
    https://github.com/vehicle-history/npm-vehicle-history-provider-web/issues/3 from
    vehicle-history/vehicle-not-found-exception

0.9.2 / 2015-01-18
  * Merge pull request
    https://github.com/vehicle-history/npm-vehicle-history-provider-web/issues/2 from
    vehicle-history/changed-model

0.9.1 / 2015-01-16
  * Merge pull request
    https://github.com/vehicle-history/npm-vehicle-history-provider-web/issues/1 from
    vehicle-history/initial-provider

0.9.0 / 2015-01-16
  * Added async flow and changed report response
  * Car parser


text:
Simple webgl wrapper in typescript.

## Samples

Samples are located in the demo/ folder; an AMD compatible compiled
version of the iwc.js library is found in dist/

## Building

Building this library uses grunt.

See http://gruntjs.com/getting-started to get started.

To build use:

    npm install
    grunt

## Development

    npm install
    bower install
    grunt dev

Then open http://localhost:3009


text:
//*********************************************************//
//    Copyright (c) Microsoft. All rights reserved.
//
//    Apache 2.0 License
//
//    You may obtain a copy of the License at
//    http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
//    implied. See the License for the specific language governing
//    permissions and limitations under the License.
//
//*********************************************************//

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Microsoft.NodejsTools.Npm.SPI {
    internal class NodeModules : AbstractNodeModules {
        private Dictionary<string, ModuleInfo> _allModules;
        private readonly string[] _ignoredDirectories = { @"\.bin", @"\.staging" };

        public NodeModules(IRootPackage parent, bool showMissingDevOptionalSubPackages, Dictionary<string, ModuleInfo> allModulesToDepth = null, int depth = 0) {
            var modulesBase = Path.Combine(parent.Path, NodejsConstants.NodeModulesFolder);

            _allModules = allModulesToDepth ?? new Dictionary<string, ModuleInfo>();

            // This is the first time NodeModules is being created.
            // Iterate through directories to add everything that's known to be top-level.
            if (depth == 0) {
                Debug.Assert(_allModules.Count == 0, "Depth is 0, but top-level modules have already been added.");

                IEnumerable<string> topLevelDirectories = Enumerable.Empty<string>();
                try {
                    topLevelDirectories = Directory.EnumerateDirectories(modulesBase);
                } catch (IOException) {
                    // We want to handle DirectoryNotFound, DriveNotFound, PathTooLong
                } catch (UnauthorizedAccessException) {
                }

                // Go through every directory in node_modules, and see if it's required as a top-level dependency
                foreach (var moduleDir in topLevelDirectories) {
                    if (moduleDir.Length < NativeMethods.MAX_FOLDER_PATH && !_ignoredDirectories.Any(toIgnore => moduleDir.EndsWith(toIgnore))) {
                        var packageJson = PackageJsonFactory.Create(new DirectoryPackageJsonSource(moduleDir));

                        if (packageJson != null) {
                            if (packageJson.RequiredBy.Count() > 0) {
                                // All dependencies in npm v3 will have at least one element present in _requiredBy.
                                // _requiredBy dependencies that begin with hash characters represent top-level dependencies
                                foreach (var requiredBy in packageJson.RequiredBy) {
                                    if (requiredBy.StartsWith("#") || requiredBy == "/") {
                                        AddTopLevelModule(parent, showMissingDevOptionalSubPackages, moduleDir, depth);
                                        break;
                                    }
                                }
                            } else {
                                // This dependency is a top-level dependency not added by npm v3
                                AddTopLevelModule(parent, showMissingDevOptionalSubPackages, moduleDir, depth);
                            }
                        }
                    }
                }
            }

            if (modulesBase.Length < NativeMethods.MAX_FOLDER_PATH && parent.HasPackageJson) {
                // Iterate through all dependencies in package.json
                foreach (var dependency in parent.PackageJson.AllDependencies) {
                    var moduleDir = modulesBase;

                    // try to find folder by recursing up tree
                    do {
                        moduleDir = Path.Combine(moduleDir, dependency.Name);
                        if (AddModuleIfNotExists(parent, moduleDir, showMissingDevOptionalSubPackages, depth, dependency)) {
                            break;
                        }

                        var parentNodeModulesIndex = moduleDir.LastIndexOf(NodejsConstants.NodeModulesFolder, Math.Max(0, moduleDir.Length - NodejsConstants.NodeModulesFolder.Length - dependency.Name.Length - 1));
                        moduleDir = moduleDir.Substring(0, parentNodeModulesIndex + NodejsConstants.NodeModulesFolder.Length);
                    } while (moduleDir.Contains(NodejsConstants.NodeModulesFolder));
                }
            }

            _packagesSorted.Sort(new PackageComparer());
        }

        private void AddTopLevelModule(IRootPackage parent, bool showMissingDevOptionalSubPackages, string moduleDir, int depth) {
            Debug.Assert(depth == 0, "Depth should be 0 when adding a top level dependency");
            AddModuleIfNotExists(parent, moduleDir, showMissingDevOptionalSubPackages, depth);
        }

        private bool AddModuleIfNotExists(IRootPackage parent, string moduleDir, bool showMissingDevOptionalSubPackages, int depth, IDependency dependency = null) {
            depth++;

            ModuleInfo moduleInfo;
            _allModules.TryGetValue(moduleDir, out moduleInfo);

            if (moduleInfo != null) {
                if (moduleInfo.Depth > depth) {
                    moduleInfo.Depth = depth;
                }

                if (dependency != null) {
                    var existingPackage = this[dependency.Name] as Package;
                    if (existingPackage != null) {
                        existingPackage.RequestedVersionRange = dependency.VersionRangeText;
                    }
                }
            } else if (Directory.Exists(moduleDir)) {
                moduleInfo = new ModuleInfo(depth);
                _allModules.Add(moduleDir, moduleInfo);
            } else {
                // The module directory wasn't found.
                return false;
            }

            if (moduleInfo.RequiredBy.Contains(parent.Name)) {
                return true;
            }

            moduleInfo.RequiredBy.Add(parent.Name);
            var package = new Package(parent, moduleDir, showMissingDevOptionalSubPackages, _allModules, depth);
            if (dependency != null) {
                package.RequestedVersionRange = dependency.VersionRangeText;
            }
            AddModule(package);

            return true;
        }

        public override int GetDepth(string filepath) {
            var lastNodeModules = filepath.LastIndexOf(NodejsConstants.NodeModulesFolder + "\\");
            var directoryToSearch = filepath.IndexOf("\\", lastNodeModules + NodejsConstants.NodeModulesFolder.Length + 1);
            var directorySubString = directoryToSearch == -1 ? filepath : filepath.Substring(0, directoryToSearch);

            ModuleInfo value = null;
            _allModules.TryGetValue(directorySubString, out value);

            var depth = value != null ? value.Depth : 0;
            Debug.WriteLine("Module Depth: {0} [{1}]", filepath, depth);

            return depth;
        }
    }

    internal class ModuleInfo {
        public int Depth { get; set; }
        public IList<string> RequiredBy { get; set; }

        internal ModuleInfo(int depth) {
            Depth = depth;
            RequiredBy = new List<string>();
        }
    }
}


text:
<?php

require_once("../include/users.php");
require_once("../include/html_functions.php");
require_once("../include/functions.php");

session_start();

$error = False;
if (isset($_POST['firstname']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['againpass']) && isset($_POST['lastname'])
    && $_POST['username'] && $_POST['password'] && $_POST['againpass'] && $_POST['firstname'] && $_POST['lastname'])
{
   if ($_POST['password'] != $_POST['againpass'])
   {
      $flash['error'] = "The passwords do not match. Try again";
      $error = True;
   }
   else if ($new_id = Users::create_user($_POST['username'], $_POST['password'], $_POST['firstname'], $_POST['lastname'], False))
   {
      Users::login_user($new_id);
      http_redirect(Users::$HOME_URL);
   }
   else
   {
      if (mysql_errno() == 1062)
      {
	 $flash['error'] = "Username '{$_POST['username']}' is already in use.";
      }
      $error = True;
   }
}
else
{
   $flash['error'] = "All fields are required";
   $error = True;
}

if ($error)
{
   our_header();
   ?>

 Register for an account!

Protect yourself from hackers and check your password strength

<?php error_message() ?>

  <form action="<?=h( $_SERVER['PHP_SELF'] )?>" method="POST">

Username :	 <input type="text" name="username" />

First Name :	 <input type="text" name="firstname" />

Last Name :	 <input type="text" name="lastname" />

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

Password again :	 <input type="password" name="againpass" />

<input type="submit" value="Create Account!" />

</form>

<?php
     our_footer();
}

?>


text:
import os
import unittest
import tempfile
import hashlib
from datetime import datetime
from random import choice as r_choice
from string import ascii_uppercase as au

from werkzeug.datastructures import FileStorage

import beerlog
from settings import DATE_FORMAT
from blog.models import get_slug_from_title, Entry
from admin.models import Users

class BeerlogTestCase(unittest.TestCase):

    post_date = "2011-01-01"
    post_time = "11:45"
    post_body = "This is a test of the posting function"
    post_title = "This is a !test!@post!!!"
    post_tags = "test, tags"

    def setUp(self):
        self.db_fd, beerlog.app.config['DB_NAME'] = tempfile.mkstemp()
        beerlog.app.config['TESTING'] = True
        beerlog.app.config['CSRF_ENABLED'] = False
        self.app = beerlog.app.test_client()
        beerlog.connect_db(beerlog.app.config)
        beerlog.init_db(beerlog.app.config)

    def tearDown(self):
        os.unlink(beerlog.app.config['DB_NAME'])

    def login(self, username, password):
        return self.app.post('/login', data=dict(
            email=username,
            password=password
        ), follow_redirects=True)

    def logout(self):
        return self.app.get('/logout', follow_redirects=True)

    def create_post(self, title, body, date, time, tags, redirect=True, pid=0):
        if pid:
            url = '/entry/edit/%s/' % pid
        else:
            url = '/entry/edit/'
        return self.app.post(url,
                             data=dict(title=title,
                                       body=body,
                                       date=date,
                                       time=time,
                                       tags=tags,
                                       post_id=pid),
                             follow_redirects=redirect)

    def create_image(self, filepath, follow=True):
        fh = open(filepath, 'rb')
        return self.app.post('/image/add/', data=dict(
            file=FileStorage(fh, filepath)
        ))

    def good_login(self):
        rv = self.login(beerlog.app.config['ADMIN_USERNAME'],
                        beerlog.app.config['ADMIN_PASSWORD'])
        assert "You were logged in" in rv.data

    def test_admin_created(self):
        username = beerlog.app.config['ADMIN_USERNAME']
        user = Users.select(Users.q.email==username)[0]
        assert user.email == beerlog.app.config['ADMIN_USERNAME']

    def test_empty_db(self):
        rv = self.app.get('/')
        assert "No entries matched your request" in rv.data

    def test_login_logout(self):
        self.good_login()
        rv = self.logout()
        assert "You were logged out" in rv.data
        rv = self.login('adminx', 'admin')
        assert "Invalid e-mail address" in rv.data
        rv = self.login('admin@admin.com', 'adminx')
        assert "Invalid username/password" in rv.data
        # try to fake out the form by providing a user_id
        rv = self.app.post('/login', data=dict(
            email=beerlog.app.config['ADMIN_USERNAME'],
            password=beerlog.app.config['ADMIN_PASSWORD'],
            user_id=1), follow_redirects=True)
        assert "Invalid username/password" in rv.data

    def test_post_authenticated(self):
        self.good_login()
        rv = self.create_post(self.post_title,
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        assert self.post_title in rv.data

    def test_slug_generation(self):
         self.good_login()
         rv = self.create_post(self.post_title,
                               self.post_body,
                               self.post_date,
                               self.post_time,
                               self.post_tags)
         assert self.post_title in rv.data
         date = datetime.strptime(self.post_date, DATE_FORMAT)
         slug = get_slug_from_title(self.post_title)
         url = "/entry/%s/%s/%s/%s/" % (date.year,
                                        date.month,
                                        date.day,
                                        slug)
         rv = self.app.get(url)
         assert self.post_title in rv.data

    def test_post_unauthenticated(self):
         rv = self.logout()
         assert "You were logged out" in rv.data
         rv = self.create_post(self.post_title,
                               self.post_body,
                               self.post_date,
                               self.post_time,
                               self.post_tags)
         assert "must be authenticated" in rv.data

    def test_post_delete_authenticated(self):
        self.good_login()
        rv = self.create_post(self.post_title,
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        rv = self.app.get('/entry/edit/1/delete/',
                          follow_redirects=True)
        assert "marked as deleted" in rv.data

    def test_post_delete_unauthenticated(self):
        self.good_login()
        rv = self.create_post(self.post_title,
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags,
                              False)
        rv = self.logout()
        assert "You were logged out" in rv.data
        rv = self.app.get('/entry/edit/1/delete/',
                          follow_redirects=True)
        assert "must be authenticated" in rv.data

    def test_multiple_posts_per_day(self):
        self.good_login()
        post_title2 = "post two"
        test_date = datetime.strptime(self.post_date, DATE_FORMAT)
        self.create_post(self.post_title,
                         self.post_body,
                         self.post_date,
                         self.post_time,
                         self.post_tags)
        self.create_post(post_title2,
                         self.post_body,
                         self.post_date,
                         self.post_time,
                         self.post_tags)
        rv = self.app.get('/entry/%s/%s/%s/' % (test_date.year,
                                                test_date.month,
                                                test_date.day))
        assert self.post_title in rv.data
        assert post_title2 in rv.data

    def test_bad_posts(self):
        self.good_login()
        # missing title
        rv = self.create_post("",
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        assert "You must provide a title" in rv.data
        # missing body
        rv = self.create_post(self.post_title,
                              "",
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        assert "The body is required" in rv.data
        # too short body
        rv = self.create_post(self.post_title,
                              "ta",
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        assert "The body is required" in rv.data
        # too long body
        rv = self.create_post(self.post_title,
                              ''.join(r_choice(au) for x in range(1048577)),
                              self.post_date,
                              self.post_time,
                              self.post_tags)
        assert "The body is required" in rv.data
        # malformed date
        rv = self.create_post(self.post_title,
                              self.post_body,
                              "AHAHAHHAHA",
                              self.post_time,
                              self.post_tags)
        assert "Invalid date/time input" in rv.data
        # malformed time
        rv = self.create_post(self.post_title,
                              self.post_body,
                              self.post_date,
                              "HAHAHAAHAH",
                              self.post_tags)
        assert "Invalid date/time input" in rv.data

    def test_post_edit(self):
        self.good_login()
        rv = self.create_post(self.post_title,
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags,
                              redirect=False,
                              pid=0)

        rv = self.create_post("i am an edited post",
                              self.post_body,
                              self.post_date,
                              self.post_time,
                              self.post_tags,
                              redirect=True,
                              pid=1)
        assert "i am an edited post" in rv.data

if __name__ == '__main__':
    unittest.main()


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Docums Mycol. 18(no. 69): 37 (1987)

#### Original name
Gomphidius viscidus var. tatrensis Pilát, 1926

### Remarks
null


text:
package org.valkyriercp.application.support;

import org.valkyriercp.application.PageComponent;
import org.valkyriercp.application.PageComponentListener;

public class PageComponentListenerAdapter implements PageComponentListener {
    private PageComponent activeComponent;

    public PageComponent getActiveComponent() {
        return activeComponent;
    }

    public void componentOpened(PageComponent component) {

    }

    public void componentFocusGained(PageComponent component) {
        this.activeComponent = component;
    }

    public void componentFocusLost(PageComponent component) {
        this.activeComponent = null;
    }

    public void componentClosed(PageComponent component) {

    }

}


text:
package com.ly.hi.im.view;

import com.ly.hi.R;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * ×óÓÒ»¬¶¯tabͼ±êºÍÎÄ×Ö½¥±äview
 */
public class TabShadeView extends FrameLayout {
    private final String TAG = TabShadeView.class.getSimpleName();

    private ImageView mImageView;
    private TextView mTextView;

    private Drawable normalDrawableSrc;
    private Drawable selectDrawableSrc;
    private int normalTextColor = 0xff999999;
    private int selectTextColor = 0xff45C01A;
    private String text = "TAB";
    private int textSize = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_SP, 10, getResources().getDisplayMetrics());

    /* ͸Ã÷¶È 0.0-1.0*/
    private float mAlpha = 1f;

    private static final String INSTANCE_STATE = "instance_state";
    private static final String STATE_ALPHA = "state_alpha";

    public TabShadeView(Context context) {
        super(context);
    }

    public TabShadeView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.layout_tab_shade, this);
        mImageView = (ImageView) findViewById(R.id.imageView);
        mTextView = (TextView) findViewById(R.id.textView);

        TypedArray typedArray = context.obtainStyledAttributes(attrs,
                R.styleable.TabShadeView);
        int indexCount = typedArray.getIndexCount();
        for (int i = 0; i < indexCount; i++) {
            int attr = typedArray.getIndex(i);
            switch (attr) {
                case R.styleable.TabShadeView_normalDrawableSrc:
                    normalDrawableSrc = typedArray.getDrawable(attr);
                    break;
                case R.styleable.TabShadeView_selectDrawableSrc:
                    selectDrawableSrc = typedArray.getDrawable(attr);
                    break;
                case R.styleable.TabShadeView_normalTextColor:
                    normalTextColor = typedArray.getColor(attr, 0xff999999);
                    break;
                case R.styleable.TabShadeView_selectTextColor:
                    selectTextColor = typedArray.getColor(attr, 0xff45C01A);
                    break;
                case R.styleable.TabShadeView_text:
                    text = typedArray.getString(attr);
                    break;
                case R.styleable.TabShadeView_textSize:
                    textSize = (int) typedArray.getDimension(attr, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10, getResources().getDisplayMetrics()));
                    break;
            }
        }
        setImageView(0);
        mTextView.setText(text);
//        Log.d(TAG, "textSize=" + textSize);
//        mTextView.setTextSize(textSize);
        setTextView(0);
        typedArray.recycle();
    }

    public void setImageView(float alpha) {
        if (mImageView != null) {
            mImageView.setBackgroundDrawable(normalDrawableSrc);
            mImageView.setImageDrawable(selectDrawableSrc);
            int a = (int) Math.ceil((255 * alpha));
            mImageView.getBackground().setAlpha(255 - a);
            mImageView.setAlpha(a);
        }

    }

    public void setTextView(float alpha) {
        if (mTextView != null) {
            String nTextColor = Integer.toHexString(normalTextColor);
            int R1 = 0, G1 = 0, B1 = 0;
            if (!TextUtils.isEmpty(nTextColor) && nTextColor.length() >= 6) {
                R1 = (int) (Integer.parseInt(nTextColor.substring(nTextColor.length() - 6, nTextColor.length() - 4), 16) * (1 - alpha));
                G1 = (int) (Integer.parseInt(nTextColor.substring(nTextColor.length() - 4, nTextColor.length() - 2), 16) * (1 - alpha));
                B1 = (int) (Integer.parseInt(nTextColor.substring(nTextColor.length() - 2, nTextColor.length()), 16) * (1 - alpha));
            }
            String sTextColor = Integer.toHexString(selectTextColor);
            int R2 = 0, G2 = 0, B2 = 0;
            if (!TextUtils.isEmpty(sTextColor) && sTextColor.length() >= 6) {
                R2 = (int) (Integer.parseInt(sTextColor.substring(sTextColor.length() - 6, sTextColor.length() - 4), 16) * alpha);
                G2 = (int) (Integer.parseInt(sTextColor.substring(sTextColor.length() - 4, sTextColor.length() - 2), 16) * alpha);
                B2 = (int) (Integer.parseInt(sTextColor.substring(sTextColor.length() - 2, sTextColor.length()), 16) * alpha);
            }
            int R3, G3, B3;
            R3 = R1 + R2;
            G3 = G1 + G2;
            B3 = B1 + B2;
            String R, G, B;
            if (R3 < 16) {
                R = "0" + Integer.toHexString(R3);
            } else {
                R = Integer.toHexString(R3);
            }
            if (G3 < 16) {
                G = "0" + Integer.toHexString(G3);
            } else {
                G = Integer.toHexString(G3);
            }
            if (B3 < 16) {
                B = "0" + Integer.toHexString(B3);
            } else {
                B = Integer.toHexString(B3);
            }
            String rgb = "#" + R + G + B;
//            Log.d(TAG, rgb);
            mTextView.setTextColor(Color.parseColor(rgb));
        }
    }

    @Override
    protected Parcelable onSaveInstanceState() {
        Bundle bundle = new Bundle();
        bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
        bundle.putFloat(STATE_ALPHA, mAlpha);
        return bundle;
    }

    @Override
    protected void onRestoreInstanceState(Parcelable state) {
        try {
            super.onRestoreInstanceState(state);
        } catch (Exception e) {
        }
        state = null;
        if (state instanceof Bundle) {
            Bundle bundle = (Bundle) state;
            mAlpha = bundle.getFloat(STATE_ALPHA);
            super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
        } else {
            super.onRestoreInstanceState(state);
        }
    }
}


text:
package fr.ourten.teabeans.property.named;

import fr.ourten.teabeans.property.ReduceProperty;
import fr.ourten.teabeans.value.ObservableValue;

import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Stream;

public class NamedReduceProperty<T, V> extends ReduceProperty<T, V> implements INamedProperty
{
    private final String name;

    public NamedReduceProperty(Function<Stream<T>, V> reducingFunction, String name)
    {
        super(reducingFunction);

        this.name = name;
    }

    @Override
    public String getName()
    {
        return name;
    }

    //////////////////
    // CONSTRUCTORS //
    //////////////////

    public static <T, V> NamedReduceProperty<T, V> reduce(String name, Function<Stream<T>, V> reducingFunction)
    {
        return new NamedReduceProperty<>(reducingFunction, name);
    }

    public static <T> NamedReduceProperty<T, T> reduce(String name, BinaryOperator<T> accumulator)
    {
        return new NamedReduceProperty<>(values -> values.reduce(accumulator).orElse(null), name);
    }

    public static <T, V> NamedReduceProperty<T, V> reduce(String name, Function<Stream<T>, V> reducingFunction, ObservableValue<T>... observables)
    {
        NamedReduceProperty<T, V> reduceProperty = new NamedReduceProperty<>(reducingFunction, name);
        reduceProperty.bind(observables);
        return reduceProperty;
    }

    public static <T> NamedReduceProperty<T, T> reduce(String name, BinaryOperator<T> accumulator, ObservableValue<T>... observables)
    {
        NamedReduceProperty<T, T> reduceProperty = new NamedReduceProperty<>(values -> values.reduce(accumulator).orElse(null), name);
        reduceProperty.bind(observables);
        return reduceProperty;
    }
}


text:
rm -rf ./npm
mkdir ./npm

cp ./apickli.js ./npm/apickli.js
cp ./apickli-gherkin.js ./npm/apickli-gherkin.js
cp ../package.json ./npm/package.json
cp ../../LICENSE ./npm/LICENSE
cp ../../README.md ./npm/README.md

cd ./npm
npm publish

rm -rf ../npm


text:
package oap.application;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import oap.io.Files;
import oap.testng.TestDirectoryFixture;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.nio.file.Path;
import java.util.concurrent.atomic.AtomicInteger;

import static oap.io.content.ContentWriter.ofString;
import static oap.testng.Asserts.urlOfTestResource;
import static org.assertj.core.api.Assertions.assertThat;

public class DynamicConfigTest {

    @Test
    public void defaultConfig() throws MalformedURLException {
        Path update = TestDirectoryFixture.testPath( "update.conf" );

        DynamicConfig<Cfg> config = new DynamicConfig<>( 10, Cfg.class,
            urlOfTestResource( getClass(), "default.conf" ),
            update.toUri().toURL()
        );
        AtomicInteger updates = new AtomicInteger( 0 );
        config.addListener( updates::incrementAndGet );
        assertThat( config.value ).isEqualTo( new Cfg( "value1" ) );

        Files.write( update, "{parameter=\"valueUpdated\"}", ofString() );
        config.control.sync();
        config.control.sync();
        config.control.sync();
        config.control.sync();
        assertThat( config.value ).isEqualTo( new Cfg( "valueUpdated" ) );
        assertThat( updates.get() ).isEqualTo( 1 );
    }
}

@EqualsAndHashCode
@ToString
class Cfg {
    String parameter;

    @JsonCreator
    Cfg( String parameter ) {
        this.parameter = parameter;
    }
}


text:
package mesosphere.marathon.core.task.bus

import mesosphere.marathon.core.task.bus.TaskChangeObservables.TaskChanged
import mesosphere.marathon.core.task.{ Task, TaskStateChange, TaskStateOp }
import mesosphere.marathon.state.PathId
import rx.lang.scala.Observable

object TaskChangeObservables {
  case class TaskChanged(stateOp: TaskStateOp, stateChange: TaskStateChange) {
    def taskId: Task.Id = stateOp.taskId
    def appId: PathId = stateOp.taskId.appId
  }
}

/**
  * Allows subscription to TaskChanged updates.
  */
trait TaskChangeObservables {
  def forAll: Observable[TaskChanged]
  def forAppId(appId: PathId): Observable[TaskChanged]
}


text:
Ext.define('Ext.ux.grid.SubTable', {
    extend: 'Ext.grid.plugin.RowExpander',

    alias: 'plugin.subtable',

    rowBodyTpl: ['

',
        '{%',
            'this.owner.renderTable(out, values);',
        '%}',
        '

'
    ],

    init: function(grid) {
        var me = this,
            columns = me.columns,
            len, i, columnCfg;

        me.callParent(arguments);

        me.columns = [];
        if (columns) {
            for (i = 0, len = columns.length; i < len; ++i) {
                // Don't register with the component manager, we create them to use
                // their rendering smarts, but don't want to treat them as real components
                columnCfg = Ext.apply({
                    preventRegister: true
                }, columns[i]);
                columnCfg.xtype = columnCfg.xtype || 'gridcolumn';
                me.columns.push(Ext.widget(columnCfg));
            }
        }
    },

    destroy: function() {
        var columns = this.columns,
            len, i;

        if (columns) {
            for (i = 0, len = columns.length; i < len; ++i) {
                columns[i].destroy();
            }
        }
        this.columns = null;
        this.callParent();
    },

    getRowBodyFeatureData: function(record, idx, rowValues) {
        this.callParent(arguments);
        rowValues.rowBodyCls += ' ' + Ext.baseCSSPrefix + 'grid-subtable-row';
    },

    renderTable: function(out, rowValues) {
        var me = this,
            columns = me.columns,
            numColumns = columns.length,
            associatedRecords = me.getAssociatedRecords(rowValues.record),
            recCount = associatedRecords.length,
            rec, column, i, j, value;

        out.push('
');
        for (j = 0; j < numColumns; j++) {
            out.push('', columns[j].text, '	');
        }
        out.push('
');
        for (i = 0; i < recCount; i++) {
            rec = associatedRecords[i];
            out.push('
');
            for (j = 0; j < numColumns; j++) {
                column = columns[j];
                value = rec.get(column.dataIndex);
                if (column.renderer && column.renderer.call) {
                    value = column.renderer.call(column.scope || me, value, {}, rec);
                }
                out.push('
', value, '
	');
            }
            out.push('
');
        }
    },

    getRowBodyContentsFn: function(rowBodyTpl) {
        var me = this;
        return function (rowValues) {
            rowBodyTpl.owner = me;
            return rowBodyTpl.applyTemplate(rowValues);
        };
    },

    getAssociatedRecords: function(record) {
        return record[this.association]().getRange();
    }
});


text:
<?php

/**
 * Permette di utilizzare la app "minify" per minificare i file js e css.
 * Durante lo sviluppo (ambiente "dev") saranno collegati alla pagina i file
 * originali, non concatenati e non minificati. In produzione invece (ambiente
 * "prod") saranno collegati alla pagina solo "script.js" e "style.css", che
 * saranno le versioni concatenate e minificate di tutti i file definiti nei
 * gruppi "js" e "css" di groupsConfig.php. E' possibile anche passare alle
 * funzioni un numero di versione che verrà inserito all'interno dei nomi dei
 * file, in modo da poter applicare tecniche di cache-bursting.
 */

/**
 * Restituisce l'array dei gruppi definiti nel file "groupsConfig.php" di minify
 * @return array
 */
function get_assets() {
  static $cache;
  if (!isset($cache))
    $cache = (require "$_SERVER[DOCUMENT_ROOT]/assets.php");
	return $cache;
}

/**
 * Scrive tutti i tag <script> necessari a collegare i file javascript. Se
 * l'ambiente di sviluppo corrente è "prod", allora verrà collegato solo
 * "script.js" (che tramite .htaccess dovrà reindirizzare a "/min/g=js").
 * Altrimenti saranno collegati tutti i javascript definiti nel gruppo "js" in
 * groupsConfig.php.
 */
function include_javascripts() {
  $assets = get_assets();
  $version = @$assets['js_version'];
  if (!isset($version)) $version = 0;
	if ($assets['minify']) {
		echo "<script src=\"/js/script.$version.js\"></script>";
	} else {
		foreach ($assets['js'] as $script)
			echo "<script src=\"/js/$script.$version.js\"></script>";
	}
}

/**
 * Scrive tutti i tag <link> necessari a collegare i file css. Se
 * l'ambiente di sviluppo corrente è "prod", allora verrà collegato solo
 * "style.js" (che tramite .htaccess dovrà reindirizzare a "/min/g=css").
 * Altrimenti saranno collegati tutti i css definiti nel gruppo "css" in
 * groupsConfig.php.
 */
function include_stylesheets() {
  $assets = get_assets();
  $version = @$assets['css_version'];
  if (!isset($version)) $version = 0;
	if ($assets['minify']) {
		echo "<link rel=\"stylesheet\" href=\"/css/style.$version.css\">";
	} else {
		foreach ($assets['css'] as $style)
			echo "<link rel=\"stylesheet\" href=\"/css/$style.$version.css\">";
	}
}