text:
package lib

import (
	"fmt"
	"io/ioutil"
	"net"
	"net/url"
	"os"
	"path"
	"runtime"
	"strings"

	"github.com/appc/acbuild/registry"
	"github.com/appc/acbuild/util"

	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/appc/spec/aci"
	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/appc/spec/discovery"
	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/appc/spec/schema"
	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/appc/spec/schema/types"
	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/coreos/rkt/pkg/fileutil"
	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/coreos/rkt/pkg/uid"
)

var (
	placeholdername = "acbuild-unnamed"
)

// Begin will start a new build, storing the untarred ACI the build operates on
// at a.CurrentACIPath. If start is the empty string, the build will begin with
// an empty ACI, otherwise the ACI stored at start will be used at the starting
// point.
func (a *ACBuild) Begin(start string, insecure bool) (err error) {
	_, err = os.Stat(a.ContextPath)
	switch {
	case os.IsNotExist(err):
		break
	case err != nil:
		return err
	default:
		return fmt.Errorf("build already in progress in this working dir")
	}

	err = os.MkdirAll(a.ContextPath, 0755)
	if err != nil {
		return err
	}

	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	defer func() {
		// If there was an error while beginning, we don't want to produce an
		// unexpected build context
		if err != nil {
			os.RemoveAll(a.ContextPath)
		}
	}()

	if start != "" {
		err = os.MkdirAll(a.CurrentACIPath, 0755)
		if err != nil {
			return err
		}
		if start[0] == '.' || start[0] == '/' {
			finfo, err := os.Stat(start)
			switch {
			case os.IsNotExist(err):
				return fmt.Errorf("no such file or directory: %s", start)
			case err != nil:
				return err
			case finfo.IsDir():
				a.beginFromLocalDirectory(start)
			default:
				return a.beginFromLocalImage(start)
			}
		} else {
			return a.beginFromRemoteImage(start, insecure)
		}
	}
	return a.beginWithEmptyACI()
}

func (a *ACBuild) beginFromLocalImage(start string) error {
	finfo, err := os.Stat(start)
	if err != nil {
		return err
	}
	if finfo.IsDir() {
		return fmt.Errorf("provided starting ACI is a directory: %s", start)
	}
	return util.ExtractImage(start, a.CurrentACIPath, nil)
}

func (a *ACBuild) beginFromLocalDirectory(start string) error {
	err := os.MkdirAll(a.CurrentACIPath, 0755)
	if err != nil {
		return err
	}

	err = fileutil.CopyTree(start, path.Join(a.CurrentACIPath, aci.RootfsDir), uid.NewBlankUidRange())
	if err != nil {
		return err
	}

	return a.writeEmptyManifest()
}

func (a *ACBuild) beginWithEmptyACI() error {
	err := os.MkdirAll(path.Join(a.CurrentACIPath, aci.RootfsDir), 0755)
	if err != nil {
		return err
	}

	return a.writeEmptyManifest()
}

func (a *ACBuild) writeEmptyManifest() error {
	acid, err := types.NewACIdentifier("acbuild-unnamed")
	if err != nil {
		return err
	}

	archlabel, err := types.NewACIdentifier("arch")
	if err != nil {
		return err
	}

	oslabel, err := types.NewACIdentifier("os")
	if err != nil {
		return err
	}

	manifest := &schema.ImageManifest{
		ACKind:    schema.ImageManifestKind,
		ACVersion: schema.AppContainerVersion,
		Name:      *acid,
		Labels: types.Labels{
			types.Label{
				*archlabel,
				runtime.GOARCH,
			},
			types.Label{
				*oslabel,
				runtime.GOOS,
			},
		},
	}

	manblob, err := manifest.MarshalJSON()
	if err != nil {
		return err
	}

	manfile, err := os.Create(path.Join(a.CurrentACIPath, aci.ManifestFile))
	if err != nil {
		return err
	}

	_, err = manfile.Write(manblob)
	if err != nil {
		return err
	}

	err = manfile.Close()
	if err != nil {
		return err
	}

	return nil
}

func (a *ACBuild) beginFromRemoteImage(start string, insecure bool) error {
	// Check if we're starting with a docker image
	if strings.HasPrefix(start, "docker://") {
		// TODO use docker2aci
		return fmt.Errorf("docker containers are currently unsupported")
	}

	app, err := discovery.NewAppFromString(start)
	if err != nil {
		return err
	}
	labels, err := types.LabelsFromMap(app.Labels)
	if err != nil {
		return err
	}

	tmpDepStoreTarPath, err := ioutil.TempDir("", "acbuild-begin-tar")
	if err != nil {
		return err
	}
	defer os.RemoveAll(tmpDepStoreTarPath)

	tmpDepStoreExpandedPath, err := ioutil.TempDir("", "acbuild-begin-expanded")
	if err != nil {
		return err
	}
	defer os.RemoveAll(tmpDepStoreExpandedPath)

	reg := registry.Registry{
		DepStoreTarPath:      tmpDepStoreTarPath,
		DepStoreExpandedPath: tmpDepStoreExpandedPath,
		Insecure:             insecure,
		Debug:                a.Debug,
	}

	err = reg.Fetch(app.Name, labels, 0, false)
	if err != nil {
		if urlerr, ok := err.(*url.Error); ok {
			if operr, ok := urlerr.Err.(*net.OpError); ok {
				if dnserr, ok := operr.Err.(*net.DNSError); ok {
					if dnserr.Err == "no such host" {
						return fmt.Errorf("unknown host when fetching image, check your connection and local file paths must start with '/' or '.'")
					}
				}
			}
		}
		return err
	}

	files, err := ioutil.ReadDir(tmpDepStoreTarPath)
	if err != nil {
		return err
	}

	if len(files) != 1 {
		var filelist string
		for _, file := range files {
			if filelist == "" {
				filelist = file.Name()
			} else {
				filelist = filelist + ", " + file.Name()
			}
		}
		panic("unexpected number of files in store after download: " + filelist)
	}

	return util.ExtractImage(path.Join(tmpDepStoreTarPath, files[0].Name()), a.CurrentACIPath, nil)
}


text:
<mz-navbar class="navbar-fixed" navbarClass="margem">
  menu
  Systema
  <mz-navbar-item-container [align]="'right'">
    <mz-navbar-item>Perfil</mz-navbar-item>
    <mz-navbar-item>Sair </mz-navbar-item>
  </mz-navbar-item-container>
</mz-navbar>

redpajama_set_name: RedPajamaGithub


text:
<meta charset="utf-8">
<title>Battery monitoring on user phone – By vliux.me</title>
<meta name="description" content="">
<meta name="keywords" content="">

<meta property="og:locale" content="en_US">
<meta property="og:title" content="Battery monitoring on user phone – By vliux.me">
<meta property="og:description" content="There are much more differences between mobile application development and servier-side/PC-client development. Mostly...">
<meta property="og:url" content="http://vliux.me/blog,/android/battery-monitoring-on-user-phone/">
<meta property="og:site_name" content="By vliux.me">

<link href="http://vliux.me/feed.xml" type="application/atom+xml" rel="alternate" title="By vliux.me Feed">

<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="http://vliux.me/assets/css/crimson.css" rel='stylesheet' type='text/css' />
<link href="/assets/css/sourcesanspro.css" rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://vliux.me/assets/css/entypo.css" media="all">

<link rel="stylesheet" href="http://vliux.me/assets/css/i.css">

<meta http-equiv="cleartype" content="on">

<link rel="shortcut icon" href="http://vliux.me/favicon.ico">

        <hgroup>

By vliux.me

        </hgroup>
        ☰

                  Home

                  Drawings

                  Photos

                  Tech

                  About

          <hgroup>

Battery monitoring on user phone

Jan 30, 2015

          </hgroup>

            There are much more differences between mobile application development and servier-side/PC-client development. Mostly because the system resources are limitied on mobile devices. Battery is one of such resources which direclty impacts the user experiences. However, it's quite easy for a novice to write code with low efficiency and high power consumption. Even experienced programmers may produce code which occasionaly drains the battery under some circumstances. In a result, the team will soon be immersed by mass of complains from users.

Things get more complicated if the app is large-scaled, and it's difficult to reproduce the abnormal power consumption cases in test environment. So, a mechanism is required to monitor the consumption on end-user's phones --- the production environment. With the machnism, we should be able to obtain information about the circumstance, which helps to identify the hotspots.

Generally speaking the monitoring incluses three phases:

1. Consumption checking: calculate the power usage of current application periodically.

2. Behavior detection: collects the behaviors of the application which may lead to battery drain.

3. Reporting: Report the collected information of 1 and 2 to a backend server for further analysis.

Check battery consumption periodically

Implement the power consumtion calculation in a service, and then use AlarmManager to startService() repeatedly, 24 hours etc. In order to minizie the side-effect of the service, use AlarmManager.setInexactRepeating() instead of setRepeating().

On Android devices before 4.4 Kitkat, as the BATTERY_STATS permission is still applicable for 3rd party applications, thelogic of BatteryStatsHelper can be copied and applied into your application, which calculates the consumption from processes, wakelocks, WiFi traffic and sensors, not only your application, but also others installed. The Helper gets the data from an Android system service named BatteryStats. As BatteryStats is a hidden class, you need to rely on Java reflection to invoke methods and fetch field values.

On Android versions greater or equal to 4.4, you can use other methodologies to simulate the actual consumption. For example, get the CPU time from files in /proc. The data is not as accurate as from BatteryStats, but better than nothing.

With the consumpton data, a series of bars can be tested against. If any of the following bars is reached, the consumption is regarded as abnormally high. You can add any additional criteria for a broder checking.

the background power consumption of your application process is among the topest N of all the applications on the given phone.

the power consumption from wake locks and cpu is more than X% greater than last check.

(You need to decide the exact number of N and X for your business scenario)

The data from battery checking are not precise, but if you collects them from a large number of user devices, you can figure out the consumption level of current application version. Use them as a criterion verify whether the refactory of code decreases the cosumption or not.

Behavior detection

Consumption data don't tell you which part of your code eats up the battery. To get that information, use local version of XposedBridge. First identify the API which may lead to high consumption, and hook them. In your hooked method callback, collect the information as below:

ActivityThread.handleReceiver()
: concrete Broadcast receiver classes called, times of invokation, and execution time-span of onReceive().

AlarmManager.setRepeating(), .setInExactRepeating(), .setExact()
: whether it's a wake-up alarm, the interval time-span, the target of PendingIntent.

AsyncTask.doInBackground()
: concrete AsyncTask classes, the times and length of doInBackground() invokation.

Binder.transact()
: concrete Binder classes, the times and length of the invokation. This covers the cases of inter-process Service execution.

ContentProvider.query(), .insert(), .update(), .delete()
: concrete ContentProvider classes, the times and length of invokation.

SensorEventListener.onSensorChanged(), .onAccuracyChanged()
: concrete classes of SensorEventListener, the times and length of invokations.

Service.start()
: concrete classes of Service, the times and length of the invokations.

Thread.start()
: concrete classes of Thread, the times and length of the invokations.

WakeLock.acquire(), .release()
: the callers of the methods, the wakelock tags, the length of holding the wakelocks.

WifiManager.startScan()
: the callers of the method, the times and length of the invokations.

WifiManager.createWifiLock()
: the caller of the method, the type of wifi lock, the times of the invokations.

There should be more points beyond this list for hooking, like network operations. Also, the above only includes the points at Android SDK level. If your application relies on some 3rd party libraries, you can also hook APIs there, to have the information more accurate, because those 3rd-party APIs may be closer to the app level code.

Analysis

Collecting the consumption and behavior data is only the first step to our purpose. By analyzing a large number of this kind of data should be able to help us pick out the most suspicious points inside the code. Today I have just taken the first step, I will come back to your when I have collected more data and have some experiences of analysis stories.

          <link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">

Recent Posts

              [最后的游侠]御灵校尉
              Nov 24, 2018

              [最后的游侠]Bravery_3
              Nov 12, 2018

              [最后的游侠]Bravery_2
              Nov 05, 2018

@Email

500px

500px中国

Instagram

    © 2018 vliux. Powered by Jekyll using the Balzac theme.


text:
using LeanCloud.Realtime.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeanCloud.Realtime
{
    /// <summary>
    /// 纯文本信息
    /// </summary>
    public class AVIMTextMessage : AVIMMessage
    {
        /// <summary>
        /// 构建一个文本信息 <see cref="AVIMTextMessage"/> class.
        /// </summary>
        public AVIMTextMessage()
        {

        }
        /// <summary>
        /// 文本内容
        /// </summary>
        public string TextContent { get; set; }

        /// <summary>
        /// 构造一个纯文本信息
        /// </summary>
        /// <param name="textContent"></param>
        public AVIMTextMessage(string textContent)
            : this()
        {
            TextContent = textContent;
        }

        /// <summary>
        /// 构建文本消息
        /// </summary>
        /// <returns></returns>
        public override Task<AVIMMessage> MakeAsync()
        {
            this.Attribute(AVIMProtocol.LCTYPE, -1);
            this.Attribute(AVIMProtocol.LCTEXT, TextContent);
            return Task.FromResult<AVIMMessage>(this);
        }

        public override Task<AVIMMessage> RestoreAsync(IDictionary<string, object> estimatedData)
        {
            throw new NotImplementedException();
        }
    }
}


text:
package com.facebook.buck.android;

import com.facebook.buck.android.apkmodule.APKModule;
import com.facebook.buck.android.exopackage.ExopackageMode;
import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.core.rulekey.AddToRuleKey;
import com.facebook.buck.core.rulekey.AddsToRuleKey;
import com.facebook.buck.core.sourcepath.SourcePath;
import com.facebook.buck.core.sourcepath.resolver.SourcePathResolverAdapter;
import com.facebook.buck.core.toolchain.tool.Tool;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.step.Step;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import java.io.File;
import java.nio.file.Path;
import java.util.EnumSet;
import java.util.Optional;
import java.util.function.Supplier;

/**
 * The class is responsible to create final bundle by taking individual module information and
 * passing to {@link com.android.bundle.Config.Bundletool} through {@link AabBuilderStep}.
 */
public class AndroidBundleBuildable extends AndroidBinaryBuildable implements AddsToRuleKey {
  // Path to Bundles config file
  @AddToRuleKey protected final Optional<SourcePath> bundleConfigFilePath;

  AndroidBundleBuildable(
      BuildTarget buildTarget,
      ProjectFilesystem filesystem,
      SourcePath keystorePath,
      SourcePath keystorePropertiesPath,
      EnumSet<ExopackageMode> exopackageModes,
      int xzCompressionLevel,
      boolean packageAssetLibraries,
      boolean compressAssetLibraries,
      Optional<CompressionAlgorithm> assetCompressionAlgorithm,
      Tool javaRuntimeLauncher,
      SourcePath androidManifestPath,
      DexFilesInfo dexFilesInfo,
      NativeFilesInfo nativeFilesInfo,
      ResourceFilesInfo resourceFilesInfo,
      ImmutableSortedSet<APKModule> apkModules,
      ImmutableMap<APKModule, SourcePath> moduleResourceApkPaths,
      Optional<SourcePath> bundleConfigFilePath) {
    super(
        buildTarget,
        filesystem,
        keystorePath,
        keystorePropertiesPath,
        exopackageModes,
        xzCompressionLevel,
        packageAssetLibraries,
        compressAssetLibraries,
        assetCompressionAlgorithm,
        javaRuntimeLauncher,
        androidManifestPath,
        dexFilesInfo,
        nativeFilesInfo,
        resourceFilesInfo,
        apkModules,
        moduleResourceApkPaths,
        BinaryType.AAB);
    this.bundleConfigFilePath = bundleConfigFilePath;
  }

  @Override
  void getBinaryTypeSpecificBuildSteps(
      ImmutableList.Builder<Step> steps,
      ImmutableModuleInfo.Builder baseModuleInfo,
      Supplier<KeystoreProperties> keystoreProperties,
      ImmutableSet.Builder<Path> nativeLibraryDirectoriesBuilder,
      ImmutableSet<Path> allAssetDirectories,
      SourcePathResolverAdapter pathResolver,
      ImmutableSet<Path> thirdPartyJars,
      ImmutableSet.Builder<Path> zipFiles,
      ImmutableSet.Builder<ModuleInfo> modulesInfo) {

    addAdditionalDexes(baseModuleInfo, pathResolver);

    baseModuleInfo
        .setResourceApk(pathResolver.getAbsolutePath(resourceFilesInfo.resourcesApkPath).getPath())
        .addDexFile(
            pathResolver
                .getRelativePath(getProjectFilesystem(), dexFilesInfo.primaryDexPath)
                .getPath())
        .setJarFilesThatMayContainResources(thirdPartyJars)
        .setZipFiles(zipFiles.build());

    modulesInfo.add(baseModuleInfo.build());

    Optional<Path> bundleConfigPath;
    bundleConfigPath =
        bundleConfigFilePath.map(sourcePath -> pathResolver.getAbsolutePath(sourcePath).getPath());

    steps.add(
        new AabBuilderStep(
            getProjectFilesystem(),
            AndroidBinaryPathUtility.getSignedApkPath(
                getProjectFilesystem(), getBuildTarget(), binaryType),
            bundleConfigPath,
            getBuildTarget(),
            false,
            modulesInfo.build()));
  }

  private void addAdditionalDexes(
      ImmutableModuleInfo.Builder baseModuleInfo, SourcePathResolverAdapter pathResolver) {
    ImmutableSet<String> moduleNames =
        apkModules.stream().map(APKModule::getName).collect(ImmutableSet.toImmutableSet());

    // TODO: longinoa - this does not support {@link NonPreDexedDexBuildable} ie
    // shouldPreDex=false
    for (Path path : dexFilesInfo.getSecondaryDexDirs(getProjectFilesystem(), pathResolver)) {
      if (path.getFileName().toString().equals("additional_dexes")) {
        File[] assetFiles = path.toFile().listFiles();
        if (assetFiles == null) {
          continue;
        }
        for (File assetFile : assetFiles) {
          if (!assetFile.getName().equals("assets")) {
            continue;
          }
          File[] modules = assetFile.listFiles();
          if (modules == null) {
            continue;
          }
          for (File module : modules) {
            if (moduleNames.contains(module.getName())) {
              continue;
            }
            baseModuleInfo.putAssetDirectories(module.toPath(), "assets");
          }
        }
      } else {
        baseModuleInfo.putAssetDirectories(path, "");
      }
    }
  }
}


text:
<!DOCTYPE html>

    <title>Chapter 24: "Home Again" | The Wonderful Wizard of Oz | L. Frank Baum | Lit2Go ETC</title>
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/screenless.css" type="text/css" media="screen" title="no title" charset="utf-8">
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/printless.css" type="text/css" media="print" title="no title" charset="utf-8">

          Lit2Go

<form action="http://etc.usf.edu/lit2go/search/"><input type="text" name="q" placeholder="Search" value=""></form>

Authors

Books

Genres

Collections

Readability

      The Wonderful Wizard of Oz

      by L. Frank Baum

      Chapter 24: "Home Again"

        Additional Information

            Year Published:
            1900

            Language:
            English

            Country of Origin:
            United States of America

            Source:
            Baum, F. L. (1900).  The Wonderful Wizard of Oz.  New York: George M. Hill.

            Readability:

                Flesch–Kincaid Level:
                6.0

            Word Count:
            84

            Genre:
            Fantasy

            Keywords:
            20th century literature, american literature, books of oz, fantasy, l. frank baum, self-help

            ✎ Cite This

  Share
  |

Downloads

          Audio

          Passage PDF

Student Activity

            APA

            MLA

            Chicago

            Baum, L. (1900). Chapter 24: "Home Again". The Wonderful Wizard of Oz (Lit2Go Edition). Retrieved February 15, 2016, from http://etc.usf.edu/lit2go/158/the-wonderful-wizard-of-oz/2769/chapter-24-home-again/

            Baum, L. Frank. "Chapter 24: "Home Again"." The Wonderful Wizard of Oz. Lit2Go Edition. 1900. Web. <http://etc.usf.edu/lit2go/158/the-wonderful-wizard-of-oz/2769/chapter-24-home-again/>. February 15, 2016.

            L. Frank Baum, "Chapter 24: "Home Again"," The Wonderful Wizard of Oz, Lit2Go Edition, (1900), accessed February 15, 2016, http://etc.usf.edu/lit2go/158/the-wonderful-wizard-of-oz/2769/chapter-24-home-again/.

Back

                  <audio controls style="width:99%;">
            <source src="http://etc.usf.edu/lit2go/audio/mp3/the-wonderful-wizard-of-oz-025-chapter-24-home-again.2769.mp3" type="audio/mpeg" />
                          <source src="http://etc.usf.edu/lit2go/audio/ogg/the-wonderful-wizard-of-oz-025-chapter-24-home-again.2769.ogg" type="audio/ogg" />
                        The embedded audio player requires a modern internet browser. You should visit Browse Happy and update your internet browser today!
          </audio>

	Aunt Em had just come out of the house to water the cabbages when she looked up and saw Dorothy running toward her.

	“My darling child!” she cried, folding the little girl in her arms and covering her face with kisses. “Where in the world did you come from?”

	“From the Land of Oz,” said Dorothy gravely. “And here is Toto, too. And oh, Aunt Em! I’m so glad to be at home again!”

Back

            This collection of children's literature is a part of the Educational Technology Clearinghouse and is funded by various grants.

            Copyright © 2006—2016 by the Florida Center for Instructional Technology, College of Education, University of South Florida.

License

Credits

FAQ

Giving

This document was downloaded from Lit2Go, a free online collection of stories and poems in Mp3 (audiobook) format published by the Florida Center for Instructional Technology. For more information, including classroom activities, readability data, and original sources, please visit http://etc.usf.edu/lit2go/158/the-wonderful-wizard-of-oz/2769/chapter-24-home-again/.

Lit2Go: The Wonderful Wizard of Oz

Chapter 24: "Home Again"


text:
namespace ConsoleApp1.GenericBits
{
    struct Sample1
    {
        public byte A;
        public byte B;
        public ushort C;
        public uint D;
        public Sample1(byte a, byte b, ushort c, uint d) => (A, B, C, D) = (a, b, c, d);
        public override string ToString() => (A, B, C, D).ToString();
    }
}


text:
// This file was automatically generated by informer-gen

package core

import (
	v1 "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/core/v1"
	internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
)

// Interface provides access to each of this group's versions.
type Interface interface {
	// V1 provides access to shared informers for resources in V1.
	V1() v1.Interface
}

type group struct {
	internalinterfaces.SharedInformerFactory
}

// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
	return &group{f}
}

// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
	return v1.New(g.SharedInformerFactory)
}


text:
ansible-haproxy-role
====================
[![Build Status](https://travis-ci.org/kefniark/ansible-haproxy-role.svg?branch=master)](https://travis-ci.org/kefniark/ansible-haproxy-role)

This Ansible Role install and configure haproxy.

Current OS supported :
 - CentOS 6
 - Debian wheezy
 - Ubuntu 14

This repository is based on a MIT License

Install
-------------------------

This project is available on [Ansible Galaxy](https://galaxy.ansible.com/list#/roles/1240).
To install :
```
  ansible-galaxy install kefniark.haproxy-role
```

Documentation:
-------------------------

To see all available options, you can look to the [Documentation](https://github.com/kefniark/ansible-haproxy-role/blob/master/docs/main.yml).

This project also contains two examples :
 - A reverse proxy for a pre installed web server : [Exemple 1](https://github.com/kefniark/ansible-haproxy-role/blob/master/docs/exemple-simple-server.yml)
 - A load balancer in front of web servers : [Exemple 2](https://github.com/kefniark/ansible-haproxy-role/blob/master/docs/exemple-loadbalancer.yml)

To make this Role more reusable, it contains 3 different tags :
 - haproxy_install : install haproxy on the host (apt/yum/...)
 - haproxy_configure : task which create the /etc/haproxy/haproxy.cfg
 - haproxy_service : tasks used to start/reload the service when there is a modification

Example Playbook
-------------------------

```yaml
- hosts: all
  remote_user: root
  roles:
   - role: haproxy
     haproxy_frontends:
     - name: loadbalancer
       bind: '*:8080'
       default_backend: webserver
     haproxy_backends:
     - name: webserver
       servers:
        - name: backend1
          ip: localhost
          port: 80
```

More Informations
-------------------------

Author: Destrem Kevin

This project is still in development and lot options are missing or not supported.
You can follow the development status on [Trello](https://trello.com/b/TPJFH9rF/ansible-haproxy).


text:
NS_ASSUME_NONNULL_BEGIN

@interface WMFAsyncBlockOperation ()

@property (nonatomic, assign) BOOL isExecuting;
@property (nonatomic, assign) BOOL isFinished;
@property (nonatomic, strong) WMFAsyncBlock block;

@end

@implementation WMFAsyncBlockOperation

- (instancetype)initWithBlock:(WMFAsyncBlock)block {
    NSParameterAssert(block);
    self = [super init];
    if (self) {
        self.block = block;
    }
    return self;
}

- (void)start {
    [self willChangeValueForKey:@"isExecuting"];
    self.isExecuting = YES;
    [self didChangeValueForKey:@"isExecuting"];
    self.block(self);
}

- (void)finish {
    [self willChangeValueForKey:@"isExecuting"];
    [self willChangeValueForKey:@"isFinished"];
    self.isExecuting = NO;
    self.isFinished = YES;
    [self didChangeValueForKey:@"isExecuting"];
    [self didChangeValueForKey:@"isFinished"];
}

@end

@implementation NSOperationQueue (AsyncBlockOperation)

- (void)wmf_addOperationWithAsyncBlock:(WMFAsyncBlock)block {
    WMFAsyncBlockOperation *operation = [[WMFAsyncBlockOperation alloc] initWithBlock:block];
    [self addOperation:operation];
}

@end

NS_ASSUME_NONNULL_END


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit548212d9f837e877b65dc2dadba7b9fc::getLoader();


text:
export default function Search() {
    extendObservable(this, {
        text: "",
        setText: action(function(texto) {
              this.text = texto
        })
    })
}


text:
export interface SelectionInfoPacket {
  lookmlElement?: string
  name?: string
  grouped?: string
  link?: string
}

export interface VisibleViewLookup {
  [view_name: string]: boolean
}

export interface LookmlObjectMetadata {
  name: string
  lookmlLink: string
  description?: string
  joinCode?: string
  connectionName?: string
  label?: string
  groupLabel?: string
  projectName?: string
  accessFilters?: any[]
  joinType?: string
  joinRelationship?: string
  joinIconType?: string
  fieldType?: string
  labelShort?: string
  fieldGroupLabel?: string
  viewLabel?: string
  valueFormat?: string
  userAttributeFilterTypes?: string[]
  fieldSql?: string
  primaryKey?: boolean
  fieldCode?: string
  fieldName?: string
  mapLayer?: string
  fieldCategory?: string
  timeframes?: string[]
  sqlTableName?: string
  lookmlObject?: string
}


text:
<?php
/**
 * storage
 *
 * @license http://opensource.org/licenses/MIT MIT
 */

class MazelabStorage_Form_Import extends Zend_Form
{

    public function init()
    {
        $this->addElement('text', 'name', array(
            'label' => 'Name',
            'required' => true,
            'validators' => array(
                new MazelabStorage_Form_Validate_StorageName(),
                array('regex', false, array(
                    'pattern' => '/^[a-z_0-9].*$/',
                    'messages' => array(
                        'regexNotMatch' => 'Only lowercase letters, digits and _ are allowed'
                    )
                ))
            )
        ));

        $this->addElement('text', 'quota', array(
            'label' => 'Quota in MB',
            'required' => true,
            'validators' => array(
                'digits',
                 array('greaterThan', false, array(0))
            ),
        ));

        $this->addElement('select', 'nodeId', array(
            "label" => "On node",
            "multiOptions" => array(
                "" => "unassigned"
            ),
            "value" => array("")
        ));

        $this->addElement('select', 'status', array(
            "label" => "The storage is",
            "multiOptions" => array(
                "0" => "enabled",
                "1" => "disabled"
            ),
            "value" => array(1)
        ));

        $this->addElement('password', 'password', array(
            'label' => 'Password',
            'required' => true
        ));

        $this->initNodeSelect();
    }

    /**
     * add available nodes to node select element
     */
    public function initNodeSelect()
    {
        foreach(MazelabStorage_Model_DiFactory::getNodeManager()->getNodes() as $id => $node) {
            $this->getElement('nodeId')->addMultiOption($id, $node->getName());
        }

        return $this;
    }

}


text:
<?php
/**
 * Class Contact
 * @package Fizzy
 * @category Model
 */

/**
 * Model class for contact requests
 *
 * @author Mattijs Hoitink <mattijs@voidwalkers.nl>
 */
class Contact extends BaseContact
{

    /**
     * Sends the contact request to the configured contact email address.
     *
     * @throws Exception when contact email is not configured
     */
    public function send()
    {

        $contactEmail = Setting::getKey('address', 'contact');

        if (null === $contactEmail) {
            throw new Exception('Contact email not configured');
        }

        $mail = new Zend_Mail();
        $mail->setSubject('Contact request')
             ->setFrom($this->email, $this->name)
             ->setBodyText($this->body)
             ->addTo($contactEmail)
             ->send();
    }

}


text:
package com.yandex.money.api.net;

import com.yandex.money.api.util.Strings;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Map;

import static com.yandex.money.api.util.Common.checkNotNull;

/**
 * Buffers request parameters and creates request body for different methods. It also encodes keys
 * and values if needed using UTF-8 charset.
 *
 * @author Slava Yasevich (vyasevich@yamoney.ru)
 */
public final class ParametersBuffer {

    private static final String UTF8_NAME = "UTF-8";
    static final Charset UTF8_CHARSET = Charset.forName(UTF8_NAME);

    private Map<String, String> params = Collections.emptyMap();

    /**
     * Encodes string value to UTF-8 byte array.
     *
     * @param value value to encode
     * @return UTF-8 byte array
     */
    public static byte[] encodeUtf8(String value) {
        try {
            return encode(value).getBytes(UTF8_CHARSET);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Sets parameters.
     *
     * @param params key-value pairs of parameters (not null)
     * @return itself
     */
    public ParametersBuffer setParameters(Map<String, String> params) {
        this.params = checkNotNull(params, "params");
        return this;
    }

    /**
     * Prepares part of url for get request.
     *

     * For example, there are two parameters provided:
     *

     * {@code Map<String, String> params = new HashMap<>();}

     * {@code params.put("key1", "value1");}

     * {@code params.put("key2", "value2");}
     *

     * Then the method will return a string "?key1=value1&key2=value2".
     *
     * @return url parameters
     */
    public String prepareGet() {
        GetBuffer buffer = new GetBuffer();
        iterate(buffer);
        return buffer.toString();
    }

    /**
     * Prepares parameters for a request as bytes.
     *

     * For example, there are two parameters provided:
     *

     * {@code Map<String, String> params = new HashMap<>();}

     * {@code params.put("key1", "value1");}

     * {@code params.put("key2", "value2");}
     *

     * Then the method will return byte array containing "?key1=value1&key2=value2".
     *
     * @return byte array of parameters
     */
    public byte[] prepareBytes() {
        PostBuffer buffer = new PostBuffer();
        iterate(buffer);
        return buffer.getBytes();
    }

    static String encode(String value) throws UnsupportedEncodingException {
        return URLEncoder.encode(value, UTF8_CHARSET.name());
    }

    private void iterate(Buffer buffer) {
        for (Map.Entry<String, String> param : params.entrySet()) {
            String key = param.getKey();
            if (Strings.isNullOrEmpty(key)) {
                continue; // ignore empty keys
            }

            String value = param.getValue();
            if (Strings.isNullOrEmpty(value)) {
                continue;
            }

            buffer.nextParameter(key, value);
        }
    }

    private interface Buffer {
        void nextParameter(String key, String value);
    }

    private static final class GetBuffer implements Buffer {

        public final StringBuilder builder = new StringBuilder();

        GetBuffer() {
        }

        @Override
        public void nextParameter(String key, String value) {
            try {
                builder.append(builder.length() == 0 ? '?' : '&')
                        .append(encode(key))
                        .append('=')
                        .append(encode(value));
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }

        @Override
        public String toString() {
            return builder.toString();
        }
    }

    private static final class PostBuffer implements Buffer {

        private static final byte[] AMPERSAND = "&".getBytes(UTF8_CHARSET);
        private static final byte[] EQUALS_SIGN = "=".getBytes(UTF8_CHARSET);

        private final ByteArrayOutputStream stream = new ByteArrayOutputStream();

        PostBuffer() {
        }

        @Override
        public void nextParameter(String key, String value) {
            try {
                if (stream.size() > 0) {
                    stream.write(AMPERSAND);
                }
                stream.write(encodeUtf8(key));
                stream.write(EQUALS_SIGN);
                stream.write(encodeUtf8(value));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        byte[] getBytes() {
            return stream.toByteArray();
        }
    }
}


text:
import { describe, it, fakeAsync, expect, tick, clearPendingTimers } from 'angular2/testing';
// #docregion basic
describe('this test', () => {
    it('looks async but is synchronous', fakeAsync(() => {
        var flag = false;
        setTimeout(() => { flag = true; }, 100);
        expect(flag).toBe(false);
        tick(50);
        expect(flag).toBe(false);
        tick(50);
        expect(flag).toBe(true);
    }));
});
// #enddocregion
// #docregion pending
describe('this test', () => {
    it('aborts a timer', fakeAsync(() => {
        // This timer is scheduled but doesn't need to complete for the
        // test to pass (maybe it's a timeout for some operation).
        // Leaving it will cause the test to fail...
        setTimeout(() => { }, 100);
        // Unless we clean it up first.
        clearPendingTimers();
    }));
});
// #enddocregion


text:
<?php
/**
 * Determines if a value exists in the input data for a web request
 */

/**
 * Determines if a value exists in the input data for a web request
 */
class Validation_Validator_HasValue_Web extends Validation_Validator_HasValue
{
	/**
	 * Determines if an input element has a value
	 *
	 * @param array $aParams input values
	 * @param string $sElementName name of element to check for a value
	 * @return boolean
	 */
	public function hasValue($aParams, $sElementName)
	{
		$bHasValue = isset($aParams[$sElementName]);
		if ($bHasValue && is_string($aParams[$sElementName])) {
			$bHasValue = trim($aParams[$sElementName]) !== '';
		}

		return $bHasValue;
	}
}

?>


text:
class FileOpenerService:

    def can_open_mime_type(self, mime):
        pass

    def open(self, file):
        pass


text:
// .NAME vtkPImageWriter - Writes images to files.
// .SECTION Description
// vtkPImageWriter writes images to files with any data type. The data type of
// the file is the same scalar type as the input.  The dimensionality
// determines whether the data will be written in one or multiple files.
// This class is used as the superclass of most image writing classes
// such as vtkBMPWriter etc. It supports streaming.

#ifndef vtkPImageWriter_h
#define vtkPImageWriter_h

#include "vtkIOParallelModule.h" // For export macro
#include "vtkImageWriter.h"
class vtkPipelineSize;

class VTKIOPARALLEL_EXPORT vtkPImageWriter : public vtkImageWriter
{
public:
  static vtkPImageWriter *New();
  vtkTypeMacro(vtkPImageWriter,vtkImageWriter);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set / Get the memory limit in kilobytes. The writer will
  // stream to attempt to keep the pipeline size within this limit
  vtkSetMacro(MemoryLimit, unsigned long);
  vtkGetMacro(MemoryLimit, unsigned long);

protected:
  vtkPImageWriter();
  ~vtkPImageWriter();

  unsigned long MemoryLimit;

  virtual void RecursiveWrite(int dim, vtkImageData *region, vtkInformation* inInfo, ofstream *file);
  virtual void RecursiveWrite(int dim, vtkImageData *cache,
                              vtkImageData *data, vtkInformation* inInfo, ofstream *file)
  {this->vtkImageWriter::RecursiveWrite(dim,cache,data,inInfo,file);};

  vtkPipelineSize *SizeEstimator;
private:
  vtkPImageWriter(const vtkPImageWriter&);  // Not implemented.
  void operator=(const vtkPImageWriter&);  // Not implemented.
};

#endif


text:
NAME = backup-postgres
DOCKERID = hyperboloide

all: build push

build:
	docker build -t $(DOCKERID)/$(NAME) .

push:
	docker push $(DOCKERID)/$(NAME)


text: export { Warning24 as default } from "../../";


text:
<?php

namespace AppBundle\Command;

/* Specifics class for command */
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/* Filesystem */
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;

class TestsCommand extends ContainerAwareCommand
{

    /** @var  ConsoleOutput */
    private $output;
    private $input;

    protected function configure()
    {
        $this
            ->setName('app:tests')
            ->setDescription('Tests sur l\'application')
            ->addArgument('group', InputArgument::OPTIONAL, 'group:groupeName')
            ->addOption('log',null,InputOption::VALUE_NONE,'log messages in file: app/logs/TestsCommand.log')
            ->addOption('clear_cache',null,InputOption::VALUE_NONE,"clear cache before tests");
        ;

    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);

        $this->output = new ConsoleOutput($output);
        $this->input = $input;

        $groupArg = $this->input->getArgument('group');
        $group = null;
        if($groupArg != null)
        {
            $group = explode('group:',$groupArg)[1];
        }

        if ($input->getOption('clear_cache')) {
            //clear cache of env test
            $cache = shell_exec("php app/console cache:clear --env=test --no-debug");
            $this->output->info($cache,'info');
        }

        $startInfo = 'Starting tests';
        $shell_command = "php /usr/local/bin/phpunit -d memory_limit=-1 -c app";
        /* l'option "-d memory_limit=-1" permet de modifier la limite mémoire du script phpunit. */

        if($group != null)
        {
            $startInfo = $startInfo.' : group: '.$group;
            $shell_command = "php /usr/local/bin/phpunit --group ".$group." --verbose -d memory_limit=-1 -c app";
            /* l'option "-d memory_limit=-1" permet de modifier la limite mémoire du script phpunit. */
        }

        $this->output->info($startInfo);
        $version = shell_exec("php /usr/local/bin/phpunit --version");
        $this->output->info($version);

        $message = shell_exec($shell_command);
        $this->output->info($message);

        if ($input->getOption('log')) {
            $rootDir = $this->getContainer()->getParameter('kernel.root_dir');
            $logFile = $rootDir.'/logs/TestsCommand.log';
            $fs = new Filesystem();
            $fs->dumpFile($logFile,$message);
        }

        $pattern = '/OK/';
        $ok = preg_match($pattern,$message);
        $pattern = '/FAILURES/';
        $failures = preg_match($pattern,$message);
        if($ok && !$failures)
        {
            $this->output->success('Test passed!!!')->writeln();
            return 0;//travis exigence
        }
        else
        {
            $this->output->error('Error in tests...')->writeln();
            return 1;//travis exigence
        }

    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Xunit;
using Verifier = Azure.ClientSdk.Analyzers.Tests.AzureAnalyzerVerifier<Azure.ClientSdk.Analyzers.AsyncAnalyzer>;

namespace Azure.ClientSdk.Analyzers.Tests
{
    public class AZC0102Tests
    {
        [Theory]
        [InlineData(LanguageVersion.CSharp7)]
        [InlineData(LanguageVersion.Latest)]
        public async Task AZC0102WarningOnTask(LanguageVersion languageVersion)
        {
            const string code = @"
namespace RandomNamespace
{
    using System.Threading.Tasks;
    public class MyClass
    {
        public static void Foo()
        {
            Task<int> task = Task.Run(() => 10);
            task.[|GetAwaiter().GetResult()|];
        }
    }
}";
            await Verifier.VerifyAnalyzerAsync(code, "AZC0102", languageVersion);
        }

        [Theory]
        [InlineData(LanguageVersion.CSharp7)]
        [InlineData(LanguageVersion.Latest)]
        public async Task AZC0102WarningOnValueTask(LanguageVersion languageVersion)
        {
            const string code = @"
namespace RandomNamespace
{
    using System.Threading.Tasks;
    public class MyClass
    {
        public static void Foo()
        {
            new ValueTask().[|GetAwaiter().GetResult()|];
        }
    }
}";
            await Verifier.VerifyAnalyzerAsync(code, "AZC0102", languageVersion);
        }

        [Fact]
        public async Task AZC0102WarningOnAwaitable()
        {
            const string code = @"
namespace RandomNamespace
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Threading.Tasks;

    public class MyClass
    {
        public static void Foo()
        {
            new CustomAwaitable().[|GetAwaiter().GetResult()|];
        }
    }

    public class CustomAwaitable
    {
        public CustomAwaiter GetAwaiter() => new CustomAwaiter();
    }

    public class CustomAwaiter : ICriticalNotifyCompletion
    {
        internal bool IsCompleted => true;
        protected internal void GetResult() {}
        public void OnCompleted(Action continuation) {}
        public void UnsafeOnCompleted(Action continuation) {}
    }
}";
            await Verifier.VerifyAnalyzerAsync(code, "AZC0102");
        }

        [Fact]
        public async Task AZC0102WarningOnExtension()
        {
            const string code = @"
namespace RandomNamespace
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Threading.Tasks;

    public class MyClass
    {
        public static void Foo()
        {
            new TestStruct().[|GetAwaiter().GetResult()|];
        }
    }

    public struct TestStruct { }

    public static class Extensions
    {
        public static TaskAwaiter GetAwaiter(this TestStruct s) => default;
    }
}";
            await Verifier.VerifyAnalyzerAsync(code, "AZC0102");
        }

        [Fact]
        public async Task AZC0102NoWarningOnNonAwaiter()
        {
            const string code = @"
namespace RandomNamespace
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Threading.Tasks;

    public class MyClass
    {
        public static void Foo()
        {
            new CustomAwaitable().GetAwaiter().GetResult();
        }
    }

    public class CustomAwaitable
    {
        public FakeAwaiter GetAwaiter() => new FakeAwaiter();
    }

    public class FakeAwaiter : INotifyCompletion
    {
        protected bool IsCompleted => true;
        public void GetResult() {}
        public void OnCompleted(Action continuation) {}
    }
}";
            await Verifier.VerifyAnalyzerAsync(code);
        }

        [Fact]
        public async Task AZC0102NoWarningOnNonAwaitable()
        {
            const string code = @"
namespace RandomNamespace
{
    using System.Runtime.CompilerServices;
    using System.Threading.Tasks;

    public class MyClass
    {
        public static void Foo()
        {
            new NonAwaitable().GetAwaiter().GetResult();
        }
    }

    public class NonAwaitable
    {
        public TaskAwaiter GetAwaiter(int i = default) => default(TaskAwaiter);
    }
}";
            await Verifier.VerifyAnalyzerAsync(code);
        }
    }
}


text:
namespace GoogleARCoreInternal.CrossPlatform
{
    using GoogleARCore;
    using GoogleARCore.CrossPlatform;

    internal static class ApiTrackingStateXPExtensions
    {
        public static XPTrackingState ToXPTrackingState(this TrackingState apiTrackingState)
        {
            switch (apiTrackingState)
            {
                case TrackingState.Tracking:
                    return XPTrackingState.Tracking;
                case TrackingState.Paused:
                    return XPTrackingState.Paused;
                case TrackingState.Stopped:
                    return XPTrackingState.Stopped;
                default:
                    return XPTrackingState.Stopped;
            }
        }
    }
}


text:
Fontastic - Font Showcasing for Pebble
======================================

This font preview app is based off the [app_font_browser] sample app and has been expanded to include many custom fonts and different text messages in each font.

It's published in the Pebble Appstore.  You do not need to compile the sample application yourself nor add additional fonts to preview.  This also shows off the necessary lines of code to load up your own custom fonts.

[![](http://pblweb.com/badge/5498fac473268fc7d4000077/black/medium)](https://apps.getpebble.com/applications/5498fac473268fc7d4000077)

[Forum Discussion] - [Pebble Appstore](https://apps.getpebble.com/applications/5498fac473268fc7d4000077)

Usage
-----

Initially you are presented with a menu of different font options.  The up and down buttons navigate the list.  Pressing back will exit the app and pressing the select button will show you a demo page.

On the demo page you can press select to cycle through the available text messages to see how they are presented in the font.  The up and down buttons switch to the previous and next fonts.  The back button returns you to the menu.

That's all there is to it.

How To Compile
--------------

Fire up [CloudPebble] and import this project from GitHub by clicking [ImportToCloudPebble].  Open the source file `fontastic.c` and then press the green button to compile and send this to your phone.  Make sure you have the developer channel enabled on your phone and ideally it will get sent to your pebble within moments.

About the Fonts
---------------

These fonts have been hand selected for a variety of purposes.  Some are good digital watch faces, others are great for larger text and still more are good for smaller text.  The entire font family is included in the repository even if not all fonts are featured.  Use this app to get a good feel for the available fonts and then carefully study the entire family to make sure you get the font you need.

### [Anonymous Pro](http://www.marksimonson.com/fonts/view/anonymous-pro) by Mark Simonson

![](screenshots/anonymous-pro.png)

A very clean monospaced font.  Designed with coding in mind.  Released under the Open Font License version 1.1 ([OFL]).

### [Bitham](http://www.typography.com/fonts/gotham/overview/) by the Hoefler & Frere-Jones Type Foundry

![](screenshots/bitham.png)

Bitham is a renamed Gotham font and is built-in to Pebble.  The TTF files are not not in this project because the font is not freely available.

### [Digit](http://www.dafont.com/digit.font) by paldave

![](screenshots/digit.png)

Digital clock based font with readable letters.  Monospaced.  Source cites "100% Free".

### [Droid](https://github.com/android/platform_frameworks_base/tree/master/data/fonts) by Steve Matteson

![](screenshots/droid.png)

Droid is a font that comes with the Pebble.  This font family was created for small screens of mobile devices.  They are licensed under the Apache License version 2.0 ([APACHE]).

### [Fjalla](http://www.fontsquirrel.com/fonts/fjalla) by Sorkin Type Co

![](screenshots/fjalla.png)

This is a condensed, medium contrast bold font, suitable for use in headlines.  It is licensed under the Open Font License version 1.1 ([OFL]).

### [GnuMICR](http://www.sandeen.net/GnuMICR/) by Eric Sandeen

![](screenshots/gnumicr.png)

Magnetic Ink Character Recognition font, used at the bottom of checks.  This font was made to be an open source alternative to commercial MICR fonts.  It is licensed under the GNU General Public License version 2.0 ([GPL2]).

### [Gothic](http://www.myfonts.com/fonts/marksimonson/raster-gothic/) by Mark Simonson

![](screenshots/gothic.png)

Raster Gothic (or, as known on the Pebble, Gothic) was created as a series of outline fonts that retain the aliased look of a bitmap font.  It's clarity and crispness are why it's added to the Pebble by default.  This is not a free font and its TTF files are not included in this project.

### [Merriweather](http://www.fontsquirrel.com/fonts/merriweather) by Eben Sorkin

![](screenshots/merriweather.png)

Merriweather is designed for better text readability and is slightly condensed.  It is licensed under the Open Font License version 1.1 ([OFL]).

### [Nevis](http://tenbytwenty.com/?xxxx_posts=nevis) by Ed Merritt

![](screenshots/nevis.png)

Nevis is a strong, angular typeface and is ideal for headings & buttons. It's assertive and bold, but manages to retain a friendly tone, and looks especially good when used in all caps.  The web page hosting it lists this font as free.

### [Noticia Text](http://www.fontsquirrel.com/fonts/noticia-text) by José Miguel Solé

![](screenshots/noticia-text.png)

Readable font designed for print and black & white applications.  Released under the Open Font License version 1.1 ([OFL]).

### [Open Sans Condensed](https://www.google.com/fonts/specimen/Open+Sans+Condensed) by Steve Matteson

![](screenshots/open-sans-condensed.png)

Designed with an upright stress, open forms and a neutral, yet friendly appearance.  Optimized for print, web, and mobile interfaces with excellent legibility characteristics in its letterforms.  Released under the Apache License version 2.0 ([APACHE]).

### [OSP-DIN](http://ospublish.constantvzw.org/foundry/osp-din/) by OSP

![](screenshots/osp-din.png)

Based on 1932 drawings of the DIN 1451 typeface seen during a trip to Berlin.  This font was used in an example by Pebble.  Licensed under the Open Font License version 1.1 ([OFL]).

### [Pendule Ornamental](http://fontstruct.com/fontstructions/show/pendule_ornamental) by Scott Lawrence

![](screenshots/pendule-ornamental.png)

This specialized ornamental/display font has been created explicitly for use in a digital clock. Two different styles of digits are provided with as A-P and a-p. The digits 0-9, and A-F, as seen on LCD and LED displays are included, along with colon(:), decimal(.) point, and negative sign (-).  Released under the Creative Commons Attribution-ShareALike 3.0 License ([CC-ASL]).

### [Phonebook](http://www.1001freefonts.com/phonebook.font) by Manfred Klein

![](screenshots/phonebook.png)

Slightly heavier and condensed to fit more words horizontally.  License according to sources all cite it is free.  Font is not listed on Klein's [official site](http://manfred-klein.ina-mar.com/), but all of his other fonts request that a donation is made when used for commercial use.

### [Roboto](http://www.google.com/fonts/specimen/Roboto) by Christian Robertson

![](screenshots/roboto.png)

Designed around the requirements of UI and high-resolution screens.  Distributed in Android since Ice Cream Sandwich.  Used in Pebble already but more variants are listed in this app.  Licensed under the Apache License version 2.0 ([APACHE]).

### [Segment 7](http://openfontlibrary.org/en/font/segment7) by Cedric Knight

![](screenshots/segment-7.png)

Strictly seven-segment (plus point) calculator display face, fixed-width and free. Other LED/LCD digital fonts may kern or include paths that are not available with seven segments in order to represent characters better. Segment7 does the best it can for upper- and lower-case Latin without compromising on the true LED display appearance.  Released under Open Font License version 1.1 ([OFL]).

### [Source Sans Pro](https://github.com/adobe-fonts/source-sans-pro) by Paul D. Hunt

![](screenshots/source-sans-pro.png)

This is a sans serif typeface intended to work well in user interfaces.  Simplified glyph designs were based off Gothic fonts and additional details were added to easily distinguish letters.  Reads well for short strings and extended settings.  Released under the Open Font License version 1.1 ([OFL]).

### [UniCons](http://openfontlibrary.org/font/unicons) by Juergen Kraus

![](screenshots/unicons.png)

A monospaced font consisting of common user interface symbols.  Licensed under the Open Font License version 1.1 ([OFL]).

More Fonts?
-----------

Do you have one that you would like to include?  Drop me a line by filing a [feature request](https://github.com/fidian/pebble-fontastic/issues) or post in the [forum discussion].  Please keep in mind that only so many custom fonts can be included in the application because there's a hard limit of 96k of resources allowed.

License Information
-------------------

The original example was listed under the MIT license.  This one is licensed under the same.  See [LICENSE.md](LICENSE.md) for the full text.

Fonts are licensed under multiple licenses.  For convenience, each font cites their license and here is the text of every license used:

* Apache License version 2 - [APACHE]
* Creative Commons Attribution-ShareALike License version 3.0 - [CC-ASL]
* GNU General Purpose License version 2 - [GPL2]
* Open Font License version 1.1 - [OFL]

[APACHE]: APACHE.md
[app_font_browser]: https://github.com/pebble/pebble-sdk-examples/tree/master/watchapps/app_font_browser
[CC-ASL]: CC-ASL.md
[CloudPebble]: https://cloudpebble.net/
[Forum Discussion]: http://forums.getpebble.com/discussion/18957
[GPL2]: GPL2.md
[ImportToCloudPebble]: https://cloudpebble.net/ide/import/github/fidian/pebble-fontastic/
[OFL]: OFL.md


text:
db.teams.find({ linode: { $ne: null }}).forEach(function(team) {
  db.people.find(
      { _id: { $in: team.peopleIds }
      , email: { $ne: null }}).forEach(function(person) {

    var linode = team.linode;
    print([person.email, linode.username, linode.password].join(','));
  });
});


text:
<?php

namespace Takeoo\Service\Exception;

/**
 * Class InvalidServiceException
 * @package Takeoo\Service\Exception
 */
class InvalidServiceException extends \Exception
{
  //
}


text:
(function () {

	// IE8
	if (window.Element && !window.HTMLElement) {
		window.HTMLElement = window.Element;
		return;
	}

	// create Element constructor
	window.Element = window.HTMLElement = new Function('return function Element() {}')();

	// generate sandboxed iframe
	var vbody = document.appendChild(document.createElement('body'));
	var frame = vbody.appendChild(document.createElement('iframe'));

	// use sandboxed iframe to replicate Element functionality
	var frameDocument = frame.contentWindow.document;
	var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
	var cache = {};

	// polyfill Element.prototype on an element
	var shiv = function (element, deep) {
		var
		childNodes = element.childNodes || [],
		index = -1,
		key, value, childNode;

		if (element.nodeType === 1 && element.constructor !== Element) {
			element.constructor = Element;

			for (key in cache) {
				value = cache[key];
				element[key] = value;
			}
		}

		while (childNode = deep && childNodes[++index]) {
			shiv(childNode, deep);
		}

		return element;
	};

	var elements = document.getElementsByTagName('*');
	var nativeCreateElement = document.createElement;
	var interval;
	var loopLimit = 100;

	prototype.attachEvent('onpropertychange', function (event) {
		var
		propertyName = event.propertyName,
		nonValue = !cache.hasOwnProperty(propertyName),
		newValue = prototype[propertyName],
		oldValue = cache[propertyName],
		index = -1,
		element;

		while (element = elements[++index]) {
			if (element.nodeType === 1) {
				if (nonValue || element[propertyName] === oldValue) {
					element[propertyName] = newValue;
				}
			}
		}

		cache[propertyName] = newValue;
	});

	prototype.constructor = Element;

	if (!prototype.hasAttribute) {
		// <Element>.hasAttribute
		prototype.hasAttribute = function hasAttribute(name) {
			return this.getAttribute(name) !== null;
		};
	}

	// Apply Element prototype to the pre-existing DOM as soon as the body element appears.
	function bodyCheck() {
		if (!(loopLimit--)) clearTimeout(interval);
		if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
			shiv(document, true);
			if (interval && document.body.prototype) clearTimeout(interval);
			return (!!document.body.prototype);
		}
		return false;
	}
	if (!bodyCheck(true)) {
		document.onreadystatechange = bodyCheck;
		interval = setInterval(bodyCheck, 25);
	}

	// Apply to any new elements created after load
	document.createElement = function createElement(nodeName) {
		var element = nativeCreateElement(String(nodeName).toLowerCase());
		return shiv(element);
	};

	// remove sandboxed iframe
	document.removeChild(vbody);
}());


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

using System;
using System.Collections.Generic;
using System.Linq;
using PclUnit.Run.Attributes;
using PclUnit.Util;

namespace PclUnit.Run
{

    public class FixtureMeta:IMeta
    {

        public AssemblyMeta Assembly { get; set; }

        public FixtureMeta()
        {
            Category =new List<string>();
            Tests = new CallBackList<TestMeta>(it=>it.Fixture = this);
        }

        public FixtureMeta(TestFixtureAttributeBase attribute, Type type)
            : this()
        {

            Name = type.Name;
            UniqueName = string.Format("T:{0}.{1}", type.Namespace, type.Name);

            if (attribute != null)
            {
                Description = attribute.GetDescription(type);
                Category = attribute.GetCategories(type);
            }

        }
        public string ToListJson()
        {
            return String.Format("{{Name:\"{0}\", UniqueName:\"{1}\", Description:\"{2}\", Category:{3}, Tests:[{4}]}}",
                                 Name.EscapeJson(), UniqueName.EscapeJson(), Description.EscapeJson(), Category.ToListJson(), String.Join(",", Tests.Select(it => it.ToListJson()).ToArray())
                );
        }

        public string ToItemJson()
        {
            return String.Format("{{Assembly:{4}, Category:{3}, Description:\"{2}\", UniqueName:\"{1}\", Name:\"{0}\",}}",
                                 Name.EscapeJson(), UniqueName.EscapeJson(), Description.EscapeJson(), Category.ToListJson(), Assembly.ToItemJson()
                );

        }

        public string UniqueName { get; set; }
        public string Name { get; set; }

        public string Description { get; set; }
        public IList<string> Category { get; set; }

        public IList<TestMeta> Tests { get; set; }
    }
}


text:
//---------Global----------//
var arrFonts = new Object();
var PreventDefaultScroll = function (evt)
{
    evt.preventDefault();
    window.scroll(0, 0);
    return false;
};
//initial event handler to detect when appMobi is ready to roll
document.addEventListener("intel.xdk.device.ready", DeviceReady, false);
intel.xdk.multitouch.add(window.document, "touchmove", PreventDefaultScroll, false);
function Init()
{
};
function DeviceReady(evt)
{
    try
    {
        //use AppMobi viewport
        intel.xdk.display.useViewport(320, 480);
        //lock orientation
        intel.xdk.device.setRotateOrientation("portrait");
        intel.xdk.device.setAutoRotate(false);
        //manage power
        intel.xdk.device.managePower(true, false);
    }
    catch (e)
    {
        alert(e.message);
    }
    var platform_suffix = intel.xdk.device.platform == "Android" ? "ANDROID" : "";
    arrFonts["ActionManRegular" + platform_suffix] = "Action Man";
    arrFonts["KitchenpoliceRegular" + platform_suffix] = "Kitchenpolice";
    arrFonts["ComfortaaRegular" + platform_suffix] = "Comfortaa";
    arrFonts["ProclamateLightLight" + platform_suffix] = "Proclamate Light";
    arrFonts["Furore" + platform_suffix] = "Furore";
    arrFonts["Letritista" + platform_suffix] = "Letritista";
    arrFonts["AnagramRegular" + platform_suffix] = "Anagram";
    arrFonts["CaslonCalligraphicInitialsReg" + platform_suffix] = "Caslon Calligraphic Initials";
    arrFonts["DeStencilNFRegular" + platform_suffix] = "DeStencil NF";
    arrFonts["KingthingsWroteRegular" + platform_suffix] = "Kingthings Wrote";
    arrFonts["KulminoituvaRegular" + platform_suffix] = "Kulminoituva";
    arrFonts["NervousRexRegular" + platform_suffix] = "Nervous Rex";
    arrFonts["NotethisRegular" + platform_suffix] = "Notethis";
    arrFonts["ProFontWindowsRegular" + platform_suffix] = "Pro Font Windows";
    arrFonts["RieslingRegular" + platform_suffix] = "Riseling";
    arrFonts["UpperEastSideRegular" + platform_suffix] = "Upper East Side";
    arrFonts["VeggieburgerRegular" + platform_suffix] = "Veggieburger";
    for (var i in arrFonts)
    {
        document.getElementById("ddFonts").innerHTML += "<option value=\'" + i + "\'>" + arrFonts[i] + "</option>";
    }
    //show splash screen
    intel.xdk.device.hideSplashScreen();
};
function ChangeFont()
{
    document.getElementById("txtSample").style.fontFamily = document.getElementById("ddFonts").value;
    document.getElementById("userinput").value = document.getElementById("ddFonts").options[document.getElementById("ddFonts").selectedIndex].text;
    ChangeText();
};
function ChangeText()
{
    document.getElementById("txtSample").innerHTML = document.getElementById("userinput").value;
};
//---------Analytics----------//
function AddAnalyticsDataPoint(eventID, queryString)
{
    try
    {
        if (queryString == null)
        {
            queryString = "";
        }
        intel.xdk.analytics.logPageEvent("/application/" + eventID + ".event", queryString, "", "GET", 0, "index.html");
    }
    catch (e)
    {
    }
};
//---------Live Updates----------//
/* Live Updates */
/* If you decide to allow your application to handle Live Updates itself,
this snippet will give you a starting point. Drop this javascript code
into your application's <body> HTML tag to detect if an update has been
successfully downloaded. */
document.addEventListener("intel.xdk.device.update.available", UpdateAvailable, false);
document.addEventListener("intel.xdk.device.ready", DeviceReadyTestForUpdate, false);
function UpdateAvailable(evt)
{
    /* test to see if the event is appMobi.device.update.available */
    if (evt.type == "intel.xdk.device.update.available")
    {
        /* there is an update available *while* the application is running - decide what to do */
        if (confirm(evt.updateMessage) == true)
        {
            UpdateApplication();
        }
        else
        {
            UpdateApplicationLater();
        }
    }
};
function DeviceReadyTestForUpdate(evt)
{
    /* appMobi.updateAvailable indicates whether or not an over the air update is available or not. */
    if (intel.xdk.updateAvailable == true)
    {
        //there is an application update available at startup
        if (confirm(intel.xdk.updateMessage) == true)
        {
            UpdateApplication();
        }
        else
        {
            UpdateApplicationLater();
        }
    }
};
function UpdateApplication()
{
    /* installs an update if one is available */
    intel.xdk.device.installUpdate();
};
function UpdateApplicationLater()
{
    /* add any code to indicate that the update has been postponed */
    alert("The update has been postponed");
};


text:
package fr.paris.lutece.portal.service.security;

import fr.paris.lutece.api.user.User;

/**
 * Interface for access loggers
 */
public interface IAccessLogger
{

    /**
     * Log a message object with the INFO level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     * @param specificOrigin
     *            specific origin of the event to log
     */
    public void info( String strEventType, String strAppEventCode, User connectedUser, Object data, String specificOrigin );

    /**
     * Log a message object with the INFO level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     */
    public default void info( String strEventType, String strAppEventCode, User connectedUser, Object data )
    {
        info( strEventType, strAppEventCode, connectedUser, data, null );
    }

    /**
     * Log a message object with the DEBUG level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     * @param specificOrigin
     *            specific origin of the event to log
     */
    public void debug( String strEventType, String strAppEventCode, User connectedUser, Object data, String specificOrigin );

    /**
     * Log a message object with the DEBUG level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     */
    public default void debug( String strEventType, String strAppEventCode, User connectedUser, Object data )
    {
        debug( strEventType, strAppEventCode, connectedUser, data, null );
    }

    /**
     * Log a message object with the TRACE level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     * @param specificOrigin
     *            specific origin of the event to log
     */
    public void trace( String strEventType, String strAppEventCode, User connectedUser, Object data, String specificOrigin );

    /**
     * Log a message object with the TRACE level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     */
    public default void trace( String strEventType, String strAppEventCode, User connectedUser, Object data )
    {
        trace( strEventType, strAppEventCode, connectedUser, data, null );
    }

    /**
     * Log a message object with the WARN level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     * @param specificOrigin
     *            specific origin of the event to log
     */
    public void warn( String strEventType, String strAppEventCode, User connectedUser, Object data, String specificOrigin );

    /**
     * Log a message object with the WARN level.
     *
     * @param strEventType
     *            the event type
     * @param strAppEventCode
     *            the event code
     * @param connectedUser
     *            the user connected
     * @param data
     *            the message object to log
     */
    public default void warn( String strEventType, String strAppEventCode, User connectedUser, Object data )
    {
        warn( strEventType, strAppEventCode, connectedUser, data, null );
    }

}


text:
import $ from 'jquery'
import {
  IMPORT_CONTACTS,
  REQUEST_CONTACTS,
  SET_CONTACTS_ERROR
} from './constants'

export function requestContacts() {
  return {
    type: REQUEST_CONTACTS
  }
}

export function importContacts(contacts) {
  return {
    type: IMPORT_CONTACTS,
    contacts
  }
}

export function setContactsError(error) {
  return {
    type: SET_CONTACTS_ERROR,
    error
  }
}

export function getContacts(){
  return function(dispatch, getState) {
    dispatch(requestContacts())
    $.ajax({
      url: window.config.url + '/contacts',
      method: 'GET',
      success: (data)=> {
        dispatch(importContacts(data))
      },
      error: (xhr, textStatus, error)=> {
        dispatch(setContactsError(error))
      }
    })
  }
}

export function addContact(newContact){
  return function(dispatch, getState) {
    $.ajax({
      url: window.config.url + '/contacts',
      method: 'POST',
      data: newContact,
      success: (data) => {
        dispatch(importContacts(data))
      },
      error: (xhr, text, error) => {
        console.log(error.toString());
      }
    })
  }
}


text:
require('./dist/js/jdm-loading-indicator');
module.exports = 'jdm.loadingIndicator';


text:
module.exports = function(config) {
  var cfg = {};
  require('./karma.conf')({set: function (x){cfg = x;}});
  cfg.client = {
    captureConsole: true
  };
  cfg.port = 19145;
  cfg.browserStack = {
      username: process.env.BROWSER_STACK_USERNAME,
      accessKey: process.env.BROWSER_STACK_ACCESS_KEY
  };
  if (!cfg.browserStack.username)
    throw new Error("You must provider username/key in the env variables BROWSER_STACK_USERNAME and BROWSER_STACK_ACCESS_KEY");

  cfg.customLaunchers = {
    bs_firefox: {
      base: 'BrowserStack',
      browser: 'firefox',
      browser_version: '45.0',
      os: 'OS X',
      os_version: 'El Capitan'
    },
    bs_edge: {
      base: 'BrowserStack',
      browser: "Edge",
      browser_version: '13',
      os: 'Windows',
      os_version: '10'
    },
    bs_chrome: {
      base: 'BrowserStack',
      browser: "Chrome",
      browser_version: "49",
      os: 'OS X',
      os_version: 'Mountain Lion'
    }
  };

  cfg.browsers = [
    'bs_chrome',
    'bs_firefox',
    'bs_edge'
  ];

  cfg.plugins = [
      'karma-qunit',
      'karma-mocha-reporter',
      'karma-browserstack-launcher'
  ];

  config.set(cfg);
};


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

import com.intellij.injected.editor.VirtualFileWindow;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.*;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class PyProjectScopeBuilder extends ProjectScopeBuilderImpl {
  public PyProjectScopeBuilder(Project project) {
    super(project);
  }

  /**
   * This method is necessary because of the check in IndexCacheManagerImpl.shouldBeFound()
   * In Python, files in PYTHONPATH are library classes but not library sources, so the check in that method ensures that
   * nothing is found there even when the user selects the "Project and Libraries" scope. Thus, we have to override the
   * isSearchOutsideRootModel() flag for that scope.
   *
   * @return all scope
   */
  @NotNull
  @Override
  public GlobalSearchScope buildAllScope() {
    return new ProjectAndLibrariesScope(myProject) {
      @Override
      public boolean contains(@NotNull VirtualFile file) {
        if (file instanceof ProjectAwareVirtualFile) {
          return ((ProjectAwareVirtualFile)file).isInProject(Objects.requireNonNull(getProject()));
        }
        return super.contains(file);
      }
    };
  }

  /**
   * Project directories are commonly included in PYTHONPATH and as a result are listed as library classes. Core logic
   * includes them in project scope only if they are also marked as source roots. Python code is often not marked as source
   * root, so we need to override the core logic and check only whether the file is under project content.
   *
   * @return project search scope
   */
  @NotNull
  @Override
  public GlobalSearchScope buildProjectScope() {
    final FileIndexFacade fileIndex = FileIndexFacade.getInstance(myProject);
    return new ProjectScopeImpl(myProject, fileIndex) {
      @Override
      public boolean contains(@NotNull VirtualFile file) {
        if (file instanceof ProjectAwareVirtualFile) {
          return ((ProjectAwareVirtualFile)file).isInProject(Objects.requireNonNull(getProject()));
        }
        if (file instanceof VirtualFileWindow) return true;
        return fileIndex.isInContent(file);
      }
    };
  }
}


text:
require "integration/test_helper"

describe Azure::Storage::File::FileService do
  subject { Azure::Storage::File::FileService.create(SERVICE_CREATE_OPTIONS()) }
  after { ShareNameHelper.clean }

  describe "#delete_share" do
    let(:share_name) { ShareNameHelper.name }
    before {
      subject.create_share share_name
    }

    it "deletes the share" do
      share = subject.get_share_stats share_name
      share.usage.must_equal 0

      result = subject.delete_share share_name
      result.must_be_nil

      assert_raises(Azure::Core::Http::HTTPError) do
        subject.get_share_stats share_name
      end
    end

    it "errors if the share does not exist" do
      assert_raises(Azure::Core::Http::HTTPError) do
        subject.delete_share FileNameHelper.name
      end
    end
  end
end


text:
const TableImporter = require('./base');
const {blogStartDate} = require('../utils/blog-info');
const {faker} = require('@faker-js/faker');
const {slugify} = require('@tryghost/string');

class NewslettersImporter extends TableImporter {
    constructor(knex) {
        super('newsletters', knex);
        this.sortOrder = 0;
        this.names = ['Occasional freebie', 'Regular premium'];
    }

    generate() {
        const name = this.names.shift();
        const sortOrder = this.sortOrder;
        this.sortOrder = this.sortOrder + 1;
        const weekAfter = new Date(blogStartDate);
        weekAfter.setDate(weekAfter.getDate() + 7);
        return {
            id: faker.database.mongodbObjectId(),
            uuid: faker.datatype.uuid(),
            name: name,
            slug: `${slugify(name)}-${faker.random.numeric(3)}`,
            sender_reply_to: 'hello@example.com',
            status: 'active',
            subscribe_on_signup: faker.datatype.boolean(),
            sort_order: sortOrder,
            created_at: faker.date.between(blogStartDate, weekAfter)
        };
    }
}

module.exports = NewslettersImporter;


text:
{% extends "base/base.html" %}

{% block content %}

About Sudoku

About

            Sudoku; originally called Number Place is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the grid (also called "boxes", "blocks", "regions", or "sub-squares") contains all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which for a well-posed puzzle has a unique solution.

            Completed puzzles are always a type of Latin square with an additional constraint on the contents of individual regions. For example, the same single integer may not appear twice in the same row, column or in any of the nine 3×3 subregions of the 9x9 playing board.

            French newspapers featured variations of the puzzles in the 19th century, and the puzzle has appeared since 1979 in puzzle books under the name Number Place. However, the modern Sudoku only started to become mainstream in 1986 by the Japanese puzzle company Nikoli, under the name Sudoku, meaning single number. It first appeared in a US newspaper and then The Times (UK) in 2004, from the efforts of Wayne Gould, who devised a computer program to rapidly produce distinct puzzles.

Source: wikipedia.org

How To Play

              Sudoku is played on a grid of 9 x 9 spaces. Within the rows and columns are 9 "squares" (made up of 3 x 3 spaces). Each row, column and square (9 spaces each) needs to be filled out with the numbers 1-9, without repeating any numbers within the row, column or square. Each Sudoku grid comes with a few spaces already filled in; the more spaces filled in, the easier the game – the more difficult Sudoku puzzles have very few spaces that are already filled in.

Source: sudoku.com

History

            Number puzzles appeared in newspapers in the late 19th century, when French puzzle setters began experimenting with removing numbers from magic squares. Le Siècle, a Paris daily, published a partially completed 9×9 magic square with 3×3 sub-squares on November 19, 1892. It was not a Sudoku because it contained double-digit numbers and required arithmetic rather than logic to solve, but it shared key characteristics: each row, column and sub-square added up to the same number.

            On July 6, 1895, Le Siècle's rival, La France, refined the puzzle so that it was almost a modern Sudoku. It simplified the 9×9 magic square puzzle so that each row, column and broken diagonals contained only the numbers 1–9, but did not mark the sub-squares. Although they are unmarked, each 3×3 sub-square does indeed comprise the numbers 1–9 and the additional constraint on the broken diagonals leads to only one solution. These weekly puzzles were a feature of French newspapers such as L'Echo de Paris for about a decade but disappeared about the time of World War I.

            The modern Sudoku was most likely designed anonymously by Howard Garns, a 74-year-old retired architect and freelance puzzle constructor from Connersville, Indiana, and first published in 1979 by Dell Magazines as Number Place (the earliest known examples of modern Sudoku). Garns's name was always present on the list of contributors in issues of Dell Pencil Puzzles and Word Games that included Number Place, and was always absent from issues that did not. He died in 1989 before getting a chance to see his creation as a worldwide phenomenon. It is unclear if Garns was familiar with any of the French newspapers listed above.

Source: wikipedia.org

{% endblock %}


text:
package com.yanjinbin.designPattern.适配器;

/**
 * @Author Silver bullet
 * @Since 2017/5/31.
 */
public interface GBCharger {
    void powerWith3Round();
}


text:
<?php

namespace Getty\Api\Request {

     class Countries extends FluentRequest {
        protected function getRoute() {
            return "countries";
        }
    }
}


text:
<?php

/* DesymfonyBundle:Usuario:registro.html.twig */
class __TwigTemplate_5617b5802052223edb6b979c86ee7b80 extends Twig_Template
{
    protected $parent;

    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->blocks = array(
            'title' => array($this, 'block_title'),
            'metadesc' => array($this, 'block_metadesc'),
            'pageid' => array($this, 'block_pageid'),
            'contenido' => array($this, 'block_contenido'),
            'lateral' => array($this, 'block_lateral'),
        );
    }

    public function getParent(array $context)
    {
        if (null === $this->parent) {
            $this->parent = $this->env->loadTemplate("DesymfonyBundle::layout.html.twig");
        }

        return $this->parent;
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $context = array_merge($this->env->getGlobals(), $context);

        $this->getParent($context)->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_title($context, array $blocks = array())
    {
        echo "Registro";
    }

    // line 4
    public function block_metadesc($context, array $blocks = array())
    {
        echo "Regístrate y participa en DeSymfony";
    }

    // line 5
    public function block_pageid($context, array $blocks = array())
    {
        echo "registro";
    }

    // line 7
    public function block_contenido($context, array $blocks = array())
    {
        // line 8
        echo "

Registro

";
        // line 11
        if ($this->getAttribute($this->getAttribute($this->getContext($context, 'app'), "session", array(), "any", false), "flash", array("notice", ), "method", false)) {
            // line 12
            echo "

";
            // line 13
            echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, 'app'), "session", array(), "any", false), "flash", array("notice", ), "method", false), "html");
            echo "

";
        }
        // line 16
        echo "
";
        // line 17
        echo $this->env->getExtension('form')->renderErrors($this->getContext($context, 'form'));
        echo "

<form action=\"";
        // line 19
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("registro"), "html");
        echo "\" method=\"post\" ";
        echo $this->env->getExtension('form')->renderEnctype($this->getContext($context, 'form'));
        echo ">

    ";
        // line 21
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "nombre", array(), "any", false));
        echo "

        ";
        // line 23
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "nombre", array(), "any", false));
        echo "
        ";
        // line 24
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "nombre", array(), "any", false));
        echo "

    ";
        // line 27
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "apellidos", array(), "any", false));
        echo "

        ";
        // line 29
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "apellidos", array(), "any", false));
        echo "
        ";
        // line 30
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "apellidos", array(), "any", false));
        echo "

    ";
        // line 33
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "email", array(), "any", false));
        echo "

        ";
        // line 35
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "email", array(), "any", false));
        echo "
        ";
        // line 36
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "email", array(), "any", false));
        echo "

        ";
        // line 40
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "dni", array(), "any", false));
        echo "

            ";
        // line 42
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "dni", array(), "any", false));
        echo "
            ";
        // line 43
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "dni", array(), "any", false));
        echo "

        ";
        // line 48
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "telefono", array(), "any", false));
        echo "

            ";
        // line 50
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "telefono", array(), "any", false));
        echo "
            ";
        // line 51
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "telefono", array(), "any", false));
        echo "

    ";
        // line 55
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "direccion", array(), "any", false));
        echo "

        ";
        // line 57
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, 'form'), "direccion", array(), "any", false));
        echo "
        ";
        // line 58
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "direccion", array(), "any", false));
        echo "

        ";
        // line 62
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "first", array(), "any", false));
        echo "

            ";
        // line 64
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "first", array(), "any", false), "Contraseña");
        echo "
            ";
        // line 65
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "first", array(), "any", false));
        echo "

        ";
        // line 70
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "second", array(), "any", false));
        echo "

            ";
        // line 72
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "second", array(), "any", false), "Repetir contraseña");
        echo "
            ";
        // line 73
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getAttribute($this->getContext($context, 'form'), "password", array(), "any", false), "second", array(), "any", false));
        echo "

    ";
        // line 76
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, 'form'), "_token", array(), "any", false));
        echo "
    ";
        // line 77
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, 'form'), "_token", array(), "any", false));
        echo "

    <input type=\"submit\" value=\"Regístrate\" />
</form>
";
    }

    // line 83
    public function block_lateral($context, array $blocks = array())
    {
        // line 84
        echo "

¿Ya estás registrado? env, $this->env->getExtension('routing')->getPath("login"), "html");
        echo "\">Haz login

Ventajas de asistir a las jornadas

Lorem ipsum et dolor

Lorem ipsum et dolor

Lorem ipsum et dolor

Preguntas frecuentes

Lorem ipsum et dolor

Lorem ipsum et dolor

Lorem ipsum et dolor

";
    }

    public function getTemplateName()
    {
        return "DesymfonyBundle:Usuario:registro.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }
}


text:
/*
    Leola Programming Language
    Author: Tony Sparks
    See license.txt
*/
package leola.ast;

import leola.vm.EvalException;

/**
 * Return statement
 *
 * @author Tony
 *
 */
public class ReturnStmt extends Stmt {

    private Expr expr;

    /**
     * @param expr
     */
    public ReturnStmt(Expr expr) {
        this.expr = becomeParentOf(expr);
    }

    /* (non-Javadoc)
     * @see leola.ast.ASTNode#visit(leola.ast.ASTNodeVisitor)
     */
    @Override
    public void visit(ASTNodeVisitor v) throws EvalException {
        v.visit(this);
    }

    /**
     * @return the expr
     */
    public Expr getExpr() {
        return expr;
    }
}


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

import com.facebook.presto.testing.LocalQueryRunner;

import static com.facebook.presto.benchmark.BenchmarkQueryRunner.createLocalQueryRunner;

public class SqlJoinWithPredicateBenchmark
        extends AbstractSqlBenchmark
{
    public SqlJoinWithPredicateBenchmark(LocalQueryRunner localQueryRunner)
    {
        super(localQueryRunner,
                "sql_join_with_predicate",
                1,
                5,
                "select count(*) from lineitem l join orders o on l.orderkey = o.orderkey and l.partkey % 2 = 0 and o.orderkey % 2 = 0\n");
    }

    public static void main(String[] args)
    {
        new SqlJoinWithPredicateBenchmark(createLocalQueryRunner()).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xerces-C++: XMLEntityDecl.hpp File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Related Pages

Classes

Files

XMLEntityDecl.hpp File Reference

Go to the source code of this file.

Classes

class  	XMLEntityDecl

 	This class defines that core information that defines an XML entity, no matter what validator is used.  More...

Defines

#define 	XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP

Define Documentation

          #define XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP

<address style="text-align: right;">Generated on Wed Apr 21 17:55:49 2010 for Xerces-C++ by

 1.5.6 </address>


text:
set :stages, %w(old production)
set :default_stage, "production"
require 'capistrano/ext/multistage'