text:
NSString *MBLTableViewMouseExitedNotification = @"MBLTableViewMouseExited";

@implementation MBLSessionsTableView

- (id)initWithFrame:(NSRect)frame
{
	NSLog(@"initWithFrame:%@", NSStringFromRect(frame));
	if (self = [super initWithFrame:frame])
	{
		[self addTrackingRect:frame
						owner:self
					 userData:NULL
				 assumeInside:YES];
	}
	return self;
}

- (IBAction)copy:(id)sender
{
	NSPasteboard *pboard = [NSPasteboard generalPasteboard];

	// Apply changes
	[sessionsController commitEditing];
	NSArray *arr = (NSArray *)[sessionsController arrangedObjects];
	int sel = [sessionsController selectionIndex];

	// Get CSV stream
	NSString *CSVString = [[[arr objectAtIndex:sel] events] CSVString];

	// Declare pasteboard types
    [pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];

	// Put data into pasteboard
	[pboard setString:CSVString forType:NSStringPboardType];
}

- (int)draggedRow
{
	return draggedRow;
}
- (void)setDraggedRow:(int)row
{
	if (row >= 0)
	{
		draggedRow = row;
	}
}

- (void)mouseExited:(NSEvent *)theEvent
{
	[[NSNotificationCenter defaultCenter] postNotificationName:MBLTableViewMouseExitedNotification
														object:self];
	//NSLog(@"Posting notification: %@", MBLTableViewMouseExitedNotification);
	[super mouseExited:theEvent];
}

@end

@implementation MBLSessionsTableView (NSDraggingSource)

- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
#pragma unused (isLocal)
	return NSDragOperationCopy | NSDragOperationDelete;
}

- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation
{
	if (operation == NSDragOperationDelete)
	{
		if ([sessionsController canRemoveArrangedObjectAtIndex:draggedRow])
		{
			[sessionsController removeObjectAtArrangedObjectIndex:draggedRow];
			NSSound *trashSound = nil;
			NSFileManager *manager = [NSFileManager defaultManager];
			if ([manager fileExistsAtPath:DRAG_TO_TRASH_SOUND_PATH])
			{
				trashSound = [[NSSound alloc] initWithContentsOfFile:DRAG_TO_TRASH_SOUND_PATH
														 byReference:YES];
			}
			[trashSound play];
			[trashSound release];
		}
		else
		{
			NSBeep();
		}
	}
}

@end

@implementation MBLSessionsTableView (NSNibAwaking)

- (void)awakeFromNib
{
	[self addTrackingRect:[self frame]
					owner:self
				 userData:NULL
			 assumeInside:YES];
}

@end


text:
'use strict';
var React = require('react');
import { NavLink } from 'fluxible-router';

class Nav extends React.Component {
    render() {
        const selected = this.props.selected;
        const links = this.props.links;

        const linkHTML = Object.keys(links).map(function (name) {
            var className = '';
            var link = links[name];

            if (selected === name) {
                className = 'pure-menu-selected';
            }

            return (

                    <NavLink routeName={link.page} activeStyle={{backgroundColor: '#eee'}}>{link.title}</NavLink>

            );
        });

        return (

                {linkHTML}

        );
    }
}

Nav.defaultProps = {
    selected: 'home',
    links: {}
};

module.exports = Nav;

redpajama_set_name: RedPajamaGithub


text:
import re
from math import log

from django import template
from django.conf import settings
from django.db import models

Post = models.get_model('blog', 'post')
Category = models.get_model('blog', 'category')

register = template.Library()

class LatestPosts(template.Node):
	"""
	TODO
	"""
	def __init__(self, limit, var_name):
		self.limit = limit
		self.var_name = var_name

	def render(self, context):
		posts = Post.objects.published()[:int(self.limit)]
		if (int(self.limit) == 1):
			context[self.var_name] = posts[0]
		else:
			context[self.var_name] = posts

		return ''

@register.tag
def get_latest_posts(parser, token):
	"""
	Gets any number of latest posts and stores them in a varable.

	Syntax::

		{% get_latest_posts [limit] as [var_name] %}

	Example usage::

		{% get_latest_posts 10 as latest_post_list %}
	"""
	try:
		tag_name, arg = token.contents.split(None, 1)
	except ValueError:
		raise template.TemplateSyntaxError, "%s tag requires arguments" % token.contents.split()[0]

	m = re.search(r'(.*?) as (\w+)', arg)

	if not m:
		raise template.TemplateSyntaxError, "%s tag had invalid arguments" % tag_name

	format_string, var_name = m.groups()

	return LatestPosts(format_string[0], var_name)

class BlogCategories(template.Node):
	"""
	TODO
	"""
	def __init__(self, var_name):
		self.var_name = var_name

	def render(self, context):
		categories = Category.objects.all()
		context[self.var_name] = categories
		return ''

@register.tag
def get_blog_categories(parser, token):
	"""
	Gets all blog categories.

	Syntax::

		{% get_blog_categories as [var_name] %}

	Example usage::

		{% get_blog_categories as category_list %}
	"""
	try:
		tag_name, arg = token.contents.split(None, 1)
	except ValueError:
		raise template.TemplateSyntaxError, "%s tag requires arguments" % token.contents.split()[0]
	m = re.search(r'as (\w+)', arg)
	if not m:
		raise template.TemplateSyntaxError, "%s tag had invalid arguments" % tag_name
	var_name = m.groups()[0]
	return BlogCategories(var_name)

@register.filter
def get_links(value):
	"""
	Extracts links from a ``Post`` body and returns a list.

	Template Syntax::

		{{ post.body|markdown|get_links }}

	"""
	try:
		try:
			from BeautifulSoup import BeautifulSoup
		except ImportError:
			from beautifulsoup import BeautifulSoup
		soup = BeautifulSoup(value)
		return soup.findAll('a')
	except ImportError:
		if settings.DEBUG:
			raise template.TemplateSyntaxError, "Error in 'get_links' filter: BeautifulSoup isn't installed."
	return value

def strip_illustrations(parser):
	"""
	Strip illustrations from the given blog entry copy.  This is used
	in feed templates, as without CSS applied illustrations look ass.

	As an example, given the string::

	>>> s = '
 A caption.
'
	>>> strip_illustrations(s)
	''
	>>> s = '
Keep this.

And this.
'
	>>> strip_illustrations(s)
	'
Keep this.

And this.
'
	"""
	from BeautifulSoup import BeautifulSoup
	soup = BeautifulSoup(parser)
	illustrations = soup.findAll("p", {"class": "illustration"})
	[illustration.extract() for illustration in illustrations]
	return str(soup)

register.filter('strip_illustrations', strip_illustrations)


text:
package speakman.whatsshakingnz.utils;

import android.test.AndroidTestCase;

import com.google.android.gms.maps.model.LatLng;

import speakman.whatsshakingnz.model.LocalPlace;

/**
 * Created by Adam on 11/24/2015.
 */
public class DistanceUtilTests extends AndroidTestCase {

    public void testClosestPlaceIsCorrect() {
        LocalPlace closestPlace = DistanceUtil.getClosestPlace(new LatLng(-36.806, 174.814));
        assertEquals("Auckland", closestPlace.name);

        closestPlace = DistanceUtil.getClosestPlace(new LatLng(-35.778, 174.217));
        assertEquals("Whangarei", closestPlace.name);

        closestPlace = DistanceUtil.getClosestPlace(new LatLng(-43.584, 172.65));
        assertEquals("Christchurch", closestPlace.name);
    }

    public void testDirectionIsCorrect() {
        LatLng center = new LatLng(-37, 170);
        LatLng north = new LatLng(-36, 170);
        LatLng northEast = new LatLng(-36, 171);
        LatLng east = new LatLng(-37, 171);
        LatLng southEast = new LatLng(-38, 171);
        LatLng south = new LatLng(-38, 170);
        LatLng southWest = new LatLng(-38, 169);
        LatLng west = new LatLng(-37, 169);
        LatLng northWest = new LatLng(-36, 169);

        assertEquals(DistanceUtil.Direction.North, DistanceUtil.getDirection(center, north));
        assertEquals(DistanceUtil.Direction.NorthEast, DistanceUtil.getDirection(center, northEast));
        assertEquals(DistanceUtil.Direction.East, DistanceUtil.getDirection(center, east));
        assertEquals(DistanceUtil.Direction.SouthEast, DistanceUtil.getDirection(center, southEast));
        assertEquals(DistanceUtil.Direction.South, DistanceUtil.getDirection(center, south));
        assertEquals(DistanceUtil.Direction.SouthWest, DistanceUtil.getDirection(center, southWest));
        assertEquals(DistanceUtil.Direction.West, DistanceUtil.getDirection(center, west));
        assertEquals(DistanceUtil.Direction.NorthWest, DistanceUtil.getDirection(center, northWest));
    }

    public void testDirectionIsCorrectForCenterLeftOfAntimeridian() {
        // Center is left of antimeridian, all points to the right of antimeridian (negative longitude)
        LatLng center = new LatLng(-37, 179);
        LatLng north = new LatLng(-31.761574, -179.791195);
        LatLng northEast = new LatLng(-35.767848, -179.542960);
        LatLng east = new LatLng(-37, -179);
        LatLng southEast = new LatLng(-37.776975, -178.863579);
        LatLng south = new LatLng(-42.013893, -179.724571);
        assertEquals(DistanceUtil.Direction.North, DistanceUtil.getDirection(center, north));
        assertEquals(DistanceUtil.Direction.NorthEast, DistanceUtil.getDirection(center, northEast));
        assertEquals(DistanceUtil.Direction.East, DistanceUtil.getDirection(center, east));
        assertEquals(DistanceUtil.Direction.SouthEast, DistanceUtil.getDirection(center, southEast));
        assertEquals(DistanceUtil.Direction.South, DistanceUtil.getDirection(center, south));
    }

    public void testDirectionIsCorrectForCenterRightOfAntimeridian() {
        // Center is right of antimeridian, all points to the left of antimeridian (positive longitude)
        LatLng center = new LatLng(-37, -179); // Center to right of antimeridian
        LatLng north = new LatLng(-31.761574, 179.791195);
        LatLng northWest = new LatLng(-35.767848, 179.542960);
        LatLng west = new LatLng(-37, 179);
        LatLng southWest = new LatLng(-37.776975, 178.863579);
        LatLng south = new LatLng(-42.013893, 179.724571);
        assertEquals(DistanceUtil.Direction.North, DistanceUtil.getDirection(center, north));
        assertEquals(DistanceUtil.Direction.NorthWest, DistanceUtil.getDirection(center, northWest));
        assertEquals(DistanceUtil.Direction.West, DistanceUtil.getDirection(center, west));
        assertEquals(DistanceUtil.Direction.SouthWest, DistanceUtil.getDirection(center, southWest));
        assertEquals(DistanceUtil.Direction.South, DistanceUtil.getDirection(center, south));
    }
}


text:
<?php

/**
 * @see Zend_Controller_Action
 */
require_once 'Zend/Controller/Action.php';

/**
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage Zend_Controller_Action_Helper
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
abstract class Zend_Controller_Action_Helper_Abstract
{
    /**
     * $_actionController
     *
     * @var Zend_Controller_Action $_actionController
     */
    protected $_actionController = null;

    /**
     * @var mixed $_frontController
     */
    protected $_frontController = null;

    /**
     * setActionController()
     *
     * @param  Zend_Controller_Action $actionController
     * @return Zend_Controller_ActionHelper_Abstract Provides a fluent interface
     */
    public function setActionController(Zend_Controller_Action $actionController = null)
    {
        $this->_actionController = $actionController;
        return $this;
    }

    /**
     * Retrieve current action controller
     *
     * @return Zend_Controller_Action
     */
    public function getActionController()
    {
        return $this->_actionController;
    }

    /**
     * Retrieve front controller instance
     *
     * @return Zend_Controller_Front
     */
    public function getFrontController()
    {
        return Zend_Controller_Front::getInstance();
    }

    /**
     * Hook into action controller initialization
     *
     * @return void
     */
    public function init()
    {
    }

    /**
     * Hook into action controller preDispatch() workflow
     *
     * @return void
     */
    public function preDispatch()
    {
    }

    /**
     * Hook into action controller postDispatch() workflow
     *
     * @return void
     */
    public function postDispatch()
    {
    }

    /**
     * getRequest() -
     *
     * @return Zend_Controller_Request_Abstract $request
     */
    public function getRequest()
    {
        $controller = $this->getActionController();
        if (null === $controller) {
            $controller = $this->getFrontController();
        }

        return $controller->getRequest();
    }

    /**
     * getResponse() -
     *
     * @return Zend_Controller_Response_Abstract $response
     */
    public function getResponse()
    {
        $controller = $this->getActionController();
        if (null === $controller) {
            $controller = $this->getFrontController();
        }

        return $controller->getResponse();
    }

    /**
     * getName()
     *
     * @return string
     */
    public function getName()
    {
        $full_class_name = get_class($this);

        if (strpos($full_class_name, '_') !== false) {
            $helper_name = strrchr($full_class_name, '_');
            return ltrim($helper_name, '_');
        } else {
            return $full_class_name;
        }
    }
}


text:
/**
 * Package: MAG - VistA Imaging
 * WARNING: Per VHA Directive 2004-038, this routine should not be modified.
 * Date Created: Apr 30, 2008
 * Site Name:  Washington OI Field Office, Silver Spring, MD
 * @author VHAISWBECKEC
 * @version 1.0
 *
 * ----------------------------------------------------------------
 * Property of the US Government.
 * No permission to copy or redistribute this software is given.
 * Use of unreleased versions of this software requires the user
 * to execute a written test agreement with the VistA Imaging
 * Development Office of the Department of Veterans Affairs,
 * telephone (301) 734-0100.
 *
 * The Food and Drug Administration classifies this software as
 * a Class II medical device.  As such, it may not be changed
 * in any way.  Modifications to this software may result in an
 * adulterated medical device under 21CFR820, the use of which
 * is considered to be a violation of US Federal Statutes.
 * ----------------------------------------------------------------
 */
package gov.va.med.imaging.datasource;

/**
 * The root abstract class of all service provider interfaces.
 * This is simply a marker-interface to allow for the use
 * of type-safe generics.
 *
 * Known Derivations:
 * @see gov.va.med.imaging.datasource.VersionableDataSourceSpi
 * @see gov.va.med.imaging.datasource.LocalDataSourceSpi
 *
 * @author VHAISWBECKEC
 *
 */
public interface DataSourceSpi
{
	/**
	 * Sets the configuration of the data source.
	 *
	 * @param configuration
	 */
	public void setConfiguration(Object configuration);
}


text:
package bus

import (
	"errors"
	"sync"
)

var mutex sync.Mutex

//RegisterConsumer to a new Channel
func RegisterConsumer(channel string, consumer messageConsumer) error {
	if hub[channel] != nil {
		return errors.New("this channel already has a consumer")
	}
	mutex.Lock()
	defer mutex.Unlock()
	hub[channel] = make(chan []byte)
	go (func() {
		for {
			msg := <-hub[channel]
			consumer(msg)
		}
	})()
	return nil
}


text:
OneClickArchiver
================

OneClickArchiver


text:
using System.Linq;
using LanguageSchoolApp.Data.Model;

namespace LanguageSchoolApp.Services.Contracts
{
    public interface ICourseService
    {
        IQueryable<Course> GetAll();

        void Update(Course course);
    }
}


text:
% Fierce Planet

# Fierce Planet

[Fierce Planet](http://www.fierce-planet.com) is an open source toolkit for developing agent-based models, with a focus on urban and social simulations.

It runs on [Node.js](http://nodejs.org) on the server, and uses
[Three.js](http://threejs.org) extensively to generate 3D simulations in the browser. [Click here](https://get.webgl.org/) to check your browser is compatible.

For more information, please visit:

 - [Fierce Planet](http://www.fierce-planet.com)
 - [GitHub](https://github.com/liammagee/fp.git)

## Running *Fierce Planet*

To run Fierce Planet locally:

 - Clone the [repository](https://github.com/liammagee/fp.git)
 - Ensure the following dependencies are installed:
    * [Node](http://nodejs.org)
    * [Gulp](http://gulpjs.com/)
 - Then run:

   cd fp
   npm install
   gulp dist
   node app.js

 - You should then be able to visit <http://localhost:3000> to view the example and built-in project simulations.

In addition, a number of other commands can be run using [gulp](http://gulpjs.com/):

### Building the source

To generate code documentation, run:

~~~ {.zsh}
    gulp require
~~~

### Generating code docs

To generate code documentation, run:

~~~ {.zsh}
    gulp jsdoc
~~~

### Generating the website

To convert the HTML website content from the [Markdown](http://daringfireball.net/projects/markdown/) docs:

~~~ {.zsh}
    gulp pandoc-site
~~~

### Running Babel to convert ES6 code to ES5

A small amount of code currently uses [ES6](https://github.com/lukehoban/es6features) for convenience. To convert this code to *ES5*, run:

~~~ {.zsh}
    gulp babel-shader
~~~

## Code Layout

The code includes the following

 - *docs*: The text content of the website, in [Markdown](http://daringfireball.net/projects/markdown/) format.
 - *public*: All assets (HTML, JavaScript, stylesheets, images, etc.) needed to run *Fierce Planet*.
 - *public/js/fp*: The source code for running *Fierce Planet* simulations.
 - *public/examples*: Examples of how *Fierce Planet* can be configured.
 - *public/projects*: Project that use and extend *Fierce Planet*.


text:
package sonata.kernel.VimAdaptor.wrapper;

import java.util.ArrayList;

public class WrapperBay {

  private static WrapperBay myInstance = null;

  private VimRepo repository = null;

  private WrapperBay() {}

  /**
   * Singleton method to get the instance of the wrapperbay.
   *
   * @return the instance of the wrapperbay
   */
  public static WrapperBay getInstance() {
    if (myInstance == null) {
      myInstance = new WrapperBay();
    }
    return myInstance;
  }

  /**
   * Set the Database reader/writer to use as a repository for VIMs.
   *
   * @param repo the Database reader/writer to store the wrappers
   */
  public void setRepo(VimRepo repo) {
    this.repository = repo;
  }

  /**
   * Register a new compute wrapper.
   *
   * @param config The configuration object representing the Wrapper to register
   * @return a JSON representing the output of the API call
   */
  public String registerComputeWrapper(WrapperConfiguration config) {
    Wrapper newWrapper = WrapperFactory.createWrapper(config);
    String output = "";
    if (newWrapper == null) {
      output = "{\"status\":\"ERROR\",\"message:\"Cannot Attach To Vim\"}";
    } else if (newWrapper.getType().equals("compute")) {
      WrapperRecord record = new WrapperRecord(newWrapper, config, null);
      this.repository.writeVimEntry(config.getUuid(), record);
      output = "{\"status\":\"COMPLETED\",\"uuid\":\"" + config.getUuid() + "\"}";
    }

    return output;
  }

  /**
   * Order the list of available compute wrapper to find the best basing on an OptimizationStrategy.
   *
   * @return A ComputeWrapper object, the best according to the OptimizationStrategy.
   */
  public ComputeWrapper getBestComputeWrapper() {
    ComputeWrapper bestWrapper = null;

    return bestWrapper;
  }

  /**
   * Utility methods to clear registry tables.
   */
  public void clear() {}

  /**
   * Remove a registered compute wrapper from the IA.
   *
   * @param uuid the uuid of the wrapper to remove
   * @return a JSON representing the output of the API call
   */
  public String removeComputeWrapper(String uuid) {
    repository.removeVimEntry(uuid);
    return "{\"status\":\"COMPLETED\"}";
  }

  /**
   * Return the list of the registered compute VIMs.
   *
   * @return an arraylist of String representing the UUIDs of the registered VIMs
   */
  public ArrayList<String> getComputeWrapperList() {
    return repository.getComputeVims();

  }

  /**
   * Return the wrapper of the compute VIM identified by the given UUID.
   *
   * @param vimUuid the UUID of the compute VIM
   *
   * @return the wrapper of the requested VIM or null if the UUID does not correspond to a
   *         registered VIM
   */
  public ComputeWrapper getComputeWrapper(String vimUuid) {
    return (ComputeWrapper) this.repository.readVimEntry(vimUuid).getVimWrapper();
  }

  /**
   * @param config
   * @param computeVimRef
   * @return
   */
  public String registerNetworkingWrapper(WrapperConfiguration config, String computeVimRef) {
    Wrapper newWrapper = WrapperFactory.createWrapper(config);
    String output = "";
    if (newWrapper == null) {
      output = "{\"status\":\"ERROR\",\"message:\"Cannot Attach To Vim\"}";
    } else if (newWrapper.getType().equals("networking")) {
      WrapperRecord record = new WrapperRecord(newWrapper, config, null);
      this.repository.writeVimEntry(config.getUuid(), record);
      this.repository.writeNetworkVimLink(computeVimRef, config.getUuid());
      output = "{\"status\":\"COMPLETED\",\"uuid\":\"" + config.getUuid() + "\"}";
    }
    return output;
  }

  /**
   * Return the VimRepo
   *
   * @return the VimRepo object.
   */
  public VimRepo getVimRepo() {
    return repository;
  }

}


text:
<ion-header>

  <ion-navbar>
    <ion-title>{{ 'Location' | translate }}</ion-title>
  </ion-navbar>

</ion-header>

<ion-content>
    <ion-card>
        <ion-img id="imgHolder" width="100%" height="250px" style="overflow-y: scroll;" [src]="location.imageUrl"></ion-img>
        <ion-card-content>
            <ion-card-title>
            {{location.name}}
            </ion-card-title>
            <p>
            {{location.description}}
            </p>
        </ion-card-content>
    </ion-card>
    <ion-list *ngIf="location.clues.length > 0">
        <ion-list-header>
        Clues
        </ion-list-header>

        <ion-item *ngFor="let clue of location.clues; let i = index" (click)="showClue(clue)">
            <ion-icon name="information-circle" item-start color="dark"></ion-icon>
            <ion-label>Clue {{i + 1}}</ion-label>
        </ion-item>
    </ion-list>
    <div text-center>
        <button *ngIf="location.status == 'not_found'" ion-button (click)="scan()">Check-In</button>
        <button *ngIf="location.status == 'found'" ion-button color="secondary">Location Found</button>
    </div>
</ion-content>


text:
namespace Microsoft.Azure.EventGrid.Models
{
    using System.Linq;

    /// <summary>
    /// Event data for Microsoft.Devices.DeviceCreated event.
    /// </summary>
    public partial class IotHubDeviceCreatedEventData : DeviceLifeCycleEventProperties
    {
        /// <summary>
        /// Initializes a new instance of the IotHubDeviceCreatedEventData
        /// class.
        /// </summary>
        public IotHubDeviceCreatedEventData()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the IotHubDeviceCreatedEventData
        /// class.
        /// </summary>
        /// <param name="deviceId">The unique identifier of the device. This
        /// case-sensitive string can be up to 128 characters long, and
        /// supports ASCII 7-bit alphanumeric characters plus the following
        /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.</param>
        /// <param name="hubName">Name of the IoT Hub where the device was
        /// created or deleted.</param>
        /// <param name="opType">The event type specified for this operation by
        /// the IoT Hub.</param>
        /// <param name="operationTimestamp">The ISO8601 timestamp of the
        /// operation.</param>
        /// <param name="twin">Information about the device twin, which is the
        /// cloud represenation of application device metadata.</param>
        public IotHubDeviceCreatedEventData(string deviceId = default(string), string hubName = default(string), string opType = default(string), string operationTimestamp = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo))
            : base(deviceId, hubName, opType, operationTimestamp, twin)
        {
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

    }
}


text:
<template name="singlePost">
	{{> navbarTop title="Post"}}

	{{> tmpBanner}}

		{{#with postWithAuthor}}

								{{> avatarImage data=this online=true}}

									{{username}}
									{{> timeDelete data=this look="dateTimePost"}}
									{{#if category}}

{{{category}}}

									{{/if}}

						{{#if position.tag}}

								{{position.tag}} {{onlyCity position.location}}

						{{/if}}

						{{#if imageUrl}}

						{{/if}}
						{{#if text}}

{{{br text}}}

						{{/if}}

						{{#unless position.tag}}
							{{#if position.location}}

									{{position.location}}

							{{/if}}
						{{/unless}}

								<button id="like-this" class="{{iLike}}">

									{{totLikes}}
								</button>
								<button id="unlike-this" class="{{iUnlike}}">

									{{totUnlikes}}
								</button>
								<button id="share-this">

									Inoltra
								</button>
								<button id="info-this">

								</button>

						{{#if comments}}

							{{#each comments}}
								{{#with commentWithAuthor}}

										{{> avatarImage data=this online=true}}

											{{username}}
											{{> timeDelete data=this look='createdAt'}}

{{{br text}}}

								{{/with}}
							{{/each}}

						{{/if}}

								<form id="comment-post-form">
									<textarea placeholder="Commenta il post..." class="autosize" id="comment-text"  data-autocomplete="username"></textarea>
									<button type="submit">

									</button>
								</form>

		{{/with}}

	{{> helpbars title="postCategory" loadmore=false gotop=true data=this }}

</template>


text:
package controllers

import (
	"fmt"
	"github.com/robfig/revel"
	"github.com/stackmachine/rottenrepos/cache"
	"log"
	"net/http"
	"regexp"
	"strings"
	"time"
)

type Check struct {
	Passed  bool
	Comment string
}

type Review struct {
	Checks []Check
}

func (r *Review) ChecksPassed() int {
	count := 0
	for _, check := range r.Checks {
		if check.Passed {
			count = count + 1
		}

	}
	return count
}

type Repository struct {
	*Review
	Description string
	Name        string
	User        string
}

type App struct {
	*revel.Controller
}

func FetchRepository(user string, repo string) Repository {
	var review Review
	key := "github-" + user + "-" + repo
	err, found := cache.Get(key, &review)

	r := Repository{Description: "", Name: repo, User: user}

	if err != nil || !found {
		return r
	}

	r.Review = &review
	return r
}

func FindFiles(user string, repo string, files ...string) bool {
	base := "https://api.github.com"

	found := make(chan bool)
	misses := make(chan bool)

	for _, file := range files {
		go func(b string, u string, r string, f string) {
			url := fmt.Sprintf("%s/repos/%s/%s/contents/%s", b, u, r, f)
			resp, err := http.Get(url)

			if err != nil {
				misses <- true
				return
			}

			if resp.StatusCode == 200 {
				found <- true
				return
			}

			misses <- true
		}(base, user, repo, file)
	}

	count := 0

	select {
	case <-found:
		return true
	case <-misses:
		count = count + 1
		if count == len(files) {
			return false
		}
	}

	return false
}

func (c App) Index() revel.Result {
	repos := []Repository{
		FetchRepository("mooseburger", "AbcaTSH"),
		FetchRepository("blakeembrey", "code-problems"),
		FetchRepository("m242", "maildrop"),
		FetchRepository("qq99", "echoplexus"),
		FetchRepository("lampepfl", "scala-js"),
		FetchRepository("creaktive", "rainbarf"),
		FetchRepository("AFNetworking", "AFNetworking"),
		FetchRepository("mitsuhiko", "flask"),
		FetchRepository("libgit2", "libgit2"),
	}

	return c.Render(repos)
}

func (c App) FindReport(repository string) revel.Result {
	c.Validation.Required(repository)
	c.Validation.Match(repository, regexp.MustCompile("^[^/]+/[^/]+$"))

	if c.Validation.HasErrors() {
		// Store the validation errors in the flash context and redirect.
		c.Validation.Keep()
		c.FlashParams()
		return c.Redirect(App.Index)
	}

	lines := strings.Split(repository, "/")
	return c.Redirect("/github/%s/%s", lines[0], lines[1])
}

func (c App) ReportCard(user string, repo string) revel.Result {
	title := user + "/" + repo + "'s Report Card - Rotten Repositories"
	key := "github-" + user + "-" + repo
	partial := c.Request.Header.Get("X-PJAX") != ""

	// Create a review channel
	var review Review

	err, found := cache.Get(key, &review)

	if err != nil {
		return c.RenderError(err)
	}

	missing := !found

	if !found && partial {

		checks := make(chan Check)
		base := "https://api.github.com"

		go func() {
			repo_url := fmt.Sprintf("%s/repos/%s/%s", base, user, repo)
			resp, err := http.Get(repo_url)

			if err != nil {
				checks <- Check{Passed: false, Comment: "GitHub Error :("}
				return
			}

			log.Println(resp.StatusCode)

			if resp.StatusCode != 200 {
				checks <- Check{Passed: false, Comment: "Repository doesn't exist"}
				return
			}

			checks <- Check{Passed: true, Comment: "Repository exists"}
			return
		}()

		// Check for LICENSE
		go func() {
			if FindFiles(user, repo, "LICENSE", "LICENSE.txt") {
				checks <- Check{Passed: true, Comment: "LICENSE in repository"}
			} else {
				checks <- Check{Passed: false, Comment: "No LICENSE in repository"}
			}
		}()

		// Check for README
		go func() {
			readme_url := fmt.Sprintf("%s/repos/%s/%s/readme", base, user, repo)
			resp, err := http.Get(readme_url)

			if err != nil {
				checks <- Check{Passed: false, Comment: "GitHub error :("}
				return
			}

			log.Println(resp.StatusCode)

			if resp.StatusCode != 200 {
				checks <- Check{Passed: false, Comment: "No README in repository"}
				return
			}

			checks <- Check{Passed: true, Comment: "README in repository"}
		}()

		for i := 0; i < 3; i++ {
			review.Checks = append(review.Checks, <-checks)
		}

		go cache.Set(key, review, 24*time.Hour)
	}

	return c.Render(user, repo, title, partial, review, missing)
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

          <title>org.scalatest.concurrent.Eventually</title>
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link type="text/css" media="screen" rel="stylesheet" href="../../../lib/template.css" />

org.scalatest.concurrent

Eventually

      object

        Eventually

         extends Eventually

Companion object that facilitates the importing of Eventually members as
an alternative to mixing in the trait. One use case is to import Eventually's members so you can use
them in the Scala interpreter:

$ scala -cp scalatest-1.8.jar
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.scalatest._
import org.scalatest._

scala> import matchers.ShouldMatchers._
import matchers.ShouldMatchers._

scala> import concurrent.Eventually._
import concurrent.Eventually._

scala> val xs = 1 to 125
xs: scala.collection.immutable.Range.Inclusive = Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 125)

scala> val it = xs.iterator
it: Iterator[Int] = non-empty iterator

scala> eventually { it.next should be (3) }

scala> eventually { Thread.sleep(999); it.next should be (3) }
org.scalatest.TestFailedException: The code passed to eventually never returned normally.
    Attempted 2 times, sleeping 10 milliseconds between each attempt.
  at org.scalatest.Eventually$class.tryTryAgain$1(Eventually.scala:313)
  at org.scalatest.Eventually$class.eventually(Eventually.scala:322)
  ...

          Linear Supertypes

Eventually, PatienceConfiguration, AbstractPatienceConfiguration, ScaledTimeSpans, AnyRef, Any

<input accesskey="/" type="text" />

                Ordering

Alphabetic

By inheritance

                Inherited

Hide All

Show all

Eventually

Eventually

PatienceConfiguration

AbstractPatienceConfiguration

ScaledTimeSpans

AnyRef

Any

              Visibility

Public

All

Type Members

      case class

        Interval

        (value: Span) extends PatienceConfigParam with Product with Serializable

A PatienceConfigParam that specifies the amount of time to sleep after
a retry.

      case class

        PatienceConfig

        (timeout: Span, interval: Span) extends Product with Serializable

Configuration object for asynchronous constructs, such as those provided by traits Eventually and
AsyncAssertions.

      class

        PatienceConfigParam

         extends AnyRef

Abstract class defining a family of configuration parameters for traits Eventually and AsyncAssertions.

      case class

        Timeout

        (value: Span) extends PatienceConfigParam with Product with Serializable

A PatienceConfigParam that specifies the maximum amount of time to wait for an asynchronous operation to
complete.

Value Members

      def

        !=

        (arg0: AnyRef): Boolean

Attributes

final

Definition Classes

AnyRef

      def

        !=

        (arg0: Any): Boolean

Attributes

final

Definition Classes

Any

      def

        ##

        (): Int

Attributes

final

Definition Classes

AnyRef → Any

      def

        ==

        (arg0: AnyRef): Boolean

Attributes

final

Definition Classes

AnyRef

      def

        ==

        (arg0: Any): Boolean

Attributes

final

Definition Classes

Any

      def

        asInstanceOf
        [T0]
        : T0

Attributes

final

Definition Classes

Any

      def

        clone

        (): AnyRef

Attributes

protected[lang]

Definition Classes

AnyRef

Annotations

                @throws()

      def

        eq

        (arg0: AnyRef): Boolean

Attributes

final

Definition Classes

AnyRef

      def

        equals

        (arg0: Any): Boolean

Definition Classes

AnyRef → Any

      def

        eventually
        [T]
        (fun: ⇒ T)(implicit config: PatienceConfig): T

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

The by-name parameter "succeeds" if it returns a result. It "fails" if it throws any exception that
would normally cause a test to fail. (These are any exceptions except TestPendingException and
Errors listed in the
Treatment of java.lang.Errors section of the
documentation of trait Suite.)

The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up is configured by the timeout field of
the PatienceConfig passed implicitly as the last parameter.
The interval to sleep between attempts is configured by the interval field of
the PatienceConfig passed implicitly as the last parameter.

fun

the by-name parameter to repeatedly invoke

config

the PatienceConfig object containing the timeout and
         interval parameters

returns

the result of invoking the fun by-name parameter, the first time it succeeds

Definition Classes

Eventually

      def

        eventually
        [T]
        (interval: Interval)(fun: ⇒ T)(implicit config: PatienceConfig): T

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

The by-name parameter "succeeds" if it returns a result. It "fails" if it throws any exception that
would normally cause a test to fail. (These are any exceptions except TestPendingException and
Errors listed in the
Treatment of java.lang.Errors section of the
documentation of trait Suite.)

The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up is configured by the timeout field of
the PatienceConfig passed implicitly as the last parameter.
The interval to sleep between attempts is configured by the value contained in the passed
interval parameter.

interval

the Interval configuration parameter

fun

the by-name parameter to repeatedly invoke

config

the PatienceConfig object containing the (used) timeout and
         (unused) interval parameters

returns

the result of invoking the fun by-name parameter, the first time it succeeds

Definition Classes

Eventually

      def

        eventually
        [T]
        (timeout: Timeout)(fun: ⇒ T)(implicit config: PatienceConfig): T

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

The by-name parameter "succeeds" if it returns a result. It "fails" if it throws any exception that
would normally cause a test to fail. (These are any exceptions except TestPendingException and
Errors listed in the
Treatment of java.lang.Errors section of the
documentation of trait Suite.)

The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up and throwing
TestFailedException is configured by the value contained in the passed
timeout parameter.
The interval to sleep between attempts is configured by the interval field of
the PatienceConfig passed implicitly as the last parameter.

timeout

the Timeout configuration parameter

fun

the by-name parameter to repeatedly invoke

config

the PatienceConfig object containing the (unused) timeout and
         (used) interval parameters

returns

the result of invoking the fun by-name parameter, the first time it succeeds

Definition Classes

Eventually

      def

        eventually
        [T]
        (timeout: Timeout, interval: Interval)(fun: ⇒ T): T

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

Invokes the passed by-name parameter repeatedly until it either succeeds, or a configured maximum
amount of time has passed, sleeping a configured interval between attempts.

The by-name parameter "succeeds" if it returns a result. It "fails" if it throws any exception that
would normally cause a test to fail. (These are any exceptions except TestPendingException and
Errors listed in the
Treatment of java.lang.Errors section of the
documentation of trait Suite.)

The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up and throwing
TestFailedException is configured by the value contained in the passed
timeout parameter.
The interval to sleep between attempts is configured by the value contained in the passed
interval parameter.

timeout

the Timeout configuration parameter

interval

the Interval configuration parameter

fun

the by-name parameter to repeatedly invoke

returns

the result of invoking the fun by-name parameter, the first time it succeeds

Definition Classes

Eventually

      def

        finalize

        (): Unit

Attributes

protected[lang]

Definition Classes

AnyRef

Annotations

                @throws()

      def

        getClass

        (): java.lang.Class[_]

Attributes

final

Definition Classes

AnyRef

      def

        hashCode

        (): Int

Definition Classes

AnyRef → Any

      def

        interval

        (value: Span): Interval

Returns an Interval configuration parameter containing the passed value, which
specifies the amount of time to sleep after a retry.

Returns an Interval configuration parameter containing the passed value, which
specifies the amount of time to sleep after a retry.

Definition Classes

PatienceConfiguration

      def

        isInstanceOf
        [T0]
        : Boolean

Attributes

final

Definition Classes

Any

      def

        ne

        (arg0: AnyRef): Boolean

Attributes

final

Definition Classes

AnyRef

      def

        notify

        (): Unit

Attributes

final

Definition Classes

AnyRef

      def

        notifyAll

        (): Unit

Attributes

final

Definition Classes

AnyRef

      implicit def

        patienceConfig

        : PatienceConfig

Implicit PatienceConfig value providing default configuration values.

Implicit PatienceConfig value providing default configuration values.

To change the default configuration, override or hide this def with another implicit
PatienceConfig containing your desired default configuration values.

Attributes

implicit

Definition Classes

PatienceConfiguration → AbstractPatienceConfiguration

      def

        scaled

        (span: Span): Span

Scales the passed Span by the Double factor returned
by spanScaleFactor.

Scales the passed Span by the Double factor returned
by spanScaleFactor.

The Span is scaled by invoking its scaledBy method,
thus this method has the same behavior:
The value returned by spanScaleFactor can be any positive number or zero,
including a fractional number. A number greater than one will scale the Span
up to a larger value. A fractional number will scale it down to a smaller value. A
factor of 1.0 will cause the exact same Span to be returned. A
factor of zero will cause Span.ZeroLength to be returned.
If overflow occurs, Span.Max will be returned. If underflow occurs,
Span.ZeroLength will be returned.

Attributes

final

Definition Classes

ScaledTimeSpans

      def

        spanScaleFactor

        : Double

The factor by which the scaled method will scale Spans.

The default implementation of this method...

The factor by which the scaled method will scale Spans.

The default implementation of this method...

Definition Classes

ScaledTimeSpans

      def

        synchronized
        [T0]
        (arg0: ⇒ T0): T0

Attributes

final

Definition Classes

AnyRef

      def

        timeout

        (value: Span): Timeout

Returns a Timeout configuration parameter containing the passed value, which
specifies the maximum amount to wait for an asynchronous operation to complete.

Returns a Timeout configuration parameter containing the passed value, which
specifies the maximum amount to wait for an asynchronous operation to complete.

Definition Classes

PatienceConfiguration

      def

        toString

        (): String

Definition Classes

AnyRef → Any

      def

        wait

        (): Unit

Attributes

final

Definition Classes

AnyRef

Annotations

                @throws()

      def

        wait

        (arg0: Long, arg1: Int): Unit

Attributes

final

Definition Classes

AnyRef

Annotations

                @throws()

      def

        wait

        (arg0: Long): Unit

Attributes

final

Definition Classes

AnyRef

Annotations

                @throws()

Inherited from Eventually

Inherited from PatienceConfiguration

Inherited from AbstractPatienceConfiguration

Inherited from ScaledTimeSpans

Inherited from AnyRef

Inherited from Any


text:
class Physical : public Statistic {
public:
    Physical(QObject *parent = nullptr) : Statistic(parent) {}
    Physical(const Physical *copy) :
        Statistic(copy) {}

    virtual QString getName() override {
        return QString("Physical");
    }
};

#endif //KNOWLEDGE_ENGINEERING_PHYSICAL_H


text:
using namespace std;

static const size_t kBufferSize = 2 * 4096;
bool SoxAudioSource::initialized_ = false;

SoxAudioSource::SoxAudioSource(const string &file_name)
	: format_(0), file_name_(file_name)
{
	if (!initialized_) {
		sox_init();
		initialized_ = true;
	}
	buffer_ = new sox_sample_t[kBufferSize];
}

SoxAudioSource::~SoxAudioSource()
{
	Close();
	delete[] buffer_;
}

bool SoxAudioSource::Open()
{
	Close();
	format_ = sox_open_read(file_name_.c_str(), NULL, NULL, NULL);
	return format_ != 0;
}

void SoxAudioSource::Close()
{
	if (format_) {
		sox_close(format_);
		format_ = 0;
	}
}

int SoxAudioSource::SampleRate()
{
	return static_cast<int>(format_->signal.rate);
}

int SoxAudioSource::Channels()
{
	return format_->signal.channels;
}

std::size_t SoxAudioSource::Read(short *buffer, std::size_t size)
{
	size_t remaining = size;
	short *ptr = buffer;
	while (remaining > 0) {
		size_t res = sox_read(format_, buffer_, std::min(remaining, kBufferSize));
		if (res == SOX_EOF || res == 0) {
			break;
		}
		int clips = 0;
		for (size_t i = 0; i < res; i++) {
			// XXX assumes that short is 16-bit
			SOX_SAMPLE_LOCALS;
			*ptr++ = SOX_SAMPLE_TO_SIGNED_16BIT(buffer_[i], clips);
		}
		remaining -= res;
	}
	//cout << "read " << size - remaining << "\n";
	return size - remaining;
}


text:
    <?php require 'index/banner.php'; ?>

    <?php require 'index/velke_menu_var_1.php'; ?>

            <?php require 'index/velke_menu_var_2.php'; ?>

            <?php require 'index/velke_menu_var_3.php'; ?>

    <?php require 'index/content_content_block.php'; ?>


text:
package org.pushandplay.cordova.apprate;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager;
import android.content.pm.ApplicationInfo;

public class AppRate extends CordovaPlugin {
	@Override
	public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException
	{
		try {
			PackageManager packageManager = this.cordova.getActivity().getPackageManager();

			if (action.equals("getAppVersion")){
				callbackContext.success(packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName);
				return true;
			}
			if (action.equals("getAppTitle")) {
				ApplicationInfo applicationInfo = packageManager.getApplicationInfo(this.cordova.getActivity().getApplicationContext().getApplicationInfo().packageName, 0);
				final String applicationName = (String) (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : "Unknown");

                callbackContext.success(applicationName);

                return true;
			}
			return false;
		} catch (NameNotFoundException e) {
			callbackContext.success("N/A");
			return true;
		}
	}
}


text:
import unittest
import webtest

import test_env_setup

from google.appengine.ext import testbed

import game_model
import team_editor
import tweets
import web_test_base

class TeamEditorTest(web_test_base.WebTestBase):
  def setUp(self):
    super(TeamEditorTest, self).setUp()
    self.testapp = webtest.TestApp(team_editor.app)

    game_model.Team(
        score_reporter_id='%3d').put()
    game_model.Team(
        score_reporter_id='%8d').put()

  def tearDown(self):
    # Reset the URL stub to the original function
    self.testbed.deactivate()

  def testSanityGet_viewTeams(self):
    response = self.testapp.get('/teams/view')
    self.assertEqual(200, response.status_int)
    # URL params are encoded.
    self.assertIn('%253d', response.body)
    self.assertIn('%258d', response.body)

  def testSanityGet_editTeam(self):
    game_model.FullTeamInfo(
        id='%3d', name='bruisers').put()
    response = self.testapp.get('/teams/edit?id=%253d')
    self.assertEqual(200, response.status_int)
    self.assertIn('%253d', response.body)
    self.assertIn('bruisers', response.body)
    # Verify the USAU link is present.
    self.assertIn('Eventteam', response.body)

  def testSanityPost(self):
    game_model.FullTeamInfo(
        id='%3d', name='bruisers').put()
    params = {
      'id': '%253d',
      'screen_name': 'bruisers',
    }

    # Need to fake the response from Twitter for UserList.
    content_items = [
        '"id_str":"2525"',
        '"id":2525',
        '"screen_name":"bruisers"',
    ]
    self.return_content = ['[{%s}]' % ','.join(content_items)]

    response = self.testapp.post('/teams/edit', params=params)
    self.assertEqual(200, response.status_int)
    self.assertIn('%3d', response.body)
    self.assertIn('2525', response.body)

    teams = game_model.Team.query(game_model.Team.twitter_id == 2525).fetch(1)
    self.assertEqual(1, len(teams))


text:
var express = require('express');
var bodyParser = require('body-parser');

var app = express();
app.use(bodyParser.json());

app.use('/task-list', require('./routes/task-list'));

app.listen(process.env.PORT || 57844);


text:
// Type definitions for bro-fs 0.4
// Project: https://github.com/vitalets/bro-fs#readme
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="filesystem" />

export type TextType = 'Text' | 'BinaryString' | 'DataURL';

export interface FSOptions {
    bytes?: number;
    /**
     * show request quota popup for PERSISTENT type
     * (for Chrome extensions with `unlimitedStorage` permission it is useful to pass `options.requestQuota = false`)
     */
    requestQuota?: boolean;
    /** `window.PERSISTENT` | `window.TEMPORARY` */
    type?: number;
}

export interface StatObject {
    fullPath: string;
    isDirectory: boolean;
    isFile: boolean;
    modificationTime: Date;
    name: string;
    size: number;
}

export interface UsageObject {
    grantedBytes: number;
    usedBytes: number;
}

export function appendFile(path: string | FileEntry, data: string |  Blob | File | ArrayBuffer): Promise<FileSystem>;
export function clear(): Promise<undefined[]>;
export function copy(oldPath: string | FileEntry, newPath: string, options?: {create?: boolean}): Promise<FileEntry>;
export function exists(path: string): Promise<boolean>;
export function getEntry(path: FileEntry): Promise<FileEntry>;
export function getRoot(): Promise<DirectoryEntry>;
export function getUrl(path: string | FileEntry): Promise<string>;
export function init(options?: FSOptions): Promise<FileSystem>;
export function isSupported(): boolean;
export function mkdir(path: string): Promise<DirectoryEntry>;
export function readdir(path: string | DirectoryEntry, options?: {deep?: boolean}): Promise<FileEntry[]>;
export function readFile(path: string | FileEntry, options: {type: 'ArrayBuffer'}): Promise<ArrayBuffer>;
export function readFile(path: string | FileEntry, options: {type: 'Blob'}): Promise<Blob>;
export function readFile(path: string | FileEntry, options: {type: 'File'}): Promise<File>;
export function readFile(path: string | FileEntry, options?: {type?: TextType}): Promise<string>;
export function rename(oldPath: string | FileEntry, newPath: string,  options?: {create?: boolean}): Promise<FileEntry>;
export function rmdir(path: string | DirectoryEntry): Promise<boolean>;
export function stat(path: string | FileEntry): Promise<StatObject>;
export function unlink(path: string | FileEntry): Promise<boolean>;
export function usage(): Promise<UsageObject>;
export function writeFile(path: string, data: string | Blob | File | ArrayBuffer): Promise<FileEntry>;


text:
'use strict';

describe('Controller: AddExpenseCtrl', function () {

  // load the controller's module
  beforeEach(module('ExpenseManagerApp'));

  var AddExpenseCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    AddExpenseCtrl = $controller('AddExpenseCtrl', {
      $scope: scope
    });
  }));

  it('should attach a list of awesomeThings to the scope', function () {
    expect(scope.awesomeThings.length).toBe(3);
  });
});


text:
function Get-MergeTasks([hashtable] $pp) {
    $tasks = @()
    $tasks += '!'* $pp.NoDesktopIcon           + 'desktopicon'
    $tasks += '!'* $pp.NoQuicklaunchIcon       + 'quicklaunchicon'
    $tasks += '!'* $pp.NoAddContextMenuFiles   + 'addcontextmenufiles'
    $tasks += '!'* $pp.NoAddContextMenuFolders + 'addcontextmenufolders'
    $tasks += '!'*!$pp.AssociateWithFiles      + 'associatewithfiles'
    $tasks += '!'* $pp.NoAddToPath             + 'addtopath'
    $tasks += '!'                              + 'runCode'

    Write-Host "Merge Tasks: $tasks"
    return $tasks -join ','
}

function Close-VSCodium {
    Get-Process vscodium -ea 0 | ForEach-Object { $_.CloseMainWindow() | Out-Null }
    Start-Sleep 1
    Get-Process vscodium -ea 0 | Stop-Process  #in case gracefull shutdown did not succeed, try hard kill
}


text:
package parts

import (
	"github.com/google/gxui/mixins/outer"
)

type VisibleOuter interface {
	outer.Redrawer
	outer.Parenter
}

type Visible struct {
	outer   VisibleOuter
	visible bool
}

func (v *Visible) Init(outer VisibleOuter) {
	v.outer = outer
	v.visible = true
}

func (v *Visible) IsVisible() bool {
	return v.visible
}

func (v *Visible) SetVisible(visible bool) {
	if v.visible != visible {
		v.visible = visible
		if p := v.outer.Parent(); p != nil {
			p.Redraw()
		}
	}
}


text:
/* @(#) floor() an image ... no promotion, so output type == input type
 * @(#)
 * @(#) int
 * @(#) im_floor( in, out )
 * @(#) IMAGE *in, *out;
 * @(#)
 * @(#) Returns 0 on success and -1 on error
 * @(#)
 *
 * 20/6/02 JC
 *	- adapted from im_abs()
 * 8/12/06
 * 	- add liboil support
 */

/*

    This file is part of VIPS.

    VIPS is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 */

/*

    These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk

 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>

#include <vips/vips.h>
#include <vips/internal.h>

#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
#endif /*HAVE_LIBOIL*/

#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/

#define floor_loop(TYPE)\
	{\
		TYPE *p = (TYPE *) in;\
		TYPE *q = (TYPE *) out;\
		\
		for( x = 0; x < sz; x++ )\
			q[x] = floor( p[x] );\
	}

/* Ceil a buffer of PELs.
 */
static void
floor_gen( PEL *in, PEL *out, int width, IMAGE *im )
{
	int x;
	int sz = width * im->Bands;

        switch( im->BandFmt ) {
        case IM_BANDFMT_FLOAT:
#ifdef HAVE_LIBOIL
		oil_floor_f32( (float *) out, (float *) in, sz );
#else /*!HAVE_LIBOIL*/
		floor_loop(float);
#endif /*HAVE_LIBOIL*/
		break;

        case IM_BANDFMT_DOUBLE:		floor_loop(double); break;
        case IM_BANDFMT_COMPLEX:	sz *= 2; floor_loop(float); break;
        case IM_BANDFMT_DPCOMPLEX:	sz *= 2; floor_loop(double); break;

        default:
		assert( 0 );
        }
}

/* Ceil of image.
 */
int
im_floor( IMAGE *in, IMAGE *out )
{
	/* Check args.
	 */
	if( in->Coding != IM_CODING_NONE ) {
		im_error( "im_floor", _( "not uncoded" ) );
		return( -1 );
	}

	/* Is this one of the int types? Degenerate to im_copy() if it
	 * is.
	 */
	if( im_isint( in ) )
		return( im_copy( in, out ) );

	/* Output type == input type.
	 */
	if( im_cp_desc( out, in ) )
		return( -1 );

	/* Generate!
	 */
	if( im_wrapone( in, out,
		(im_wrapone_fn) floor_gen, in, NULL ) )
		return( -1 );

	return( 0 );
}


text:
class ComponentsController < ApplicationController
  def index
    if params[:component]
      component_name = params[:component].gsub("::", "_").underscore
      render :inline => "<%= netzke :#{component_name}, :class_name => '#{params[:component]}', :height => 400 %>", :layout => true
    else
      redirect_to root_path
    end
  end
end