text:
package com.salesforce.dva.argus.service.metric.transform;

import com.salesforce.dva.argus.entity.Metric;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.*;

public class LogTransformTest {

    @Test(expected = IllegalArgumentException.class)
    public void testLogTransformWithoutMetrics() {
        List<Metric> metrics = null;

        (new MetricMappingTransform(new LogValueMapping())).transform(metrics);
    }

    @Test
    public void testLogTransformWithoutBaseForOneMetric() {
        Metric m1 = new Metric("test_scope", "test_metric");
        Map<Long, Double> dp = new HashMap<Long, Double>();

        dp.put(2L, 10.0);
        dp.put(4L, 100.0);
        dp.put(5L, 10000.0);
        m1.setDatapoints(dp);

        List<Metric> metrics = Arrays.asList(m1);
        List<Metric> result = (new MetricMappingTransform(new LogValueMapping())).transform(metrics);

        assertThat(result, equalTo(metrics));

        Map<Long, Double> expectedDps = new HashMap<Long, Double>();

        expectedDps.put(2L, 1.0);
        expectedDps.put(4L, 2.0);
        expectedDps.put(5L, 4.0);
        assertEquals(result.get(0).getDatapoints(), expectedDps);
    }

    @Test
    public void testLogTransformWithBaseForOneMetric() {
        Metric m1 = new Metric("test_scope", "test_metric");
        Map<Long, Double> dp = new HashMap<Long, Double>();

        dp.put(2L, 4.0);
        dp.put(4L, 8.0);
        dp.put(5L, 32.0);
        m1.setDatapoints(dp);

        List<Metric> metrics = Arrays.asList(m1);
        List<String> constants = new ArrayList<String>();

        constants.add("2");

        List<Metric> result = (new MetricMappingTransform(new LogValueMapping())).transform(metrics, constants);

        assertThat(result, equalTo(metrics));

        Map<Long, Double> expectedDps = new HashMap<Long, Double>();

        expectedDps.put(2L, 2.0);
        expectedDps.put(4L, 3.0);
        expectedDps.put(5L, 5.0);
        assertEquals(result.get(0).getDatapoints(), expectedDps);
    }

    @Test
    public void testLogWithoutBaseTransformForMultipleMetric() {
        Metric m1 = new Metric("test_scope", "test_metric");
        Map<Long, Double> dp_1 = new HashMap<Long, Double>();

        dp_1.put(2L, 10.0);
        dp_1.put(4L, 100.0);
        dp_1.put(5L, 10000.0);
        m1.setDatapoints(dp_1);

        Metric m2 = new Metric("test_scope", "test_metric");
        HashMap<Long, Double> dp_2 = new HashMap<Long, Double>();

        dp_2.put(2L, 10000.0);
        dp_2.put(4L, 10.0);
        dp_2.put(5L, 1.0);
        m2.setDatapoints(dp_2);

        List<Metric> metrics = Arrays.asList(m1, m2);
        List<Metric> result = (new MetricMappingTransform(new LogValueMapping())).transform(metrics);

        assertThat(result, equalTo(metrics));

        Map<Long, Double> expectedDps_1 = new HashMap<Long, Double>();

        expectedDps_1.put(2L, 1.0);
        expectedDps_1.put(4L, 2.0);
        expectedDps_1.put(5L, 4.0);

        Map<Long, Double> expectedDps_2 = new HashMap<Long, Double>();

        expectedDps_2.put(2L, 4.0);
        expectedDps_2.put(4L, 1.0);
        expectedDps_2.put(5L, 0.0);
        assertEquals(result.get(0).getDatapoints(), expectedDps_1);
        assertEquals(result.get(1).getDatapoints(), expectedDps_2);
    }

    @Test
    public void testLogWithBaseTransformForMultipleMetric() {
        Metric m1 = new Metric("test_scope", "test_metric");
        Map<Long, Double> dp_1 = new HashMap<Long, Double>();

        dp_1.put(2L, 4.0);
        dp_1.put(4L, 8.0);
        dp_1.put(5L, 32.0);
        m1.setDatapoints(dp_1);

        Metric m2 = new Metric("test_scope", "test_metric");
        HashMap<Long, Double> dp_2 = new HashMap<Long, Double>();

        dp_2.put(2L, 1024.0);
        dp_2.put(4L, 64.0);
        dp_2.put(5L, 16.0);
        m2.setDatapoints(dp_2);

        List<Metric> metrics = Arrays.asList(m1, m2);
        List<String> constants = new ArrayList<String>();

        constants.add("2");

        List<Metric> result = (new MetricMappingTransform(new LogValueMapping())).transform(metrics, constants);

        assertThat(result, equalTo(metrics));

        Map<Long, Double> expectedDps_1 = new HashMap<Long, Double>();

        expectedDps_1.put(2L, 2.0);
        expectedDps_1.put(4L, 3.0);
        expectedDps_1.put(5L, 5.0);

        Map<Long, Double> expectedDps_2 = new HashMap<Long, Double>();

        expectedDps_2.put(2L, 10.0);
        expectedDps_2.put(4L, 6.0);
        expectedDps_2.put(5L, 4.0);
        assertEquals(result.get(0).getDatapoints(), expectedDps_1);
        assertEquals(result.get(1).getDatapoints(), expectedDps_2);
    }

    @Test
    public void testLogTransformWithoutBaseForOneMetricHavingNull() {
        Metric m1 = new Metric("test_scope", "test_metric");
        Map<Long, Double> dp = new HashMap<Long, Double>();

        dp.put(2L, null);
        dp.put(4L, 100.0);
        dp.put(5L, 10000.0);
        m1.setDatapoints(dp);

        List<Metric> metrics = Arrays.asList(m1);
        List<Metric> result = (new MetricMappingTransform(new LogValueMapping())).transform(metrics);

        assertThat(result, equalTo(metrics));

        Map<Long, Double> expectedDps = new HashMap<Long, Double>();

        expectedDps.put(2L, Double.NEGATIVE_INFINITY);
        expectedDps.put(4L, 2.0);
        expectedDps.put(5L, 4.0);
        assertEquals(result.get(0).getDatapoints(), expectedDps);
    }
}
/* Copyright (c) 2016, Salesforce.com, Inc.  All rights reserved. */


text:
import AbstractMergeDateRangeRefiner from "../../../../common/refiners/AbstractMergeDateRangeRefiner";

export default class ZHHansMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
    patternBetween(): RegExp {
        return /^\s*(至|到|-|~|~|-|ー)\s*$/i;
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'base64'

require 'rbnacl'

require 'macaroons/caveat'
require 'macaroons/utils'
require 'macaroons/serializers/binary'
require 'macaroons/serializers/json'

module Macaroons
  class RawMacaroon

    def initialize(key: nil, identifier: nil, location: nil)
      if key.nil? || identifier.nil? || location.nil?
        raise ArgumentError, 'Must provide all three: (key, identifier, location)'
      end

      @key = key
      @identifier = identifier
      @location = location
      @signature = create_initial_macaroon_signature(key, identifier)
      @caveats = []
    end

    def self.from_binary(serialized: nil)
      Macaroons::BinarySerializer.new().deserialize(serialized)
    end

    def self.from_json(serialized: nil)
      Macaroons::JsonSerializer.new().deserialize(serialized)
    end

    attr_reader :identifier
    attr_reader :key
    attr_reader :location
    attr_accessor :caveats
    attr_accessor :signature

    def signature
      Utils.hexlify(@signature).downcase
    end

    def add_first_party_caveat(predicate)
      caveat = Caveat.new(predicate)
      @caveats << caveat
      @signature = Utils.sign_first_party_caveat(@signature, predicate)
    end

    def add_third_party_caveat(caveat_key, caveat_id, caveat_location)
      derived_caveat_key = Utils.truncate_or_pad(Utils.hmac('macaroons-key-generator', caveat_key))
      truncated_or_padded_signature = Utils.truncate_or_pad(@signature)
      box = RbNaCl::SimpleBox.from_secret_key(truncated_or_padded_signature)
      ciphertext = box.encrypt(derived_caveat_key)
      verification_id = ciphertext
      caveat = Caveat.new(caveat_id, verification_id, caveat_location)
      @caveats << caveat
      @signature = Utils.sign_third_party_caveat(@signature, verification_id, caveat_id)
    end

    def serialize
      Macaroons::BinarySerializer.new().serialize(self)
    end

    def serialize_json
      Macaroons::JsonSerializer.new().serialize(self)
    end

    def prepare_for_request(macaroon)
      bound_macaroon = Marshal.load( Marshal.dump( macaroon ) )
      raw = bound_macaroon.instance_variable_get(:@raw_macaroon)
      raw.signature = bind_signature(macaroon.signature)
      bound_macaroon
    end

    def bind_signature(signature)
      key = Utils.truncate_or_pad("\0")
      hash1 = Utils.hmac(key, Utils.unhexlify(self.signature))
      hash2 = Utils.hmac(key, Utils.unhexlify(signature))
      Utils.hmac(key, hash1 + hash2)
    end

    private

    def create_initial_macaroon_signature(key, identifier)
      derived_key = Utils.generate_derived_key(key)
      Utils.hmac(derived_key, identifier)
    end

  end
end


text:
package org.apereo.cas.uma.discovery;

import org.apereo.cas.uma.web.controllers.BaseUmaEndpointControllerTests;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is {@link UmaServerDiscoverySettingsFactoryTests}.
 *
 * @author Misagh Moayyed
 * @since 6.3.0
 */
@Tag("UMA")
public class UmaServerDiscoverySettingsFactoryTests extends BaseUmaEndpointControllerTests {
    @Test
    public void verifyOperation() {
        assertNotNull(discoverySettings.getAuthorizationEndpoint());
        assertNotNull(discoverySettings.getAuthorizationRequestEndpoint());
        assertNotNull(discoverySettings.getDynamicClientEndpoint());
        assertNotNull(discoverySettings.getIntrospectionEndpoint());
        assertNotNull(discoverySettings.getPermissionRegistrationEndpoint());
        assertNotNull(discoverySettings.getRequestingPartyClaimsEndpoint());
        assertNotNull(discoverySettings.getResourceSetRegistrationEndpoint());
        assertNotNull(discoverySettings.getTokenEndpoint());
    }

}


text:
<?php
namespace Brainwave\Filesystem\Adapters;

use \OpenCloud\OpenStack;
use \League\Flysystem\Adapter\Rackspace;
use \OpenCloud\ObjectStore\Resource\Container;
use \Brainwave\Filesystem\Adapters\Interfaces\ConnectorInterface;

/**
 * ConnectionFactory
 *
 * @package Narrowspark/framework
 * @author  Daniel Bannert
 * @since   0.9.3-dev
 *
 */
class RackspaceConnector implements ConnectorInterface
{
    /**
     * Establish an adapter connection.
     *
     * @param  array  $config
     * @return \League\Flysystem\Adapter\Rackspace
     */
    public function connect(array $config)
    {
        $auth = $this->getAuth($config);
        $client = $this->getClient($auth);

        return $this->getAdapter($client);
    }

    /**
     * Get the authentication data.
     *
     * @param  array  $config
     * @return array
     *
     * @throws \InvalidArgumentException
     */
    protected function getAuth(array $config)
    {
        if (!array_key_exists('username', $config) || ! array_key_exists('password', $config)) {
            throw new \InvalidArgumentException('The rackspace connector requires authentication.');
        }

        if (!array_key_exists('endpoint', $config) || ! array_key_exists('container', $config)) {
            throw new \InvalidArgumentException('The rackspace connector requires configuration.');
        }

        return array_only($config, ['username', 'password', 'endpoint', 'container']);
    }

    /**
     * Get the rackspace client.
     *
     * @param  array  $auth
     * @return \OpenCloud\ObjectStore\Resource\Container
     */
    protected function getClient(array $auth)
    {
        $client = new OpenStack($auth['endpoint'], [
            'username' => $auth['username'],
            'password' => $auth['password'],
        ]);

        return $client->objectStoreService('cloudFiles', 'LON')->getContainer($auth['container']);
    }

    /**
     * Get the rackspace adapter.
     *
     * @param  \OpenCloud\ObjectStore\Resource\Container  $client
     * @return \League\Flysystem\Adapter\Rackspace
     */
    protected function getAdapter(Container $client)
    {
        return new Rackspace($client);
    }
}


text:
#include "hphp/runtime/ext/extension.h"
#include "hphp/runtime/vm/native-data.h"

#include "CommandStartedEvent.h"

namespace HPHP {

const StaticString s_MongoDriverMonitoringCommandStartedEvent_className("MongoDB\\Driver\\Monitoring\\CommandStartedEvent");
const StaticString s_MongoDriverMonitoringCommandStartedEvent_command("command");
const StaticString s_MongoDriverMonitoringCommandStartedEvent_databaseName("databaseName");

}


text:
<?php
namespace Test\Unit\Result;

require_once dirname(dirname(__DIR__)) . '/Setup.php';

use Test\Setup;
use Braintree;

class ErrorTest extends Setup
{
    public function testCallingNonExsitingFieldReturnsNull()
    {
        $result = new Braintree\Result\Error(['errors' => [], 'params' => [], 'message' => 'briefly describe']);
        $this->assertNull($result->transaction);
    }
}


text:
/**
 * <p>
 * Amazon DocumentDB API documentation
 * </p>
 */
package com.amazonaws.services.docdb;


text:
using std::cerr;
using std::endl;
#endif // DEBUG

namespace FbTk {

EventManager *EventManager::instance() {
    static EventManager ev;
    return &ev;
}

EventManager::~EventManager() {
#ifdef DEBUG
    if (m_eventhandlers.size() != 0)
        cerr<<"FbTk::EventManager: Warning: unregistered eventhandlers!"<<endl;
#endif // DEBUG
}

void EventManager::handleEvent(XEvent &ev) {
    dispatch(ev.xany.window, ev);
}

void EventManager::add(EventHandler &ev, const FbWindow &win) {
    registerEventHandler(ev, win.window());
}

void EventManager::addParent(EventHandler &ev, const FbWindow &win) {
    if (win.window() != 0)
        m_parent[win.window()] = &ev;
}

void EventManager::remove(const FbWindow &win) {
    unregisterEventHandler(win.window());
}

EventHandler *EventManager::find(Window win) {
    return m_eventhandlers[win];
}

bool EventManager::grabKeyboard(Window win) {
    int ret = XGrabKeyboard(App::instance()->display(), win, False,
                            GrabModeAsync, GrabModeAsync, CurrentTime);
    return (ret == Success);
}

void EventManager::ungrabKeyboard() {
    XUngrabKeyboard(App::instance()->display(), CurrentTime);
}

Window EventManager::getEventWindow(XEvent &ev) {
    // we only have cases for events that differ from xany
    switch (ev.type) {
    case CreateNotify:
        // XCreateWindowEvent
        return ev.xcreatewindow.window;
        break;
    case DestroyNotify:
        // XDestroyWindowEvent
        return ev.xdestroywindow.window;
        break;
    case UnmapNotify:
        // XUnmapEvent
        return ev.xunmap.window;
        break;
    case MapNotify:
        // XMapEvent
        return ev.xmap.window;
        break;
    case MapRequest:
        // XMapRequestEvent
        return ev.xmaprequest.window;
        break;
    case ReparentNotify:
        // XReparentEvent
        return ev.xreparent.window;
        break;
    case ConfigureNotify:
        // XConfigureNotify
        return ev.xconfigure.window;
        break;
    case GravityNotify:
        // XGravityNotify
        return ev.xgravity.window;
        break;
    case ConfigureRequest:
        // XConfigureRequestEvent
        return ev.xconfigurerequest.window;
        break;
    case CirculateNotify:
        // XCirculateEvent
        return ev.xcirculate.window;
        break;
    case CirculateRequest:
        // XCirculateRequestEvent
        return ev.xcirculaterequest.window;
        break;
    default:
        return ev.xany.window;
    }
}

void EventManager::registerEventHandler(EventHandler &ev, Window win) {
    if (win != None)
        m_eventhandlers[win] = &ev;
}

void EventManager::unregisterEventHandler(Window win) {
    if (win != None) {
        m_eventhandlers.erase(win);
        m_parent.erase(win);
    }
}

void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
    EventHandler *evhand = 0;
    if (parent) {
        EventHandlerMap::iterator it = m_parent.find(win);
        if (it == m_parent.end())
            return;
        else
            evhand = it->second;
    } else {
        win = getEventWindow(ev);
        EventHandlerMap::iterator it = m_eventhandlers.find(win);
        if (it == m_eventhandlers.end())
            return;
        else
            evhand = it->second;
    }

    if (evhand == 0)
        return;

    switch (ev.type) {
    case KeyPress:
        if (!XFilterEvent(&ev, win))
            evhand->keyPressEvent(ev.xkey);
    break;
    case KeyRelease:
        evhand->keyReleaseEvent(ev.xkey);
    break;
    case ButtonPress:
        evhand->buttonPressEvent(ev.xbutton);
    break;
    case ButtonRelease:
        evhand->buttonReleaseEvent(ev.xbutton);
    break;
    case MotionNotify:
        evhand->motionNotifyEvent(ev.xmotion);
    break;
    case Expose:
        evhand->exposeEvent(ev.xexpose);
    break;
    case EnterNotify:
        evhand->enterNotifyEvent(ev.xcrossing);
    break;
    case LeaveNotify:
        if (ev.xcrossing.mode != NotifyGrab &&
            ev.xcrossing.mode != NotifyUngrab)
            evhand->leaveNotifyEvent(ev.xcrossing);
    break;
    default:
        evhand->handleEvent(ev);
    break;
    };

    // find out which window is the parent and
    // dispatch event
    Window root, parent_win, *children = 0;
    unsigned int num_children;
    if (XQueryTree(FbTk::App::instance()->display(), win,
                   &root, &parent_win, &children, &num_children) != 0) {
        if (children != 0)
            XFree(children);

        if (parent_win != 0 &&
            parent_win != root) {
            if (m_parent[parent_win] == 0)
                return;

            // dispatch event to parent
            dispatch(parent_win, ev, true);
        }
    }

}

} // end namespace FbTk


text:
<?php namespace Zizaco\Entrust\Traits;

/**
 * This file is part of Entrust,
 * a role & permission management solution for Laravel.
 *
 * @license MIT
 * @package Zizaco\Entrust
 */

use Illuminate\Cache\TaggableStore;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Cache;

trait EntrustRoleTrait
{
    //Big block of caching functionality.
    public function cachedPermissions()
    {
        $rolePrimaryKey = $this->primaryKey;
        $cacheKey = 'entrust_permissions_for_role_'.$this->$rolePrimaryKey;
        if(Cache::getStore() instanceof TaggableStore) {
            return Cache::tags(Config::get('entrust.permission_role_table'))->remember($cacheKey, Config::get('cache.ttl'), function () {
                return $this->perms()->get();
            });
        }
        else return $this->perms()->get();
    }
    public function save(array $options = [])
    {   //both inserts and updates
        if(!parent::save($options)){
            return false;
        }
        if(Cache::getStore() instanceof TaggableStore) {
            Cache::tags(Config::get('entrust.permission_role_table'))->flush();
        }
        return true;
    }
    public function delete(array $options = [])
    {   //soft or hard
        if(!parent::delete($options)){
            return false;
        }
        if(Cache::getStore() instanceof TaggableStore) {
            Cache::tags(Config::get('entrust.permission_role_table'))->flush();
        }
        return true;
    }
    public function restore()
    {   //soft delete undo's
        if(!parent::restore()){
            return false;
        }
        if(Cache::getStore() instanceof TaggableStore) {
            Cache::tags(Config::get('entrust.permission_role_table'))->flush();
        }
        return true;
    }

    /**
     * Many-to-Many relations with the user model.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function users()
    {
        return $this->belongsToMany(Config::get('auth.providers.users.model'), Config::get('entrust.role_user_table'),Config::get('entrust.role_foreign_key'),Config::get('entrust.user_foreign_key'));
       // return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'));
    }

    /**
     * Many-to-Many relations with the permission model.
     * Named "perms" for backwards compatibility. Also because "perms" is short and sweet.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function perms()
    {
        return $this->belongsToMany(Config::get('entrust.permission'), Config::get('entrust.permission_role_table'), Config::get('entrust.role_foreign_key'), Config::get('entrust.permission_foreign_key'));
    }

    /**
     * Boot the role model
     * Attach event listener to remove the many-to-many records when trying to delete
     * Will NOT delete any records if the role model uses soft deletes.
     *
     * @return void|bool
     */
    public static function boot()
    {
        parent::boot();

        static::deleting(function($role) {
            if (!method_exists(Config::get('entrust.role'), 'bootSoftDeletes')) {
                $role->users()->sync([]);
                $role->perms()->sync([]);
            }

            return true;
        });
    }

    /**
     * Checks if the role has a permission by its name.
     *
     * @param string|array $name       Permission name or array of permission names.
     * @param bool         $requireAll All permissions in the array are required.
     *
     * @return bool
     */
    public function hasPermission($name, $requireAll = false)
    {
        if (is_array($name)) {
            foreach ($name as $permissionName) {
                $hasPermission = $this->hasPermission($permissionName);

                if ($hasPermission && !$requireAll) {
                    return true;
                } elseif (!$hasPermission && $requireAll) {
                    return false;
                }
            }

            // If we've made it this far and $requireAll is FALSE, then NONE of the permissions were found
            // If we've made it this far and $requireAll is TRUE, then ALL of the permissions were found.
            // Return the value of $requireAll;
            return $requireAll;
        } else {
            foreach ($this->cachedPermissions() as $permission) {
                if ($permission->name == $name) {
                    return true;
                }
            }
        }

        return false;
    }

    /**
     * Save the inputted permissions.
     *
     * @param mixed $inputPermissions
     *
     * @return void
     */
    public function savePermissions($inputPermissions)
    {
        if (!empty($inputPermissions)) {
            $this->perms()->sync($inputPermissions);
        } else {
            $this->perms()->detach();
        }
    }

    /**
     * Attach permission to current role.
     *
     * @param object|array $permission
     *
     * @return void
     */
    public function attachPermission($permission)
    {
        if (is_object($permission)) {
            $permission = $permission->getKey();
        }

        if (is_array($permission)) {
            $permission = $permission['id'];
        }

        $this->perms()->attach($permission);
    }

    /**
     * Detach permission from current role.
     *
     * @param object|array $permission
     *
     * @return void
     */
    public function detachPermission($permission)
    {
        if (is_object($permission))
            $permission = $permission->getKey();

        if (is_array($permission))
            $permission = $permission['id'];

        $this->perms()->detach($permission);
    }

    /**
     * Attach multiple permissions to current role.
     *
     * @param mixed $permissions
     *
     * @return void
     */
    public function attachPermissions($permissions)
    {
        foreach ($permissions as $permission) {
            $this->attachPermission($permission);
        }
    }

    /**
     * Detach multiple permissions from current role
     *
     * @param mixed $permissions
     *
     * @return void
     */
    public function detachPermissions($permissions = null)
    {
        if (!$permissions) $permissions = $this->perms()->get();

        foreach ($permissions as $permission) {
            $this->detachPermission($permission);
        }
    }
}


text:
package geonote.app.Activity;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.SystemClock;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import geonote.app.Fragments.SplashScreenFragment;
import geonote.app.R;
import geonote.app.Receiver.AlarmReceiver;

import io.fabric.sdk.android.Fabric;
import com.crashlytics.android.Crashlytics;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SplashScreenActivity extends FragmentActivity {

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

        Fabric.with(this, new Crashlytics());

        try {

            PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);

            for (Signature signature : info.signatures)
            {
                MessageDigest md = MessageDigest.getInstance("SHA");
                Log.d("MessageDigest, Sig:", signature.toCharsString());

                md.update(signature.toByteArray());

                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }

        } catch (PackageManager.NameNotFoundException e) {
            Log.e("name not found", e.toString());
        } catch (NoSuchAlgorithmException e) {
            Log.e("no such an algorithm", e.toString());
        }

        setContentView(R.layout.activity_splash_screen);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new SplashScreenFragment())
                    .commit();
        }

        startAlarmManager();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_splash_screen, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void startAlarmManager() {
        Log.d("SplashScreenActivity", "startAlarmManager");

        Context context = getBaseContext();
        AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        Intent tIntent = new Intent(context, AlarmReceiver.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, tIntent, 0);

        alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                SystemClock.elapsedRealtime(),
                60 * 60 * 1000, // wake up every hour
                pendingIntent);
    }
}


text:
const requestWithCache = require("./requestWithCache").requestWithCache;
const cheerio = require("cheerio");

function getSlam40Songs() {
//

//
2

//

//

//
Starboy

//
The Weeknd

//

//
//

  const interval = 64800000; // 18 hours

  return requestWithCache("http://www.slam.nl/slam40/", interval)
    .then(body => cheerio.load(body))
    .then($ => {
      const songs = [];

      $(".listing").each(function() {

        const nr = $(this).find('.nmbr').text();
        const artist = $(this).find('.excerpt').text();
        const title = $(this).find('.title').text();

        if( !songs.find(s => s.nr === nr && s.title === title ) ) {

          songs.push({
            nr,
            artist,
            title
          });

        }
      });

      return songs;
    })
}

module.exports = getSlam40Songs;


text:
import styled from "styled-components";
import { PropTypes } from "prop-types";

import { errorColor } from "style/styleFunctions";

const TableCol = styled.div`
  ${props =>
    props.errorPercent ? `color: ${errorColor(props.errorPercent)}` : ""};
  flex: 1 1 12%;
  text-align: left;
`;

TableCol.propTypes = {
  errorPercent: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};

export default TableCol;


text:
@interface PodsDummy_STFPSIndicator : NSObject
@end
@implementation PodsDummy_STFPSIndicator
@end


text:
require 'syobocal/db/object'
require 'syobocal/db/api_request'

module Syobocal
  module DB

    def fetch_titles(tid: nil, lastupdate_from: nil, lastupdate_to: nil)
      params = []
      params << "Command=TitleLookup"
      if tid
        params << "TID=" + comma_separated_str(tid)
      else
        params << "TID=*"
      end

      if lastupdate_from || lastupdate_to
        params << "LastUpdate=" + format_from_to(lastupdate_from, lastupdate_to)
      end

      xml = APIRequest.req(params)
      Object::Title.eager_load(xml)
    end

    def fetch_programs(tid: nil, chid: nil, range_from: nil, range_to: nil, count: nil, lastupdate_from: nil, lastupdate_to: nil, pid: nil)
      params = []
      params << "Command=ProgLookup"
      params << "TID="   + comma_separated_str(tid)   if tid
      params << "ChID="  + comma_separated_str(chid)  if chid
      params << "Count=" + comma_separated_str(count) if count
      params << "PID="   + comma_separated_str(pid)   if pid

      if range_from && range_to
        params << "Range=" + format_from_to(range_from, range_to)
      end

      if lastupdate_from || lastupdate_to
        params << "LastUpdate=" + format_from_to(lastupdate_from, lastupdate_to)
      end

      xml = APIRequest.req(params)
      Object::Program.eager_load(xml)
    end

    def fetch_channels(chid: nil, lastupdate_from: nil, lastupdate_to: nil)
      params = []
      params << "Command=ChLookup"
      params << "ChID=" + comma_separated_str(chid) if chid

      if lastupdate_from || lastupdate_to
        params << "LastUpdate=" + format_from_to(lastupdate_from, lastupdate_to)
      end

      xml = APIRequest.req(params)
      Object::Channel.load(xml)
    end

    def fetch_channel_groups(ch_gid: nil, lastupdate_from: nil, lastupdate_to: nil)
      params = []
      params << "Command=ChGroupLookup"
      params << "ChID=" + comma_separated_str(ch_gid) if ch_gid

      if lastupdate_from || lastupdate_to
        params << "LastUpdate=" + format_from_to(lastupdate_from, lastupdate_to)
      end

      xml = APIRequest.req(params)
      Object::ChannelGroup.load(xml)
    end

    private
    def format_from_to(from, to)
      format_datetime(from) + "-" + format_datetime(to)
    end

    def format_datetime(datetime)
      datetime ? datetime.strftime("%Y%m%d_%H%M%S") : ""
    end

    def comma_separated_str(integer_or_integers)
      if integer_or_integers.is_a? Integer
        return integer_or_integers.to_s
      else
        array = []
        integer_or_integers.each do |i|
          array << i.to_s
        end
        return array.join(",")
      end
    end

  end
end