text:
package ca.ualberta.cs.team5geotopics;

import android.graphics.Bitmap;

public class UserController {
	private User mUser;

	public UserController() {
		this.mUser = User.getInstance();
	}

	public UserController(User user){
		this.mUser = user;
	}
	/**
	 * Used to add OR remove a comment ID from the bookmark's list. If the ID
	 * exists its removed, else its added.
	 *
	 * @param ID
	 *            The comment ID
	 */
	public void bookmark(CommentModel comment) {
		mUser.bookmark(comment);
	}

	/**
	 * This method is used to tell the user model that we are viewing a specific
	 * comment. This allows us to remove it from the want to read bookmarks list
	 * upon reading.
	 *
	 * @param comment
	 *            The comment we are reading
	 */
	public void readingComment(CommentModel comment) {
		if (mUser.inBookmarks(comment)) {
			mUser.removeBookmark(comment);
		}
	}

	/**
	 * Used to add OR remove a comment ID from the favourites's list. If the ID
	 * exists its removed, else its added.
	 *
	 * @param ID
	 *            The comment ID
	 */
	public void favourite(CommentModel comment) {
		mUser.favourite(comment);
	}

	public void updateProfile(String userName, String contactInfo, String bio, Bitmap profile){
		mUser.update(userName, contactInfo, bio, profile);
	}
}


text:
const timers = {
    arcFill: null,
    circleFill: null,
    displayFill: null,
    guide0Fill: null,
    guide1Fill: null,
    markerFill: null,
    markerInterval: null,
    precision: null,
};

const intervals = [
    Math.PI / 12,
    Math.PI / 6,
    Math.PI / 4,
    Math.PI / 3,
    Math.PI / 2,
    Math.PI * 2 / 3,
    Math.PI
];

//===== Slider DOM updaters
function updatePrecision(precision) {
    document.getElementById('precision-slider').value = precision;
    document.getElementById('precision-value')
        .innerHTML = `${precision} digit${precision === 1 ? '' : 's'}`;
}

function updateMarkerInterval(interval, units) {
    const deg = interval * 180 / Math.PI;
    const rad = interval;

    const str = (units === 'deg'
        ? `${Math.round(deg * 100) / 100}°`
        : `${Math.round(rad * 100) / 100} rad`);

    document.getElementById('marker-interval-slider').value = intervals.indexOf(rad);
    document.getElementById('marker-interval-value').innerHTML = str;
}

//===== Event listeners
function onPrecisionChange(evt) {
    const precision = parseInt(evt.target.value);
    updatePrecision(precision);

    function save() {
        chrome.storage.sync.set({ precision });
    }

    clearTimeout(timers.precision);
    timers.precision = setTimeout(save, 200);
}

function onMarkerIntervalChange(evt) {
    const markerInterval = intervals[parseInt(evt.target.value)];
    const units = document['options-form'].units.value;
    updateMarkerInterval(markerInterval, units);

    function save() {
        chrome.storage.sync.set({ markerInterval });
    }

    clearTimeout(timers.markerInterval);
    timers.markerInterval = setTimeout(save, 200);
}

function onDisplayFillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.displayFillR.value, 255));
        const g = Math.max(0, Math.min(form.displayFillG.value, 255));
        const b = Math.max(0, Math.min(form.displayFillB.value, 255));
        const a = Math.max(0, Math.min(form.displayFillA.value, 1));

        form.displayFillR.value = r;
        form.displayFillG.value = g;
        form.displayFillB.value = b;
        form.displayFillA.value = a;

        chrome.storage.sync.set({ displayFill: `rgba(${r},${g},${b},${a})` });
    }

    clearTimeout(timers.displayFill);
    timers.displayFill = setTimeout(save, 500);
}

function onCircleFillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.circleFillR.value, 255));
        const g = Math.max(0, Math.min(form.circleFillG.value, 255));
        const b = Math.max(0, Math.min(form.circleFillB.value, 255));
        const a = Math.max(0, Math.min(form.circleFillA.value, 1));

        form.circleFillR.value = r;
        form.circleFillG.value = g;
        form.circleFillB.value = b;
        form.circleFillA.value = a;

        chrome.storage.sync.set({ circleFill: `rgba(${r},${g},${b},${a})` });
    }

    clearTimeout(timers.circleFill);
    timers.circleFill = setTimeout(save, 500);
}

function onArcFillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.arcFillR.value, 255));
        const g = Math.max(0, Math.min(form.arcFillG.value, 255));
        const b = Math.max(0, Math.min(form.arcFillB.value, 255));
        const a = Math.max(0, Math.min(form.arcFillA.value, 1));

        form.arcFillR.value = r;
        form.arcFillG.value = g;
        form.arcFillB.value = b;
        form.arcFillA.value = a;

        chrome.storage.sync.set({ arcFill: `rgba(${r},${g},${b},${a})` });
    }

    clearTimeout(timers.arcFill);
    timers.arcFill = setTimeout(save, 500);
}

function onGuide0FillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.guide0FillR.value, 255));
        const g = Math.max(0, Math.min(form.guide0FillG.value, 255));
        const b = Math.max(0, Math.min(form.guide0FillB.value, 255));
        const a = Math.max(0, Math.min(form.guide0FillA.value, 1));

        form.guide0FillR.value = r;
        form.guide0FillG.value = g;
        form.guide0FillB.value = b;
        form.guide0FillA.value = a;

        chrome.storage.sync.set({ guide0Fill: `rgba(${r},${g},${b},${a})` });
    }

    clearTimeout(timers.guide0Fill);
    timers.guide0Fill = setTimeout(save, 500);
}

function onGuide1FillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.guide1FillR.value, 255));
        const g = Math.max(0, Math.min(form.guide1FillG.value, 255));
        const b = Math.max(0, Math.min(form.guide1FillB.value, 255));
        const a = Math.max(0, Math.min(form.guide1FillA.value, 1));

        form.guide1FillR.value = r;
        form.guide1FillG.value = g;
        form.guide1FillB.value = b;
        form.guide1FillA.value = a;

        chrome.storage.sync.set({ guide1Fill: `rgba(${r},${g},${b},${a})` });
    }

    clearTimeout(timers.guide1Fill);
    timers.guide1Fill = setTimeout(save, 500);
}

function onMarkerFillChange(evt) {
    function save() {
        const form = document['options-form'];
        const r = Math.max(0, Math.min(form.markerFillR.value, 255));
        const g = Math.max(0, Math.min(form.markerFillG.value, 255));
        const b = Math.max(0, Math.min(form.markerFillB.value, 255));

        form.markerFillR.value = r;
        form.markerFillG.value = g;
        form.markerFillB.value = b;

        chrome.storage.sync.set({ markerFill: `rgba(${r},${g},${b},1)` });
    }

    clearTimeout(timers.markerFill);
    timers.markerFill = setTimeout(save, 500);
}

function onUnitsChange(evt) {
    const units = evt.target.value;
    chrome.storage.sync.set({ units });

    chrome.storage.sync.get({ markerInterval: null },
        ({ markerInterval }) => updateMarkerInterval(markerInterval, units));
}

function onRotationChange(evt) {
    const rotation = evt.target.value;
    chrome.storage.sync.set({ rotation });
}

function onMarkerLabelsChange(evt) {
    const markerLabels = evt.target.value;
    chrome.storage.sync.set({ markerLabels });
}

function onMarkerLengthChange(evt) {
    const markerLength = evt.target.value;
    chrome.storage.sync.set({ markerLength });
}

function onMarkerSnapChange(evt) {
    const markerSnap = evt.target.value;
    chrome.storage.sync.set({ markerSnap });
}

function restore() {
    chrome.storage.sync.get({
        arcFill: `rgba(50,243,150,0.1)`,
        circleFill: `rgba(200,200,200,0.03)`,
        displayFill: `rgba(240,240,240,0.95)`,
        guide0Fill: 'rgba(46,198,86,1)',
        guide1Fill: 'rgba(0,0,255,1)',
        markerFill: 'rgba(160,160,160,1)',
        markerLabels: false,
        markerLength: 'center',
        markerSnap: true,
        markerInterval: Math.PI / 6,
        precision: 1,
        rotation: 'ccw',
        units: 'deg'
    }, ({ precision, markerFill, markerLabels, markerLength, markerSnap, markerInterval, displayFill, circleFill, arcFill, guide0Fill, guide1Fill, units, rotation }) => {
        updatePrecision(precision);

        updateMarkerInterval(markerInterval, units);

        const form = document['options-form'];
        form.units.value = units;
        form.rotation.value = rotation;
        form.markerLabels.value = markerLabels;
        form.markerLength.value = markerLength;
        form.markerSnap.value = markerSnap;

        const arc = arcFill.substring(5, arcFill.length - 1).split(',');
        const circle = circleFill.substring(5, circleFill.length - 1).split(',');
        const display = displayFill.substring(5, displayFill.length - 1).split(',');
        const guide0 = guide0Fill.substring(5, guide0Fill.length - 1).split(',');
        const guide1 = guide1Fill.substring(5, guide1Fill.length - 1).split(',');
        const marker = markerFill.substring(5, markerFill.length - 1).split(',');

        form.arcFillR.value = arc[0];
        form.arcFillG.value = arc[1];
        form.arcFillB.value = arc[2];
        form.arcFillA.value = arc[3];

        form.circleFillR.value = circle[0];
        form.circleFillG.value = circle[1];
        form.circleFillB.value = circle[2];
        form.circleFillA.value = circle[3];

        form.displayFillR.value = display[0];
        form.displayFillG.value = display[1];
        form.displayFillB.value = display[2];
        form.displayFillA.value = display[3];

        form.guide0FillR.value = guide0[0];
        form.guide0FillG.value = guide0[1];
        form.guide0FillB.value = guide0[2];
        form.guide0FillA.value = guide0[3];

        form.guide1FillR.value = guide1[0];
        form.guide1FillG.value = guide1[1];
        form.guide1FillB.value = guide1[2];
        form.guide1FillA.value = guide1[3];

        form.markerFillR.value = marker[0];
        form.markerFillG.value = marker[1];
        form.markerFillB.value = marker[2];
    });
}

document.addEventListener('DOMContentLoaded', () => {
    restore();

    document.getElementById('precision-slider')
        .addEventListener('input', onPrecisionChange);

    document.getElementById('marker-interval-slider')
        .addEventListener('input', onMarkerIntervalChange);

    const form = document['options-form'];

    form.units[0].addEventListener('change', onUnitsChange);
    form.units[1].addEventListener('change', onUnitsChange);

    form.rotation[0].addEventListener('change', onRotationChange);
    form.rotation[1].addEventListener('change', onRotationChange);

    form.markerLabels[0].addEventListener('change', onMarkerLabelsChange);
    form.markerLabels[1].addEventListener('change', onMarkerLabelsChange);

    form.markerLength[0].addEventListener('change', onMarkerLengthChange);
    form.markerLength[1].addEventListener('change', onMarkerLengthChange);

    form.markerSnap[0].addEventListener('change', onMarkerSnapChange);
    form.markerSnap[1].addEventListener('change', onMarkerSnapChange);

    form.displayFillR.addEventListener('input', onDisplayFillChange);
    form.displayFillG.addEventListener('input', onDisplayFillChange);
    form.displayFillB.addEventListener('input', onDisplayFillChange);
    form.displayFillA.addEventListener('input', onDisplayFillChange);

    form.circleFillR.addEventListener('input', onCircleFillChange);
    form.circleFillG.addEventListener('input', onCircleFillChange);
    form.circleFillB.addEventListener('input', onCircleFillChange);
    form.circleFillA.addEventListener('input', onCircleFillChange);

    form.arcFillR.addEventListener('change', onArcFillChange);
    form.arcFillG.addEventListener('change', onArcFillChange);
    form.arcFillB.addEventListener('change', onArcFillChange);
    form.arcFillA.addEventListener('change', onArcFillChange);

    form.guide0FillR.addEventListener('change', onGuide0FillChange);
    form.guide0FillG.addEventListener('change', onGuide0FillChange);
    form.guide0FillB.addEventListener('change', onGuide0FillChange);
    form.guide0FillA.addEventListener('change', onGuide0FillChange);

    form.guide1FillR.addEventListener('change', onGuide1FillChange);
    form.guide1FillG.addEventListener('change', onGuide1FillChange);
    form.guide1FillB.addEventListener('change', onGuide1FillChange);
    form.guide1FillA.addEventListener('change', onGuide1FillChange);

    form.markerFillR.addEventListener('change', onMarkerFillChange);
    form.markerFillG.addEventListener('change', onMarkerFillChange);
    form.markerFillB.addEventListener('change', onMarkerFillChange);
});

redpajama_set_name: RedPajamaGithub


text:
/* @flow */

import { ENV, CARD_PRIORITY, FUNDING, BUTTON_LAYOUT, FUNDING_ELIGIBILITY_REASON } from '../constants';
import type { LocaleType, FundingSource, FundingSelection, FundingList } from '../types';

import { getFundingConfig, getCardConfig, FUNDING_PRIORITY, FUNDING_CONFIG } from './config';

let fundingEligibilityReasons = [];

export function isFundingIneligible(source : FundingSource, { locale, funding, layout, commit } :
    { locale : LocaleType, funding : FundingSelection, layout : string, commit? : boolean }) : ?string {

    let isVertical = layout === BUTTON_LAYOUT.VERTICAL;
    let allowSecondary = getFundingConfig(source, isVertical ? 'allowVertical' : 'allowHorizontal');

    if (!allowSecondary) {
        return FUNDING_ELIGIBILITY_REASON.SECONDARY_DISALLOWED;
    }

    if (funding.disallowed.indexOf(source) !== -1 && getFundingConfig(source, 'allowOptOut')) {
        return FUNDING_ELIGIBILITY_REASON.OPT_OUT;
    }

    if (funding.disallowed.indexOf(source) !== -1 && source === FUNDING.VENMO) {
        return FUNDING_ELIGIBILITY_REASON.OPT_OUT;
    }

    if (getFundingConfig(source, 'allowedCountries', [ locale.country ]).indexOf(locale.country) === -1) {
        return FUNDING_ELIGIBILITY_REASON.DISALLOWED_COUNTRY;
    }

    if (getFundingConfig(source, 'requireCommitAsTrue') && !commit) {
        return FUNDING_ELIGIBILITY_REASON.COMMIT_NOT_SET;
    }
}

export function isFundingAutoEligible(source : FundingSource, { locale, funding, layout } :
    { locale : LocaleType, funding : FundingSelection, layout : string }) : ?string {

    let isVertical = layout === BUTTON_LAYOUT.VERTICAL;

    if (isVertical && getFundingConfig(source, 'defaultVerticalCountries', []).indexOf(locale.country) !== -1) {
        return FUNDING_ELIGIBILITY_REASON.DEFAULT_COUNTRY;
    }

    if (getFundingConfig(source, 'default')) {
        return FUNDING_ELIGIBILITY_REASON.DEFAULT;
    }

    if (funding.allowed.indexOf(source) !== -1 && getFundingConfig(source, 'allowOptIn')) {
        return FUNDING_ELIGIBILITY_REASON.OPT_IN;
    }

    if (funding.remembered.indexOf(source) !== -1 && getFundingConfig(source, 'allowRemember')) {
        return FUNDING_ELIGIBILITY_REASON.REMEMBERED;
    }
}

export function isFundingEligible(source : FundingSource, { locale, funding, env, layout, selected, commit } :
    { locale : LocaleType, funding : FundingSelection, env : string, layout : string, selected? : string, commit : boolean }) : { eligible : boolean, reason : string } {

    if (selected && source === selected) {
        return { eligible: true, reason: FUNDING_ELIGIBILITY_REASON.PRIMARY };
    }

    if (!getFundingConfig(source, 'enabled')) {
        if (!(env === ENV.TEST && getFundingConfig(source, 'test'))) {
            return { eligible: false, reason: FUNDING_ELIGIBILITY_REASON.NOT_ENABLED };
        }
    }

    let ineligibleReason = isFundingIneligible(source, { locale, funding, layout, commit });

    if (ineligibleReason) {
        return { eligible: false, reason: ineligibleReason };
    }

    let autoEligibleReason = isFundingAutoEligible(source, { locale, funding, layout });

    if (autoEligibleReason) {
        return { eligible: true, reason: autoEligibleReason };
    }

    return { eligible: false, reason: FUNDING_ELIGIBILITY_REASON.NEED_OPT_IN };
}

export function determineEligibleFunding({ funding, selected, locale, env, layout, commit } :
    { funding : FundingSelection, selected : FundingSource, locale : LocaleType, env : string, layout : string, commit : boolean }) : FundingList {

    let reasons = {};

    let eligibleFunding = FUNDING_PRIORITY.filter(source => {
        let { eligible, reason } = isFundingEligible(source, { selected, locale, funding, env, layout, commit });
        reasons[source] = { eligible, reason, factors: { env, locale, layout } };
        return eligible;
    });

    fundingEligibilityReasons.push(reasons);

    eligibleFunding.splice(eligibleFunding.indexOf(selected), 1);
    eligibleFunding.unshift(selected);

    return eligibleFunding;
}

export function determineEligibleCards({ funding, locale } :
    { funding : FundingSelection, locale : LocaleType }) : FundingList {

    return getCardConfig(locale.country, 'priority')
        .filter(card => funding.disallowed.indexOf(card) === -1);
}

export function validateFunding(funding : FundingSelection = { allowed: [], disallowed: [], remembered: [] }) {

    if (funding.allowed) {
        for (let source of funding.allowed) {
            if (CARD_PRIORITY.indexOf(source) !== -1) {
                continue;
            }

            if (!FUNDING_CONFIG.hasOwnProperty(source)) {
                throw new Error(`Invalid funding source: ${ source }`);
            }

            if (!getFundingConfig(source, 'allowOptIn')) {
                throw new Error(`Can not allow funding source: ${ source }`);
            }

            if (funding.disallowed && funding.disallowed.indexOf(source) !== -1) {
                throw new Error(`Can not allow and disallow funding source: ${ source }`);
            }
        }
    }

    if (funding.disallowed) {
        for (let source of funding.disallowed) {
            if (CARD_PRIORITY.indexOf(source) !== -1) {
                continue;
            }

            if (!FUNDING_CONFIG.hasOwnProperty(source)) {
                throw new Error(`Invalid funding source: ${ source }`);
            }

            if (!getFundingConfig(source, 'allowOptOut')) {
                throw new Error(`Can not disallow funding source: ${ source }`);
            }
        }
    }
}

export function logFundingEligibility() {
    fundingEligibilityReasons.forEach((reasons, i) => {
        console.log(`\nButton ${ i + 1 }:\n`); // eslint-disable-line no-console

        console.table(Object.keys(reasons).map(source => {  // eslint-disable-line no-console
            let { reason, eligible, factors } = reasons[source];

            return {
                'Funding':     source,
                'Reason':      reason,
                'Eligibility': eligible ? 'eligible' : 'ineligible',
                'Factors':     JSON.stringify(factors)
            };
        }));
    });
}


text:
[instagram-private-api](../../README.md) / [responses](../../modules/responses.md) / MediaUpdatedMediaResponseCandidatesItem

# Interface: MediaUpdatedMediaResponseCandidatesItem

[responses](../../modules/responses.md).MediaUpdatedMediaResponseCandidatesItem

## Table of contents

### Properties

- [estimated\_scans\_sizes](MediaUpdatedMediaResponseCandidatesItem.md#estimated_scans_sizes)
- [height](MediaUpdatedMediaResponseCandidatesItem.md#height)
- [url](MediaUpdatedMediaResponseCandidatesItem.md#url)
- [width](MediaUpdatedMediaResponseCandidatesItem.md#width)

## Properties

### estimated\_scans\_sizes

• **estimated\_scans\_sizes**: `number`[]

#### Defined in

[src/responses/media.updated-media.response.ts:53](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L53)

___

### height

• **height**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:51](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L51)

___

### url

• **url**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:52](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L52)

___

### width

• **width**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:50](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L50)


text:
title: Sense of Scale with Spheres and Fog
date: 2015-12-18
author: twitter|joshcarpenter|Josh Carpenter
layout: blog
image:
  href: https://aframe.io/examples/showcase/spheres-and-fog/
  src: spheres-and-fog.jpg
---

[spheres]: https://aframe.io/examples/showcase/spheres-and-fog/

I like the [Spheres and Fog example][spheres] because it explores the sense of scale within virtual reality more than our other early examples. A series of spheres in the scene vary from 0.15 to 30 meters in radius, and a fog on `<a-scene>` amplifies the sense of size and distance:

```html
<a-scene fog="type: linear; color: #AAB; far: 30; near: 0">
```

<!-- more -->

The soft shadows under each sphere are faked with images. In Photoshop I created a circular gradient that fades from opaque to transparent. I applied this image as a child object of each sphere:

```html
<a-sphere position="-3 0 0" translate="0 1.75 0" radius="1.75" color="#7BC8A4" roughness="0.2">
  <a-image src="../_images/radial-shadow-3.png" rotation="-90 0 0" scale="1.75 1.75 1.75"></a-image>
</a-sphere>
```

I rotated the images -90 degrees on the x-axis so that they lie flat, and then used scale to adjust their sizes to fit the proportions of their parent sphere.

To make each sphere appear to sit on ground — neither too high nor too low — I used a translate value on each sphere, where the Y value was equal to the sphere radius:

```html
<a-sphere position="-15 0 5" translate="0 3 0" radius="3" color="#ECECEC">
```

The translate component in A-Frame shifts the geometry of a primitive (or geometry component on an entity, if you're using entities and components) relative to the object position. The position remains the same, but the visible geometry moves relative to it. This enabled me to use the keep each sphere's position at 0 on the y-axis, matching my mental model of the spheres being balls sitting on the ground. It would arguably have been more concise to achieve the same visual effect by using y-axis positions instead of translate, but I found this approach felt better.