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.
'''

# script to highlight adb logcat output for console
# written originally by jeff sharkey, http://jsharkey.org/
# modified thereafter by garen j. torikian (for filtering support)
# piping detection and popen() added by other android team members

import os, sys, re, StringIO
import fcntl, termios, struct

# unpack the current terminal width/height
data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')
HEIGHT, WIDTH = struct.unpack('hh',data)

BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)

def format(fg=None, bg=None, bright=False, bold=False, dim=False, reset=False):
    # manually derived from http://en.wikipedia.org/wiki/ANSI_escape_code#Codes
    codes = []
    if reset: codes.append("0")
    else:
        if not fg is None: codes.append("3%d" % (fg))
        if not bg is None:
            if not bright: codes.append("4%d" % (bg))
            else: codes.append("10%d" % (bg))
        if bold: codes.append("1")
        elif dim: codes.append("2")
        else: codes.append("22")
    return "\033[%sm" % (";".join(codes))

def indent_wrap(message, indent=0, width=80):
    wrap_area = width - indent
    messagebuf = StringIO.StringIO()
    current = 0
    while current < len(message):
        next = min(current + wrap_area, len(message))
        messagebuf.write(message[current:next])
        if next < len(message):
            messagebuf.write("\n%s" % (" " * indent))
        current = next
    return messagebuf.getvalue()

LAST_USED = [RED,GREEN,YELLOW,BLUE,MAGENTA,CYAN,WHITE]
KNOWN_TAGS = {
    "dalvikvm": BLUE,
    "Process": BLUE,
    "ActivityManager": CYAN,
    "ActivityThread": CYAN,
}

def allocate_color(tag):
    # this will allocate a unique format for the given tag
    # since we dont have very many colors, we always keep track of the LRU
    if not tag in KNOWN_TAGS:
        KNOWN_TAGS[tag] = LAST_USED[0]
    color = KNOWN_TAGS[tag]
    LAST_USED.remove(color)
    LAST_USED.append(color)
    return color

RULES = {
    #re.compile(r"([\w\.@]+)=([\w\.@]+)"): r"%s\1%s=%s\2%s" % (format(fg=BLUE), format(fg=GREEN), format(fg=BLUE), format(reset=True)),
}

TAGTYPE_WIDTH = 3
TAG_WIDTH = 20
PROCESS_WIDTH = 8 # 8 or -1
HEADER_SIZE = TAGTYPE_WIDTH + 1 + TAG_WIDTH + 1 + PROCESS_WIDTH + 1

TAGTYPES = {
    "V": "%s%s%s " % (format(fg=WHITE, bg=BLACK), "V".center(TAGTYPE_WIDTH), format(reset=True)),
    "D": "%s%s%s " % (format(fg=BLACK, bg=BLUE), "D".center(TAGTYPE_WIDTH), format(reset=True)),
    "I": "%s%s%s " % (format(fg=BLACK, bg=GREEN), "I".center(TAGTYPE_WIDTH), format(reset=True)),
    "W": "%s%s%s " % (format(fg=BLACK, bg=YELLOW), "W".center(TAGTYPE_WIDTH), format(reset=True)),
    "E": "%s%s%s " % (format(fg=BLACK, bg=RED), "E".center(TAGTYPE_WIDTH), format(reset=True)),
}

retag = re.compile("^([A-Z])/([^\(]+)\(([^\)]+)\): (.*)$")

arg_size = len(sys.argv)
filter_tags = []

if arg_size >= 2:
    for i, arg in enumerate(sys.argv):
        if arg == "-f":
            filter_tags.append(sys.argv[i+1])

input = sys.stdin

while True:
    try:
        line = input.readline()
    except KeyboardInterrupt:
        break

    filter_match = False
    if len(filter_tags) >= 1:
        for filter_name in filter_tags:
            if filter_name in line:
                filter_match = True
                break
    else:
        filter_match = True

    if filter_match is True:
        match = retag.match(line)
        if not match is None:
            tagtype, tag, owner, message = match.groups()
            linebuf = StringIO.StringIO()

            # center process info
            if PROCESS_WIDTH > 0:
                owner = owner.strip().center(PROCESS_WIDTH)
                linebuf.write("%s%s%s " % (format(fg=BLACK, bg=BLACK, bright=True), owner, format(reset=True)))

            # right-align tag title and allocate color if needed
            tag = tag.strip()
            color = allocate_color(tag)
            tag = tag[-TAG_WIDTH:].rjust(TAG_WIDTH)
            linebuf.write("%s%s %s" % (format(fg=color, dim=False), tag, format(reset=True)))

            # write out tagtype colored edge
            if not tagtype in TAGTYPES: break
            linebuf.write(TAGTYPES[tagtype])

            # insert line wrapping as needed
            message = indent_wrap(message, HEADER_SIZE, WIDTH)

            # format tag message using rules
            for matcher in RULES:
                replace = RULES[matcher]
                message = matcher.sub(replace, message)

            linebuf.write(message)
            line = linebuf.getvalue()

        print line
        if len(line) == 0: break


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.kirauks.pixelrunner.scene.base;

import org.andengine.entity.scene.background.Background;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.text.Text;
import org.andengine.entity.text.TextOptions;
import org.andengine.util.adt.align.HorizontalAlign;
import org.andengine.util.adt.color.Color;
import net.kirauks.pixelrunner.R;

/**
 *
 * @author Karl
 */
public abstract class BaseSplashScene extends BaseScene{
    private Sprite headphones;
    private Text advice;

    @Override
    public void createScene() {
        this.setBackground(new Background(Color.BLACK));
        this.headphones = new Sprite(260, 65, this.resourcesManager.splashHeadphones, this.vbom);
        this.headphones.setScale(4);
        this.advice = new Text(434, 65, resourcesManager.fontPixel_34, this.activity.getString(R.string.splash_headphones), new TextOptions(HorizontalAlign.CENTER), vbom);
        attachChild(this.headphones);
        attachChild(this.advice);
    }

    @Override
    public void onBackKeyPressed() {
        System.exit(0);
    }

    @Override
    public void onMenuKeyPressed(){
    }

    @Override
    public void onPause() {
    }

    @Override
    public void onResume() {
    }

    @Override
    public void disposeScene() {
        this.headphones.detachSelf();
        this.headphones.dispose();
        this.advice.detachSelf();
        this.advice.dispose();
    }
}

redpajama_set_name: RedPajamaGithub


text:
level-queue
===========

A Queue Module for level db. Using streams we can implement further modules such as a job queue.


text:
layout: post
title: In the beginning
published: true
category: Miscellaneous
tags: []
commentIssueId: 1
---

Hello everyone! So this is where it all begins, huh? Anyway enough rambling I suppose you want to know what this site is about. Well I use this site mainly for rambling about programming as well as book reviews, I read a lot of shitty SciFi books, plus a [portfolio]({{ site.url }}/portfolio) for all of my projects, most of which are Open Source and avaliable on [my github](http://github.com/jwolff52)! (I also apparently use it for non-sequitur statements)

I think that pretty much sums everything up. Many of my posts may be this short, though the book reviews may get a little...ugly so stick around and enjoy the view, it's free!


text:
var test = require('tap').test,
  merge = require('..');

test('Should not touch properties when types match', function(t) {
  var options = {
    age: 42
  };
  merge(options, {
    age: 24
  });

  t.equal(options.age, 42);
  t.end();
});

test('Should extend, because types are different', function(t) {
  var options = {
    age: '42'
  };
  merge(options, {
    age: 24
  });

  t.equal(options.age, 24);
  t.end();
});

test('Should augment with new properties', function(t) {
  var options = {
    age: 42
  };
  merge(options, {
    newproperty: 24
  });

  t.equal(options.age, 42);
  t.equal(options.newproperty, 24);
  t.end();
});

test('goes deep', function(t) {
  var options = {
    age: 42
  };
  merge(options, {
    nested: {
      name: 'deep'
    }
  });

  t.equal(options.age, 42);
  t.equal(options.nested.name, 'deep');
  t.end();
});

test('goes deep avoids conflicts', function(t) {
  var options = {
    age: 42,
    user: {
      firstName: 'John'
    }
  };
  merge(options, {
    user: {
      lastName: 'Smith'
    }
  });

  t.equal(options.age, 42);
  t.equal(options.user.firstName, 'John');
  t.equal(options.user.lastName, 'Smith');
  t.end();
});

test('Initializes with default object', function(t) {
  var options = {
    age: '42'
  };
  var result = merge(undefined, options);
  t.same(result, options);

  var onlyOptions = merge(options);
  t.same(onlyOptions, options);

  t.end();
});

test('Do not copy prototype', function(t) {
  function Options() {
    this.age = 42;
  }
  Options.prototype.foo = 'foo';

  var options = new Options();
  var result = merge({}, options);
  t.equal(result.age, 42);
  t.ok(result.foo === undefined);

  t.end();
});


text:
.class public Lcom/google/android/gms/drive/query/internal/LogicalFilter;
.super Lcom/google/android/gms/drive/query/internal/AbstractFilter;

# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/Parcelable$Creator<Lcom/google/android/gms/drive/query/internal/LogicalFilter;>;"
        }
    .end annotation
.end field

# instance fields
.field public final ˊ:Lcom/google/android/gms/drive/query/internal/Operator;

.field public final ˋ:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<Lcom/google/android/gms/drive/query/internal/FilterHolder;>;"
        }
    .end annotation
.end field

.field public final ˎ:I

.field private ˏ:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<Lcom/google/android/gms/drive/query/Filter;>;"
        }
    .end annotation
.end field

# direct methods
.method static constructor <clinit>()V
    .locals 1

    new-instance v0, Lo/յ;

    invoke-direct {v0}, Lo/յ;-><init>()V

    sput-object v0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->CREATOR:Landroid/os/Parcelable$Creator;

    return-void
.end method

.method public constructor <init>(ILcom/google/android/gms/drive/query/internal/Operator;Ljava/util/List;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(ILcom/google/android/gms/drive/query/internal/Operator;Ljava/util/List<Lcom/google/android/gms/drive/query/internal/FilterHolder;>;)V"
        }
    .end annotation

    invoke-direct {p0}, Lcom/google/android/gms/drive/query/internal/AbstractFilter;-><init>()V

    iput p1, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˎ:I

    iput-object p2, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˊ:Lcom/google/android/gms/drive/query/internal/Operator;

    iput-object p3, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    return-void
.end method

.method public varargs constructor <init>(Lcom/google/android/gms/drive/query/internal/Operator;Lcom/google/android/gms/drive/query/Filter;[Lcom/google/android/gms/drive/query/Filter;)V
    .locals 7

    invoke-direct {p0}, Lcom/google/android/gms/drive/query/internal/AbstractFilter;-><init>()V

    const/4 v0, 0x1

    iput v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˎ:I

    iput-object p1, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˊ:Lcom/google/android/gms/drive/query/internal/Operator;

    new-instance v0, Ljava/util/ArrayList;

    array-length v1, p3

    add-int/lit8 v1, v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    new-instance v1, Lcom/google/android/gms/drive/query/internal/FilterHolder;

    invoke-direct {v1, p2}, Lcom/google/android/gms/drive/query/internal/FilterHolder;-><init>(Lcom/google/android/gms/drive/query/Filter;)V

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    new-instance v0, Ljava/util/ArrayList;

    array-length v1, p3

    add-int/lit8 v1, v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˏ:Ljava/util/List;

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˏ:Ljava/util/List;

    invoke-interface {v0, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    move-object v3, p3

    array-length v4, v3

    const/4 v5, 0x0

    :goto_0
    if-ge v5, v4, :cond_0

    aget-object v6, v3, v5

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    new-instance v1, Lcom/google/android/gms/drive/query/internal/FilterHolder;

    invoke-direct {v1, v6}, Lcom/google/android/gms/drive/query/internal/FilterHolder;-><init>(Lcom/google/android/gms/drive/query/Filter;)V

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˏ:Ljava/util/List;

    invoke-interface {v0, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public constructor <init>(Lcom/google/android/gms/drive/query/internal/Operator;Ljava/lang/Iterable;)V
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Lcom/google/android/gms/drive/query/internal/Operator;Ljava/lang/Iterable<Lcom/google/android/gms/drive/query/Filter;>;)V"
        }
    .end annotation

    invoke-direct {p0}, Lcom/google/android/gms/drive/query/internal/AbstractFilter;-><init>()V

    const/4 v0, 0x1

    iput v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˎ:I

    iput-object p1, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˊ:Lcom/google/android/gms/drive/query/internal/Operator;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˏ:Ljava/util/List;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    invoke-interface {p2}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/drive/query/Filter;

    move-object v3, v0

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˏ:Ljava/util/List;

    invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    new-instance v1, Lcom/google/android/gms/drive/query/internal/FilterHolder;

    invoke-direct {v1, v3}, Lcom/google/android/gms/drive/query/internal/FilterHolder;-><init>(Lcom/google/android/gms/drive/query/Filter;)V

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    :cond_0
    return-void
.end method

# virtual methods
.method public describeContents()I
    .locals 1

    const/4 v0, 0x0

    return v0
.end method

.method public writeToParcel(Landroid/os/Parcel;I)V
    .locals 0

    invoke-static {p0, p1, p2}, Lo/յ;->ˊ(Lcom/google/android/gms/drive/query/internal/LogicalFilter;Landroid/os/Parcel;I)V

    return-void
.end method

.method public ˊ(Lo/Ӵ;)Ljava/lang/Object;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:Ljava/lang/Object;>(Lo/\u04f4<TT;>;)TT;"
        }
    .end annotation

    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˋ:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/drive/query/internal/FilterHolder;

    move-object v3, v0

    invoke-virtual {v3}, Lcom/google/android/gms/drive/query/internal/FilterHolder;->getFilter()Lcom/google/android/gms/drive/query/Filter;

    move-result-object v0

    invoke-interface {v0, p1}, Lcom/google/android/gms/drive/query/Filter;->ˊ(Lo/Ӵ;)Ljava/lang/Object;

    move-result-object v0

    invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    :cond_0
    iget-object v0, p0, Lcom/google/android/gms/drive/query/internal/LogicalFilter;->ˊ:Lcom/google/android/gms/drive/query/internal/Operator;

    invoke-interface {p1, v0, v1}, Lo/Ӵ;->ˋ(Lcom/google/android/gms/drive/query/internal/Operator;Ljava/util/List;)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method


text:
const express = require('express');
const bodyParser = require('body-parser');
const webpush = require('web-push');
const gcloud = require('google-cloud');
const model = require('../model');
const path = require ('path');

// Project variables
const project_id = 'web-push-rocks';
const app = express();
const pubsub = gcloud.pubsub({
  projectId: project_id
});
const subscribeTopicId = `projects/${project_id}/topics/subscribe`;
const sendTopicId = `projects/${project_id}/topics/send`;
const jsonParser = bodyParser.json();

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

let subscribeTopic;
let sendTopic;
let sendRawTopic;
let instanceVAPIDKey;

app.use(express.static('public'));

app.get('/', (req, res) => {
  res.render('index', {
    publicKey: instanceVAPIDKey.publicKey,
    messages: [{}]
  });
});

app.post('/subscribe', jsonParser, (req, res) => {
  const subscription = req.body;
  console.log(subscription);

  subscription.privateKey = instanceVAPIDKey.privateKey;

  subscribeTopic.publish({
    subscription: subscription
  });
  res.send('ok');
});

app.post('/send', jsonParser, (req, res) => {
  const message = req.body;
  const id = req.query.id;

  console.log(message)

  sendTopic.publish({
    id: id,
    message: message
  });

  res.send('ok');
});

app.post('/send-raw', (req, res) => {
  const message = req.body;
  const id = req.query.id;
  const processor = req.query.processor;

  // Topic must exist
  const rawTopic = pubsub.topic(`projects/${project_id}/topics/send-${processor}`);
  rawTopic.publish({
      id: id,
      processor: processor,
      headers: req.headers,
      message: message
    })
    .then(() => res.send('ok'))
    .catch(() => res.send('error'))
});

app.listen(3000, () => {
  app.set('views', path.join(__dirname , 'views'));
  app.set('view engine', 'ejs');

  const vapidKeys = webpush.generateVAPIDKeys();

  // Before the server starts, let's get VAPID persisted
  instanceVAPIDKey = new model.ApplicationKey(vapidKeys.publicKey, vapidKeys.privateKey);
  instanceVAPIDKey.put();

  // Create the topic
  pubsub.createTopic(subscribeTopicId)
        .then(data => subscribeTopic = data[0])
        .catch(data => subscribeTopic = pubsub.topic(subscribeTopicId));

  // Create the topic that will be used to send the broadcasts.
  pubsub.createTopic(sendTopicId)
        .then(data => sendTopic = data[0])
        .catch(data => sendTopic = pubsub.topic(sendTopicId));

  console.log('Front-end is listenting on port 3000');
});


text:
title: "*Kölner Stadt-Anzeiger* (Germany) on The Cold Song"
book: en/books/the-cold-song.md
type: review
date: 2004-01-05 00:00:00 -0500
attribution: "*Kölner Stadt-Anzeiger* (Germany)"
file: ''
featured: false
weight: ''

---
With Ullmann there is no false reconciliation—this, too, makes her novel so utterly convincing.


text:
"""Generate a Cobalt build ID header."""

import datetime
import os
import sys
import time

template = """
#ifndef _COBALT_BUILD_ID_H_
#define _COBALT_BUILD_ID_H_

#ifndef COBALT_BUILD_VERSION_NUMBER
#define COBALT_BUILD_VERSION_NUMBER "{version_number}"
#endif  // COBALT_BUILD_VERSION_NUMBER

#endif  // _COBALT_BUILD_ID_H_
"""

def BuildId(output_path, version_number):
  """Write a Cobalt build_id header file with time and version info.

  Args:
    output_path: Location of the build id header to write.
    version_number: Build version number, generated when gn gen is run.
  Returns:
    0 on success.
  """
  username = os.environ.get('USERNAME', os.environ.get('USER'))
  if not username:
    username = 'unknown'
  timestamp = time.time()
  date_rep = datetime.datetime.fromtimestamp(timestamp).strftime('%c')

  with open(output_path, 'w') as f:
    f.write(
        template.format(
            date_rep=date_rep,
            timestamp=int(timestamp),
            version_number=version_number,
            username=username))
  return 0

if __name__ == '__main__':
  sys.exit(BuildId(sys.argv[1], sys.argv[2]))


text:
echo "Patch for Okcash for Manjaro Linux 5205"

date

# Patch Okcash for Manjaro + boost 1.75 + qt 5.15.2
cp -r patch5205/* ../..

echo "PATCH APPLIED"

# end Client
echo "Done with the Okcash Manjaro patch 5205 on its latest version for:"
uname -a
echo "Get  empowered with Okcash!"
exit 0


text:
"""Package for regression testing of the blender nif scripts."""

import bpy
import io_scene_nif.nif_import
import io_scene_nif.nif_export
import os
import os.path

from pyffi.formats.nif import NifFormat

def clear_bpy_data():
    """Remove all objects from blender."""

    def clear_bpy_prop_collection(collection):
        for elem in collection[:]:
            collection.remove(elem)

    def clear_users(collection):
        for elem in collection[:]:
            collection[elem.name].user_clear()
            collection.remove(collection[elem.name])

    # unlink objects
    for b_obj in bpy.data.objects[:]:
        bpy.context.scene.objects.unlink(b_obj)

    # remove all data
    for collection in (
        "actions", "objects", "meshes", "armatures", "lamps", "lattices",
        "particles", "metaballs", "shape_keys", "texts", "curves",
        "cameras", "grease_pencil", "groups", "libraries",
        "node_groups",
        "materials",
        ):
        clear_bpy_prop_collection(getattr(bpy.data, collection))

    # need to remove any users first
    for collection in (
        "brushes", "textures", "images",
        ):
        clear_users(getattr(bpy.data, collection))

def setup():
    """Enables the nif scripts addon, so all tests can use it."""
    bpy.ops.wm.addon_enable(module="io_scene_nif")
    clear_bpy_data()

def teardown():
    """Disables the nif scripts addon."""
    bpy.ops.wm.addon_disable(module="io_scene_nif")

class Base:
    """Base class for all tests."""
    # Debug Settings
    gen_blender_scene = False
    gen_nifs = False

    def b_clear(self):
        """Clear all objects from scene."""
        # ensure in object mode
        # unlinking objects will throw error otherwise
        if not (bpy.context.mode == 'OBJECT'):
            bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
        clear_bpy_data()

    def teardown(self):
        """Called when test finishes, should clean everything to
        prepare for next test.
        """
        self.b_clear()

class SingleNif(Base):
    """Base class for testing a feature concerning single nif files.

    Every test consists of two pieces of data:

    * a nif file (see :attr:`SingleNif.n_create_data`)
    * one or more blender objects (produced by blender code,
      see :meth:`SingleNif.b_create_objects`)

    To construct a new test, you must create a new nif file,
    and overload :meth:`SingleNif.b_create_objects` to match
    the desired imported nif in blender.

    Then, overload the following two methods for checking this data:

    * :meth:`SingleNif.b_check_data`
    * :meth:`SingleNif.n_check_data`

    Two tests will be run
    (see implementation of :meth:`SingleNif.test_import_export`
    and :meth:`SingleNif.test_export_import`):

    1. Check nif data to be imported,
       import nif,
       check imported blender data,
       export it again,
       check exported nif data.

    2. Create blender objects,
       check blender data to be exported,
       export to nif,
       check exported nif data,
       import the nif just exported,
       check imported blender data.

    """

    n_name = None
    """Base name of nif file (without ``0.nif`` at the end)."""

    EPSILON = 0.005
    """A small value used when comparing floats."""

    n_game = 'OBLIVION'
    """Game for nif export."""

    n_filepath_0 = None
    """The name of the nif file to import
    (set automatically from :attr:`SingleNif.n_name`).
    """

    n_filepath_1 = None
    """The name of the nif file to export from import
    (set automatically from :attr:`SingleNif.n_name`).
    """

    n_filepath_2 = None
    """The name of the nif file to export from created blender scene
    (set automatically from :attr:`SingleNif.n_name`).
    """

    b_filepath_0 = None
    """The name of the blend file after importing *n_filepath_0*
    (set automatically from :attr:`SingleNif.n_name`).
    """

    b_filepath_1 = None
    """The name of the blend file resulting from *b_create_objects*
    (set automatically from :attr:`SingleNif.n_name`).
    """

    b_filepath_2 = None
    """The name of the blend file after import of *n_filepath_2*
    (set automatically from :attr:`SingleNif.n_name`).
    """

    def __init__(self):
        """Initialize the test."""
        Base.__init__(self)

        self.n_filepath_0 = "test/nif/" + self.n_name + "0.nif"
        self.n_filepath_1 = "test/nif/" + self.n_name + "1.nif"
        self.n_filepath_2 = "test/nif/" + self.n_name + "2.nif"

        self.b_filepath_0 = "test/autoblend/" + self.n_name + "0.blend"
        self.b_filepath_1 = "test/autoblend/" + self.n_name + "1.blend"
        self.b_filepath_2 = "test/autoblend/" + self.n_name + "2.blend"

        if not os.path.exists(os.path.dirname(self.n_filepath_0)):
            os.makedirs(os.path.dirname(self.n_filepath_0))

        if not os.path.exists(os.path.dirname(self.b_filepath_0)):
            os.makedirs(os.path.dirname(self.b_filepath_0))

    def _b_clear_check(self, b_obj_names):
        """Check that *b_obj_names* are really cleared from the scene."""
        try:
            for name in b_obj_names:
                b_obj = bpy.data.objects[name]
        except KeyError:
            pass
        else:
            raise RuntimeError(
                "failed to clear {0} from scene".format(b_obj))

    def _b_select_all(self):
        """Select all objects, and return their names."""
        b_obj_names = []
        for b_obj in bpy.data.objects:
            b_obj.select = True
            b_obj_names.append(b_obj.name)
        return b_obj_names

    def b_create_objects(self):
        """Create blender objects for feature."""
        raise NotImplementedError

    def b_save(self, b_filepath):
        """Save current scene to blend file."""
        bpy.ops.wm.save_mainfile(filepath=b_filepath)

    def b_check_data(self):
        """Check blender objects against feature."""
        raise NotImplementedError

    def n_create_data(self):
        """Create and return nif data used for initial nif file."""
        raise NotImplementedError

    def n_check_data(self, n_data):
        """Check nif data against feature."""
        raise NotImplementedError

    def n_check(self, n_filepath):
        """Check nif file against feature."""
        self.n_check_data(self.n_read(n_filepath))

    def n_read(self, n_filepath):
        """Read nif file and return the data."""
        n_data = NifFormat.Data()
        with open(n_filepath, "rb") as stream:
            n_data.read(stream)
        return n_data

    def n_write(self, n_data, n_filepath):
        """Write a nif file from data."""
        with open(n_filepath, "wb") as stream:
            n_data.write(stream)

    def n_import(self, n_filepath):
        """Import nif file."""
        bpy.ops.import_scene.nif(
            filepath=n_filepath,
            log_level='DEBUG',
            )

    def n_export(self, n_filepath):
        """Export selected blender object to nif file."""
        bpy.ops.export_scene.nif(
            filepath=n_filepath,
            log_level='DEBUG',
            game=self.n_game,
            )

    def test_import_export(self):
        """Test import followed by export."""
        # create initial nif file and check data
        self.n_write(self.n_create_data(), self.n_filepath_0)
        self.n_check(self.n_filepath_0)

        # import nif and check data
        self.b_clear()
        self.n_import(self.n_filepath_0)
        b_obj_names = self._b_select_all()
        self.b_save(self.b_filepath_0)
        self.b_check_data()

        # export and check data
        self.n_export(self.n_filepath_1)
        self.n_check(self.n_filepath_1)
        self.b_clear()
        self._b_clear_check(b_obj_names)

    def test_export_import(self):
        """Test export followed by import."""

        # create scene
        self.b_create_objects()
        b_obj_names = self._b_select_all()
        self.b_save(self.b_filepath_1)
        self.b_check_data()

        # export and check data
        self.n_export(self.n_filepath_2)
        self.n_check(self.n_filepath_2)
        self.b_clear()
        self._b_clear_check(b_obj_names)

        # import and check data
        self.n_import(self.n_filepath_2)
        b_obj_names = self._b_select_all()
        self.b_save(self.b_filepath_2)
        self.b_check_data()
        self.b_clear()
        self._b_clear_check(b_obj_names)


text:
export _VAGRANT_DIR="/vagrant"
export _PROVISION_DIR="$_VAGRANT_DIR/scripts/vagrant"
export _CONTENT_DIR="$_PROVISION_DIR/content"
export _SCRIPTS_DIR="$_PROVISION_DIR/scripts"

# update before provisioning
sudo apt-get update -y

"$_SCRIPTS_DIR/install_essentials.sh"

"$_SCRIPTS_DIR/install_git.sh"

"$_SCRIPTS_DIR/install_python.sh"

"$_SCRIPTS_DIR/install_node.sh"

# add custom content to .bashrc
cat "$_CONTENT_DIR/home/vagrant/.bashrc" >> /home/vagrant/.bashrc


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 mimir.exec.spark.datasource.google

import org.apache.spark.sql._

package object spreadsheet {
  /**
   * Add a method, `spreadsheet`, to DataFrameReader that allows reading Google Spreadsheets data.
   */
  implicit class SpreadsheetDataFrameReader(reader: DataFrameReader) {
    def spreadsheet: String => DataFrame =
      reader.format("mimir.exec.spark.datasource.google.spreadsheet").load
  }

  /**
   * Add a method, `spreadsheet`, to DataFrameWriter that allows you to write Google Spreadsheets data.
   */
  implicit class SpreadsheetDataFrameWriter[T](writer: DataFrameWriter[T]) {
    def spreadsheet: String => Unit =
      writer.format("mimir.exec.spark.datasource.google.spreadsheet").save
  }
}


text:
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants';
import { s__, n__ } from '~/locale';

export const groupedSummaryText = state => {
  if (state.isLoading) {
    return s__('Reports|Accessibility scanning results are being parsed');
  }

  if (state.hasError) {
    return s__('Reports|Accessibility scanning failed loading results');
  }

  const numberOfResults = state.report?.summary?.errored || 0;
  if (numberOfResults === 0) {
    return s__('Reports|Accessibility scanning detected no issues for the source branch only');
  }

  return n__(
    'Reports|Accessibility scanning detected %d issue for the source branch only',
    'Reports|Accessibility scanning detected %d issues for the source branch only',
    numberOfResults,
  );
};

export const summaryStatus = state => {
  if (state.isLoading) {
    return LOADING;
  }

  if (state.hasError || state.status === STATUS_FAILED) {
    return ERROR;
  }

  return SUCCESS;
};

export const shouldRenderIssuesList = state =>
  Object.values(state.report).some(x => Array.isArray(x) && x.length > 0);

// We could just map state, but we're going to iterate in the future
// to add notes and warnings to these issue lists, so I'm going to
// keep these as getters
export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors;


text:
package com.ltsllc.miranda.servlet.user;

import com.ltsllc.miranda.clientinterface.basicclasses.User;
import com.ltsllc.miranda.clientinterface.results.ResultObject;

import java.util.List;

/**
 * Created by Clark on 4/15/2017.
 */
public class UserListResultObject extends ResultObject {
    private List<User> userList;

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
}


text:
Mircro php structure for developing web application

#### How to install
This structure can only be installed using composer only. Use below code create project.

```
composer create-project micro-struct/structure structure
```

This will create project with name 'structure'.

#### URL Mapping
URL mapping to controller can be done using route.php file located in config directory.
All route rules should be defiend unedr array key `rule`

Bellow are sample route which we will learn one by one.

````php
return [
    'rule' => [
        '/' => [
            'controller' => 'MainController',
            'method' => 'index'
        ],
        'login' => [
            'controller'=>'MainController',
            'method'=>'login'
        ],
        'test/(:string)' => [
            'controller' => 'MainController',
            'method' => '@1',
        ]
    ]
];
````

Each route rule should placed as key and its value shoudl contain locating controller and method name. If you do not define locating controller or method, structure will thorugh errro.

1st rule is landing route of the applicaiton. Landing route is defined using `/` only.

2nd rule is static route which is directly mapped to controller method.

3rd rule is dynamic.
Here we can define dynamic segmetn using `(:string)` or `(:int)`. For third rule we have defined above it matched anything after `test/` till next `/` not found. Few matchable routes are listed below

`test/method1`, `test/method2`, `test/method3`.

#### Databse connection
This Strucure uses Donctrine ORM and DBAL to connect to databse. Databse configuration is located in config.php file of config directory.
You can use any of one or both `ORM` or `DBAL` by setting its value to `TRUE`. To disable database connection set their value to `FALSE`.

Connected databse connenction's instance is only avaiable to Model class's two property called `entityManager` and `db`.

To use ORM
````php
  $this->entityManager
````

To use DBAL
````php
  $this->db
````


text:
import {Component} from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
import {Routes, RouterModule, Router} from '@angular/router';
import {ProductDetailComponentParam} from "./components/product-param";

const routes: Routes = [
    {path: 'product/:id', component: ProductDetailComponentParam}
];

class Product {
    id: number;
    description: string;
}

@Component({
    selector: 'app',
    template: `
        <ul style="width: 100px;">
           <li *ngFor="let product of products"
            [class.selected]="product === selectedProduct"
            (click) = onSelect(product)>
              <span>{{product.id}} {{product.description}} </span>
           </li>
       </ul>

        <router-outlet></router-outlet>
    `,
    styles:[`.selected {background-color: cornflowerblue}`]
})
class AppComponent {
    selectedProduct: Product;

    products: Product[] = [
        {id: 1, description: "iPhone 7"},
        {id: 2, description: "Samsung 7"},
        {id: 3, description: "MS Lumina"}
    ];

    constructor(private _router: Router){}

    onSelect(prod: Product): void {
        this.selectedProduct = prod;
        this._router.navigate(["/product", prod.id]);
    }
}

@NgModule({
    imports:      [ BrowserModule, RouterModule.forRoot(routes)],
    declarations: [ AppComponent, ProductDetailComponentParam],
    providers:[{provide: LocationStrategy, useClass: HashLocationStrategy}],
    bootstrap:    [ AppComponent ]
})
class AppModule { }

platformBrowserDynamic().bootstrapModule(AppModule);


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.togglz.junit (Togglz 2.1.0.Final API)</title>
<meta name="date" content="2014-12-29">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

org.togglz.junit

Classes

TogglzRule

Annotation Types

WithFeature