text:
function err(text){
  console.log('\x1b[31mERR! \x1b[39m '+text);
}
function warning(text){
  console.log('\x1b[33mOOPS \x1b[39m '+text);
}
function success(text){
  console.log('\x1b[32mSUCCESS \x1b[39m '+text);
}

var msg = {
  apiServerStarted :function(port){
    success('server is running on port ' + port);
  },
  apiServerStopped :function(port){
    success('server is running on ' + port +' successfully stopped');
  },
  portNaN : function(port){
    err(port + ' is not a number, try something like 5000 or give 0 to choose landom port');
  },
  portNotDefined : function(){
    err('Could not find port number. try something like 5000 or give 0 to choose landom port');
  },
  portAlreadyUsed : function(port){
    err(port + ' is alreay used by other service, try other numbers');
  },
  apiAlreadyRunning: function(port){
    err('server is alreay running in port ' + port);
  },
  dataFieldNotSpecified: function(path){
    warning('Could not find "data" field for your '+path+' api setting ');
  },
  pathFieldNotSpecified: function(index){
    warning('could not find "path" field in your request '+index);
  },
  templateNotSpecified: function(name){
    warning('Could not find '+name+' template ');
  },
  stubTypeNotFound: function(name){
    warning('Could not find '+name+' type ');
  },
  noTemplateType: function(template, type, types){
    warning('Template ' + template + ' has no type ' + type + ' try '+types.join(' or '))
  },
  notEnoughChoice: function(type, list){
    err('run out of unique choice for '+type+' operation. please give enough elements for '+list)
  },
  notParseableDatetime: function(key, value){
    err('could not parse '+key+' ('+value+') please use JavaScript Date Object parseable string')
  },
  missingSettings: function(template, type, list){
    err(template+' ('+ type+') needs '+list.join(' and ')+'.')
  },
  generalError : function(errorMessage){
    err(errorMessage);
  }
};

module.exports = msg;


text:
package com.mateoi.money.io;

import com.mateoi.money.model.*;
import org.javamoney.moneta.Money;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Singleton class used for parsing a main state and loading it.
 */
public class MainStateParser {
    private static final MainStateParser instance = new MainStateParser();

    // Private constructor to prevent instantiation
    private MainStateParser() {
        // Empty
    }

    /**
     * Get the singleton instance of this class
     *
     * @return The instance of this class
     */
    public static MainStateParser getInstance() {
        return instance;
    }

    /**
     * Parses a main state from a list of lines, then initializes the program state.
     *
     * @param lines The lines to parse
     */
    public void parseIntoMainState(List<String> lines) {
        List<Account> accounts = cleanLines(lines, FilePrefixes.ACCOUNT_PREFIX).map(this::parseAccount).collect(Collectors.toList());
        List<BudgetItem> budgets = cleanLines(lines, FilePrefixes.BUDGET_PREFIX).map(this::parseBudgetItem).collect(Collectors.toList());
        List<SavingsItem> savings = cleanLines(lines, FilePrefixes.SAVINGS_PREFIX).map(s -> parseSavingsItem(s, accounts)).collect(Collectors.toList());
        List<Transaction> transactions = cleanLines(lines, FilePrefixes.TRANSACTION_PREFIX).map(s -> parseTransaction(s, budgets)).collect(Collectors.toList());
        List<SubTransaction> subTransactions = cleanLines(lines, FilePrefixes.SUBTRANSACTION_PREFIX).map(s -> parseSubTransaction(s, accounts, transactions)).collect(Collectors.toList());

        MainState.getInstance().initialize(transactions, accounts, budgets, savings, subTransactions);
    }

    /**
     * Creates a stream of the given lines consisting only of those lines that start with the given prefix,
     * but with the prefix removed.
     *
     * @param lines  The lines to clean
     * @param prefix The prefix to remove
     * @return Those lines which begin with prefix, with that prefix removed
     */
    private Stream<String> cleanLines(List<String> lines, String prefix) {
        return lines.stream().filter(s -> s.startsWith(prefix)).map(s -> s.substring(prefix.length()));
    }

    /**
     * Parses an account from a format that should match Account's toString() function.
     *
     * @param s The string to parse
     * @return An Account object encoded by this string, without Transaction information, or null if the string isn't
     * formatted properly
     */
    private Account parseAccount(String s) {
        String[] parts = s.trim().split(";");
        if (parts.length == 5) {
            int id;
            try {
                id = Integer.parseInt(parts[0]);
            } catch (NumberFormatException n) {
                return null;
            }
            String name = parts[1];
            Money starting = Money.parse(parts[2]);
            float interest;
            try {
                interest = Float.parseFloat(parts[3]);
            } catch (NumberFormatException n) {
                return null;
            }
            Money warning = Money.parse(parts[4]);
            return new Account(id, name, starting, warning, interest);
        }
        return null;
    }

    /**
     * Parses a {@link BudgetItem} from a format that should match BudgetItem's toString() function.
     *
     * @param s The string to parse
     * @return A BudgetItem object encoded by this string, without Transaction information, or null if the string isn't
     * formatted properly
     */
    private BudgetItem parseBudgetItem(String s) {
        String[] parts = s.trim().split(";");
        if (parts.length == 5) {
            int id;
            try {
                id = Integer.parseInt(parts[0]);
            } catch (NumberFormatException n) {
                return null;
            }
            boolean in = Boolean.parseBoolean(parts[1]);
            String name = parts[2];
            Money amount = Money.parse(parts[3]);
            boolean essential = Boolean.parseBoolean(parts[4]);
            return new BudgetItem(id, in, name, amount, essential);
        }
        return null;
    }

    /**
     * Parses a {@link SavingsItem} from a format that should match SavingsItem's toString() function.
     *
     * @param s The string to parse
     * @return A SavingsItem object encoded by this string, without Transaction information, or null if the string isn't
     * formatted properly
     */
    private SavingsItem parseSavingsItem(String s, List<Account> accounts) {
        String[] parts = s.trim().split(";");
        if (parts.length == 6) {
            int id;
            try {
                id = Integer.parseInt(parts[0]);
            } catch (NumberFormatException n) {
                return null;
            }
            String name = parts[1];
            Money goal = Money.parse(parts[2]);
            Money currentAmount = Money.parse(parts[3]);
            int account_id;
            try {
                account_id = Integer.parseInt(parts[4]);
            } catch (NumberFormatException n) {
                return null;
            }
            float allocation;
            try {
                allocation = Float.parseFloat(parts[5]);
            } catch (NumberFormatException n) {
                return null;
            }
            Account account = getAccount(account_id, accounts);
            return new SavingsItem(id, name, goal, currentAmount, account, allocation);

        }
        return null;
    }

    /**
     * Parses a {@link Transaction} from a format that should match Transaction's toString() function.
     *
     * @param s The string to parse
     * @return A Transaction object encoded by this string, or null if the string isn't
     * formatted properly
     */
    private Transaction parseTransaction(String s, List<BudgetItem> budgets) {
        String[] parts = s.trim().split(";");
        if (parts.length == 5) {
            int id;
            try {
                id = Integer.parseInt(parts[0]);
            } catch (NumberFormatException n) {
                return null;
            }
            LocalDate date;
            try {
                date = LocalDate.parse(parts[1], DateTimeFormatter.ISO_DATE);
            } catch (DateTimeParseException e) {
                System.out.println("Couldn't parse " + parts[1]);
                return null;
            }
            String description = parts[2];
            int budget_id;
            try {
                budget_id = Integer.parseInt(parts[3]);
            } catch (NumberFormatException n) {
                return null;
            }

            BudgetItem budgetItem = getBudgetItem(budget_id, budgets);
            boolean included = Boolean.parseBoolean(parts[4]);
            return new Transaction(id, date, description, budgetItem, included);
        }
        return null;
    }

    /**
     * Parses a {@link SubTransaction} from a format that should match SubTransaction's toString() function.
     *
     * @param s The string to parse
     * @return A SubTransaction object encoded by this string, or null if the string isn't
     * formatted properly
     */
    private SubTransaction parseSubTransaction(String s, List<Account> accounts, List<Transaction> transactions) {
        String[] parts = s.trim().split(";");
        if (parts.length == 4) {
            int id;
            try {
                id = Integer.parseInt(parts[0]);
            } catch (NumberFormatException n) {
                return null;
            }
            int transactionId;
            try {
                transactionId = Integer.parseInt(parts[1]);
            } catch (NumberFormatException n) {
                return null;
            }
            int accountId;
            try {
                accountId = Integer.parseInt(parts[2]);
            } catch (NumberFormatException n) {
                return null;
            }
            Money amount = Money.parse(parts[3]);
            Transaction transaction = getTransaction(transactionId, transactions);
            Account account = getAccount(accountId, accounts);
            return new SubTransaction(id, account, amount, transaction);
        }
        return null;
    }

    /**
     * Get the account with the given ID from the list of accounts, or {@link MainState#UNKNOWN_ACCOUNT} if not found.
     *
     * @param account_id ID of the account to fetch
     * @param accounts   List of accounts to search in
     * @return The account with the given ID, or UNKNOWN_ACCOUNT if not found
     */
    private Account getAccount(int account_id, List<Account> accounts) {
        return accounts.stream().filter(a -> a.getId() == account_id).findFirst().orElse(MainState.UNKNOWN_ACCOUNT);
    }

    /**
     * Get the budget with the given ID from the list of budgets, or {@link MainState#UNKNOWN_BUDGET} if not found.
     *
     * @param budget_id ID of the budget to fetch
     * @param budgets   List of budgets to search in
     * @return The budget with the given ID, or UNKNOWN_BUDGET if not found
     */
    private BudgetItem getBudgetItem(int budget_id, List<BudgetItem> budgets) {
        return budgets.stream().filter(b -> b.getId() == budget_id).findFirst().orElse(MainState.UNKNOWN_BUDGET);
    }

    /**
     * Get the transaction with the given ID from the list of transactions, or {@link MainState#UNKNOWN_TRANSACTION} if not found.
     *
     * @param transactionId ID of the transaction to fetch
     * @param transactions  List of transactions to search in
     * @return The transaction with the given ID, or the default transaction if not found
     */
    private Transaction getTransaction(int transactionId, List<Transaction> transactions) {
        return transactions.stream().filter(t -> t.getId() == transactionId).findFirst().orElse(MainState.UNKNOWN_TRANSACTION);
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
namespace falkonry_csharp_client.helper.models
{

    public class Interval
    {
        public string field
        {
            get;
            set;

        }
        public string duration
        {
            get;
            set;

        }
    }
}


text:
package com.google.android.apps.work.kerberosauthenticator;

import static com.google.android.apps.work.kerberosauthenticator.Constants.TAG;

import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.google.android.apps.work.kerberosauthenticator.internal.KerberosAccountDetails;
import com.google.android.apps.work.kerberosauthenticator.internal.TicketGrantingTicket;
import com.google.android.apps.work.kerberosauthenticator.internal.TicketRequestResult;
import com.google.android.apps.work.kerberosauthenticator.internal.kinit.UserAuthenticationResultListener;
import com.google.android.apps.work.kerberosauthenticator.internal.kinit.UserAuthenticationTask;
import javax.security.auth.Subject;

/** Obtains a ticket granting ticket for the user, while displaying authentication status and
 * details on the most recently issued tickets.
 * If the user launches the Kerberos authenticator via the launcher manually, this activity will
 * only show status.
 */
public class LoginActivity extends BaseAuthenticatorActivity implements
    UserAuthenticationResultListener {

  boolean isPasswordRetry = false;

  /** Returns an intent that can be used to authenticate an account. */
  public static Intent getAuthenticateIntent(
      Context context, AccountAuthenticatorResponse response) {
    return getAuthenticateIntent(context, response, null);
  }

  /** Returns an intent that can be used to authenticate an account. */
  public static Intent getAuthenticateIntent(
      Context context, AccountAuthenticatorResponse response, String serviceName) {
    Intent intent = new Intent(context, LoginActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    if (serviceName != null) {
      intent.putExtra(Constants.SERVICE_NAME, serviceName);
    }
    return intent;
  }

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Let the user know an account cannot be added because managed config is missing.
    if (!accountConfiguration.hasManagedConfigs()) {
      startActivity(DeclineAddingAccountActivity.getDeclineIntentDueToConfigMissing(this, null));
      finish();
      return;
    }

    isPasswordRetry = false;

    setContentView(R.layout.authenticator);

    Intent intent = getIntent();
    String serviceName = intent.getStringExtra(Constants.SERVICE_NAME);
    boolean shouldAddAccount = TextUtils.isEmpty(serviceName);
    Log.d(
        Constants.TAG,
        String.format(
            "Starting login activity, service name? %s, add new account? %s.",
            serviceName, shouldAddAccount));

    // Initialise the UI with corresponding values.
    initUI(false /*isUserInitiated*/, serviceName);

    // Generate or renew a TGT. Do not attempt recovering from a bad password if we are in the
    // process of adding a new account.
    authenticateAccount(shouldAddAccount);

    // If only the status is shown, the activity remains open until the user taps the dismiss
    // button to finish it.
    Log.d(Constants.TAG, "Finished creating login activity.");
  }

  @Override
  public void onTicketGrantingTicketResult(
      TicketRequestResult ticketRequestResult, Subject ticket) {
    if (accountConfiguration.getDebugWithSensitiveData()) {
      Log.d(TAG, String.format("Result of attempt to authenticate user: %s , valid ticket? %s",
          ticketRequestResult, ticket != null));
    }
    Bundle result = new Bundle();
    KerberosAccount account = KerberosAccount.getAccount(this);
    boolean successGettingTgt = ticketRequestResult.successful() && ticket != null;

    if (successGettingTgt && account != null) {
      TicketGrantingTicket tgt = new TicketGrantingTicket(ticket);
      account.setTicketGrantingTicket(tgt.asSerialized());
      account.save(this);
      isPasswordRetry = false;
    } else {
      if (ticketRequestResult.isPasswordBad() && !isPasswordRetry) {
        Log.i(
            Constants.TAG,
            String.format(
                "Bad password for user %s, removing and attempting re-authentication.",
                account.getName()));
        KerberosAccount.removeAccount(this);
        isPasswordRetry = true;
        authenticateAccount(true /*shouldAddAccount*/);
      } else {
        setErrorResultAndFinish(
            AccountManager.ERROR_CODE_BAD_AUTHENTICATION, ticketRequestResult.toString());
      }
      return;
    }

    String serviceName = getIntent().getStringExtra(Constants.SERVICE_NAME);
    if (serviceName == null) {
      result.putString(AccountManager.KEY_ACCOUNT_NAME, account.getName());
      result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.KERBEROS_ACCOUNT_TYPE);
      // Change UI to show the TGT is obtained correctly.
      setResultAndFinish(result);
    } else {
      // A service name was provided - meaning the TGT had to be renewed before getting a service
      // ticket. As the TGT was renewed successfully, launch the service ticket activity.
      AccountAuthenticatorResponse response =
          getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
      Intent serviceTicketIntent =
          ServiceTicketActivity.getServiceTicketIntent(this, serviceName, response);
      serviceTicketIntent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
      startActivity(serviceTicketIntent);
      finish();
    }
  }

  private void authenticateAccount(boolean shouldAddAccount) {
    KerberosAccountDetails accountDetails = accountConfiguration.getAccountDetails();
    if (accountDetails == null) {
      Log.e(TAG, "Missing details for new account, erroring out.");
      setErrorResultAndFinish(AccountManager.ERROR_CODE_BAD_ARGUMENTS, "Account details missing");
      return;
    }

    KerberosAccount account = KerberosAccount.getAccount(this);
    // Remove the old account if the username in the from the managed configuration is different
    // to the saved account.
    if (account != null) {
      boolean accountNameDiffers = !account.getName().equals(accountDetails.getUsername());
      if (accountNameDiffers) {
        Log.i(
            Constants.TAG,
            String.format("Removing obsolete account for user" + " %s.", account.getName()));
        KerberosAccount.removeAccount(this);
        account = null;
      }      // Fall through to the logic for creating and saving a new account as the old
      // one was just removed.
    } else if (!shouldAddAccount) {
      throw new IllegalStateException(
          "No account is defined and not in a flow for adding accounts.");
    }

    boolean hasUserPassword = account != null && !TextUtils.isEmpty(account.getPassword());
    if (accountConfiguration.hasManagedConfigPassword() || hasUserPassword) {
      // We have all data required to authenticate.
      initiateUserAuthenticationTask(buildKerberosAccountDetails(accountDetails, account));
    } else {
      showPasswordEntryPrompt(account);
    }
  }

  private void saveUserCredentials() {
    hideUserLoginUI();
    KerberosAccountDetails detailsWithoutPassword = accountConfiguration.getAccountDetails();
    String password = ((TextView) findViewById(R.id.editTextPw)).getText().toString();
    KerberosAccountDetails detailsWithPassword =
        new KerberosAccountDetails(
            detailsWithoutPassword.getUsername(),
            password,
            detailsWithoutPassword.getActiveDirectoryDomain(),
            detailsWithoutPassword.getAdDomainController());
    initiateUserAuthenticationTask(detailsWithPassword);
  }

  private void initiateUserAuthenticationTask(KerberosAccountDetails accountDetails) {
    setRefreshingStatus(getTGTTimestampTextViewId());
    KerberosAccount account = KerberosAccount.getAccount(this);
    if (account == null) {
      account = new KerberosAccount(accountDetails);
    }

    account.save(this);
    UserAuthenticationTask kinit =
        new UserAuthenticationTask(
            this,
            new KerberosAccountDetails(
                account.getName(),
                account.getPassword(),
                account.getDomain(),
                account.getDomainController()),
            accountConfiguration.getDebugWithSensitiveData());
    kinit.execute();
  }

  private void showUserLoginUI() {
    View pwField = findViewById(R.id.editTextPw);
    pwField.setVisibility(View.VISIBLE);
    Button loginBtn = findViewById(R.id.ok_btn);
    loginBtn.setText(R.string.login_btn);
    loginBtn.setVisibility(View.VISIBLE);
    loginBtn.setOnClickListener(v -> saveUserCredentials());
  }

  private void hideUserLoginUI() {
    findViewById(R.id.editTextPw).setVisibility(View.INVISIBLE);
    findViewById(R.id.ok_btn).setVisibility(View.INVISIBLE);
    setText(getTGTTimestampTextViewId(), getText(R.string.not_available).toString());
    setRefreshingStatus(getTGTTimestampTextViewId());
  }

  private void showPasswordEntryPrompt(KerberosAccount account) {
    // Activity was created to generate a TGT.
    // Prepare to check if we have the user password available.
    boolean missingAccountPassword = account == null || TextUtils.isEmpty(account.getPassword());
    if (!accountConfiguration.hasManagedConfigPassword() && missingAccountPassword) {
      // User needs to log in if there is no managed config password and the Account Manager
      // does not hold any password.
      showUserLoginUI();
    }
    if (account != null) {
      // If the TGT is being renewed for the same account, check if there is any service ticket
      // information available already.
      showLastServiceAuth();
    }
  }

  private static KerberosAccountDetails buildKerberosAccountDetails(
      KerberosAccountDetails accountDetails, KerberosAccount account) {
    String username;
    String password;
    String domain;
    String controller;
    if (account == null) {
      username = accountDetails.getUsername();
      password = accountDetails.getPassword();
      domain = accountDetails.getActiveDirectoryDomain();
      controller = accountDetails.getAdDomainController();
    } else {
      username = account.getName();
      password = account.getPassword();
      domain = account.getDomain();
      controller = account.getDomainController();
    }

    if (TextUtils.isEmpty(password)) {
      throw new IllegalStateException("No valid password.");
    }
    return new KerberosAccountDetails(username, password, domain, controller);
  }
}


text:
namespace Microsoft.Azure.Search.Models
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Newtonsoft.Json;
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Microsoft.Rest.Azure;

    /// <summary>
    /// Information about a token returned by an analyzer.
    /// </summary>
    public partial class TokenInfo
    {
        /// <summary>
        /// Initializes a new instance of the TokenInfo class.
        /// </summary>
        public TokenInfo() { }

        /// <summary>
        /// Initializes a new instance of the TokenInfo class.
        /// </summary>
        public TokenInfo(string token = default(string), int? startOffset = default(int?), int? endOffset = default(int?), int? position = default(int?))
        {
            Token = token;
            StartOffset = startOffset;
            EndOffset = endOffset;
            Position = position;
        }

        /// <summary>
        /// Gets the token returned by the analyzer.
        /// </summary>
        [JsonProperty(PropertyName = "token")]
        public string Token { get; private set; }

        /// <summary>
        /// Gets the index of the first character of the token in the input
        /// text.
        /// </summary>
        [JsonProperty(PropertyName = "startOffset")]
        public int? StartOffset { get; private set; }

        /// <summary>
        /// Gets the index of the last character of the token in the input
        /// text.
        /// </summary>
        [JsonProperty(PropertyName = "endOffset")]
        public int? EndOffset { get; private set; }

        /// <summary>
        /// Gets the position of the token in the input text relative to other
        /// tokens. The first token in the input text has position 0, the
        /// next has position 1, and so on. Depending on the analyzer used,
        /// some tokens might have the same position, for example if they are
        /// synonyms of each other.
        /// </summary>
        [JsonProperty(PropertyName = "position")]
        public int? Position { get; private set; }

    }
}


text:
docker stop scipy-notebook

docker run -it --rm --name "scipy-notebook" -p 8888:8889 jupyter/scipy-notebook start-singleuser.sh


text:
package example::plugin_command;

use strict;
use warnings;
use base qw(centreon::plugins::script_simple);

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $self->{version} = '0.1';
    %{$self->{modes}} = (
                         'launchcmd' => 'example::mode::launchcmd'
                         );

    return $self;
}

1;

__END__

=head1 PLUGIN DESCRIPTION

An example of local command plugin.

=cut


text:
//
//  PauseView.m
//  CatchEggs
//
//  Created by Chang Shun-Kuei on 3/25/12.
//  Copyright (c) 2012 n/a. All rights reserved.
//

#import "PauseView.h"
#import "MainMenu.h"
#import "SimpleAudioEngine.h"

@implementation PauseView

- (id)initWithFrame:(CGRect)frame
{

    if ([super initWithFrame:frame]) {
        // Initialization code
        [self setUserInteractionEnabled:YES];

        self.backgroundColor = [UIColor blackColor];

        [self setAlpha:0.5f];

        playButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        CGSize imgSize = CGSizeMake(64, 64);

        playButton.frame = CGRectMake(110, 128, 260, imgSize.height);
        playButton.backgroundColor = [UIColor clearColor];

        //add shadow
        playButton.layer.shadowColor = [UIColor blackColor].CGColor;
        playButton.layer.shadowOpacity = 1.0;
        playButton.layer.shadowRadius = 5.0;
        playButton.layer.shadowOffset = CGSizeMake(0, 3);

        [playButton setImage:[UIImage imageNamed:@"button-play.png"] forState:UIControlStateNormal];

        [playButton setTitle:@"RESUME" forState:UIControlStateNormal];
        [playButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [playButton.titleLabel setFont:[UIFont boldSystemFontOfSize:36.0]];

        playButton.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0); //4個參數是上邊界,左邊界,下邊界,右邊界。

        playButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

        [playButton addTarget:self action:@selector(clickPlay) forControlEvents:UIControlEventTouchUpInside];

        [self addSubview:playButton];

        restartButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        restartButton.frame = CGRectMake(110, 48, 260, imgSize.height);
        restartButton.backgroundColor = [UIColor clearColor];
        restartButton.layer.shadowColor = [UIColor blackColor].CGColor;
        restartButton.layer.shadowOpacity = 1.0;
        restartButton.layer.shadowRadius = 5.0;
        restartButton.layer.shadowOffset = CGSizeMake(0, 3);

        [restartButton setImage:[UIImage imageNamed:@"button-rotate-ccw.png"] forState:UIControlStateNormal];

        [restartButton setTitle:@"RESTART" forState:UIControlStateNormal];
        [restartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [restartButton.titleLabel setFont:[UIFont boldSystemFontOfSize:36.0]];

        restartButton.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0); //4個參數是上邊界,左邊界,下邊界,右邊界。

        restartButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

        [restartButton addTarget:self action:@selector(clickRestart) forControlEvents:UIControlEventTouchUpInside];

        [self addSubview:restartButton];

    }
    return self;
}

- (void)dealloc
{

    [super dealloc];
}

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

- (void)regesterPlayButtonWithTarget:(id)target action:(SEL)action
{

    playTarget = target;
    playAction = action;

}
- (void)regesterRestartButtonWithTarget:(id)target action:(SEL)action
{

    restartTarget = target;
    restartAction = action;
}

- (void)clickPlay
{
    [[SimpleAudioEngine sharedEngine] playEffect:@"click.caf"];

    if([playTarget respondsToSelector:playAction]) {

        [playTarget performSelector:playAction];

    }
}
- (void)clickRestart
{
    [[SimpleAudioEngine sharedEngine] playEffect:@"click.caf"];

    if([restartTarget respondsToSelector:restartAction]) {

        [restartTarget performSelector:restartAction];
    }
}

@end


text:
package jspetrinet.ast;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import jspetrinet.exception.JSPNException;
import jspetrinet.exception.NotFindObjectException;
import jspetrinet.marking.Mark;

public class ASTEnv {

	private Mark currentMark;
	private final Map<String,Object> hash;

	public ASTEnv() {
		currentMark = null;
		hash = new HashMap<String,Object>();
	}

	@Override
	public String toString() {
		String linesep = System.getProperty("line.separator").toString();
		String res = "Defined labels:" + linesep;
		for (String s: hash.keySet()) {
			res += s + "; ";
		}
		return res;
	}

	// getter
	public Mark getCurrentMark() {
		return currentMark;
	}

	public void setCurrentMark(Mark m) {
		currentMark = m;
	}

	public Object get(String label) throws JSPNException {
		if (!hash.containsKey(label)) {
			throw new NotFindObjectException(label);
		}
		return hash.get(label);
	}

	public void put(String label, Object value) {
		hash.put(label, value);
	}

	public void remove(String label) {
		hash.remove(label);
	}

	public boolean contains(String label) {
		return hash.containsKey(label);
	}

	public Set<Map.Entry<String,Object>> entrySet() {
		return hash.entrySet();
	}

}


text:
export default class ASTDispatcher {
  constructor(prefix, errorIfMissing) {
    this.errorIfMissing = errorIfMissing;
    this.prefix = prefix;
  }

  dispatch(term) {
    let field = this.prefix + term.type;
    if (typeof this[field] === 'function') {
      return this[field](term);
    } else if (!this.errorIfMissing) {
      return term;
    }
    throw new Error(`Missing implementation for: ${field}`);
  }
}


text:
<Record>
<Term>Palinavir</Term>
<SemanticType>Pharmacologic Substance</SemanticType>
<ParentTerm>Protease Inhibitor</ParentTerm>
<ClassificationPath>Chemicals_and_Drugs_Kind/Drug, Food, Chemical or Biomedical Material/Pharmacologic Substance/Anti-Infective Agent/Antiviral Agent/Palinavir,/NCIThesaurus/Chemicals_and_Drugs_Kind/Drug, Food, Chemical or Biomedical Material/Pharmacologic Substance/Enzyme Inhibitor/Protease Inhibitor/Palinavir</ClassificationPath>
<BroaderTerm>Chemicals_and_Drugs_Kind</BroaderTerm>
<BroaderTerm>Enzyme Inhibitor</BroaderTerm>
<BroaderTerm>NCIThesaurus</BroaderTerm>
<BroaderTerm>Palinavir,</BroaderTerm>
<BroaderTerm>Pharmacologic Substance</BroaderTerm>
<BroaderTerm>Palinavir</BroaderTerm>
<BroaderTerm>Protease Inhibitor</BroaderTerm>
<BroaderTerm>Antiviral Agent</BroaderTerm>
<BroaderTerm>Anti-Infective Agent</BroaderTerm>
<BroaderTerm>Drug, Food, Chemical or Biomedical Material</BroaderTerm>
<Synonym>PALINAVIR</Synonym>
<Synonym>Palinavir</Synonym>
<Source>NCI Thesaurus</Source>
</Record>


text:
/**
 * Javascript of Index Candidate Page Backend
 * @author Harrison <harrison@likipe.se>
 */
jQuery(document).ready(function($) {
	if(typeof(bCheckJavascriptIndexCandidateBackend) !== "undefined" && bCheckJavascriptIndexCandidateBackend === true) {
		/**
		* Set abuse with ajax
		* When click checkbox abuse
		* @param {object} e
		* @author Rony <rony@likipe.se>
		*/
	   $(document).on('click',"td.abuse span.checkbox", function(e) {
		   var $this = $(this);
		   var $parent = $this.parent('.abuse');
		   var iIdCandidate = parseInt($parent.children("input[name='sCandidateAbuseID']").val());
		   var $contentCandidate = $this.closest('div.active_user.content');
		   var oData = {};
		   oData['id'] = iIdCandidate;
		   $.ajax({
			   type: 'PUT',
			   url: Routing.generate('videocv_api_candidate_edit_abuse', {iIdCandidate: iIdCandidate}),
			   contentType: 'application/json',
			   data: oData,
			   beforeSend: function() {
				   $(ajaxLoader).appendTo($contentCandidate);
				   $contentCandidate.css('opacity', '0.5');
			   },
			   success: function(data) {
				   window.location.reload();
			   },
			   error: function (xhr, ajaxOptions, thrownError) {
				   showLightboxMessage("Can not found this Candiate in System");
			   },
			   complete: function() {
				   $contentCandidate.children('.ajax-loader-profile').remove();
				   $contentCandidate.css('opacity', '1');
			   }
		   });
		   e.preventDefault();
	   });

	   /**
		* Set abuse with ajax
		* When click abuse in Profile Candidate
		* @param {object} e
		* @author Harrison <harrison@likipe.se>
		*/

		$(document).on('click', ".candidate-profile .abuse-candidate", function(e) {
			var sure = confirm(videoCVTranslationMessages['are_you_sure']);
			if (sure) {
				var $this = $(this);
				var $popupProfile = $this.closest('div.candidate-profile-backend');
				var iIdCandidate = parseInt($this.data('idcandidate'));
				var oData = {};
				oData['id'] = iIdCandidate;
				//var abuse = $.parseJSON(sContent);
				$.ajax({
					type: 'PUT',
					url: Routing.generate('videocv_api_candidate_edit_abuse', {iIdCandidate: iIdCandidate}),
					contentType: 'application/json',
					data: oData,
					beforeSend: function() {
						$(ajaxLoader).appendTo($popupProfile);
						$popupProfile.css('opacity', '0.5');
					},
					success: function(data) {
						if (data.abuse) {
							showLightboxMessage("Abuse Successfully");
						} else {
							showLightboxMessage("Remove Abuse Successfully");
						}
						window.location.href = reloadUrl;
					},
					error: function(xhr, ajaxOptions, thrownError) {
						showLightboxMessage("Can not found this Candiate in System");
					},
					complete: function() {
						$popupProfile.children('.ajax-loader-profile').remove();
						$popupProfile.css('opacity', '1');
					}
				});
			}
			e.preventDefault();
		});

		/**
		 * Set Active/InActive with Ajax
		 * when click Active/InActive button in Profile Popup
		 * @author Harrison<harrison@likipe.se>
		 * @param {e} e
		 */
		$(document).on('click', ".candidate-profile .active-candidate", function(e) {
			var sure = confirm(videoCVTranslationMessages['are_you_sure']);
			if (sure) {
				var $this = $(this);
				var iIdCandidate = parseInt($this.data('idcandidate'));
				var $popupProfile = $this.closest('div.candidate-profile-backend');
				var oData = {};
				oData['id'] = iIdCandidate;
				$.ajax({
					type: 'PUT',
					url: Routing.generate('videocv_api_candidate_edit_active', {iIdCandidate: iIdCandidate}),
					contentType: 'application/json',
					data: oData,
					beforeSend: function() {
						$(ajaxLoader).appendTo($popupProfile);
						$popupProfile.css('opacity', '0.5');
					},
					success: function(data) {
						if (data.active) {
							showLightboxMessage("Active Successfully");
						} else {
							showLightboxMessage("InActive Successfully");
						}
						window.location.href = reloadUrl;
					},
					error: function(xhr, ajaxOptions, thrownError) {
						showLightboxMessage("Can not found this Candiate in System");
					},
					complete: function() {
						$popupProfile.children('.ajax-loader-profile').remove();
						$popupProfile.css('opacity', '1');
					}
				});
			}
			e.preventDefault();
		});
	   /**
		* Set Admin send email to Candidate
		* when click Send E-mail button in Profile Popup
		* @author Harrison<harrison@likipe.se>
		*  @param {e} e
		*/
	   $(document).on('click',".candidate-profile .email-candidate", function(e) {
		   var $this = $(this);
		   var iIdCandidate = parseInt($this.data('idcandidate'));
		   var $popupProfile = $this.closest('div.view-popup-profile');
		   var oData = {};
		   oData['id'] = iIdCandidate;
		   $.ajax({
			   type: 'POST',
			   url: Routing.generate('videocv_api_candidate_admin_send_email', {iIdCandidate: iIdCandidate}),
			   contentType: 'application/json',
			   data: oData,
			   beforeSend: function() {
				   $(ajaxLoader).appendTo($popupProfile);
				   $popupProfile.css('opacity', '0.5');
			   },
			   success: function(data) {
				   if(data) {
					   showLightboxMessage("Send E-mail Successfully");
				   }
			   },
			   error: function (xhr, ajaxOptions, thrownError) {
				   showLightboxMessage('Error: ' + xhr.responseJSON.error);
			   },
			   complete: function() {
				   $popupProfile.children('.ajax-loader-profile').remove();
				   $popupProfile.css('opacity', '1');
			   }
		   });
		   e.preventDefault();
	   });
	}
});


text: Splashers API Documentation


text:
if defined?(JRUBY_VERSION)

  require 'helper'
  require 'connection/test_methods'

  class ConnectionDirectTest < RSolrBaseTest

    include ConnectionTestMethods

    attr :dist
    attr :home

    def setup
      base = File.expand_path( File.dirname(__FILE__) )
      @dist = File.join(base, '..', '..', 'apache-solr')
      @home = File.join(dist, 'example', 'solr')
      @solr = RSolr.connect(:direct, :home_dir=>@home, :dist_dir=>@dist)
      @solr.delete_by_query('*:*')
      @solr.commit
    end

    def teardown
      @solr.adapter.close
    end

    def test_new_connection_with_existing_core
      Dir["#{@dist}/dist/*.jar"].each { |p| require p }
      dc = org.apache.solr.servlet.DirectSolrConnection.new(@home, "#{@home}/data", nil)
      adapter = RSolr::Connection::Adapter::Direct.new dc
      s = RSolr::Connection::Base.new(adapter)
      assert_equal Hash, s.request('/admin/ping').class
      adapter.close
    end

  end

end


text:
import { useState, useEffect } from 'react';

export default (ref, threshold = 0.25) => {
  const [isIntersecting, setIntersecting] = useState(false);

  useEffect(() => {
    const element = ref.current;
    const observer = new IntersectionObserver(
      ([entry]) => {
        if (entry.isIntersecting) {
          setIntersecting(true);
          observer.unobserve(entry.target);
        }
      },
      {
        threshold,
      }
    );
    if (element) {
      setTimeout(() => observer.observe(element), 3500);
    }
    return () => {
      observer.unobserve(element);
    };
  }, [ref, threshold]);
  return isIntersecting;
};


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--

    Copyright 2004-2014 The Kuali Foundation

    Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php

    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.

-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="1" author="jkakkad" context="kpme-client-bootstrap">
        <comment>KPME-1634 Acc cat maint leave code reference changed to earn code</comment>
        <renameColumn tableName="LM_ACCRUAL_CATEGORY_T" oldColumnName="LEAVE_CODE" newColumnName="EARN_CODE" columnDataType="VARCHAR(15)" />
        <addNotNullConstraint tableName="LM_ACCRUAL_CATEGORY_T" columnName="EARN_CODE" columnDataType="VARCHAR(15)" />
        <renameColumn tableName="LM_ACCRUAL_CATEGORY_RULES_T" oldColumnName="MAX_PAYOUT_LEAVE_CODE" newColumnName="MAX_PAYOUT_EARN_CODE" columnDataType="VARCHAR(15)" />
    </changeSet>

</databaseChangeLog>


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Smartsheet.Api;
using Smartsheet.Api.Models;
using System.Collections.Generic;
using System.Configuration;

namespace IntegrationTestSDK
{
    [TestClass]
    public class DiscussionResourcesTest
    {
        [TestMethod]
        public void TestDiscussionResources()
        {
            SmartsheetClient smartsheet = new SmartsheetBuilder().SetMaxRetryTimeout(30000).Build();

            long sheetId = CreateSheet(smartsheet);

            Discussion discussionToCreate = new Discussion.CreateDiscussionBuilder("A discussion", new Comment.AddCommentBuilder("a comment").Build()).Build();
            Discussion createdDiscussion = smartsheet.SheetResources.DiscussionResources.CreateDiscussion(sheetId, discussionToCreate);
            long createdDiscussionId = createdDiscussion.Id.Value;
            string path = "../../../../../IntegrationTestSDK/TestFile.txt";
            Discussion createdDiscussionWithFile = smartsheet.SheetResources.DiscussionResources.CreateDiscussionWithAttachment(sheetId, discussionToCreate, path, null);
            Assert.IsTrue(createdDiscussionWithFile.Comments[0].Attachments[0].Name == "TestFile.txt");

            PaginatedResult<Discussion> discussions = smartsheet.SheetResources.DiscussionResources.ListDiscussions(sheetId, new DiscussionInclusion[] { DiscussionInclusion.COMMENTS, DiscussionInclusion.ATTACHMENTS }, null);
            Assert.IsTrue(discussions.TotalCount == 2);
            Assert.IsTrue(discussions.Data.Count == 2);
            Assert.IsTrue(discussions.Data[0].Id.Value == createdDiscussion.Id.Value || discussions.Data[0].Id.Value == createdDiscussionWithFile.Id.Value);
            Assert.IsTrue(discussions.Data[1].Id.Value == createdDiscussion.Id.Value || discussions.Data[1].Id.Value == createdDiscussionWithFile.Id.Value);

            Discussion getDiscussionWithFile = smartsheet.SheetResources.DiscussionResources.GetDiscussion(sheetId, createdDiscussionWithFile.Id.Value);
            Assert.IsTrue(getDiscussionWithFile.Title == "A discussion");
            Assert.IsTrue(getDiscussionWithFile.Comments.Count == 1);
            Assert.IsTrue(getDiscussionWithFile.Comments[0].Attachments.Count == 1);
            Assert.IsTrue(getDiscussionWithFile.Comments[0].Attachments[0].Name == "TestFile.txt");

            Row row = new Row.AddRowBuilder(true, null, null, null, null).Build();
            IList<Row> rows = smartsheet.SheetResources.RowResources.AddRows(sheetId, new Row[] { row });
            Assert.IsTrue(rows.Count == 1);
            Assert.IsTrue(rows[0].Id.HasValue);
            long rowId = rows[0].Id.Value;
            Comment comment = new Comment.AddCommentBuilder("a comment!").Build();
            Discussion discussionToCreateOnRow = new Discussion.CreateDiscussionBuilder("discussion on row", comment).Build();
            Discussion discussionCreatedOnRow = smartsheet.SheetResources.RowResources.DiscussionResources.CreateDiscussionWithAttachment(sheetId, rowId, discussionToCreateOnRow, path, null);
            PaginatedResult<Discussion> discussionsOnRow = smartsheet.SheetResources.RowResources.DiscussionResources
            .ListDiscussions(sheetId, rowId, new DiscussionInclusion[] { DiscussionInclusion.COMMENTS }, null);
            Assert.IsTrue(discussionsOnRow.Data.Count == 1);
            Assert.IsTrue(discussionsOnRow.Data[0].Title == "discussion on row");
            Assert.IsTrue(discussionsOnRow.Data[0].Comments[0].Text == "discussion on row\n\na comment!");

            smartsheet.SheetResources.DeleteSheet(sheetId);
        }

        private static long CreateSheet(SmartsheetClient smartsheet)
        {
            Column[] columnsToCreate = new Column[] {
            new Column.CreateSheetColumnBuilder("col 1", true, ColumnType.TEXT_NUMBER).Build(),
            new Column.CreateSheetColumnBuilder("col 2", false, ColumnType.DATE).Build(),
            new Column.CreateSheetColumnBuilder("col 3", false, ColumnType.TEXT_NUMBER).Build(),
            };
            Sheet createdSheet = smartsheet.SheetResources.CreateSheet(new Sheet.CreateSheetBuilder("new sheet", columnsToCreate).Build());
            Assert.IsTrue(createdSheet.Columns.Count == 3);
            Assert.IsTrue(createdSheet.Columns[1].Title == "col 2");
            return createdSheet.Id.Value;
        }
    }
}


text:
<!DOCTYPE HTML>

<title>Ocean Currents Map</title>

    COAWST Sea Surface Currents Map

    <canvas id="legend1" width=80 height=20></canvas> 0.1 m/s

    <canvas id="legend2" width=80 height=20></canvas> 0.3 m/s

    <canvas id="legend3" width=80 height=20></canvas> 0.5 m/s

    <canvas id="legend4" width=80 height=20></canvas> 1.0 m/s

    <canvas id="legend5" width=80 height=20></canvas> 1.5 m/s

    <input style="visibility:hidden" id="animating" type="checkbox" checked></input>

    <input id="unzoom" style="visiblity:hidden" onclick="doUnzoom()" type="button" value="Unzoom"></input>

  <canvas id="display" width=800 height=600 unselectable="on" class="unselectable">    If the map is missing, we recommend the latest
	Chrome browser.
</canvas>
  <canvas id="city-display" width=800 height=600 unselectable="on" class="unselectable"></canvas>
  <canvas id="image-canvas" width=800 height=600 unselectable="on" class="unselectable"></canvas>

This map represents a snapshot of daily-averaged ocean surface current from the USGS COAWST coupled circulation, wave and sediment transport modeling system for the US East and Gulf coasts.

The surface current data is extracted from the USGS THREDDS Data Server via OPeNDAP and averaged over 24 hours. The streaks are created dynamically by JavaScript running in the browser.

Please send feedback and inquiries to: John Warner.

		This map uses copyrighted technology developed by Fernanda Viegas and Martin Wattenberg (hint.fm) for their stunning wind map application.  They have graciously allowed us to show visualization of ocean currents here until license issues are resolved.


text:
$(document).ready(function() {

  var scrollLink = $('.scroll');

  // Smooth scrolling
  scrollLink.click(function(e) {
    $('body,html').animate({
      scrollTop: $(this.hash).offset().top
    }, 1000 );
  });

  // Active link switching
  $(window).scroll(function() {
    var scrollbarLocation = $(this).scrollTop();

    scrollLink.each(function() {

      var sectionOffset = $(this.hash).offset().top - 20;

      if ( sectionOffset <= scrollbarLocation ) {
        $(this).parent().addClass('active');
        $(this).parent().siblings().removeClass('active');
      }
    })
  })

  // Auto close navbar on clicking a link in it
  // Ref: https://stackoverflow.com/a/14250000/5614968
  $('.navbar-collapse a').click(function() {
    $(".navbar-collapse").collapse('hide');
  });
})


text:
package omgrofl.interpreter.commands;

import omgrofl.interpreter.Command;
import omgrofl.interpreter.CommandSequence;
import omgrofl.Globals;
import omgrofl.interpreter.exceptions.ScriptExitException;
import omgrofl.interpreter.exceptions.ScriptInterruptedException;

public class InfiniteLoopCommand extends Command {

    protected CommandSequence script;

    public InfiniteLoopCommand(CommandSequence script) {
        this.script = script;
    }

    public CommandSequence getCommandSequence() {
        return script;
    }

    @Override
    public void execute() throws ScriptExitException {
        try {
            while (true)
                script.run();
        } catch (ScriptInterruptedException e) {
            // do nothing, this is normal
        }
    }

    @Override
    public String toString() {
        return Globals.loopOperator + "\n" +
                Globals.indent(script.toString()) +
                Globals.endOperator;
    }
}


text:
@charset "utf-8";
/* CSS Document */
body {
    background-image: url("../images/index-01.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
}

@font-face {
    font-family: "Bebas Neue";
    src: url("../fonts/bebas_neue/BebasNeue.otf") format("truetype");
}

.cari {
	text-align: center;
	vertical-align: middle;
	margin-top: 23%;

}

#search {
    vertical-align: middle;
}

input[type=text] {
    width: 40%;
    box-sizing: border-box;
    border: 2px solid #c71002;
    border-radius: 10px;
    font-size: 16px;
	color: #c71002;
	text-align: center;
	background-color: white;
    background-image: url('../images/search.png');
	background-size: 20px;
    background-position: 10px 10px;
    background-repeat: no-repeat;
    padding: 10px;
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
}

input[type=text]:focus {
	color: #c71002;
}

input::placeholder {
  color: #c71002;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}


text:
from fabric.api import env, local, require

project_name = 'eraldoenergy'

def backup():
    """fab [environment] backup"""
    require('environment')
    if env.environment == "development":
        local('pg_dump -Fc {project} > backups/{project}-{environment}_`date +%Y-%m-%d_%H%M%S`.dump'.format(
            project=project_name, environment=env.environment))
    elif env.environment in ['staging', 'production']:
        local(
            'curl -o backups/{project}-{environment}_`date +%Y-%m-%d_%H%M%S`.dump `heroku pg:backups public-url --app {app}`'.format(
                project=project_name, environment=env.environment, app=env.app))

def deploy():
    """fab [environment] deploy"""
    require('environment')
    maintenance_on()
    push()
    migrate()
    maintenance_off()
    ps()

def maintenance_on():
    """fab [environment] maintenance_on"""
    require('environment')
    local('heroku maintenance:on --app %s' % env.app)

def maintenance_off():
    """fab [environment] maintenance_off"""
    require('environment')
    local('heroku maintenance:off --app %s' % env.app)

def push():
    """fab [environment] push"""
    require('environment')
    local('git push origin {branch}'.format(branch=env.branch))

def migrate(app=None):
    """fab [environment] migrate"""
    require('environment')
    if env.environment == "development":
        if app is not None:
            local('python manage.py migrate %s' % app)
        else:
            local('python manage.py migrate')
    else:
        if app is not None:
            local('heroku run python manage.py migrate %s --app %s' % (app, env.app))
        else:
            local('heroku run python manage.py migrate --app %s' % env.app)

def ps():
    """fab [environment] ps"""
    require('environment')
    local('heroku ps --app %s' % env.app)

def open():
    """fab [environment] open"""
    require('environment')
    local('heroku open --app %s' % env.app)

def development():
    """fab development [command]"""
    env.environment = 'development'
    env.app = 'local'
    env.branch = 'development'

def staging():
    """fab staging [command]"""
    env.environment = 'staging'
    env.app = 'eraldoenergy-staging'
    env.branch = 'staging'

def production():
    """fab production [command]"""
    env.environment = 'production'
    env.app = 'eraldoenergy'
    env.branch = 'master'


text:
package org.simpleframework.xml.core;

import org.simpleframework.xml.strategy.Type;
import org.simpleframework.xml.stream.InputNode;
import org.simpleframework.xml.stream.OutputNode;
import org.simpleframework.xml.stream.Position;
import org.simpleframework.xml.stream.Style;

/**
 * The CompositeKey object is used to convert an object
 * to an from an XML element. This accepts only composite objects and
 * will throw an exception if the ElementMap annotation
 * is configured to have an attribute key. If a key name is given for
 * the annotation then this will act as a parent element to the
 * resulting XML element for the composite object.
 *
 * @author Niall Gallagher
 *
 * @see org.simpleframework.xml.ElementMap
 */
class CompositeKey implements Converter {

   /**
    * This is the context used to support the serialization process.
    */
   private final Context context;

   /**
    * This is the traverser used to read and write the composite key.
    */
   private final Traverser root;

   /**
    * This is the style used to style the names used for the XML.
    */
   private final Style style;

   /**
    * This is the entry object used to provide configuration details.
    */
   private final Entry entry;

   /**
    * This represents the type of object the key is written as.
    */
   private final Type type;

   /**
    * Constructor for the CompositeKey object. This will
    * create an object capable of reading an writing composite keys
    * from an XML element. This also allows a parent element to be
    * created to wrap the key object if desired.
    *
    * @param context this is the root context for the serialization
    * @param entry this is the entry object used for configuration
    * @param type this is the type of object the key represents
    */
   public CompositeKey(Context context, Entry entry, Type type) throws Exception {
      this.root = new Traverser(context);
      this.style = context.getStyle();
      this.context = context;
      this.entry = entry;
      this.type = type;
   }

   /**
    * This method is used to read the key value from the node. The
    * value read from the node is resolved using the template filter.
    * If the key value can not be found according to the annotation
    * attributes then null is assumed and returned.
    *
    * @param node this is the node to read the key value from
    *
    * @return this returns the value deserialized from the node
    */
   public Object read(InputNode node) throws Exception {
      Position line = node.getPosition();
      Class expect = type.getType();
      String name = entry.getKey();

      if(name == null) {
         name = context.getName(expect);
      }
      if(entry.isAttribute()) {
         throw new AttributeException("Can not have %s as an attribute for %s at %s", expect, entry, line);
      }
      return read(node, name);
   }

   /**
    * This method is used to read the key value from the node. The
    * value read from the node is resolved using the template filter.
    * If the key value can not be found according to the annotation
    * attributes then null is assumed and returned.
    *
    * @param node this is the node to read the key value from
    * @param value this is the value to deserialize in to
    *
    * @return this returns the value deserialized from the node
    *
    * @throws Exception if value is not null an exception is thrown
    */
   public Object read(InputNode node, Object value) throws Exception {
      Position line = node.getPosition();
      Class expect = type.getType();

      if(value != null) {
         throw new PersistenceException("Can not read key of %s for %s at %s", expect, entry, line);
      }
      return read(node);
   }

   /**
    * This method is used to read the key value from the node. The
    * value read from the node is resolved using the template filter.
    * If the key value can not be found according to the annotation
    * attributes then null is assumed and returned.
    *
    * @param node this is the node to read the key value from
    * @param key this is the name of the key wrapper XML element
    *
    * @return this returns the value deserialized from the node
    */
   private Object read(InputNode node, String key) throws Exception {
      String name = style.getElement(key);
      Class expect = type.getType();

      if(name != null) {
         node = node.getNext(name);
      }
      if(node == null) {
         return null;
      }
      if(node.isEmpty()) {
         return null;
      }
      return root.read(node, expect);
   }

   /**
    * This method is used to read the key value from the node. The
    * value read from the node is resolved using the template filter.
    * If the key value can not be found according to the annotation
    * attributes then null is assumed and the node is valid.
    *
    * @param node this is the node to read the key value from
    *
    * @return this returns the value deserialized from the node
    */
   public boolean validate(InputNode node) throws Exception {
      Position line = node.getPosition();
      Class expect = type.getType();
      String name = entry.getKey();

      if(name == null) {
         name = context.getName(expect);
      }
      if(entry.isAttribute()) {
         throw new ElementException("Can not have %s as an attribute for %s at %s", expect, entry, line);
      }
      return validate(node, name);
   }

   /**
    * This method is used to read the key value from the node. The
    * value read from the node is resolved using the template filter.
    * If the key value can not be found according to the annotation
    * attributes then null is assumed and the node is valid.
    *
    * @param node this is the node to read the key value from
    * @param key this is the name of the key wrapper XML element
    *
    * @return this returns the value deserialized from the node
    */
   private boolean validate(InputNode node, String key) throws Exception {
      String name = style.getElement(key);
      InputNode next = node.getNext(name);
      Class expect = type.getType();

      if(next == null) {
         return true;
      }
      if(next.isEmpty()) {
         return true;
      }
      return root.validate(next, expect);
   }

   /**
    * This method is used to write the value to the specified node.
    * The value written to the node must be a composite object and if
    * the element map annotation is configured to have a key attribute
    * then this method will throw an exception.
    *
    * @param node this is the node that the value is written to
    * @param item this is the item that is to be written
    */
   public void write(OutputNode node, Object item) throws Exception {
      Class expect = type.getType();
      String key = entry.getKey();

      if(entry.isAttribute()) {
         throw new ElementException("Can not have %s as an attribute for %s", expect, entry);
      }
      if(key == null) {
         key = context.getName(expect);
      }
      String name = style.getElement(key);

      root.write(node, item, expect, name);
   }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Simple Responsive Website Template</title>
    <link rel="stylesheet" type="text/css" href="stylesheets/reset.css" />
    <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
    <link rel="stylesheet" type="text/css" href="stylesheets/media-queries.css" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href='https://fonts.googleapis.com/css?family=Hind+Siliguri' rel='stylesheet' type='text/css'>

Responsive Template

Simple Responsive Website Template. Without any frameworks.

                Download the Project
                Official Site
                Follow Me

Project Description

This sample web page does not use any third-party framework, like Twitter Bootstrap or ZURB Foundation, to take advantage of available resources responsive here. Only HTML5 and CSS3 are required to apply these features to a web page. Originally made by onextrapixel.com and migrated to GitHub for me.

                    See the project page →

How to use?

Simple!

Copy code, paste code. Very simple. But the whole secret of the responsive feature is the media-queries.css file. See this:

    @media screen and (max-width: 478px) { ... }
    @media screen and (max-width: 480px) { ... }
    @media screen and (max-width: 740px) { ... }
    /* And more... */

And, of course, in the viewport meta name.

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

Any doubt?

See if you can find something that can help in the documentation. Click here →

Bugs

Found a bug? Tell me! Click here →

Support or Contact

Wiki

Issues

Social

Facebook

Twitter

GitHub

License

The MIT License (MIT)

                    Copyright (c) 2015 Vinícius Stutz

                    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.

© 2015 - This project is supported by Vinicius Stutz.


text:
require "social_share_button/version"
require "social_share_button/config"
require "social_share_button/helper"

I18n.load_path += Dir.glob( File.dirname(__FILE__) + "lib/locales/*.{rb,yml}" )

module SocialShareButtonFoundation
  module Rails
    if ::Rails.version < "3.1"
      require "social_share_button/railtie"
    else
      require "social_share_button/engine"
    end
  end
end

ActionView::Base.send :include, SocialShareButtonFoundation::Helper


text:
<?php

class IntakesController extends AppController
{
    public $name = 'Intakes';
    public $components = array('Intakez' => array(
        'module' => 'Registratie',
    ));

    public function view($id = null)
    {
        if ($this->Intakez->view($id)) {
            $this->render('/intakes/view');
        } else {
            $this->redirect(array(
                'controller' => 'klanten',
                'action' => 'index',
            ));
        }
    }

    public function add($klant_id = null)
    {
        $redirect_url = array(
            'controller' => 'klanten',
            'action' => 'view',
            $klant_id,
        );
        if (!empty($this->data)) {
            if ($this->Intakez->save_data($klant_id)) { //saved successfully
                //save the last intake field in the klant:
                $this->Intake->set_last_intake($klant_id);
                $this->redirect($redirect_url);
            } else {
                //something went wrong, render the same view again with validation
            //errors
                $this->Intakez->setup_add_view($klant_id);
                //no redirect
            }
        } else {
            if (!$this->Intakez->setup_add_view($klant_id)) {
                //flash messages are already set by the compontent
                $this->redirect(array(
                    'controller' => 'klanten',
                    'action' => 'index',
                ));
            }
        }

        $this->set('back_action', $redirect_url);
    }

    public function edit($id = null)
    {
        if (!$id && empty($this->data)) {
            $this->c->flashError(__('Ongeldige intake', true));
            $this->c->redirect(array(
                'controller' => 'klanten',
                'action' => 'index',
            ));
        }

        $klant_view = array('controller' => 'klanten', 'action' => 'view');

        if (!empty($this->data)) {
            if ($this->Intakez->save_edited()) {
                $this->redirect(
                    $klant_view + array($this->data['Intake']['klant_id'])
                );
            }
            //on save failure:
            $this->Intakez->setup_edit_view($this->data['Intake']['id']);
        } else {
            if (!$this->Intakez->setup_edit_view($id)) {
                if ($this->data['Intake']['klant_id']) {
                    $this->redirect(
                        $klant_view + array($this->data['Intake']['klant_id'])
                    );
                } else {
                    $this->redirect(array(
                        'controller' => 'klanten',
                        'action' => 'index',
                    ));
                }
            }
        }//end of else (for empty this->data)
    }

    public function delete($id = null)
    {
        if (!$id) {
            $this->flashError(__('Ongeldige id voor intake', true));
            $this->redirect(array('action' => 'index'));
        }
        if ($this->Intake->delete($id)) {
            $this->flashError(__('Intake verwijderd', true));
            $this->redirect(array('action' => 'index'));
        }
        $this->flashError(__('Intake is niet verwijderd', true));
        $this->redirect(array('action' => 'index'));
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.zuehlke.cht.demo.rabbit.jca</groupId>
		<artifactId>rabbitMqJca</artifactId>
		<version>1.0-SNAPSHOT</version>
	</parent>

	<artifactId>rabbitMqRar</artifactId>
	<name>rabbitMqRar</name>
	<packaging>rar</packaging>

	<dependencies>
		<dependency>
			<groupId>com.zuehlke.cht.demo.rabbit.jca</groupId>
			<artifactId>rabbitMqRarImpl</artifactId>
			<version>1.0-SNAPSHOT</version>
		</dependency>
	</dependencies>
</project>


text:
require "app/models/review_body"

RSpec.describe ReviewBody do
  describe "#to_s" do
    context "when no errors are passed" do
      it "returns empty string" do
        review_body = ReviewBody.new([])

        result = review_body.to_s

        expect(result).to eq ""
      end
    end

    context "with errors" do
      it "returns formatted errors" do
        review_body = ReviewBody.new(["invalid config", "foo\n  bar"])

        result = review_body.to_s

        expect(result).to eq <<~EOS.chomp
          Some files could not be reviewed due to errors:

          invalid config

invalid config

          foo

foo
            bar

        EOS
      end

      context "when errors are too long" do
        it "truncates the errors" do
          stub_const("ReviewBody::HEADER", "errs")
          stub_const("ReviewBody::DETAILS_FORMAT", "%s:\n'%s'")
          stub_const("ReviewBody::SUMMARY_LENGTH", 5)
          stub_const("ReviewBody::MAX_BODY_LENGTH", 40)
          review_body = ReviewBody.new(
            [
              "err1\n  foo",
              "err2\n  bar\n  baz",
            ],
          )

          result = review_body.to_s

          expect(result.size).to eq 40
          expect(result).to eq <<~EOS.chomp
            errs
            err1:
            'err1
              foo'
            err2:
            'err2
              b'
          EOS
        end
      end
    end
  end
end


text:
Dac::Dac(port_t port) : Pblock(port, HWPL_DAC_PORTS){}

int Dac::open(int flags){
	return hwpl_dac_open((const device_cfg_t*)&(this->port_));
}

int Dac::close(){
	return hwpl_dac_close((const device_cfg_t*)&this->port_);
}

int Dac::getattr(dac_attr_t * attr){
	return hwpl_dac_getattr(this->port_, attr);
}

int Dac::setattr(const dac_attr_t * attr){
	return hwpl_dac_setattr(this->port_, (void*)attr);
}

dac_sample_t Dac::get(void){
	return hwpl_dac_get(this->port_, NULL);
}

int Dac::write(void * buf, int nbyte){
	return applib_util_transfer((const device_cfg_t*)&port_, hwpl_dac_write, loc, buf, nbyte, O_RDWR | APPLIB_UTIL_WRITE_FLAG);
}


text:
<?xml version="1.0" standalone="yes"?>
<!--

    Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<project basedir="." default="run">
  <description>
      This sample application demonstrates the use of mapping annotations
      @XmlAccessorOrder and @XmlType.propOrder in Java classes for ordering
      properties and fields in Java to schema bindings.
    </description>
  <property name="jaxb.home" value="../.." />
  <path id="classpath">
    <pathelement path="src" />
    <pathelement path="classes" />
    <pathelement path="schemas" />
    <fileset dir="${jaxb.home}" includes="mod/*.jar" />
  </path>
  <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask">
    <classpath refid="classpath" />
  </taskdef>

  <!--compile Java source files-->
  <target name="compile" description="Compile all Java source files">
    <echo message="Generating schemas..." />
    <mkdir dir="schemas" />
    <schemagen destdir="schemas">
      <src path="src" />
      <exclude name="Main.java" />
      <classpath refid="classpath" />
    </schemagen>
    <echo message="Compiling the java source files..." />
    <mkdir dir="classes" />
    <javac destdir="classes" debug="on">
      <src path="src" />
      <classpath refid="classpath" />
    </javac>
  </target>

  <target name="run" depends="compile" description="Run the sample app">
    <echo message="Running the sample application..." />
    <java classname="Main" fork="true">
      <classpath refid="classpath" />
    </java>
  </target>

  <target name="javadoc" description="Generates javadoc" depends="compile">
    <echo message="Generating javadoc..." />
    <mkdir dir="docs/api" />
    <javadoc sourcepath="gen-src" destdir="docs/api" windowtitle="Ordering Properties and Fieldes in Java to Schema Bindings" useexternalfile="yes">
      <fileset dir="." includes="gen-src/**/*.java" excludes="**/impl/**/*.java" />
    </javadoc>
  </target>

  <target name="clean" description="Deletes all the generated artifacts.">
    <delete dir="docs/api" />
    <delete dir="gen-src" />
    <delete dir="schemas" />
    <delete dir="classes" />
  </target>
</project>


text:
move spigot-1.8.jar to local libs

local spigot-1.8.jar ref [java - How to add local .jar file dependency to build.gradle file? - Stack Overflow](http://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file)


text:
@interface LYXNewsItemViewModel : NSObject

@property (nonatomic, strong, readonly) OCTEvent *event;
@property (nonatomic, copy, readonly) NSAttributedString *attributedString;

@property (nonatomic, assign) CGFloat height;
@property (nonatomic, strong) RACCommand *didClickLinkCommand;

- (instancetype)initWithEvent:(OCTEvent *)event;

@end


text:
default['phpenv']['user'] = 'phpenv'
default['phpenv']['user_home'] = '/home/phpenv'
default['phpenv']['manage_home'] = true

default['phpenv']['group'] = 'phpenv'
default['phpenv']['group_users'] = []

default['phpenv']['root_path'] = '/opt/phpenv'
default['phpenv']['create_profiled'] = true
default['phpenv']['git_force_update'] = false
default['phpenv']['git_repository'] = 'https://github.com/CHH/phpenv.git'
default['phpenv']['git_reference'] = 'master'
default['phpenv']['php-build']['git_force_update'] = false
default['phpenv']['php-build']['git_repository'] = 'https://github.com/CHH/php-build.git'
default['phpenv']['php-build']['git_reference'] = 'master'

case platform
when 'redhat', 'centos', 'fedora', 'amazon', 'scientific'
  default['phpenv']['packages'] = %w(
    git
  )
when 'debian', 'ubuntu', 'suse'
  default['phpenv']['packages'] = %w(
    re2c
    libsqlite0-dev
    libxml2-dev
    libpcre3-dev
    libbz2-dev
    libcurl4-openssl-dev
    libdb-dev
    libjpeg-dev
    libpng12-dev
    libxpm-dev
    libfreetype6-dev
    libmysqlclient-dev
    postgresql-server-dev-all
    libt1-dev
    libgd2-xpm-dev
    libgmp-dev
    libsasl2-dev
    libmhash-dev
    unixodbc-dev
    freetds-dev
    libpspell-dev
    libsnmp-dev
    libtidy-dev
    libxslt1-dev
    libmcrypt-dev
    libssl-dev
    libreadline-dev
    git
  )
when 'freebsd'
  default['phpenv']['packages'] = %w(
    git
  )
end


text:
<?php

namespace directapi\services\campaigns\models\strategies;

use directapi\components\Model;
use Symfony\Component\Validator\Constraints as Assert;

class StrategyAverageCpaPerFilter extends Model
{
    /**
     * @var int
     */
    public $FilterAverageCpa;

    /**
     * @var int
     * @Assert\NotBlank()
     */
    public $FilterAverageCpc;

    /**
     * @var int
     * @Assert\NotBlank()
     */
    public $GoalId;

    /**
     * @var int
     */
    public $WeeklySpendLimit;

    /**
     * @var int
     */
    public $BidCeiling;
}


text:
describe('MAPS', () => {

  xit('has a set method', ()=>{

    // Create a new map called 'myMap'
    // add a new entry. Use "name" as the key and "Aaron" as the value

    expect(myMap.get("name")).toBe("Aaron");

  });

  xit('can use objects as a key', ()=>{
    let user = {name: 'Aaron'};
    let value = {twitter: '@js_dev', gplus: '+AaronFrost'}

    // Create a map called 'myMap'
    // add a new entry. Use user as the key, and value as the value

    expect(myMap.has(user)).toBe(true);
    expect(myMap.get(user)).toBe(value);
  });

});


text:
var cloneBurrito = require('clone');
//
cloneBurrito.init();
cloneBurrito.copyGitRepo({'callback': afterFinish});


text:
package org.jboss.curriculum.converters;

import java.io.Serializable;

import javax.ejb.Stateless;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named;

@Stateless
@Named("converter")
public class PropertyConverter implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    // These two properties are used by the JSF only
	private String property = "";
	private String convertedProperty = "";

	private String convert(String prop) {

	    if (prop == null || prop.isEmpty()) {
	        throw new RuntimeException("Null or empty String can't be converted");
	    }

		return prop + " CONVERTED";
	}

	/**
	 * Used as the JSF action method
	 */
	public void convert() {
		try {
			this.convertedProperty = this.convert(this.property);
		} catch (RuntimeException e) {
			this.convertedProperty = "Error - Unable to convert";
			FacesContext.getCurrentInstance().addMessage(null,
					new FacesMessage(e.getMessage()));
		}
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String temperature) {
		this.property = temperature;
	}

	public String getConvertedProperty() {
		return convertedProperty;
	}

}


text:
<title>pcre_version specification</title>

This HTML document has been generated automatically from the original man page.
If there is any nonsense in it, please consult the man page, in case the
conversion went wrong.

SYNOPSIS

#include <pcre.h>

char *pcre_version(void);

DESCRIPTION

This function returns a character string that gives the version number of the
PCRE library, and its date of release.

There is a complete description of the PCRE API in the
pcreapi
page.