text:
package imabradley.peach.factions.claim.provider;

import imabradley.peach.factions.claim.Claim;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;

import java.util.Queue;
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * The ClaimLoader class is responsible for loading claims
 * from their YamlConfiguration source file.
 *
 * @version 1.0
 * @author Bradley Steele
 */
public class ClaimLoader {

    private final Plugin plugin;
    private final Queue<ClaimFileContext> claimFileQueue = new ConcurrentLinkedQueue<>();
    private final ClaimLoadResultHandler resultHandler;

    private volatile boolean loading = false;

    /**
     * @param plugin plugin which the loader belongs to.
     */
    public ClaimLoader(Plugin plugin, ClaimLoadResultHandler resultHandler) {
        this.plugin = plugin;
        this.resultHandler = resultHandler;
    }

    /**
     * @param context the file context to be added to the queue.
     */
    public void loadAsync(ClaimFileContext context) {
        claimFileQueue.add(context);

        if (!loading) {
            loadNextAsync();
        }
    }

    /**
     * Asynchronously loads {@link imabradley.peach.factions.claim.Claim}'s
     * from a YamlConfiguration file source. If the claim file contains
     * invalid data it will not be sent to the provider and the console
     * will be warned.
     * <p>
     * Note: Using Bukkit's Scheduler to run asynchronous tasks rather than
     * a separate thread.
     */
    private void loadNextAsync() {
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            ClaimFileContext context = claimFileQueue.poll();

            if (context != null) {
                loading = true;
                UUID uuid;

                try {
                     uuid = UUID.fromString(context.getConfig().getString("claim.uuid", null));
                } catch (IllegalArgumentException | NullPointerException e) {
                    uuid = UUID.randomUUID();
                }

                World world = Bukkit.getWorld(context.getConfig()
                        .getString("claim.world", Bukkit.getWorlds().get(0).getName()));

                int x1 = context.getConfig().getInteger("claim.x1", 0);
                int z1 = context.getConfig().getInteger("claim.z1", 0);
                int x2 = context.getConfig().getInteger("claim.x2", 0);
                int z2 = context.getConfig().getInteger("claim.z2", 0);

                if (x1 == 0 && z1 == 0 && x2 == 0 && z2 == 0) {
                    resultHandler.onClaimLoadFailure(context, "Invalid claim! All corners are 0 [ID: " +
                            uuid.toString() + "].");
                    loading = false;
                } else {
                    resultHandler.onClaimLoadSuccess(new Claim(uuid, world, x1, z1, x2, z2));
                }

                // Load the next claim whether this was a success/failure.
                loadNextAsync();
            } else {
                loading = false;
            }
        });
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--

-->
<android.support.v7.internal.widget.ActionBarContextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:theme="?attr/actionBarTheme"
        style="?attr/actionModeStyle"/>
<!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/layout/abc_action_mode_bar.xml --><!-- From: file:/C:/Users/Cata/AndroidStudioProjects/Componente1_localizacion/Application/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/layout/abc_action_mode_bar.xml -->

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * @namespace
 */
namespace Zend\Locale\Data;

use Zend\Locale\Locale as ZFLocale;

/**
 * Locale data provider, handles INTL
 *
 * @category   Zend
 * @package    Zend_Locale
 * @subpackage Data
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Intl extends AbstractLocale
{
    /**
     * Returns detailed informations from the language table
     * If no detail is given a complete table is returned
     *
     * @param string  $locale Normalized locale
     * @param boolean $invert Invert output of the data
     * @param string|array $detail Detail to return information for
     * @return array
     */
    public static function getDisplayLanguage($locale, $invert = false, $detail = null)
    {
        if ($detail !== null) {
            return Locale::getDisplayLanguage($locale);
        } else {
            $list = ZFLocale::getLocaleList();
            foreach($list as $key => $value) {
                $list[$key] = Locale::getDisplayLanguage($key);
            }

            if ($invert) {
                array_flip($list);
            }

            return $list;
        }
    }

    /**
     * Returns detailed informations from the script table
     * If no detail is given a complete table is returned
     *
     * @param string  $locale Normalized locale
     * @param boolean $invert Invert output of the data
     * @param string|array $detail Detail to return information for
     * @return array
     */
    public static function getDisplayScript($locale, $invert = false, $detail = null)
    {
        if ($detail !== null) {
            return Locale::getDisplayScript($locale);
        } else {
            $list = ZFLocale::getLocaleList();
            foreach($list as $key => $value) {
                $list[$key] = Locale::getDisplayScript($key);
            }

            if ($invert) {
                array_flip($list);
            }

            return $list;
        }
    }

    /**
     * Returns detailed informations from the territory table
     * If no detail is given a complete table is returned
     *
     * @param string  $locale Normalized locale
     * @param boolean $invert Invert output of the data
     * @param string|array $detail Detail to return information for
     * @return array
     */
    public static function getDisplayTerritory($locale, $invert = false, $detail = null)
    {
        if ($detail !== null) {
            return Locale::getDisplayRegion($locale);
        } else {
            $list = ZFLocale::getLocaleList();
            foreach($list as $key => $value) {
                $list[$key] = Locale::getDisplayRegion($key);
            }

            if ($invert) {
                array_flip($list);
            }

            return $list;
        }
    }

    /**
     * Returns detailed informations from the variant table
     * If no detail is given a complete table is returned
     *
     * @param string  $locale Normalized locale
     * @param boolean $invert Invert output of the data
     * @param string|array $detail Detail to return information for
     * @return array
     */
    public static function getDisplayVariant($locale, $invert = false, $detail = null)
    {
        if ($detail !== null) {
            return Locale::getDisplayVariant($locale);
        } else {
            $list = ZFLocale::getLocaleList();
            foreach($list as $key => $value) {
                $list[$key] = Locale::getDisplayVariant($key);
            }

            if ($invert) {
                array_flip($list);
            }

            return $list;
        }
    }
}


text:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('blog-list', 'Integration | Component | blog list', {
  integration: true
});

test('it renders', function(assert) {
  assert.expect(2);

  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{blog-list}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#blog-list}}
      template block text
    {{/blog-list}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Monitor.Management.Models;
using System;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Insights.Autoscale
{
    /// <summary>
    /// Create an AutoscaleNotification
    /// </summary>
    [Cmdlet(VerbsCommon.New, "AzureRmAutoscaleNotification"), OutputType(typeof(AutoscaleNotification))]
    public class NewAzureRmAutoscaleNotificationCommand : MonitorCmdletBase
    {
        private const string Operation = "Scale";

        /// <summary>
        /// Gets or sets the CustomEmails list of the action. A comma-separated list of e-mail addresses
        /// </summary>
        [Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The list of comma-separated webhooks")]
        [Alias("Webhooks")]
        public WebhookNotification[] Webhook { get; set; }

        /// <summary>
        /// Gets or sets the CustomEmails list of the action. A comma-separated list of e-mail addresses
        /// </summary>
        [Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The list of custom e-mails")]
        [ValidateNotNullOrEmpty]
        [Alias("CustomEmails")]
        public string[] CustomEmail { get; set; }

        /// <summary>
        /// Gets or sets the send e-mail to subscription administrator flag
        /// </summary>
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The send e-mail to subscription administrator flag")]
        public SwitchParameter SendEmailToSubscriptionAdministrator { get; set; }

        /// <summary>
        /// Gets or sets the send e-mail to subscription coadministrators flag
        /// </summary>
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The send e-mail to subscription coadministrators flag")]
        [Alias("SendEmailToSubscriptionCoAdministrators")]
        public SwitchParameter SendEmailToSubscriptionCoAdministrator { get; set; }

        /// <summary>
        /// Executes the Cmdlet. This is a callback function to simplify the exception handling
        /// </summary>
        protected override void ProcessRecordInternal()
        { }

        /// <summary>
        /// Execute the cmdlet
        /// </summary>
        public override void ExecuteCmdlet()
        {
            this.WriteIdentifiedWarning(
                cmdletName: "New-AzureRmAutoscaleNotification",
                topic: "Parameter name change",
                message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
            if (!(this.SendEmailToSubscriptionAdministrator || this.SendEmailToSubscriptionCoAdministrator) &&
                ((this.Webhook == null || this.Webhook.Length < 1) && (this.CustomEmail == null || this.CustomEmail.Length < 1)))
            {
                throw new ArgumentException("At least one Webhook or one CustomeEmail must be present, or the notification must be sent to the admin or co-admin");
            }

            var emailNotification = new EmailNotification
            {
                CustomEmails = this.CustomEmail,
                SendToSubscriptionAdministrator = this.SendEmailToSubscriptionAdministrator,
                SendToSubscriptionCoAdministrators = this.SendEmailToSubscriptionCoAdministrator,
            };

            var notification = new AutoscaleNotification
            {
                Email = emailNotification,
                Webhooks = this.Webhook
            };

            WriteObject(notification);
        }
    }
}


text:
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Salir extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('session');
    }

    public function close() {
        $this->session->sess_destroy();
        redirect('', 'refresh');
    }

     public function perfil() {
     $nombrez = $this->session->userdata('nombre') . ' ' . $this->session->userdata('apellidos');
     $datax['nombre'] = $nombrez;
     $datax['puesto'] = $this->session->userdata('puesto');

     $data['nombre'] = $nombrez;
     $data['idcapturista'] = $this->session->userdata('idempleado');
     $data['nombre'] = $this->session->userdata('nombre');
     $data['apellidos'] = $this->session->userdata('apellidos');
     $data['email'] = $this->session->userdata('email');
     $data['password'] = $this->session->userdata('password');
     $data['sigla'] = $this->session->userdata('sigla');
     $data['menu'] = $this->load->view('plantilla/menu', $datax, true);
     $this->load->view('admin/perfil', $data);
 }

    public function actualizarperfil() {
       $idempleado = $this->input->post('idempleado');
       $nombre= $this->input->post('nombre');
       $apellidos = $this->input->post('apellidos');
       $email = $this->input->post('email');
       $password = $this->input->post('password');
       $sigla = $this->input->post('sigla');

       $mensaje="";

       $this->load->model('models_usuario');
       $data = array(
        'nombre' =>  $nombre,
        'apellidos' =>  $apellidos,
        'email' =>  $email,
        'password' =>  $password,
        'sigla' =>  $sigla,
        'nombre' =>  $nombre);

       $valor = $this->models_usuario->update($idempleado, $data);

       $this->session->sess_destroy();
       redirect('', 'refresh');

   }

}


text:
package io.cdap.plugin.repartitioner;

import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.cdap.api.data.format.StructuredRecord;
import io.cdap.cdap.etl.api.FailureCollector;
import io.cdap.cdap.etl.api.PipelineConfigurer;
import io.cdap.cdap.etl.api.batch.SparkCompute;
import io.cdap.cdap.etl.api.batch.SparkExecutionPluginContext;
import org.apache.spark.api.java.JavaRDD;

/**
 * Repartitioner Spark Compute Plugin.
 */
@Plugin(type = SparkCompute.PLUGIN_TYPE)
@Name(Repartitioner.PLUGIN_NAME)
@Description("Repartitions data in order to change the maximum level of parallelism")
public class Repartitioner extends SparkCompute<StructuredRecord, StructuredRecord> {

  public static final String PLUGIN_NAME = "Repartitioner";
  private RepartitionerConfig config;

  public Repartitioner(RepartitionerConfig config) {
    this.config = config;
  }

  @Override
  public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException {
    super.configurePipeline(pipelineConfigurer);
    FailureCollector failureCollector = pipelineConfigurer.getStageConfigurer().getFailureCollector();
    config.validate(failureCollector);
  }

  @Override
  public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context,
                                             JavaRDD<StructuredRecord> input) {
    FailureCollector failureCollector = context.getFailureCollector();
    config.validate(failureCollector);
    failureCollector.getOrThrowException();

    return input.coalesce(config.getPartitions(), config.getShuffle());
  }
}


text:
dhmap
=====

HTML5/JS library for drawing and updating network layouts

# Try it

    cd src/
    python -m SimpleHTTPServer

Go to `http://localhost:8000/examples/`


text:
@implementation THPlayheadView

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self setupView];
    }
    return self;
}

- (void)setupView {
    self.backgroundColor = [UIColor clearColor];
    self.userInteractionEnabled = NO;
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(clearPlayhead:)
                                                 name:AVPlayerItemDidPlayToEndTimeNotification
                                               object:nil];
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)clearPlayhead:(NSNotification *)notification {
    [self reset];
}

- (void)reset {
    self.layer.sublayers = nil;
}

- (void)synchronizeWithPlayerItem:(AVPlayerItem *)playerItem {

    // Remove existing sublayers
    [self reset];

    // ----- Configure Red Line -----

    // Red line is 4 pts wide
    CGRect lineRect = CGRectMake(0.0f, 0.0f, 4.0f, self.layer.bounds.size.height);

    CAShapeLayer *redlineLayer = [CAShapeLayer layer];
    redlineLayer.path = [UIBezierPath bezierPathWithRect:lineRect].CGPath;
    redlineLayer.frame = lineRect;
    redlineLayer.fillColor = [[UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.4f] CGColor];

    // ----- Configure White Line -----

    // White line is 1 pt wide
    lineRect.origin.x = 0;
    lineRect.size.width = 1;

    // Position the white line layer of the timeMarker at the center of the red band layer
    CAShapeLayer *whitelineLayer = [CAShapeLayer layer];
    whitelineLayer.path = [UIBezierPath bezierPathWithRect:lineRect].CGPath;
    whitelineLayer.frame = lineRect;
    whitelineLayer.position = CGPointMake(2.0f, self.bounds.size.height / 2.0f);
    whitelineLayer.fillColor = [UIColor whiteColor].CGColor;

    // Add the white line layer to red line layer
    [redlineLayer addSublayer:whitelineLayer];

    // Configure basic animation to animate the x position of the playhead
    CABasicAnimation *playheadAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
    playheadAnimation.fromValue = [self xPositionForTime:kCMTimeZero];
    playheadAnimation.toValue = [self xPositionForTime:playerItem.duration];
    playheadAnimation.removedOnCompletion = NO;
    playheadAnimation.beginTime = AVCoreAnimationBeginTimeAtZero;
    playheadAnimation.duration = CMTimeGetSeconds(playerItem.duration);
    playheadAnimation.fillMode = kCAFillModeBoth;
    [redlineLayer addAnimation:playheadAnimation forKey:nil];

    // Create AVSynchronizedLayer to synchronize with player's timing
    AVSynchronizedLayer *syncLayer = [AVSynchronizedLayer synchronizedLayerWithPlayerItem:playerItem];
    [syncLayer addSublayer:redlineLayer];

    [self.layer addSublayer:syncLayer];

    // Trigger redraw to update UI
    [self.layer setNeedsDisplay];
}

- (NSNumber *)xPositionForTime:(CMTime)time {
    CGPoint position = THGetOriginForTime(time);
    return @(position.x + X_OFFSET);
}

@end


text:
IntrinsicEdManagerWindowMaterial::IntrinsicEdManagerWindowMaterial(
    QWidget* parent)
    : IntrinsicEdManagerWindowBase(parent)
{
  setWindowTitle("Materials");
  _propertyCompilerEntry =
      Application::_resourcePropertyCompilerMapping[_N(Material)];
  _resourceManagerEntry = Application::_resourceManagerMapping[_N(Material)];
  _resourceIcon = QIcon(":/Icons/brush");
  _managerFilePath = "managers/Material.manager.json";
  _resourceName = "Material";

  QObject::connect(this, SIGNAL(resourceTreePopulated()), this,
                   SLOT(onResourceTreePopulated()));

  onPopulateResourceTree();
}

void IntrinsicEdManagerWindowMaterial::onResourceTreePopulated() {}


text:
package os

import (
	"errors"
	"runtime"
	"syscall"
	"time"
)

// The only signal values guaranteed to be present on all systems
// are Interrupt (send the process an interrupt) and Kill (force
// the process to exit).
var (
	Interrupt Signal = syscall.Note("interrupt")
	Kill      Signal = syscall.Note("kill")
)

func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) {
	sysattr := &syscall.ProcAttr{
		Dir: attr.Dir,
		Env: attr.Env,
		Sys: attr.Sys,
	}

	for _, f := range attr.Files {
		sysattr.Files = append(sysattr.Files, f.Fd())
	}

	pid, h, e := syscall.StartProcess(name, argv, sysattr)
	if e != nil {
		return nil, &PathError{"fork/exec", name, e}
	}

	return newProcess(pid, h), nil
}

func (p *Process) writeProcFile(file string, data string) error {
	f, e := OpenFile("/proc/"+itoa(p.Pid)+"/"+file, O_WRONLY, 0)
	if e != nil {
		return e
	}
	defer f.Close()
	_, e = f.Write([]byte(data))
	return e
}

func (p *Process) signal(sig Signal) error {
	if p.done() {
		return errors.New("os: process already finished")
	}
	if sig == Kill {
		// Special-case the kill signal since it doesn't use /proc/$pid/note.
		return p.Kill()
	}
	if e := p.writeProcFile("note", sig.String()); e != nil {
		return NewSyscallError("signal", e)
	}
	return nil
}

func (p *Process) kill() error {
	if e := p.writeProcFile("ctl", "kill"); e != nil {
		return NewSyscallError("kill", e)
	}
	return nil
}

func (p *Process) wait() (ps *ProcessState, err error) {
	var waitmsg syscall.Waitmsg

	if p.Pid == -1 {
		return nil, ErrInvalid
	}

	for true {
		err = syscall.Await(&waitmsg)

		if err != nil {
			return nil, NewSyscallError("wait", err)
		}

		if waitmsg.Pid == p.Pid {
			p.setDone()
			break
		}
	}

	ps = &ProcessState{
		pid:    waitmsg.Pid,
		status: &waitmsg,
	}
	return ps, nil
}

func (p *Process) release() error {
	// NOOP for Plan 9.
	p.Pid = -1
	// no need for a finalizer anymore
	runtime.SetFinalizer(p, nil)
	return nil
}

func findProcess(pid int) (p *Process, err error) {
	// NOOP for Plan 9.
	return newProcess(pid, 0), nil
}

// ProcessState stores information about a process, as reported by Wait.
type ProcessState struct {
	pid    int              // The process's id.
	status *syscall.Waitmsg // System-dependent status info.
}

// Pid returns the process id of the exited process.
func (p *ProcessState) Pid() int {
	return p.pid
}

func (p *ProcessState) exited() bool {
	return p.status.Exited()
}

func (p *ProcessState) success() bool {
	return p.status.ExitStatus() == 0
}

func (p *ProcessState) sys() interface{} {
	return p.status
}

func (p *ProcessState) sysUsage() interface{} {
	return p.status
}

func (p *ProcessState) userTime() time.Duration {
	return time.Duration(p.status.Time[0]) * time.Millisecond
}

func (p *ProcessState) systemTime() time.Duration {
	return time.Duration(p.status.Time[1]) * time.Millisecond
}

func (p *ProcessState) String() string {
	if p == nil {
		return "<nil>"
	}
	return "exit status: " + p.status.Msg
}


text:
package me.tsukanov.counter.view;

import android.content.Context;
import androidx.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import me.tsukanov.counter.R;
import me.tsukanov.counter.domain.Counter;

class CountersListAdapter extends ArrayAdapter<Counter> {

  private static final String TAG = CountersListAdapter.class.getSimpleName();

  CountersListAdapter(Context context) {
    super(context, 0);
  }

  @NonNull
  public View getView(int position, View convertView, @NonNull ViewGroup parent) {
    if (convertView == null) {
      convertView = LayoutInflater.from(getContext()).inflate(R.layout.menu_row, null);
    }
    final TextView titleView = convertView.findViewById(R.id.row_title);
    final TextView countView = convertView.findViewById(R.id.row_count);

    final Counter counter = getItem(position);
    if (counter != null) {
      titleView.setText(counter.getName());
      countView.setText(counter.getValue().toString());
    } else {
      Log.v(TAG, String.format("Failed to get item in position %s", position));
      titleView.setText("???");
      countView.setText("???");
    }

    return convertView;
  }
}


text:
<query id="insertTrash" action="insert">
    <tables>
        <table name="trash" />
    </tables>
    <columns>
        <column name="trash_srl" var="trashSrl" filter="number" notnull="notnull" />
        <column name="title" var="title" notnull="notnull" />
        <column name="origin_module" var="originModule" notnull="notnull" default="document" />
        <column name="serialized_object" var="serializedObject" />
        <column name="description" var="description" />
        <column name="ipaddress" var="ipaddress" default="ipaddress()" />
        <column name="remover_srl" var="removerSrl" default="0" filter="number" />
        <column name="regdate" var="regdate" default="curdate()" />
    </columns>
</query>