text:
package org.wordpress.passcodelock;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.util.Log;

public class StringUtils {

	public static String getMd5Hash(String input) {
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] messageDigest = md.digest(input.getBytes());
			BigInteger number = new BigInteger(1, messageDigest);
			String md5 = number.toString(16);

			while (md5.length() < 32)
				md5 = "0" + md5;

			return md5;
		} catch (NoSuchAlgorithmException e) {
			Log.e("MD5", e.getLocalizedMessage());
			return null;
		}
	}

}


text:
This page was generated with Wiki Builder. Do not change the format!

## Info
Dictates a rule around whether the plug is enabled or insertable. In practice, the live Destiny data will refer to these entries by index. You can then look up that index in the appropriate property (enabledRules or insertionRules) to get the localized string for the failure message if it failed.

## Schema
* **Schema Type:** Definition
* **Type:** object

## Properties
Name | Type | Description
---- | ---- | -----------
failureMessage | string | The localized string to show if this rule fails.

## Example
```javascript
{
    // Type: string
    "failureMessage": ""
}

```

## References
1. https://bungie-net.github.io/multi/schema_Destiny-Definitions-Items-DestinyPlugRuleDefinition.html#schema_Destiny-Definitions-Items-DestinyPlugRuleDefinition

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: "Finally- A blog of my own!"
description: ""
category:
tags:  [general, r, statistics]
---

After thinking about it a long time, I finally decided to create a blog of my own.
Learning of [Jekyll](http://jekyllrb.com/) with [kramdown](http://kramdown.gettalong.org/) markdown for interpreting  [MathJax](https://www.mathjax.org/) made the difference, as I can now easily post with all the mathematical detail I want.
[Barry Clark's](http://www.smashingmagazine.com/2014/08/01/build-blog-jekyll-github-pages/) guide really helped me getting started.
I can event edit [RMarkdown](http://rmarkdown.rstudio.com/) in [RStudio](http://www.rstudio.com/), outputting text and images, and automatically publish on [Github](https://github.com/).
I did not try this exciting pipeline yet, but it is documented by  [Andy South](http://andysouth.github.io/blog-setup/).

Well, if you are interested on my thoughts on statistics and `R`, you may consider adding this feed to your RSS reader.

## What to Expect

Future posts will include:

- An intro to the underlying concepts of machines learning. Taken from [my course at BGU](https://github.com/johnros/Intro2R).
- A mass of research ideas I have, and I know I will never have time to attend.
- Random thoughts about `R`. Probably with some code.


text:
package view

import (
	"bytes"
	"encoding/gob"
	"fmt"
)

// View represents a server's view of the members of the distributed system. A View once created is immutable, for a mutable View, see CurrentView type.
type View struct {
	Entries map[Update]bool
	Members map[Process]bool // Cache, can be rebuilt from Entries
}

func newView() *View {
	v := View{}
	v.Entries = make(map[Update]bool)
	v.Members = make(map[Process]bool)
	return &v
}

func NewWithUpdates(updates ...Update) *View {
	newCopy := newView()
	newCopy.addUpdate(updates...)
	return newCopy
}

func NewWithProcesses(processes ...Process) *View {
	updates := []Update{}
	for _, process := range processes {
		updates = append(updates, Update{Join, process})
	}
	return NewWithUpdates(updates...)
}

func (v *View) NewCopyWithUpdates(updates ...Update) *View {
	newCopy := newView()

	for update, _ := range v.Entries {
		newCopy.Entries[update] = true
	}
	for process, _ := range v.Members {
		newCopy.Members[process] = true
	}

	newCopy.addUpdate(updates...)

	return newCopy
}

func (v *View) addUpdate(updates ...Update) {
	for _, newUpdate := range updates {
		v.Entries[newUpdate] = true

		switch newUpdate.Type {
		case Join:
			if !v.Entries[Update{Leave, newUpdate.Process}] {
				v.Members[newUpdate.Process] = true
			}
		case Leave:
			delete(v.Members, newUpdate.Process)
		}
	}
}

func (v *View) String() string {
	buf := new(bytes.Buffer)

	fmt.Fprintf(buf, "{")

	first := true
	for process, _ := range v.Members {
		if !first {
			fmt.Fprintf(buf, ", ")
		}
		fmt.Fprintf(buf, "%v", process.Addr)
		first = false
	}

	fmt.Fprintf(buf, "}")
	return buf.String()
}

func (v *View) LessUpdatedThan(v2 *View) bool {
	if len(v2.Entries) > len(v.Entries) {
		return true
	}

	for k2, _ := range v2.Entries {
		if _, ok := v.Entries[k2]; !ok {
			return true
		}
	}
	return false
}

func (v *View) Equal(v2 *View) bool {
	if len(v.Entries) != len(v2.Entries) {
		return false
	}

	for k2, _ := range v2.Entries {
		if _, ok := v.Entries[k2]; !ok {
			return false
		}
	}
	return true
}

func (v *View) HasUpdate(u Update) bool {
	return v.Entries[u]
}

func (v *View) HasMember(p Process) bool {
	return v.Members[p]
}

func (v *View) GetUpdates() []Update {
	var updates []Update
	for update, _ := range v.Entries {
		updates = append(updates, update)
	}
	return updates
}

func (v *View) GetUpdatesNotIn(v2 *View) []Update {
	var updates []Update
	for loopUpdate, _ := range v.Entries {
		if !v2.Entries[loopUpdate] {
			updates = append(updates, loopUpdate)
		}
	}

	return updates
}

func (v *View) GetMembers() []Process {
	var members []Process
	for process, _ := range v.Members {
		members = append(members, process)
	}
	return members
}

func (v *View) GetMembersNotIn(v2 *View) []Process {
	var members []Process
	for process, _ := range v.Members {
		if !v2.Members[process] {
			members = append(members, process)
		}
	}

	return members
}

// GetProcessPosition returns an unique number for the process in the view. Returns -1 if process is not a member of the view.
func (v *View) GetProcessPosition(process Process) int {
	if _, ok := v.Members[process]; !ok {
		return -1
	}

	// Position will be the position of the process in an ordered list of the members.
	position := 0
	for proc, _ := range v.Members {
		if proc.Addr < process.Addr {
			position++
		}
	}
	return position
}

func (v *View) NumberOfMembers() int {
	return len(v.Members)
}

func (v *View) NumberOfUpdates() int {
	return len(v.Entries)
}

func (v *View) QuorumSize() int {
	membersTotal := len(v.Members)
	return (membersTotal+1)/2 + (membersTotal+1)%2
}

func (v *View) NumberOfToleratedFaults() int {
	membersTotal := len(v.Members)
	return membersTotal - v.QuorumSize()
}

// ----- ERRORS -----

type OldViewError struct {
	NewView *View
}

func (e OldViewError) Error() string {
	return fmt.Sprintf("Client's current view is old, update to '%v'", e.NewView)
}

func init() { gob.Register(new(OldViewError)) }

// ----- Auxiliary types ---------

type updateType string

const (
	Join  updateType = "+"
	Leave updateType = "-"
)

type Process struct {
	Addr string
}

func (thisProcess Process) Less(otherProcess Process) bool {
	return thisProcess.Addr < otherProcess.Addr
}

type Update struct {
	Type    updateType
	Process Process
}

func (thisUpdate Update) Less(otherUpdate Update) bool {
	if thisUpdate.Type < otherUpdate.Type {
		return true
	} else if thisUpdate.Type == otherUpdate.Type {
		return thisUpdate.Process.Less(otherUpdate.Process)
	} else {
		return false
	}
}


text:
<?php

class Extension {

    public function pre_controller($params = array()) {
//        $config = load_class('Config', 'core');
//        $config->load('site');
    }

    public function pre_system($params = array()) {
//        require_once(BASEPATH . 'database/DB.php');
//        $db = DB(); // getting hold of a DAO instance
        // routing information is always useful to have for pageview logs
//        load_class('Utf8', 'core');
//        $RTR = load_class('Router', 'core');
        // Router also load Uri and Config classes inside so the following two instances could be interesting too:
        // $RTR->uri
        // $RTR->config
        //$db->insert('page_view_log', array('class' => $RTR->fetch_class(), 'method' => $RTR->fetch_method()));
    }

}


text:
id: 5900f37d1000cf542c50fe8f
challengeType: 5
title: 'Problem 16: Power digit sum'
videoUrl: ''
localeTitle: 'Задача 16: сумма цифр питания'
---

## Description

 2 15 = 32768 , а сумма его цифр равна 3 + 2 + 7 + 6 + 8 = 26. Какова сумма цифр числа 2 exponent ?

## Instructions

## Tests

```yml
tests:
  - text: <code>powerDigitSum(15)</code> должен вернуть 26.
    testString: 'assert.strictEqual(powerDigitSum(15), 26, "<code>powerDigitSum(15)</code> should return 26.");'
  - text: <code>powerDigitSum(128)</code> должен вернуть 166.
    testString: 'assert.strictEqual(powerDigitSum(128), 166, "<code>powerDigitSum(128)</code> should return 166.");'
  - text: <code>powerDigitSum(1000)</code> должен вернуть 1366.
    testString: 'assert.strictEqual(powerDigitSum(1000), 1366, "<code>powerDigitSum(1000)</code> should return 1366.");'

```

## Challenge Seed

```js
function powerDigitSum(exponent) {
  // Good luck!
  return true;
}

powerDigitSum(15);

```

## Solution

```js
// solution required
```


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="44dp"
    android:orientation="vertical"
    android:minHeight="40dp"
    android:padding="4dp"
    android:background="@android:color/background_light">

       <TextView
           android:text="00:00"
           android:id="@+id/tv_schedule_time_start"
           android:textSize="14sp"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"/>

       <TextView
           android:text="00:00"
           android:id="@+id/tv_schedule_time_end"
           android:textSize="14sp"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_below="@id/tv_schedule_time_start"
           android:textColor="@android:color/darker_gray" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:id="@+id/imageView"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/tv_schedule_time_start"
        android:layout_toEndOf="@+id/tv_schedule_time_start"
        android:background="#3498db"
        android:minWidth="2dp"
        android:layout_marginLeft="4dp"
        android:minHeight="40dp" />

    <TextView
        android:id="@+id/tv_schedule_title"
        android:textSize="18sp"
        android:layout_marginLeft="8dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/imageView"
        android:ellipsize="end"
        android:maxLines="1"
        android:scrollHorizontally="true"
        android:text="スケジュールタイトル"
        android:gravity="center_vertical"
        android:textIsSelectable="false" />

    <TextView
        android:id="@+id/tv_schedule_same_users"
        android:textSize="10sp"
        android:textColor="@android:color/darker_gray"
        android:layout_marginLeft="10dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/imageView"
        android:layout_below="@id/tv_schedule_title"
        android:ellipsize="end"
        android:maxLines="1"
        android:scrollHorizontally="true"
        android:text="@string/unset"
        android:gravity="center_vertical" />

</RelativeLayout >


text:
package org.italiangrid.voms.request.impl;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

import org.italiangrid.voms.request.VOMSACRequest;
import org.italiangrid.voms.request.VOMSProtocol;
import org.italiangrid.voms.request.VOMSProtocolError;
import org.italiangrid.voms.request.VOMSProtocolListener;
import org.italiangrid.voms.request.VOMSResponse;
import org.italiangrid.voms.request.VOMSServerInfo;

import eu.emi.security.authn.x509.X509CertChainValidatorExt;
import eu.emi.security.authn.x509.X509Credential;
import eu.emi.security.authn.x509.impl.CertificateUtils;
import eu.emi.security.authn.x509.impl.FormatMode;
import eu.emi.security.authn.x509.impl.HostnameMismatchCallback;
import eu.emi.security.authn.x509.impl.SocketFactoryCreator;

/**
 * Protocol implementing the legacy interface.
 *
 *
 */
public class LegacyProtocol extends AbstractVOMSProtocol implements
  VOMSProtocol, HostnameMismatchCallback {

  public LegacyProtocol(X509CertChainValidatorExt validator,
    VOMSProtocolListener listener, int connectTimeout, int readTimeout) {

    super(validator, listener, connectTimeout, readTimeout);
  }

  public synchronized VOMSResponse doRequest(VOMSServerInfo endpoint,
    X509Credential credential, VOMSACRequest request) {

    SSLSocketFactory sslSocketFactory = getSSLSocketFactory(credential);

    SSLSocket sslSocket = null;

    try {

      sslSocket = (SSLSocket) sslSocketFactory.createSocket();
      sslSocket.setSoTimeout(readTimeout);
      sslSocket.setEnabledProtocols(VOMS_LEGACY_ENABLED_PROTOCOLS);

      SocketAddress sa = new InetSocketAddress(endpoint.getURL().getHost(),
        endpoint.getURL().getPort());

      sslSocket.connect(sa, connectTimeout);
      if (!isSkipHostnameChecks()) {
        SocketFactoryCreator.connectWithHostnameChecking(sslSocket, this);
      }

    } catch (Throwable t) {

      throw new VOMSProtocolError(t.getMessage(), endpoint, request,
        credential, t);

    }

    LegacyRequestSender protocol = LegacyRequestSender.instance(listener);

    VOMSResponse response = null;

    try {

      protocol.sendRequest(request, endpoint, sslSocket.getOutputStream());

      InputStream inputStream = sslSocket.getInputStream();

      response = new LegacyVOMSResponseParsingStrategy().parse(inputStream);

      sslSocket.close();

    } catch (IOException e) {

      throw new VOMSProtocolError(e.getMessage(), endpoint, request,
        credential, e);
    }

    listener.notifyReceivedResponse(response);
    return response;
  }

  public void nameMismatch(SSLSocket socket, X509Certificate peerCertificate,
    String hostName) throws SSLException {

    String peerCertString = CertificateUtils.format(peerCertificate,
      FormatMode.MEDIUM_ONE_LINE);
    String message = String
      .format(
        "No subject alternative DNS name matching %s found. Peer certificate : %s",
        hostName, peerCertString);
    throw new SSLException(message);

  }

}


text:
package org.sakaiproject.tool.assessment.integration.helper.integrated;

import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
import org.sakaiproject.tool.assessment.facade.AgentFacade;
import org.sakaiproject.tool.assessment.integration.helper.ifc.PublishingTargetHelper;

/**
 *
 *
Description:
 * This is an integrated context implementation helper delegate class for
 * the PublishingTarget class.
 * "Integrated" means that Samigo (Tests and Quizzes)
 * is running within the context of the Sakai portal and authentication
 * mechanisms, and therefore makes calls on Sakai for things it needs.

 *
Note: To customize behavior you can add your own helper class to the
 * Spring injection via the integrationContext.xml for your context.
 * The particular integrationContext.xml to be used is selected by the
 * build process.
 *

 *
Sakai Project Copyright (c) 2005

 *

 * @author Ed Smiley <esmiley@stanford.edu>
 */

public class PublishingTargetHelperImpl implements PublishingTargetHelper
{
  private Logger log = LoggerFactory.getLogger(PublishingTargetHelperImpl.class);

    //private org.sakaiproject.component.api.ComponentManager cm;

  public PublishingTargetHelperImpl()
  {
  }

  /**
   * Gets to whom you can publish.
   * @return map of key value pairs:
   *  e.g. "Authenticated Users"->"AUTHENTICATED_USERS"
   */
  public HashMap getTargets()
  {
     HashMap map = new HashMap();
     map.put("Anonymous Users", "ANONYMOUS_USERS");
     map.put(AgentFacade.getCurrentSiteName(), AgentFacade.getCurrentSiteId());
     //map.put("Selected Groups", "SELECTED_GROUPS");
     map.put(AssessmentAccessControlIfc.RELEASE_TO_SELECTED_GROUPS, AssessmentAccessControlIfc.RELEASE_TO_SELECTED_GROUPS);
     return map;
  }
}


text:
bountyDelayTime = 10000
isBountyGamemodeAllowed = false
OutputColorR,OutputColorG,OutputColorB =  171, 255, 174

btestmode = true
addCommandHandler( "bountytestmode",
	function(Psource,cmd,bln)
		if hasObjectPermissionTo( Psource, "function.banPlayer", false) then
			if bln == true or bln == "true" then btestmode = true outputDebugString("Bounty testmode : true")
			elseif bln == false or bln == "false" then btestmode = false outputDebugString("Bounty testmode : false")
			end
		end
	end)

local BountyTable = {
	-- [playerWithBounty] = { EXAMPLE TREE
	-- 	["source"] = bountySource,
	-- 	["amount"] = bountyAmount, }
}

local hasPlayerSetBounty = {
	-- [player] = true, -- EXAMPLE TREE --
}

local gc = exports["gc"]
-- local kill = exports["race_kill"]

function setBountyHandler(Psource,cmd,NamePart, amount)
	-- fail checks --

	if btestmode and not hasObjectPermissionTo( Psource, "function.banPlayer", false ) then return end

	if exports.race:getRaceMode() == "Sprint" then return end

	if not isBountyGamemodeAllowed then outputChatBox("Bounty's are only allowed in DD or Shooter!",Psource,255,0,0) return end

	if not NamePart then return end

	local toPlayer = getPlayerFromPartialName(NamePart)

	if hasPlayerSetBounty[Psource] then outputChatBox("You can only set 1 bounty per match.",Psource,255,0,0) return end

	if not toPlayer then outputChatBox("Player Not Found.",Psource,255,0,0) return end

	if isPedDead(toPlayer) then outputChatBox("You can't set bounties on dead players.",Psource,255,0,0) return end

	local theName = __getPlayerName(toPlayer,true)

	if BountyTable[toPlayer] then outputChatBox(theName.." already got a bounty his head.",Psource,255,0,0) return end

	if not tonumber(amount) then outputChatBox("Wrong command syntax used, use: /addbounty name amount",Psource,255,0,0) return end

	local amount = tonumber(amount)
	if amount < 50 or amount > 1000 then outputChatBox("GC Amount must be between 50gc and 10000gc",Psource,255,0,0) return end

	local playerGC = gc:getPlayerGreencoins(Psource)
	if playerGC-amount < 0 then outputChatBox("You do not have enough GC!",Psource,255,0,0) return end

	local alivePlayers = getAlivePlayers()
	local minPlayers = calculateMinimumPlayers()
	-- if #alivePlayers < minPlayers then bountyOutput("You can't place a bounty with less than "..tostring(minPlayers).." players alive.",Psource,255,0,0) return end
	-- if Psource == toPlayer then bountyOutput("You can not put a bounty on yourself!",Psource,255,0,0) return end

	-- End fail checks --
	setTimer( setBounty, bountyDelayTime, 1, toPlayer,Psource,amount)
	local time = bountyDelayTime
	local time = time/1000
	outputChatBox("Bounty will be active in "..tostring(time).." seconds.",Psource,0,255,0)

end
addCommandHandler( "setbounty", setBountyHandler )

function setBounty(victim,Psource,amount)
	if mapState ~= "Running" then outputChatBox("Bounty Failed, Map has stopped.",Psource,255,0,0) return end
	if not isElement(victim) then outputChatBox("Bounty Failed, Can't find player.",Psource,255,0,0) return end
	if isPedDead( victim ) then outputChatBox("Bounty Failed, Victim is dead.",Psource,255,0,0) return end
	if BountyTable[victim] then outputChatBox("Bounty Failed, There is already a bounty on that player.",Psource,255,0,0) return end
	local sourceName = __getPlayerName(Psource,true)
	local victimName = __getPlayerName(victim,true)
	hasPlayerSetBounty[Psource] = true
	BountyTable[victim] = {
	["source"] = Psource,
	["amount"] = amount }

	giveBountyRewards(Psource, -amount)
	bountyOutput(sourceName.." has put a bounty on "..victimName.."'s head! ("..tostring(amount).." GC)",getRootElement(),OutputColorR,OutputColorG,OutputColorB)

	triggerClientEvent( root, "clientReceiveBounty", root, victim, amount )

end

function checkGamemode(state)
	mapState = state
	if state == "Running" and exports.race:getRaceMode() == "Destruction derby" or exports.race:getRaceMode() == "Shooter" then
		isBountyGamemodeAllowed = true
	elseif state == "LoadingMap" then
		BountyTable = {}
		hasPlayerSetBounty = {}
	else
		isBountyGamemodeAllowed = false
	end
end
addEvent('onRaceStateChanging', true)
addEventHandler("onRaceStateChanging", root, checkGamemode)

-- Bounty Kill --
function handleBountyKill()
	local player = source

	-- if tonumber(#getAlivePlayers()) == 1 then handleWinner() end
	if not BountyTable[player] then return end

	local amount = tonumber(BountyTable[player]["amount"])
	local bountySource = BountyTable[player]["source"]

	local killer = exports.race_kill:getKiller(player)
	local killerName = __getPlayerName(killer, true)
	local playerName = __getPlayerName(player, true)
	local sourceName = __getPlayerName(bountySource, true)

	if killer == bountySource then
		bountyOutput(sourceName.." completed his own bounty by killing "..playerName..", "..tostring(amount).." GC refunded.",root,OutputColorR,OutputColorG,OutputColorB )
		giveBountyRewards(bountySource,amount)

		BountyTable[player] = nil
		return
	end

	if not killer then
		-- Refund source
		bountyOutput(playerName.." died without getting killed, "..tostring(amount).." GC refunded to "..sourceName.."!",root,OutputColorR,OutputColorG,OutputColorB)
		giveBountyRewards(bountySource,amount)

		BountyTable[player] = nil

	elseif killer then
		-- Give Killer Credit
		bountyOutput(killerName.." has earned "..tostring(amount).."GC for completing "..sourceName.."'s bounty by killing "..playerName.."!",root,OutputColorR,OutputColorG,OutputColorB)
		giveBountyRewards(killer,amount)

		BountyTable[player] = nil
	end

end
addEvent('onPlayerFinishDD')
addEventHandler('onPlayerFinishDD', root, handleBountyKill)
addEvent('onPlayerFinishShooter')
addEventHandler('onPlayerFinishShooter', root, handleBountyKill)

function handleWinner(name)
	local winner = source
	if name == "race rank" and tonumber(getElementData(winner,"race rank")) == 1 then
		local winnerName = __getPlayerName(winner,true)

		if not BountyTable[winner] then return end

		local amount = BountyTable[winner]["amount"]

		bountyOutput(winnerName.." earned "..tostring(amount).."GC for winning the match with a bounty on his head!",root,OutputColorR,OutputColorG,OutputColorB)
		giveBountyRewards(winner,amount)

		BountyTable = {}
		hasPlayerSetBounty = {}
	end

end
addEventHandler("onElementDataChange",root,handleWinner)

function giveBountyRewards(to,amt)
	if not btestmode then
		gc:addPlayerGreencoins(to,amt)
	end
end

-- Min Player Calculator --
function calculateMinimumPlayers()
	local playerCount = getPlayerCount()
	if playerCount < 10 then playerCount = 10 end
	local percent = playerCount/100*40 -- calculate 40 percent
	return math.floor(percent)
end

 -- util --
function bountyOutput(str,element,r,g,b)
	local delayTime = 800 -- ms
	setTimer(function()
	local prefix = "[Bounty]"
	outputChatBox(prefix.." "..str,element,r,g,b)
	exports.messages:outputGameMessage(prefix.." "..str,element,2.4,r,g,b)
	end,delayTime,1)
end

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

function __getPlayerName(plyr, bln)
	if bln and isElement(plyr) then
		local theName = getPlayerName(plyr)
		local theName = string.gsub(theName, '#%x%x%x%x%x%x', '')
		return theName
	elseif not bln then
		return getPlayerName(plyr)
	end
end


text:
import { Injectable } from '@angular/core';
import {
    CanActivate, Router,
    ActivatedRouteSnapshot,
    RouterStateSnapshot
} from '@angular/router';
import { AuthService } from './auth.service';

@Injectable()
export class AuthGuard implements CanActivate {

    constructor(private authService: AuthService, private router: Router) {}

    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
        const url: string = state.url;

        return this.checkLogin(url);
    }

    checkLogin(url: string): boolean {
        if (this.authService.loggedIn()) { return true; }

        // Store the attempted URL for redirecting
        this.authService.redirectRoute = url;

        // Navigate to the login page with extras
        this.router.navigate([this.authService.loginRoute]);
        return false;
    }
}


text:
[![Build Status](https://travis-ci.org/Helabs/omniauth-facebook-rails.png)](https://travis-ci.org/Helabs/omniauth-facebook-rails)

##omniauth-facebook-rails
This gem speeds up omniauth-facebook setup in Rails apps.

##Getting started
omniauth-facebook-rails works with Rails 3.2 onwards. You can add it to your Gemfile with:

```ruby
gem 'omniauth-facebook-rails'
```

Add the required environment variables:

```
export FACEBOOK_APP_KEY=123456
export FACEBOOK_APP_SECRET=abcdef
```

Move the migration files:

```
rake omniauth_facebook:setup
```

Then, migrate them:

```
rake db:migrate
```

It will add the fields to your users table if it already exists,
otherwise it will create it.

It is heavily recommended for you to change railsties order in
`config/application.rb`:

```ruby
config.railties_order = [OmniauthFacebookRails::Engine, :main_app, :all]
```

Otherwise, your `User` model won't load the Engine's  `User` model.

##Features/Problems
* It is in Portuguese.
* You only are granted access to the person's  email.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## License
This project is released under the [MIT
License](http://www.opensource.org/licenses/MIT)


text:
importScripts('third_party/serviceworker-cache-polyfill.js');

var CACHE_NAME = 'app';
var CACHE_VERSION = '@VERSION@';

self.oninstall = function(event) {

  var urls = [

    '/',
    '/images/chrome-touch-icon-192x192.png',

    '/scripts/app-core.js',

    '/elements/hello-world/hello-world.html',

    '/favicon.ico',
    '/manifest.json'

  ];

  urls = urls.map(function(url) {
    return new Request(url, {credentials: 'include'});
  });

  event.waitUntil(
    caches
      .open(CACHE_NAME + '-v' + CACHE_VERSION)
      .then(function(cache) {
        return cache.addAll(urls);
      })
  );

};

self.onactivate = function(event) {

  var currentCacheName = CACHE_NAME + '-v' + CACHE_VERSION;
  caches.keys().then(function(cacheNames) {

    return Promise.all(
      cacheNames.map(function(cacheName) {
        if (cacheName.indexOf(CACHE_NAME) == -1) {
          return;
        }

        if (cacheName != currentCacheName) {
          return caches.delete(cacheName);
        }
      })
    );
  });

};

self.onfetch = function(event) {

  var request = event.request;
  var url = new URL(request.url);
  var validSubsections = [
    'create', 'details', 'edit', ''
  ];

  var subsection = /^\/([^\/]*)/.exec(url.pathname)[1];

  event.respondWith(

    // Check the cache for a hit.
    caches.match(request).then(function(response) {

      // If we have a response return it.
      if (response)
        return response;

      // Otherwise return index.html file.
      if (validSubsections.indexOf(subsection) >= 0)
        return caches.match('/');

      // We may get requests for analytics so
      // do a very dumb check for that.
      if (url.host.indexOf('app') === -1)
        return fetch(request);

      // And worst case we fire out a not found.
      return new Response('Sorry, not found');
    })
  );
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Risersoft.API.GSTN.GSTR3
{
    public class Tpm
    {
        [Required]
        [Display(Name = "IGST payable")]
        public double i_py { get; set; }

        [Required]
        [Display(Name = "CGST payable")]
        public double c_py { get; set; }

        [Required]
        [Display(Name = "SGST payable")]
        public double s_py { get; set; }

        [Required]
        [Display(Name = "CESS payable")]
        public double cs_py { get; set; }

        [Required]
        [Display(Name = "List of Paid Through Cash")]
        public List<Pdcash> pdcash { get; set; }

        [Required]
        [Display(Name = "List of Paid Through Credit")]
        public List<Pdcr> pdcr { get; set; }
    }
}


text:
def welcome (address)
	if address.match("CA")
    return "Welcome to California"
  else
    return "You should move to California"
  end
end