text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.9
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace org.doubango.tinyWRAP {

using System;
using System.Runtime.InteropServices;

public class ProxyAudioConsumerCallback : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal ProxyAudioConsumerCallback(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(ProxyAudioConsumerCallback obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~ProxyAudioConsumerCallback() {
    Dispose();
  }

  public virtual void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          tinyWRAPPINVOKE.delete_ProxyAudioConsumerCallback(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
    }
  }

  public ProxyAudioConsumerCallback() : this(tinyWRAPPINVOKE.new_ProxyAudioConsumerCallback(), true) {
    SwigDirectorConnect();
  }

  public virtual int prepare(int ptime, int rate, int channels) {
    int ret = (SwigDerivedClassHasMethod("prepare", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_prepareSwigExplicitProxyAudioConsumerCallback(swigCPtr, ptime, rate, channels) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_prepare(swigCPtr, ptime, rate, channels));
    return ret;
  }

  public virtual int start() {
    int ret = (SwigDerivedClassHasMethod("start", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_startSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_start(swigCPtr));
    return ret;
  }

  public virtual int pause() {
    int ret = (SwigDerivedClassHasMethod("pause", swigMethodTypes2) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_pauseSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_pause(swigCPtr));
    return ret;
  }

  public virtual int stop() {
    int ret = (SwigDerivedClassHasMethod("stop", swigMethodTypes3) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_stopSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_stop(swigCPtr));
    return ret;
  }

  private void SwigDirectorConnect() {
    if (SwigDerivedClassHasMethod("prepare", swigMethodTypes0))
      swigDelegate0 = new SwigDelegateProxyAudioConsumerCallback_0(SwigDirectorprepare);
    if (SwigDerivedClassHasMethod("start", swigMethodTypes1))
      swigDelegate1 = new SwigDelegateProxyAudioConsumerCallback_1(SwigDirectorstart);
    if (SwigDerivedClassHasMethod("pause", swigMethodTypes2))
      swigDelegate2 = new SwigDelegateProxyAudioConsumerCallback_2(SwigDirectorpause);
    if (SwigDerivedClassHasMethod("stop", swigMethodTypes3))
      swigDelegate3 = new SwigDelegateProxyAudioConsumerCallback_3(SwigDirectorstop);
    tinyWRAPPINVOKE.ProxyAudioConsumerCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
  }

  private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
    System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
    bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyAudioConsumerCallback));
    return hasDerivedMethod;
  }

  private int SwigDirectorprepare(int ptime, int rate, int channels) {
    return prepare(ptime, rate, channels);
  }

  private int SwigDirectorstart() {
    return start();
  }

  private int SwigDirectorpause() {
    return pause();
  }

  private int SwigDirectorstop() {
    return stop();
  }

  public delegate int SwigDelegateProxyAudioConsumerCallback_0(int ptime, int rate, int channels);
  public delegate int SwigDelegateProxyAudioConsumerCallback_1();
  public delegate int SwigDelegateProxyAudioConsumerCallback_2();
  public delegate int SwigDelegateProxyAudioConsumerCallback_3();

  private SwigDelegateProxyAudioConsumerCallback_0 swigDelegate0;
  private SwigDelegateProxyAudioConsumerCallback_1 swigDelegate1;
  private SwigDelegateProxyAudioConsumerCallback_2 swigDelegate2;
  private SwigDelegateProxyAudioConsumerCallback_3 swigDelegate3;

  private static Type[] swigMethodTypes0 = new Type[] { typeof(int), typeof(int), typeof(int) };
  private static Type[] swigMethodTypes1 = new Type[] {  };
  private static Type[] swigMethodTypes2 = new Type[] {  };
  private static Type[] swigMethodTypes3 = new Type[] {  };
}

}


text:
int	g_be_message_out = 1;

BattlEyeSystem::BattlEyeSystem()
{
	client = NULL;
	server = NULL;

	m_test_load_client = false;
//-	auto_update = 1;
}

BattlEyeSystem::~BattlEyeSystem()
{
	xr_delete( client );
	xr_delete( server );
}

void BattlEyeSystem::SetServerPath( LPCSTR path )
{
	VERIFY( path );
	m_server_path._set( path );
}

void BattlEyeSystem::SetClientPath( LPCSTR path )
{
	VERIFY( path );
	m_client_path._set( path );
}

LPCSTR	BattlEyeSystem::GetServerPath()
{
	return m_server_path.c_str();
}

LPCSTR	BattlEyeSystem::GetClientPath()
{
	return m_client_path.c_str();
}

bool BattlEyeSystem::ReloadServerDLL( xrServer* xr_server )
{
	xr_delete( server );
	server = NULL;

	LPCSTR			dll_file_name = m_server_path.c_str();
	string_path		old_file_name;
	string_path		new_file_name;
	string_path		err_file_name;

	strconcat( sizeof(old_file_name), old_file_name, dll_file_name, ".old" );
	strconcat( sizeof(new_file_name), new_file_name, dll_file_name, ".new" );
	strconcat( sizeof(err_file_name), err_file_name, dll_file_name, ".error" );

	if ( rename( dll_file_name, old_file_name ) )
	{
		Msg( "! Could not rename %s to %s", dll_file_name, old_file_name );
		return false;
	}
	if ( rename( new_file_name, dll_file_name ) )
	{
		Msg( "! Could not rename %s to %s", new_file_name, dll_file_name );
		return false;
	}

	server = xr_new<BattlEyeServer>( xr_server );
	if ( server->IsLoaded() ) // (1) if loaded from BEServer.dll (new version)
	{
		server->AddConnectedPlayers();
		if ( !DeleteFile( old_file_name ) )
		{
			Msg( "! Could not delete old %s", old_file_name );
			//return _false;
		}
		return true;
	}

	xr_delete( server );
	server = NULL;

	if ( rename( dll_file_name, err_file_name ) )
	{
		Msg( "! Could not rename %s to %s", dll_file_name, err_file_name );
		return false;
	}
	if ( rename( old_file_name, dll_file_name ) )
	{
		Msg( "! Could not rename %s to %s", old_file_name, dll_file_name );
		return false;
	}

	server = xr_new<BattlEyeServer>( xr_server );
	if ( server->IsLoaded() ) // (2) if loaded from BEServer.dll (prev version)
	{
		server->AddConnectedPlayers();
		return true;
	}

	xr_delete( server );
	server = NULL;
	return false;
}

bool BattlEyeSystem::ReloadClientDLL()
{
	xr_delete( client );
	client = NULL;

	LPCSTR			dll_file_name = m_client_path.c_str();
	string_path		old_file_name;
	string_path		new_file_name;
	string_path		err_file_name;
	strconcat( sizeof(old_file_name), old_file_name, dll_file_name, ".old" );
	strconcat( sizeof(new_file_name), new_file_name, dll_file_name, ".new" );
	strconcat( sizeof(err_file_name), err_file_name, dll_file_name, ".error" );

	if ( rename( dll_file_name, old_file_name ) )
	{
		Msg( "! Could not rename %s to %s", dll_file_name, old_file_name );
		return false;
	}
	if ( rename( new_file_name, dll_file_name ) )
	{
		Msg( "! Could not rename %s to %s", new_file_name, dll_file_name );
		return false;
	}

	client = xr_new<BattlEyeClient>();
	if ( client->IsLoaded() ) // (1) if loaded from BEClient.dll (new version)
	{
		if ( !DeleteFile( old_file_name ) )
		{
			Msg( "! Could not delete old %s", old_file_name );
			//return _false;
		}
		return true;
	}

	xr_delete( client );
	client = NULL;

	if ( rename( dll_file_name, err_file_name ) )
	{
		Msg( "! Could not rename %s to %s", dll_file_name, err_file_name );
		return false;
	}
	if ( rename( old_file_name, dll_file_name ) )
	{
		Msg( "! Could not rename %s to %s", old_file_name, dll_file_name );
		return false;
	}

	client = xr_new<BattlEyeClient>();
	if ( client->IsLoaded() ) // (2) if loaded from BEClient.dll (prev version)
	{
		return true;
	}

	xr_delete( client );
	client = NULL;
	return false;
}

bool BattlEyeSystem::LoadClient()
{
	//if ( Level().IsClient() )
	{
		if ( client )
		{
			return true;
		}
		client = xr_new<BattlEyeClient>();
		if ( client->IsLoaded() )
		{
			return true;
		}
		xr_delete( client );
		client = NULL;
		Msg( "! Error loading BattlEye Client!" );
		MainMenu()->OnLoadError( BATTLEYE_CLIENT_DLL );
	}
	return false;
}

bool BattlEyeSystem::LoadServer( xrServer* xr_server )
{
	if ( server )
	{
		return true;
	}
	server = xr_new<BattlEyeServer>( xr_server );
	if ( server->IsLoaded() )
	{
		return true;
	}
	xr_delete( server );
	server = NULL;

	Msg( "! Error loading BattlEye Server!" );
	MainMenu()->OnLoadError( BATTLEYE_SERVER_DLL );
	return false;
}

void BattlEyeSystem::UpdateClient()
{
	if ( !client )
	{
		return;
	}
	if ( !client->Run() )
	{
		ReloadClientDLL();
	}
}

void BattlEyeSystem::UpdateServer( xrServer* xr_server )
{
	if ( !server )
	{
		return;
	}
	if ( !server->Run() )
	{
		ReloadServerDLL( xr_server );
	}
}

void BattlEyeSystem::ReadPacketClient( NET_Packet* pack )
{
	if ( !client )
	{
		return;
	}
	u32 len;
	pack->r_u32( len );

	void* data = xr_malloc( len );
	pack->r( data, len );

	client->NewPacket( data, len );
	xr_delete( data );
}

void BattlEyeSystem::ReadPacketServer( u32 sender, NET_Packet* pack )
{
	if ( !server )
	{
		return;
	}
	u32 len;
	pack->r_u32( len );

	void* data = xr_malloc( len );
	pack->r( data, len );

	server->NewPacket( sender, data, len );
	xr_delete( data );
}

bool BattlEyeSystem::TestLoadClient()
{
	m_test_load_client = false;
	if ( g_dedicated_server )
	{
		return true; //false = Error
	}

	if ( LoadClient() ) // test load
	{
		xr_delete( client );
		client = NULL;

		m_test_load_client = true;
	}
	return m_test_load_client;
}

bool BattlEyeSystem::InitDir()
{
	string_path		dir_be;
	FS.update_path( dir_be, "$app_data_root$", "" );
	strcat_s( dir_be, sizeof(dir_be), BATTLEYE_DIR );

	if( FS.can_write_to_folder(dir_be) == NULL )
	{
		if ( !CreateDirectory( dir_be, NULL ) )
		{
			Msg( "! Cannot make folder >>> %s", dir_be );
			return false;
		}
	}

	string_path		fn_sv;
	if ( !InitDLL( BATTLEYE_SERVER_DLL, fn_sv ) )
	{
		return false;
	}
	SetServerPath( fn_sv );

	string_path		fn_cl;
	if ( !InitDLL( BATTLEYE_CLIENT_DLL, fn_cl ) )
	{
		return false;
	}
	SetClientPath( fn_cl );

	return true;
}

bool BattlEyeSystem::InitDLL( LPCSTR dll_name, string_path& out_file )
{
	FILE* ft;
	FS.update_path( out_file, "$app_data_root$", "" );
	strcat_s( out_file, sizeof(out_file), dll_name );

	ft = fopen( out_file, "r" );
	if( ft == NULL )
	{
		HMODULE h_game = GetModuleHandle("xrGame.dll");
		R_ASSERT( h_game );

		string_path cur_dir, full_dir;
		GetModuleFileName( h_game, full_dir, sizeof(full_dir) );

		string_path		fn_orig;
		string16		disk, ext;
		string64		fn_temp;
		_splitpath( full_dir, disk, cur_dir, fn_temp, ext );
		strconcat( sizeof(fn_orig), fn_orig, disk, cur_dir, dll_name );

		ft = fopen( fn_orig, "r" );
		if( ft == NULL )
		{
			Msg( "! File not found >>> %s", fn_orig );
			return false;
		}
		fclose( ft );

		CopyFile( fn_orig, out_file, FALSE );
		ft = fopen( out_file, "r" );
		if( ft == NULL )
		{
			Msg( "! File not found >>> %s", out_file );
			return false;
		}
		fclose( ft );
	}
	fclose( ft );
	return true;
}

#endif // BATTLEYE

redpajama_set_name: RedPajamaGithub


text:
package org.arabidopsis.ahocorasick;

import java.util.Set;

/**
 *
Holds the result of the search so far.  Includes the outputs where the search finished as
 *  well as the last index of the matching.

 *
 *
(Internally, it also holds enough state to continue a running search, though this is not
 *   exposed for public use.)

 */
public class SearchResult {
  State lastMatchedState;
  char[] chars;
  int lastIndex;

  SearchResult(State s, char[] bs, int i) {
    this.lastMatchedState = s;
    this.chars = bs;
    this.lastIndex = i;
  }

  /**
   * Returns a list of the outputs of this match.
   */
  public Set<Object> getOutputs() {
    return lastMatchedState.getOutputs();
  }

  /**
   * Returns the index where the search terminates.  Note that this is one char after the last
   * matching character.
   */
  public int getLastIndex() {
    return lastIndex;
  }
}


text:
package org.eclipse.rdf4j.spring.uuidsource.noveltychecking;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @since 4.0.0
 * @author Florian Kleedorfer
 */
@Configuration
@ConditionalOnProperty(prefix = "rdf4j.spring.uuidsource.noveltychecking", name = "enabled")
@EnableConfigurationProperties(NoveltyCheckingUUIDSourceProperties.class)
public class NoveltyCheckingUUIDSourceConfig {
	@Bean
	public NoveltyCheckingUUIDSource getUUIDSource() {
		return new NoveltyCheckingUUIDSource();
	}
}


text:
const React = require('react');
const Chance = require('chance');
const Clipboard = require('clipboard-js');
const IpsigmaTypeSelect = require('./IpsigmaTypeSelect');

const chance = new Chance();

class IpsigmaGenerator extends React.Component {
    constructor(props) {
        super(props);

        // Define our initial state.
        this.state = {
            output: '',             // Initial output for the text box.
            paragraphCount: 3,      // Initial value for number of paragraphs to generate
            sentenceEndings:        // Punctuation marks that can end sentences. Adding duplicates increases their likelihood.
                ['.', '.', '.', '!', '?'],
            type: 'Pikachu',        // Initial value for the type of lipsum to generate
            types: [                // Schema for the different types of generation available.
                {
                    name: "Pikachu",
                    words: ["pikachu", "pika", "chuchu", "pikapi", "pikaaa", "pipika", "kachu", "pipikachu", "piiikachu", "pi", "kachuuu", "chu"]
                },
                {
                    name: "Bulbasaur",
                    words: ["bulbasaur", "bulba", "bulbabulb", "saur", "sauur", "bulbasaaaur", "bul", "bulbulbasaur", "bulbabulba", "bulbasaaaaur"]
                },
                {
                    name: "Charmander",
                    words: ["charmander", "charchar", "char", "charcharchar", "chaaaarmander", "charcharmander", "chaaaar", "mander"]
                }
            ]
        };
    }

   render() {
       return (

{this.props.appName || "Ipsigma"}

                       Type
                       <IpsigmaTypeSelect types={this.state.types} onChange={this.setType.bind(this)} />

                       # of Paragraphs
                       <input className="form-control" type="number" onChange={this.onParagraphCountUpdated.bind(this)} defaultValue={this.state.paragraphCount} />

                   <button className="btn btn-primary" onClick={this.generate.bind(this)}>Generate Ipsum</button>

                   <button className="btn btn-primary" onClick={this.copyToClipboard.bind(this)}>Copy to Cliboard</button>

                   <textarea rows="10" className="form-control" value={this.state.output} />

       );
   }

    /**
     * Uses Clipboard.js to put the current contents of the output textarea into the clipboard.
     */
   copyToClipboard() {
        Clipboard.copy(this.state.output);
   }

    /**
     * The primary lipsum generation function. Puts its result in the state rather than returning.
     */
   generate() {
       let output = '';

       for(let i=0; i<this.state.paragraphCount; i++) {
           // Generate the next paragraph
           output += this.generateParagraph();

           // If this isn't the last paragraph, we need to append 2 line breaks
           if(i+1 < this.state.paragraphCount) {
               output += "\r\n\r\n";
           }
       }

       // Put the final, combined output in the state so that React will display in the UI
       this.setState({output: output});
   }

    /**
     * Generates a single paragraph of lipsum and returns it.
     * @returns {string}
     */
   generateParagraph() {
       let output = '';
       let isSentenceStart = true;

       this.state.types.forEach((typeDef) => {
           // Is this the right type definition?
           if(typeDef.name === this.state.type) {
               // Each paragraph will be 50 - 75 words.
               let paragraphLength = 50 + chance.integer({min:0, max: 25});

               for(let i=0; i<paragraphLength; i++) {
                   let word = typeDef.words[chance.integer({min:0, max:typeDef.words.length-1})];

                   // If this is the first word of a new sentence, we need to capitalize it.
                   if(isSentenceStart) {
                       word = word.charAt(0).toUpperCase() + word.slice(1);
                       isSentenceStart = false;
                   }

                   output += word;

                   if(i !== (paragraphLength-1)) {
                       // Generate a random value that will be used to randomly sprinkle in punctuation.
                       let punctValue = chance.integer({min:1, max:10});

                       if(punctValue === 10) { // Randomly, 10% of the time, end the sentence.
                           output += this.state.sentenceEndings[chance.integer({min:0, max:this.state.sentenceEndings.length-1})];
                           isSentenceStart = true;
                       } else if(punctValue === 9) { // Randomly, 10% of the time, throw in a comma.
                           output += ",";
                       }

                       // Regardless of the above, since this isn't the last word, we need a space.
                       output += " ";
                   } else {
                       // This is the last word, so we should make sure it ends with some form of sentence-ending punctuation.
                       output += this.state.sentenceEndings[chance.integer({min:0, max:this.state.sentenceEndings.length-1})];
                   }
               }
           }
       });
       return output;
   }

    /**
     * Sets the type of lipsum to generate.
     * @param type
     */
   setType(type) {
       this.state.type = type;
   }

    /**
     * Updates the state whenever the paragraph count is updated.
     * @param e
     */
   onParagraphCountUpdated(e) {
        this.setState({paragraphCount: e.target.value});
   }
}

module.exports = IpsigmaGenerator;


text:
package edu.wisc.my.portlets.bookmarks.web.support;

import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;

/**
 * Uses the configured bookmarkSetName as a key into the PortletPreferences to resolve the
 * name of the BookmarkSet for the request.
 *
 * @author Eric Dalquist eric.dalquist@doit.wisc.edu
 * @version $Revision: 12161 $
 */
public class PortletPreferencesBookmarkSetNameResolver implements NameResolver {
    /** Constant DEFAULT_BOOKMARK_SET_NAME="bookmarkSetName" */
    public static final String DEFAULT_BOOKMARK_SET_NAME = "bookmarkSetName";

    private String bookmarkSetName = DEFAULT_BOOKMARK_SET_NAME;

    /**
     *
Getter for the field bookmarkSetName.

     *
     * @return Returns the bookmarkSetName.
     */
    public String getBookmarkSetName() {
        return this.bookmarkSetName;
    }

    /**
     *
Setter for the field bookmarkSetName.

     *
     * @param bookmarkSetName The bookmarkSetName to set.
     */
    public void setBookmarkSetName(String bookmarkSetName) {
        this.bookmarkSetName = bookmarkSetName;
    }

    /** {@inheritDoc} */
    public String getBookmarkSetName(PortletRequest request) {
        final PortletPreferences prefs = request.getPreferences();
        return prefs.getValue(this.bookmarkSetName, null);
    }
}


text:
import {fromJS, Map, List, Set} from 'immutable'
import DoubleMap from '../util/DoubleMap'
import {ADD, REMOVE, CHANGE} from './commands'

function changeCourse(state,action){
  let cid = String(action.id)
  return state.setIn(['courses',cid].concat(action.subfield),action.to)
}

function addCourse(state,action){
  let instructor = action.id
  let cids = state.get('courses').map(x => x.get('cid')).toList().toJS()
  let cid = (cids.length > 0 ? String(Math.max(...cids) + 1) : "1")
  return state.withMutations(s =>
    s.updateIn(['instructors',instructor,'courses'],Set(),x => x.add(cid)).
      setIn(['courses',cid],Map({
        quarter: "fall",
        number: 0,
        name: "New Course",
        instructor: instructor,
        cid: cid,
        hours: Map({range: List([1,1]), total: 7.5})
      })))
}

function removeCourse(state,action){
  let cid = String(action.id)
  let instructor = state.getIn(['courses',cid,'instructor'])
  return state.withMutations(s =>
    s.deleteIn(['courses',cid]).
      update('assignments',asg => asg.delete(null,cid)).
      updateIn(['instructors',instructor,'courses'],x => x.remove(cid)))
}

export default function course(state,action){
  switch(action.command){
    case ADD: return addCourse(state,action)
    case REMOVE: return removeCourse(state,action)
    case CHANGE: return changeCourse(state,action)
    default: return state
  }
}


text:
namespace MyMvcProjectTemplate.Web.Infrastructure.Mapping
{
    public interface IMapTo<T>
        where T : class
    {
    }
}


text:
@implementation UIView (CorpFrame)

- (CGFloat) x
{
    return self.frame.origin.x;
}

- (void) setX:(CGFloat)x
{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (CGFloat) y
{
    return self.frame.origin.y;
}

- (void) setY:(CGFloat)y
{
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}

- (CGPoint) origin
{
    return self.frame.origin;
}

- (void) setOrigin:(CGPoint)origin
{
    CGRect frame = self.frame;
    frame.origin = origin;
    self.frame = frame;
}

- (CGFloat) width
{
    return self.frame.size.width;
}

- (void) setWidth:(CGFloat)width
{
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

- (CGFloat) height
{
    return self.frame.size.height;
}

- (void) setHeight:(CGFloat)height
{
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

- (CGSize) size
{
    return self.frame.size;
}

- (void) setSize:(CGSize)size
{
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}

@end

@implementation UIView (CorpSuperOrSubView)

- (void) clearSubView
{
    NSArray *subs = self.subviews;
    if (subs && subs.count > 0) {
        for (UIView *sub in subs) {
            [sub removeFromSuperview];
        }
    }
}

- (NSArray *) allSubviews
{
    if (self  && self.subviews && self.subviews != 0) {
        NSMutableArray *allSubviews = [NSMutableArray array];
        for (UIView *v in self.subviews) {
            [allSubviews addObject:v];
            NSArray *a = [v allSubviews];
            if (a && a.count != 0) {
                [allSubviews addObjectsFromArray:a];
            }
        }
        return allSubviews;
    }
    return nil;
}

- (NSArray *) sortedInputs
{
    NSMutableArray *canBecomeFirstResponders = [NSMutableArray array];
    NSArray *allSubviews = [self allSubviews];
    for (UIView *v in allSubviews) {
        if ([v isKindOfClass:[UITextField class]] && !v.hidden && v.userInteractionEnabled) {
            UITextField *tf = (UITextField *)v;
            if (tf.enabled) {
                [canBecomeFirstResponders addObject:v];
            }
        }

        if ([v isKindOfClass:[UITextView class]] && !v.hidden && v.userInteractionEnabled) {
            UITextView *tv = (UITextView *)v;
            if (tv.editable) {
                [canBecomeFirstResponders addObject:v];
            }
        }
    }

    [canBecomeFirstResponders sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        UIView *v1 = (UIView *)obj1;
        UIView *v2 = (UIView *)obj2;

        CGPoint p1 = [v1 convertPoint:(CGPoint){0, 0} toView:self];
        CGPoint p2 = [v2 convertPoint:(CGPoint){0, 0} toView:self];

        if (p1.y < p2.y) {
            return NSOrderedAscending;
        }
        if (p1.y > p2.y) {
            return NSOrderedDescending;
        }

        if (p1.x < p2.x) {
            return NSOrderedAscending;
        }
        if (p1.x > p2.x) {
            return NSOrderedDescending;
        }

        return NSOrderedSame;
    }];

    return canBecomeFirstResponders.count == 0 ? nil : canBecomeFirstResponders;
}

- (UIView *) superviewWithClass:(Class)clazz
{
    if ([self.superview isKindOfClass:clazz]) {
        return self;
    }
    if (self.superview) {
        return [self.superview superviewWithClass:clazz];
    }
    return nil;
}

@end


text:
<?php

namespace MajorApi\Tests\Functional\Library\Service\Quickbooks;

use MajorApi\AppBundle\Library\Service\Quickbooks\CustomerFinderService;
use MajorApi\AppBundle\Tests\Mixin\FunctionalMixin;
use MajorApi\AppBundle\Tests\TestCase;

use \ArrayObject;

/**
 * @group FunctionalTests
 * @group LibraryTests
 */
class CustomerFinderServiceTest extends TestCase
{

    use FunctionalMixin;

    /**
     * @expectedException \RuntimeException
     */
    public function testFindingCustomerRequiresApplication()
    {
        $service = new CustomerFinderService(static::$kernel->getContainer());
        $service->findByName('Customer McPerson');
    }

    /**
     * @expectedException MajorApi\AppBundle\Library\Service\Exception\Quickbooks\CustomerNotFoundException
     */
    public function testFindingCustomerRequiresCustomerToExist()
    {
        $service = $this->getService();
        $service->findByName('InvalidCustomer');
    }

    public function testFindingCustomer()
    {
        $service = $this->getService();
        $quickbooksCustomer = $service->findByName(static::$fixtures['quickbooksCustomer']->getName());

        $this->assertEquals(static::$fixtures['quickbooksCustomer']->getId(), $quickbooksCustomer->getId());
    }

    public function testFindingLatestCustomers()
    {
        $service = $this->getService();
        $quickbooksCustomers = $service->findLatest(1);

        $this->assertGreaterThan(0, $quickbooksCustomers->count());
        $this->assertEquals(static::$fixtures['quickbooksCustomer']->getId(), $quickbooksCustomers[0]->getId());
    }

    private function getService()
    {
        $service = new CustomerFinderService(static::$kernel->getContainer());
        $service->setApplication(static::$fixtures['application']);

        return $service;
    }

}


text:
require 'test_helper'
require 'routes_upgrader'

# Stub out methods on upgrader class
module Rails
  module Upgrading
    class RoutesUpgrader
      attr_writer :routes_code

      def has_routes_file?
        true
      end

      def routes_code
        @routes_code
      end
    end

    class RouteGenerator
      def app_name
        "MyApplication"
      end
    end
  end
end

class RoutesUpgraderTest < ActiveSupport::TestCase
  def setup
    Rails::Upgrading::RouteRedrawer.stack = []
  end

  def test_generates_routes_file
    routes_code = "
      ActionController::Routing::Routes.draw do |map|
        map.connect '/home', :controller => 'home', :action => 'index'
        map.login '/login', :controller => 'sessions', :action => 'new'

        map.resources :hats
        map.resource :store
      end
    "

    new_routes_code = "MyApplication::Application.routes.draw do
  match '/home' => 'home#index'
  match '/login' => 'sessions#new', :as => :login
  resources :hats
  resource :store
end
"

    upgrader = Rails::Upgrading::RoutesUpgrader.new
    upgrader.routes_code = routes_code

    result = upgrader.generate_new_routes

    assert_equal new_routes_code, result
  end

  def test_generates_code_for_regular_route
    route = Rails::Upgrading::FakeRoute.new("/about", {:controller => 'static', :action => 'about'})
    assert_equal "match '/about' => 'static#about'", route.to_route_code
  end

  def test_generates_code_for_named_route
    route = Rails::Upgrading::FakeRoute.new("/about", {:controller => 'static', :action => 'about'}, "about")
    assert_equal "match '/about' => 'static#about', :as => :about", route.to_route_code
  end

  def test_generates_code_for_namespace
    ns = Rails::Upgrading::FakeNamespace.new("static")
    # Add a route to the namespace
    ns << Rails::Upgrading::FakeRoute.new("/about", {:controller => 'static', :action => 'about'})

    assert_equal "namespace :static do\nmatch '/about' => 'static#about'\nend\n", ns.to_route_code
  end

  def test_generates_code_for_resources
    route = Rails::Upgrading::FakeResourceRoute.new("hats")
    assert_equal "resources :hats", route.to_route_code
  end

  def test_generates_code_for_resources
    route = Rails::Upgrading::FakeSingletonResourceRoute.new("hat")
    assert_equal "resource :hat", route.to_route_code
  end

  def test_generates_code_for_resources_with_special_methods
    route = Rails::Upgrading::FakeResourceRoute.new("hats", {:member => {:wear => :get}, :collection => {:toss => :post}})
    assert_equal "resources :hats do\ncollection do\npost :toss\nend\nmember do\nget :wear\nend\n\nend\n", route.to_route_code
  end

  def test_generates_code_for_route_with_extra_params
    route = Rails::Upgrading::FakeRoute.new("/about", {:controller => 'static', :action => 'about', :something => 'extra'})
    assert_equal "match '/about' => 'static#about', :something => 'extra'", route.to_route_code
  end

  def test_generates_code_for_route_with_requirements
    route = Rails::Upgrading::FakeRoute.new("/foo", {:controller => 'foo', :action => 'bar', :requirements => {:digit => /%d/}})
    assert_equal "match '/foo' => 'foo#bar', :constraints => { :digit => /%d/ }", route.to_route_code
  end

  def test_generates_code_for_root
    routes_code = "
      ActionController::Routing::Routes.draw do |map|
        map.root :controller => 'home', :action => 'index'
      end
    "

    new_routes_code = "MyApplication::Application.routes.draw do
  match '/' => 'home#index'
end
"

    upgrader = Rails::Upgrading::RoutesUpgrader.new
    upgrader.routes_code = routes_code

    result = upgrader.generate_new_routes

    assert_equal new_routes_code, result
  end

  def test_generates_code_for_default_route
    routes_code = "
      ActionController::Routing::Routes.draw do |map|
        map.connect ':controller/:action/:id.:format'
        map.connect ':controller/:action/:id'
      end
    "

    new_routes_code = "MyApplication::Application.routes.draw do
  match '/:controller(/:action(/:id))'
end
"

    upgrader = Rails::Upgrading::RoutesUpgrader.new
    upgrader.routes_code = routes_code

    result = upgrader.generate_new_routes

    assert_equal new_routes_code, result
  end
end


text:
@interface MPCReceiptPageControl : UIViewController <UIPageViewControllerDataSource,UIScrollViewDelegate>

@property (strong, nonatomic) IBOutlet UIScrollView *containerScroll;
@property (strong, nonatomic) UIPageViewController *pageController;
@property BOOL isMainPoint;
@property (strong, nonatomic) NSDictionary *receiptDict;

@end


text:
<?php
/*
* File: Payload.php
* Category: -
* Author: MSG
* Created: 05.03.17 05:41
* Updated: -
*
* Description:
*  -
*/

namespace Webklex\GitHook\Payload;

class Payload {

    /**
     * Payload holder
     * @var array $aPayload
     */
    protected $aPayload = [];

    /**
     * Map all required attributes
     * @var array $map
     */
    protected $map = [
        'commits' => [[
            'id' => null,
            'timestamp' => null,
            'message' => null,
            'url' => null,
            'author' => [
                'name' => null,
                'email' => null,
            ],
        ]],
        'repository' => [
            'name' => null,
            'description' => null,
            'url' => null,
            'homepage' => null,
        ],
        'ref' => null,
        'user_name' => null,
        'before' => null,
        'after' => null,
    ];

    /**
     * Cast any mapped value to a given schema
     * @var array $casts
     */
    protected $casts = [];

    /**
     * Payload constructor.
     */
    public function __construct() {}

    /**
     * Parse a payload string into the service
     * @param $payload
     *
     * @return $this
     */
    public function parsePayload($payload){
        if($this->isJson($payload)){
            $this->aPayload = $this->validate(json_decode($payload, true), $this->map);
            $this->castPayload();
        }

        return $this;
    }

    /**
     * Check if a given string is valid JSON
     * @param $string string
     * @return bool
     */
    public function isJson($string) {
        json_decode($string);
        return (json_last_error() == JSON_ERROR_NONE);
    }

    /**
     * Validate and map a given payload recursive
     * @param array $aPayload
     * @param array $aMap
     *
     * @return array
     */
    public function validate(array $aPayload, array $aMap){
        $payload = [];
        foreach($aMap as $key => $map){
            if($map === ''){
                $payload[$key] = '';
            }elseif(isset($aPayload[$key])){
                if(is_array($aPayload[$key])){
                    $payload[$key] = $this->validate($aPayload[$key], $map);
                }elseif($map != null){
                    $payload[$key] = $this->getPayloadValue($map, $aPayload);
                }else{
                    $payload[$key] = $aPayload[$key];
                }
            }elseif(is_array($map)){
                $payload[$key] = [];

                foreach($map as $k => $m){
                    if(is_array($m)){
                        $payload[$key][$k] = $this->validate($aPayload, $m);
                    }elseif($m != null){
                        $payload[$key][$k] = $this->getPayloadValue($m, $aPayload);
                    }elseif($m === ''){
                        $payload[$key][$k] = '';
                    }else{
                        $payload[$key][$k] = $aPayload[$key][$k];
                    }
                }
            }elseif($map != null){
                $payload[$key] = $this->getPayloadValue($map, $aPayload);
            }
        }
        return $payload;
    }

    /**
     * Get a payload value from a given compact string index
     * @param $key
     * @param array $payload
     *
     * @return array|mixed
     */
    protected function getPayloadValue($key, array $payload){
        $keys = explode('.', $key);
        foreach($keys as $i => $key){
            unset($keys[$i]);
            if(isset($payload[$key])){
                $payload = $payload[$key];
            }
        }

        return $payload;
    }

    /**
     * Cast available casts on the current payload
     */
    protected function castPayload(){
        foreach($this->casts as $string => $cast){
            $keys = explode('.', $string);

            $key = $keys[0];
            unset($keys[0]);
            sort($keys);

            $this->aPayload = $this->replace($this->aPayload, $key, $keys, $cast);
        }
    }

    /**
     * Cast a specific value within the payload
     * @param $arr array
     * @param $key string
     * @param $keys array
     * @param $cast string
     *
     * @return mixed
     */
    protected function replace($arr, $key, $keys, $cast){
        if(!empty($keys)){
            $kkey = $keys[0];
            unset($keys[0]);
            sort($keys);
            $arr[$key] = $this->replace($arr[$key], $kkey, $keys, $cast);
        }else{
            $arr[$key] = str_replace('{$1}', $arr[$key], $cast);
        }
        return $arr;
    }

    /**
     * Get the current payload
     * @return \Illuminate\Support\Collection
     */
    public function getPayload(){
        return collect($this->aPayload);
    }
}


text:
namespace Microsoft.Azure.Management.WebSites
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// CertificateRegistrationProviderOperations operations.
    /// </summary>
    public partial interface ICertificateRegistrationProviderOperations
    {
        /// <summary>
        /// Implements Csm operations Api to exposes the list of available Csm
        /// Apis under the resource provider
        /// </summary>
        /// <remarks>
        /// Implements Csm operations Api to exposes the list of available Csm
        /// Apis under the resource provider
        /// </remarks>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="DefaultErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<CsmOperationDescription>>> ListOperationsWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Implements Csm operations Api to exposes the list of available Csm
        /// Apis under the resource provider
        /// </summary>
        /// <remarks>
        /// Implements Csm operations Api to exposes the list of available Csm
        /// Apis under the resource provider
        /// </remarks>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="DefaultErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<CsmOperationDescription>>> ListOperationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
package com.jyutwaa.zhaoziliang.glimpse.Presenter;

/**
 * Created by zhaoziliang on 17/2/24.
 */

public interface IBilibiliIntegratedPresenter extends BasePresenter {

    void getIntegratedTopList();

}


text:
(function(angular) {
  'use strict';
angular.module('multiSlotTranscludeExample', [])
 .directive('pane', function() {
    return {
      restrict: 'E',
      transclude: {
        'title': '?paneTitle',
        'body': 'paneBody',
        'footer': '?paneFooter'
      },
      template: '
' +
                  '
Fallback Title
' +
                  '

' +
                  '
Fallback Footer
' +
                '
'
    };
})
.controller('ExampleController', ['$scope', function($scope) {
  $scope.title = 'Lorem Ipsum';
  $scope.link = 'https://google.com';
  $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
}]);
})(window.angular);


text:
package de.sogomn.spjgl;

/**
 * Defines an interface for objects that can be updated.
 * Can be used in other context aswell.
 * @author Sogomn
 *
 */
@FunctionalInterface
public interface IUpdatable {

	/**
	 * Usually called to update the object
	 * @param delta The time passed in seconds since the last call, usually in nanoseconds
	 */
	void update(final long delta);

}


text:
package api

import (
	"bytes"
	"fmt"
	"io"
	"net"
	"net/http"
	"strings"
	"sync"
)

// EventSource is a component which can hajick http connection and then send event to client.
type EventSource struct {
	conn        net.Conn
	closed      bool
	closeNotify chan bool
	locker      sync.Mutex
}

// EventData is a type which can be send by SendEvent(), SendEvent() will call Encode() and then write result into connection.
type EventData interface {
	Encode() ([]byte, error)
	Decode(content []byte) error
}

// NewEventSource create a new event source, event source will hijack w.conn; so you can not write anything to this responseWriter after calling this.
func NewEventSource(w http.ResponseWriter) (*EventSource, error) {
	var err error
	es := &EventSource{
		closeNotify: make(chan bool),
		closed:      false,
	}
	if hijacker, ok := w.(http.Hijacker); ok {
		es.conn, _, err = hijacker.Hijack()
	} else {
		return nil, fmt.Errorf("responseWriter do not support hijacker")
	}

	if _, err = es.conn.Write([]byte("HTTP/1.1 200 OK\r\nContent-Type: text/event-stream\r\n")); err != nil {
		es.Close()
		return nil, err
	}

	if _, err = es.conn.Write([]byte("Vary: Accept-Encoding\r\n")); err != nil {
		es.Close()
		return nil, err
	}

	if _, err = es.conn.Write([]byte("\r\n")); err != nil {
		es.Close()
		return nil, err
	}

	go func() { // this goroutine to monitor connection whether closed
		io.Copy(nil, es.conn)
		es.Close()
	}()
	return es, nil
}

// SendEvent send a event to client.
// data can be []byte, string or EventData. it should not contain '\n' in it, otherwize only the first line will be send.
// the given data can be string or []byte or EventData
func (es *EventSource) SendEvent(id uint64, event string, data interface{}) error {
	switch data.(type) {
	case string:
		es.conn.Write(generateMessage(id, event, data.(string)))
	case []byte:
		es.conn.Write(generateMessage(id, event, string(data.([]byte))))
	case EventData:
		content, err := data.(EventData).Encode()
		if err != nil {
			return err
		}
		es.conn.Write(generateMessage(id, event, string(content)))
	}
	return nil
}

// CloseNotify return a channel used to notify the connection's close event.
// the return channel will be closed when connection was closed, nothing send into it.
func (es *EventSource) CloseNotify() <-chan bool {
	return es.closeNotify
}

// Close the event source, this function also close the http connection.
func (es *EventSource) Close() {
	es.locker.Lock()
	defer es.locker.Unlock()
	if !es.closed {
		es.conn.Close()
		close(es.closeNotify)
		es.closed = true
	}
}

func generateMessage(id uint64, event, content string) []byte {
	var data bytes.Buffer
	data.WriteString(fmt.Sprintf("id: %d\n", id))
	if len(event) > 0 {
		data.WriteString(fmt.Sprintf("event: %s\n", strings.Replace(event, "\n", "", -1)))
	}
	if len(content) > 0 {
		lines := strings.Split(content, "\n")
		for _, line := range lines {
			data.WriteString(fmt.Sprintf("data: %s\n", line))
		}
	}
	data.WriteString("\n")
	return data.Bytes()
}


text:
<?hh // strict
namespace Titon\Test\Stub\Context;

use Titon\Context\ClassList;
use Titon\Context\ServiceProvider\AbstractServiceProvider;

class FooServiceProviderStub extends AbstractServiceProvider {

    protected ClassList $provides = Vector {
        'Titon\Test\Stub\Context\FooStub'
    };

    public function register(): void {
        if ($this->depository !== null) {
            $this->depository->register('foo', 'Titon\Test\Stub\Context\FooStub');
        }
    }

}


text:
package defaults

import (
	"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
	"k8s.io/kubernetes/pkg/scheduler/factory"
)

func init() {
	// Register functions that extract metadata used by predicates computations.
	factory.RegisterPredicateMetadataProducerFactory(
		func(args factory.PluginFactoryArgs) predicates.PredicateMetadataProducer {
			return predicates.NewPredicateMetadataFactory(args.PodLister)
		})

	// IMPORTANT NOTES for predicate developers:
	// Registers predicates and priorities that are not enabled by default, but user can pick when creating their
	// own set of priorities/predicates.

	// PodFitsPorts has been replaced by PodFitsHostPorts for better user understanding.
	// For backwards compatibility with 1.0, PodFitsPorts is registered as well.
	factory.RegisterFitPredicate("PodFitsPorts", predicates.PodFitsHostPorts)
	// Fit is defined based on the absence of port conflicts.
	// This predicate is actually a default predicate, because it is invoked from
	// predicates.GeneralPredicates()
	factory.RegisterFitPredicate(predicates.PodFitsHostPortsPred, predicates.PodFitsHostPorts)
	// Fit is determined by resource availability.
	// This predicate is actually a default predicate, because it is invoked from
	// predicates.GeneralPredicates()
	factory.RegisterFitPredicate(predicates.PodFitsResourcesPred, predicates.PodFitsResources)
	// Fit is determined by the presence of the Host parameter and a string match
	// This predicate is actually a default predicate, because it is invoked from
	// predicates.GeneralPredicates()
	factory.RegisterFitPredicate(predicates.HostNamePred, predicates.PodFitsHost)
	// Fit is determined by node selector query.
	factory.RegisterFitPredicate(predicates.MatchNodeSelectorPred, predicates.PodMatchNodeSelector)

	// Fit is determined by volume zone requirements.
	factory.RegisterFitPredicateFactory(
		predicates.NoVolumeZoneConflictPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewVolumeZonePredicate(args.PVInfo, args.PVCInfo, args.StorageClassInfo)
		},
	)
	// Fit is determined by whether or not there would be too many AWS EBS volumes attached to the node
	factory.RegisterFitPredicateFactory(
		predicates.MaxEBSVolumeCountPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewMaxPDVolumeCountPredicate(predicates.EBSVolumeFilterType, args.PVInfo, args.PVCInfo)
		},
	)
	// Fit is determined by whether or not there would be too many GCE PD volumes attached to the node
	factory.RegisterFitPredicateFactory(
		predicates.MaxGCEPDVolumeCountPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewMaxPDVolumeCountPredicate(predicates.GCEPDVolumeFilterType, args.PVInfo, args.PVCInfo)
		},
	)
	// Fit is determined by whether or not there would be too many Azure Disk volumes attached to the node
	factory.RegisterFitPredicateFactory(
		predicates.MaxAzureDiskVolumeCountPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewMaxPDVolumeCountPredicate(predicates.AzureDiskVolumeFilterType, args.PVInfo, args.PVCInfo)
		},
	)
	factory.RegisterFitPredicateFactory(
		predicates.MaxCSIVolumeCountPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewCSIMaxVolumeLimitPredicate(args.PVInfo, args.PVCInfo)
		},
	)
	factory.RegisterFitPredicateFactory(
		predicates.MaxCinderVolumeCountPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewMaxPDVolumeCountPredicate(predicates.CinderVolumeFilterType, args.PVInfo, args.PVCInfo)
		},
	)

	// Fit is determined by inter-pod affinity.
	factory.RegisterFitPredicateFactory(
		predicates.MatchInterPodAffinityPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewPodAffinityPredicate(args.NodeInfo, args.PodLister)
		},
	)

	// Fit is determined by non-conflicting disk volumes.
	factory.RegisterFitPredicate(predicates.NoDiskConflictPred, predicates.NoDiskConflict)

	// GeneralPredicates are the predicates that are enforced by all Kubernetes components
	// (e.g. kubelet and all schedulers)
	factory.RegisterFitPredicate(predicates.GeneralPred, predicates.GeneralPredicates)

	// Fit is determined by node memory pressure condition.
	factory.RegisterFitPredicate(predicates.CheckNodeMemoryPressurePred, predicates.CheckNodeMemoryPressurePredicate)

	// Fit is determined by node disk pressure condition.
	factory.RegisterFitPredicate(predicates.CheckNodeDiskPressurePred, predicates.CheckNodeDiskPressurePredicate)

	// Fit is determined by node pid pressure condition.
	factory.RegisterFitPredicate(predicates.CheckNodePIDPressurePred, predicates.CheckNodePIDPressurePredicate)

	// Fit is determined by node conditions: not ready, network unavailable or out of disk.
	factory.RegisterMandatoryFitPredicate(predicates.CheckNodeConditionPred, predicates.CheckNodeConditionPredicate)

	// Fit is determined based on whether a pod can tolerate all of the node's taints
	factory.RegisterFitPredicate(predicates.PodToleratesNodeTaintsPred, predicates.PodToleratesNodeTaints)

	// Fit is determined by volume topology requirements.
	factory.RegisterFitPredicateFactory(
		predicates.CheckVolumeBindingPred,
		func(args factory.PluginFactoryArgs) predicates.FitPredicate {
			return predicates.NewVolumeBindingPredicate(args.VolumeBinder)
		},
	)
}


text:
package oap.util;

import it.unimi.dsi.fastutil.io.FastByteArrayInputStream;

import java.io.InputStream;

public class FastByteArrayOutputStream extends it.unimi.dsi.fastutil.io.FastByteArrayOutputStream {
    public FastByteArrayOutputStream() {
    }

    public FastByteArrayOutputStream( int initialCapacity ) {
        super( initialCapacity );
    }

    public FastByteArrayOutputStream( byte[] a ) {
        super( a );
    }

    public FastByteArrayOutputStream( byte[] a, long position, long length ) {
        super( a );
        this.position( position );
        this.length = ( int ) length;
    }

    public InputStream getInputStream() {
        return new FastByteArrayInputStream( array, 0, length );
    }

    @Override
    public String toString() {
        return new String( array, 0, length );
    }
}


text:
angular.module('mobio.cache')

        .factory('settingsCache', function () {

            return {
                cacheAvailable: function () {
                    return (typeof (Storage) === 'undefined' ? false : true);
                },
                getSettings: function () {
                    if (!this.cacheAvailable()) {
                        return false;
                    }

                    if(!JSON.parse(window.localStorage.getItem("settingsCache"))) {
                        window.localStorage.setItem("settingsCache", JSON.stringify({}));
                    }

                    return JSON.parse(window.localStorage.getItem("settingsCache"));
                },
                updateSettings: function (name, value) {
                    if (!this.cacheAvailable()) {
                        return false;
                    }
                    var settingsCache = this.getSettings();

                    if (!settingsCache) {
                        settingsCache = {};
                    }

                    settingsCache[name] = value;

                    window.localStorage.setItem("settingsCache", JSON.stringify(settingsCache));
                    return settingsCache;
                }
            };
        });