text:
name 'rage4dns'
maintainer 'Li-Te Chen'
maintainer_email 'datacoda@gmail.com'
license 'Apache 2.0'
description 'Installs/Configures rage4dns'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.0.2'

supports 'ubuntu'

depends 'cron'

redpajama_set_name: RedPajamaGithub


text:
@extends('app')

@section('title')
Add New Post
@endsection

@section('content')

<form action="/tutorials/blog/public/new-post" method="post">
	<input type="hidden" name="_token" value="{{ csrf_token() }}">

		<input required="required" value="{{ old('title') }}" placeholder="Enter title here" type="text" name = "title"class="form-control" />

		<textarea name='body'class="form-control">{{ old('body') }}</textarea>

	<input type="submit" name='publish' class="btn btn-success" value = "Publish"/>
	<input type="submit" name='save' class="btn btn-default" value = "Save Draft" />
</form>
@endsection


text:
require "spec_helper"

describe PusherFake::Channel::Presence do
  subject { described_class }

  let(:name) { "channel" }

  it "inherits from private channel" do
    expect(subject.ancestors).to include(PusherFake::Channel::Private)
  end

  it "creates an empty members hash" do
    channel = subject.new(name)

    expect(channel.members).to eq({})
  end
end

describe PusherFake::Channel::Presence, "#add" do
  subject { described_class.new(name) }

  let(:name)              { "name" }
  let(:user_id)           { "1234" }
  let(:connection)        { instance_double(PusherFake::Connection, emit: nil) }
  let(:connections)       { instance_double(Array, push: nil, length: 0) }
  let(:channel_data)      { { user_id: user_id } }
  let(:authentication)    { "auth" }
  let(:subscription_data) { { presence: { hash: {}, count: 1 } } }

  let(:data) do
    { auth:         authentication,
      channel_data: MultiJson.dump(channel_data) }
  end

  before do
    allow(PusherFake::Webhook).to receive(:trigger)
    allow(MultiJson).to receive(:load).and_return(channel_data)
    allow(subject).to receive(:connections).and_return(connections)
    allow(subject).to receive(:emit).and_return(nil)
    allow(subject).to receive(:subscription_data).and_return(subscription_data)
  end

  it "authorizes the connection" do
    allow(subject).to receive(:authorized?).and_return(nil)

    subject.add(connection, data)

    expect(subject).to have_received(:authorized?).with(connection, data)
  end

  it "parses the channel_data when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(MultiJson).to have_received(:load)
      .with(data[:channel_data], symbolize_keys: true)
  end

  it "assigns the channel_data to the members hash for current connection" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(subject.members[connection]).to eq(channel_data)
  end

  it "notifies the channel of the new member when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(subject).to have_received(:emit)
      .with("pusher_internal:member_added", channel_data)
  end

  it "successfully subscribes the connection when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(connection).to have_received(:emit)
      .with("pusher_internal:subscription_succeeded",
            subscription_data, subject.name)
  end

  it "adds the connection to the channel when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(connections).to have_received(:push).with(connection)
  end

  it "triggers occupied webhook for first connection added when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)
    allow(subject).to receive(:connections).and_call_original

    2.times { subject.add(connection, data) }

    expect(PusherFake::Webhook).to have_received(:trigger)
      .with("channel_occupied", channel: name).once
  end

  it "triggers the member added webhook when authorized" do
    allow(subject).to receive(:authorized?).and_return(true)

    subject.add(connection, data)

    expect(PusherFake::Webhook).to have_received(:trigger)
      .with("member_added", channel: name, user_id: user_id).once
  end

  it "unsuccessfully subscribes the connection when not authorized" do
    allow(subject).to receive(:authorized?).and_return(false)

    subject.add(connection, data)

    expect(connection).to have_received(:emit)
      .with("pusher_internal:subscription_error", {}, subject.name)
  end

  it "does not trigger channel occupied webhook when not authorized" do
    allow(subject).to receive(:authorized?).and_return(false)
    allow(subject).to receive(:connections).and_call_original

    2.times { subject.add(connection, data) }

    expect(PusherFake::Webhook).not_to have_received(:trigger)
  end

  it "does not trigger the member added webhook when not authorized" do
    allow(subject).to receive(:authorized?).and_return(false)

    subject.add(connection, data)

    expect(PusherFake::Webhook).not_to have_received(:trigger)
  end
end

describe PusherFake::Channel::Presence, "#remove" do
  subject { described_class.new(name) }

  let(:name)         { "name" }
  let(:user_id)      { "1234" }
  let(:connection)   { double }
  let(:channel_data) { { user_id: user_id } }

  before do
    allow(PusherFake::Webhook).to receive(:trigger)
    allow(subject).to receive(:connections).and_return([connection])
    allow(subject).to receive(:emit).and_return(nil)

    subject.members[connection] = channel_data
  end

  it "removes the connection from the channel" do
    subject.remove(connection)

    expect(subject.connections).to be_empty
  end

  it "removes the connection from the members hash" do
    subject.remove(connection)

    expect(subject.members).not_to have_key(connection)
  end

  it "triggers the member removed webhook" do
    subject.remove(connection)

    expect(PusherFake::Webhook).to have_received(:trigger)
      .with("member_removed", channel: name, user_id: user_id).once
  end

  it "notifies the channel of the removed member" do
    subject.remove(connection)

    expect(subject).to have_received(:emit)
      .with("pusher_internal:member_removed", channel_data)
  end
end

describe PusherFake::Channel::Presence,
         "#remove, for an unsubscribed connection" do
  subject { described_class.new(name) }

  let(:name)         { "name" }
  let(:user_id)      { "1234" }
  let(:connection)   { double }
  let(:channel_data) { { user_id: user_id } }

  before do
    allow(subject).to receive(:connections).and_return([])
    allow(subject).to receive(:emit).and_return(nil)
    allow(subject).to receive(:trigger).and_return(nil)
  end

  it "does not raise an error" do
    expect do
      subject.remove(connection)
    end.not_to raise_error
  end

  it "does not trigger an event" do
    subject.remove(connection)

    expect(subject).not_to have_received(:trigger)
      .with("member_removed", channel: name, user_id: user_id)
  end

  it "does not emit an event" do
    subject.remove(connection)

    expect(subject).not_to have_received(:emit)
      .with("pusher_internal:member_removed", channel_data)
  end
end

describe PusherFake::Channel::Presence, "#subscription_data" do
  subject { described_class.new("name") }

  let(:one)     { { user_id: 1, name: "Bob" } }
  let(:two)     { { user_id: 2, name: "Beau" } }
  let(:data)    { subject.subscription_data }
  let(:members) { { double => one } }

  before do
    allow(subject).to receive(:members).and_return(members)
  end

  it "returns hash with presence information" do
    expect(data).to eq(presence: {
                         hash:  { one[:user_id] => one[:user_info] },
                         count: 1
                       })
  end

  it "handles multiple members" do
    members[double] = two

    expect(data[:presence][:count]).to eq(2)
    expect(data[:presence][:hash]).to eq(
      one[:user_id] => one[:user_info], two[:user_id] => two[:user_info]
    )
  end
end


text:
import time

from pytest import mark

from cauldron.session.projects import specio

SCENARIOS = [
    (20, 'just now'),
    (3 * 60, '3 minutes ago'),
    (3 * 3600, '3 hours ago'),
    (4 * 86400, '4 days ago'),
    (6 * 7 * 86400, '6 weeks ago'),
    (367 * 86400, '1 year ago'),
    (3 * 365 * 86400, '3 years ago'),
]

@mark.parametrize('offset, expected', SCENARIOS)
def test_format_times(offset: float, expected: str):
    """Should return formatted time according to scenario expectation."""
    timestamp = time.time() - offset
    assert expected == specio.format_times(timestamp)['elapsed']


text:
@interface BRBubbleView ()

@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) CAShapeLayer *arrow;

@end

@implementation BRBubbleView

- (BOOL)canBecomeFirstResponder {
    return YES;
}

- (BOOL)resignFirstResponder {
    if ([super resignFirstResponder]) {
        [self popOut];
        return YES;
    }
    else
        return NO;
}

+ (instancetype)viewWithText:(NSString *)text center:(CGPoint)center {
    BRBubbleView *v = [[self alloc] initWithFrame:CGRectMake(center.x - MARGIN_X, center.y - MARGIN_Y, MARGIN_X * 2,
                                                             MARGIN_Y * 2)];

    v.text = text;
    return v;
}

+ (instancetype)viewWithText:(NSString *)text tipPoint:(CGPoint)point tipDirection:(BRBubbleTipDirection)direction {
    BRBubbleView *v = [[self alloc] initWithFrame:CGRectMake(0, 0, MARGIN_X * 2, MARGIN_Y * 2)];

    v.text = text;
    v.tipDirection = direction;
    v.tipPoint = point;
    return v;
}

+ (instancetype)viewWithAttributedText:(NSAttributedString *)attributedText center:(CGPoint)center {
    BRBubbleView *v = [[self alloc] initWithFrame:CGRectMake(center.x - MARGIN_X, center.y - MARGIN_Y, MARGIN_X * 2, MARGIN_Y * 2)];

    v.attributedText = attributedText;
    return v;
}

+ (instancetype)viewWithAttributedText:(NSAttributedString *)attributedText tipPoint:(CGPoint)point tipDirection:(BRBubbleTipDirection)direction {
    BRBubbleView *v = [[self alloc] initWithFrame:CGRectMake(0, 0, MARGIN_X * 2, MARGIN_Y * 2)];

    v.attributedText = attributedText;
    v.tipDirection = direction;
    v.tipPoint = point;
    return v;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (!(self = [super initWithFrame:frame]))
        return nil;

    self.layer.cornerRadius = RADIUS;
    self.backgroundColor = [UIColor lightGrayColor];
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(MARGIN_X, MARGIN_Y, frame.size.width - MARGIN_X * 2,
                                                           frame.size.height - MARGIN_Y * 2)];
    self.label.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    self.label.textAlignment = NSTextAlignmentCenter;
    self.label.textColor = [UIColor whiteColor];
    self.label.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
    self.label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.15];
    self.label.shadowOffset = CGSizeMake(0.0, 1.0);
    self.label.numberOfLines = 0;
    [self addSubview:self.label];

    return self;
}

- (void)dealloc {
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
}

- (void)setText:(NSString *)text {
    self.label.text = text;
    [self setNeedsLayout];
}

- (NSString *)text {
    return self.label.text;
}

- (void)setAttributedText:(NSAttributedString *)text {
    self.label.attributedText = text;
    [self setNeedsLayout];
}

- (NSAttributedString *)attributedText {
    return self.label.attributedText;
}

- (void)setFont:(UIFont *)font {
    self.label.font = font;
    [self setNeedsLayout];
}

- (UIFont *)font {
    return self.label.font;
}

- (void)setTipPoint:(CGPoint)tipPoint {
    _tipPoint = tipPoint;
    [self setNeedsLayout];
}

- (void)setTipDirection:(BRBubbleTipDirection)tipDirection {
    _tipDirection = tipDirection;
    [self setNeedsLayout];
}

- (void)setCustomView:(UIView *)customView {
    if (_customView)
        [_customView removeFromSuperview];
    _customView = customView;
    customView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |
                                  UIViewAutoresizingFlexibleBottomMargin;
    if (customView)
        [self addSubview:customView];
    [self setNeedsLayout];
}

- (instancetype)popIn {
    self.alpha = 0.0;
    self.transform = CGAffineTransformMakeScale(0.75, 0.75);

    [UIView animateWithDuration:0.5
                          delay:0.0
         usingSpringWithDamping:0.5
          initialSpringVelocity:0
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
                         self.transform = CGAffineTransformMakeScale(1.0, 1.0);
                         self.alpha = 1.0;
                     }
                     completion:nil];

    return self;
}

- (instancetype)popOut {
    [UIView animateWithDuration:0.25
        delay:0.0
        options:UIViewAnimationOptionCurveEaseOut
        animations:^{
            self.alpha = 0.0;
            self.transform = CGAffineTransformMakeScale(0.75, 0.75);
        }
        completion:^(BOOL finished) {
            [self removeFromSuperview];
        }];

    return self;
}

- (instancetype)popOutAfterDelay:(NSTimeInterval)delay {
    [self performSelector:@selector(popOut) withObject:nil afterDelay:delay];
    return self;
}

- (void)layoutSubviews {
    CGPoint center = self.center;
    CGRect rect = [self.label textRectForBounds:CGRectMake(0.0, 0.0, MAX_WIDTH - MARGIN_X * 2, CGFLOAT_MAX)
                         limitedToNumberOfLines:0];

    if (self.customView) {
        if (rect.size.width < self.customView.frame.size.width)
            rect.size.width = self.customView.frame.size.width;
        rect.size.height += self.customView.frame.size.height + (self.text.length > 0 ? MARGIN_Y : 0);
    }

    if (self.tipPoint.x > 1) { // position bubble to point to tipPoint
        center.x = self.tipPoint.x;

        if (center.x + rect.size.width / 2 > self.superview.frame.size.width - MARGIN_EDGE) {
            center.x = (self.superview.frame.size.width - MARGIN_EDGE) - rect.size.width / 2;
        }
        else if (center.x - rect.size.width / 2 < MARGIN_EDGE + MARGIN_X) {
            center.x = MARGIN_EDGE + MARGIN_X + rect.size.width / 2;
        }

        center.y = self.tipPoint.y;
        center.y += (self.tipDirection == BRBubbleTipDirectionUp ? 1 : -1) * ((rect.size.height + MARGIN_Y * 2) / 2 + RADIUS);
    }

    self.frame = CGRectMake(center.x - (rect.size.width + MARGIN_X * 2) / 2, center.y - (rect.size.height + MARGIN_Y * 2) / 2,
                            rect.size.width + MARGIN_X * 2, rect.size.height + MARGIN_Y * 2);

    if (self.customView) { // layout customView and label
        self.customView.center = CGPointMake((rect.size.width + MARGIN_X * 2) / 2,
                                             self.customView.frame.size.height / 2 + MARGIN_Y);
        self.label.frame = CGRectMake(MARGIN_X, self.customView.frame.size.height + MARGIN_Y * 2,
                                      self.label.frame.size.width,
                                      self.frame.size.height - (self.customView.frame.size.height + MARGIN_Y * 3));
    }
    else {
        self.label.frame = CGRectMake(MARGIN_X, MARGIN_Y, self.label.frame.size.width,
                                      self.frame.size.height - MARGIN_Y * 2);
    }

    if (self.tipPoint.x > 1) { // draw tip arrow
        CGMutablePathRef path = CGPathCreateMutable();
        CGFloat x = self.tipPoint.x - (center.x - (rect.size.width + MARGIN_X * 2) / 2);

        if (!self.arrow)
            self.arrow = [[CAShapeLayer alloc] init];
        if (x > rect.size.width + MARGIN_X * 2 - (RADIUS + 7.5))
            x = rect.size.width + MARGIN_X * 2 - (RADIUS + 7.5);
        if (x < self.layer.cornerRadius + 7.5)
            x = self.layer.cornerRadius + 7.5;

        if (self.tipDirection == BRBubbleTipDirectionUp) {
            CGPathMoveToPoint(path, NULL, 0.0, 7.5);
            CGPathAddLineToPoint(path, NULL, 7.5, 0.0);
            CGPathAddLineToPoint(path, NULL, 15.0, 7.5);
            CGPathAddLineToPoint(path, NULL, 0.0, 7.5);
            self.arrow.position = CGPointMake(x, 0.5);
            self.arrow.anchorPoint = CGPointMake(0.5, 1.0);
        }
        else {
            CGPathMoveToPoint(path, NULL, 0.0, 0.0);
            CGPathAddLineToPoint(path, NULL, 7.5, 7.5);
            CGPathAddLineToPoint(path, NULL, 15.0, 0.0);
            CGPathAddLineToPoint(path, NULL, 0.0, 0.0);
            self.arrow.position = CGPointMake(x, rect.size.height + MARGIN_Y * 2 - 0.5);
            self.arrow.anchorPoint = CGPointMake(0.5, 0.0);
        }

        self.arrow.path = path;
        self.arrow.strokeColor = [UIColor clearColor].CGColor;
        self.arrow.fillColor = self.backgroundColor.CGColor;
        self.arrow.bounds = CGRectMake(0.0, 0.0, 15.0, 7.5);
        [self.layer addSublayer:self.arrow];
        CGPathRelease(path);
    }
    else if (self.arrow) { // remove tip arrow
        [self.arrow removeFromSuperlayer];
        self.arrow = nil;
    }

    [super layoutSubviews];
}

@end


text:
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}

module Test.Refine where

import Prelude

import Control.Monad
import Data.List
import Language.Haskell.TH
import Test.QuickCheck

import Debug.Trace

qRefineEq = qRefineWith Nothing
qRefine f = qRefineWith (Just f)

qRefineWith :: Maybe Name -> Name -> Name -> [Name] -> Name -> Q Exp
qRefineWith eq op_a op_c names_c abs_fun = do
  let
    abstract_name i =
      "abstract_" ++ "_" ++ show i --wow
    abstract f arg n
      | isPrefixOf "ref_" (nameBase arg)
      = valD (varP n) (normalB (appE (varE f) (varE arg))) []
      | otherwise
      = valD (varP n) (normalB (varE arg)) []
    abstract_app ns =
      foldl appE (varE op_a) (fmap varE ns)
    concrete_app ns =
      foldl appE (varE op_c) (fmap varE ns)

  names_a <- mapM (return . mkName . abstract_name) [0..length names_c - 1]
  lets <- zipWithM (abstract abs_fun) names_c names_a
  letE (fmap pure lets)
    $ case eq of
        Nothing ->
          [|$(abstract_app names_a) === $(concrete_app names_c)|]
        Just f ->
          [|$(varE f) $(abstract_app names_a) ($(varE abs_fun) $(concrete_app names_c))|]

functionT :: Name -> Q [Type]
functionT name = do
  info <- reify name
  let
    go = return . takeArrowsT
  case info of
    ClassOpI _ t _ _ ->
      go t
    VarI _ t _ _ ->
      go t
    _ ->
      error ("not a function: " ++ nameBase name)

takeArrowsT :: Type -> [Type]
takeArrowsT =
  let
    go x | trace ("go: " ++ show x) False = undefined
    go (ForallT _ _ t) =
      go t
    go (AppT ArrowT t) =
      [t]
    go (AppT x y) =
      go x ++ go y
    go _ =
      []
  in go


text:
0.2.0
=====

Switches from running activity and decision loops in a thread to running
them as child process. This will simplify monitoring the different loops
and provide insulation from the other loops.

* Adds ```simpler_workflow:work``` rake task to locate, load and run the
  activity and decision loops.
* Adds the option to perform an action after forking a child process.
* Adds a swf script used to manage the workflow. The following actions
  are supported:
  * *start* - Start the activity and decision loops located under
    lib/workflow as a daemon
  * *run* - runs the activity and decision loops without daemonizing
    them.
  * *stop* - stops the activity and decision loops.
  * *pstree* - shows the child processes
  * *shutdown* - shuts down the activity and decision loops
  * *tail* - tails the logs associated with the workflow.
* Preloads the Rails environment (if running under Rails) to reduce the
  amount of time spent loading it after forking. May also reduce the
  memory footprint of the application by sharing memory (on some
  platform).

Migrating to 0.2.0
------------------

The workflow definitions should stay the same. You can either choose to
use the ```swf``` script to manage the workflows, build on top of the ```simpler_workflow:work```
rake task or keep your existing scripts.

You will need to add ```Process.waitall``` to prevent the parent
process from exiting prematurely.

Using the ```SimplerWorkflow.after_fork``` method
-------------------------------------------------

You can use the ```SimplerWorkflow.after_form``` method to perform
actions after the child processes have been forked. This is useful to
re-establish ActiveRecord connections when using PostgreSQL for example.
Here's an example of this usage:

```ruby
SimplerWorkflow.after_fork do
  ActiveRecord::Base.establish_connection
end
```

It's usage is very similar to Resque's usage.


text:
require(["jquery", "sakai/sakai.api.core"], function($, sakai){

    /**
     * @name sakai_global.carousel
     *
     * @class carousel
     *
     * @description
     *
     * @version 0.0.1
     * @param {String} tuid Unique id of the widget
     * @param {Boolean} showSettings Show the settings of the widget or not
     */
    sakai_global.carousel = function(tuid, showSettings){

        /////////////////////////////
        // Configuration variables //
        /////////////////////////////

        // Containers
        var carouselContainer = "#carousel_container";

        // Templates
        var carouselSingleColumnTemplate = "carousel_single_column_template";

        /////////////////////
        // RENDER PREVIEWS //
        /////////////////////

        var renderImagePreview = function(contentURL, lastModified){
            var url = "/p/" + contentURL + "?_=" + lastModified;
            return "<img src=\"" + url + "\" style=\"max-width:350;\"/>";
        };

        var isJwPlayerSupportedVideo = function(mimeType){
            var supported = false;
            if (mimeType.substring(0, 6) === "video/") {
                var mimeSuffix = mimeType.substring(6);
                if (mimeSuffix === "x-flv" || mimeSuffix === "mp4" || mimeSuffix === "3gpp" || mimeSuffix === "quicktime") {
                    supported = true;
                }
            }
            return supported;
        };

        var createSWFObject = function(url, params, flashvars){
            if (!url) {
                url = "/devwidgets/video/jwplayer/player-licensed.swf";
            }
            var so = new SWFObject(url, 'ply', '350', '197', '9', '#ffffff');
            so.addParam('allowfullscreen', 'true');
            if (params.allowscriptaccess) {
                so.addParam('allowscriptaccess', params.allowscriptaccess);
            }
            else {
                so.addParam('allowscriptaccess', 'always');
            }
            so.addParam('wmode', 'opaque');
            return so;
        };

        var renderVideoPlayer = function(url){
            var so = createSWFObject(false, {}, {});
            so.addVariable('file', "/p/" + url);
            so.addVariable('stretching', 'uniform');
            so.write("carousel_video");
            return $("#carousel_video_holder").html();
        };

        /////////////////////
        // RENDER CAROUSEL //
        /////////////////////

        var updateViewAfterAnimation = function(carousel, li, index, state){
            if (index > carousel.options.size || index < 1) {
                index = index % carousel.options.size;
                if (!index) {
                    index = carousel.options.size;
                }
                if (index < 1) {
                    index = carousel.options.size + index;
                }
            }
            $("#carousel_container .carousel_view_toggle li").removeClass("carousel_view_toggle_selected");
            $("#carousel_view_toggle_" + carousel.last).removeClass("carousel_view_toggle_selected");
            $("#carousel_view_toggle_" + index).addClass("carousel_view_toggle_selected");

            $(window).bind("sakai.addToContacts.requested", function(evObj, user){
                var addbutton = $.grep($("#carousel_container .sakai_addtocontacts_overlay"), function(value, index) {
                    return $(value).attr("sakai-entityid") === user.userid;
                });
                $(addbutton).remove();
            });
        };

        var stopAutoScrolling = function(carousel){
            carousel.startAuto(0);
        };

        var carouselBinding = function(carousel){
            // Pause autoscrolling if the user moves with the cursor over the clip.
            carousel.clip.hover(function(){
                carousel.stopAuto();
            }, function(){
                carousel.startAuto();
            });

            // Disable autoscrolling if the user clicks the prev or next button.
            carousel.buttonNext.bind('click', function(){
                stopAutoScrolling(carousel);
            });

            carousel.buttonPrev.bind('click', function(){
                stopAutoScrolling(carousel);
            });

            $('.carousel_view_toggle li').bind('click', function(){
                stopAutoScrolling(carousel);
                carousel.scroll($.jcarousel.intval($(this)[0].id.split("carousel_view_toggle_")[1]));
                $("#carousel_container .carousel_view_toggle li").removeClass("carousel_view_toggle_selected");
                $(this).addClass("carousel_view_toggle_selected");
                return false;
            });

            $(window).bind(tuid + ".shown.sakai", {"carousel": carousel}, toggleCarousel);
        };

        var toggleCarousel = function(e, showing){
            if (showing) {
                e.data.carousel.startAuto();
            } else {
                e.data.carousel.stopAuto();
            }
        };

        var renderCarousel = function(dataArr){
            sakai.api.Util.TemplateRenderer(carouselSingleColumnTemplate, {
                "data": dataArr,
                "sakai": sakai
            }, $(carouselContainer), false);
            applyThreeDots();
            $(carouselContainer).jcarousel({
                auto: 8,
                animation: "slow",
                scroll: 1,
                easing: "swing",
                size: dataArr.length,
                initCallback: carouselBinding,
                wrap: "circular",
                itemFirstInCallback: {
                    onAfterAnimation: updateViewAfterAnimation
                }
            });
        };

        var applyThreeDots = function(){
            $.each($(".carousel_apply_threedots"), function(index, item){
                var maxrows = 1;
                if (item && item.className) {
                    var classes = item.className.split(" ");
                    $.each(classes, function(i, cl){
                        if (cl && cl.indexOf("threedots_allow_") === 0) {
                            maxrows = parseInt(cl.split("threedots_allow_")[1], 10);
                            return false;
                        }
                    });
                }
                $(item).text(sakai.api.Util.applyThreeDots($(item).text(), $(item).width(), {max_rows:maxrows}, "carousel_content_tags s3d_action", true));
            });
        };

        var parseContent = function(data, dataArr, callback){
            var noPreviewArr = [];
            var previewArr = [];

            if (data && data.content && data.content.results) {
                sakai.api.Content.prepareContentForRender(data.content.results, sakai.data.me, function(results){
                    $.each(results, function(index, item) {
                        if (item.thumbnail){
                            previewArr.push(item);
                        } else {
                            noPreviewArr.push(item);
                        }
                    });
                    // Prefer items with previews
                    var suggested = {
                        contentType: "suggestedContent",
                        suggestions: previewArr.concat(noPreviewArr)
                    };
                    dataArr.push(suggested);
                    callback(data, dataArr);
                });
            }
        };

        var parseGroups = function(data, dataArr){
            var picDescTags = [];
            var picDesc = [];
            var picTags = [];
            var descTags = [];
            var desc = [];
            var tags = [];
            var noPic = [];
            $.each(data.groups.results, function (index, group){
                var obj = {};

                if (group["sakai:group-description"] && group["sakai:group-description"].length) {
                    obj.description = group["sakai:group-description"];
                }
                if (group["sakai:tags"] && group["sakai:tags"].length) {
                    obj.tags = sakai.api.Util.formatTags(group["sakai:tags"]);
                }
                if (group.picture){
                    obj.picture = sakai.api.Groups.getProfilePicture(group);
                }
                obj.counts = group.counts;

                obj.contentType = "group";
                obj.groupid = group["sakai:group-id"];
                obj.title = group["sakai:group-title"];

                if (obj.picture && obj.description && obj.tags) {
                    picDescTags.push(obj);
                } else if (obj.picture && obj.description) {
                    picDesc.push(obj);
                } else if (obj.picture && obj.tags) {
                    picTags.push(obj);
                } else if (obj.description && obj.tags) {
                    descTags.push(obj);
                } else if (obj.description) {
                    desc.push(obj);
                } else if (obj.tags) {
                    tags.push(obj);
                } else {
                    noPic.push(obj);
                }
            });
            var suggested = {
                contentType: "suggestedGroups",
                suggestions: picDescTags.concat(picDesc, picTags, descTags, desc, tags, noPic).splice(0,6)
            };

            dataArr.push(suggested);

        };

        var parseUsers = function(data, dataArr){
            var hasPicAndTag = [];
            var hasPic = [];
            var hasTag = [];
            var noPicAndTag = [];

            sakai.api.User.getContacts(function() {
                $.each(data.users.results, function (index, user){
                    var obj = {};

                    obj.userid = user.profile.userid;
                    obj.contentType = "user";
                    obj.displayName = sakai.api.User.getDisplayName(user.profile);
                    obj.counts = user.profile.counts;

                    user = user.profile.basic.elements;
                    if (user["sakai:tags"] && user["sakai:tags"].value && user["sakai:tags"].value.length){
                        obj.tags = sakai.api.Util.formatTags(user["sakai:tags"].value);
                    }
                    if (user.aboutme){
                        obj.aboutme = user.aboutme.elements.aboutme.value;
                    }
                    if (user.picture && user.picture.value && user.picture.value.length){
                        obj.picture = $.parseJSON(user.picture.value);
                    }
                    // is the user a contact or pending contact
                    if ($.grep(sakai.data.me.mycontacts, function(value, index){return value.target === obj.userid;}).length !== 0){
                        obj.connected = true;
                    }

                    if (obj.picture && obj.tags){
                        hasPicAndTag.push(obj);
                    } else if (obj.picture) {
                        hasPic.push(obj);
                    } else if (obj.tags) {
                        hasTag.push(obj);
                    } else {
                        noPicAndTag.push(obj);
                    }
                });

                var suggested = {
                    contentType: "suggestedUsers",
                    suggestions: hasPicAndTag.concat(hasPic, hasTag, noPicAndTag).splice(0, 8)
                };
                dataArr.push(suggested);
            });
        };

        var parseData = function(data){
            var dataArr = [];
            parseContent(data, dataArr, function(data, dataArr){
                parseGroups(data, dataArr);
                parseUsers(data, dataArr);
                if (dataArr.length) {
                    renderCarousel(dataArr);
                }
            });
        };

        var loadFeatured = function(){
            var dataArr = {
                "content": false,
                "groups": false,
                "users": false
            };

            var reqs = [
                {
                    url: "/var/search/pool/me/related-content.json",
                    method: "GET",
                    parameters: {
                        "items": 11
                    }
                },
                {
                    url: "/var/contacts/related-contacts.json",
                    method: "GET",
                    parameters: {
                        "items": 11
                    }
                },
                {
                    url: "/var/search/myrelatedgroups.json",
                    method: "GET",
                    parameters: {
                        "items": 11
                    }
                }
            ];

            sakai.api.Server.batch(reqs, function(success, data) {
                if (success) {
                    //content
                    dataArr.content = $.parseJSON(data.results[0].body);
                    //users
                    dataArr.users = $.parseJSON(data.results[1].body);
                    //groups
                    dataArr.groups = $.parseJSON(data.results[2].body);
                }
                parseData(dataArr);
            }, false);

        };

        var doInit = function(){
            loadFeatured();
        };

        doInit();
    };

    sakai.api.Widgets.widgetLoader.informOnLoad("carousel");
});


text:
function TasksView(title) {
	current_user = Ti.App.current_user;
	var win = Ti.UI.createView({
		title : title,
		backgroundColor : 'black'
	});

	var scrollView = Ti.UI.createScrollView({
		contentWidth : 'auto',
		contentHeight : 'auto',
		showVerticalScrollIndicator : true,
		showHorizontalScrollIndicator : true,
		top : 0,
		height : '100%',
		width : '100%'
	});

	var table = Ti.UI.createTableView({
		top : 10,
		backgroundColor : 'transparent',
		color : "white"
	});
	populateData();
	function populateData() {
		var data = [];
		var list = [];
		var results = [];
		var netWork = require('lib/network');
		netWork.getTasks(function(response) {
			results = response;
			for (var i = 0; i < results.length; i++) {
				list.push({
					leftImage : '/images/' + results[i].completed + '.png',
					title : results[i].name + "   " + results[i].priority,
					id : results[i].id,
					branch_id : results[i].branch_id,
					company_id : results[i].company_id,
					name : results[i].name,
					comments : results[i].comments,
					completed : results[i].completed,
					description1 : results[i].description,
					priority : results[i].priority,
					hasChild : true
				});
			}
			table.setData(list);
		});
	};

	table.selectionIndicator = true;
	Ti.App.addEventListener('databaseUpdated', populateData);
	scrollView.add(table);
	table.addEventListener('click', function(e) {
		win.fireEvent('itemSelected', {
			id : e.rowData.id,
			branch_id : e.rowData.branch_id,
			company_id : e.rowData.company_id,
			name : e.rowData.name
		});
		var taskdetails = require("ui/handheld/TaskDetailWindow")
		new taskdetails(e.rowData).open();
	});

	/*var eMobile = Ti.UI.createView({
		backgroundColor : '#00f',
		backgroundImage : '/images/eMobile.png',
		height : 87,
		left: 10,
		right: 10,
		width : "95%",
		top : "80%",
		layout : 'vertical'
	});
	scrollView.add(eMobile);

	eMobile.addEventListener('click', function(e) {
		Ti.Platform.openURL("http://emobile.com.mx/");
	});*/
	win.add(scrollView);
	return win;
};

module.exports = TasksView;


text:
```php
public __construct ( void )
```

## Details

Class: [BearCMS\Data\Users\User](bearcms.data.users.user.class.md)

Location: ~/classes/BearCMS/Data/Users/User.php

---

[back to index](index.md)


text:
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Project'
        db.create_table(u'issues_project', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='projects', null=True, to=orm['auth.User'])),
            ('project', self.gf('django.db.models.fields.CharField')(max_length=60)),
        ))
        db.send_create_signal(u'issues', ['Project'])

        # Adding model 'Version'
        db.create_table(u'issues_version', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('version', self.gf('django.db.models.fields.CharField')(max_length=10)),
        ))
        db.send_create_signal(u'issues', ['Version'])

        # Adding model 'Milestone'
        db.create_table(u'issues_milestone', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('milestone', self.gf('django.db.models.fields.CharField')(max_length=50)),
        ))
        db.send_create_signal(u'issues', ['Milestone'])

        # Adding model 'Type'
        db.create_table(u'issues_type', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('type', self.gf('django.db.models.fields.CharField')(max_length=30)),
        ))
        db.send_create_signal(u'issues', ['Type'])

        # Adding model 'Component'
        db.create_table(u'issues_component', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('component', self.gf('django.db.models.fields.CharField')(max_length=30)),
        ))
        db.send_create_signal(u'issues', ['Component'])

        # Adding model 'Tag'
        db.create_table(u'issues_tag', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='tags', null=True, to=orm['auth.User'])),
            ('tag', self.gf('django.db.models.fields.CharField')(max_length=30)),
        ))
        db.send_create_signal(u'issues', ['Tag'])

        # Adding model 'Issue'
        db.create_table(u'issues_issue', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=60)),
            ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_issues', null=True, to=orm['auth.User'])),
            ('description', self.gf('django.db.models.fields.TextField')(default='', max_length=3000, blank=True)),
            ('description_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
            ('owner', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['auth.User'])),
            ('priority', self.gf('django.db.models.fields.IntegerField')(default=0, null=True, blank=True)),
            ('difficulty', self.gf('django.db.models.fields.IntegerField')(default=0, null=True, blank=True)),
            ('progress', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('closed', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('project', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['issues.Project'])),
            ('version', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['issues.Version'])),
            ('milestone', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['issues.Milestone'])),
            ('component', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['issues.Component'])),
            ('type', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='issues', null=True, to=orm['issues.Type'])),
        ))
        db.send_create_signal(u'issues', ['Issue'])

        # Adding M2M table for field tags on 'Issue'
        m2m_table_name = db.shorten_name(u'issues_issue_tags')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('issue', models.ForeignKey(orm[u'issues.issue'], null=False)),
            ('tag', models.ForeignKey(orm[u'issues.tag'], null=False))
        ))
        db.create_unique(m2m_table_name, ['issue_id', 'tag_id'])

        # Adding model 'Comment'
        db.create_table(u'issues_comment', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='comments', null=True, to=orm['auth.User'])),
            ('issue', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='comments', null=True, to=orm['issues.Issue'])),
            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('description', self.gf('django.db.models.fields.TextField')(max_length=3000)),
            ('description_html', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal(u'issues', ['Comment'])

    def backwards(self, orm):
        # Deleting model 'Project'
        db.delete_table(u'issues_project')

        # Deleting model 'Version'
        db.delete_table(u'issues_version')

        # Deleting model 'Milestone'
        db.delete_table(u'issues_milestone')

        # Deleting model 'Type'
        db.delete_table(u'issues_type')

        # Deleting model 'Component'
        db.delete_table(u'issues_component')

        # Deleting model 'Tag'
        db.delete_table(u'issues_tag')

        # Deleting model 'Issue'
        db.delete_table(u'issues_issue')

        # Removing M2M table for field tags on 'Issue'
        db.delete_table(db.shorten_name(u'issues_issue_tags'))

        # Deleting model 'Comment'
        db.delete_table(u'issues_comment')

    models = {
        u'auth.group': {
            'Meta': {'object_name': 'Group'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        u'auth.permission': {
            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        u'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        u'issues.comment': {
            'Meta': {'object_name': 'Comment'},
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments'", 'null': 'True', 'to': u"orm['auth.User']"}),
            'description': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
            'description_html': ('django.db.models.fields.TextField', [], {}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'issue': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments'", 'null': 'True', 'to': u"orm['issues.Issue']"})
        },
        u'issues.component': {
            'Meta': {'object_name': 'Component'},
            'component': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        u'issues.issue': {
            'Meta': {'object_name': 'Issue'},
            'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'component': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['issues.Component']"}),
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_issues'", 'null': 'True', 'to': u"orm['auth.User']"}),
            'description': ('django.db.models.fields.TextField', [], {'default': "''", 'max_length': '3000', 'blank': 'True'}),
            'description_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'difficulty': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'milestone': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['issues.Milestone']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['auth.User']"}),
            'priority': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}),
            'progress': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'project': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['issues.Project']"}),
            'tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['issues.Tag']"}),
            'type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['issues.Type']"}),
            'version': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'issues'", 'null': 'True', 'to': u"orm['issues.Version']"})
        },
        u'issues.milestone': {
            'Meta': {'object_name': 'Milestone'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'milestone': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'issues.project': {
            'Meta': {'object_name': 'Project'},
            'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'projects'", 'null': 'True', 'to': u"orm['auth.User']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'project': ('django.db.models.fields.CharField', [], {'max_length': '60'})
        },
        u'issues.tag': {
            'Meta': {'object_name': 'Tag'},
            'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tags'", 'null': 'True', 'to': u"orm['auth.User']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'tag': ('django.db.models.fields.CharField', [], {'max_length': '30'})
        },
        u'issues.type': {
            'Meta': {'object_name': 'Type'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'type': ('django.db.models.fields.CharField', [], {'max_length': '30'})
        },
        u'issues.version': {
            'Meta': {'object_name': 'Version'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'version': ('django.db.models.fields.CharField', [], {'max_length': '10'})
        }
    }

    complete_apps = ['issues']


text:
from __future__ import absolute_import, division, print_function

from re import compile, escape, MULTILINE

from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import regexNamer, bounceStarter, indirectStarter
from .common import _WordPressScraper, xpath_class, WP_LATEST_SEARCH

class AbstruseGoose(_BasicScraper):
    url = 'http://abstrusegoose.com/'
    rurl = escape(url)
    starter = bounceStarter
    stripUrl = url + '%s'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(tagre('img', 'src',
                                r'(http://abstrusegoose\.com/strips/[^<>"]+)'))
    prevSearch = compile(tagre('a', 'href', r'(%s\d+)' % rurl) +
                         r'« Previous')
    nextSearch = compile(tagre('a', 'href', r'(%s\d+)' % rurl) +
                         r'Next »')
    help = 'Index format: n (unpadded)'
    textSearch = compile(tagre("img", "title", r'([^"]+)'))

    def namer(self, image_url, page_url):
        index = int(page_url.rstrip('/').split('/')[-1])
        name = image_url.split('/')[-1].split('.')[0]
        return 'c%03d-%s' % (index, name)

class AbsurdNotions(_BasicScraper):
    baseUrl = 'http://www.absurdnotions.org/'
    url = baseUrl + 'page129.html'
    stripUrl = baseUrl + 'page%s.html'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(tagre('img', 'src', r'(an[^"]+)'))
    multipleImagesPerStrip = True
    prevSearch = compile(tagre('a', 'href', r'([^"]+)') +
                         tagre('img', 'src', 'nprev\.gif'))
    help = 'Index format: n (unpadded)'

class AcademyVale(_BasicScraper):
    url = 'http://www.imagerie.com/vale/'
    stripUrl = url + 'avarch.cgi?%s'
    firstStripUrl = stripUrl % '001'
    imageSearch = compile(tagre('img', 'src', r'(avale\d{4}-\d{2}\.gif)'))
    prevSearch = compile(tagre('a', 'href', r'(avarch[^">]+)', quote="") +
                         tagre('img', 'src', 'AVNavBack\.gif'))
    help = 'Index format: nnn'

class Achewood(_BasicScraper):
    url = 'http://www.achewood.com/'
    stripUrl = url + 'index.php?date=%s'
    firstStripUrl = stripUrl % '00000000'
    imageSearch = compile(tagre("img", "src", r'(/comic\.php\?date=\d+)'))
    prevSearch = compile(tagre("a", "href", r'(index\.php\?date=\d+)',
                               after="Previous"))
    help = 'Index format: mmddyyyy'
    namer = regexNamer(compile(r'date=(\d+)'))

class AfterStrife(_WordPressScraper):
    baseUrl = 'http://afterstrife.com/'
    stripUrl = baseUrl + '?p=%s'
    url = stripUrl % '262'
    firstStripUrl = stripUrl % '1'
    prevSearch = '//a[%s]' % xpath_class('navi-prev')
    help = 'Index format: nnn'
    endOfLife = True

class AGirlAndHerFed(_BasicScraper):
    url = 'http://www.agirlandherfed.com/'
    stripUrl = url + '1.%s.html'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(tagre("img", "src", r'(img/strip/[^"]+\.jpg)'))
    prevSearch = compile(r'[^>]+Back')
    help = 'Index format: nnn'

class AhoiPolloi(_ParserScraper):
    url = 'https://ahoipolloi.blogger.de/'
    stripUrl = url + '?day=%s'
    firstStripUrl = stripUrl % '20060306'
    multipleImagesPerStrip = True
    lang = 'de'
    imageSearch = '//img[contains(@src, "/static/antville/ahoipolloi/")]'
    prevSearch = '//a[contains(@href, "/?day=")]'
    help = 'Index format: yyyymmdd'

class AhoyEarth(_WordPressScraper):
    url = 'http://www.ahoyearth.com/'
    prevSearch = '//a[%s]' % xpath_class('navi-prev')

class AirForceBlues(_WordPressScraper):
    url = 'http://farvatoons.com/'
    firstStripUrl = url + 'comic/in-texas-there-are-texans/'

class ALessonIsLearned(_BasicScraper):
    url = 'http://www.alessonislearned.com/'
    prevSearch = compile(tagre("a", "href", r"(index\.php\?comic=\d+)",
                               quote="'") + r"[^>]+previous")
    stripUrl = url + 'index.php?comic=%s'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(tagre("img", "src", r"(cmx/lesson\d+\.[a-z]+)"))
    help = 'Index format: nnn'

class Alice(_WordPressScraper):
    url = 'http://www.alicecomics.com/'
    latestSearch = '//a[text()="Latest Alice!"]'
    starter = indirectStarter

class AlienLovesPredator(_BasicScraper):
    url = 'http://alienlovespredator.com/'
    stripUrl = url + '%s/'
    firstStripUrl = stripUrl % '2004/10/12/unavoidable-delay'
    imageSearch = compile(tagre("img", "src", r'([^"]+)',
                                after='border="1" alt="" width="750"'))
    prevSearch = compile(tagre("a", "href", r'([^"]+)', after="prev"))
    help = 'Index format: yyyy/mm/dd/name'

class AlienShores(_WordPressScraper):
    url = 'http://alienshores.com/alienshores_band/'
    firstStripUrl = url + 'AScomic/updated-cover/'

class AllTheGrowingThings(_BasicScraper):
    url = 'http://growingthings.typodmary.com/'
    rurl = escape(url)
    stripUrl = url + '%s/'
    firstStripUrl = stripUrl % '2009/04/21/all-the-growing-things'
    imageSearch = compile(tagre("img", "src", r'(%sfiles/[^"]+)' % rurl))
    prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
    help = 'Index format: yyyy/mm/dd/strip-name'

class AlphaLuna(_BasicScraper):
    url = 'http://www.alphaluna.net/'
    stripUrl = url + 'issue-%s/'
    firstStripUrl = stripUrl % '1/cover'
    imageSearch = compile(tagre("a", "href",
                                r'[^"]*/(?:issue-|support/upcoming)[^"]+') +
                          tagre("img", "src", r'([^"]*/PAGINAS/[^"]+)'))
    prevSearch = compile(tagre("a", "href", r'([^"]+)') +
                         tagre("img", "alt", "Prev"))
    help = 'Index format: issue/page (e.g. 4/05)'

class AlphaLunaSpanish(AlphaLuna):
    name = 'AlphaLuna/Spanish'
    lang = 'es'
    url = 'http://alphaluna.net/spanish/'
    stripUrl = url + 'issue-%s/'
    firstStripUrl = stripUrl % '1/portada'

class Altermeta(_BasicScraper):
    url = 'http://altermeta.net/'
    rurl = escape(url)
    stripUrl = url + 'archive.php?comic=%s'
    firstStripUrl = stripUrl % '0'
    imageSearch = compile(r'')
    prevSearch = compile(r'<img src="%stemplate/default/images/sasha/back\.png' % rurl)
    help = 'Index format: n (unpadded)'

class AltermetaOld(Altermeta):
    url = Altermeta.url + 'oldarchive/index.php'
    stripUrl = Altermeta.url + 'oldarchive/archive.php?comic=%s'
    firstStripUrl = stripUrl % '0'
    prevSearch = compile(r'Back')

class AmazingSuperPowers(_BasicScraper):
    url = 'http://www.amazingsuperpowers.com/'
    rurl = escape(url)
    stripUrl = url + '%s/'
    firstStripUrl = stripUrl % '2007/09/heredity'
    imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
    prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
    help = 'Index format: yyyy/mm/name'

    def shouldSkipUrl(self, url, data):
        """Skip pages without images."""
        return url in (
            # video
            self.stripUrl % '2013/05/orbital-deathray-kickstarter',
        )

class Amya(_WordPressScraper):
    url = 'http://www.amyachronicles.com/'

class Angband(_BasicScraper):
    url = 'http://angband.calamarain.net/'
    stripUrl = url + 'view.php?date=%s'
    firstStripUrl = stripUrl % '2005-12-30'
    imageSearch = compile(tagre("img", "src", r'(comics/Scroll[^"]+)'))
    prevSearch = compile(tagre("a", "href", r'(view\.php\?date\=[^"]+)') +
                         "Previous")
    help = 'Index format: yyyy-mm-dd'

class Angels2200(_BasicScraper):
    url = 'http://www.janahoffmann.com/angels/'
    stripUrl = url + '%s'
    imageSearch = compile(tagre("img", "src", r"(http://www\.janahoffmann\.com/angels/comics/[^']+)", quote="'"))
    prevSearch = compile(tagre("a", "href", r'([^"]+)') + "« Previous")
    help = 'Index format: yyyy/mm/dd/part-<n>-comic-<n>'

class Annyseed(_ParserScraper):
    baseUrl = 'http://www.mirrorwoodcomics.com/'
    url = baseUrl + 'AnnyseedLatest.htm'
    stripUrl = baseUrl + 'Annyseed%s.htm'
    imageSearch = '//div/img[contains(@src, "Annyseed")]'
    prevSearch = '//a[img[@name="Previousbtn"]]'
    help = 'Index format: nnn'

class AoiHouse(_ParserScraper):
    url = 'http://www.aoihouse.net/'
    imageSearch = '//div[@id="comic"]/a[2]/img'
    prevSearch = '//a[@id="cndprev"]'

class AppleGeeks(_BasicScraper):
    url = 'http://www.applegeeks.com/'
    stripUrl = url + 'comics/viewcomic.php?issue=%s'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(tagre("img", "src", r'((?:/comics/)?issue\d+\.jpg)'))
    prevSearch = compile(r'
Previous Comic
\s*
', MULTILINE)
    help = 'Index format: n (unpadded)'

class ARedTailsDream(_BasicScraper):
    baseUrl = 'http://www.minnasundberg.fi/'
    stripUrl = baseUrl + 'comic/page%s.php'
    firstStripUrl = stripUrl % '00'
    url = baseUrl + 'comic/recent.php'
    imageSearch = compile(tagre('img', 'src', r'(chapter.+?/eng[^"]*)'))
    prevSearch = compile(tagre('a', 'href', r'(page\d+\.php)') +
                         tagre("img", "src", r'.*?aprev.*?'))
    help = 'Index format: nn'

class Ashes(_WordPressScraper):
    url = 'http://www.flowerlarkstudios.com/comic/prologue/10232009/'
    firstStripUrl = url
    latestSearch = WP_LATEST_SEARCH
    starter = indirectStarter

class ASofterWorld(_ParserScraper):
    url = 'http://www.asofterworld.com/'
    stripUrl = url + 'index.php?id=%s'
    firstStripUrl = stripUrl % '1'
    imageSearch = '//div[@id="comicimg"]//img'
    prevSearch = '//div[@id="previous"]/a'
    help = 'Index format: n (unpadded)'

class AstronomyPOTD(_ParserScraper):
    baseUrl = 'http://apod.nasa.gov/apod/'
    url = baseUrl + 'astropix.html'
    starter = bounceStarter
    stripUrl = baseUrl + 'ap%s.html'
    firstStripUrl = stripUrl % '061012'
    imageSearch = '//a/img'
    multipleImagesPerStrip = True
    prevSearch = '//a[text()="<"]'
    nextSearch = '//a[text()=">"]'
    help = 'Index format: yymmdd'

    def shouldSkipUrl(self, url, data):
        """Skip pages without images."""
        return data.xpath('//iframe')  # videos

    def namer(self, image_url, page_url):
        return '%s-%s' % (page_url.split('/')[-1].split('.')[0][2:],
                          image_url.split('/')[-1].split('.')[0])

class AxeCop(_WordPressScraper):
    url = 'http://axecop.com/comic/season-two/'


text:
cask "openshot-video-editor" do
  version "2.6.1"
  sha256 "da40d4361810bf131cd06a1afe71e9a7a15918f2b154e1399db7306b2a3b72d3"

  url "https://github.com/OpenShot/openshot-qt/releases/download/v#{version}/OpenShot-v#{version}-x86_64.dmg",
      verified: "github.com/OpenShot/openshot-qt/"
  name "OpenShot Video Editor"
  desc "Cross-platform video editor"
  homepage "https://openshot.org/"

  conflicts_with cask: "homebrew/cask-versions/openshot-video-editor-daily"
  depends_on macos: ">= :catalina"

  app "OpenShot Video Editor.app"

  zap trash: [
    "~/.openshot_qt",
    "~/Library/Application Support/openshot",
    "~/Library/Preferences/openshot-qt.plist",
  ]
end


text:
<?php declare(strict_types=1);

namespace Cjsaylor\Domain\Entity;

use Cjsaylor\Domain\Behavior\ArraySerializable;

trait EntityTrait
{

    /**
     * Initialize the entity with data.
     *
     * @param array $initialData
     * @return void
     */
    public function initialize(array $initialData = []) : void
    {
        foreach ($initialData as $key => $value) {
            $this[$key] = $value;
        }
    }

    /**
     * Array representation of this entity.
     *
     * @return array
     */
    public function toArray() : array
    {
        $output = [];
        foreach ($this->data as $key => $val) {
            $output[$key] = $val instanceof ArraySerializable ? $val->toArray() : $val;
        }
        return $output;
    }
}


text:
package org.usfirst.frc.team236.robot.commands.autonomous;

import org.usfirst.frc.team236.robot.commands.Intake;
import org.usfirst.frc.team236.robot.commands.ShiftDown;
import org.usfirst.frc.team236.robot.commands.ShiftUp;
import org.usfirst.frc.team236.robot.commands.Wait;
import org.usfirst.frc.team236.robot.commands.arm.GoDefenseAngle;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 *
 */
public class BackwardRawtonomous extends CommandGroup {

    public BackwardRawtonomous() {

	addParallel(new Intake());
	addParallel(new ShiftDown());
	addSequential(new GoDefenseAngle());

	addParallel(new Intake());
	addSequential(new RawDrive(-1), 2);

	addParallel(new ShiftUp());
	addSequential(new Wait(1));

	addParallel(new Intake());
	addSequential(new TurnWithGyro(180));
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/transitional.dtd">

  <meta HTTP-EQUIV=CONTENT-TYPE CONTENT="text/html; charset=utf-8">
  <title>Slide 5</title>


text:
layout: post
title: What is Ardour?
description: "The Introduction"
comments: false
tags: [01 INTRODUCTION]
comments: false
image:
  feature: Ardour3_Empty_Session_Transparent.png
  credit:
  creditlink:
---

**Ardour** is a professional, full-featured hard disk recorder
and Digital Audio Workstation (DAW). Ardour is Free/Libre Open Source Software (FLOSS).

**PLEASE NOTE:**
This link refers to an older version of Ardour (3.5). To read the updated tutorial for Ardour 4, go to [http://brunoruviaro.github.io/ardour4-tutorial/](http://brunoruviaro.github.io/ardour4-tutorial/)

More information on Ardour can be found at
[http://ardour.org/](http://ardour.org/ "http://ardour.org/").

### Click [here](http://brunoruviaro.github.io/ardour4-tutorial/tags/) to go to the updated [Ardour 4 tutorial](http://brunoruviaro.github.io/ardour4-tutorial/tags/)


text:
<?php

namespace SMW\Tests\Exporter\Element;

use SMW\Exporter\Element\ExpNsResource;
use SMW\Exporter\Element\ExpElement;
use SMW\DIWikiPage;
use SMWDataItem as DataItem;

/**
 * @covers \SMW\Exporter\Element\ExpNsResource
 * @group semantic-mediawiki
 *
 * @license GNU GPL v2+
 * @since 2.2
 *
 * @author mwjames
 */
class ExpNsResourceTest extends \PHPUnit_Framework_TestCase {

	public function testCanConstruct() {

		$this->assertInstanceOf(
			'\SMW\Exporter\Element\ExpNsResource',
			new ExpNsResource( '', '', '', null )
		);

		// Legacy
		$this->assertInstanceOf(
			'\SMWExpNsResource',
			new \SMWExpNsResource( '', '', '', null )
		);
	}

	/**
	 * @dataProvider constructorProvider
	 */
	public function testAccessToMethods( $localName, $namespace, $namespaceId, $dataItem ) {

		$instance = new ExpNsResource(
			$localName,
			$namespace,
			$namespaceId,
			$dataItem
		);

		$this->assertEquals(
			$namespaceId . ':' . $localName,
			$instance->getQName()
		);

		$this->assertEquals(
			$namespace . $localName,
			$instance->getUri()
		);

		$this->assertEquals(
			$localName,
			$instance->getLocalName()
		);

		$this->assertEquals(
			$namespace,
			$instance->getNamespace()
		);

		$this->assertEquals(
			$namespaceId,
			$instance->getNamespaceId()
		);

		$this->assertEquals(
			$dataItem,
			$instance->getDataItem()
		);
	}

	/**
	 * @dataProvider constructorProvider
	 */
	public function testSerializiation( $localName, $namespace, $namespaceId, $dataItem, $expected ) {

		$instance = new ExpNsResource(
			$localName,
			$namespace,
			$namespaceId,
			$dataItem
		);

		$this->assertEquals(
			$expected,
			$instance->getSerialization()
		);

		$this->assertEquals(
			$instance,
			ExpElement::newFromSerialization( $instance->getSerialization() )
		);
	}

	/**
	 * @dataProvider invalidConstructorProvider
	 */
	public function testInvalidConstructorThrowsException( $localName, $namespace, $namespaceId, $dataItem ) {

		$this->setExpectedException( 'InvalidArgumentException' );

		$instance = new ExpNsResource(
			$localName,
			$namespace,
			$namespaceId,
			$dataItem
		);
	}

	/**
	 * @dataProvider serializationMissingElementProvider
	 */
	public function testDeserializiationForMissingElementThrowsException( $serialization ) {

		$this->setExpectedException( 'RuntimeException' );

		ExpElement::newFromSerialization(
			$serialization
		);
	}

	public function constructorProvider() {

		#0
		$provider[] = array(
			'', '', '', null,
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => '||',
				'dataitem' => null
			)
		);

		#1
		$provider[] = array(
			'Foo', '', '', null,
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => 'Foo||',
				'dataitem' => null
			)
		);

		#2
		$provider[] = array(
			'Foo', 'Bar', '', null,
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => 'Foo|Bar|',
				'dataitem' => null
			)
		);

		#3
		$provider[] = array(
			'Foo', 'Bar', 'Fum', null,
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => 'Foo|Bar|Fum',
				'dataitem' => null
			)
		);

		#4
		$provider[] = array(
			'Foo', 'Bar', 'Fum', new DIWikiPage( 'Foo', NS_MAIN ),
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => 'Foo|Bar|Fum',
				'dataitem' => array(
					'type' => DataItem::TYPE_WIKIPAGE,
					'item' => 'Foo#0#'
				)
			)
		);

		return $provider;
	}

	public function invalidConstructorProvider() {

		#0
		$provider[] = array(
			array(), '', '', null
		);

		#1
		$provider[] = array(
			'', array(), '', null
		);

		#2
		$provider[] = array(
			'', '', array(), null
		);

		return $provider;
	}

	public function serializationMissingElementProvider() {

		#0
		$provider[] = array(
			array()
		);

		#1
		$provider[] = array(
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE
			)
		);

		#2
		$provider[] = array(
			array(
				'type' => 'BogusType'
			)
		);

		#3
		$provider[] = array(
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'dataitem' => null
			)
		);

		#4
		$provider[] = array(
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => '',
				'dataitem' => null
			)
		);

		#5
		$provider[] = array(
			array(
				'type' => ExpNsResource::TYPE_NSRESOURCE,
				'uri'  => '|',
				'dataitem' => null
			)
		);

		return $provider;
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#607D8B</color>
    <color name="colorPrimaryDark">#455A64</color>
    <color name="colorAccent">#00E676</color>
</resources>


text:
<?php

namespace Akamai\CCU;

class Request
{
    public $objects;

    public $type;

    public function __construct($objects, $type = null) {
        $this->objects = is_array($objects) ? $objects : array($objects);
        if (in_array($type, array('arl', 'cpcode'))) {
            $this->type = $type;
        }
    }

    public function isReadyToSubmit()
    {
        return !empty($this->objects);
    }
}


text:
package net.opengis.gml.impl;

import net.opengis.gml.AbstractGeometricPrimitiveType;
import net.opengis.gml.GmlPackage;

import org.eclipse.emf.ecore.EClass;

/**
 *
 * An implementation of the model object 'Abstract Geometric Primitive Type'.
 *
 *

 *

 *
 * @generated
 */
public abstract class AbstractGeometricPrimitiveTypeImpl extends AbstractGeometryTypeImpl implements AbstractGeometricPrimitiveType {
	/**
	 *
	 *
	 * @generated
	 */
	protected AbstractGeometricPrimitiveTypeImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GmlPackage.eINSTANCE.getAbstractGeometricPrimitiveType();
	}

} //AbstractGeometricPrimitiveTypeImpl


text:
Jupiter::Jupiter(Player* owner, const b2Vec2& pos, float scale)
{
	SetDynamicBody(owner, HERO_JUPITER, pos, scale);
	m_Hp = m_MaxHp = 1800;
	m_Speed = Reduce(370.0f);

    m_Buff = new BuffSkill(m_Owner);
	m_SkillList[SKILL_Q] = new SparkSkill(m_Owner, scale);
    m_SkillList[SKILL_W] = new LightningSkill(m_Owner);
    m_SkillList[SKILL_E] = new FlashSkill(m_Owner);
    m_SkillList[SKILL_R] = new LightningPumpkinSkill(m_Owner);
}

Jupiter::~Jupiter()
{
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Docums Mycol. 6(no. 24): 41 (1976)

#### Original name
Hygrophorus laetus f. pallidus A.H. Sm.

### Remarks
null


text:
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl.cache.impl.todo;

import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.fileTypes.FileTypeExtension;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.indexing.DataIndexer;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.indexing.FileContent;
import com.intellij.util.indexing.IndexedFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class TodoIndexers extends FileTypeExtension<DataIndexer<TodoIndexEntry, Integer, FileContent>> {
  public static final TodoIndexers INSTANCE = new TodoIndexers();

  private static final ExtensionPointName<ExtraPlaceChecker> EP_NAME = ExtensionPointName.create("com.intellij.todoExtraPlaces");

  private TodoIndexers() {
    super("com.intellij.todoIndexer");
  }

  public static boolean needsTodoIndex(@NotNull IndexedFile file) {
    if (FileBasedIndex.IGNORE_PLAIN_TEXT_FILES && file.getFileType() == PlainTextFileType.INSTANCE) {
      return false;
    }
    VirtualFile vFile = file.getFile();

    if (!vFile.isInLocalFileSystem()) {
      return false;
    }

    Project project = file.getProject();
    if (project != null && ProjectFileIndex.getInstance(project).isInContent(vFile)) {
      return true;
    }

    for (ExtraPlaceChecker checker : EP_NAME.getExtensionList()) {
      if (checker.accept(project, file.getFile())) {
        return true;
      }
    }
    return false;
  }

  public static boolean belongsToProject(@NotNull Project project, @NotNull VirtualFile file) {
    for (ExtraPlaceChecker checker : EP_NAME.getExtensionList()) {
      if (checker.accept(project, file)) {
        return true;
      }
    }
    if (!ProjectFileIndex.getInstance(project).isInContent(file)) {
      return false;
    }
    return true;
  }

  /**
   * Provides a way to expand TO-DO index filter beyond open projects content scope.
   * It shall be used primarily to create the index for files inside custom {@link com.intellij.util.indexing.IndexableSetContributor} implementations.
   */
  public interface ExtraPlaceChecker {
    boolean accept(@Nullable Project project, @NotNull VirtualFile file);
  }
}


text:
from unittest import TestCase
import os
import decimal
up = os.path.dirname
j = os.path.join

from schema import SCHEMA

try:
    # To run the tests we still need lxml
    from lxml.etree import XMLSchema, XMLParser, fromstring
except ImportError:
    raise Exception("lxml 2.0.3+ is needed to run authorize tests")

from authorize import gen_xml as x, responses, cim, arb

parser = XMLParser()
schema_validator = XMLSchema(fromstring(SCHEMA, parser))

DELIMITER = "---------------------------------------------------------------------------------------"

def to_tree(s):
    return fromstring(s, parser)

def assertValid(s):
    schema_validator.assertValid(to_tree(s))

class TestXML(TestCase):

    def setUp(self):
        self.cim_old = cim.Api.request
        def validateRequest(self, body):
            assertValid(body)
            assert_other = getattr(self, "assert_other", None)
            if assert_other is not None:
                assert_other(body)
        cim.Api.request = validateRequest
        self.cim = cim.Api(u'foo', u'bar', is_test=True)

        self.arb_old = arb.Api.request
        arb.Api.request = lambda self, body: assertValid(body)
        self.arb = arb.Api(u"foo", u"bar", is_test=True)

    def tearDown(self):
        cim.Api.request = self.cim_old
        arb.Api.request = self.arb_old

    def test_general_examples(self):
        """
        Test that response parser don't break with example patterns
        given by Authorize.Net
        """
        examples = file(j(up(os.path.abspath(__file__)), 'CIMXMLExamples.txt')).read().split(DELIMITER)
        for example in examples:
            example = example.strip()
            try:
                resp = x.to_dict(example, responses.cim_map)
            except responses.AuthorizeError:
                resp = x.to_dict(example, responses.cim_map, do_raise=False)
                assert resp.messages.message.code.text_ in responses.cim_map
            else:
                assert resp.messages.message.code.text_ == u'I00001'

    def test_parse_direct_response(self):
        """
        The direct response string returned by Authorize.net can be
        quite interesting to parse. We verify that it is correctly
        handled.
        """
        response = """\
<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileTransactionResponse xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <messages>
    <resultCode>Ok</resultCode>
    <message>
      I00001
      <text>Successful.</text>
    </message>
  </messages>
  <directResponse>*1*;*1*;*1*;*This transaction has been approved.*;*000000*;*Y*;*2000000001*;*INV000001*;*description of transaction*;*10.95*;*CC*;*auth_capture*;*custId123*;*John*;*Doe*;**;*123 Main St., foo*;*Bellevue*;*WA*;*98004*;*USA*;*000-000-0000*;**;*mark@example.com*;*John*;*Doe*;**;*123 Main St.*;*Bellevue*;*WA*;*98004*;*USA*;*1.00*;*0.00*;*2.00*;*FALSE*;*PONUM000001*;*D18EB6B211FE0BBF556B271FDA6F92EE*;*M*;*buaaahahah , *;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;**;*wallers,*</directResponse>
</createCustomerProfileTransactionResponse>"""
        resp = x.to_dict(response, responses.cim_map, delimiter=u";", encapsulator=u"*")
        assert resp.direct_response.code == u"1"
        assert resp.direct_response.address == u"123 Main St., foo"
        assert resp.direct_response.holder_verification == u"buaaahahah , "

    def test_parser_to_dict(self):
        """
        Test that the dict parser works as expected
        """
        xml = """\
<foo>
    <bar>baz</bar>
    <quz>
        <wow>works!</wow>
    </quz>
</foo>
"""
        d = x.to_dict(xml, {})
        assert d.bar.text_ == u'baz'
        assert d.quz.wow.text_ == u'works!'

    def test_create_profile(self):
        """
        Test that the XML generated for create_profile is valid according
        to the XMLSchema.
        """
        self.cim.create_profile(
            card_number=u"42222222222",
            expiration_date=u"2010-04",
            customer_id=u"dialtone"
        )

        def assert_other(message):
            assert 'creditCardNumber' not in message
            assert 'bankAccount' in message
        self.assert_other = assert_other
        try:
            self.cim.create_profile(
                customer_id=u"dialtone",
                profile_type=u"bank",
                name_on_account=u"John Doe",
                routing_number=u"12345678",
                account_number=u"1234567890"
            )
        finally:
            del self.assert_other

        self.cim.create_profile(
            card_number=u"42222222222",
            expiration_date=u"2010-04",
            customer_id=u"dialtone",
            ship_phone=u'415-415-4154',
            ship_first_name=u'valentino'
        )

        payment_profiles = [
            dict(card_number=u"43333333333",
                 expiration_date=u"2010-04"),
            dict(profile_type=u"bank",
                 name_on_account=u"John Doeð",
                 routing_number=u"12345678",
                 account_number=u"1234567890")
        ]

        def assert_other(message):
            assert 'John Doe' in message
            assert '43333333333' in message
            assert 'valentino' in message
        self.assert_other = assert_other
        try:
            self.cim.create_profile(
                customer_id=u"dialtone",
                payment_profiles=payment_profiles,
                ship_phone=u"415-415-4154",
                ship_first_name=u"valentino"
            )
        finally:
            del self.assert_other

    def test_create_payment_profile(self):
        """
        Test that the XML generated for create_payment_profile is valid
        according to the XMLSchema.
        """
        self.cim.create_payment_profile(
            customer_profile_id=u'300',
            customer_type=u'individual',
            card_number=u'42222222222',
            expiration_date=u'2009-10'
        )

    def test_create_shipping_address(self):
        """
        Test that the XML generated for create_shipping_address is valid
        according to the XMLSchema.
        """
        self.cim.create_shipping_address(
            customer_profile_id=100,
            ship_phone=u'415-415-4154',
            ship_first_name=u'valentino'
        )

    def test_create_profile_transaction(self):
        """
        Test that the XML generated for create_profile_transaction is
        valid according to the XMLSchema, and that approval_code is
        only required when capture_only is used as profile_type.
        """
        line_items=[{'item_id': u"45",
                     'name': u'hello',
                     'description': u"foobar",
                     'quantity': 5,
                     'unit_price': decimal.Decimal("30.4")}]
        self.cim.create_profile_transaction(
            profile_type=u"auth_only",
            amount=12.34,
            tax_amount=3.0,
            ship_amount=3.0,
            duty_amount=3.0,
            line_items=line_items,
            customer_profile_id=u"123",
            customer_payment_profile_id=u"123",
            invoice_number=u"12345",
            tax_exempt=True
        )
        try:
            self.cim.create_profile_transaction(
                profile_type=u"capture_only",
                amount=12.34,
                tax_amount=3.0,
                ship_amount=3.0,
                duty_amount=3.0,
                line_items=line_items,
                customer_profile_id=123,
                customer_payment_profile_id=223,
                invoice_number=12345,
                tax_exempt=True
            )
        except KeyError, e:
            assert 'approval_code' in str(e) # error was caused by
                                             # this key missing
            self.cim.create_profile_transaction(
                profile_type=u"capture_only",
                amount=12.34,
                tax_amount=3.0,
                ship_amount=3.0,
                duty_amount=3.0,
                line_items=line_items,
                customer_profile_id=123,
                customer_payment_profile_id=223,
                invoice_number=12345,
                tax_exempt=True,
                approval_code=134323
            )

    def test_delete_profile(self):
        """
        Test that the XML generated for delete_profile is valid
        according to the XMLSchema.
        """
        self.cim.delete_profile(customer_profile_id=u"123")

    def test_delete_payment_profile(self):
        """
        Test that the XML generated for delete_payment_profile is valid
        according to the XMLSchema.
        """
        self.cim.delete_payment_profile(
            customer_profile_id=u"123",
            customer_payment_profile_id=u"432"
        )

    def test_delete_shipping_address(self):
        """
        Test that the XML generated for delete_shipping_address is valid
        according to the XMLSchema.
        """
        self.cim.delete_shipping_address(
            customer_profile_id=u"123",
            customer_address_id=u"543"
        )

    def test_get_profile(self):
        """
        Test that the XML generated for get_profile is valid
        according to the XMLSchema.
        """
        self.cim.get_profile(customer_profile_id=u"123")

    def test_get_payment_profile(self):
        """
        Test that the XML generated for get_payment_profile is valid
        according to the XMLSchema.
        """
        self.cim.get_payment_profile(
            customer_profile_id=u"655",
            customer_payment_profile_id=u"999"
        )

    def test_get_shipping_address(self):
        """
        Test that the XML generated for get_shipping_address is valid
        according to the XMLSchema.
        """
        self.cim.get_shipping_address(
            customer_profile_id=u"900",
            customer_address_id=u"344"
        )

    def test_update_profile(self):
        """
        Test that the XML generated for update_profile is valid
        according to the XMLSchema.
        """
        self.cim.update_profile(
            customer_id=u"222",
            description=u"Foo bar baz quz",
            email=u"dialtone@gmail.com",
            customer_profile_id=u"122"
        )

    def test_update_payment_profile(self):
        """
        Test that the XML generated for update_payment_profile is valid
        according to the XMLSchema.
        """
        self.cim.update_payment_profile(
            customer_profile_id=u"122",
            customer_payment_profile_id=u"444",
            card_number=u"422222222222",
            expiration_date=u"2009-10"
        )

    def test_update_shipping_address(self):
        """
        Test that the XML generated for update_shipping_address is valid
        according to the XMLSchema.
        """
        self.cim.update_shipping_address(
            customer_profile_id=u"222",
            customer_address_id=u"444",
            first_name=u"pippo",
            phone=u"415-415-4154"
        )

    def test_validate_payment_profile(self):
        """
        Test that the XML generated for validate_payment_profile is valid
        according to the XMLSchema.
        """
        self.cim.validate_payment_profile(
            customer_profile_id=u"222",
            customer_payment_profile_id=u"444",
            customer_address_id=u"555",
        )

    def test_create_subscription(self):
        """
        Test that XML generated for arb subscription creation is valid
        according to XMLSchema.
        """
        try:
            self.arb.create_subscription(
                trial_occurrences=4,
                interval_length=1,
                interval_unit=arb.MONTHS_INTERVAL,
                start_date=u"2008-09-09",
                amount=39.99,
                card_number=u"4222222222222",
                expiration_date=u"2009-10",
                bill_first_name=u"Michael",
                bill_last_name=u"Pool"
            )
        except KeyError:
            pass
        self.arb.create_subscription(
            trial_amount=5.00,
            trial_occurrences=4,
            interval_length=1,
            interval_unit=arb.MONTHS_INTERVAL,
            start_date=u"2008-09-09",
            amount=39.99,
            card_number=u"4222222222222",
            expiration_date=u"2009-10",
            bill_first_name=u"Michael",
            bill_last_name=u"Pool"
        )
        self.arb.create_subscription(
            trial_amount=5.00,
            trial_occurrences=4,
            interval_length=1,
            interval_unit=arb.MONTHS_INTERVAL,
            start_date=u"2008-09-09",
            amount=39.99,
            card_number=u"4222222222222",
            expiration_date=u"2009-10",
            ship_first_name=u"valentino",
            first_name=u"valentino",
            bill_first_name=u"valentino",
            bill_last_name=u"Pool",
            driver_number=u"55555",
            driver_state=u"CA",
            driver_birth=u"1990-09-09"
        )

    def test_update_subscription(self):
        """
        Test that XML generated for arb subscription creation is valid
        according to XMLSchema.
        """
        args = dict(trial_amount=5.00,
                    trial_occurrences=4,
                    interval_length=1,
                    interval_unit=arb.MONTHS_INTERVAL,
                    start_date=u"2008-09-09",
                    amount=39.99,
                    card_number=u"4222222222222",
                    expiration_date=u"2009-10",
                    ship_first_name=u"valentino",
                    first_name=u"valentino",
                    bill_first_name=u"valentino",
                    bill_last_name=u"pool",
                    driver_number=u"55555",
                    driver_state=u"CA",
                    driver_birth=u"1990-09-09"
        )

        try:
            self.arb.update_subscription(**args)
        except KeyError:
            self.arb.update_subscription(subscription_id=u"1234", **args)

    def test_cancel_subscription(self):
        """
        Cancel subscription is a generated correctly
        """
        try:
            self.arb.cancel_subscription()
        except KeyError:
            self.arb.cancel_subscription(subscription_id=u"1234")


text:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Timers</title>
</head>
<body>
  <input type="button" onclick="clearInterval(intervalId)" value="stop interval">
  <script>
    let counter = 0;
    let intervalId = setInterval(announce, 2000);

    function announce() {
      let moment = new Date();
      console.log(`Counter is ${++counter} at ${moment}`);
    }
  </script>
</body>
</html>


text:
package utils

import (
	"bytes"
	"time"

	"github.com/cloudflare/goflow/v3/decoders/netflowlegacy"
	flowmessage "github.com/cloudflare/goflow/v3/pb"
	"github.com/cloudflare/goflow/v3/producer"
	"github.com/prometheus/client_golang/prometheus"
)

type StateNFLegacy struct {
	Transport Transport
	Logger    Logger
}

func (s *StateNFLegacy) DecodeFlow(msg interface{}) error {
	pkt := msg.(BaseMessage)
	buf := bytes.NewBuffer(pkt.Payload)
	key := pkt.Src.String()
	samplerAddress := pkt.Src
	if samplerAddress.To4() != nil {
		samplerAddress = samplerAddress.To4()
	}

	ts := uint64(time.Now().UTC().Unix())
	if pkt.SetTime {
		ts = uint64(pkt.RecvTime.UTC().Unix())
	}

	timeTrackStart := time.Now()
	msgDec, err := netflowlegacy.DecodeMessage(buf)

	if err != nil {
		switch err.(type) {
		case *netflowlegacy.ErrorVersion:
			NetFlowErrors.With(
				prometheus.Labels{
					"router": key,
					"error":  "error_version",
				}).
				Inc()
		}
		return err
	}

	switch msgDecConv := msgDec.(type) {
	case netflowlegacy.PacketNetFlowV5:
		NetFlowStats.With(
			prometheus.Labels{
				"router":  key,
				"version": "5",
			}).
			Inc()
		NetFlowSetStatsSum.With(
			prometheus.Labels{
				"router":  key,
				"version": "5",
				"type":    "DataFlowSet",
			}).
			Add(float64(msgDecConv.Count))
	}

	var flowMessageSet []*flowmessage.FlowMessage
	flowMessageSet, err = producer.ProcessMessageNetFlowLegacy(msgDec)

	timeTrackStop := time.Now()
	DecoderTime.With(
		prometheus.Labels{
			"name": "NetFlowV5",
		}).
		Observe(float64((timeTrackStop.Sub(timeTrackStart)).Nanoseconds()) / 1000)

	for _, fmsg := range flowMessageSet {
		fmsg.TimeReceived = ts
		fmsg.SamplerAddress = samplerAddress
	}

	if s.Transport != nil {
		s.Transport.Publish(flowMessageSet)
	}

	return nil
}

func (s *StateNFLegacy) FlowRoutine(workers int, addr string, port int, reuseport bool) error {
	return UDPRoutine("NetFlowV5", s.DecodeFlow, workers, addr, port, reuseport, s.Logger)
}