text:
@interface EKChartViewController ()<XYPieChartDelegate, XYPieChartDataSource, UIScrollViewDelegate>

@property (nonatomic, strong) EKAppDelegate *appDelegate;
@property (nonatomic, strong) EKChartView   *chartView;
@property (nonatomic, assign) BOOL           pageControlBeingUsed;
@property (nonatomic, copy)   NSArray       *proxyData;
@property (nonatomic, copy)   NSArray       *sortedProxyData;

@end

@implementation EKChartViewController;

#pragma mark - Life cycle

- (void)loadView
{
    EKChartView *view = [[EKChartView alloc] init];
    self.view = view;
    self.chartView = view;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.appDelegate = (EKAppDelegate *)[[UIApplication sharedApplication] delegate];
    [self.appDelegate.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];

    [self.chartView.chart setDelegate:self];
    [self.chartView.chart setDataSource:self];
    self.chartView.scrollView.delegate = self;

    [self setUpUI];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];

    [self.appDelegate.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModePanningNavigationBar];

    self.proxyData = [self endDataReadyForChart];
    self.sortedProxyData = [self sortedDataForBarChart];

    if ([TSMessage isNotificationActive]) {
        [TSMessage dismissActiveNotification];
    }

    [self showPieChart];
    [self.chartView.chart reloadData];
    [self showBarChart];
}

- (void)viewDidDisappear:(BOOL)animated;
{
    [super viewDidDisappear:animated];

    for (UIView *view in [self.chartView.barChartView subviews]) {
        if ([view isKindOfClass:[EKBar class]]) {
            [view removeFromSuperview];
        }
    }
}

#pragma mark - UI

- (void)setUpUI
{
    UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                                                target:self
                                                                                action:@selector(sharePressed:)];
    [[self navigationItem] setRightBarButtonItem:newBackButton];

    [self.chartView.pageControl addTarget:self
                                   action:@selector(pageControlTapped:)
                         forControlEvents:UIControlEventTouchUpInside];
}

- (void)showPieChart
{
    self.chartView.totalTime.text = [self totalTime];
    self.chartView.cirle.color = [EKActivityProvider colorForActivity:[self.proxyData[0] allKeys][0]];
    self.chartView.activityName.text = [self.proxyData[0] allKeys][0];
    self.chartView.activityTime.text = [NSString timeFormattedStringForValue:[[self.proxyData[0] allValues][0] unsignedLongLongValue] withFraction:NO];
}

- (void)showBarChart
{
    self.chartView.barChartView.frame = CGRectMake(screenWidth(), 0.0f, screenWidth(), screenHeight() - 124.0f);

    NSArray *grades = [self grades];

    CGFloat start = [[EKLayoutUtil layoutAttributesForBarOnHostView:self.chartView.barChartView barCount:[self.proxyData count]][0] floatValue];
    CGFloat barHeight = [[EKLayoutUtil layoutAttributesForBarOnHostView:self.chartView.barChartView barCount:[self.proxyData count]][1] floatValue];

    NSUInteger count = [self.proxyData count];

    for (NSUInteger i = 0; i < count; i++) {
        CGRect newFrame = CGRectMake(30.0f, start + barHeight * 1.5f * i, 260.0f, barHeight);

        EKBar *progressBar              = [[EKBar alloc] init];
        progressBar.tag                 = i;
        progressBar.frame               = newFrame;
        progressBar.bar.backgroundColor = [EKActivityProvider colorForActivity:[self.sortedProxyData[i] allKeys][0]];
        [progressBar drawBarWithProgress:[grades[i] floatValue] animated:YES];
        [progressBar addTarget:self action:@selector(pop:) forControlEvents:UIControlEventTouchUpInside];
        [self.chartView.barChartView addSubview:progressBar];
    }

    self.chartView.cirle2.color       = [EKActivityProvider colorForActivity:[self.sortedProxyData[0] allKeys][0]];
    self.chartView.activityName2.text = [self.sortedProxyData[0] allKeys][0];
    self.chartView.activityTime2.text = [NSString timeFormattedStringForValue:[[self.sortedProxyData[0] allValues][0] unsignedLongLongValue] withFraction:NO];
}

#pragma mark - Prepare data for chart

- (NSSet *)activitiesNoDuplicates
{
    NSMutableSet *noDuplicates = [[NSMutableSet alloc] init];
    NSParameterAssert([self.dateModels count] > 0);

    for (EKDateModel *date in self.dateModels) {
        if (date != nil) {
            for (EKRecordModel *record in [date.toRecord allObjects]) {
                if ((record != nil) && (record.activity != nil)) {
                    [noDuplicates addObject:record.activity];
                }
            }
        }
    }
    NSParameterAssert([[noDuplicates allObjects] count] > 0);

    return [noDuplicates copy];
}

- (NSArray *)recordsFromGivenDates
{
    NSMutableArray *records = [@[] mutableCopy];
    NSParameterAssert([self.dateModels count] > 0);

    for (EKDateModel *date in self.dateModels) {
        if (date != nil) {
            for (EKRecordModel *record in [date.toRecord allObjects]) {
                if (record != nil) {
                    [records addObject:record];
                }
            }
        }
    }
    NSParameterAssert([records count] > 0);

    return [records copy];
}

- (NSArray *)filteredRecordsGroupedByName
{
    NSSet *activitiesNoDuplicates = [self activitiesNoDuplicates];
    NSArray *recordsFromGivenDates = [self recordsFromGivenDates];
    NSMutableArray *result = [@[] mutableCopy];

    NSUInteger count = [[activitiesNoDuplicates allObjects] count];

    for (NSUInteger i = 0; i < count; i++) {
        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"activity == %@", [activitiesNoDuplicates allObjects][i]];
        NSArray *mock = [recordsFromGivenDates filteredArrayUsingPredicate:predicate];
        [result addObject:mock];
    }
    NSParameterAssert([result count] > 0);

    return [result copy];
}

- (NSArray *)endDataReadyForChart
{
    unsigned long long sum = 0;
    EKRecordModel *mock = nil;
    NSArray *filteredRecordsGroupedByName = [self filteredRecordsGroupedByName];
    NSMutableArray *endData = [@[] mutableCopy];

    for (NSArray *arrayObject in filteredRecordsGroupedByName) {
        if (arrayObject != nil) {
            for (EKRecordModel *record in arrayObject) {
                if (record != nil) {
                    mock = record;
                    sum = sum + [record.duration unsignedLongLongValue];
                }
            }
            [endData addObject:@{ mock.activity : @(sum) }];
            sum = 0;
        }
    }
    NSParameterAssert([endData count] > 0);

    return [endData copy];
}

- (NSArray *)sortedDataForBarChart
{
    NSArray *sortedArray = [self.proxyData sortedArrayUsingComparator: ^NSComparisonResult (id a, id b) {
        id firstValue = [(NSDictionary *)a allValues][0];
        id secondValue = [(NSDictionary *)b allValues][0];
        return [secondValue compare:firstValue];
    }];

    NSParameterAssert(sortedArray != nil);

    return sortedArray;
}

- (NSArray *)grades
{
    NSMutableArray *array = [@[] mutableCopy];
    CGFloat grade = 0;

    NSUInteger count = [self.sortedProxyData count];

    for (NSUInteger i = 0; i < count; i++) {
        if (self.sortedProxyData[i] != nil) {
            grade = [[self.sortedProxyData[i] allValues][0] floatValue] / [[self.sortedProxyData[0] allValues][0] floatValue];
            [array addObject:@(grade)];
        }
    }
    NSParameterAssert([array count] > 0);

    return [array copy];
}

#pragma mark - Prepare data for "total" label

- (NSString *)totalTime
{
    unsigned long long sum = 0;
    NSArray *array = self.proxyData;
    NSUInteger count = [array count];

    for (NSUInteger i = 0; i < count; i++) {
        if (array[i] != nil) {
            sum = sum + [[array[i] allValues][0] unsignedLongLongValue];
        }
    }

    return [NSString timeFormattedStringForValue:sum withFraction:NO];
}

#pragma mark - Actions

- (void)sharePressed:(id)sender
{
    NSParameterAssert(sender != nil);

    if (sender != nil) {
        __weak typeof(self) weakSelf = self;

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
            UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[[EKScreenshotUtil convertViewToImage:self.navigationController.view]]
                                                                                applicationActivities:nil];
            controller.excludedActivityTypes = @[UIActivityTypePostToVimeo, UIActivityTypeAddToReadingList, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact];
            [weakSelf presentViewController:controller animated:YES completion:nil];
        });
    }
}

- (void)pageControlTapped:(FXPageControl *)sender
{
    NSParameterAssert(sender != nil);

    if (sender != nil) {
        CGPoint offset = CGPointMake(sender.currentPage * self.chartView.scrollView.frame.size.width, -64.0f);
        [self.chartView.scrollView setContentOffset:offset animated:YES];
        self.pageControlBeingUsed = YES;
    }
}

- (void)pop:(id)sender
{
    NSParameterAssert(sender != nil);

    UIView *view = (UIView *)sender;
    CGFloat duration = 0.4f;

    view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
    [UIView animateKeyframesWithDuration:duration / 3 delay:0 options:0 animations: ^{
        view.transform = CGAffineTransformMakeScale(1.05f, 1.5f);
    } completion: ^(BOOL finished) {
        [UIView animateKeyframesWithDuration:duration / 3 delay:0 options:0 animations: ^{
            view.transform = CGAffineTransformMakeScale(0.9f, 0.9f);
        } completion: ^(BOOL finished) {
            [UIView animateKeyframesWithDuration:duration / 3 delay:0 options:0 animations: ^{
                view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
            } completion: ^(BOOL finished) {
            }];
        }];
    }];
    [[EKSoundsProvider sharedInstance] sliceSound];

    self.chartView.cirle2.color = [EKActivityProvider colorForActivity:[self.sortedProxyData[view.tag] allKeys][0]];
    self.chartView.activityTime2.text = [NSString timeFormattedStringForValue:[[self.sortedProxyData[view.tag] allValues][0] unsignedLongLongValue] withFraction:NO];
    self.chartView.activityName2.text = [self.sortedProxyData[view.tag] allKeys][0];
}

#pragma mark - XYPieChart Data Source

- (NSUInteger)numberOfSlicesInPieChart:(XYPieChart *)pieChart
{
    return [self.proxyData count];
}

- (CGFloat)pieChart:(XYPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index
{
    return [[self.proxyData[index] allValues][0] unsignedLongLongValue];
}

- (UIColor *)pieChart:(XYPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index
{
    return [EKActivityProvider colorForActivity:[self.proxyData[index] allKeys][0]];
}

- (NSString *)pieChart:(XYPieChart *)pieChart textForSliceAtIndex:(NSUInteger)index
{
    return [NSString timeFormattedStringForValue:[[self.proxyData[index] allValues][0] unsignedLongLongValue] withFraction:NO];
}

#pragma mark - XYPieChart Delegate

- (void)pieChart:(XYPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index
{
    [[EKSoundsProvider sharedInstance] sliceSound];
}

- (void)pieChart:(XYPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index
{
    [[EKSoundsProvider sharedInstance] sliceSound];

    self.chartView.cirle.color = [EKActivityProvider colorForActivity:[self.proxyData[index] allKeys][0]];
    self.chartView.activityTime.text = [NSString timeFormattedStringForValue:[[self.proxyData[index] allValues][0] unsignedLongLongValue] withFraction:NO];
    self.chartView.activityName.text = [self.proxyData[index] allKeys][0];
}

#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (!self.pageControlBeingUsed) {
        NSInteger pageIndex = round(scrollView.contentOffset.x / scrollView.bounds.size.width);
        self.chartView.pageControl.currentPage = pageIndex;
    }
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    self.pageControlBeingUsed = NO;
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    self.pageControlBeingUsed = NO;
}

@end


text:
class God : public OrientableObject
{
public:
	God(){
		set(
			0,0,0, // at origin
			1,0,0, // looking in +x direction
			0,1,0  // up is +y direction
		);
	}
	void moveForward(float d);
	void turnH(float d);
	void turnV(float d);
private:
	void turn(float x,float y, float z,float angle);
};

redpajama_set_name: RedPajamaGithub


text:
import { moduleFor, test } from 'ember-qunit';

moduleFor('route:admin/settings', 'Unit | Route | admin/settings', {
  // Specify the other units that are required for this test.
  // needs: ['controller:foo']
});

test('it exists', function(assert) {
  let route = this.subject();
  assert.ok(route);
});


text:
@implementation InAppMsgText
@end


text:
package com.wemakestuff.teracast.rss.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import com.wemakestuff.teracast.database.annotations.ContentType;
import com.wemakestuff.teracast.database.annotations.SortOrder;
import com.wemakestuff.teracast.database.annotations.UriPaths;

@DatabaseTable(tableName = "rss_image")
@UriPaths({ RssImage.ENTITY_PL, RssImage.ENTITY_PL + "/#" })
@ContentType(BaseData.MIME_TYPE_PFX + RssImage.ENTITY)
@SortOrder(RssImage.URL + " DESC")
public class RssImage extends BaseData implements Parcelable {
    public static final String ENTITY = "feed";
    public static final String ENTITY_PL = ENTITY + "s";

    public static final String URL = "url";
    private static final String TITLE = "title";
    private static final String LINK = "link";
    private static final String WIDTH = "width";
    private static final String HEIGHT = "height";

	@DatabaseField(columnName = URL)
	private String url;

	@DatabaseField(columnName = TITLE)
	private String title;

	@DatabaseField(columnName = LINK)
	private String link;

	@DatabaseField(columnName = WIDTH)
	private int    width;

	@DatabaseField(columnName = HEIGHT)
	private int    height;

    public RssImage() {
        super();
    }

    public RssImage(Parcel source) {
        id = source.readLong();
        url = source.readString();
        title = source.readString();
        link = source.readString();
        width = source.readInt();
        height = source.readInt();
    }

    public String getUrl() {
		return url;
	}

	public void setUrl(final String url) {
		this.url = url;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(final String title) {
		this.title = title;
	}

	public String getLink() {
		return link;
	}

	public void setLink(final String link) {
		this.link = link;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(final int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(final int height) {
		this.height = height;
	}

	@Override
	public boolean equals(final Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		final RssImage rssImage = (RssImage) o;

		if (height != rssImage.height) return false;
		if (width != rssImage.width) return false;
		if (link != null ? !link.equals(rssImage.link) : rssImage.link != null) return false;
		if (title != null ? !title.equals(rssImage.title) : rssImage.title != null) return false;
		if (url != null ? !url.equals(rssImage.url) : rssImage.url != null) return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = url != null ? url.hashCode() : 0;
		result = 31 * result + (title != null ? title.hashCode() : 0);
		result = 31 * result + (link != null ? link.hashCode() : 0);
		result = 31 * result + width;
		result = 31 * result + height;
		return result;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder("RssImage{");
		sb.append("url='").append(url).append('\'');
		sb.append(", title='").append(title).append('\'');
		sb.append(", link='").append(link).append('\'');
		sb.append(", width=").append(width);
		sb.append(", height=").append(height);
		sb.append('}');
		return sb.toString();
	}

    public static final Creator<RssImage> CREATOR = new Creator<RssImage>() {
        @Override
        public RssImage createFromParcel(Parcel source) {
            return new RssImage(source);
        }

        @Override
        public RssImage[] newArray(int size) {
            return new RssImage[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(url);
        dest.writeString(link);
        dest.writeInt(width);
        dest.writeInt(height);

    }
}


text:
import Laws
#This is used to bring in the file from the get-go
#meaning all the info will travel between them

import RaceDesc
import ClassDesc
#Race info! Not Rascism and Class info! Not Classism..?
#Also because import is silly I need to reimport on every run to ensure witty comments

import imp
#I need this to reimport RaceDesc and ClassDesc so it runs everytime it passes over them

#The main aim of this project is to create a simple DnD Character builder
#This may even be useful but I will never know
#Also something something GUI

print('Begin \n')
#I was always bad at openings

print('')
print('Let\'s start with a race. You can choose any from the following list:')
print(*Laws.race_list, sep='\n')

while True:
    #This is the loop for picking a race

    #A loop is used so that they can keep going back and forth
    #This also lets me give descriptions on each pick

    Laws.user_race = input('\n Race: ').title()
    #the \n gives me a new line, I just like the format

    if Laws.user_race not in Laws.race_list:
        print('That isn\'t a race you can choose!')
        continue
    #Safety net to ensure only available races are picked
    #also .titled() for simplicity

    print('')
    imp.reload(RaceDesc)
    #This means everytime we pass over this it re loads the module
    print('')
    #Calls the description of the race

    print('Is ', Laws.user_race, ' the race you want?')
    #I know what it's asking doens't mean the user does
    user_response = input('Yes/No/List \n').title()
    #I couldn't decide how to explain what the options were so this seemed easiest.
    if user_response == 'Yes':
        print('')
        break
    #This was very witty and slightly complex, then I encountered 2 different bugs
    #So now it just breaks if it's the race they want

    if user_response == 'No':
        continue
    #Obviously if they say no, they want to re-pick, I haven't made it loop into the
    #main block because I don't want to fill the output with constant lists
    #So "No" just lets them re-pick with a third option for re-veiwing the list

    if user_response == 'List':
        print(*Laws.race_list, sep='\n')
        continue
    #This proved to be the easiest way to do this, so "List" just re-prints the list
    #and then goes back to the beginning of the internal block.

    if user_response == 'List':
        continue
    #The list catch, if someone said "List" then it can bring them back around

    else:
        print('I\'ll take that as a no')
        continue
    ##Sassy bitch

print('\n With a race chosen, now you need a class! \n')
print(*Laws.class_list, sep='\n')

#This will be another while loop
#infact this will be pretty indentical but with classes instead of races
while True:
    Laws.user_class = input('\n Class: ').title()
    if Laws.user_class not in Laws.class_list:
        print('That isn\'t a class you can be!')
        continue

    print('')
    imp.reload(ClassDesc)
    print('')

    print('Is ', Laws.user_class, ' the class you want?')
    #See above

    user_response = input('Yes/No/List \n').title()
    #Copied and pasted so everything going forward is the same

    if user_response == 'Yes':
        break

    if user_response == 'No':
        continue

    if user_response == 'List':
        print(*Laws.class_list, sep='\n')
        continue

    if user_response == 'List':
        continue

    else:
        print('I\'ll take that as a no')
        continue
    ##Still a sassy bitch


text:
Marketing websites parser
===============

This is a parser for several marketing websites:

- digitalbuzzblog.com
- creativeguerrillamarketing.com
- creativecriminals.com
- viralblog.com
- improveverywhere.com
- onthegroundlookingup.com
- 1000heads.com
- blog.guerrillacomm.com

Parses all blog posts to a CSV file. Each record represents one blog post and has the following structure:

1. Date (yyyy-mm-dd)
2. Title
3. Author
4. Rating
5. Category
6. Has images / video (1 if true, 0 otherwise)
7. Comments count
8. Tweets count
9. Facebook likes count
10. Post text
11. Comments text (all comments joined together)

Installation
===============

Requires Python 2.7.x and additional libraries:

```
pip install lxml
pip install beautifulsoup4
```

Usage
===============

```
$ python parser.py -h
usage: parser.py [-h] [-f POST_FROM] [-c COUNT] sitename

positional arguments:
  sitename              name of the website to parse (digitalbuzzblog, creativecriminals, creativeguerrillamarketing)

optional arguments:
  -h, --help            show this help message and exit
  -f POST_FROM, --post_from POST_FROM
                        0-based index of the first post to parse
  -c COUNT, --count COUNT
                        number of posts to parse

```

Example #1: parse all content from Digital Buzz:

    python parser.py digitalbuzzblog

Example #2: parse 20 posts from Creative Criminals, starting from post # 300:

    python parser.py -f 300 -c 20 creativecriminals

All data is saved to the `data` subfolder (i.e., 'data/digitalbuzzblog.csv'). Pipe character `|` is used as a CSV separator.


text:
require 'spec_helper'

RSpec.describe OneviewSDK::API2000::C7000::NetworkSet do
  include_context 'shared context'

  it 'inherits from OneviewSDK::API1800::C7000::NetworkSet' do
    expect(described_class).to be < OneviewSDK::API1800::C7000::NetworkSet
  end
end


text:
export const equalTextDocs = {
  name: 'equalText',
  category: 'Relational',
  syntax: [
    'equalText(x, y)'
  ],
  description:
      'Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.',
  examples: [
    'equalText("Hello", "Hello")',
    'equalText("a", "A")',
    'equal("2e3", "2000")',
    'equalText("2e3", "2000")',
    'equalText("B", ["A", "B", "C"])'
  ],
  seealso: [
    'compare', 'compareNatural', 'compareText', 'equal'
  ]
}


text:
Reveal.initialize({
// Display controls in the bottom right corner
    controls: true,

    // Display a presentation progress bar
    progress: true,

    // Display the page number of the current slide
    slideNumber: false,

    // Push each slide change to the browser history
    history: false,

    // Enable keyboard shortcuts for navigation
    keyboard: true,

    // Enable the slide overview mode
    overview: true,

    // Vertical centering of slides
    center: true,

    // Enables touch navigation on devices with touch input
    touch: true,

    // Loop the presentation
    loop: false,

    // Change the presentation direction to be RTL
    rtl: false,

    // Turns fragments on and off globally
    fragments: true,

    // Flags if the presentation is running in an embedded mode,
    // i.e. contained within a limited portion of the screen
    embedded: false,

    // Flags if we should show a help overlay when the questionmark
    // key is pressed
    help: true,

    // Flags if speaker notes should be visible to all viewers
    showNotes: false,

    // Number of milliseconds between automatically proceeding to the
    // next slide, disabled when set to 0, this value can be overwritten
    // by using a data-autoslide attribute on your slides
    autoSlide: 0,

    // Stop auto-sliding after user input
    autoSlideStoppable: true,

    // Enable slide navigation via mouse wheel
    mouseWheel: false,

    // Hides the address bar on mobile devices
    hideAddressBar: true,

    // Opens links in an iframe preview overlay
    previewLinks: false,

    // Transition style
    transition: 'none', // none/fade/slide/convex/concave/zoom

    // Transition speed
    transitionSpeed: 'default', // default/fast/slow

    // Transition style for full page slide backgrounds
    backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom

    // Number of slides away from the current that are visible
    viewDistance: 3,

    // Parallax background image
    parallaxBackgroundImage: '', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"

    // Parallax background size
    parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"

    // Amount to move parallax background (horizontal and vertical) on slide change
    // Number, e.g. 100
    parallaxBackgroundHorizontal: '',
    parallaxBackgroundVertical: '',

    // Optional reveal.js plugins
    dependencies: [
        { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
        //{ src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
        //{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
        { src: 'reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
        { src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
        { src: 'reveal.js/plugin/notes/notes.js', async: true }
    ]
}
);

Reveal.addEventListener( 'demo5-event', function() {
    var vis = d3.select("#demo5-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData4_demo4.nodes.length;

    var data = JSONData4_demo4;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo5-start") > -1) {
        setTimeout(displayData, 500, JSONData2_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo5-git-fetch") > -1) {
        setTimeout(displayData, 500, JSONData4_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo5-git-rebase-1") > -1) {
        setTimeout(displayData, 500, JSONData4_demo5, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo5-git-rebase-2") > -1) {
        setTimeout(displayData, 500, JSONData5_demo5, vis, h, scaleY);
    }
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo5-git-fetch") > -1) {
        setTimeout(displayData, 500, JSONData2_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo5-git-rebase-1") > -1) {
        setTimeout(displayData, 500, JSONData4_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo5-git-rebase-2") > -1) {
        setTimeout(displayData, 500, JSONData4_demo5, vis, h, scaleY);
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'demo6-event', function() {
    var vis = d3.select("#demo6-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData4_demo4.nodes.length;

    var data = JSONData4_demo4;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo6-start") > -1) {
        setTimeout(displayData, 500, JSONData1_demo6, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo6-git-checkout-feature") > -1) {
        setTimeout(displayData, 500, JSONData2_demo6, vis, h, scaleY);
    }
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo6-git-fetch") > -1) {
        setTimeout(displayData, 500, JSONData1_demo6, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo6-git-checkout-feature") > -1) {
        setTimeout(displayData, 500, JSONData1_demo6, vis, h, scaleY);
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'demo4-event', function() {
    var vis = d3.select("#demo4-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData4_demo4.nodes.length;

    var data = JSONData4_demo4;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo4-start") > -1) {
        setTimeout(displayData, 500, JSONData2_demo6, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-fetch") > -1) {
        setTimeout(displayData, 500, JSONData2_demo4, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-merge-feature") > -1) {
        setTimeout(displayData, 500, JSONData4_demo4, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-checkout-feature") > -1) {
        setTimeout(displayData, 500, JSONData5_demo4, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-merge-master") > -1) {
        setTimeout(displayData, 500, JSONData6_demo4, vis, h, scaleY);
    }
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo4-git-fetch") > -1) {
        setTimeout(displayData, 500, JSONData2_demo6, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-merge-feature") > -1) {
        setTimeout(displayData, 500, JSONData2_demo4, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-checkout-feature") > -1) {
        setTimeout(displayData, 500, JSONData4_demo4, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo4-git-merge-master") > -1) {
        setTimeout(displayData, 500, JSONData5_demo4, vis, h, scaleY);
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'demo3-event', function() {
    var vis = d3.select("#demo3-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData2_demo1.nodes.length;

    var data = JSONData2_demo1;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo3-start") > -1) {
        setTimeout(displayData, 500, JSONData0_demo2, vis, h, scaleY);
    }
    if (classAttribute.indexOf("demo3-git-checkout-b") > -1) {
        setTimeout(displayData, 500, JSONData1_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-commit-0") > -1) {
        setTimeout(displayData, 500, JSONData2_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-checkout") > -1) {
        setTimeout(displayData, 500, JSONData3_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-commit-1") > -1) {
        setTimeout(displayData, 500, JSONData4_demo3, vis, h, scaleY);
    }
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo3-git-checkout-b") > -1) {
        setTimeout(displayData, 500, JSONData0_demo2, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-commit-0") > -1) {
        setTimeout(displayData, 500, JSONData1_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-checkout") > -1) {
        setTimeout(displayData, 500, JSONData2_demo3, vis, h, scaleY);
    }
    else if (classAttribute.indexOf("demo3-git-commit-1") > -1) {
        setTimeout(displayData, 500, JSONData3_demo3, vis, h, scaleY);
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'demo2-event', function() {
    var vis = d3.select("#demo2-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData2_demo2.nodes.length;

    var data = JSONData2_demo1;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo2-start") > -1) {
        setTimeout(displayData, 500, JSONData0_demo2, vis, h, scaleY);
    }
    if (classAttribute.indexOf("demo2-git-branch") > -1) {
        setTimeout(displayData, 500, JSONData1_demo2, vis, h, scaleY);
    }
    if (classAttribute.indexOf("demo2-git-commit") > -1) {
        setTimeout(displayData, 500, JSONData2_demo2, vis, h, scaleY);
        // do stuff
    }
    //setTimeout(displayData, 1500, JSONData1_demo1, vis, h);
    //setTimeout(displayData, 2500, JSONData2_demo1, vis, h);
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo2-git-branch") > -1) {
        setTimeout(displayData, 500, JSONData0_demo2, vis, h, scaleY);
        // do stuff
    }
    if (classAttribute.indexOf("demo2-git-commit") > -1) {
        setTimeout(displayData, 500, JSONData1_demo2, vis, h, scaleY);
        // do stuff
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'demo1-event', function() {
    var vis = d3.select("#demo1-chart").style("padding-top", "100px").style("padding-bottom", "100px");

    var h = 50*1.5*JSONData2_demo1.nodes.length;

    var data = JSONData2_demo1;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

Reveal.addEventListener( 'fragmentshown', function( event ) {
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo1-start") > -1) {
        setTimeout(displayData, 500, JSONData0_demo1, vis, h, scaleY);
    }
    if (classAttribute.indexOf("demo1-git-commit-1") > -1) {
        setTimeout(displayData, 500, JSONData1_demo1, vis, h, scaleY);
    }
    if (classAttribute.indexOf("demo1-git-commit-2") > -1) {
        setTimeout(displayData, 500, JSONData2_demo1, vis, h, scaleY);
    }
} );

Reveal.addEventListener( 'fragmenthidden', function( event ) {
    console.log(event.fragment.getAttribute("class"))
    var classAttribute = event.fragment.getAttribute("class")
    if (classAttribute.indexOf("demo1-git-commit-1") > -1) {
        setTimeout(displayData, 500, JSONData0_demo1, vis, h, scaleY);
        // do stuff
    }
    if (classAttribute.indexOf("demo1-git-commit-2") > -1) {
        setTimeout(displayData, 500, JSONData1_demo1, vis, h, scaleY);
        // do stuff
    }
} );

} ); // end addEventListener

Reveal.addEventListener( 'title-event', function() {
    var vis = d3.select("#title-chart").style("padding-top", "0px").style("padding-bottom", "100px");
    var h = 50*JSONData2_title.nodes.length;
    var data = JSONData2_title;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

    setTimeout(displayData, 500, JSONData0_title, vis, h, scaleY);

    setTimeout(displayData, 1500, JSONData1_title, vis, h, scaleY);

    setTimeout(displayData, 2500, JSONData2_title, vis, h, scaleY);
} );

function displayData(data, vis, h, scaleY) {
render(data, vis, h, scaleY);
}

    var vis = d3.select("#title-chart").style("padding-top", "0px").style("padding-bottom", "100px");
    var h = 50*JSONData2_title.nodes.length;
    var data = JSONData2_title;
    var scaleY = d3.scale.linear()
        .range([d3.min(data.nodes, function(d){return d.pos[1]} ), d3.max(data.nodes, function(d){return d.pos[1]} )])
        .domain([h, 0]);

    setTimeout(displayData, 0, JSONData0_title, vis, h, scaleY);
    setTimeout(displayData, 1000, JSONData1_title, vis, h, scaleY);
    setTimeout(displayData, 2000, JSONData2_title, vis, h, scaleY);


text:
<?php

namespace ZfrCors\Exception;

/**
 * @license MIT
 * @author  Florent Blaison <florent.blaison@gmail.com>
 */
interface ExceptionInterface
{
}


text:
module.exports = {
  thunderpath: '~/github/thunder-project/thunder/thunder/'
}


text:
package com.lambdaworks;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

import org.apache.log4j.Logger;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;

/**
 * @author Mark Paluch
 */
public class LoggingTestRule implements MethodRule {

    private boolean threadDumpOnFailure = false;

    public LoggingTestRule(boolean threadDumpOnFailure) {
        this.threadDumpOnFailure = threadDumpOnFailure;
    }

    @Override
    public Statement apply(Statement base, FrameworkMethod method, Object target) {

        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                Logger logger = Logger.getLogger(method.getMethod().getDeclaringClass());
                logger.info("---------------------------------------");
                logger.info("-- Invoke method " + method.getMethod().getDeclaringClass().getSimpleName() + "."
                        + method.getName());
                logger.info("---------------------------------------");

                try {
                    base.evaluate();
                } catch (Throwable t) {
                    if (threadDumpOnFailure) {
                        printThreadDump(logger);
                    }

                    throw t;
                } finally {
                    logger.info("---------------------------------------");
                    logger.info("-- Finished method " + method.getMethod().getDeclaringClass().getSimpleName() + "."
                            + method.getName());
                    logger.info("---------------------------------------");
                }
            }
        };
    }

    private void printThreadDump(Logger logger) {
        logger.info("---------------------------------------");

        ByteArrayOutputStream buffer = getThreadDump();
        logger.info("-- Thread dump: " + buffer.toString());

        logger.info("---------------------------------------");
    }

    private ByteArrayOutputStream getThreadDump() {
        ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
        long[] threadIds = threadBean.getAllThreadIds();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        PrintStream stream = new PrintStream(buffer);

        for (long tid : threadIds) {
            ThreadInfo info = threadBean.getThreadInfo(tid, 50);
            if (info == null) {
                stream.println("  Inactive");
                continue;
            }
            stream.println("Thread " + getTaskName(info.getThreadId(), info.getThreadName()) + ":");
            Thread.State state = info.getThreadState();
            stream.println("  State: " + state);
            stream.println("  Blocked count: " + info.getBlockedCount());
            stream.println("  Waited count: " + info.getWaitedCount());

            if (state == Thread.State.WAITING) {
                stream.println("  Waiting on " + info.getLockName());
            } else if (state == Thread.State.BLOCKED) {
                stream.println("  Blocked on " + info.getLockName());
                stream.println("  Blocked by " + getTaskName(info.getLockOwnerId(), info.getLockOwnerName()));
            }
            stream.println("  Stack:");
            for (StackTraceElement frame : info.getStackTrace()) {
                stream.println("    " + frame.toString());
            }
        }
        stream.flush();
        return buffer;
    }

    private static String getTaskName(long id, String name) {
        if (name == null) {
            return Long.toString(id);
        }
        return id + " (" + name + ")";
    }
}


text:
package org.springframework.cloud.aws.context.annotation;

import com.amazonaws.services.s3.AmazonS3;
import org.junit.jupiter.api.Test;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

/**
 * @author Alain Sahli
 */
class OnMissingAmazonClientConditionTest {

	@Test
	void condition_withMatchingCase_shouldCreateBeanFoo() throws Exception {
		// Arrange & Act
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
				ConfigWithMissingAmazonClientCondition.class);

		// Assert
		assertThat(applicationContext.containsBean("foo")).isTrue();
	}

	@Test
	void condition_withNonMatchingCase_shouldNotCreateBeanFoo() throws Exception {
		// Arrange & Act
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
				ConfigWithDummyS3Client.class, ConfigWithMissingAmazonClientCondition.class);

		// Assert
		assertThat(applicationContext.containsBean("foo")).isFalse();
	}

	@Configuration(proxyBeanMethods = false)
	protected static class ConfigWithDummyS3Client {

		@Bean
		AmazonS3 amazonS3() {
			return mock(AmazonS3.class);
		}

	}

	@Configuration(proxyBeanMethods = false)
	protected static class ConfigWithMissingAmazonClientCondition {

		@Bean
		@ConditionalOnMissingAmazonClient(AmazonS3.class)
		String foo() {
			return "foo";
		}

	}

}


text:
'use strict';

const assert = require('assert');

module.exports = function() {
  this.Then(/^the response body has (an|a) "([^"]*)" field$/, (anOrA, expectedFieldName, done) => {
    const world = this.world;
    assert.ok(world.lastResponseBody.hasOwnProperty(expectedFieldName));
    done();
  });
};


text:
package types

import (
	"encoding/json"
	"fmt"
	"time"

	"github.com/gravitational/trace"

	"github.com/gravitational/teleport/api/constants"
)

// Duration is a wrapper around duration to set up custom marshal/unmarshal
type Duration time.Duration

// Duration returns time.Duration from Duration typex
func (d Duration) Duration() time.Duration {
	return time.Duration(d)
}

// Value returns time.Duration value of this wrapper
func (d Duration) Value() time.Duration {
	return time.Duration(d)
}

// MarshalJSON marshals Duration to string
func (d Duration) MarshalJSON() ([]byte, error) {
	return json.Marshal(d.Duration().String())
}

// UnmarshalJSON interprets the given bytes as a Duration value
func (d *Duration) UnmarshalJSON(data []byte) error {
	if len(data) == 0 {
		return nil
	}
	var stringVar string
	if err := json.Unmarshal(data, &stringVar); err != nil {
		return trace.Wrap(err)
	}
	if stringVar == constants.DurationNever {
		*d = Duration(0)
		return nil
	}
	out, err := parseDuration(stringVar)
	if err != nil {
		return trace.BadParameter(err.Error())
	}
	*d = out
	return nil
}

// MarshalYAML marshals duration into YAML value,
// encodes it as a string in format "1m"
func (d Duration) MarshalYAML() (interface{}, error) {
	return fmt.Sprintf("%v", d.Duration()), nil
}

// UnmarshalYAML unmarshals duration from YAML value.
func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var stringVar string
	if err := unmarshal(&stringVar); err != nil {
		return trace.Wrap(err)
	}
	if stringVar == constants.DurationNever {
		*d = Duration(0)
		return nil
	}
	out, err := parseDuration(stringVar)
	if err != nil {
		return trace.BadParameter(err.Error())
	}
	*d = out
	return nil
}

// MaxDuration returns the maximum duration value
func MaxDuration() Duration {
	return NewDuration(1<<63 - 1)
}

// NewDuration converts the given time.Duration value to a duration
func NewDuration(d time.Duration) Duration {
	return Duration(d)
}

// leadingInt consumes the leading [0-9]* from s.
func leadingInt(s string) (x int64, rem string, err error) {
	i := 0
	for ; i < len(s); i++ {
		c := s[i]
		if c < '0' || c > '9' {
			break
		}
		if x > (1<<63-1)/10 {
			// overflow
			return 0, "", trace.BadParameter("time: bad [0-9]*")
		}
		x = x*10 + int64(c) - '0'
		if x < 0 {
			// overflow
			return 0, "", trace.BadParameter("time: bad [0-9]*")
		}
	}
	return x, s[i:], nil
}

// leadingFraction consumes the leading [0-9]* from s.
// It is used only for fractions, so does not return an error on overflow,
// it just stops accumulating precision.
func leadingFraction(s string) (x int64, scale float64, rem string) {
	i := 0
	scale = 1
	overflow := false
	for ; i < len(s); i++ {
		c := s[i]
		if c < '0' || c > '9' {
			break
		}
		if overflow {
			continue
		}
		if x > (1<<63-1)/10 {
			// It's possible for overflow to give a positive number, so take care.
			overflow = true
			continue
		}
		y := x*10 + int64(c) - '0'
		if y < 0 {
			overflow = true
			continue
		}
		x = y
		scale *= 10
	}
	return x, scale, s[i:]
}

var unitMap = map[string]int64{
	"ns": int64(time.Nanosecond),
	"us": int64(time.Microsecond),
	"µs": int64(time.Microsecond), // U+00B5 = micro symbol
	"μs": int64(time.Microsecond), // U+03BC = Greek letter mu
	"ms": int64(time.Millisecond),
	"s":  int64(time.Second),
	"m":  int64(time.Minute),
	"h":  int64(time.Hour),
	"d":  int64(time.Hour * 24),
	"mo": int64(time.Hour * 24 * 30),
	"y":  int64(time.Hour * 24 * 365),
}

// parseDuration parses a duration string.
// A duration string is a possibly signed sequence of
// decimal numbers, each with optional fraction and a unit suffix,
// such as "300ms", "-1.5h" or "2h45m".
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
func parseDuration(s string) (Duration, error) {
	// [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+
	orig := s
	var d int64
	neg := false

	// Consume [-+]?
	if s != "" {
		c := s[0]
		if c == '-' || c == '+' {
			neg = c == '-'
			s = s[1:]
		}
	}
	// Special case: if all that is left is "0", this is zero.
	if s == "0" {
		return 0, nil
	}
	if s == "" {
		return 0, trace.BadParameter("time: invalid duration " + orig)
	}
	for s != "" {
		var (
			v, f  int64       // integers before, after decimal point
			scale float64 = 1 // value = v + f/scale
		)

		var err error

		// The next character must be [0-9.]
		if !(s[0] == '.' || '0' <= s[0] && s[0] <= '9') {
			return 0, trace.BadParameter("time: invalid duration " + orig)
		}
		// Consume [0-9]*
		pl := len(s)
		v, s, err = leadingInt(s)
		if err != nil {
			return 0, trace.BadParameter("time: invalid duration " + orig)
		}
		pre := pl != len(s) // whether we consumed anything before a period

		// Consume (\.[0-9]*)?
		post := false
		if s != "" && s[0] == '.' {
			s = s[1:]
			pl := len(s)
			f, scale, s = leadingFraction(s)
			post = pl != len(s)
		}
		if !pre && !post {
			// no digits (e.g. ".s" or "-.s")
			return 0, trace.BadParameter("time: invalid duration " + orig)
		}

		// Consume unit.
		i := 0
		for ; i < len(s); i++ {
			c := s[i]
			if c == '.' || '0' <= c && c <= '9' {
				break
			}
		}
		if i == 0 {
			return 0, trace.BadParameter("time: missing unit in duration " + orig)
		}
		u := s[:i]
		s = s[i:]
		unit, ok := unitMap[u]
		if !ok {
			return 0, trace.BadParameter("time: unknown unit " + " in duration " + orig)
		}
		if v > (1<<63-1)/unit {
			// overflow
			return 0, trace.BadParameter("time: invalid duration " + orig)
		}
		v *= unit
		if f > 0 {
			// float64 is needed to be nanosecond accurate for fractions of hours.
			// v >= 0 && (f*unit/scale) <= 3.6e+12 (ns/h, h is the largest unit)
			v += int64(float64(f) * (float64(unit) / scale))
			if v < 0 {
				// overflow
				return 0, trace.BadParameter("time: invalid duration " + orig)
			}
		}
		d += v
		if d < 0 {
			// overflow
			return 0, trace.BadParameter("time: invalid duration " + orig)
		}
	}

	if neg {
		d = -d
	}
	return Duration(d), nil
}


text:
.class public final Lcom/google/android/gms/internal/zzls;
.super Landroid/graphics/drawable/Drawable;

# interfaces
.implements Landroid/graphics/drawable/Drawable$Callback;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/gms/internal/zzls$1;,
        Lcom/google/android/gms/internal/zzls$zza;,
        Lcom/google/android/gms/internal/zzls$zzb;
    }
.end annotation

# instance fields
.field private mFrom:I

.field private zzNY:J

.field private zzaea:Z

.field private zzaeh:I

.field private zzaei:I

.field private zzaej:I

.field private zzaek:I

.field private zzael:I

.field private zzaem:Z

.field private zzaen:Lcom/google/android/gms/internal/zzls$zzb;

.field private zzaeo:Landroid/graphics/drawable/Drawable;

.field private zzaep:Landroid/graphics/drawable/Drawable;

.field private zzaeq:Z

.field private zzaer:Z

.field private zzaes:Z

.field private zzaet:I

# direct methods
.method public constructor <init>(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V
    .registers 6

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/google/android/gms/internal/zzls;-><init>(Lcom/google/android/gms/internal/zzls$zzb;)V

    if-nez p1, :cond_a

    invoke-static {}, Lcom/google/android/gms/internal/zzls$zza;->zzoG()Lcom/google/android/gms/internal/zzls$zza;

    move-result-object p1

    :cond_a
    iput-object p1, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {p1, p0}, Landroid/graphics/drawable/Drawable;->setCallback(Landroid/graphics/drawable/Drawable$Callback;)V

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    iget v1, v0, Lcom/google/android/gms/internal/zzls$zzb;->zzaex:I

    invoke-virtual {p1}, Landroid/graphics/drawable/Drawable;->getChangingConfigurations()I

    move-result v2

    or-int/2addr v1, v2

    iput v1, v0, Lcom/google/android/gms/internal/zzls$zzb;->zzaex:I

    if-nez p2, :cond_20

    invoke-static {}, Lcom/google/android/gms/internal/zzls$zza;->zzoG()Lcom/google/android/gms/internal/zzls$zza;

    move-result-object p2

    :cond_20
    iput-object p2, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {p2, p0}, Landroid/graphics/drawable/Drawable;->setCallback(Landroid/graphics/drawable/Drawable$Callback;)V

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    iget v1, v0, Lcom/google/android/gms/internal/zzls$zzb;->zzaex:I

    invoke-virtual {p2}, Landroid/graphics/drawable/Drawable;->getChangingConfigurations()I

    move-result v2

    or-int/2addr v1, v2

    iput v1, v0, Lcom/google/android/gms/internal/zzls$zzb;->zzaex:I

    return-void
.end method

.method constructor <init>(Lcom/google/android/gms/internal/zzls$zzb;)V
    .registers 4

    const/4 v1, 0x0

    invoke-direct {p0}, Landroid/graphics/drawable/Drawable;-><init>()V

    iput v1, p0, Lcom/google/android/gms/internal/zzls;->zzaeh:I

    const/16 v0, 0xff

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    iput v1, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaea:Z

    new-instance v0, Lcom/google/android/gms/internal/zzls$zzb;

    invoke-direct {v0, p1}, Lcom/google/android/gms/internal/zzls$zzb;-><init>(Lcom/google/android/gms/internal/zzls$zzb;)V

    iput-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    return-void
.end method

# virtual methods
.method public canConstantState()Z
    .registers 3

    const/4 v1, 0x1

    iget-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeq:Z

    if-nez v0, :cond_1a

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getConstantState()Landroid/graphics/drawable/Drawable$ConstantState;

    move-result-object v0

    if-eqz v0, :cond_1d

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getConstantState()Landroid/graphics/drawable/Drawable$ConstantState;

    move-result-object v0

    if-eqz v0, :cond_1d

    move v0, v1

    :goto_16
    iput-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaer:Z

    iput-boolean v1, p0, Lcom/google/android/gms/internal/zzls;->zzaeq:Z

    :cond_1a
    iget-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaer:Z

    return v0

    :cond_1d
    const/4 v0, 0x0

    goto :goto_16
.end method

.method public draw(Landroid/graphics/Canvas;)V
    .registers 9
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .prologue
    const/4 v1, 0x1

    const/high16 v6, 0x3f800000    # 1.0f

    const/4 v0, 0x0

    iget v2, p0, Lcom/google/android/gms/internal/zzls;->zzaeh:I

    packed-switch v2, :pswitch_data_86

    :cond_9
    :goto_9
    move v0, v1

    :goto_a
    iget v1, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    iget-boolean v2, p0, Lcom/google/android/gms/internal/zzls;->zzaea:Z

    iget-object v3, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    iget-object v4, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    if-eqz v0, :cond_63

    if-eqz v2, :cond_18

    if-nez v1, :cond_1b

    :cond_18
    invoke-virtual {v3, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    :cond_1b
    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    if-ne v1, v0, :cond_27

    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    invoke-virtual {v4, v0}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    invoke-virtual {v4, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    :cond_27
    :goto_27
    return-void

    :pswitch_28
    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v2

    iput-wide v2, p0, Lcom/google/android/gms/internal/zzls;->zzNY:J

    const/4 v1, 0x2

    iput v1, p0, Lcom/google/android/gms/internal/zzls;->zzaeh:I

    goto :goto_a

    :pswitch_32
    iget-wide v2, p0, Lcom/google/android/gms/internal/zzls;->zzNY:J

    const-wide/16 v4, 0x0

    cmp-long v2, v2, v4

    if-ltz v2, :cond_9

    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v2

    iget-wide v4, p0, Lcom/google/android/gms/internal/zzls;->zzNY:J

    sub-long/2addr v2, v4

    long-to-float v2, v2

    iget v3, p0, Lcom/google/android/gms/internal/zzls;->zzaek:I

    int-to-float v3, v3

    div-float/2addr v2, v3

    cmpl-float v3, v2, v6

    if-ltz v3, :cond_61

    :goto_4a
    if-eqz v1, :cond_4e

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeh:I

    :cond_4e
    invoke-static {v2, v6}, Ljava/lang/Math;->min(FF)F

    move-result v0

    iget v2, p0, Lcom/google/android/gms/internal/zzls;->mFrom:I

    int-to-float v2, v2

    iget v3, p0, Lcom/google/android/gms/internal/zzls;->zzaei:I

    iget v4, p0, Lcom/google/android/gms/internal/zzls;->mFrom:I

    sub-int/2addr v3, v4

    int-to-float v3, v3

    mul-float/2addr v0, v3

    add-float/2addr v0, v2

    float-to-int v0, v0

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    goto :goto_9

    :cond_61
    move v1, v0

    goto :goto_4a

    :cond_63
    if-eqz v2, :cond_6b

    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    sub-int/2addr v0, v1

    invoke-virtual {v3, v0}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    :cond_6b
    invoke-virtual {v3, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    if-eqz v2, :cond_75

    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    invoke-virtual {v3, v0}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    :cond_75
    if-lez v1, :cond_82

    invoke-virtual {v4, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    invoke-virtual {v4, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    invoke-virtual {v4, v0}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    :cond_82
    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->invalidateSelf()V

    goto :goto_27

    :pswitch_data_86
    .packed-switch 0x1
        :pswitch_28
        :pswitch_32
    .end packed-switch
.end method

.method public getChangingConfigurations()I
    .registers 3

    invoke-super {p0}, Landroid/graphics/drawable/Drawable;->getChangingConfigurations()I

    move-result v0

    iget-object v1, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    iget v1, v1, Lcom/google/android/gms/internal/zzls$zzb;->zzaew:I

    or-int/2addr v0, v1

    iget-object v1, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    iget v1, v1, Lcom/google/android/gms/internal/zzls$zzb;->zzaex:I

    or-int/2addr v0, v1

    return v0
.end method

.method public getConstantState()Landroid/graphics/drawable/Drawable$ConstantState;
    .registers 3

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->canConstantState()Z

    move-result v0

    if-eqz v0, :cond_11

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->getChangingConfigurations()I

    move-result v1

    iput v1, v0, Lcom/google/android/gms/internal/zzls$zzb;->zzaew:I

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaen:Lcom/google/android/gms/internal/zzls$zzb;

    :goto_10
    return-object v0

    :cond_11
    const/4 v0, 0x0

    goto :goto_10
.end method

.method public getIntrinsicHeight()I
    .registers 3

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v0

    iget-object v1, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v1

    invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I

    move-result v0

    return v0
.end method

.method public getIntrinsicWidth()I
    .registers 3

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v0

    iget-object v1, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v1

    invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I

    move-result v0

    return v0
.end method

.method public getOpacity()I
    .registers 3

    iget-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaes:Z

    if-nez v0, :cond_19

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getOpacity()I

    move-result v0

    iget-object v1, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1}, Landroid/graphics/drawable/Drawable;->getOpacity()I

    move-result v1

    invoke-static {v0, v1}, Landroid/graphics/drawable/Drawable;->resolveOpacity(II)I

    move-result v0

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzaet:I

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaes:Z

    :cond_19
    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaet:I

    return v0
.end method

.method public invalidateDrawable(Landroid/graphics/drawable/Drawable;)V
    .registers 3
    .param p1, "who"    # Landroid/graphics/drawable/Drawable;

    .prologue
    invoke-static {}, Lcom/google/android/gms/internal/zzmx;->zzqu()Z

    move-result v0

    if-eqz v0, :cond_f

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    if-eqz v0, :cond_f

    invoke-interface {v0, p0}, Landroid/graphics/drawable/Drawable$Callback;->invalidateDrawable(Landroid/graphics/drawable/Drawable;)V

    :cond_f
    return-void
.end method

.method public mutate()Landroid/graphics/drawable/Drawable;
    .registers 3

    iget-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaem:Z

    if-nez v0, :cond_25

    invoke-super {p0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    if-ne v0, p0, :cond_25

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->canConstantState()Z

    move-result v0

    if-nez v0, :cond_18

    new-instance v0, Ljava/lang/IllegalStateException;

    const-string v1, "One or more children of this LayerDrawable does not have constant state; this drawable cannot be mutated."

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_18
    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/internal/zzls;->zzaem:Z

    :cond_25
    return-object p0
.end method

.method protected onBoundsChange(Landroid/graphics/Rect;)V
    .registers 3
    .param p1, "bounds"    # Landroid/graphics/Rect;

    .prologue
    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V

    return-void
.end method

.method public scheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V
    .registers 6
    .param p1, "who"    # Landroid/graphics/drawable/Drawable;
    .param p2, "what"    # Ljava/lang/Runnable;
    .param p3, "when"    # J

    .prologue
    invoke-static {}, Lcom/google/android/gms/internal/zzmx;->zzqu()Z

    move-result v0

    if-eqz v0, :cond_f

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    if-eqz v0, :cond_f

    invoke-interface {v0, p0, p2, p3, p4}, Landroid/graphics/drawable/Drawable$Callback;->scheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V

    :cond_f
    return-void
.end method

.method public setAlpha(I)V
    .registers 4
    .param p1, "alpha"    # I

    .prologue
    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    iget v1, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    if-ne v0, v1, :cond_8

    iput p1, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    :cond_8
    iput p1, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->invalidateSelf()V

    return-void
.end method

.method public setColorFilter(Landroid/graphics/ColorFilter;)V
    .registers 3
    .param p1, "cf"    # Landroid/graphics/ColorFilter;

    .prologue
    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeo:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setColorFilter(Landroid/graphics/ColorFilter;)V

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setColorFilter(Landroid/graphics/ColorFilter;)V

    return-void
.end method

.method public startTransition(I)V
    .registers 4
    .param p1, "durationMillis"    # I

    .prologue
    const/4 v1, 0x0

    iput v1, p0, Lcom/google/android/gms/internal/zzls;->mFrom:I

    iget v0, p0, Lcom/google/android/gms/internal/zzls;->zzaej:I

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzaei:I

    iput v1, p0, Lcom/google/android/gms/internal/zzls;->zzael:I

    iput p1, p0, Lcom/google/android/gms/internal/zzls;->zzaek:I

    const/4 v0, 0x1

    iput v0, p0, Lcom/google/android/gms/internal/zzls;->zzaeh:I

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->invalidateSelf()V

    return-void
.end method

.method public unscheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V
    .registers 4
    .param p1, "who"    # Landroid/graphics/drawable/Drawable;
    .param p2, "what"    # Ljava/lang/Runnable;

    .prologue
    invoke-static {}, Lcom/google/android/gms/internal/zzmx;->zzqu()Z

    move-result v0

    if-eqz v0, :cond_f

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzls;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    if-eqz v0, :cond_f

    invoke-interface {v0, p0, p2}, Landroid/graphics/drawable/Drawable$Callback;->unscheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V

    :cond_f
    return-void
.end method

.method public zzoF()Landroid/graphics/drawable/Drawable;
    .registers 2

    iget-object v0, p0, Lcom/google/android/gms/internal/zzls;->zzaep:Landroid/graphics/drawable/Drawable;

    return-object v0
.end method


text:
from nose.tools import assert_raises
import anyjson

modnames = [e[0] for e in anyjson._modules]

def test_default_serialization():
    assert anyjson.dumps([1,2,3]).replace(" ", "") == "[1,2,3]"
    assert anyjson.serialize([1,2,3]).replace(" ", "") == "[1,2,3]"

def test_default_deserialization():
    assert anyjson.loads("[1,2,3]") == [1,2,3]
    assert anyjson.deserialize("[1,2,3]") == [1,2,3]

def test_forced_serialization():
    for name in modnames:
        try:
            anyjson.force_implementation(name)
        except ImportError:
            continue # module can't be tested, try next

        assert anyjson.dumps([1,2,3]).replace(" ", "") == "[1,2,3]"
        assert anyjson.serialize([1,2,3]).replace(" ", "") == "[1,2,3]"

def test_forced_deserialization():
    for name in modnames:
        try:
            anyjson.force_implementation(name)
        except ImportError:
            continue # module can't be tested, try next

        assert anyjson.loads("[1,2,3]") == [1,2,3]
        assert anyjson.deserialize("[1,2,3]") == [1,2,3]

def test_exceptions():
    for name in modnames:
        try:
            anyjson.force_implementation(name)
        except ImportError:
            continue # module can't be tested, try next

        assert_raises(TypeError, anyjson.dumps, [object()])
        assert_raises(TypeError, anyjson.serialize, [object()])
        assert_raises(ValueError, anyjson.loads, "[")
        assert_raises(ValueError, anyjson.deserialize, "[")

def test_json_loads_unicode():
    try:
        anyjson.force_implementation("json")
    except ImportError:
        return

    assert "foo" in anyjson.loads(u'{"foo": "bar"}')


text:
package io.github.kkysen.quicktrip.apis.hotels.secret;

import io.github.kkysen.quicktrip.app.data.Hotel;
import io.github.kkysen.quicktrip.json.Json;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 *
 *
 * @author Khyber Sen
 */
@Json
@RequiredArgsConstructor
@Getter
public class JsonHotelsHotel implements Hotel {

    /*
     * FIXME this is unfinished
     * these are the main fields I want, but they're not all simple fields, but objects
     * JsonHotelsHotelsAdapter right now only does these fields w/o any error checking
     */

    private final String name;
    private final String phoneNumber;
    private final String address;
    private final String imgUrl;
    private final double rating;
    private final double distance;
    private final int price;

    @Override
    public String toString() {
        return "JsonHotelsHotel [name=" + name + ", phoneNumber=" + phoneNumber + ", address="
                + address + ", imgUrl=" + imgUrl + ", rating=" + rating + ", distance=" + distance
                + ", price=" + price + "]";
    }

}


text:
const path = require('path');
const Webpack = require('webpack');
const HTMLWebpackPlugin = require('html-webpack-plugin');

const precss = require('precss');
const autoprefixer = require('autoprefixer');

const HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
  template: path.join(__dirname, 'src', 'index.html'),
  filename: 'index.html',
  inject: 'body'
});

module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'webpack/hot/dev-server',
    'webpack-dev-server/client?http://localhost:8080',
    `${__dirname}/src/index.js`
  ],
  output: {
    path: `${__dirname}/dist`,
    filename: 'bundle.js'
  },

  resolve: {
    root: path.resolve(__dirname),
    alias: {
      components: 'src/components',
      containers: 'src/containers'
    },
    extensions: ['', '.js']
  },

  module: {
    loaders: [
      { test: /\.json$/, loader: 'json' },
      { test: /\.js$/, exclude: /node_modules/, loader: 'react-hot!babel' },
      { test: /\.css$/, include: /src/, loader: 'style!css?modules&importLoaders=1!postcss' }
    ]
  },

  plugins: [
    HTMLWebpackPluginConfig,
    new Webpack.HotModuleReplacementPlugin(),
    new Webpack.NoErrorsPlugin(),
  ],

  postcss: [
    autoprefixer, precss
  ],

  devServer: {
    quiet: true,
    contentBase: './dist',
    colors: true,
    historyApiFallback: true,
    hot: true,
    inline: true
  },
};


text:
namespace {

const char kCroshExtensionEntryPoint[] = "/html/crosh.html";

const extensions::Extension* GetTerminalExtension(Profile* profile) {
  // Search order for terminal extensions.
  // We prefer hterm-dev, then hterm, then the builtin crosh extension.
  static const char* kPossibleAppIds[] = {
    extension_misc::kHTermDevAppId,
    extension_misc::kHTermAppId,
    extension_misc::kCroshBuiltinAppId,
  };

  // The hterm-dev should be first in the list.
  DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermDevAppId);

  ExtensionService* service = profile->GetExtensionService();
  for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) {
    const extensions::Extension* extension = service->GetExtensionById(
        kPossibleAppIds[x], false);
    if (extension)
      return extension;
  }

  return NULL;
}

}  // namespace

namespace extensions {

GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) {
  const extensions::Extension* extension = GetTerminalExtension(profile);
  if (!extension)
    return GURL();

  return extension->GetResourceURL(kCroshExtensionEntryPoint);
}

}  // namespace extensions


text:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<nite:root nite:id="WO2007000651.chemical-names" xmlns:nite="http://nite.sourceforge.net/">
</nite:root>