text:
$(document).ready(function() {
	if (!jQuery.support.leadingWhitespace){
/*		if ($("html").hasClass("ie6"))
			alert('Sorry, we are not supporting Internet Explorer 6, please use another browser');
		else if ($("html").hasClass("ie7"))
			alert('Sorry, we are not supporting Internet Explorer 7, please use another browser');
		else if ($("html").hasClass("ie8"))
			alert('Sorry, we are not supporting Internet Explorer 8, please use another browser');
		else
			alert('Sorry, we are not supporting the browser you are using, please use another browser');

		$('.browserError').removeClass('hidden');
		*/
		document.location.href = getAppPath() + 'error/unsupportedBrowser';
    }

	/*
	 * JQuery Validation Rules
	 */
	$.validator.addMethod('positiveNumber',
		    function (value) {
		        return Number(value) > 0;
		    }, 'Enter a positive number.');

	/*
	 * JQuery UI Adaptor
	 */

	/* For the Jquery table ui-widget-header*/

	$('.jqTable').addClass('ui-widget ui-widget-content ui-corner-all');

	/* For the jquery button */

	$('.jqButton').addClass('ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-button-text');
	$('.jqButton').mouseover(function(e){
		$(this).addClass('ui-state-hover');
	});
	$('.jqButton').mouseleave(function(e){
		$(this).removeClass('ui-state-hover');
	});

	/* For the home page */

	$('.jqHeading').addClass('ui-widget ui-corner-all ui-state-default');

	$('.jqHeading .jqIcon').addClass('ui-icon ui-icon-triangle-1-e');

	$('.jqHeading').click(function(event){
		$(this).toggleClass('ui-state-active');
		$(this).children('.jqIcon').toggleClass('ui-icon-triangle-1-e ui-icon-triangle-1-s');
	});

	$('.jqHeading').mouseover(function(){
		$(this).addClass('ui-state-hover');
	});

	$('.jqHeading').mouseleave(function(){
		$(this).removeClass('ui-state-hover');
	});

	$('#top-nav li').mouseenter(function(event){
		if (!$(this).hasClass('ui-state-active'))
			$(this).addClass('ui-state-hover');
	});

	$('#top-nav li').mouseleave(function(event){
		$(this).removeClass('ui-state-hover');
	});

	$('a.disabled').click(function(e){
		e.preventDefault();
		return false;
	});

});

// Set max chars for textArea
function maxcharsForTextArea(field, max, event)
{
	if (field.value.length > max) {
		field.value = field.value.substring(0, max);
		if (event.type != 'keydown') {
			infoMsg('This field only allows ' + max + ' characters.');
		}

		return false;
	}
	return true;
}

/////////////
// Dialog box

function errorMsg(outputMsg, titleMsg, onCloseCallback) {
    if (!titleMsg)
        titleMsg = 'ERROR';

    if (!outputMsg)
        outputMsg = 'Error Occurs.';

    $("

").html(outputMsg).dialog({
        title: titleMsg,
        resizable: false,
        modal: true,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        },
        close: onCloseCallback
    }).prev(".ui-dialog-titlebar").css("color","red");;
}

function infoMsg(outputMsg, titleMsg, onCloseCallback) {
    if (!titleMsg)
        titleMsg = 'INFO';

    if (!outputMsg)
        outputMsg = 'Welcome and have a nice day.';

    $("

").html(outputMsg).dialog({
        title: titleMsg,
        resizable: false,
        modal: true,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        },
        close: onCloseCallback
    }).prev(".ui-dialog-titlebar").css("color","blue");;
}

function jqAlert(outputMsg, titleMsg, onCloseCallback) {
    if (!titleMsg)
        titleMsg = 'Alert';

    if (!outputMsg)
        outputMsg = 'No Message to Display.';

    $("

").html(outputMsg).dialog({
        title: titleMsg,
        resizable: false,
        modal: true,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        },
        close: onCloseCallback
    });
}

function getAppPath() {
	var appPath = $("#globalForm").find('input[name="appPath"]').val();
	return appPath;
}

function validateFamilyNameString(inputtxt) {
	var regTxt = /^[0-9a-z\_\.]{3,30}$/;
	if (inputtxt.match(regTxt)) {
		return true;
	} else {
		return false;
	}
}

function validateUserNameString(inputtxt) {
	var regTxt = /^[0-9a-z\_\.]{3,30}$/;
	if (inputtxt.match(regTxt)) {
		return true;
	} else {
		return false;
	}
}

function verifyAge(year, month, day, adultAge) {

	var verifyResult = false;

    var now = new Date();
    var dob = new Date(year, month, day);
    var nowYear = now.getFullYear();
    var dobYear = dob.getFullYear();
    var age = nowYear - dobYear;

	var verifyResult = false;

    var verifyResult =  age >=  adultAge;
	return verifyResult;
}

function getLastDateOfMonth(Year, Month) {
	return (new Date((new Date(Year, Month + 1, 1)) - 1));
}

////////////////////////////////////////////////////////////////////////


text:
const path = require('path')
const gulp = require('gulp')
const babel = require('gulp-babel')
const clean = require('gulp-clean')
const gutil = require('gulp-util')

const files = {
	gulpfile: path.resolve(__dirname, 'gulpfile.js'),
	src: `${path.resolve(__dirname, 'src')}/**/*.js`,
	lib: path.resolve(__dirname, 'lib')
}

gulp.task('lib:clean', () => {
	return gulp.src(files.lib, { read: false })
	.pipe(clean())
})

gulp.task('lib:build', () => {
	return gulp.src(files.src)
	.pipe(babel())
	.pipe(gulp.dest(files.lib))
})

gulp.task('watch:lib', ['lib:build'], () => {
	gulp.watch(files.src, ['lib:build'])
})

gulp.task('default', ['watch:lib'])

redpajama_set_name: RedPajamaGithub


text:
//
//  CheckButton.m
//  EpiInfo
//
//  Created by John Copeland on 6/4/17.
//

#import "CheckButton.h"

@implementation CheckButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
/*
- (void)drawRect:(CGRect)rect
{
    CGContextRef ctx = UIGraphicsGetCurrentContext();

    CGContextBeginPath(ctx);

    CGContextMoveToPoint   (ctx, CGRectGetMinX(rect) + 2, CGRectGetMaxY(rect) - 6);  // top left
    CGContextAddLineToPoint(ctx, CGRectGetMidX(rect), CGRectGetMaxY(rect) - 1);  // bottom left
    CGContextAddLineToPoint(ctx, CGRectGetMaxX(rect) - 1, CGRectGetMinY(rect) + 3);  // mid right
    CGContextAddLineToPoint(ctx, CGRectGetMaxX(rect) - 4, CGRectGetMinY(rect) + 1);  // mid right
    CGContextAddLineToPoint(ctx, CGRectGetMidX(rect) - 2, CGRectGetMaxY(rect) - 6);  // bottom left
    CGContextAddLineToPoint(ctx, CGRectGetMinX(rect) + 4, CGRectGetMaxY(rect) - 10);  // top left

    CGContextClosePath(ctx);

    CGContextSetRGBFillColor(ctx, 0, 0, 0, 1);
    CGContextFillPath(ctx);
}
*/
@end


text:
module TubeGetter
  module Crawler
    class Base

      attr_accessor :original_url, :uri, :doc, :download_progress, :done

      def initialize(url)
        @agent = Mechanize.new
        @agent.user_agent_alias = 'Windows IE 7'
        @original_url = url
        @uri = Addressable::URI.parse(url)
        @done = false
      end

      def get(*args)
        @agent.get(*args)
      end

      def post(*args)
        @agent.post(*args)
      end

      def filename
        self.class.filename(original_url)
      end

      def target_filename
        File.join TubeGetter::Config.video_path, filename
      end

      def temp_filename
        File.join TubeGetter::Config.temp_path, filename
      end

      def crawl(*args)
        raise "Crawl method is not implemented! Please override this method."
      end

      def title
        raise "Title method is not implemented! Please override this method."
      end

      def needs_conversion
        raise "needs_conversion method is not implemented! Please override this method."
      end

      def save_and_open(doc)
        text = (doc.respond_to?(:body) ? doc.body : doc)

        filename = "/tmp/#{SecureRandom.uuid}.html"
        File.open(filename, "w") do |f|
          f.write(text)
        end

        `open #{filename}`
      end

      def wget(url, filename)
        progress_regex = /.* \.{10} \.{10} \.{10} \.{10} \.{10} (\d+)%.*/

        @download_progress = 0

        IO.popen("wget -c -O \"#{filename}\" \"#{url}\" 2>&1", "r") do |pipe|
          while line = pipe.gets
            if line.match(progress_regex)
              @download_progress = line.gsub(progress_regex, "\\1").to_i
              sleep 1
            end
          end

          pipe.close
          puts "Pipe exited with #{$?}"
        end

        @done = true
        @download_progress = 100 if @download_progress > 0
      end

      # ------------------------------------------------------------------------------------------------------------

      def self.needs_conversion?
        raise "needs_conversion? method is not implemented! Please override this method."
      end

      def self.filename(url)
        "#{slug} - #{get_id_from_url(url)}.mp4"
      end

      def self.slug
        raise "Slug method not implemented! Please override this method."
      end

      def self.get_id_from_url(url)
        raise "get_id_from_url method not implemented! Please override this method."
      end

    end
  end
end


text:
/*************************************************************************/
/*  gradient_texture_2d_editor_plugin.cpp                                */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "gradient_texture_2d_editor_plugin.h"

#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "scene/gui/box_container.h"
#include "scene/gui/flow_container.h"
#include "scene/gui/separator.h"

Point2 GradientTexture2DEditorRect::_get_handle_position(const Handle p_handle) {
	// Get the handle's mouse position in pixels relative to offset.
	return (p_handle == HANDLE_FILL_FROM ? texture->get_fill_from() : texture->get_fill_to()).clamp(Vector2(), Vector2(1, 1)) * size;
}

void GradientTexture2DEditorRect::_update_fill_position() {
	if (handle == HANDLE_NONE) {
		return;
	}

	// Update the texture's fill_from/fill_to property based on mouse input.
	Vector2 percent = ((get_local_mouse_position() - offset) / size).clamp(Vector2(), Vector2(1, 1));
	if (snap_enabled) {
		percent = (percent - Vector2(0.5, 0.5)).snapped(Vector2(snap_size, snap_size)) + Vector2(0.5, 0.5);
	}

	String property_name = handle == HANDLE_FILL_FROM ? "fill_from" : "fill_to";

	undo_redo->create_action(vformat(TTR("Set %s"), property_name), UndoRedo::MERGE_ENDS);
	undo_redo->add_do_property(texture.ptr(), property_name, percent);
	undo_redo->add_undo_property(texture.ptr(), property_name, handle == HANDLE_FILL_FROM ? texture->get_fill_from() : texture->get_fill_to());
	undo_redo->commit_action();
}

void GradientTexture2DEditorRect::gui_input(const Ref<InputEvent> &p_event) {
	// Grab/release handle.
	const Ref<InputEventMouseButton> mb = p_event;
	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
		if (mb->is_pressed()) {
			Point2 mouse_position = mb->get_position() - offset;
			if (Rect2(_get_handle_position(HANDLE_FILL_FROM).round() - handle_size / 2, handle_size).has_point(mouse_position)) {
				handle = HANDLE_FILL_FROM;
			} else if (Rect2(_get_handle_position(HANDLE_FILL_TO).round() - handle_size / 2, handle_size).has_point(mouse_position)) {
				handle = HANDLE_FILL_TO;
			} else {
				handle = HANDLE_NONE;
			}
		} else {
			_update_fill_position();
			handle = HANDLE_NONE;
		}
	}

	// Move handle.
	const Ref<InputEventMouseMotion> mm = p_event;
	if (mm.is_valid()) {
		_update_fill_position();
	}
}

void GradientTexture2DEditorRect::set_texture(Ref<GradientTexture2D> &p_texture) {
	texture = p_texture;
	texture->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update));
}

void GradientTexture2DEditorRect::set_snap_enabled(bool p_snap_enabled) {
	snap_enabled = p_snap_enabled;
	update();
}

void GradientTexture2DEditorRect::set_snap_size(float p_snap_size) {
	snap_size = p_snap_size;
	update();
}

void GradientTexture2DEditorRect::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE:
		case NOTIFICATION_THEME_CHANGED: {
			checkerboard->set_texture(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")));
		} break;

		case NOTIFICATION_DRAW: {
			if (texture.is_null()) {
				return;
			}

			const Ref<Texture2D> fill_from_icon = get_theme_icon(SNAME("EditorPathSmoothHandle"), SNAME("EditorIcons"));
			const Ref<Texture2D> fill_to_icon = get_theme_icon(SNAME("EditorPathSharpHandle"), SNAME("EditorIcons"));
			handle_size = fill_from_icon->get_size();

			Size2 rect_size = get_size();

			// Get the size and position to draw the texture and handles at.
			size = Size2(texture->get_width() * rect_size.height / texture->get_height(), rect_size.height);
			if (size.width > rect_size.width) {
				size.width = rect_size.width;
				size.height = texture->get_height() * size.width / texture->get_width();
			}
			offset = ((rect_size - size + handle_size) / 2).round();
			size -= handle_size;
			checkerboard->set_rect(Rect2(offset, size));

			draw_set_transform(offset);
			draw_texture_rect(texture, Rect2(Point2(), size));

			// Draw grid snap lines.
			if (snap_enabled) {
				const Color primary_line_color = Color(0.5, 0.5, 0.5, 0.9);
				const Color line_color = Color(0.5, 0.5, 0.5, 0.5);

				// Draw border and centered axis lines.
				draw_rect(Rect2(Point2(), size), primary_line_color, false);
				draw_line(Point2(size.width / 2, 0), Point2(size.width / 2, size.height), primary_line_color);
				draw_line(Point2(0, size.height / 2), Point2(size.width, size.height / 2), primary_line_color);

				// Draw vertical lines.
				int prev_idx = 0;
				for (int x = 0; x < size.width; x++) {
					int idx = int((x / size.width - 0.5) / snap_size);

					if (x > 0 && prev_idx != idx) {
						draw_line(Point2(x, 0), Point2(x, size.height), line_color);
					}

					prev_idx = idx;
				}

				// Draw horizontal lines.
				prev_idx = 0;
				for (int y = 0; y < size.height; y++) {
					int idx = int((y / size.height - 0.5) / snap_size);

					if (y > 0 && prev_idx != idx) {
						draw_line(Point2(0, y), Point2(size.width, y), line_color);
					}

					prev_idx = idx;
				}
			}

			// Draw handles.
			draw_texture(fill_from_icon, (_get_handle_position(HANDLE_FILL_FROM) - handle_size / 2).round());
			draw_texture(fill_to_icon, (_get_handle_position(HANDLE_FILL_TO) - handle_size / 2).round());
		} break;
	}
}

GradientTexture2DEditorRect::GradientTexture2DEditorRect() {
	undo_redo = EditorNode::get_singleton()->get_undo_redo();

	checkerboard = memnew(TextureRect);
	checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE);
	checkerboard->set_draw_behind_parent(true);
	add_child(checkerboard);

	set_custom_minimum_size(Size2(0, 250 * EDSCALE));
}

///////////////////////

void GradientTexture2DEditor::_reverse_button_pressed() {
	undo_redo->create_action(TTR("Swap GradientTexture2D Fill Points"));
	undo_redo->add_do_property(texture.ptr(), "fill_from", texture->get_fill_to());
	undo_redo->add_do_property(texture.ptr(), "fill_to", texture->get_fill_from());
	undo_redo->add_undo_property(texture.ptr(), "fill_from", texture->get_fill_from());
	undo_redo->add_undo_property(texture.ptr(), "fill_to", texture->get_fill_to());
	undo_redo->commit_action();
}

void GradientTexture2DEditor::_set_snap_enabled(bool p_enabled) {
	texture_editor_rect->set_snap_enabled(p_enabled);

	snap_size_edit->set_visible(p_enabled);
}

void GradientTexture2DEditor::_set_snap_size(float p_snap_size) {
	texture_editor_rect->set_snap_size(MAX(p_snap_size, 0.01));
}

void GradientTexture2DEditor::set_texture(Ref<GradientTexture2D> &p_texture) {
	texture = p_texture;
	texture_editor_rect->set_texture(p_texture);
}

void GradientTexture2DEditor::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE:
		case NOTIFICATION_THEME_CHANGED: {
			reverse_button->set_icon(get_theme_icon(SNAME("ReverseGradient"), SNAME("EditorIcons")));
			snap_button->set_icon(get_theme_icon(SNAME("SnapGrid"), SNAME("EditorIcons")));
		} break;
	}
}

GradientTexture2DEditor::GradientTexture2DEditor() {
	undo_redo = EditorNode::get_singleton()->get_undo_redo();

	HFlowContainer *toolbar = memnew(HFlowContainer);
	add_child(toolbar);

	reverse_button = memnew(Button);
	reverse_button->set_tooltip(TTR("Swap Gradient Fill Points"));
	toolbar->add_child(reverse_button);
	reverse_button->connect("pressed", callable_mp(this, &GradientTexture2DEditor::_reverse_button_pressed));

	toolbar->add_child(memnew(VSeparator));

	snap_button = memnew(Button);
	snap_button->set_tooltip(TTR("Toggle Grid Snap"));
	snap_button->set_toggle_mode(true);
	toolbar->add_child(snap_button);
	snap_button->connect("toggled", callable_mp(this, &GradientTexture2DEditor::_set_snap_enabled));

	snap_size_edit = memnew(EditorSpinSlider);
	snap_size_edit->set_min(0.01);
	snap_size_edit->set_max(0.5);
	snap_size_edit->set_step(0.01);
	snap_size_edit->set_value(0.1);
	snap_size_edit->set_custom_minimum_size(Size2(65 * EDSCALE, 0));
	toolbar->add_child(snap_size_edit);
	snap_size_edit->connect("value_changed", callable_mp(this, &GradientTexture2DEditor::_set_snap_size));

	texture_editor_rect = memnew(GradientTexture2DEditorRect);
	add_child(texture_editor_rect);

	set_mouse_filter(MOUSE_FILTER_STOP);
	_set_snap_enabled(snap_button->is_pressed());
	_set_snap_size(snap_size_edit->get_value());
}

///////////////////////

bool EditorInspectorPluginGradientTexture2D::can_handle(Object *p_object) {
	return Object::cast_to<GradientTexture2D>(p_object) != nullptr;
}

void EditorInspectorPluginGradientTexture2D::parse_begin(Object *p_object) {
	GradientTexture2D *texture = Object::cast_to<GradientTexture2D>(p_object);
	if (!texture) {
		return;
	}
	Ref<GradientTexture2D> t(texture);

	GradientTexture2DEditor *editor = memnew(GradientTexture2DEditor);
	editor->set_texture(t);
	add_custom_control(editor);
}

///////////////////////

GradientTexture2DEditorPlugin::GradientTexture2DEditorPlugin() {
	Ref<EditorInspectorPluginGradientTexture2D> plugin;
	plugin.instantiate();
	add_inspector_plugin(plugin);
}


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />

(function(){
    // contants
    var NULL = null,
        UNDEFINED = undefined,
        TRUE = true,
        FALSE = false,
        SETX = "setX",
        SETY = "setY",
        SETXY = "setXY",
        LEFT = "left",
        BOTTOM = "bottom",
        TOP = "top",
        RIGHT = "right",
        HEIGHT = "height",
        WIDTH = "width",
        POINTS = "points",
        HIDDEN = "hidden",
        ABSOLUTE = "absolute",
        VISIBLE = "visible",
        MOTION = "motion",
        POSITION = "position",
        EASEOUT = "easeOut",
        /*
         * Use a light flyweight here since we are using so many callbacks and are always assured a DOM element
         */
        flyEl = new Ext.Element.Flyweight(),
        queues = {},
        getObject = function(o){
            return o || {};
        },
        fly = function(dom){
            flyEl.dom = dom;
            flyEl.id = Ext.id(dom);
            return flyEl;
        },
        /*
         * Queueing now stored outside of the element due to closure issues
         */
        getQueue = function(id){
            if(!queues[id]){
                queues[id] = [];
            }
            return queues[id];
        },
        setQueue = function(id, value){
            queues[id] = value;
        };

//Notifies Element that fx methods are available
Ext.enableFx = TRUE;

/**
 * @class Ext.Fx
 * <p>A class to provide basic animation and visual effects support.  <b>Note:</b> This class is automatically applied
 * to the {@link Ext.Element} interface when included, so all effects calls should be performed via {@link Ext.Element}.
 * Conversely, since the effects are not actually defined in {@link Ext.Element}, Ext.Fx <b>must</b> be
 * {@link Ext#enableFx included} in order for the Element effects to work.</p><br/>
 *
 * <p><b><u>Method Chaining</u></b></p>
 * <p>It is important to note that although the Fx methods and many non-Fx Element methods support "method chaining" in that
 * they return the Element object itself as the method return value, it is not always possible to mix the two in a single
 * method chain.  The Fx methods use an internal effects queue so that each effect can be properly timed and sequenced.
 * Non-Fx methods, on the other hand, have no such internal queueing and will always execute immediately.  For this reason,
 * while it may be possible to mix certain Fx and non-Fx method calls in a single chain, it may not always provide the
 * expected results and should be done with care.  Also see <tt>{@link #callback}</tt>.</p><br/>
 *
 * <p><b><u>Anchor Options for Motion Effects</u></b></p>
 * <p>Motion effects support 8-way anchoring, meaning that you can choose one of 8 different anchor points on the Element
 * that will serve as either the start or end point of the animation.  Following are all of the supported anchor positions:</p>
<pre>
Value  Description
-----  -----------------------------
tl     The top left corner
t      The center of the top edge
tr     The top right corner
l      The center of the left edge
r      The center of the right edge
bl     The bottom left corner
b      The center of the bottom edge
br     The bottom right corner
</pre>
 * <b>Note</b>: some Fx methods accept specific custom config parameters.  The options shown in the Config Options
 * section below are common options that can be passed to any Fx method unless otherwise noted.</b>
 *
 * @cfg {Function} callback A function called when the effect is finished.  Note that effects are queued internally by the
 * Fx class, so a callback is not required to specify another effect -- effects can simply be chained together
 * and called in sequence (see note for <b><u>Method Chaining</u></b> above), for example:<pre><code>
 * el.slideIn().highlight();
 * </code></pre>
 * The callback is intended for any additional code that should run once a particular effect has completed. The Element
 * being operated upon is passed as the first parameter.
 *
 * @cfg {Object} scope The scope (<code>this</code> reference) in which the <tt>{@link #callback}</tt> function is executed. Defaults to the browser window.
 *
 * @cfg {String} easing A valid Ext.lib.Easing value for the effect:</p><div class="mdetail-params"><ul>
 * <li><b><tt>backBoth</tt></b></li>
 * <li><b><tt>backIn</tt></b></li>
 * <li><b><tt>backOut</tt></b></li>
 * <li><b><tt>bounceBoth</tt></b></li>
 * <li><b><tt>bounceIn</tt></b></li>
 * <li><b><tt>bounceOut</tt></b></li>
 * <li><b><tt>easeBoth</tt></b></li>
 * <li><b><tt>easeBothStrong</tt></b></li>
 * <li><b><tt>easeIn</tt></b></li>
 * <li><b><tt>easeInStrong</tt></b></li>
 * <li><b><tt>easeNone</tt></b></li>
 * <li><b><tt>easeOut</tt></b></li>
 * <li><b><tt>easeOutStrong</tt></b></li>
 * <li><b><tt>elasticBoth</tt></b></li>
 * <li><b><tt>elasticIn</tt></b></li>
 * <li><b><tt>elasticOut</tt></b></li>
 * </ul></div>
 *
 * @cfg {String} afterCls A css class to apply after the effect
 * @cfg {Number} duration The length of time (in seconds) that the effect should last
 *
 * @cfg {Number} endOpacity Only applicable for {@link #fadeIn} or {@link #fadeOut}, a number between
 * <tt>0</tt> and <tt>1</tt> inclusive to configure the ending opacity value.
 *
 * @cfg {Boolean} remove Whether the Element should be removed from the DOM and destroyed after the effect finishes
 * @cfg {Boolean} useDisplay Whether to use the <i>display</i> CSS property instead of <i>visibility</i> when hiding Elements (only applies to
 * effects that end with the element being visually hidden, ignored otherwise)
 * @cfg {String/Object/Function} afterStyle A style specification string, e.g. <tt>"width:100px"</tt>, or an object
 * in the form <tt>{width:"100px"}</tt>, or a function which returns such a specification that will be applied to the
 * Element after the effect finishes.
 * @cfg {Boolean} block Whether the effect should block other effects from queueing while it runs
 * @cfg {Boolean} concurrent Whether to allow subsequently-queued effects to run at the same time as the current effect, or to ensure that they run in sequence
 * @cfg {Boolean} stopFx Whether preceding effects should be stopped and removed before running current effect (only applies to non blocking effects)
 */
Ext.Fx = {

    // private - calls the function taking arguments from the argHash based on the key.  Returns the return value of the function.
    //           this is useful for replacing switch statements (for example).
    switchStatements : function(key, fn, argHash){
        return fn.apply(this, argHash[key]);
    },

    /**
     * Slides the element into view.  An anchor point can be optionally passed to set the point of
     * origin for the slide effect.  This function automatically handles wrapping the element with
     * a fixed-size container if needed.  See the Fx class overview for valid anchor point options.
     * Usage:
     *<pre><code>
// default: slide the element in from the top
el.slideIn();

// custom: slide the element in from the right with a 2-second duration
el.slideIn('r', { duration: 2 });

// common config options shown with default values
el.slideIn('t', {
    easing: 'easeOut',
    duration: .5
});
</code></pre>
     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    slideIn : function(anchor, o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            st = dom.style,
            xy,
            r,
            b,
            wrap,
            after,
            st,
            args,
            pt,
            bw,
            bh;

        anchor = anchor || "t";

        me.queueFx(o, function(){
            xy = fly(dom).getXY();
            // fix display to visibility
            fly(dom).fixDisplay();

            // restore values after effect
            r = fly(dom).getFxRestore();
            b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight};
            b.right = b.x + b.width;
            b.bottom = b.y + b.height;

            // fixed size for slide
            fly(dom).setWidth(b.width).setHeight(b.height);

            // wrap if needed
            wrap = fly(dom).fxWrap(r.pos, o, HIDDEN);

            st.visibility = VISIBLE;
            st.position = ABSOLUTE;

            // clear out temp styles after slide and unwrap
            function after(){
                 fly(dom).fxUnwrap(wrap, r.pos, o);
                 st.width = r.width;
                 st.height = r.height;
                 fly(dom).afterFx(o);
            }

            // time to calculate the positions
            pt = {to: [b.x, b.y]};
            bw = {to: b.width};
            bh = {to: b.height};

            function argCalc(wrap, style, ww, wh, sXY, sXYval, s1, s2, w, h, p){
                var ret = {};
                fly(wrap).setWidth(ww).setHeight(wh);
                if(fly(wrap)[sXY]){
                    fly(wrap)[sXY](sXYval);
                }
                style[s1] = style[s2] = "0";
                if(w){
                    ret.width = w;
                }
                if(h){
                    ret.height = h;
                }
                if(p){
                    ret.points = p;
                }
                return ret;
            };

            args = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, {
                    t  : [wrap, st, b.width, 0, NULL, NULL, LEFT, BOTTOM, NULL, bh, NULL],
                    l  : [wrap, st, 0, b.height, NULL, NULL, RIGHT, TOP, bw, NULL, NULL],
                    r  : [wrap, st, b.width, b.height, SETX, b.right, LEFT, TOP, NULL, NULL, pt],
                    b  : [wrap, st, b.width, b.height, SETY, b.bottom, LEFT, TOP, NULL, bh, pt],
                    tl : [wrap, st, 0, 0, NULL, NULL, RIGHT, BOTTOM, bw, bh, pt],
                    bl : [wrap, st, 0, 0, SETY, b.y + b.height, RIGHT, TOP, bw, bh, pt],
                    br : [wrap, st, 0, 0, SETXY, [b.right, b.bottom], LEFT, TOP, bw, bh, pt],
                    tr : [wrap, st, 0, 0, SETX, b.x + b.width, LEFT, BOTTOM, bw, bh, pt]
                });

            st.visibility = VISIBLE;
            fly(wrap).show();

            arguments.callee.anim = fly(wrap).fxanim(args,
                o,
                MOTION,
                .5,
                EASEOUT,
                after);
        });
        return me;
    },

    /**
     * Slides the element out of view.  An anchor point can be optionally passed to set the end point
     * for the slide effect.  When the effect is completed, the element will be hidden (visibility =
     * 'hidden') but block elements will still take up space in the document.  The element must be removed
     * from the DOM using the 'remove' config option if desired.  This function automatically handles
     * wrapping the element with a fixed-size container if needed.  See the Fx class overview for valid anchor point options.
     * Usage:
     *<pre><code>
// default: slide the element out to the top
el.slideOut();

// custom: slide the element out to the right with a 2-second duration
el.slideOut('r', { duration: 2 });

// common config options shown with default values
el.slideOut('t', {
    easing: 'easeOut',
    duration: .5,
    remove: false,
    useDisplay: false
});
</code></pre>
     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    slideOut : function(anchor, o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            st = dom.style,
            xy = me.getXY(),
            wrap,
            r,
            b,
            a,
            zero = {to: 0};

        anchor = anchor || "t";

        me.queueFx(o, function(){

            // restore values after effect
            r = fly(dom).getFxRestore();
            b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight};
            b.right = b.x + b.width;
            b.bottom = b.y + b.height;

            // fixed size for slide
            fly(dom).setWidth(b.width).setHeight(b.height);

            // wrap if needed
            wrap = fly(dom).fxWrap(r.pos, o, VISIBLE);

            st.visibility = VISIBLE;
            st.position = ABSOLUTE;
            fly(wrap).setWidth(b.width).setHeight(b.height);

            function after(){
                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();
                fly(dom).fxUnwrap(wrap, r.pos, o);
                st.width = r.width;
                st.height = r.height;
                fly(dom).afterFx(o);
            }

            function argCalc(style, s1, s2, p1, v1, p2, v2, p3, v3){
                var ret = {};

                style[s1] = style[s2] = "0";
                ret[p1] = v1;
                if(p2){
                    ret[p2] = v2;
                }
                if(p3){
                    ret[p3] = v3;
                }

                return ret;
            };

            a = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, {
                t  : [st, LEFT, BOTTOM, HEIGHT, zero],
                l  : [st, RIGHT, TOP, WIDTH, zero],
                r  : [st, LEFT, TOP, WIDTH, zero, POINTS, {to : [b.right, b.y]}],
                b  : [st, LEFT, TOP, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}],
                tl : [st, RIGHT, BOTTOM, WIDTH, zero, HEIGHT, zero],
                bl : [st, RIGHT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}],
                br : [st, LEFT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x + b.width, b.bottom]}],
                tr : [st, LEFT, BOTTOM, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.right, b.y]}]
            });

            arguments.callee.anim = fly(wrap).fxanim(a,
                o,
                MOTION,
                .5,
                EASEOUT,
                after);
        });
        return me;
    },

    /**
     * Fades the element out while slowly expanding it in all directions.  When the effect is completed, the
     * element will be hidden (visibility = 'hidden') but block elements will still take up space in the document.
     * The element must be removed from the DOM using the 'remove' config option if desired.
     * Usage:
     *<pre><code>
// default
el.puff();

// common config options shown with default values
el.puff({
    easing: 'easeOut',
    duration: .5,
    remove: false,
    useDisplay: false
});
</code></pre>
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    puff : function(o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            st = dom.style,
            width,
            height,
            r;

        me.queueFx(o, function(){
            width = fly(dom).getWidth();
            height = fly(dom).getHeight();
            fly(dom).clearOpacity();
            fly(dom).show();

            // restore values after effect
            r = fly(dom).getFxRestore();

            function after(){
                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();
                fly(dom).clearOpacity();
                fly(dom).setPositioning(r.pos);
                st.width = r.width;
                st.height = r.height;
                st.fontSize = '';
                fly(dom).afterFx(o);
            }

            arguments.callee.anim = fly(dom).fxanim({
                    width : {to : fly(dom).adjustWidth(width * 2)},
                    height : {to : fly(dom).adjustHeight(height * 2)},
                    points : {by : [-width * .5, -height * .5]},
                    opacity : {to : 0},
                    fontSize: {to : 200, unit: "%"}
                },
                o,
                MOTION,
                .5,
                EASEOUT,
                 after);
        });
        return me;
    },

    /**
     * Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television).
     * When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still
     * take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired.
     * Usage:
     *<pre><code>
// default
el.switchOff();

// all config options shown with default values
el.switchOff({
    easing: 'easeIn',
    duration: .3,
    remove: false,
    useDisplay: false
});
</code></pre>
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    switchOff : function(o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            st = dom.style,
            r;

        me.queueFx(o, function(){
            fly(dom).clearOpacity();
            fly(dom).clip();

            // restore values after effect
            r = fly(dom).getFxRestore();

            function after(){
                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();
                fly(dom).clearOpacity();
                fly(dom).setPositioning(r.pos);
                st.width = r.width;
                st.height = r.height;
                fly(dom).afterFx(o);
            };

            fly(dom).fxanim({opacity : {to : 0.3}},
                NULL,
                NULL,
                .1,
                NULL,
                function(){
                    fly(dom).clearOpacity();
                        (function(){
                            fly(dom).fxanim({
                                height : {to : 1},
                                points : {by : [0, fly(dom).getHeight() * .5]}
                            },
                            o,
                            MOTION,
                            0.3,
                            'easeIn',
                            after);
                        }).defer(100);
                });
        });
        return me;
    },

    /**
     * Highlights the Element by setting a color (applies to the background-color by default, but can be
     * changed using the "attr" config option) and then fading back to the original color. If no original
     * color is available, you should provide the "endColor" config option which will be cleared after the animation.
     * Usage:
<pre><code>
// default: highlight background to yellow
el.highlight();

// custom: highlight foreground text to blue for 2 seconds
el.highlight("0000ff", { attr: 'color', duration: 2 });

// common config options shown with default values
el.highlight("ffff9c", {
    attr: "background-color", //can be any valid CSS property (attribute) that supports a color value
    endColor: (current color) or "ffffff",
    easing: 'easeIn',
    duration: 1
});
</code></pre>
     * @param {String} color (optional) The highlight color. Should be a 6 char hex color without the leading # (defaults to yellow: 'ffff9c')
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    highlight : function(color, o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            attr = o.attr || "backgroundColor",
            a = {},
            restore;

        me.queueFx(o, function(){
            fly(dom).clearOpacity();
            fly(dom).show();

            function after(){
                dom.style[attr] = restore;
                fly(dom).afterFx(o);
            }
            restore = dom.style[attr];
            a[attr] = {from: color || "ffff9c", to: o.endColor || fly(dom).getColor(attr) || "ffffff"};
            arguments.callee.anim = fly(dom).fxanim(a,
                o,
                'color',
                1,
                'easeIn',
                after);
        });
        return me;
    },

   /**
    * Shows a ripple of exploding, attenuating borders to draw attention to an Element.
    * Usage:
<pre><code>
// default: a single light blue ripple
el.frame();

// custom: 3 red ripples lasting 3 seconds total
el.frame("ff0000", 3, { duration: 3 });

// common config options shown with default values
el.frame("C3DAF9", 1, {
    duration: 1 //duration of each individual ripple.
    // Note: Easing is not configurable and will be ignored if included
});
</code></pre>
    * @param {String} color (optional) The color of the border.  Should be a 6 char hex color without the leading # (defaults to light blue: 'C3DAF9').
    * @param {Number} count (optional) The number of ripples to display (defaults to 1)
    * @param {Object} options (optional) Object literal with any of the Fx config options
    * @return {Ext.Element} The Element
    */
    frame : function(color, count, o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            proxy,
            active;

        me.queueFx(o, function(){
            color = color || '#C3DAF9';
            if(color.length == 6){
                color = '#' + color;
            }
            count = count || 1;
            fly(dom).show();

            var xy = fly(dom).getXY(),
                b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight},
                queue = function(){
                    proxy = fly(document.body || document.documentElement).createChild({
                        style:{
                            position : ABSOLUTE,
                            'z-index': 35000, // yee haw
                            border : '0px solid ' + color
                        }
                    });
                    return proxy.queueFx({}, animFn);
                };

            arguments.callee.anim = {
                isAnimated: true,
                stop: function() {
                    count = 0;
                    proxy.stopFx();
                }
            };

            function animFn(){
                var scale = Ext.isBorderBox ? 2 : 1;
                active = proxy.anim({
                    top : {from : b.y, to : b.y - 20},
                    left : {from : b.x, to : b.x - 20},
                    borderWidth : {from : 0, to : 10},
                    opacity : {from : 1, to : 0},
                    height : {from : b.height, to : b.height + 20 * scale},
                    width : {from : b.width, to : b.width + 20 * scale}
                },{
                    duration: o.duration || 1,
                    callback: function() {
                        proxy.remove();
                        --count > 0 ? queue() : fly(dom).afterFx(o);
                    }
                });
                arguments.callee.anim = {
                    isAnimated: true,
                    stop: function(){
                        active.stop();
                    }
                };
            };
            queue();
        });
        return me;
    },

   /**
    * Creates a pause before any subsequent queued effects begin.  If there are
    * no effects queued after the pause it will have no effect.
    * Usage:
<pre><code>
el.pause(1);
</code></pre>
    * @param {Number} seconds The length of time to pause (in seconds)
    * @return {Ext.Element} The Element
    */
    pause : function(seconds){
        var dom = this.dom,
            t;

        this.queueFx({}, function(){
            t = setTimeout(function(){
                fly(dom).afterFx({});
            }, seconds * 1000);
            arguments.callee.anim = {
                isAnimated: true,
                stop: function(){
                    clearTimeout(t);
                    fly(dom).afterFx({});
                }
            };
        });
        return this;
    },

   /**
    * Fade an element in (from transparent to opaque).  The ending opacity can be specified
    * using the <tt>{@link #endOpacity}</tt> config option.
    * Usage:
<pre><code>
// default: fade in from opacity 0 to 100%
el.fadeIn();

// custom: fade in from opacity 0 to 75% over 2 seconds
el.fadeIn({ endOpacity: .75, duration: 2});

// common config options shown with default values
el.fadeIn({
    endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)
    easing: 'easeOut',
    duration: .5
});
</code></pre>
    * @param {Object} options (optional) Object literal with any of the Fx config options
    * @return {Ext.Element} The Element
    */
    fadeIn : function(o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            to = o.endOpacity || 1;

        me.queueFx(o, function(){
            fly(dom).setOpacity(0);
            fly(dom).fixDisplay();
            dom.style.visibility = VISIBLE;
            arguments.callee.anim = fly(dom).fxanim({opacity:{to:to}},
                o, NULL, .5, EASEOUT, function(){
                if(to == 1){
                    fly(dom).clearOpacity();
                }
                fly(dom).afterFx(o);
            });
        });
        return me;
    },

   /**
    * Fade an element out (from opaque to transparent).  The ending opacity can be specified
    * using the <tt>{@link #endOpacity}</tt> config option.  Note that IE may require
    * <tt>{@link #useDisplay}:true</tt> in order to redisplay correctly.
    * Usage:
<pre><code>
// default: fade out from the element's current opacity to 0
el.fadeOut();

// custom: fade out from the element's current opacity to 25% over 2 seconds
el.fadeOut({ endOpacity: .25, duration: 2});

// common config options shown with default values
el.fadeOut({
    endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)
    easing: 'easeOut',
    duration: .5,
    remove: false,
    useDisplay: false
});
</code></pre>
    * @param {Object} options (optional) Object literal with any of the Fx config options
    * @return {Ext.Element} The Element
    */
    fadeOut : function(o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            style = dom.style,
            to = o.endOpacity || 0;

        me.queueFx(o, function(){
            arguments.callee.anim = fly(dom).fxanim({
                opacity : {to : to}},
                o,
                NULL,
                .5,
                EASEOUT,
                function(){
                    if(to == 0){
                        Ext.Element.data(dom, 'visibilityMode') == Ext.Element.DISPLAY || o.useDisplay ?
                            style.display = "none" :
                            style.visibility = HIDDEN;

                        fly(dom).clearOpacity();
                    }
                    fly(dom).afterFx(o);
            });
        });
        return me;
    },

   /**
    * Animates the transition of an element's dimensions from a starting height/width
    * to an ending height/width.  This method is a convenience implementation of {@link shift}.
    * Usage:
<pre><code>
// change height and width to 100x100 pixels
el.scale(100, 100);

// common config options shown with default values.  The height and width will default to
// the element&#39;s existing values if passed as null.
el.scale(
    [element&#39;s width],
    [element&#39;s height], {
        easing: 'easeOut',
        duration: .35
    }
);
</code></pre>
    * @param {Number} width  The new width (pass undefined to keep the original width)
    * @param {Number} height  The new height (pass undefined to keep the original height)
    * @param {Object} options (optional) Object literal with any of the Fx config options
    * @return {Ext.Element} The Element
    */
    scale : function(w, h, o){
        this.shift(Ext.apply({}, o, {
            width: w,
            height: h
        }));
        return this;
    },

   /**
    * Animates the transition of any combination of an element's dimensions, xy position and/or opacity.
    * Any of these properties not specified in the config object will not be changed.  This effect
    * requires that at least one new dimension, position or opacity setting must be passed in on
    * the config object in order for the function to have any effect.
    * Usage:
<pre><code>
// slide the element horizontally to x position 200 while changing the height and opacity
el.shift({ x: 200, height: 50, opacity: .8 });

// common config options shown with default values.
el.shift({
    width: [element&#39;s width],
    height: [element&#39;s height],
    x: [element&#39;s x position],
    y: [element&#39;s y position],
    opacity: [element&#39;s opacity],
    easing: 'easeOut',
    duration: .35
});
</code></pre>
    * @param {Object} options  Object literal with any of the Fx config options
    * @return {Ext.Element} The Element
    */
    shift : function(o){
        o = getObject(o);
        var dom = this.dom,
            a = {};

        this.queueFx(o, function(){
            for (var prop in o) {
                if (o[prop] != UNDEFINED) {
                    a[prop] = {to : o[prop]};
                }
            }

            a.width ? a.width.to = fly(dom).adjustWidth(o.width) : a;
            a.height ? a.height.to = fly(dom).adjustWidth(o.height) : a;

            if (a.x || a.y || a.xy) {
                a.points = a.xy ||
                           {to : [ a.x ? a.x.to : fly(dom).getX(),
                                   a.y ? a.y.to : fly(dom).getY()]};
            }

            arguments.callee.anim = fly(dom).fxanim(a,
                o,
                MOTION,
                .35,
                EASEOUT,
                function(){
                    fly(dom).afterFx(o);
                });
        });
        return this;
    },

    /**
     * Slides the element while fading it out of view.  An anchor point can be optionally passed to set the
     * ending point of the effect.
     * Usage:
     *<pre><code>
// default: slide the element downward while fading out
el.ghost();

// custom: slide the element out to the right with a 2-second duration
el.ghost('r', { duration: 2 });

// common config options shown with default values
el.ghost('b', {
    easing: 'easeOut',
    duration: .5,
    remove: false,
    useDisplay: false
});
</code></pre>
     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to bottom: 'b')
     * @param {Object} options (optional) Object literal with any of the Fx config options
     * @return {Ext.Element} The Element
     */
    ghost : function(anchor, o){
        o = getObject(o);
        var me = this,
            dom = me.dom,
            st = dom.style,
            a = {opacity: {to: 0}, points: {}},
            pt = a.points,
            r,
            w,
            h;

        anchor = anchor || "b";

        me.queueFx(o, function(){
            // restore values after effect
            r = fly(dom).getFxRestore();
            w = fly(dom).getWidth();
            h = fly(dom).getHeight();

            function after(){
                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();
                fly(dom).clearOpacity();
                fly(dom).setPositioning(r.pos);
                st.width = r.width;
                st.height = r.height;
                fly(dom).afterFx(o);
            }

            pt.by = fly(dom).switchStatements(anchor.toLowerCase(), function(v1,v2){ return [v1, v2];}, {
               t  : [0, -h],
               l  : [-w, 0],
               r  : [w, 0],
               b  : [0, h],
               tl : [-w, -h],
               bl : [-w, h],
               br : [w, h],
               tr : [w, -h]
            });

            arguments.callee.anim = fly(dom).fxanim(a,
                o,
                MOTION,
                .5,
                EASEOUT, after);
        });
        return me;
    },

    /**
     * Ensures that all effects queued after syncFx is called on the element are
     * run concurrently.  This is the opposite of {@link #sequenceFx}.
     * @return {Ext.Element} The Element
     */
    syncFx : function(){
        var me = this;
        me.fxDefaults = Ext.apply(me.fxDefaults || {}, {
            block : FALSE,
            concurrent : TRUE,
            stopFx : FALSE
        });
        return me;
    },

    /**
     * Ensures that all effects queued after sequenceFx is called on the element are
     * run in sequence.  This is the opposite of {@link #syncFx}.
     * @return {Ext.Element} The Element
     */
    sequenceFx : function(){
        var me = this;
        me.fxDefaults = Ext.apply(me.fxDefaults || {}, {
            block : FALSE,
            concurrent : FALSE,
            stopFx : FALSE
        });
        return me;
    },

    /* @private */
    nextFx : function(){
        var ef = getQueue(this.dom.id)[0];
        if(ef){
            ef.call(this);
        }
    },

    /**
     * Returns true if the element has any effects actively running or queued, else returns false.
     * @return {Boolean} True if element has active effects, else false
     */
    hasActiveFx : function(){
        return getQueue(this.dom.id)[0];
    },

    /**
     * Stops any running effects and clears the element's internal effects queue if it contains
     * any additional effects that haven't started yet.
     * @return {Ext.Element} The Element
     */
    stopFx : function(finish){
        var me = this,
            id = me.dom.id;
        if(me.hasActiveFx()){
            var cur = getQueue(id)[0];
            if(cur && cur.anim){
                if(cur.anim.isAnimated){
                    setQueue(id, [cur]); //clear
                    cur.anim.stop(finish !== undefined ? finish : TRUE);
                }else{
                    setQueue(id, []);
                }
            }
        }
        return me;
    },

    /* @private */
    beforeFx : function(o){
        if(this.hasActiveFx() && !o.concurrent){
           if(o.stopFx){
               this.stopFx();
               return TRUE;
           }
           return FALSE;
        }
        return TRUE;
    },

    /**
     * Returns true if the element is currently blocking so that no other effect can be queued
     * until this effect is finished, else returns false if blocking is not set.  This is commonly
     * used to ensure that an effect initiated by a user action runs to completion prior to the
     * same effect being restarted (e.g., firing only one effect even if the user clicks several times).
     * @return {Boolean} True if blocking, else false
     */
    hasFxBlock : function(){
        var q = getQueue(this.dom.id);
        return q && q[0] && q[0].block;
    },

    /* @private */
    queueFx : function(o, fn){
        var me = fly(this.dom);
        if(!me.hasFxBlock()){
            Ext.applyIf(o, me.fxDefaults);
            if(!o.concurrent){
                var run = me.beforeFx(o);
                fn.block = o.block;
                getQueue(me.dom.id).push(fn);
                if(run){
                    me.nextFx();
                }
            }else{
                fn.call(me);
            }
        }
        return me;
    },

    /* @private */
    fxWrap : function(pos, o, vis){
        var dom = this.dom,
            wrap,
            wrapXY;
        if(!o.wrap || !(wrap = Ext.getDom(o.wrap))){
            if(o.fixPosition){
                wrapXY = fly(dom).getXY();
            }
            var div = document.createElement("div");
            div.style.visibility = vis;
            wrap = dom.parentNode.insertBefore(div, dom);
            fly(wrap).setPositioning(pos);
            if(fly(wrap).isStyle(POSITION, "static")){
                fly(wrap).position("relative");
            }
            fly(dom).clearPositioning('auto');
            fly(wrap).clip();
            wrap.appendChild(dom);
            if(wrapXY){
                fly(wrap).setXY(wrapXY);
            }
        }
        return wrap;
    },

    /* @private */
    fxUnwrap : function(wrap, pos, o){
        var dom = this.dom;
        fly(dom).clearPositioning();
        fly(dom).setPositioning(pos);
        if(!o.wrap){
            var pn = fly(wrap).dom.parentNode;
            pn.insertBefore(dom, wrap);
            fly(wrap).remove();
        }
    },

    /* @private */
    getFxRestore : function(){
        var st = this.dom.style;
        return {pos: this.getPositioning(), width: st.width, height : st.height};
    },

    /* @private */
    afterFx : function(o){
        var dom = this.dom,
            id = dom.id;
        if(o.afterStyle){
            fly(dom).setStyle(o.afterStyle);
        }
        if(o.afterCls){
            fly(dom).addClass(o.afterCls);
        }
        if(o.remove == TRUE){
            fly(dom).remove();
        }
        if(o.callback){
            o.callback.call(o.scope, fly(dom));
        }
        if(!o.concurrent){
            getQueue(id).shift();
            fly(dom).nextFx();
        }
    },

    /* @private */
    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
        animType = animType || 'run';
        opt = opt || {};
        var anim = Ext.lib.Anim[animType](
                this.dom,
                args,
                (opt.duration || defaultDur) || .35,
                (opt.easing || defaultEase) || EASEOUT,
                cb,
                this
            );
        opt.anim = anim;
        return anim;
    }
};

// backwards compat
Ext.Fx.resize = Ext.Fx.scale;

//When included, Ext.Fx is automatically applied to Element so that all basic
//effects are available directly via the Element API
Ext.Element.addMethods(Ext.Fx);
})();


text:
FROM phusion/baseimage:0.9.11
MAINTAINER kstile <2kwv01@things>
ENV DEBIAN_FRONTEND noninteractive

# Set correct environment variables
ENV HOME /root

# Use baseimage-docker's init system
CMD ["/sbin/my_init"]

# Fix a Debianism of the nobody's uid being 65534
RUN usermod -u 99 nobody
RUN usermod -g 100 nobody

# install our dependencies and nodejs
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
#RUN apt-get -y install python-software-properties git build-essential
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs

# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /opt/app/podcastSlinger && cp -a /tmp/node_modules /opt/app/podcastSlinger

# podcastSlinger Configuration
#VOLUME

# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
WORKDIR /opt/app/podcastSlinger
ADD id3.js /opt/app/podcastSlinger/
ADD rss.jade /opt/app/podcastSlinger/
ADD server.js /opt/app/podcastSlinger/

RUN chown -R 99:100 /opt/app/podcastSlinger

# Add podcastSlinger to runit
RUN mkdir /etc/service/podcastSlinger
ADD podcastSlinger.sh /etc/service/podcastSlinger/run
RUN chmod +x /etc/service/podcastSlinger/run


text:
class GnuWhich < Formula
  desc "GNU implementation of which utility"
  # Previous homepage is dead. Have linked to the GNU Projects page for now.
  homepage "https://savannah.gnu.org/projects/which/"
  url "https://ftp.gnu.org/gnu/which/which-2.21.tar.gz"
  mirror "https://ftpmirror.gnu.org/which/which-2.21.tar.gz"
  sha256 "f4a245b94124b377d8b49646bf421f9155d36aa7614b6ebf83705d3ffc76eaad"

  bottle do
    cellar :any_skip_relocation
    rebuild 2
    sha256 "83fb2814c1a81fa381f5462565141ff1f4fd0580847288c7047019353bad0fa4" => :mojave
    sha256 "1c2174cbc0d721dec7f86f920dbdda09109c84fdf8b8cada6a10b01d496e411b" => :high_sierra
    sha256 "ebd500ad7b851205dd25c7ec78441f029b9982b8a0f3df081266e58f6df7c6ec" => :sierra
  end

  def install
    args = %W[
      --prefix=#{prefix}
      --disable-dependency-tracking
      --program-prefix=g
    ]

    system "./configure", *args
    system "make", "install"

    (libexec/"gnubin").install_symlink bin/"gwhich" => "which"
    (libexec/"gnuman/man1").install_symlink man1/"gwhich.1" => "which.1"
  end

  def caveats; <<~EOS
    GNU "which" has been installed as "gwhich".
    If you need to use it as "which", you can add a "gnubin" directory
    to your PATH from your bashrc like:

        PATH="#{opt_libexec}/gnubin:$PATH"

    Additionally, you can access its man page with normal name if you add
    the "gnuman" directory to your MANPATH from your bashrc as well:

        MANPATH="#{opt_libexec}/gnuman:$MANPATH"
  EOS
  end

  test do
    system "#{bin}/gwhich", "gcc"
    system "#{opt_libexec}/gnubin/which", "gcc"
  end
end


text:
package de.mprengemann.intellij.plugin.androidicons.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataKeys;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import de.mprengemann.intellij.plugin.androidicons.dialogs.IconImporter;
import de.mprengemann.intellij.plugin.androidicons.util.AndroidFacetUtils;
import icons.AndroidIcons;
import org.jetbrains.annotations.NotNull;

public class IconsAction extends AnAction {

    public IconsAction() {
        super("Icon Pack Drawable Importer",
              "Creates a new Android Asset by the use of Google\'s Material Icons or Android Icons",
              AndroidIcons.Android);
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent event) {
        Project project = getEventProject(event);
        Module module = event.getData(DataKeys.MODULE);

        IconImporter dialog = new IconImporter(project, module);
        dialog.show();
    }

    @Override
    public void update(@NotNull AnActionEvent e) {
        AndroidFacetUtils.updateActionVisibility(e);
    }

}


text:
package com.thinkbiganalytics.feedmgr.service.feed.importing;

import com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata;
import com.thinkbiganalytics.feedmgr.rest.model.ImportProperty;
import com.thinkbiganalytics.feedmgr.rest.model.ImportPropertyBuilder;
import com.thinkbiganalytics.feedmgr.service.feed.importing.model.LegacyDatasource;
import com.thinkbiganalytics.kylo.catalog.rest.model.DataSet;
import com.thinkbiganalytics.kylo.catalog.rest.model.DataSource;
import com.thinkbiganalytics.metadata.rest.model.data.Datasource;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class FeedImportDatasourceUtil {

    private static final Logger log = LoggerFactory.getLogger(FeedImportDatasourceUtil.class);

    /**
     * key that will help the importer decide to show datasets
     */
    public static final String LEGACY_TABLE_DATA_SOURCE_KEY = "legacyTableDataSource";
    /**
     * key that will help the importer decide to show catalog datasources
     */
    public static final String LEGACY_QUERY_DATA_SOURCE_KEY = "legacyQueryDataSource";

    public static final String CATALOG_DATASOURCE_KEY = "catalogDataSource";

    public static void replaceMap(Map<String,Object> map, String lookFor, String replace) {
        for(String key :map.keySet()) {
            Object value = map.get(key);
            if (value instanceof String && ((String) value).equalsIgnoreCase(lookFor)) {
                //REPLACE IT
                map.put(key,replace);
                log.info("Replaced {} with {} in Map ", lookFor,replace);
            } else if (value instanceof List) {
                List<Object> copiedList = FeedImportDatasourceUtil.replaceList((List<Object>)value, lookFor, replace);
                map.put(key,copiedList);
            } else if (value instanceof Map) {
                FeedImportDatasourceUtil.replaceMap((Map<String,Object>) value, lookFor, replace);
            }
            else {
                map.put(key,value);
            }
        }
    }

    public static List<Object> replaceList(List<Object> list,String lookFor, String replace) {
        List<Object> copy = new ArrayList<>();

        for (Object value : list) {
            if (value instanceof String && ((String) value).equalsIgnoreCase(lookFor)) {
                //REPLACE IT
                log.info("Replaced {} with {} in List ", lookFor,replace);
                copy.add(replace);
            } else if (value instanceof List) {
                List<Object> copiedList = FeedImportDatasourceUtil.replaceList((List<Object>) value, lookFor, replace);
                copy.add(copiedList);

            } else if (value instanceof Map) {
                copy.add(value);
                FeedImportDatasourceUtil.replaceMap((Map<String, Object>) value, lookFor, replace);
            } else {
                copy.add(value);
            }

        }
        return copy;
    }

    public static void replaceChartModelReferences(FeedMetadata metadata, Map<String,String>replacements){

        if(metadata.getDataTransformation() != null && StringUtils.isNotBlank(metadata.getDataTransformation().getDataTransformScript()) && metadata.getDataTransformation().getChartViewModel() != null && replacements != null && replacements.size() >0) {

            List<Map<String, Object>> nodes = (List<Map<String, Object>>) metadata.getDataTransformation().getChartViewModel().get("nodes");
            if (nodes != null) {
                nodes.stream().forEach((nodeMap) -> {
                    replacements.entrySet().stream().forEach(entry -> replaceMap(nodeMap, entry.getKey(), entry.getValue()));
                });
            }

        }
        if(metadata.getDataTransformation() != null && metadata.getDataTransformation().getCatalogDataSourceIds() != null) {
            //update the catalogDataSourceIds and the metadata.datasourceids with the new ids
            List<String> newIds = metadata.getDataTransformation().getCatalogDataSourceIds().stream().map(id -> replacements.containsKey(id) ? replacements.get(id) : id).collect(Collectors.toList());
            metadata.getDataTransformation().setCatalogDataSourceIds(newIds);
        }
        if(metadata.getDataTransformation() != null && metadata.getDataTransformation().getDatasourceIds() != null) {
            List<String>
                updatedDatasourceIds =
                metadata.getDataTransformation().getDatasourceIds().stream().map(id -> replacements.containsKey(id) ? replacements.get(id) : id).collect(Collectors.toList());
            metadata.getDataTransformation().setDatasourceIds(updatedDatasourceIds);
        }

    }

    public static void populateFeedDatasourceIdsProperty(FeedMetadata metadata){
        //fill the datasourceIds array will catalog datasets and datasources for backwards compatability
        List<String> catalogDataSources =metadata.getDataTransformation() != null ? metadata.getDataTransformation().getCatalogDataSourceIds() : null;
        List<DataSet> catalogDataSets = metadata.getSourceDataSets();
        List<String> datasourceIds = metadata.getDataTransformation() != null ? metadata.getDataTransformation().getDatasourceIds() : null;

        final  List<String> ids  = datasourceIds != null ? datasourceIds : new ArrayList<>();
        if(catalogDataSets != null){
            catalogDataSets.stream().filter(dataSet -> !ids.contains(dataSet.getId())).forEach(dataSet -> ids.add(dataSet.getId()));
        }

        if(catalogDataSources != null){
            catalogDataSources.stream().filter(datasource -> !ids.contains(datasource)).forEach(datasource -> ids.add(datasource));
        }
        metadata.getDataTransformation().setDatasourceIds(ids);

    }

    public static void fixDatasetMatchesUserDataSource(FeedMetadata metadata, String datasourceId, com.thinkbiganalytics.kylo.catalog.rest.model.DataSet dataSet){

        if(metadata.getDataTransformation() != null && StringUtils.isNotBlank(metadata.getDataTransformation().getDataTransformScript()) && metadata.getDataTransformation().getChartViewModel() != null) {

            List<Map<String, Object>> nodes = (List<Map<String, Object>>) metadata.getDataTransformation().getChartViewModel().get("nodes");
            if (nodes != null) {
                nodes.stream().filter(nodeMap -> nodeMap.containsKey("datasourceId") && ((String)nodeMap.get("datasourceId")).equalsIgnoreCase(datasourceId))
                    .forEach((nodeMap) -> {
                        nodeMap.put("datasetMatchesUserDataSource", false);
                        if(!nodeMap.containsKey("dataset")){
                            Map<String,Object> map = new HashMap<>();
                            map.put("id",dataSet.getId());
                            nodeMap.put("dataset",map);
                        }
                    });
            }
        }
    }

    public static void replaceLegacyDataSourceScript(FeedMetadata metadata,String table, String datasourceId, DataSet dataSet){

        String find = "datasourceProvider.getTableFromDatasource(\""+table+"\", \""+datasourceId+"\", sqlContext)";
        String replace = "catalogDataSetProvider.read(\""+dataSet.getId()+"\")";
        String replaced = metadata.getDataTransformation().getDataTransformScript().replace(find,replace);
        metadata.getDataTransformation().setDataTransformScript(replaced);
        if(metadata.getSourceDataSets() == null){
            metadata.setSourceDataSets(new ArrayList<>());
        }
        metadata.getSourceDataSets().add(dataSet);
        //remove the legacy user datasource id
        metadata.getDataTransformation().getDatasourceIds().remove(datasourceId);
        FeedImportDatasourceUtil.fixDatasetMatchesUserDataSource(metadata, datasourceId, dataSet);
    }

    public static void replaceLegacyQueryDataSourceScript(FeedMetadata metadata, String datasourceId, DataSource dataSource){

        if(metadata.getDataTransformation() != null && StringUtils.isNotBlank(metadata.getDataTransformation().getDataTransformScript())) {
            String script = metadata.getDataTransformation().getDataTransformScript();
            Pattern pattern = Pattern.compile("datasourceProvider.getTableFromDatasource\\((.*) AS KYLO_SPARK_QUERY\", \""+datasourceId+"\", sqlContext\\)");
            Matcher matcher = pattern.matcher(script);
            StringBuffer sb = new StringBuffer();
            while (matcher.find()) {
                String query = matcher.group(1).replaceAll("\"", "");
                String catalogDataSourceId = dataSource.getId();
                matcher.appendReplacement(sb,matcher.group(0).replaceFirst(datasourceId,catalogDataSourceId));
            }
            matcher.appendTail(sb);
            metadata.getDataTransformation().setDataTransformScript(sb.toString());
            //remove the legacy user datasource id
            metadata.getDataTransformation().getDatasourceIds().remove(datasourceId);

            //populate the new Catalog Datasource ids
            if(metadata.getDataTransformation().getCatalogDataSourceIds() == null){
                metadata.getDataTransformation().setCatalogDataSourceIds(new ArrayList<>());
            }
            if(!metadata.getDataTransformation().getCatalogDataSourceIds().contains(dataSource.getId())){
                metadata.getDataTransformation().getCatalogDataSourceIds().add(dataSource.getId());
                metadata.getDataTransformation().updateDataSourceIdsString();
            }
        }
    }

    /**
     * Make sure the connections attributes that link source and dest nodes are correct.
     * it appears some kylo instances have the joinKeys that list the (sourceKey and destKey)mapping to the wrong node.
     * this will fix the join keys so the sourceKey maps to the source node and the destKey maps to the destNode
     *
     * @param metadata
     */
    public static void ensureConnectionKeysMatch(FeedMetadata metadata){

        if(metadata.getDataTransformation().getChartViewModel() != null ) {
            List<Map<String, Object>> nodes = (List<Map<String, Object>>) metadata.getDataTransformation().getChartViewModel().get("nodes");

            Map<String, Map<String, Object>> nodeById = nodes.stream().collect(Collectors.toMap(node -> node.get("id").toString(), node -> node));
            List<Map<String, Map<String, Object>>> connections = (List<Map<String, Map<String, Object>>>) metadata.getDataTransformation().getChartViewModel().get("connections");
            if (connections != null) {

                connections.stream().forEach(connection -> {
                    Map<String, Object> joinKeys = (Map<String, Object>) connection.get("joinKeys");
                    String sourceKey = joinKeys.get("sourceKey").toString();
                    String destKey = joinKeys.get("destKey").toString();

                    Map<String, Object> sourceNode = nodeById.get(connection.get("source").get("nodeID") + "");
                    Map<String, Object> destNode = nodeById.get(connection.get("dest").get("nodeID") + "");

                    Map<String, Map<String, Object>> srcNodeAttrs = ((Map<String, Map<String, Object>>) sourceNode.get("nodeAttributes"));
                    List<Map<String, String>> srcAttrs = (List<Map<String, String>>) srcNodeAttrs.get("attributes");
                    List<String> sourceFields = srcAttrs.stream().map(attr -> attr.get("name")).collect(Collectors.toList());

                    Map<String, Map<String, Object>> destNodeAttrs = ((Map<String, Map<String, Object>>) destNode.get("nodeAttributes"));
                    List<Map<String, String>> destAttrs = (List<Map<String, String>>) destNodeAttrs.get("attributes");
                    List<String> destFields = destAttrs.stream().map(attr -> attr.get("name")).collect(Collectors.toList());

                    boolean validSource = sourceFields.contains(sourceKey);
                    boolean validDest = destFields.contains(destKey);
                    if (!validDest && !validSource) {
                        //try flipping them
                        validSource = sourceFields.contains(destKey);
                        validDest = destFields.contains(sourceKey);
                        if (validDest && validSource) {
                            //flip them
                            joinKeys.put("sourceKey", destKey);
                            joinKeys.put("destKey", sourceKey);
                            log.info("Fixed source and dest Keys for feed {} ", metadata.getCategoryAndFeedName());
                        }
                    }
                });

            }
        }

    }

    /**
     * Parse the script for all legacy datasources and return a map of datasourceId, list of datasources
     * @param metadata
     * @return return a map of datasourceId, list of datasources
     */
    public static Map<String,List<LegacyDatasource>> parseLegacyDatasourcesById(FeedMetadata metadata){
        Map<String,List<LegacyDatasource>> map = new HashMap<>();
        if(metadata.getDataTransformation() != null && StringUtils.isNotBlank(metadata.getDataTransformation().getDataTransformScript())) {
            String script = metadata.getDataTransformation().getDataTransformScript();
            Pattern pattern = Pattern.compile("datasourceProvider.getTableFromDatasource\\((.*), (.*), sqlContext\\)");
            Matcher matcher = pattern.matcher(script);
            StringBuffer sb = new StringBuffer();
            // check all occurance
            while (matcher.find()) {
                String tableOrQuery = matcher.group(1).replaceAll("\"", "");
                String datasourceId = matcher.group(2).replaceAll("\"", "");
                LegacyDatasource legacyDatasource = null;
                if(tableOrQuery.contains("KYLO_SPARK_QUERY")){
                    tableOrQuery = tableOrQuery.replaceAll("AS KYLO_SPARK_QUERY","");
                    legacyDatasource = LegacyDatasource.newQueryDatasource(tableOrQuery,datasourceId);
                }
                else {
                    legacyDatasource = LegacyDatasource.newTableDatasource(tableOrQuery,datasourceId);
                }
                map.computeIfAbsent(datasourceId, dsId -> new ArrayList<LegacyDatasource>()).add(legacyDatasource);
            }
        }
        return map;

    }

    /**
     * For the script if there is no matching userdatasource, build the import property for the user to supply the matching dataset
     * @param metadata
     * @param availableDatasources
     * @return
     */
    public static List<ImportProperty> buildDatasourceAssignmentProperties(FeedMetadata metadata, Set<String> availableDatasources){
        Map<String,List<LegacyDatasource>> legacyDatasources = FeedImportDatasourceUtil.parseLegacyDatasourcesById(metadata);

        final List<Datasource> providedDatasources = Optional.ofNullable(metadata.getUserDatasources()).orElse(Collections.emptyList());
        Map<String,Datasource>providedDatasourcesMap = providedDatasources.stream()
            .collect(Collectors.toMap(ds->ds.getId(), ds1->ds1));

       return  providedDatasources.stream()
            .filter(datasource -> (availableDatasources == null || !availableDatasources.contains(datasource.getId())))
            .flatMap(datasource -> legacyDatasources.get(datasource.getId()).stream())
            .map(legacyDataSource -> {
                Datasource legacySource = providedDatasourcesMap.get(legacyDataSource.getDatasourceId());
                if(legacyDataSource.isDataSet()) {
                    return ImportPropertyBuilder.anImportProperty()
                        .withComponentName(legacySource.getName())
                        .withDisplayName(legacyDataSource.getTable())
                        .withComponentId(legacyDataSource.getKey())
                        .withPropertyKey(legacyDataSource.getKey().replace(".", "-").replace(" ", "_"))
                        .putAdditionalProperty("table", legacyDataSource.getTable())
                        .putAdditionalProperty("datasourceId", legacyDataSource.getDatasourceId())
                        .putAdditionalProperty(LEGACY_TABLE_DATA_SOURCE_KEY, "true").build();
                }
                else {
                    return ImportPropertyBuilder.anImportProperty()
                        .withComponentName(legacySource.getName())
                        .withDisplayName(legacyDataSource.getQuery())
                        .withComponentId(legacyDataSource.getKey())
                        .withPropertyKey(legacyDataSource.getKey().replace(".", "-").replace(" ", "_"))
                        .putAdditionalProperty("query", legacyDataSource.getQuery())
                        .putAdditionalProperty("datasourceId", legacyDataSource.getDatasourceId())
                        .putAdditionalProperty(LEGACY_QUERY_DATA_SOURCE_KEY, "true").build();
                }
            })
            .collect(Collectors.toList());

    }

    public static List<ImportProperty> buildCatalogDatasourceAssignmentProperties(FeedMetadata metadata, Set<String> availableDatasources){

        if(metadata.getDataTransformation().getCatalogDataSourceIds() != null && !metadata.getDataTransformation().getCatalogDataSourceIds().isEmpty()){

         return   metadata.getDataTransformation().getCatalogDataSourceIds().stream().filter(id -> availableDatasources == null || !availableDatasources.contains(id)).map(id -> {
                return ImportPropertyBuilder.anImportProperty()
                    .withComponentName("Catalog Source")
                    .withDisplayName( metadata.getDataTransformation().getSql())
                    .withComponentId(id)
                    .withPropertyKey(id.replace(".", "-").replace(" ", "_"))
                    .putAdditionalProperty("datasourceId", id)
                    .putAdditionalProperty("query", metadata.getDataTransformation().getSql())
                    .putAdditionalProperty(CATALOG_DATASOURCE_KEY, "true").build();
            }).collect(Collectors.toList());

        }
        else {
            return Collections.emptyList();
        }

    }

}


text:
Examples below assume that you have setup `redux-observable` middleware so that firebase is available within your epics. View the [setup section of recipes for epics](/recipes/epics).

### redux-form Input
Debounce writing of info that is typed to a ref on Firebase (useful for syncing changes typed into redux-form inputs).

```javascript
import firebase from 'firebase/app'
import 'firebase/database'
import { actionTypes } from 'redux-form';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/debounceTime';

// Watch for redux-form change events
const change = action$ => action$.ofType(actionTypes.CHANGE).debounceTime(200);
// When form fields are blurred (useful for persisting changes added by extensions and auto-fillers)
const blur = action$ => action$.ofType(actionTypes.BLUR);
// Combine form input streams
const formInput = actionStreams$ => Observable.merge(...actionStreams$);

const firebaseSet$ = (path, payload) =>
  Observable.fromPromise(firebase.database().ref(path).set(payload));

export const reduxFormFieldChangeEpic = (action$, { getState, dispatch }) =>
  // create a stream of formInput actions, listen to change and blur events
  formInput([change(action$), blur(action$)])
    .do(({ meta }) => { // create a side-effect for dispatching action before update
      dispatch({
        type: 'FORM_FIELD_UPDATING',
        payload: { meta },
      }); // dispatch updating action
    })
    .switchMap((action) => { // switch the stream to a stream that returns a different stream
      const { meta, payload } = action;
      const path = 'some/path'

      // make call to update firebase
      return firebaseSet$(path, payload)
       // map each promise to an action that indicates the update complete
        .mapTo(({
          type: 'FORM_FIELD_UPDATED',
          payload,
          meta: { path, ...meta },
        }));
    });
```

### redux-form Array
Writing of info that is changed in a redux-form array to firebase.

```js
import firebase from 'firebase/app'
import 'firebase/database'
import { actionTypes } from 'redux-form';
import { get } from 'lodash';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/mergeMap';
import { actionTypes } from 'redux-form';
// When item is removed from redux-form array
const arrayRemove = action$ => action$.ofType(actionTypes.ARRAY_REMOVE);
// When item is pushed to redux-form array
const arrayPush = action$ => action$.ofType(actionTypes.ARRAY_PUSH);
// Combine form array action streams
const formArrayAction = actionStream$ => Observable.merge(...actionStream$);

export function firebaseSet$(path, payload) {
  return Observable.fromPromise(firebase.database().ref(path).set(payload));
}

export function reduxFormArrayEpic(action$, { getState }) {
  // create a stream of formArray actions, listen to add and remove events
  return formArrayAction([arrayRemove(action$), arrayPush(action$)])
  // map arrayActions to an Observable which is merged in the output Observable of promises
    .mergeMap((action) => {
      const { form } = getState();
      const { meta, meta: { field } } = action;
      const payload = get(form, `${meta.form}.values.${field}`, null);
      const path = 'some/path'

      // make call to update firebase
      return firebaseSet$(path, payload)
       // the action indicating the action was completed
        .mapTo(({
          type: 'FORM_ARRAY_CHANGE',
          payload: meta,
        }));
    });
}
```


text:
"""
Tests encoding functionality during parsing
for all of the parsers defined in parsers.py
"""

from io import BytesIO
import os
import tempfile

import numpy as np
import pytest

from pandas import DataFrame
import pandas._testing as tm

def test_bytes_io_input(all_parsers):
    encoding = "cp1255"
    parser = all_parsers

    data = BytesIO("שלום:1234\n562:123".encode(encoding))
    result = parser.read_csv(data, sep=":", encoding=encoding)

    expected = DataFrame([[562, 123]], columns=["שלום", "1234"])
    tm.assert_frame_equal(result, expected)

def test_read_csv_unicode(all_parsers):
    parser = all_parsers
    data = BytesIO("\u0141aski, Jan;1".encode("utf-8"))

    result = parser.read_csv(data, sep=";", encoding="utf-8", header=None)
    expected = DataFrame([["\u0141aski, Jan", 1]])
    tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize("sep", [",", "\t"])
@pytest.mark.parametrize("encoding", ["utf-16", "utf-16le", "utf-16be"])
def test_utf16_bom_skiprows(all_parsers, sep, encoding):
    # see gh-2298
    parser = all_parsers
    data = """skip this
skip this too
A,B,C
1,2,3
4,5,6""".replace(
        ",", sep
    )
    path = f"__{tm.rands(10)}__.csv"
    kwargs = dict(sep=sep, skiprows=2)
    utf8 = "utf-8"

    with tm.ensure_clean(path) as path:
        from io import TextIOWrapper

        bytes_data = data.encode(encoding)

        with open(path, "wb") as f:
            f.write(bytes_data)

        bytes_buffer = BytesIO(data.encode(utf8))
        bytes_buffer = TextIOWrapper(bytes_buffer, encoding=utf8)

        result = parser.read_csv(path, encoding=encoding, **kwargs)
        expected = parser.read_csv(bytes_buffer, encoding=utf8, **kwargs)

        bytes_buffer.close()
        tm.assert_frame_equal(result, expected)

def test_utf16_example(all_parsers, csv_dir_path):
    path = os.path.join(csv_dir_path, "utf16_ex.txt")
    parser = all_parsers
    result = parser.read_csv(path, encoding="utf-16", sep="\t")
    assert len(result) == 50

def test_unicode_encoding(all_parsers, csv_dir_path):
    path = os.path.join(csv_dir_path, "unicode_series.csv")
    parser = all_parsers

    result = parser.read_csv(path, header=None, encoding="latin-1")
    result = result.set_index(0)
    got = result[1][1632]

    expected = "\xc1 k\xf6ldum klaka (Cold Fever) (1994)"
    assert got == expected

@pytest.mark.parametrize(
    "data,kwargs,expected",
    [
        # Basic test
        ("a\n1", dict(), DataFrame({"a": [1]})),
        # "Regular" quoting
        ('"a"\n1', dict(quotechar='"'), DataFrame({"a": [1]})),
        # Test in a data row instead of header
        ("b\n1", dict(names=["a"]), DataFrame({"a": ["b", "1"]})),
        # Test in empty data row with skipping
        ("\n1", dict(names=["a"], skip_blank_lines=True), DataFrame({"a": [1]})),
        # Test in empty data row without skipping
        (
            "\n1",
            dict(names=["a"], skip_blank_lines=False),
            DataFrame({"a": [np.nan, 1]}),
        ),
    ],
)
def test_utf8_bom(all_parsers, data, kwargs, expected):
    # see gh-4793
    parser = all_parsers
    bom = "\ufeff"
    utf8 = "utf-8"

    def _encode_data_with_bom(_data):
        bom_data = (bom + _data).encode(utf8)
        return BytesIO(bom_data)

    result = parser.read_csv(_encode_data_with_bom(data), encoding=utf8, **kwargs)
    tm.assert_frame_equal(result, expected)

def test_read_csv_utf_aliases(all_parsers, utf_value, encoding_fmt):
    # see gh-13549
    expected = DataFrame({"mb_num": [4.8], "multibyte": ["test"]})
    parser = all_parsers

    encoding = encoding_fmt.format(utf_value)
    data = "mb_num,multibyte\n4.8,test".encode(encoding)

    result = parser.read_csv(BytesIO(data), encoding=encoding)
    tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize(
    "fname,encoding",
    [
        ("test1.csv", "utf-8"),
        ("unicode_series.csv", "latin-1"),
        ("sauron.SHIFT_JIS.csv", "shiftjis"),
    ],
)
def test_binary_mode_file_buffers(all_parsers, csv_dir_path, fname, encoding):
    # gh-23779: Python csv engine shouldn't error on files opened in binary.
    # gh-31575: Python csv engine shouldn't error on files opened in raw binary.
    parser = all_parsers

    fpath = os.path.join(csv_dir_path, fname)
    expected = parser.read_csv(fpath, encoding=encoding)

    with open(fpath, mode="r", encoding=encoding) as fa:
        result = parser.read_csv(fa)
    tm.assert_frame_equal(expected, result)

    with open(fpath, mode="rb") as fb:
        result = parser.read_csv(fb, encoding=encoding)
    tm.assert_frame_equal(expected, result)

    with open(fpath, mode="rb", buffering=0) as fb:
        result = parser.read_csv(fb, encoding=encoding)
    tm.assert_frame_equal(expected, result)

@pytest.mark.parametrize("pass_encoding", [True, False])
def test_encoding_temp_file(all_parsers, utf_value, encoding_fmt, pass_encoding):
    # see gh-24130
    parser = all_parsers
    encoding = encoding_fmt.format(utf_value)

    expected = DataFrame({"foo": ["bar"]})

    with tm.ensure_clean(mode="w+", encoding=encoding, return_filelike=True) as f:
        f.write("foo\nbar")
        f.seek(0)

        result = parser.read_csv(f, encoding=encoding if pass_encoding else None)
        tm.assert_frame_equal(result, expected)

def test_encoding_named_temp_file(all_parsers):
    # see gh-31819
    parser = all_parsers
    encoding = "shift-jis"

    if parser.engine == "python":
        pytest.skip("NamedTemporaryFile does not work with Python engine")

    title = "てすと"
    data = "こむ"

    expected = DataFrame({title: [data]})

    with tempfile.NamedTemporaryFile() as f:
        f.write(f"{title}\n{data}".encode(encoding))

        f.seek(0)

        result = parser.read_csv(f, encoding=encoding)
        tm.assert_frame_equal(result, expected)