text:
package flex2.compiler.asdoc;

import flex2.compiler.mxml.lang.StandardDefs;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * This class is used to generate the toplevel.xml file.
 *
 */
public class TopLevelGenerator implements DocCommentGenerator
{
    StringBuilder xml;

    /**
     * Constructor
     */
    public TopLevelGenerator()
    {
        xml = new StringBuilder();
    }

    /**
     * Future implementation of this will just save it to a file in generate.
     */
    public String toString()
    {
        return xml.toString();
    }

    /**
     * Iterates through all classes and creates toplevel.xml
     */
    public void generate(DocCommentTable table)
    {
        xml.append("<asdoc>\n");
        Iterator packageIterator = table.getPackages().keySet().iterator();
        while (packageIterator.hasNext())
        {
            String currentPackage = (String)packageIterator.next();
            Iterator classIterator = table.getClassesAndInterfaces(currentPackage).keySet().iterator();
            while (classIterator.hasNext())
            {
                String currentClass = (String)classIterator.next();
                Iterator commentsIterator = table.getAllClassComments(currentClass, currentPackage).iterator();
                while (commentsIterator.hasNext())
                {
                    emitDocComment((DocComment)commentsIterator.next());
                }
            }
        }
        xml.append("\n</asdoc>\n");
    }

    /**
     * helper method for printing a tag in toplevel.xml
     * @param tagName
     * @param value
     */
    private void appendTag(String tagName, String value)
    {
        xml.append("\n<");
        xml.append(tagName);
        xml.append("><![CDATA[");
        xml.append(value);
        xml.append("]]></");
        xml.append(tagName);
        xml.append(">");
    }

    /**
     * append all tags in xml format (except inheritDoc)
     * @param tags
     */
    private void emitTags(Map tags)
    {
        Iterator tagIterator = tags.keySet().iterator();
        while (tagIterator.hasNext())
        {
            String tagName = ((String)tagIterator.next()).intern();
            Object o = tags.get(tagName);
            if (o == null)
                continue;
            if (o instanceof Boolean)
            {
                boolean b = ((Boolean)o).booleanValue();
                if (b)
                {
                    appendTag(tagName, "");
                }
                else
                    continue;
            }
            else if (o instanceof List)
            {
                List l = (List)o;
                for (int i = 0; i < l.size(); i++)
                {
                    String value = (String)l.get(i);
                    appendTag(tagName, value);
                }
            }
            else if (o instanceof Map)   //custom Tags (implied tagName.equals("custom")
            {
                Map m = (Map)o;
                Iterator customTagIter = m.keySet().iterator();
                while (customTagIter.hasNext())
                {
                    tagName = (String)customTagIter.next();
                    String value = (String)m.get(tagName);
                    appendTag(tagName, value);
                }
            }
            else
            {
                String value = (String)o;
                appendTag(tagName, value);
            }
        }
    }

    /**
     * appends metadata associated with a definition.
     * @param metadata
     */
    private void emitMetadata(List metadata)
    {
        for (int i = 0; i < metadata.size(); i++)
        {
            DocComment meta = (DocComment)metadata.get(i);
            String metadataType = meta.getMetadataType().intern();
            xml.append("\n<metadata>\n");
            xml.append("\t<");
            xml.append(metadataType);
            xml.append(" owner='");
            xml.append(meta.getOwner());
            xml.append("' ");
            String name = meta.getName();
            if (!name.equals("IGNORE"))
                xml.append("name='").append(name).append("' ");
            String type_meta = meta.getType_meta();
            if (type_meta != null)
            {
                xml.append("type='").append(type_meta).append("' ");
            }

            String event_meta = meta.getEvent_meta();
            if (event_meta != null)
            {
                xml.append("event='").append(event_meta).append("' ");
            }
            String kind_meta = meta.getKind_meta();
            if (kind_meta != null)
            {
                xml.append("kind='").append(kind_meta).append("' ");
            }
            String arrayType_meta = meta.getArrayType_meta();
            if (arrayType_meta != null)
            {
                xml.append("arrayType='").append(arrayType_meta).append("' ");
            }
            String format_meta = meta.getFormat_meta();
            if (format_meta != null)
            {
                xml.append("format='").append(format_meta).append("' ");
            }
            String enumeration_meta = meta.getEnumeration_meta();
            if (enumeration_meta != null)
            {
                xml.append("enumeration='").append(enumeration_meta).append("' ");
            }
            String inherit_meta = meta.getInherit_meta();
            if (inherit_meta != null)
            {
                xml.append("inherit='").append(inherit_meta).append("' ");
            }

            if (metadataType == StandardDefs.MD_EVENT || metadataType == StandardDefs.MD_STYLE || metadataType == StandardDefs.MD_EFFECT)
            {
                // if message meta data is present then emit it. Applicable for Deprecation
                String message_meta = meta.getMessage_meta();
                if (message_meta != null)
                {
                    xml.append("deprecatedMessage='").append(message_meta).append("' ");
                }

                // if replacement meta data is present then emit it. Applicable for Deprecation
                String replacement_meta = meta.getReplacement_meta();
                if (replacement_meta != null)
                {
                    xml.append("deprecatedReplacement='").append(replacement_meta).append("' ");
                }

                // if since meta data is present then emit it. Applicable for Deprecation
                String since_meta = meta.getSince_meta();
                if (since_meta != null)
                {
                    xml.append("deprecatedSince='").append(since_meta).append("' ");
                }

                if(metadataType == StandardDefs.MD_STYLE)
                {
                	// if theme meta data is present then emit it.
                    String theme_meta = meta.getTheme_meta();
                    if (theme_meta != null)
                    {
                        xml.append("theme='").append(theme_meta).append("' ");
                    }
                }
            }
            else if(metadataType == StandardDefs.MD_SKINPART)
            {
                String variableType_meta = meta.getVariableType_meta();
                if (variableType_meta != null)
                {
                    xml.append("var_type='").append(variableType_meta).append("' ");
                }

                String required_meta = meta.getRequired_meta();
                if (required_meta != null)
                {
                    xml.append("required='").append(required_meta).append("' ");
                }
                else
                {
                    // false is now the default value for required in case of SkinPart.
                    xml.append("required='false' ");
                }
            }
            else
            {
                // if message meta data is present then emit it. Applicable for Deprecation
                String message_meta = meta.getMessage_meta();
                if (message_meta != null)
                {
                    xml.append("message='").append(message_meta).append("' ");
                }

                // if replacement meta data is present then emit it. Applicable for Deprecation
                String replacement_meta = meta.getReplacement_meta();
                if (replacement_meta != null)
                {
                    xml.append("replacement='").append(replacement_meta).append("' ");
                }

                // if since meta data is present then emit it. Applicable for Deprecation
                String since_meta = meta.getSince_meta();
                if (since_meta != null)
                {
                    xml.append("since='").append(since_meta).append("' ");
                }
            }

            xml.append(">");

            //These types of metadata can have comments associated with them
            if (metadataType == StandardDefs.MD_EVENT || metadataType == StandardDefs.MD_STYLE || metadataType == StandardDefs.MD_EFFECT
                    || metadataType == StandardDefs.MD_SKINSTATE || metadataType == StandardDefs.MD_SKINPART || metadataType == StandardDefs.MD_ALTERNATIVE
                    || metadataType == StandardDefs.MD_DISCOURAGEDFORPROFILE || metadataType == StandardDefs.MD_EXPERIMENTAL)
            {
                String desc = meta.getDescription();
                if (desc != null)
                    appendTag("description", meta.getDescription());
                emitTags(meta.getAllTags());
            }
            xml.append("\n\t</");
            xml.append(metadataType);
            xml.append(">\n</metadata>");
        }

    }

    /**
     * Appends a package.
     * @param comment
     */
    private void emitPackage(DocComment comment)
    {
        xml.append("\n<packageRec name='");
        xml.append(comment.getFullname());
        xml.append("' fullname='");
        xml.append(comment.getFullname());
        xml.append("'>");

        String desc = comment.getDescription();
        if (desc != null)
            appendTag("description", comment.getDescription());
        emitTags(comment.getAllTags());

        xml.append("\n</packageRec>");
    }

    /**
     * Appends a class or interface
     * @param comment
     */
    private void emitClass(DocComment comment)
    {
        String tagName = (comment.getType() == DocComment.CLASS) ? "classRec" : "interfaceRec";
        xml.append("\n<");
        xml.append(tagName);
        xml.append(" name='");
        xml.append(comment.getName());
        xml.append("' fullname='");
        xml.append(comment.getFullname());
        String sourcefile = comment.getSourceFile();
        if (sourcefile != null)
        {
            xml.append("' sourcefile='");
            xml.append(sourcefile);
        }
        xml.append("' namespace='");
        xml.append(comment.getNamespace());
        xml.append("' access='");
        xml.append(comment.getAccess());
        xml.append("' ");
        if (comment.getType() == DocComment.INTERFACE)
        {
            String[] baseClasses = comment.getBaseclasses();
            if (baseClasses != null)
            {
                xml.append("baseClasses='");
                for (int i = 0; i < baseClasses.length; i++)
                {
                    String baseclass = baseClasses[i];
                    if (baseclass != null)
                    {
                        if (i != 0)
                            xml.append(";");
                        xml.append(baseclass);
                    }
                }
                xml.append("' ");
            }
        }
        else
        {
            xml.append("baseclass='");
            xml.append(comment.getBaseClass());
            xml.append("' ");
            String[] interfaces = comment.getInterfaces();
            if (interfaces != null)
            {
                xml.append("interfaces='");
                for (int i = 0; i < interfaces.length; i++)
                {
                    String inter = interfaces[i];
                    if (inter != null)
                    {
                        if (i != 0)
                            xml.append(";");
                        xml.append(inter);
                    }
                }
                xml.append("' ");
            }
        }
        xml.append("isFinal='");
        xml.append(comment.isFinal());
        xml.append("' ");
        xml.append("isDynamic='");
        xml.append(comment.isDynamic());
        xml.append("' ");
        xml.append(">");

        String desc = comment.getDescription();
        if (desc != null)
            appendTag("description", comment.getDescription());
        emitTags(comment.getAllTags());

        if (comment.getMetadata() != null)
            emitMetadata(comment.getMetadata());
        xml.append("\n</");
        xml.append(tagName);
        xml.append(">");
    }

    /**
     * Appends a function
     * @param comment
     */
    private void emitFunction(DocComment comment)
    {
        xml.append("\n<method name='");
        xml.append(comment.getName());
        xml.append("' fullname='");
        xml.append(comment.getFullname());
        xml.append("' ");
        xml.append("isStatic='");
        xml.append(comment.isStatic());
        xml.append("' ");
        xml.append("isFinal='");
        xml.append(comment.isFinal());
        xml.append("' ");
        xml.append("isOverride='");
        xml.append(comment.isOverride());
        xml.append("' ");

        String[] param_names = comment.getParamNames();
        if (param_names != null)
        {
            xml.append(" param_names='");
            for (int i = 0; i < param_names.length; i++)
            {
                String pname = param_names[i];
                if (pname != null)
                {
                    if (i != 0)
                        xml.append(";");
                    xml.append(pname);
                }
            }
            xml.append("'");

            String[] param_types = comment.getParamTypes();
            xml.append(" param_types='");
            for (int i = 0; i < param_types.length; i++)
            {
                String ptype = param_types[i];
                if (ptype != null)
                {
                    if (i != 0)
                        xml.append(";");
                    xml.append(ptype);
                }
            }
            xml.append("'");

            String[] param_defaults = comment.getParamDefaults();
            xml.append(" param_defaults='");
            for (int i = 0; i < param_defaults.length; i++)
            {
                String pdefa = param_defaults[i];
                if (pdefa != null)
                {
                    if (i != 0)
                        xml.append(";");
                    xml.append(pdefa);
                }
            }
            xml.append("'");
        }

        xml.append(" result_type='");
        xml.append(comment.getResultType());
        xml.append("'>");

        String desc = comment.getDescription();
        if (desc != null)
            appendTag("description", comment.getDescription());
        emitTags(comment.getAllTags());

        if (comment.getMetadata() != null)
            emitMetadata(comment.getMetadata());
        xml.append("\n</method>");
    }

    /**
     * Appends a field.
     * @param comment
     */
    private void emitField(DocComment comment)
    {
        xml.append("\n<field name='");
        xml.append(comment.getName());
        xml.append("' fullname='");
        xml.append(comment.getFullname());
        xml.append("' type='");
        String type = comment.getVartype();
        if (type != null)
            xml.append(comment.getVartype());
        xml.append("' isStatic='");
        xml.append(comment.isStatic());
        xml.append("' isConst='");
        xml.append(comment.isConst());
        xml.append("' ");
        String defaultValue = comment.getDefaultValue();
        if (defaultValue != null)
        {
            xml.append("defaultValue='");

            try
            {
                Pattern pattern = Pattern.compile("\\p{Cntrl}");
                Matcher matcher = pattern.matcher(defaultValue);
                defaultValue = matcher.replaceAll("");
            }
            catch (Exception ex) {}

            xml.append(defaultValue);
            xml.append("' ");
        }
        xml.append(">");

        String desc = comment.getDescription();
        if (desc != null)
            appendTag("description", comment.getDescription());
        emitTags(comment.getAllTags());

        if (comment.getMetadata() != null)
            emitMetadata(comment.getMetadata());
        xml.append("\n</field>");
    }

    /**
     * Appends a specific comment to the StringBuilder.
     * @param comment
     */
    private void emitDocComment(DocComment comment)
    {
        if (!comment.isExcluded())
        {
            int type = comment.getType();
            if (type == DocComment.PACKAGE)
                emitPackage(comment);
            else if (type == DocComment.CLASS || type == DocComment.INTERFACE)
                emitClass(comment);
            else if (type >= DocComment.FUNCTION && type <= DocComment.FUNCTION_SET)
                emitFunction(comment);
            else if (type == DocComment.FIELD)
                emitField(comment);
        }
    }

}


text:
package morbrian.mormessages.rest;

import morbrian.mormessages.controller.Subscription;
import morbrian.mormessages.controller.SubscriptionManager;
import org.slf4j.Logger;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import java.io.IOException;
import java.security.Principal;
import java.util.List;

@Path("/subscription") @RequestScoped public class SubscriptionRestApi {

  @Inject private Logger logger;
  @Inject private SubscriptionManager subscriptionManager;
  @Inject private Principal principal;

  @GET @Path("/") @Produces(MediaType.APPLICATION_JSON)
  public List<Subscription> listSubscriptions() {
    return subscriptionManager.listSubscriptions(principal.getName());
  }

  @GET @Path("/{subscriptionId}") @Produces(MediaType.APPLICATION_JSON)
  public Subscription getSubscription(@PathParam("subscriptionId") String subscriptionId) {
    Subscription subscription = subscriptionManager.getSubscription(subscriptionId);
    if (subscription != null) {
      return subscription;
    } else {
      Response error = Response.status(Response.Status.NOT_FOUND)
          .entity("no subscription for id " + subscriptionId).build();
      throw new WebApplicationException(error);
    }
  }

  @PUT @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
  public Subscription createSubscription(Subscription subscription,
      @Context final HttpServletResponse response) throws IOException {
    String userIdentity = (principal != null) ? principal.getName() : "";
    String topicId = subscription.getTopicId();
    if (userIdentity == null || !userIdentity.equals(subscription.getUserIdentity())) {
      Response error = Response.status(Status.BAD_REQUEST)
          .entity("subscriptions can only be created for the user making the request").build();
      throw new WebApplicationException(error);
    }

    Subscription created = subscriptionManager.createSubscription(topicId, userIdentity);
    response.setStatus(HttpServletResponse.SC_CREATED);
    response.flushBuffer();
    logger.info("(create-subscription) user(" + userIdentity + ") on topic (" + topicId + ")");
    return created;
  }

  @POST @Path("/{subscriptionId}") @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public Subscription modifySubscription(@PathParam("subscriptionId") String subscriptionId, Subscription subscription) {
    String userIdentity = (principal != null) ? principal.getName() : "";
    if (userIdentity == null || !userIdentity.equals(subscription.getUserIdentity())) {
      Response error = Response.status(Status.BAD_REQUEST)
          .entity("subscriptions can only be modified for the user making the request").build();
      throw new WebApplicationException(error);
    }
    if (subscriptionId == null || !subscriptionId.equals(subscription.getSubscriptionId())) {
      Response error = Response.status(Status.BAD_REQUEST)
          .entity("subscriptionId on request path does not match subscriptiom in request body").build();
      throw new WebApplicationException(error);
    }
    String topicId = subscription.getTopicId();
    Subscription storedSubscription =
        subscriptionManager.getSubscription(subscription.getSubscriptionId());
    if (topicId == null || !topicId.equals(storedSubscription.getTopicId())) {
      Response error = Response.status(Status.BAD_REQUEST).entity(
          "modification of topicId not allowd; delete the subscription and create a new one")
          .build();
      throw new WebApplicationException(error);
    }

    return subscriptionManager.renewSubscription(subscription);
  }

  @DELETE @Path("/{subscriptionId}") @Produces(MediaType.APPLICATION_JSON)
  public void deleteSubscription(@PathParam("subscriptionId") String subscriptionId) {
    Subscription subscription = subscriptionManager.getSubscription(subscriptionId);
    if (subscription == null) {
      // nothing to do, it's also possible the subscription belongs to somebody else
      return;
    }
    subscriptionManager.deleteSubscription(subscriptionId);
  }

}

redpajama_set_name: RedPajamaGithub


text:
/* eslint no-unused-vars: "off" */

module.exports = (app) => {
  // catch 404 and forward to error handler
  app.use((req, res, next) => {
    const err = new Error('Not Found');
    err.code = 404;
    err.message = 'Not Found';
    next(err);
  });

  // error handler
  app.use((err, req, res, next) => {
    const error = {
      code: err.code || 500,
      error: err.error || err.message,
    };
    res.status(error.code).json(error);
  });
};


text:
<!DOCTYPE html>

		{{ partial "head" . }}

			{{ partial "header" . }}

			{{ partial "teaser" . }}

				{{ .Content }}

					Written by {{ .Params.author }}, {{ .Date.Format "January 2006" }}

			{{ if .Params.disqus }}

			{{ end }}

			{{ partial "footer" . }}

		{{ partial "scripts" .}}


text:
.class Landroid/widget/RemoteViews$SetOnClickFillInIntent;
.super Landroid/widget/RemoteViews$Action;
.source "RemoteViews.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/RemoteViews;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "SetOnClickFillInIntent"
.end annotation

# static fields
.field public static final TAG:I = 0x9

# instance fields
.field fillInIntent:Landroid/content/Intent;

.field final synthetic this$0:Landroid/widget/RemoteViews;

# direct methods
.method public constructor <init>(Landroid/widget/RemoteViews;ILandroid/content/Intent;)V
    .locals 1
    .param p1, "this$0"    # Landroid/widget/RemoteViews;
    .param p2, "id"    # I
    .param p3, "fillInIntent"    # Landroid/content/Intent;

    .prologue
    .line 381
    iput-object p1, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->this$0:Landroid/widget/RemoteViews;

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Landroid/widget/RemoteViews$Action;-><init>(Landroid/widget/RemoteViews$Action;)V

    .line 382
    iput p2, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->viewId:I

    .line 383
    iput-object p3, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->fillInIntent:Landroid/content/Intent;

    .line 381
    return-void
.end method

.method public constructor <init>(Landroid/widget/RemoteViews;Landroid/os/Parcel;)V
    .locals 1
    .param p1, "this$0"    # Landroid/widget/RemoteViews;
    .param p2, "parcel"    # Landroid/os/Parcel;

    .prologue
    .line 386
    iput-object p1, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->this$0:Landroid/widget/RemoteViews;

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Landroid/widget/RemoteViews$Action;-><init>(Landroid/widget/RemoteViews$Action;)V

    .line 387
    invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I

    move-result v0

    iput v0, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->viewId:I

    .line 388
    sget-object v0, Landroid/content/Intent;->CREATOR:Landroid/os/Parcelable$Creator;

    invoke-interface {v0, p2}, Landroid/os/Parcelable$Creator;->createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/Intent;

    iput-object v0, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->fillInIntent:Landroid/content/Intent;

    .line 386
    return-void
.end method

# virtual methods
.method public apply(Landroid/view/View;Landroid/view/ViewGroup;Landroid/widget/RemoteViews$OnClickHandler;)V
    .locals 4
    .param p1, "root"    # Landroid/view/View;
    .param p2, "rootParent"    # Landroid/view/ViewGroup;
    .param p3, "handler"    # Landroid/widget/RemoteViews$OnClickHandler;

    .prologue
    .line 399
    iget v2, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->viewId:I

    invoke-virtual {p1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    .line 400
    .local v1, "target":Landroid/view/View;
    if-nez v1, :cond_0

    return-void

    .line 402
    :cond_0
    iget-object v2, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->this$0:Landroid/widget/RemoteViews;

    invoke-static {v2}, Landroid/widget/RemoteViews;->-get1(Landroid/widget/RemoteViews;)Z

    move-result v2

    if-nez v2, :cond_1

    .line 403
    const-string/jumbo v2, "RemoteViews"

    const-string/jumbo v3, "The method setOnClickFillInIntent is available only from RemoteViewsFactory (ie. on collection items)."

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 405
    return-void

    .line 407
    :cond_1
    if-ne v1, p1, :cond_3

    .line 408
    iget-object v2, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->fillInIntent:Landroid/content/Intent;

    const v3, 0x1020045

    invoke-virtual {v1, v3, v2}, Landroid/view/View;->setTagInternal(ILjava/lang/Object;)V

    .line 398
    :cond_2
    :goto_0
    return-void

    .line 409
    :cond_3
    iget-object v2, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->fillInIntent:Landroid/content/Intent;

    if-eqz v2, :cond_2

    .line 410
    new-instance v0, Landroid/widget/RemoteViews$SetOnClickFillInIntent$1;

    invoke-direct {v0, p0, p3}, Landroid/widget/RemoteViews$SetOnClickFillInIntent$1;-><init>(Landroid/widget/RemoteViews$SetOnClickFillInIntent;Landroid/widget/RemoteViews$OnClickHandler;)V

    .line 442
    .local v0, "listener":Landroid/view/View$OnClickListener;
    invoke-virtual {v1, v0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    goto :goto_0
.end method

.method public getActionName()Ljava/lang/String;
    .locals 1

    .prologue
    .line 447
    const-string/jumbo v0, "SetOnClickFillInIntent"

    return-object v0
.end method

.method public writeToParcel(Landroid/os/Parcel;I)V
    .locals 2
    .param p1, "dest"    # Landroid/os/Parcel;
    .param p2, "flags"    # I

    .prologue
    .line 392
    const/16 v0, 0x9

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 393
    iget v0, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->viewId:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 394
    iget-object v0, p0, Landroid/widget/RemoteViews$SetOnClickFillInIntent;->fillInIntent:Landroid/content/Intent;

    const/4 v1, 0x0

    invoke-virtual {v0, p1, v1}, Landroid/content/Intent;->writeToParcel(Landroid/os/Parcel;I)V

    .line 391
    return-void
.end method


text:
@interface SDKPanner ()

@property (nonatomic, strong) NSBox *box;
@property (nonatomic, strong) NSButton *button;
@property (nonatomic, assign) CGPoint cgPointValue;
@property (nonatomic, assign) SEL action;
@property (nonatomic, assign) id target;
@property (nonatomic, assign) BOOL enabled;

@end

@implementation SDKPanner
@synthesize enabled = _enabled;

- (void)commonInit {
  NSBox *box = [[NSBox alloc] initWithFrame:self.bounds];
  box.autoresizingMask = (NSViewWidthSizable | NSViewHeightSizable);
  box.translatesAutoresizingMaskIntoConstraints = YES;
  box.title = @"";
  box.titlePosition = NSNoTitle;
  [self addSubview:box];
  self.box = box;

  NSButton *button = [[NSButton alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
  button.bezelStyle = NSCircularBezelStyle;
  button.frame = CGRectMake((self.bounds.size.width - button.frame.size.width) / 2.0,
                            (self.bounds.size.width - button.frame.size.width) / 2.0,
                            button.frame.size.width,
                            button.frame.size.height);
  [button setEnabled:NO];
  [button setTitle:@""];
  [self addSubview:button];
  self.button = button;

  self.enabled = YES;
}

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

- (id)initWithFrame:(NSRect)frameRect {
  self = [super initWithFrame:frameRect];
  if (self) {
    [self commonInit];
  }
  return self;
}

- (void)trackMouse {
  NSPoint mouse = [self.window convertScreenToBase:[NSEvent mouseLocation]];
  NSPoint converted = [self convertPoint:mouse fromView:nil];
  CGPoint cgConv = NSPointToCGPoint(converted);
  cgConv.x = MIN(MAX(0, cgConv.x), self.bounds.size.width);
  cgConv.y = MIN(MAX(0, cgConv.y), self.bounds.size.height);
  self.button.center = cgConv;

  CGPoint unit = {cgConv.x / self.bounds.size.width - 0.5,
                  cgConv.y / self.bounds.size.height - 0.5};
  self.cgPointValue = unit;
  [self sendAction:self.action to:self.target];
}

- (void)mouseDown:(NSEvent *)theEvent {
  if (!self.enabled) return;
  [self trackMouse];
  [super mouseDown:theEvent];
  [self.button setEnabled:YES];
  [self.button highlight:YES];
}

- (void)mouseDragged:(NSEvent *)theEvent {
  if (!self.enabled) return;
  [self trackMouse];
}

- (void)mouseUp:(NSEvent *)theEvent {
  [super mouseUp:theEvent];
  self.button.center = self.box.center;
  [self.button setEnabled:NO];
  [self.button highlight:NO];
  self.cgPointValue = CGPointZero;
  [self sendAction:self.action to:self.target];
}

- (void)setEnabled:(BOOL)enabled {
  _enabled = enabled;
  if (enabled) {
    self.alphaValue = 1.0;
  } else {
    self.alphaValue = 0.5;
  }
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string name="app_name">Mapyst</string>
	<string name="buttonHandler">onClickHandler</string>
	<string name="imageButtonHandler">onImageClickHandler</string>
	<string name="configure_intro">Images Widget Configuration</string>
	<string name="configure_update">Update Time</string>
	<string name="udpate_rate_hint">value in seconds</string>
	<string name="save_config">Save</string>
</resources>


text:
/* Memory block management routines */

#include "memint.h"

#if defined(__STDC__)
extern void exit(int);
#else
extern void exit();
#endif

/* Amount of memory allocated */

static SIZE_T block_allocation;

/* mem_copy(dest, src, size) copies a block of memory. */

void
#if defined(__STDC__)
mem_copy(pointer dest, pointer src, SIZE_T size)
#else
mem_copy(dest, src, size)
     pointer dest;
     pointer src;
     SIZE_T size;
#endif
{
  MEM_COPY(dest, src, size);
}

/* mem_zero(ptr, size) zeros a block of memory. */

void
#if defined(__STDC__)
mem_zero(pointer ptr, SIZE_T size)
#else
mem_zero(ptr, size)
     pointer ptr;
     SIZE_T size;
#endif
{
  MEM_ZERO(ptr, size);
}

extern void (*bdd_fatal_hook)(char *message);

/* mem_fatal(message) prints an error message and exits. */

void
#if defined(__STDC__)
mem_fatal(char *message)
#else
mem_fatal(message)
     char *message;
#endif
{
  fprintf(stderr, "Memory management library: error: %s\n", message);
  if (bdd_fatal_hook == NULL)
  {
	exit(1);
  }
  else
  {
	  (*bdd_fatal_hook)(message);
  }
}

SIZE_T
#if defined(__STDC__)
mem_allocation(void)
#else
mem_allocation()
#endif
{
  /* This will always returns zero when we're using malloc and free, */
  /* but you can maybe change it depending on your system. */
  return (block_allocation);
}

char *
#if defined(__STDC__)
mem_version(void)
#else
mem_version()
#endif
{
  return ("1.0");
}

/******************************************************************/
/* This code used if we're going to do our own memory management. */

#if !defined(USE_MALLOC_FREE)
/* Free lists of various sizes */

static block avail[MAX_SIZE_INDEX+1];

/* Bogus segment for initialization */

static struct segment_ dummy_seg={(pointer)0, (SIZE_T)0};

/* Current segment */

static segment curr_seg= &dummy_seg;

static
int
#if defined(__STDC__)
ceiling_log_2(SIZE_T i)
#else
ceiling_log_2(i)
     SIZE_T i;
#endif
{
  SIZE_T j;
  int result;

  for (result=0, j=1; j < i; ++result, j*=2);
  return (result);
}

/* block_size_index(size) return the coded size for a block. */

static
int
#if defined(__STDC__)
block_size_index(SIZE_T size)
#else
block_size_index(size)
     SIZE_T size;
#endif
{
  if (size < 1)
    return (-1);
  if (size > MAX_SIZE)
    mem_fatal("block_size_index: block size too large");
  else
    size+=HEADER_SIZE;
  return (ceiling_log_2(size));
}

/* add_to_free_list(b) adds b to the appropriate free list. */

static
void
#if defined(__STDC__)
add_to_free_list(block b)
#else
add_to_free_list(b)
     block b;
#endif
{
  int i;

  i=b->size_index;
  if (!avail[i])
    {
      b->next=b;
      b->prev=b;
      avail[i]=b;
    }
  else
    {
      b->next=avail[i]->next;
      avail[i]->next->prev=b;
      avail[i]->next=b;
      b->prev=avail[i];
    }
  b->used=0;
}

/* remove_from_free_list(b) removes b from the free list which it */
/* is on. */

static
block
#if defined(__STDC__)
remove_from_free_list(block b)
#else
remove_from_free_list(b)
     block b;
#endif
{
  int i;

  i=b->size_index;
  if (b->next == b)
    avail[i]=0;
  else
    {
      b->next->prev=b->prev;
      b->prev->next=b->next;
      if (avail[i] == b)
	avail[i]=b->next;
    }
  b->used=1;
  return (b);
}

/* buddy(b) returns the buddy block of b, or null if there is no */
/* buddy. */

static
block
#if defined(__STDC__)
buddy(block b)
#else
buddy(b)
     block b;
#endif
{
  SIZE_T buddy_offset;

  buddy_offset=(SIZE_T)(((INT_PTR)b-(INT_PTR)b->seg->base_address) ^ ((SIZE_T)1 << b->size_index));
  if (buddy_offset < b->seg->limit)
    return ((block)((INT_PTR)b->seg->base_address+buddy_offset));
  else
    return ((block)0);
}

/* trim_to_size(b, size_index) repeatedly splits b until it has */
/* the indicated size.  Blocks which are split off are added to the */
/* appropriate free list. */

static
void
#if defined(__STDC__)
trim_to_size(block b, int size_index)
#else
trim_to_size(b, size_index)
     block b;
     int size_index;
#endif
{
  block bb;

  while (b->size_index > size_index)
    {
      b->size_index--;
      bb=buddy(b);
      bb->size_index=b->size_index;
      bb->seg=b->seg;
      add_to_free_list(bb);
    }
}

/* merge_and_free(b) repeatedly merges b its buddy until b has no */
/* buddy or the buddy isn't free, then adds the result to the */
/* appropriate free list. */

static
void
#if defined(__STDC__)
merge_and_free(block b)
#else
merge_and_free(b)
     block b;
#endif
{
  block bb;

  for (bb=buddy(b); bb && !bb->used && bb->size_index == b->size_index; bb=buddy(b))
    {
      remove_from_free_list(bb);
      if ((INT_PTR)bb < (INT_PTR)b)
	b=bb;
      b->size_index++;
    }
  add_to_free_list(b);
}

/* mem_get_block(size) allocates a new block of the specified size. */

pointer
#if defined(__STDC__)
mem_get_block(SIZE_T size)
#else
mem_get_block(size)
     SIZE_T size;
#endif
{
	int i;
	int size_index;
	int alloc_size_index;
	int new_seg;
	SIZE_T alloc_size;
	pointer sbrk_ret;
	block b;

	if ((size_index=block_size_index(size)) < 0)
		return ((pointer)0);
	/* Find smallest free block which is large enough. */
	for (i=size_index; i <= MAX_SIZE_INDEX && !avail[i]; ++i);
	if (i > MAX_SIZE_INDEX)
	{
		/* We must get more storage; don't allocate less than */
		/* 2^MIN_ALLOC_SIZE_INDEX. */
		if (size_index < MIN_ALLOC_SIZE_INDEX)
			alloc_size_index=MIN_ALLOC_SIZE_INDEX;
		else
			alloc_size_index=size_index;
		alloc_size=((SIZE_T)1 << alloc_size_index);
		/* Pad current segment to be a multiple of 2^alloc_size_index in */
		/* length. */
		alloc_size+=((curr_seg->limit+alloc_size-1) & ~(alloc_size-1))-curr_seg->limit;
		if ((sbrk_ret=(pointer)SBRK(0)) != (pointer)((INT_PTR)curr_seg->base_address+curr_seg->limit) || // FIXME: SBRK(0) leaks memory
			alloc_size+curr_seg->limit > MAX_SEG_SIZE)
		{
			/* Segment is too large or someone else has moved the break. */
			/* Pad to get to appropriate boundary. */
			alloc_size=ROUNDUP((INT_PTR)sbrk_ret)-(INT_PTR)sbrk_ret;
			/* Pad allocation request with storage for new segment */
			/* information and indicate that a new segment must be */
			/* created. */
			alloc_size+=((SIZE_T)1 << alloc_size_index)+ROUNDUP(sizeof(struct segment_));
			new_seg=1;
		}
		else
			new_seg=0;
		sbrk_ret=(pointer)SBRK(alloc_size);
		if (sbrk_ret == (pointer)-1)
			mem_fatal("mem_get_block: allocation failed");
		block_allocation+=alloc_size;
		if (new_seg)
		{
			curr_seg=(segment)ROUNDUP((INT_PTR)sbrk_ret);
			curr_seg->base_address=(pointer)((INT_PTR)curr_seg+ROUNDUP(sizeof(struct segment_)));
			curr_seg->limit=0;
			/* Readjust allocation size. */
			alloc_size=(1l << alloc_size_index);
		}
      /* Carve allocated space up into blocks and add to free lists. */
		while (alloc_size)
		{
			size=alloc_size-(alloc_size & (alloc_size-1));
			b=(block)((INT_PTR)curr_seg->base_address+curr_seg->limit);
			b->size_index=ceiling_log_2(size);
			b->seg=curr_seg;
			add_to_free_list(b);
			curr_seg->limit+=size;
			alloc_size-=size;
		}
		/* Find free block of appropriate size. */
		for (i=size_index; i <= MAX_SIZE_INDEX && !avail[i]; ++i);
	}
	b=remove_from_free_list(avail[i]);
	trim_to_size(b, size_index);
	return ((pointer)((INT_PTR)b+HEADER_SIZE));
}

/* mem_free_block(p) frees the block indicated by p. */

void
#if defined(__STDC__)
mem_free_block(pointer p)
#else
mem_free_block(p)
     pointer p;
#endif
{
  block b;

  if (!p)
    return;
  b=(block)((INT_PTR)p-HEADER_SIZE);
  if (!b->used)
    mem_fatal("mem_free_block: block not in use");
  if (b->size_index < 0 || b->size_index > MAX_SIZE_INDEX)
    mem_fatal("mem_free_block: invalid block header");
  merge_and_free(b);
}

/* mem_resize_block(p, new_size) expands or contracts the block */
/* indicated by p to a new size.  We try to avoid moving the block if */
/* possible. */

pointer
#if defined(__STDC__)
mem_resize_block(pointer p, SIZE_T new_size)
#else
mem_resize_block(p, new_size)
     pointer p;
     SIZE_T new_size;
#endif
{
  int new_size_index;
  block b;
  block bb;
  pointer q;
  SIZE_T old_size;

  if (!p)
    return (mem_get_block(new_size));
  b=(block)((INT_PTR)p-HEADER_SIZE);
  if (!b->used)
    mem_fatal("mem_resize_block: block not in use");
  if (b->size_index < 0 || b->size_index > MAX_SIZE_INDEX)
    mem_fatal("mem_resize_block: invalid block header");
  if ((new_size_index=block_size_index(new_size)) < 0)
    {
      mem_free_block(p);
      return ((pointer)0);
    }
  if (b->size_index >= new_size_index)
    {
      /* Shrink block. */
      trim_to_size(b, new_size_index);
      return (p);
    }
  old_size=(1l << b->size_index)-HEADER_SIZE;
  /* Try to expand by adding buddies at higher addresses. */
  for (bb=buddy(b);
       bb && (INT_PTR)b < (INT_PTR)bb && !bb->used && bb->size_index == b->size_index;
       bb=buddy(b))
    {
      remove_from_free_list(bb);
      if (++(b->size_index) == new_size_index)
	return (p);
    }
  /* Couldn't expand all the way to needed size; allocate a new block */
  /* and move the contents of the old one. */
  q=mem_get_block(new_size);
  mem_copy(q, p, old_size);
  merge_and_free(b);
  return (q);
}
#endif

/******************************************************************/

/* This code used if we're using malloc and free. */

#if defined(USE_MALLOC_FREE)
pointer
#if defined(__STDC__)
mem_get_block(SIZE_T size)
#else
mem_get_block(size)
     SIZE_T size;
#endif
{
  pointer result;
  void *p;

  if (size <= 0)
    return ((pointer)0);

  p = MALLOC(size + 1);

  result = (void *)((unsigned long)((unsigned long)p + 0x08) & 0xFFFFFFFF8);

  if (!result)
    mem_fatal("mem_get_block: allocation failed (USE_MALLOC_FREE defined)");

  printf("result = %x\n", result);

#ifdef WIN32
  /*
  (unsigned long)result = (unsigned long)result + 0x08;

  (unsigned long)result = ((unsigned long)result & 0xFFFFFFF8);
*/
  if((unsigned long)result & 0x07)  {
	printf("result = %x\n", result);
    mem_fatal("mem_get_block: not aligned on 8 byte boundry");
  }
#endif
  return (result);
}

void
#if defined(__STDC__)
mem_free_block(pointer p)
#else
mem_free_block(p)
     pointer p;
#endif
{
  if (!p)
    return;
  FREE(p);
}

pointer
#if defined(__STDC__)
mem_resize_block(pointer p, SIZE_T new_size)
#else
mem_resize_block(p, new_size)
     pointer p;
     SIZE_T new_size;
#endif
{
  void *np;
  pointer result;
  SIZE_T old_size;

  if (!p)
    return (mem_get_block(new_size));
  if (new_size <= 0)
    {
      mem_free_block(p);
      return ((pointer)0);
    }

 /* old_size = _msize(p);
*/
  printf("old_size = %d\n", old_size);

  /*np = REALLOC(p, new_size+8);
  */

  result = mem_get_block(new_size);

  if (!result)
    mem_fatal("mem_resize_block: allocation failed (USE_MALLOC_FREE defined)");

  /*mem_copy(result, p, old_size);
*/
  mem_free_block(p);

#ifdef WIN32

  if((unsigned long)result & 0x07)  {
	printf("result = %x\n", result);
    mem_fatal("mem_resize_block: not aligned on 8 byte boundry");
  }
#endif
  return (result);
}
#endif

void
#if defined(__STDC__)
mem_quit(void)
#else
mem_quit()
#endif
{
//	int i;
//	for (i=0; i<MAX_SIZE_INDEX+1; i++)
//	{
//		void *p = avail[i];
//		if (p) while(p->next) p = p->next;
//		// now we are at the end of list
//
//	}
}


text:
jQuery(function($) {
    $.fn.authchoice = function(options) {
        options = $.extend({
            popup: {
                resizable: 'yes',
                scrollbars: 'no',
                toolbar: 'no',
                menubar: 'no',
                location: 'no',
                directories: 'no',
                status: 'yes',
                width: 450,
                height: 380
            }
        }, options);

        return this.each(function() {
            var $container = $(this);

            $container.find('a').on('click', function(e) {
                e.preventDefault();

                var authChoicePopup = $container.data('authChoicePopup');

                if (authChoicePopup) {
                    authChoicePopup.close();
                }

                var url = this.href;
                var popupOptions = $.extend({}, options.popup); // clone

                var localPopupWidth = this.getAttribute('data-popup-width');
                if (localPopupWidth) {
                    popupOptions.width = localPopupWidth;
                }
                var localPopupHeight = this.getAttribute('data-popup-height');
                if (localPopupWidth) {
                    popupOptions.height = localPopupHeight;
                }

                popupOptions.left = (window.screen.width - popupOptions.width) / 2;
                popupOptions.top = (window.screen.height - popupOptions.height) / 2;

                var popupFeatureParts = [];
                for (var propName in popupOptions) {
                    if (popupOptions.hasOwnProperty(propName)) {
                        popupFeatureParts.push(propName + '=' + popupOptions[propName]);
                    }
                }
                var popupFeature = popupFeatureParts.join(',');

                authChoicePopup = window.open(url, 'yii_auth_choice', popupFeature);
                authChoicePopup.focus();

                $container.data('authChoicePopup', authChoicePopup);
            });
        });
    };
});


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    {% include dynamic_title.html %}
    <title>{% if title %}{{ title }}{% elsif page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" type="text/css" href="{{ site.url }}{{ site.baseurl }}/assets/built/screen.css" />
    <link rel="stylesheet" type="text/css" href="{{ site.url }}{{ site.baseurl }}/assets/built/screen.edited.css" />
    <link rel="stylesheet" type="text/css" href="{{ site.url }}{{ site.baseurl }}/assets/built/syntax.css" />

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">

    {% include head.html %}

 1 %}paged archive-template{% elsif page.class %}{{ page.class }}{% else %}home-template{% endif %}">

        {{ content }}

        {% if paginator.total_posts > site.paginate %}
            {% if page.class == 'home-template' %}
                {% include post_pagination.html %}
            {% elsif page.class == 'page-template' %}
                {% include post_pagination.html %}
            {% elsif page.class == 'author-template' %}
                {% include author_pagination.html %}
            {% elsif page.class == 'tag-template' %}
                {% include tag_pagination.html %}
            {% else %}
                {% include post_pagination.html %}
            {% endif %}
        {% endif %}

{{ site.title }} © {{  site.time | date: '%Y' }}

Proudly published with Jekyll &
                    GitHub Pages using
                    Jasper2

                    Latest Posts
                    {% if site.facebook %}Facebook{% endif %}
                    {% if site.twitter %}Twitter{% endif %}
                    Ghost

    {% if site.subscribers %}

                {% if site.logo %}

                {% endif %}

Subscribe to {{ site.title }}

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

                {% include subscribe-form.html placeholder="youremail@example.com" %}

    {% endif %}

    {% if paginator.total_pages > site.paginate %}

    {% endif %}

    {% if page.class == "post-template" %}
        {% include post-scripts.html %}
    {% elsif page.class == "page-template" %}
        {% include page-scripts.html %}
    {% endif %}


text:
import datetime as dt
import glob
import logging
import os
import pathlib
from os.path import expanduser, expandvars, join
from typing import Callable, Iterable, Literal, Optional, Union

import pytz
import xdg
from tzlocal import get_localzone

try:
    # Available from configobj 5.1.0
    from configobj.validate import VdtValueError
except ModuleNotFoundError:
    from validate import VdtValueError

from ..khalendar.vdir import CollectionNotFoundError, Vdir
from ..parse_datetime import guesstimedeltafstr
from ..terminal import COLORS
from .exceptions import InvalidSettingsError

logger = logging.getLogger('khal')

def is_timezone(tzstring: Optional[str]) -> dt.tzinfo:
    """tries to convert tzstring into a pytz timezone or return local timezone

    raises a VdtvalueError if tzstring is not valid
    """
    if not tzstring:
        # later version of tzlocal return zoneinfo (not pytz) timezones
        # as a lot of our other code can't deal with this yet, we need to force
        # pytz timezones for the time being
        return pytz.timezone(str(get_localzone()))
    try:
        return pytz.timezone(tzstring)
    except pytz.UnknownTimeZoneError:
        raise VdtValueError(f"Unknown timezone {tzstring}")

def is_timedelta(string: str) -> dt.timedelta:
    try:
        return guesstimedeltafstr(string)
    except ValueError:
        raise VdtValueError(f"Invalid timedelta: {string}")

def weeknumber_option(option: str) -> Union[str, Literal[False]]:
    """checks if *option* is a valid value

    :param option: the option the user set in the config file
    :type option: str
    :returns: 'off', 'left', 'right' or False
    """
    option = option.lower()
    if option == 'left':
        return 'left'
    elif option == 'right':
        return 'right'
    elif option in ['off', 'false', '0', 'no', 'none']:
        return False
    else:
        raise VdtValueError(
            f"Invalid value '{option}' for option 'weeknumber', must be one of "
            "'off', 'left' or 'right'")

def monthdisplay_option(option: str) -> str:
    """checks if *option* is a valid value

    :param option: the option the user set in the config file
    :returns: firstday, firstfullweek
    """
    option = option.lower()
    if option == 'firstday':
        return 'firstday'
    elif option == 'firstfullweek':
        return 'firstfullweek'
    else:
        raise VdtValueError(
            f"Invalid value '{option}' for option 'monthdisplay', must be one "
            "of 'firstday' or 'firstfullweek'"
        )

def expand_path(path: str) -> str:
    """expands `~` as well as variable names"""
    return expanduser(expandvars(path))

def expand_db_path(path: str) -> str:
    """expands `~` as well as variable names, defaults to $XDG_DATA_HOME"""
    if path is None:
        path = join(xdg.BaseDirectory.xdg_data_home, 'khal', 'khal.db')
    return expanduser(expandvars(path))

def is_color(color: str) -> str:
    """checks if color represents a valid color

    raises a VdtValueError if color is not valid
    """
    # check if color is
    # 1) the default empty value
    # 2) auto
    # 3) a color name from the 16 color palette
    # 4) a color index from the 256 color palette
    # 5) an HTML-style color code
    if (color in ['', 'auto'] or
            color in COLORS.keys() or
            (color.isdigit() and int(color) >= 0 and int(color) <= 255) or
            (color.startswith('#') and (len(color) in [4, 7, 9]) and
             all(c in '01234567890abcdefABCDEF' for c in color[1:]))):
        return color
    raise VdtValueError(color)

def test_default_calendar(config) -> None:
    """test if config['default']['default_calendar'] is set to a sensible
    value
    """
    if config['default']['default_calendar'] is None:
        pass
    elif config['default']['default_calendar'] not in config['calendars']:
        logger.fatal(
            f"in section [default] {config['default']['default_calendar']} is "
            "not valid for 'default_calendar', must be one of "
            f"{config['calendars'].keys()}"
        )
        raise InvalidSettingsError()
    elif config['calendars'][config['default']['default_calendar']]['readonly']:
        logger.fatal('default_calendar may not be read_only!')
        raise InvalidSettingsError()

def get_color_from_vdir(path: str) -> Optional[str]:
    try:
        color = Vdir(path, '.ics').get_meta('color')
    except CollectionNotFoundError:
        color = None
    if color is None or color == '':
        logger.debug(f'Found no or empty file `color` in {path}')
        return None
    color = color.strip()
    try:
        is_color(color)
    except VdtValueError:
        logger.warning(f"Found invalid color `{color}` in {path}color")
        color = None
    return color

def get_unique_name(path: str, names: Iterable[str]) -> str:
    # TODO take care of edge cases, make unique name finding less brain-dead
    try:
        name = Vdir(path, '.ics').get_meta('displayname')
    except CollectionNotFoundError:
        logger.fatal(f'The calendar at `{path}` is not a directory.')
        raise
    if name is None or name == '':
        logger.debug(f'Found no or empty file `displayname` in {path}')
        name = os.path.split(path)[-1]
    if name in names:
        while name in names:
            name = name + '1'
    return name

def get_all_vdirs(expand_path: str) -> Iterable[str]:
    """returns a list of paths, expanded using glob
    """
    # FIXME currently returns a list of all directories in path
    # we add an additional / at the end to make sure we are only getting
    # directories
    items = glob.glob(f'{expand_path}/', recursive=True)
    paths = [pathlib.Path(item) for item in sorted(items, key=len, reverse=True)]
    leaves = set()
    parents = set()
    for path in paths:
        if path in parents:
            # we have already seen the current directory as the parent of
            # another directory, so this directory can't be a vdir
            continue
        parents.add(path.parent)
        leaves.add(path)
    # sort to make sure that auto generated names are always identical
    return sorted(os.fspath(path) for path in leaves)

def get_vdir_type(_: str) -> str:
    # TODO implement
    return 'calendar'

def config_checks(
    config,
    _get_color_from_vdir: Callable=get_color_from_vdir,
    _get_vdir_type: Callable=get_vdir_type,
) -> None:
    """do some tests on the config we cannot do with configobj's validator"""
    # TODO rename or split up, we are also expanding vdirs of type discover
    if len(config['calendars'].keys()) < 1:
        logger.fatal('Found no calendar section in the config file')
        raise InvalidSettingsError()
    config['sqlite']['path'] = expand_db_path(config['sqlite']['path'])
    if not config['locale']['default_timezone']:
        config['locale']['default_timezone'] = is_timezone(
            config['locale']['default_timezone'])
    if not config['locale']['local_timezone']:
        config['locale']['local_timezone'] = is_timezone(
            config['locale']['local_timezone'])

    # expand calendars with type = discover
    # we need a copy of config['calendars'], because we modify config in the body of the loop
    for cname, cconfig in sorted(config['calendars'].items()):
        if not isinstance(config['calendars'][cname], dict):
            logger.fatal('Invalid config file, probably missing calendar sections')
            raise InvalidSettingsError
        if config['calendars'][cname]['type'] == 'discover':
            logger.debug(f"discovering calendars in {cconfig['path']}")
            vdirs_discovered = get_all_vdirs(cconfig['path'])
            logger.debug(f"found the following vdirs: {vdirs_discovered}")
            for vdir in vdirs_discovered:
                vdir_config = {
                    'path': vdir,
                    'color': _get_color_from_vdir(vdir) or cconfig.get('color', None),
                    'type': _get_vdir_type(vdir),
                    'readonly': cconfig.get('readonly', False),
                    'priority': 10,
                }
                unique_vdir_name = get_unique_name(vdir, config['calendars'].keys())
                config['calendars'][unique_vdir_name] = vdir_config
            config['calendars'].pop(cname)

    test_default_calendar(config)
    for calendar in config['calendars']:
        if config['calendars'][calendar]['type'] == 'birthdays':
            config['calendars'][calendar]['readonly'] = True
        if config['calendars'][calendar]['color'] == 'auto':
            config['calendars'][calendar]['color'] = \
                _get_color_from_vdir(config['calendars'][calendar]['path'])


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.leadingZeros = leadingZeros;
exports.encodeFileName = encodeFileName;
exports.default = void 0;

/**
 * prepends leading zeros to the given string, so that
 * the resulting string will be 3 characters long
 *
 * @ignore
 * @param n
 * @returns {string}
 */
function leadingZeros(n) {
  return "00".concat(n).slice(-3);
}
/**
 * The following directories in the generated folder/file structure have to be URL encoded:
 *  - branch directory
 *  - build directory
 *  - use case directory
 *  - scenario directory
 *
 * @ignore
 * @param inputString
 */

function encodeFileName(inputString) {
  var encodedString = encodeURIComponent(inputString); // scenarioo java api uses java.net.URLEncoder which encodes strings differently
  // See http://stackoverflow.com/a/607403
  // and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
  // scenarioo java api uses url encoding where slashes are plus signs

  encodedString = encodedString.replace(/%20/g, '+'); // ECMAScripts' "encodeURIComponent" does not encode parentheses, java.net.URLEncoder does!

  encodedString = encodedString.replace(/\)/g, '%29');
  encodedString = encodedString.replace(/\(/g, '%28'); // ECMAScripts' "encodeURIComponent" does not encode the following chars, java.net.URLEncoder does!

  encodedString = encodedString.replace(/~/g, '%7E');
  encodedString = encodedString.replace(/'/g, '%27');
  encodedString = encodedString.replace(/!/g, '%21');
  return encodedString;
}

var _default = {
  encodeFileName: encodeFileName,
  leadingZeros: leadingZeros
};
exports.default = _default;


text:
namespace {
//!
//! \brief Applies custom appearance and behavior to items in the poll choices
//! editor.
//!
class ChoicesListDelegate : public QStyledItemDelegate
{
    Q_OBJECT

public:
    ChoicesListDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent)
    {
    }

    QWidget* createEditor(
        QWidget* parent,
        const QStyleOptionViewItem& option,
        const QModelIndex& index) const override
    {
        QWidget* editor = QStyledItemDelegate::createEditor(parent, option, index);

        if (QLineEdit* line_edit = qobject_cast<QLineEdit*>(editor)) {
            line_edit->setMaxLength(VotingModel::maxPollChoiceLabelLength());
        }

        return editor;
    }

private:
    void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override
    {
        QStyledItemDelegate::initStyleOption(option, index);

        // Display a row number before each choice label:
        option->text = QStringLiteral("%1. %2").arg(index.row() + 1).arg(option->text);
    }
}; // ChoicesListDelegate

//!
//! \brief Provides for QWizardPage::registerField() without a real widget.
//!
struct DummyField : public QWidget
{
    DummyField(QWidget* parent = nullptr) : QWidget(parent) { hide(); }
};
} // Anonymous namespace

//!
//! \brief Manages the set of choices for the poll choices editor.
//!
class ChoicesListModel : public QStringListModel
{
    Q_OBJECT

public:
    ChoicesListModel(QObject* parent = nullptr) : QStringListModel(parent)
    {
    }

    bool isComplete(const int response_type) const
    {
        if (response_type == 0) {
            return true;
        }

        return rowCount(QModelIndex()) >= 2;
    }

    QModelIndex addItem()
    {
        const int row = rowCount(QModelIndex());

        if (!insertRows(row, 1)) {
            return QModelIndex();
        }

        return index(row);
    }

    void removeItem(const QModelIndex& index)
    {
        if (index.isValid()) {
            removeRows(index.row(), 1);
        }

        emit completeChanged();
    }

    bool setData(const QModelIndex& index, const QVariant& value, int role) override
    {
        emit completeChanged();

        return QStringListModel::setData(index, value.toString().trimmed(), role);
    }

    Qt::ItemFlags flags(const QModelIndex& index) const override
    {
        if (!index.isValid()) {
            return QStringListModel::flags(index) | Qt::ItemIsDropEnabled;
        }

        return QStringListModel::flags(index) & ~Qt::ItemIsDropEnabled;
    }

signals:
    void completeChanged();
}; // ChoicesListModel

// -----------------------------------------------------------------------------
// Class: PollWizardDetailsPage
// -----------------------------------------------------------------------------

PollWizardDetailsPage::PollWizardDetailsPage(QWidget* parent)
    : QWizardPage(parent)
    , ui(new Ui::PollWizardDetailsPage)
    , m_poll_types(nullptr)
    , m_choices_model(new ChoicesListModel(this))
{
    ui->setupUi(this);

    GRC::ScaleFontPointSize(ui->pageTitleLabel, 14);

    setCommitPage(true);
    setButtonText(QWizard::CommitButton, tr("Create Poll"));

    registerField("title*", ui->titleField);
    registerField("durationDays", ui->durationField);
    registerField("question", ui->questionField);
    registerField("url*", ui->urlField);
    registerField("weightType", ui->weightTypeList);
    registerField("responseType", ui->responseTypeList);
    registerField("txid", new DummyField(this), "", "");

    ui->durationField->setMinimum(VotingModel::minPollDurationDays());
    ui->durationField->setMaximum(VotingModel::maxPollDurationDays());
    ui->titleField->setMaxLength(VotingModel::maxPollTitleLength());
    ui->questionField->setMaxLength(VotingModel::maxPollQuestionLength());
    ui->urlField->setMaxLength(VotingModel::maxPollUrlLength());

    ui->weightTypeList->addItem(tr("Balance"));
    ui->weightTypeList->addItem(tr("Magnitude+Balance"));

    ui->responseTypeList->addItem(tr("Yes/No/Abstain"));
    ui->responseTypeList->addItem(tr("Single Choice"));
    ui->responseTypeList->addItem(tr("Multiple Choice"));

    ChoicesListDelegate* choices_delegate = new ChoicesListDelegate(this);

    ui->choicesList->setModel(m_choices_model.get());
    ui->choicesList->setItemDelegate(choices_delegate);
    ui->choicesFrame->hide();
    ui->editChoiceButton->hide();
    ui->removeChoiceButton->hide();

    connect(
        ui->responseTypeList, QOverload<int>::of(&QComboBox::currentIndexChanged),
        [this](int index) {
            ui->choicesFrame->setVisible(index > 0);
            ui->standardChoicesLabel->setVisible(index == 0);
            emit completeChanged();
        });
    connect(
        ui->choicesList->selectionModel(), &QItemSelectionModel::selectionChanged,
        [this](const QItemSelection& selected, const QItemSelection& deselected) {
            Q_UNUSED(deselected);
            ui->editChoiceButton->setVisible(!selected.isEmpty());
            ui->removeChoiceButton->setVisible(!selected.isEmpty());
        });
    connect(ui->addChoiceButton, &QAbstractButton::clicked, [this]() {
        ui->choicesList->edit(m_choices_model->addItem());
        ui->choicesList->scrollToBottom();
    });
    connect(ui->editChoiceButton, &QAbstractButton::clicked, [this]() {
        ui->choicesList->edit(ui->choicesList->selectionModel()->selectedIndexes().first());
    });
    connect(ui->removeChoiceButton, &QAbstractButton::clicked, [this]() {
        m_choices_model->removeItem(ui->choicesList->selectionModel()->selectedIndexes().first());
    });
    connect(m_choices_model.get(), &ChoicesListModel::completeChanged, [this]() {
        emit completeChanged();
    });
}

PollWizardDetailsPage::~PollWizardDetailsPage()
{
    delete ui;
}

void PollWizardDetailsPage::setModel(VotingModel* voting_model)
{
    m_voting_model = voting_model;

    updateIcons();
}

void PollWizardDetailsPage::setPollTypes(const PollTypes* const poll_types)
{
    m_poll_types = poll_types;
}

void PollWizardDetailsPage::initializePage()
{
    if (!m_poll_types) {
        return;
    }

    ui->errorLabel->hide();

    const int type_id = field("pollType").toInt();
    const PollTypeItem& poll_type = (*m_poll_types)[type_id];

    ui->pollTypeLabel->setText(poll_type.m_name);
    ui->durationField->setMinimum(poll_type.m_min_duration_days);
    ui->durationField->setValue(poll_type.m_min_duration_days);

    if (type_id != PollTypes::PollTypeSurvey) {
        ui->pollTypeAlert->show();
        ui->weightTypeList->setCurrentIndex(1); // Magnitude+Balance
        ui->weightTypeList->setDisabled(true);
    } else {
        ui->pollTypeAlert->hide();
        ui->weightTypeList->setEnabled(true);
    }

    if (type_id == PollTypes::PollTypeProject) {
        ui->titleField->setText(QStringLiteral("[%1] %2")
            .arg(poll_type.m_name)
            .arg(field("projectPollTitle").toString()));
        ui->responseTypeList->setCurrentIndex(0); // Yes/No/Abstain
        ui->responseTypeList->setDisabled(true);
    } else {
        ui->responseTypeList->setEnabled(true);
    }
}

bool PollWizardDetailsPage::validatePage()
{
    if (!m_voting_model) {
        return false;
    }

    const CAmount burn_fee = m_voting_model->estimatePollFee();
    const QMessageBox::StandardButton pressed = QMessageBox::question(
        this,
        tr("Create Poll"),
        tr("This poll will cost %1 plus a transaction fee. Continue?")
            .arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, burn_fee))
    );

    if (pressed != QMessageBox::Yes) {
        return false;
    }

    const VotingResult result = m_voting_model->sendPoll(
        field("title").toString(),
        field("durationDays").toInt(),
        field("question").toString(),
        field("url").toString(),
        // The dropdown list only contains non-deprecated weight type options
        // which start from offset 2:
        field("weightType").toInt() + 2,
        field("responseType").toInt() + 1,
        m_choices_model->stringList());

    if (!result.ok()) {
        ui->errorLabel->setText(result.error());
        ui->errorLabel->show();

        return false;
    }

    setField("txid", result.txid());

    return true;
}

bool PollWizardDetailsPage::isComplete() const
{
    return QWizardPage::isComplete()
        && m_choices_model->isComplete(field("responseType").toInt());
}

void PollWizardDetailsPage::updateIcons()
{
    if (!m_voting_model) {
        return;
    }

    const QString theme = m_voting_model->getOptionsModel().getCurrentStyle();

    ui->addChoiceButton->setIcon(QIcon(":/icons/" + theme + "_add"));
    ui->editChoiceButton->setIcon(QIcon(":/icons/" + theme + "_edit"));
    ui->removeChoiceButton->setIcon(QIcon(":/icons/" + theme + "_remove"));
}

#include "qt/voting/pollwizarddetailspage.moc"


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ARBShadow (LWJGL API)</title>
<meta name="date" content="2013-12-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.lwjgl.opengl

Class ARBShadow

java.lang.Object

org.lwjgl.opengl.ARBShadow

public final class ARBShadow
extends java.lang.Object

Field Summary

Fields

Modifier and Type
Field and Description

static int
GL_COMPARE_R_TO_TEXTURE_ARB

static int
GL_TEXTURE_COMPARE_FUNC_ARB

static int
GL_TEXTURE_COMPARE_MODE_ARB

Method Summary

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

GL_TEXTURE_COMPARE_MODE_ARB

public static final int GL_TEXTURE_COMPARE_MODE_ARB

See Also:

Constant Field Values

GL_TEXTURE_COMPARE_FUNC_ARB

public static final int GL_TEXTURE_COMPARE_FUNC_ARB

See Also:

Constant Field Values

GL_COMPARE_R_TO_TEXTURE_ARB

public static final int GL_COMPARE_R_TO_TEXTURE_ARB

See Also:

Constant Field Values

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2002-2009 lwjgl.org. All Rights Reserved.


text:
import {Component, Input} from '@angular/core';
import {BaseSchemaComponent} from "../../core/base-schema";

@Component({
  selector: 'null-schema',
  templateUrl: './null-schema.component.html',
  styleUrls: ['./null-schema.component.scss']
})
export class NullSchemaComponent extends BaseSchemaComponent {
}


text:
package de.bitbrain.jpersis.drivers.mysql;

import de.bitbrain.jpersis.drivers.jdbc.JDBCDriver;

/**
 * Implementation for MySQL
 *
 * @author Miguel Gonzalez Sanchez
 * @since 1.0
 * @version 1.0
 */
public class MySQLDriver extends JDBCDriver {

  public MySQLDriver(String host, String port, String database, String user, String password) {
    super(host, port, database, user, password);
  }

  @Override
  protected String getURL(String host, String port, String database) {
    return "jdbc:mysql://" + host + ":" + port + "/" + database;
  }
}


text:
<?php
/**
 * WooCommerce Uninstall
 *
 * Uninstalling WooCommerce deletes user roles, pages, tables, and options.
 *
 * @author      WooThemes
 * @category    Core
 * @package     WooCommerce/Uninstaller
 * @version     2.3.0
 */

if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

global $wpdb, $wp_version;

wp_clear_scheduled_hook( 'woocommerce_scheduled_sales' );
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
wp_clear_scheduled_hook( 'woocommerce_cleanup_sessions' );
wp_clear_scheduled_hook( 'woocommerce_geoip_updater' );
wp_clear_scheduled_hook( 'woocommerce_tracker_send_event' );

$status_options = get_option( 'woocommerce_status_options', array() );

if ( ! empty( $status_options['uninstall_data'] ) ) {
	// Roles + caps.
	include_once( 'includes/class-wc-install.php' );
	WC_Install::remove_roles();

	// Pages.
	wp_trash_post( get_option( 'woocommerce_shop_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_cart_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_checkout_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_myaccount_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_edit_address_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_view_order_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_change_password_page_id' ) );
	wp_trash_post( get_option( 'woocommerce_logout_page_id' ) );

	if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_attribute_taxonomies';" ) ) {
		$wc_attributes = array_filter( (array) $wpdb->get_col( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies;" ) );
	} else {
		$wc_attributes = array();
	}

	// Tables.
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_api_keys" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_attribute_taxonomies" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_downloadable_product_permissions" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_termmeta" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_tax_rates" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_tax_rate_locations" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_shipping_zone_methods" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_shipping_zone_locations" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_shipping_zones" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_sessions" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_payment_tokens" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_payment_tokenmeta" );

	// Delete options.
	$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce\_%';");

	// Delete posts + data.
	$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation', 'shop_coupon', 'shop_order', 'shop_order_refund' );" );
	$wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_order_items" );
	$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_order_itemmeta" );

	// Delete terms if > WP 4.2 (term splitting was added in 4.2)
	if ( version_compare( $wp_version, '4.2', '>=' ) ) {
		// Delete term taxonomies
		foreach ( array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type' ) as $taxonomy ) {
			$wpdb->delete(
				$wpdb->term_taxonomy,
				array(
					'taxonomy' => $taxonomy,
				)
			);
		}

		// Delete term attributes
		foreach ( $wc_attributes as $taxonomy ) {
			$wpdb->delete(
				$wpdb->term_taxonomy,
				array(
					'taxonomy' => 'pa_' . $taxonomy,
				)
			);
		}

		// Delete orphan relationships
		$wpdb->query( "DELETE tr FROM {$wpdb->term_relationships} tr LEFT JOIN {$wpdb->posts} posts ON posts.ID = tr.object_id WHERE posts.ID IS NULL;" );

		// Delete orphan terms
		$wpdb->query( "DELETE t FROM {$wpdb->terms} t LEFT JOIN {$wpdb->term_taxonomy} tt ON t.term_id = tt.term_id WHERE tt.term_id IS NULL;" );

		// Delete orphan term meta
		if ( ! empty( $wpdb->termmeta ) ) {
			$wpdb->query( "DELETE tm FROM {$wpdb->termmeta} tm LEFT JOIN {$wpdb->term_taxonomy} tt ON tm.term_id = tt.term_id WHERE tt.term_id IS NULL;" );
		}
	}

	// Clear any cached data that has been removed
	wp_cache_flush();
}