text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="novoda.audio"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-sdk android:minSdkVersion="4" />

    <application
    	android:icon="@drawable/icon"
    	android:label="Simple Audio Streamer">

        <activity
        	android:name=".StreamerInterface"
        	android:label="Audio Streaming example">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
     			<action android:name="android.intent.action.VIEW" />
     			<action android:name="android.intent.action.BROWSABLE" />
     			<category android:name="android.intent.category.DEFAULT" />
     			<data android:mimeType="application/pls" />
 				<data android:mimeType="audio/x-scpls" />
 				<data android:mimeType="audio/x-mpegurl" />
 			</intent-filter>
        </activity>

    	<service android:exported="true" android:name=".service.AudioStreamService" android:enabled="true"></service>
    </application>

</manifest>


text:
#import "UIKit-Structs.h"
#import <Foundation/NSObject.h>
#import "UIAnimation.h"

@interface UIAnimation : NSObject {
	id _target;
	SEL _action;
	id _delegate;
	struct {
		unsigned curve : 4;
		unsigned tvOutput : 1;
		unsigned reserved : 27;
	} _animationFlags;
	double _startTime;
	double _duration;
	int _state;
}
-(id)initWithTarget:(id)target;
-(void)stopAnimation;
-(id)target;
-(void)setDelegate:(id)delegate;
-(id)delegate;
-(void)setAction:(SEL)action;
-(SEL)action;
-(void)setAnimationCurve:(int)curve;
-(void)setProgress:(float)progress;
-(float)progressForFraction:(float)fraction;
-(void)dealloc;
@end

@interface UIAnimation (Internal)
-(int)state;
-(BOOL)tvOutput;
-(void)setDuration:(double)duration;
-(float)fractionForTime:(double)time;
-(void)markStart:(double)start;
-(void)markStop;
@end

redpajama_set_name: RedPajamaGithub


text:
<?php

	class CompositeMatcher {
		protected $matchers = array();
		private $wasConstructed = false;

		public function add($matcher) {
			$this->matchers[] = $matcher;
		}

		public function matches($string, &$value) {
			if(!$this->wasConstructed) {
				$this->build();
				$this->wasConstructed = true;
			}
			return $this->match($string, $value);
		}

		protected function build() {}
	}

	class ParallelMatcher extends CompositeMatcher {
		protected function match($string, &$value) {
			$maxLength = false;
			$result = null;
			foreach($this->matchers as $matcher) {
				$length = $matcher->matches($string, $subvalue);
				if($maxLength === false || $length > $maxLength) {
					$maxLength = $length;
					$result = $subvalue;
				}
			}
			$value = $this->process($result);
			return $maxLength;
		}

		protected function process($value) {
			return $value;
		}
	}

	class SerialMatcher extends CompositeMatcher {
		protected function match($string, &$value) {
			$results = array();
			$total_length = 0;
			foreach($this->matchers as $matcher) {
				if(($length = $matcher->matches($string, $result)) === false) return false;
				$total_length += $length;
				$results[] = $result;
				$string = substr($string, $length);
			}
			$value = $this->process($results);
			return $total_length;
		}

		protected function process($results) {
			return implode('', $results);
		}
	}

	class SimpleSerialMatcher extends SerialMatcher {
		private $return_part_index;

		public function __construct($return_part_index = 0) {
			$this->return_part_index = $return_part_index;
		}

		public function process($parts) {
			return $parts[$this->return_part_index];
		}
	}

	class RegexMatcher {
		private $regex;

		public function __construct($regex) {
			$this->regex = $regex;
		}

		public function matches($string, &$value) {
			if(preg_match("/^{$this->regex}/", $string, $matches)) {
				$value = $this->process($matches);
				return strlen($matches[0]);
			}
			$value = false;
			return false;
		}

		protected function process($matches) {
			return $matches[0];
		}
	}

	class AnnotationsMatcher {
		public function matches($string, &$annotations) {
			$annotations = array();
			$annotation_matcher = new AnnotationMatcher;
			while(true) {
				if(preg_match('/\s(?=@)/', $string, $matches, PREG_OFFSET_CAPTURE)) {
					$offset = $matches[0][1] + 1;
					$string = substr($string, $offset);
				}  else {
					return; //no more annotations
				}
				if(($length = $annotation_matcher->matches($string, $data)) !== false) {
					$string = substr($string, $length);
					list($name, $params) = $data;
					$annotations[$name][] = $params;
				}
			}
		}
	}

	class AnnotationMatcher extends SerialMatcher {
		protected function build() {
			$this->add(new RegexMatcher('@'));
			$this->add(new RegexMatcher('[A-Z][a-zA-Z0-9_]*'));
			$this->add(new AnnotationParametersMatcher);
		}

		protected function process($results) {
			return array($results[1], $results[2]);
		}
	}

	class ConstantMatcher extends RegexMatcher {
		private $constant;

		public function __construct($regex, $constant) {
			parent::__construct($regex);
			$this->constant = $constant;
		}

		protected function process($matches) {
			return $this->constant;
		}
	}

	class AnnotationParametersMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new ConstantMatcher('', array()));
			$this->add(new ConstantMatcher('\(\)', array()));
			$params_matcher = new SimpleSerialMatcher(1);
			$params_matcher->add(new RegexMatcher('\(\s*'));
			$params_matcher->add(new AnnotationValuesMatcher);
			$params_matcher->add(new RegexMatcher('\s*\)'));
			$this->add($params_matcher);
		}
	}

	class AnnotationValuesMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new AnnotationTopValueMatcher);
			$this->add(new AnnotationHashMatcher);
		}
	}

	class AnnotationTopValueMatcher extends AnnotationValueMatcher {
		protected function process($value) {
			return array('value' => $value);
		}
	}

	class AnnotationValueMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new ConstantMatcher('true', true));
			$this->add(new ConstantMatcher('false', false));
			$this->add(new ConstantMatcher('TRUE', true));
			$this->add(new ConstantMatcher('FALSE', false));
			$this->add(new ConstantMatcher('NULL', null));
			$this->add(new ConstantMatcher('null', null));
			$this->add(new AnnotationStringMatcher);
			$this->add(new AnnotationNumberMatcher);
			$this->add(new AnnotationArrayMatcher);
			$this->add(new AnnotationStaticConstantMatcher);
			$this->add(new AnnotationDefineConstantMatcher);
			$this->add(new NestedAnnotationMatcher);
		}
	}

	class AnnotationKeyMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new RegexMatcher('[a-zA-Z][a-zA-Z0-9_]*'));
			$this->add(new AnnotationStringMatcher);
			$this->add(new AnnotationIntegerMatcher);
		}
	}

	class AnnotationPairMatcher extends SerialMatcher {
		protected function build() {
			$this->add(new AnnotationKeyMatcher);
			$this->add(new RegexMatcher('\s*=\s*'));
			$this->add(new AnnotationValueMatcher);
		}

		protected function process($parts) {
			return array($parts[0] => $parts[2]);
		}
	}

	class AnnotationHashMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new AnnotationPairMatcher);
			$this->add(new AnnotationMorePairsMatcher);
		}
	}

	class AnnotationMorePairsMatcher extends SerialMatcher {
		protected function build() {
			$this->add(new AnnotationPairMatcher);
			$this->add(new RegexMatcher('\s*,\s*'));
			$this->add(new AnnotationHashMatcher);
		}

		protected function match($string, &$value) {
			$result = parent::match($string, $value);
			return $result;
		}

		public function process($parts) {
			return array_merge($parts[0], $parts[2]);
		}
	}

	class AnnotationArrayMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new ConstantMatcher('{}', array()));
			$values_matcher = new SimpleSerialMatcher(1);
			$values_matcher->add(new RegexMatcher('\s*{\s*'));
			$values_matcher->add(new AnnotationArrayValuesMatcher);
			$values_matcher->add(new RegexMatcher('\s*}\s*'));
			$this->add($values_matcher);
		}
	}

	class AnnotationArrayValuesMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new AnnotationArrayValueMatcher);
			$this->add(new AnnotationMoreValuesMatcher);
		}
	}

	class AnnotationMoreValuesMatcher extends SimpleSerialMatcher {
		protected function build() {
			$this->add(new AnnotationArrayValueMatcher);
			$this->add(new RegexMatcher('\s*,\s*'));
			$this->add(new AnnotationArrayValuesMatcher);
		}

		protected function match($string, &$value) {
			$result = parent::match($string, $value);
			return $result;
		}

		public function process($parts) {
			return array_merge($parts[0], $parts[2]);
		}
	}

	class AnnotationArrayValueMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new AnnotationValueInArrayMatcher);
			$this->add(new AnnotationPairMatcher);
		}
	}

	class AnnotationValueInArrayMatcher extends AnnotationValueMatcher {
		public function process($value) {
			return array($value);
		}
	}

	class AnnotationStringMatcher extends ParallelMatcher {
		protected function build() {
			$this->add(new AnnotationSingleQuotedStringMatcher);
			$this->add(new AnnotationDoubleQuotedStringMatcher);
		}
	}

	class AnnotationNumberMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct("-?[0-9]*\.?[0-9]*");
		}

		protected function process($matches) {
			$isFloat = strpos($matches[0], '.') !== false;
			return $isFloat ? (float) $matches[0] : (int) $matches[0];
		}
	}

	class AnnotationIntegerMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct("-?[0-9]*");
		}

		protected function process($matches) {
			return (int) $matches[0];
		}
	}

	class AnnotationSingleQuotedStringMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct("'([^']*)'");
		}

		protected function process($matches) {
			return $matches[1];
		}
	}

	class AnnotationDoubleQuotedStringMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct('"([^"]*)"');
		}

		protected function process($matches) {
			return $matches[1];
		}
	}

	class AnnotationStaticConstantMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct('(\w+::\w+)');
		}

		protected function process($matches) {
			$name = $matches[1];
			if(!defined($name)) {
				trigger_error("Constant '$name' used in annotation was not defined.");
				return false;
			}
			return constant($name);
		}

	}

	class AnnotationDefineConstantMatcher extends RegexMatcher {
		public function __construct() {
			parent::__construct('([A-Z]+(_[A-Z]+)*)');
		}

		protected function process($matches) {
			$name = $matches[1];
			if(!defined($name)) {
				trigger_error("Constant '$name' used in annotation was not defined.");
				return false;
			}
			return constant($name);
		}

	}

	class NestedAnnotationMatcher extends AnnotationMatcher {
		protected function process($result) {
			$builder = new AnnotationsBuilder;
			return $builder->instantiateAnnotation($result[1], $result[2]);
		}
	}
?>


text:
//
//  NSData+ImageContentType.h
//  XDCommonLib
//
//  Created by suxinde on 16/5/24.
//  Copyright © 2016年 su xinde. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSData (ImageContentType)

/**
 *  Compute the content type for an image data
 *
 *  @param data the input data
 *
 *  @return the content type as string (i.e. image/jpeg, image/gif)
 */
+ (NSString *)sd_contentTypeForImageData:(NSData *)data;

@end


text:
require 'test_helper'

class FavouriteTest < ActiveSupport::TestCase
  fixtures :all

  test 'remove redundant' do
    fav = favourites(:data_file_fav)
    res = fav.resource
    assert_difference('Favourite.count', -1) do
      User.current_user = res.contributor
      res.destroy
    end

    o = Factory(:organism)
    fav = Favourite.new(resource: o, user: users(:quentin))
    fav.save!
    User.with_current_user Factory(:admin) do
      assert_difference('Favourite.count', -1) do
        o.destroy
      end
    end
  end

  test 'is_favouritable' do
    df = data_files(:picture)
    assert df.is_favouritable?
    assert DataFile.is_favouritable?

    assert Event.is_favouritable?
    assert events(:private_event).is_favouritable?

    o = organisms(:yeast)
    assert o.is_favouritable?
    assert Organism.is_favouritable?

    u = users(:quentin)
    assert !u.is_favouritable?
    assert !User.is_favouritable?

    assert SavedSearch.is_favouritable?
  end
end