blob_id
large_stringlengths 40
40
| language
large_stringclasses 1
value | repo_name
large_stringlengths 5
119
| path
large_stringlengths 4
271
| score
float64 2.52
4.84
| int_score
int64 3
5
| text
stringlengths 26
4.09M
|
|---|---|---|---|---|---|---|
5a8b1b975de48c490ab3c21da12ad5b0a8d59b29
|
TypeScript
|
manuth/ExtendedYoGenerator
|
/packages/extended-yo-generator/src/Components/Inquiry/QuestionBase.ts
| 3.234375
| 3
|
import { ChoiceCollection, KeyUnion, Question } from "inquirer";
import { GeneratorOptions } from "yeoman-generator";
import { IGenerator } from "../../IGenerator.js";
import { IGeneratorSettings } from "../../IGeneratorSettings.js";
/**
* Represents a question.
*
* @template TSettings
* The type of the settings of the generator.
*
* @template TOptions
* The type of the options of the generator.
*/
export abstract class QuestionBase<TSettings extends IGeneratorSettings = IGeneratorSettings, TOptions extends GeneratorOptions = GeneratorOptions> implements Question<TSettings>
{
/**
* @inheritdoc
*/
public prefix?: string;
/**
* @inheritdoc
*/
public suffix?: string;
/**
* The generator of the question.
*/
private generator: IGenerator<TSettings, TOptions>;
/**
* Initializes a new instance of the {@link QuestionBase `QuestionBase<TSettings, TOptions>`} class.
*
* @param generator
* The generator of the question.
*/
public constructor(generator: IGenerator<TSettings, TOptions>)
{
this.generator = generator;
}
/**
* Gets the generator of the question.
*/
protected get Generator(): IGenerator<TSettings, TOptions>
{
return this.generator;
}
/**
* @inheritdoc
*/
public abstract get name(): KeyUnion<TSettings>;
/**
* @inheritdoc
*
* @param answers
* The answers provided by the user.
*
* @returns
* The message to show to the user.
*/
public message = async (answers: TSettings): Promise<string> =>
{
return this.Message(answers);
};
/**
* @inheritdoc
*
* @param answers
* The answers provided by the user.
*
* @returns
* The default value.
*/
public default = async (answers: TSettings): Promise<any> =>
{
return this.Default(answers);
};
/**
* @inheritdoc
*
* @param input
* The input provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* The filtered value.
*/
public filter = async (input: any, answers: TSettings): Promise<any> =>
{
return this.Filter(input, answers);
};
/**
* @inheritdoc
*
* @param answers
* The answers provided by the user.
*
* @returns
* A value indicating whether the question should be asked.
*/
public when = async (answers: TSettings): Promise<boolean> =>
{
return this.When(answers);
};
/**
* @inheritdoc
*
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* Either a value indicating whether the answer is valid or a {@link String `string`} which describes the error.
*/
public validate = async (input: any, answers: TSettings): Promise<string | boolean> =>
{
return this.Validate(input, answers);
};
/**
* @inheritdoc
*
* @param answers
* The answers provided by the user.
*
* @returns
* The choices the user can choose from.
*/
public choices = async (answers: TSettings): Promise<ChoiceCollection<TSettings>> =>
{
return this.Choices(answers);
};
/**
* Gets the default value of the question.
*
* @param answers
* The answers provided by the user.
*
* @returns
* The default value.
*/
protected async Default(answers: TSettings): Promise<any>
{
return null;
}
/**
* Post-processes the answer.
*
* @param input
* The input provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* The filtered value.
*/
protected async Filter(input: any, answers: TSettings): Promise<any>
{
return input;
}
/**
* Gets a value indicating whether the question should be prompted.
*
* @param answers
* The answers provided by the user.
*
* @returns
* A value indicating whether the question should be asked.
*/
protected async When(answers: TSettings): Promise<boolean>
{
return true;
}
/**
* Validates the integrity of the answer.
*
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* Either a value indicating whether the answer is valid or a {@link String `string`} which describes the error.
*/
protected async Validate(input: any, answers: TSettings): Promise<boolean | string>
{
return true;
}
/**
* The choices of the prompt.
*
* @param answers
* The answers provided by the user.
*
* @returns
* The choices the user can choose from.
*/
protected async Choices(answers: TSettings): Promise<ChoiceCollection<TSettings>>
{
return [];
}
/**
* Gets the message to show to the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* The message to show to the user.
*/
protected abstract Message(answers: TSettings): Promise<string>;
}
|
7515d3e9e71d24a7e5683f0cd0b29895a3598101
|
TypeScript
|
mamunhpath/leetcode
|
/src/lemonade-change/index.ts
| 2.921875
| 3
|
export const lemonadeChange = function(bills: number[]) {
let five = 0
let ten = 0
for (let money of bills) {
if (money === 5) five++
else if (money === 10) {
if (five === 0) return false
ten++
five--
} else {
if (five === 0 || ten * 10 + five * 5 < 15) return false
if (ten === 0) {
five -= 3
} else {
ten--
five--
}
}
}
return true
}
|
57ef64628f6915b2b0404c7417b6577dfde5499b
|
TypeScript
|
cm94242/ts-monads
|
/src/option.ts
| 3.875
| 4
|
export interface OptionMatch<T, T2> {
some: (arg: T) => T2,
none: () => T2
}
export abstract class Option<T>{
abstract map<T2>(fxn: (arg: T) => T2) : Option<T2>
abstract flatMap<T2>(fxn: (arg: T) => Option<T2>) : Option<T2>
abstract filter(fxn: (arg: T) => boolean) : Option<T>
abstract get() : T
abstract isDefined(): boolean
match<T2>(matcher: OptionMatch<T, T2>) : T2 {
return this.isDefined() ? matcher.some(this.get()) : matcher.none()
}
fold<T2>(alternate: T2, fxn: (arg: T) => T2) : T2 {
return this.isDefined() ? fxn(this.get()) : alternate
}
getOrElse(alternate: T) : T {
return this.isDefined() ? this.get() : alternate
}
orElse(alternate: Option<T>) : Option<T> {
return this.isDefined() ? this : alternate
}
isEmpty() : boolean {
return !this.isDefined()
}
static none<T>() : Option<T> {
return new None<T>()
}
static some<T>(arg: T) : Option<T> {
if (null == arg){
throw new Error("Some cannot be null!")
}
return new Some<T>(arg)
}
static from<T>(arg: T | null | undefined) : Option<T> {
if (null == arg){
return Option.none()
}
return Option.some(arg)
}
}
class Some<T> extends Option<T> {
constructor(private readonly arg: T){
super()
}
isDefined() : boolean {
return true
}
map<T2>(fxn: (arg: T) => T2) : Option<T2> {
const tmp : T2 = fxn(this.arg)
return new Some<T2>(tmp)
}
flatMap<T2>(fxn: (arg: T) => Option<T2>) : Option<T2> {
const tmp : Option<T2> = fxn(this.arg)
return tmp
}
filter(fxn: (arg: T) => boolean) : Option<T> {
return fxn(this.arg) ? this : new None<T>()
}
get() : T {
return this.arg
}
}
class None<T> extends Option<T> {
isDefined() : boolean {
return false
}
map<T2>(fxn: (arg: T) => T2) : Option<T2> {
return new None<T2>()
}
flatMap<T2>(fxn: (arg: T) => Option<T2>) : Option<T2> {
return new None<T2>()
}
filter(fxn: (arg: T) => boolean) : Option<T> {
return this
}
get() : T {
throw new Error("No value!")
}
}
|
8bab6fee39b4ead80d2537c36fefddfc0db38cbe
|
TypeScript
|
Mikael-R/aziris
|
/src/utils/listItems.ts
| 3.171875
| 3
|
interface IListItems {
(items: any[], pageActual: number, limitItems: number): any[]
}
const listItems: IListItems = (items, pageActual, limitItems) => {
const itemsInPageActual = []
const totalPages = Math.ceil(items.length / limitItems)
let count = pageActual * limitItems - limitItems
const delimiter = count + limitItems
if (pageActual <= totalPages) {
for (let i = count; i < delimiter; i++) {
if (items[i]) itemsInPageActual.push(items[i])
count++
}
}
return itemsInPageActual
}
export default listItems
|
0501b7227be859ed3f7b94cb7126cb21a6dfd0b9
|
TypeScript
|
future4code/Murilo-Oliari
|
/semana14/Aula44/src/exe03.ts
| 3.625
| 4
|
function arrayToObject (arrayDeNumeros: number[]): void {
type objetoDaLista = {
quantidadeDeNumeros: number,
quantidadeDeImpares: number,
somaDeTodosOsElementos: number
}
const impares = arrayDeNumeros.filter(el =>
el % 2 !== 0 ? true : false);
const soma: number = arrayDeNumeros.reduce((soma, el) => soma + el)
const novoObjeto: objetoDaLista = {
quantidadeDeNumeros: arrayDeNumeros.length,
quantidadeDeImpares: impares.length,
somaDeTodosOsElementos: soma
}
console.log(novoObjeto)
}
arrayToObject([2, 3, 6, 8])
|
4ad3b8300c902374bb9700cb42f0185bb354813e
|
TypeScript
|
KnifeOnlyI/AgileMind
|
/src/main/webapp/app/entities/release.entity.ts
| 3.0625
| 3
|
/**
* Represent a release
*
* @author Dany Pignoux (dany.pignoux@outlook.fr)
*/
export class Release {
/**
* Constructor
*
* @param id The ID
* @param name The Name
* @param description The description
* @param date The date
* @param stories The stories
* @param project The project
*/
public constructor(
public id?: number,
public name?: string,
public description?: string,
public date?: Date,
public stories?: Array<number>,
public project?: number,
) {
}
}
|
a22a180991528bce8d94494501e54bad373bcbb7
|
TypeScript
|
majidbop/Assignment
|
/src/finders/athletes.ts
| 2.609375
| 3
|
import { Filter } from '../models/interfaces'
import { Athlete } from '../models/database/athlete'
import log from '../logger/log';
import { getAthleteBySkill, getAthleteByCompetition, getAthleteIdsByFilter, getAthleteById } from '../drivers/athletes';
import { AthletesPresenter } from '../models/presenter';
export async function getAthletes(filters: Filter[], page: number, limit: number): Promise<AthletesPresenter[]> {
log.info("Get Athletes in founder layer called with following infos", "filters: ", filters, " ,page: ", page, "limit: ", limit);
const relationFilters = filters.filter((filter: Filter): Boolean => (filter.name == 'skill' || filter.name == 'champions'));
const usersId = (await Promise.all(relationFilters.map((filter: Filter): Promise<number[]> => {
switch (filter.name.toLowerCase()) {
case 'skill':
return getAthleteBySkill([{ filter: filter.filter, name: 'skillName', value: filter.value }])
case 'champions':
return getAthleteByCompetition([{ filter: filter.filter, name: 'champName', value: filter.value }])
default:
break;
}
return new Promise(resolve => resolve([]))
}))).reduce((prev: number[], current: number[]): number[] => prev.concat(current), [])
const athleteFilters = filters.filter((filter: Filter): Boolean => (filter.name != 'skill' && filter.name != 'champions'));
athleteFilters.push({ filter: "in", name: "id", value: usersId })
log.debug(`athleteFilters: ${JSON.stringify(athleteFilters)}`)
const athletesId: number[] = await getAthleteIdsByFilter(athleteFilters);
const athletes: AthletesPresenter[] = await Promise.all(athletesId.map((athleteId: number): Promise<AthletesPresenter> => {
return getAthleteById(athleteId);
}));
return athletes
}
|
3ba9ba94957c0f7fde19fd60a5b245234740df64
|
TypeScript
|
irosvall/chatbuds-client
|
/src/app/services/error-handler/error-handler.service.ts
| 2.890625
| 3
|
import { Injectable } from '@angular/core'
import { Observable, of } from 'rxjs'
@Injectable({
providedIn: 'root'
})
export class ErrorHandlerService {
constructor() { }
/**
* Handle Http operations that failed.
*
* @param operation - Name of the operation that failed.
* @param result - Optional value to return as the observable result, if left out the error is sent.
*/
public handleError<T>(result?: T) {
return (error: any): Observable<T> => {
// Client errors such as network errors.
if (error instanceof ErrorEvent) {
console.error('An error occurred:', error.message);
}
// Let the app keep running by returning an empty result.
if (result === undefined) {
return of(error as T)
} else {
return of(result as T)
}
}
}
}
|
afda553464ba8cf3174e80c93b40992cbc67fa2f
|
TypeScript
|
ahiatt14/gallformers
|
/pages/api/source/index.ts
| 2.640625
| 3
|
import { pipe } from 'fp-ts/lib/function';
import * as O from 'fp-ts/lib/Option';
import * as TE from 'fp-ts/lib/TaskEither';
import { NextApiRequest, NextApiResponse } from 'next';
import { Err, getQueryParams, sendErrResponse, sendSuccResponse, toErr } from '../../../libs/api/apipage';
import { SourceApi, SourceWithSpeciesSourceApi } from '../../../libs/api/apitypes';
import { searchSources, sourcesWithSpeciesSourceBySpeciesId } from '../../../libs/db/source';
export default async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
// 2 paths:
// 1: an ID is passed in fetch that source
// 2: a query string is passed in, fetch source that contain that string
const errMsg = (): TE.TaskEither<Err, SourceWithSpeciesSourceApi[]> => {
return TE.left({ status: 400, msg: 'Failed to provide the speciesid as a query param.' });
};
const params = getQueryParams(req.query, ['speciesid', 'q']);
if (params && O.isSome(params['speciesid'])) {
await pipe(
params['speciesid'],
O.map(parseInt),
O.map(sourcesWithSpeciesSourceBySpeciesId),
O.map(TE.mapLeft(toErr)),
O.getOrElse(errMsg),
TE.fold(sendErrResponse(res), sendSuccResponse(res)),
)();
} else if (params && O.isSome(params['q'])) {
const errMsg = (): TE.TaskEither<Error, SourceApi[]> => {
return TE.left(new Error('Failed to search for sources.'));
};
await pipe(
params['q'],
O.fold(errMsg, searchSources),
TE.mapLeft(toErr),
TE.fold(sendErrResponse(res), sendSuccResponse(res)),
)();
} else {
res.status(400).end('No valid query params provided. Pass either a speciesId or a query.');
}
};
|
6e12e0db188e8f6c739be9f2c6bd9b1118f51229
|
TypeScript
|
TakyiuLo/angular-temp-auth
|
/src/app/data-share.service.ts
| 2.84375
| 3
|
import { Injectable } from "@angular/core";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
/* DataShareService interfaces start here */
export interface Action {
readonly type: string;
readonly payload: any;
}
/* DataShareService interfaces ends here */
@Injectable({
providedIn: "root"
})
export class DataShareService {
// using BehaviorSubject so late subscriber will still get the most recent source
private subject: BehaviorSubject<any> = new BehaviorSubject("Default Data");
public observer = this.subject.asObservable();
public store = { user: null }; // store will have most up to date data
constructor() {
this.share({ type: "default", payload: "OK" });
}
share(action: Action, options: any = { saveAs: null }) {
if (options.saveAs) {
this.store[options.saveAs] = action.payload;
}
// console.log("shared", action);
this.subject.next(action);
}
// prepare type returns a pre-defined type function
prepareType(type: string) {
return (payload: any) => ({
type,
payload
});
}
}
|
f371d3240d74b2fd601d57f34fd1682266f885fc
|
TypeScript
|
JonathanWilbur/preql
|
/source/normalizeError.ts
| 3.40625
| 3
|
/**
* This function exists to solve two problems:
*
* 1. In older versions of Serverless, Serverless crashes when it encounters
* an unusually structured `Error` type. See
* [the issue](https://github.com/serverless/serverless/issues/6267).
* 2. The `Ajv` library, which is used for JSON validation, throws unusually
* structured errors with a non-descriptive `message`, but with a more
* descriptive `errors` array of error-like objects. This function appends
* the error messages from this array of errors to the end of the `message`
* field.
*
* @param err {Error} The error to be normalized.
* @returns {Error} The modified error.
*/
export default
function normalizeError (err: any): Error {
/*
This is to make Ajv.ValidationError print errors in errorMessage when
using Serverless Framework.
*/
if (
"message" in err
&& "errors" in err
&& typeof err.errors === "object"
&& Array.isArray(err.errors)
) {
err.message += `: ${(err.errors as object[]).map((e: any): string => {
if ("message" in e) return e.message;
return "";
}).join(", ")}`;
}
return err;
}
|
605781a3a9460404d36ed6117bc527f9ceed9b06
|
TypeScript
|
dotkom/hacktoberfest-code-golf
|
/src/storage.ts
| 3.109375
| 3
|
import { SetStateAction, Dispatch, useEffect, useState } from 'react'
const getLocalStorageState = <T>(key: string, orElse: T): T => {
try {
const data = localStorage.getItem(key)
if (data) {
return JSON.parse(data)
} else {
return orElse
}
} catch {}
return orElse
}
const setLocalStorageState = <T>(key: string, data: T) => {
localStorage.setItem(key, JSON.stringify(data))
}
export function useLocalStorage<T>(key: string, orElse: T): [T, Dispatch<SetStateAction<T>>] {
const initialState = getLocalStorageState<T>(key, orElse)
const [value, setValue] = useState<T>(initialState)
useEffect(() => {
setLocalStorageState(key, value)
}, [key, orElse, value])
return [value, setValue]
}
|
b9641cbc1fad0cd92c5a97bebf9408f433c049ab
|
TypeScript
|
confuego/Math
|
/tests/matrix3.spec.ts
| 3.203125
| 3
|
import { Matrix3, Vector3 } from "../src";
import { expect } from "chai";
import "mocha";
describe("Matrix3", () => {
it("should create", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
expect(mat).to.not.be.null;
});
it("should get cells", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
});
it("should set cells", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.set(2, 2, 1000);
expect(mat.get(2, 2)).to.be.equal(1000);
});
it("should add (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.add(mat, mat);
expect(mat.get(0, 0)).to.be.equal(2);
expect(mat.get(0, 1)).to.be.equal(4);
expect(mat.get(0, 2)).to.be.equal(6);
expect(mat.get(1, 0)).to.be.equal(8);
expect(mat.get(1, 1)).to.be.equal(10);
expect(mat.get(1, 2)).to.be.equal(12);
expect(mat.get(2, 0)).to.be.equal(14);
expect(mat.get(2, 1)).to.be.equal(16);
expect(mat.get(2, 2)).to.be.equal(18);
});
it("should add (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const newMat = mat.add(mat);
expect(newMat.get(0, 0)).to.be.equal(2);
expect(newMat.get(0, 1)).to.be.equal(4);
expect(newMat.get(0, 2)).to.be.equal(6);
expect(newMat.get(1, 0)).to.be.equal(8);
expect(newMat.get(1, 1)).to.be.equal(10);
expect(newMat.get(1, 2)).to.be.equal(12);
expect(newMat.get(2, 0)).to.be.equal(14);
expect(newMat.get(2, 1)).to.be.equal(16);
expect(newMat.get(2, 2)).to.be.equal(18);
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
});
it("should subtract (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.sub(mat, mat);
expect(mat.get(0, 0)).to.be.equal(0);
expect(mat.get(0, 1)).to.be.equal(0);
expect(mat.get(0, 2)).to.be.equal(0);
expect(mat.get(1, 0)).to.be.equal(0);
expect(mat.get(1, 1)).to.be.equal(0);
expect(mat.get(1, 2)).to.be.equal(0);
expect(mat.get(2, 0)).to.be.equal(0);
expect(mat.get(2, 1)).to.be.equal(0);
expect(mat.get(2, 2)).to.be.equal(0);
});
it("should subtract (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const newMat = mat.sub(mat);
expect(newMat.get(0, 0)).to.be.equal(0);
expect(newMat.get(0, 1)).to.be.equal(0);
expect(newMat.get(0, 2)).to.be.equal(0);
expect(newMat.get(1, 0)).to.be.equal(0);
expect(newMat.get(1, 1)).to.be.equal(0);
expect(newMat.get(1, 2)).to.be.equal(0);
expect(newMat.get(2, 0)).to.be.equal(0);
expect(newMat.get(2, 1)).to.be.equal(0);
expect(newMat.get(2, 2)).to.be.equal(0);
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
});
it("should multiply a vector (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const vec = new Vector3([1, 2, 3]);
const res = mat.mulVec(vec);
expect(res.get(0)).to.be.equal(14);
expect(res.get(1)).to.be.equal(32);
expect(res.get(2)).to.be.equal(50);
});
it("should multiply a vector (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const vec = new Vector3([1, 2, 3]);
mat.mulVec(vec, vec);
expect(vec.get(0)).to.be.equal(14);
expect(vec.get(1)).to.be.equal(32);
expect(vec.get(2)).to.be.equal(50);
});
it("should multiply mat3 (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const mat2 = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const res = mat.mulMat(mat2);
expect(res.get(0, 0)).to.be.equal(30);
expect(res.get(0, 1)).to.be.equal(36);
expect(res.get(0, 2)).to.be.equal(42);
expect(res.get(1, 0)).to.be.equal(66);
expect(res.get(1, 1)).to.be.equal(81);
expect(res.get(1, 2)).to.be.equal(96);
expect(res.get(2, 0)).to.be.equal(102);
expect(res.get(2, 1)).to.be.equal(126);
expect(res.get(2, 2)).to.be.equal(150);
});
it("should multiply mat3 (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const mat2 = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const res = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.mulMat(mat2, res);
expect(res.get(0, 0)).to.be.equal(30);
expect(res.get(0, 1)).to.be.equal(36);
expect(res.get(0, 2)).to.be.equal(42);
expect(res.get(1, 0)).to.be.equal(66);
expect(res.get(1, 1)).to.be.equal(81);
expect(res.get(1, 2)).to.be.equal(96);
expect(res.get(2, 0)).to.be.equal(102);
expect(res.get(2, 1)).to.be.equal(126);
expect(res.get(2, 2)).to.be.equal(150);
});
it("should calculate determinant", () => {
const mat = new Matrix3([19, 2, 3], [4, 5, 6], [7, 8, 9]);
const det = mat.det();
expect(det).to.be.equal(-54);
});
it("should transpose (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.transpose(mat);
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(4);
expect(mat.get(0, 2)).to.be.equal(7);
expect(mat.get(1, 0)).to.be.equal(2);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(8);
expect(mat.get(2, 0)).to.be.equal(3);
expect(mat.get(2, 1)).to.be.equal(6);
expect(mat.get(2, 2)).to.be.equal(9);
});
it("should transpose (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const tran = mat.transpose();
expect(tran.get(0, 0)).to.be.equal(1);
expect(tran.get(0, 1)).to.be.equal(4);
expect(tran.get(0, 2)).to.be.equal(7);
expect(tran.get(1, 0)).to.be.equal(2);
expect(tran.get(1, 1)).to.be.equal(5);
expect(tran.get(1, 2)).to.be.equal(8);
expect(tran.get(2, 0)).to.be.equal(3);
expect(tran.get(2, 1)).to.be.equal(6);
expect(tran.get(2, 2)).to.be.equal(9);
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
});
it("should find the adjoint (new)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const adj = mat.adj();
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
expect(adj.get(0, 0)).to.be.equal(-3);
expect(adj.get(0, 1)).to.be.equal(6);
expect(adj.get(0, 2)).to.be.equal(-3);
expect(adj.get(1, 0)).to.be.equal(6);
expect(adj.get(1, 1)).to.be.equal(-12);
expect(adj.get(1, 2)).to.be.equal(6);
expect(adj.get(2, 0)).to.be.equal(-3);
expect(adj.get(2, 1)).to.be.equal(6);
expect(adj.get(2, 2)).to.be.equal(-3);
});
it("should find the adjoint (reference)", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
const adj = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.adj(adj);
expect(adj.get(0, 0)).to.be.equal(-3);
expect(adj.get(0, 1)).to.be.equal(6);
expect(adj.get(0, 2)).to.be.equal(-3);
expect(adj.get(1, 0)).to.be.equal(6);
expect(adj.get(1, 1)).to.be.equal(-12);
expect(adj.get(1, 2)).to.be.equal(6);
expect(adj.get(2, 0)).to.be.equal(-3);
expect(adj.get(2, 1)).to.be.equal(6);
expect(adj.get(2, 2)).to.be.equal(-3);
});
it("should find the inverse (new)", () => {
const mat = new Matrix3([12, 2, 3], [4, 5, 6], [7, 8, 9]);
const inv = mat.inv();
expect(mat.get(0, 0)).to.be.equal(12);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
expect(inv.get(0, 0)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(0, 1)).to.be.closeTo(-2 / 11, 0.001);
expect(inv.get(0, 2)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(1, 0)).to.be.closeTo(-2 / 11, 0.001);
expect(inv.get(1, 1)).to.be.closeTo(-29 / 11, 0.001);
expect(inv.get(1, 2)).to.be.closeTo(20 / 11, 0.001);
expect(inv.get(2, 0)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(2, 1)).to.be.closeTo(82 / 33, 0.001);
expect(inv.get(2, 2)).to.be.closeTo(-52 / 33, 0.001);
});
it("should find the inverse (reference)", () => {
const mat = new Matrix3([12, 2, 3], [4, 5, 6], [7, 8, 9]);
const inv = new Matrix3([12, 2, 3], [4, 5, 6], [7, 8, 9]);
mat.inv(inv);
expect(mat.get(0, 0)).to.be.equal(12);
expect(mat.get(0, 1)).to.be.equal(2);
expect(mat.get(0, 2)).to.be.equal(3);
expect(mat.get(1, 0)).to.be.equal(4);
expect(mat.get(1, 1)).to.be.equal(5);
expect(mat.get(1, 2)).to.be.equal(6);
expect(mat.get(2, 0)).to.be.equal(7);
expect(mat.get(2, 1)).to.be.equal(8);
expect(mat.get(2, 2)).to.be.equal(9);
expect(inv.get(0, 0)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(0, 1)).to.be.closeTo(-2 / 11, 0.001);
expect(inv.get(0, 2)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(1, 0)).to.be.closeTo(-2 / 11, 0.001);
expect(inv.get(1, 1)).to.be.closeTo(-29 / 11, 0.001);
expect(inv.get(1, 2)).to.be.closeTo(20 / 11, 0.001);
expect(inv.get(2, 0)).to.be.closeTo(1 / 11, 0.001);
expect(inv.get(2, 1)).to.be.closeTo(82 / 33, 0.001);
expect(inv.get(2, 2)).to.be.closeTo(-52 / 33, 0.001);
});
it("should not find the inverse", () => {
const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]);
expect(mat.inv.bind(mat)).to.throw("Determinant is 0.");
});
it("should calculate the identity", () => {
const mat = Matrix3.IDENTITY();
expect(mat.get(0, 0)).to.be.equal(1);
expect(mat.get(0, 1)).to.be.equal(0);
expect(mat.get(0, 2)).to.be.equal(0);
expect(mat.get(1, 0)).to.be.equal(0);
expect(mat.get(1, 1)).to.be.equal(1);
expect(mat.get(1, 2)).to.be.equal(0);
expect(mat.get(2, 0)).to.be.equal(0);
expect(mat.get(2, 1)).to.be.equal(0);
expect(mat.get(2, 2)).to.be.equal(1);
});
it("should create a rotation (Axis / Angle)", () => {
const vec = new Vector3([0, 0, 1]);
const rot = Matrix3.rotateAxis(vec, Math.PI / 2);
const res = rot.mulVec(new Vector3([0, 2, 0]));
expect(res.get(0)).to.be.equal(-2);
expect(Math.round(res.get(1))).to.be.equal(0);
expect(res.get(2)).to.be.equal(0);
});
it("should create a rotation (Euler Angles)", () => {
const rot = Matrix3.rotate(Math.PI / 2, Math.PI / 2, Math.PI / 2);
const res = rot.mulVec(new Vector3([0, 0, 1]));
expect(Math.round(res.get(0))).to.be.equal(0);
expect(res.get(1)).to.be.equal(1);
expect(Math.round(res.get(2))).to.be.equal(0);
});
});
|
69c70beda325cbabcd9e988643946ec77df9879b
|
TypeScript
|
flode/Tarot
|
/src/datastructure/responses.ts
| 2.78125
| 3
|
import {IData} from '../interfaces/IData';
type Jeu = {
jeuId: number;
active: boolean;
joueurs: string[];
};
export type ServerResponse =
{ type: typeof ServerResponses.JEU; jeu: ResponseJeu | null; moi: number } |
{ type: typeof ServerResponses.JOUEUR_JOINT; joueurs: string[]|null; jeux: Jeu[]; chat_attendant: string } |
{ type: typeof ServerResponses.REJOINDU };
export interface ResponseJeu extends IData {
nomJoueurs: string[];
}
export class ServerResponses {
public static readonly JEU = 'jeu' as const;
public static readonly JOUEUR_JOINT = 'joueurJoint' as const;
public static readonly REJOINDU = 'rejoindu';
public static readonly makeJeu = (jeu: ResponseJeu | null, moi: number) => ({type: ServerResponses.JEU, jeu, moi});
public static readonly makeJoueurJoint = (joueurs: string[]|null, jeux: Jeu[], chatAttendant: string) => ({
type: ServerResponses.JOUEUR_JOINT,
chat_attendant: chatAttendant,
joueurs,
jeux,
});
public static readonly makeRejoindu = () => ({type: ServerResponses.REJOINDU});
}
|
1f28d7c05ddebc3b7b12cb224eff3faee31c390c
|
TypeScript
|
end5/CoCWebOld
|
/build/Game/Items/Consumables/PurePearl.ts
| 2.71875
| 3
|
import { Consumable } from './Consumable';
import { ConsumableName } from './ConsumableName';
import { DisplayText } from '../../../Engine/display/DisplayText';
import { Character } from '../../Character/Character';
import { PerkType } from '../../Effects/PerkType';
import { ItemDesc } from '../ItemDesc';
export class PurePearl extends Consumable {
public constructor() {
super(ConsumableName.PurePearl, new ItemDesc("P.Pearl", "a pure pearl"), 1000);
}
public use(character: Character) {
DisplayText().clear();
DisplayText("You cram the pearl in your mouth and swallow it like a giant pill with some difficulty. Surprisingly there is no discomfort, only a cool calming sensation that springs up from your core.");
character.stats.lib += -5;
character.stats.lust += -25;
character.stats.cor += -10;
if (!character.perks.has(PerkType.PurityBlessing))
character.perks.add(PerkType.PurityBlessing, 0, 0, 0, 0);
}
}
|
2ed82160b0353ace405ef984fbb6d6086da7efcd
|
TypeScript
|
artem6/board_games
|
/src/games/pearsToPears/cards.ts
| 3.0625
| 3
|
export const getGreenCard = () => {
return greenCards[Math.floor(Math.random() * greenCards.length)];
};
export const getRedCard = () => {
return redCards[Math.floor(Math.random() * redCards.length)];
};
export const getNewHand = () => {
const cards: string[] = [];
for (let i = 0; i < 5; i++) cards.push(getRedCard());
return cards;
};
const redCards = [
`A Bad Haircut - The perfect start to a bad hair day. `,
`A Bakery - Some bakers start work at 3:00 in the morning, so breads and donuts are fresh for breakfast. `,
`A Broken Leg - I was riding my bike when I hit this big rock . . . `,
`A Bull Fight - Also known as "la fiesta brava" (the brave festival). A whole lot of bull.. `,
// `A Cabin In The Woods - Henry David Thoreau went to Walden Pond for two years. All we're asking for is one lousy weekend! `,
`A Can Of Worms - Now you've opened it. `,
`A Car Crash - "Hey, it was an accident!" `,
`A Cheap Motel - No charge for the cockroaches. `,
`A Cookbook - The best ones include favorite family recipes. `,
`A Crawl Space - Where you'll find something the cat dragged in. `,
`A Crown - A crown is a symbol of royalty. `,
`A Desert - Hot, dry and sandy. `,
`A Dollar - Spend it wisely! `,
`A Dozen Red Roses - When eleven just won't do. `,
`A Fairy - A tiny creature who has magical powers and can fly, like Tinkerbell. `,
`A Few Good Men - Is that too much to ask? `,
`A Flat Tire - "Whaddya mean, there's no spare?" `,
`A Fool & His Money - Are soon parted... especially on Wall Street. `,
`A Forest - Home to Bambi, Winnie the Pooh, Robin Hood, and many woodland animals. `,
`A French Maid - Ooh, la, la! `,
`A Full Moon - "When the moon hits your eye like a big pizza pie, that's amore!" -Dean Martin `,
`A Funeral - A ceremony held to honor a person who has died. `,
`A Giant - A very large and powerful person. When Jack climbed the bean stalk, he met a hungry giant. `,
`A Haunted House - Maybe if people would STOP building their dream homes on ancient burial grounds ... `,
`A High School Bathroom - "Fools rush in where angels fear to tread" -Alexander Pope `,
`A Hole In One - Par for the course? `,
`A Honeymoon - America's top honeymoon spots are Hawaii, Niagara Falls, Las Vegas and Florida. You can get there by air, land, sea ... or shotgun. `,
`A King - King Arthur became famous when he pulled a magical sword from a stone. `,
`A Leaky Boat - Time to bail out. `,
`A Little White Lie - If you can't say anything nice . . . `,
`A Locker Room - Steamy atmosphere ... bawdy humor ... sweaty bodies ... HEY! Sounds like Cable TV! `,
`A Log Cabin - Just cut down a few trees and make a house. `,
`A Mermaid - An imaginary creature with the upper body of a woman and the tail of a fish. `,
`A Microwave Oven - You'll have popcorn in two minutes. `,
`A Million Dollars - If I had a million dollars. . . `,
`A Morgue - "Given strange eons, even death may die..." -H.P. Lovecraft `,
`A Movie Theater - When you want a REALLY big screen. `,
// `A Mummy - "Walk like an Egyptian." - The Bangles `,
`A Mummy - In Egypt there are mummies that are over 3,000 years old. `,
`A Nine Iron - A golf club best used on short shots or large opponents. `,
`A Parade - I love a parade. `,
`A Piano - A piano is a percussion instrument, like a drum or cymbal. `,
`A Pile Of Leaves - Rake them up and jump in! `,
`A Prince - Some are real, but most are just in fairy tales. `,
`A Princess - Some are real, but most are just in fairy tales. `,
`A Queen - A wicked queen tried to kill Snow White with a poison apple. `,
`A Refrigerator - First stop after school. `,
`A Ringing In My Ears - Answer that, would'ya? `,
`A Saw - A metal tool with sharp teeth used to cut metal and wood. Some are used as musical instruments. `,
`A School Bus - The only thing we have to fear is fear itself. -Franklin D. Roosevelt `,
`A School Cafeteria - Food fight!. `,
`A School Dance - No chicken dance or hokey-pokey! `,
`A Spare Tire - The good news is: we have a spare tire . . . `,
`A Submarine - It's a sandwich shaped like a boat.or a boat shaped like a sandwich. `,
`A Sunrise - "But he who kisses the joy as it flies/ Lives in eternity's sunrise." -William Blake `,
`A Sunset - The sun never set on the British Empire ... because God didn't trust the English in the dark. `,
`A Surprise - Something that is unexpected, like a present from a friend. `,
`A Swimming Pool - No diving in the shallow end. `,
`A Tree House - Your first high-rise apartment. `,
`A Used Car Lot - One of the most honest places around. Honest ... `,
`A Volcano - Hot lava! `,
// `Abbot & Costello - Comedy team who had everyone guessing - "Who's on first?" `,
// `Abraham Lincoln - 1809-65, 16th U.S. president, led the Union to victory in the American Civil War and abolished slavery. Was assassinated for his efforts. `,
`Abraham Lincoln - President of the U.S. during the Civil War. He was called "Honest Abe." `,
`Actors - If they're really good, you can't tell they're acting. `,
`Actresses - "Romeo, Romeo, wherefore art thou." Romeo and Juliet by William Shakespeare. `,
`Adam & Eve - A relationship of Biblical proportions. `,
`Adam Sandler - 1966- , American comedian, film star, and Saturday Night Live alumnus. Genius or goofball - you make the call. `,
`Adolf Hitler - 1889-1945, turned Germany into a militarized dictatorship, caused the slaughter of millions and launched World War II. `,
`Africa - The continent located between the Atlantic Ocean and Indian Ocean. `,
`AIDS - Acquired Immune Deficiency Syndrome. `,
`Airline Food - Since when is a bag of peanuts considered a meal? `,
// `Airplane - The Wright Brothers were "wright" when they added power to a glider in order to make it fly. `,
`Airplanes - I want to sit by the window! `,
`Al Pacino - 1940- , Oscar winning American actor and star of "The Godfather," "Dog Day Afternoon" and "Scent Of A Woman." One very intense guy. `,
`Aladdin - Folktale character who found a magic lamp with a gentle genie inside. `,
// `Alan Greenspan - 1926-, chairman of the U.S. Federal Reserve Board. `,
`Alaska - The 49th state. It's the home of Mount McKinley. `,
`Albert Einstein - 1879-1855, German-born American physicist and Nobel laureate who created theories of relativity. Nice hair. `,
`Alfred Hitchcock - 1899-1980, British-born American director and producer of brilliant psychological thrillers. Right, mother? MOTHER! `,
`Alien Abductions - There was a blinding light -and she was gone! `,
`Aliens - They're not from around here! `,
`Alligators - Large reptiles with strong jaws and long tails. Their skins are made into shoes and purses. `,
`AM & FM - Making waves in radio. `,
`Americans - How many Americans does it take to screw in a light bulb? THAT'S NOT FUNNY! WE'RE SUING! `,
`Amputations - "A SCRATCH? Your arm's off!" - Monty Python and the Holy Grail. `,
`Amsterdam - The capital of the Netherlands, and one of Europe's most beautiful and notorious cities. `,
`An Igloo - A domed-shaped house made from blocks of hard snow or ice. `,
`Ancient Rome - In ancient times, all roads led to Rome, and the traffic has only gotten worse. `,
`Andy Warhol - 1928-87, American painter and filmmaker, a leader of the pop art movement. Famous for slightly more than 15 minutes. `,
`Angry Hornets - Who put the bees in their bonnets?. `,
// `Anna & The King - The 1999 film romanticizing the story of Anna Leonowens and King Mongkut of Siam. `,
// `Anna Kournikova - 1981-, Russian-born star of the tennis court and internet. `,
`Anne Frank - 1929-45, German Jewish girl who wrote in her diary about her family hiding from the Nazis. She died in a concentration camp. `,
`Antarctica - Home to the lowest temperature ever recorded on earth, -126.9 F. `,
// `Anthony Hopkins - 1937- , British actor starred in The Elephant Man, Howard's End, and, of course, The Silence Of The Lambs. Knighted in 1992. `,
`Anthrax - A potentially deadly infectious disease caused by spore bacteria. Anthrax has been developed as a biological weapon. `,
`Antiques Roadshow - PBS television program where folks bring oddities for appraisal. One person's trash is another one's treasure. `,
// `Antony & Cleopatra - Roman general and Egyptian queen. A love affair that wouldn't die. Oh, wait, it did. `,
`Ants - Some are black and some are red. I don't want them in my bed! `,
`Apple Juice - Baby's first juice. `,
`Apple Pie - It's as American as ... as ... something ... `,
`Pears - More than 40 million metric tons are produced worldwide every year. How 'bout them pears? `,
// `Pears - Johnny Pearseed traveled across the United States planting seeds for apple trees. `,
`Pears & Oranges - Don't even TRY to compare them. `,
`Aristotle - 384-322 B.C., ancient Greek philosopher. His writings formed the foundation for much of today's philosophical and political thought. `,
`Arm & A Leg - Sure, they were free, but just try replacing them. `,
`Armadillo - Burrowing mammal with armor-like bony plat covering. Roadkill extraordinaire. `,
`Armed Robbery - You got your Robbery, your Armed Robbery, your Strong Armed Robbery, and, of course, the five finger discount. `,
`Arnold Schwarzenegger - 1947-, Austrian born body-builder turned actor. "My body is like breakfast, lunch, and dinner. I don't think about it, I just have it." `,
`Aroma Therapy - Alternative medicine. Something's smelly about it. `,
`Arsenic & Old Lace - The hilarious dark comedy written by Joseph Kesselring, or the 1944 film adaptation by Frank Capra. `,
`Artists - So creative! `,
`Assault & Battery - That would be a single "A" battery. `,
`Assembly Lines - Faster. FASTER! `,
`Astronauts - It's a great day for a space walk! `,
`At My Parent's House - Like never-never land, you're never seen as an adult here. `,
`Atlantis - Mythological city where the folks had that sinking feeling. `,
`Atomic Bombs - The Italian physicist Enrico Fermi succeeded in producing the first nuclear chain reaction in 1942, at the University of Chicago. `,
`Attack On Pearl Harbor - "Yesterday, December 7th, 1941, a date which will live in infamy ..." -Franklin D. Roosevelt `,
// `Austin Powers - Fictional British man of mystery. Yeah, bay-beee, yeah! `,
`Australian Outback - Beware of dangerous temperatures, strange animals, and didgeridoos. `,
// `Babe Ruth - 1895-1948, American baseball legend, and one heck of a candy bar! `,
`Babies - Little bundles of joy ... and who needs sleep, anyway? `,
`Babies - Very young children or infants. They cry a lot! `,
`Baby Dolls - Some of them talk, some of them walk, and some even wet their pants! `,
`Baby Food - Strained peas and mushy meat. Doesn't that sound good? `,
`Baby Showers - Baby showers may bring flowers ... `,
`Babysitters - The good ones let you stay up late. `,
`Backstreet Boys - The latest American pop boy band. Which one do you think is the cutest? `,
`Backyards - Your playground at home! `,
`Bacon - Meat from a pig, flavored with salt and smoke. Oink! `,
`Bad Dogs - Bad dog, bad dog. What'cha gonna do? `,
`Bad Dreams - Like good dreams, but with monsters. `,
// `Bagels And Lox - A perfect snack for salmon-chanted evening ... `,
`Bagpipes - A shrill-toned musical instrument consisting of a leather bag and pipes. Also available in plaid. `,
`Baked Beans - Add a little bacon, brown sugar and Beano! `,
`Baked Potatoes - Hot potato, couch potato, potato head, twice baked, half-baked, ... whatever. `,
`Baking Cookies - An experience only surpassed by eating them. `,
// `Baking Cookies - Mix up the dough and put them in the oven. `,
// `Bald Eagles - Known for their majestic appearance and powerful flight. In 1782, the bald eagle was chosen as the emblem of the United States. `,
`Bald Eagles - They're not really bald. The white feathers on their heads make them look that way. `,
`Ball & Chain - Don't let it get you down. `,
`Ballerinas - Beautiful, graceful dancers who are always on their toes. `,
// `Ballerinas - It takes years of training before a ballerina can dance in toe shoes. `,
`Balloons - Lots of colors, shapes, and sizes. `,
`Ballroom Dancing - Fox-trots, tangos, cha-chas, and more! Are you ready to rumba? `,
`Bananas - Monkeys like them a bunch! `,
`Band-Aids - Available in lots of colors and shapes. A fun way to cover cuts and scrapes. `,
`Bangkok - Capital of Thailand. Location: near the Gulf of Siam. Population: five million. Reputation: seedy. `,
`Bankruptcy - It'll be the debt of you. `,
// `Barbara Walters - 1931- , American television journalist and author. Voted one of the most important women of the century by "Ladies Home Journal." `,
`Barbed Wire - Wire with sharp points, used for fences. Created havoc on the western frontier. `,
`Barbershops - It's a beauty shop for guys. `,
`Barbie & Ken - Ah, to be blond and plastic... `,
`Barbie Dolls - Tall, thin, fashion dolls with lots of clothes and tiny feet. `,
`Barfing - We didn't want to bring that up ... `,
// `Barney - Purple dinosaur. "I love you, you love me, blah, blah, blah ... " `,
`Barney - A large, purple dinosaur. "I love you, you love me." `,
`Bart Simpson - Fictional animated character. Don't have a cow, man!" `,
// `Baseball - Its one, two, three strikes you're out . . . `,
// `Baseball Games - "One, two, three strikes, YOU'RE OUT!" `,
// `Baseball Fields - It's 90 feet from home plate to first base. But it seems longer when you're trying to reach it! `,
// `Basketball - Some basketball players are over seven feet tall. `,
// `Bates Motel - The haunt of Alfred Hitchcock's psycho, Norman Bates ... and mother, of course ... `,
// `Batman - How does Batman's mother call him home? "Dinner, dinner, dinner, dinner, dinner, dinner, dinner, dinner - BATMAN!" `,
`Batman - A superhero who wears a black mask and cape. He drives the Batmobile. `,
`Batman & Robin - Superheroes or vigilantes, you make the call. `,
// `Bats - The little brown bat consumes as many as 600 mosquitoes in an hour. The vampire bat dines elsewhere ... `,
`Bats - Either furry little animals that fly, or sticks used to hit baseballs. `,
`Bats & Balls - At least they don't go on strike. `,
`BB Guns - You'll shoot your eye out!" `,
`Beach Balls - Blow them up and watch them blow away! `,
`Beach Parties - Up for some "Beach Blanket Bingo," Annette? `,
`Beanbag Chairs - For beanbag butts . . . `,
`Beanie Babies - Tiny plush collectible to love and cherish. Don't take that tag off! `,
// `Beanie Babies - Little bean bag creatures that can be played with or collected. `,
`Bears - Large, shaggy animals with sharp claws and little tails. Sometimes they are named Teddy. `,
// `Beauty & The Beast - A French fairy tale, animated by Disney in 1991. `,
`Beauty And The Beast - A tale as old as time ... so Disney didn't have to pay royalties. `,
// `Beavis & Butt-Head - He said "butt." Huh-huh. Huh-huh. `,
`Bed & Breakfast - Not the same as breakfast in bed. `,
`Bee Stings - Leave the bees alone- and they'll leave you alone. `,
`Beef Stew - Meat, potatoes, carrots, onions... `,
`Beer - "Beer is proof that God loves us and wants us to be happy." - Benjamin Franklin `,
`Beer & Pretzels - "these pretzels are making me thirsty" - Cosmo Kramer, Seinfeld `,
`Beer Bellies - Just think of them as microbreweries. `,
`Beethoven - 1770-1827, German composer, considered one of the greatest of the western world. `,
// `Beets - Beats Brussels sprout. `,
`Beets - Round purplish-red vegetables. Do you like beets? `,
// `Being & Nothingness - Jean Paul Satre's 1943 work based on the distinction between things that exist by themselves and those that exist for themselves. `,
`Being In Love - "Love's like the measles, all the worse when it comes late." -Douglas Jerrold `,
`Bell-Bottoms - Bell-bottoms and pea coats -who would have thought the Navy could be such a trendsetter? `,
`Bells & Whistles - It's got everything! `,
`Belt Buckles - Cowboys like them fancy and pilgrims like them plain. `,
// `Ben Stiller - 1965-, American actor, director, and funny guy of Reality Bites, There's Something About Mary, and Meet The Parents `,
`Berlin - 1945 - Adolph Hitler's last stand. Bunker ... I mean -hunker down, soldier. `,
`Bert & Ernie - Sesame Street's muppet buddies. `,
// `Bert And Ernie - Two nice guys in striped shirts who live on Sesame Street. `,
`Bigfoot - Legendary North American monster, a.k.a. Sasquatch or the Abominable Snowman. `,
`Big Bang Theory - A cosmological theory for the origin of the universe. An explosive idea! `,
// `Big Bird - Beloved Sesame Street character, or the not-necessarily-beloved U.S. spy satellite. `,
`Big Bird - A very large, yellow bird who lives on Sesame Street with Bert and Ernie. `,
`Big Cities - Very large towns, like New York, Los Angeles and Chicago. `,
`Big Dogs - An adult Saint Bernard weighs over 170 pounds. `,
`Big Macs - T w o a l l b e e f p a t t i e s s p e c i a l s a u c e l e t t u c e c h e e s e p i c k l e s o n i o n s o n a s e s a m e s e e d b u n . `,
// `Bill & Ted - Characters in Keanu Reeves' excellent time-travel adventure film. Yeah, dude. `,
`Bill Clinton - 1946- , popular, yet embattled, 42nd president of the United States. `,
`Bill Gates - 1955-, chairman and chief software architect of Microsoft Corporation. A very rich guy. `,
// `Bill Murray - 1950-, American actor and comedian. Star of Ghostbusters, Stripes, Groundhog Day, and Lost In Translation. `,
`Billboards - Only 1,254 miles to Wall Drug ... `,
// `Billy Crystal - 1947-, American comedian, actor and director. He looks maaaaah-velous. `,
// `Bingo - "There was a farmer, had a dog, and Bingo was his name-o ..." `,
`Bingo - Get five in a row. BINGO! `,
`Bird Watching - A hobby that relies on a wing and a prayer. `,
`Birds - "Birds of a feather, flock together." `,
`Birthday Cake - What kind of cake, white or chocolate? `,
// `Black Cats - It's bad luck if they cross your path. You might step in a hairball! `,
`Black Cats - They're not really bad luck! `,
`Black Holes - The gravitational field of a black hole is so strong that nothing, including light, can escape from its vicinity. `,
`Black Licorice - Alexander the Great and Julius Caesar both endorsed the beneficial properties of Licorice. No word on black jelly beans . . . `,
`Black Lingerie - Victoria's REAL secret: selling skimpy negligees at hefty price . . . `,
`Black Velvet - Smooth, silky and sophisticated ... until you paint an Elvis on it. `,
`Blackouts - They can occur at any `,
`Blizzard - Extreme cold, strong winds, and a head snowfall. Also known as Canada. `,
// `Blood - A healthy human body contains between five and six quarts of blood. Bloody right they do! `,
`Blood - Blood carries oxygen and nutrients throughout the body. `,
`Blood & Tears - Don't forget the sweat. `,
`Blowing Bubbles - The bigger the better! `,
`Blowing Your Nose - Please use a tissue! `,
// `Blue Velvet - An elegant, textured fabric, Bobby Vinton love song, or David Lynch's bizarre 1986 film about the dark side of small-town America. `,
`Blueberries - Blueberries will stain your teeth. Smile! `,
`Board Games - Games have been played for thousands of years. Some games of Monopoly just SEEM that long. `,
`Boardwalk & Park Place - Top of the line in the real estate game. `,
`Boats - "Row, row, row your boat!" `,
`Body & Soul - Just tryin' to keep it all together. `,
`Body Odor - Over $1.6 billion is spent each year on antiperspirants in the United States. That stinks! `,
`Body Piercing - YOU STUCK WHAT? WHERE? `,
// `Body Snatchers - We'd be worried, but nobody would want to snatch OUR bodies . . . `,
`Body Surfing - When you're too cheap to buy a surfboard. `,
`Bodybuilders - If you build it they will come. `,
`Bonbons - Sweets for the sweet ... `,
`Bongos - Small drums played with the fingers. Used in Latin American and African music. The choice of American beat poets. `,
// `Bonnie & Clyde - American outlaws of the 1920s, played by Faye Dunaway and Warren Beatty in the 1967 film. `,
`Bora Bora - Volcanic island in the Pacific. Good oranges and vanilla. `,
`Bottled Water - How much are you willing to pay for something you can get for free? `,
`Bow & Arrows - More effective than sticks and stones. `,
`Bowling - Three strikes and you're in. `,
`Bowling - A game played by rolling a heavy ball so that it knocks down wooden pins. A perfect score is 300. `,
`Boxing - An ancient and honorable sport - not just for boys anymore ... `,
// `Boy Scouts - International organization for boys and young men founded in England in 1908, to foster character, citizenship and outdoor life. `,
`Boy Scouts - On my honor, I will do my best... and learn to camp. `,
// `Boyfriends - "My boyfriend's back and you're gonna be in trouble." - The Angels `,
`Boyfriends - We're just friends! `,
`Boys - "Snips and snails and puppy dog tails." `,
`Braces - No more gum, no caramels, no corn on the cob. `,
`Brad Pitt - 1963- , American actor and heart-throb. `,
`Brain Surgeons - Hey, it ain't brain surgery ... oh ... wait a second ... `,
// `Brains - Vital to human existence and mad scientists. `,
`Brains - It's all in your head. `,
`Bread & Water - Make that a baguette and a bottle of Perrier. `,
`Breaking & Entering - "Honest, Officer, I lost my keys." `,
`Bride & Groom - "With this ring..." `,
// `Britney Spears - 1981-, American singer. From mouseketeer to international pop star. `,
`Broadway - The New York theater district. "They say the neon lights shine bright on Broadway." -Barry Mann `,
// `Brooks & Dunn - Extremely successful country & honky-tonk music duo. "If they don't dance, you're dead." - Ronnie Dunn `,
`Brothers - Oh, brother! `,
`Brothers & Sisters - "You can pick your friends, but..." `,
// `Bruce Willis - 1955- , Diehard American action movie star who has moonlighted on TV. He also starred in Pulp Fiction, Armageddon and The Sixth Sense. `,
`Bruises - The dark color of a bruise is caused by broken blood vessels under the skin. `,
`Brushing Your Teeth - Oh! What's that gunk stuck on your teeth? `,
`Bubble Bath - Just add water! `,
`Bubble Gum - Crack it, snap it, pop it, and blow it! `,
// `Bubble Gum - Chewing is easy, blowing bubbles is hard, getting it out of your hair is even harder. `,
`Bubbles - "Tiny bubbles, in the wine/ Tiny bubble make me feel fine ..." -Don Ho `,
`Buddies - Good friends - people and pets. `,
`Buffalo - A large animal with a big, shaggy head and a hump on its back, native to North America. `,
`Bugs - Ants, beetles, spiders, and roaches. It's "A Bug's Life." `,
`Bugs Bunny - A tall, skinny cartoon rabbit. "What's up, Doc?" `,
`Bulls & Bears - On or off Wall Street. `,
`Bullfighting - A traditional sport in some Spanish speaking countries. `,
// `Bullwinkle - As in the cartoon "The Adventures of Rocky and Bullwinkle" - the moose half of moose and squirrel. `,
`Bumble Bees - Large, fuzzy bees with yellow and black stripes. Watch out - they sting! `,
`Bumper Cars - Much like rush hour in Chicago. `,
`Bumper Stickers - Your personal billboard! `,
`Bungee Jumping - Another sport hanging on by a thread. `,
`Bunk Beds - Two single beds, one on top of the other. I want the top! `,
`Burger & Fries - You want flies with that?" `,
`Burned Toast - Want some burned bacon with that? `,
`Bus Drivers - Don't bother the bus driver. `,
`Butter - What's better than butter? `,
`Buttons & Bows - Cute as a button, or a bow. `,
`Butterflies - Butterflies flutter by. `,
`Buying A House - If only we had the money, we could get a mortgage. `,
`Buzz Lightyear - The animated star of Toy Story. "To infinity and beyond!" `,
`Cabbage - From the French word caboche, meaning "big head." `,
`Cactus - Require little care and exhibit bizarre forms. As such, they are often mistaken for Survivalists. `,
`California - Sacramento is its capital, Los Angeles its largest city. Here we come. `,
// `Calvin & Hobbs - Bill Waterson's late, great comic strip featuring a little boy and his tiger. `,
// `Camelot - "On second though, let's not go to Camelot. 'Tis a silly place." - King Arthur, Monty Python and the Holy Grail `,
`Camels - One hump or two? `,
`Cameras - "And this is a picture from our summer vacation..." `,
`Campfire - S'mores and songs. Gather 'round! `,
`Camping - Shhh! Did you hear that noise? `,
`Camping Trip - When you just have to get s'more nature. `,
// `Canada - Federated country of North America. The Great White North - eh? `,
`Canada - Largest country in North America. Canada is located north of the U.S. `,
`Canadians - How many Canadians does it take to screw in a lightbulb? Fifteen. Fourteen to chip it out of the ice, and one to screw it in. `,
`Candles - How many candles are on your birthday cake? `,
`Candy - Lollipops, jelly beans, chocolates, and lots more. All the good stuff! `,
`Candy Corn - It may be corn but it's not a vegetable. `,
`Canoes - Light, narrow boats. Don't stand up! `,
`Captain Kirk - Fictional starship captain. "Beam me up Scotty, there is no intelligent life on this planet!" - bumper sticker, 1980s `,
`Car Bombs - Not including the Ford Pinto, of course. `,
`Car Crash - Always wear your seatbelt. `,
`Car Horns - Blow it, buddy! `,
`Card Games - "Pears to Pears" might be fun! `,
// `Carl Sagan - 1934-96, American astronomer and pioneer exobiologist. Touched many lives. Billions and billions of them. `,
// `Carlos Santana - 1947-, guitar legend and member of the Rock and Roll Hall of Fame. Truly Supernatural. `,
`Carnival Workers - Step right up ... `,
`Carpenters - Hammering and sawing- it's just wood work. `,
`Carrot & Sticks - The ultimate motivator... for a donkey. `,
`Carrots - Bugs Bunny's favorite food. `,
// `Cary Grant - 1904-86, British-born American actor known for his debonair manner. He can be found North by Northwest. `,
`Casablanca - The largest city in Morocco, and one heck of a good movie. "Of all the gin joints in all the towns in all the world..." `,
`Casinos - Slots and slots of fun. `,
`Castles - Kings, queens, knights in shining armor, and little square hamburgers. `,
`Castles - Some have towers, dungeons and moats. `,
`Cat & Mouse - It's just a game. `,
`Catfish - Fish with feelers that look like whiskers. `,
// `Catherine Zeta-Jones - 1969-, Welsh born actor, famous for her stunning good looks, as seen in The Mask Of Zorro, Entrapment and Traffic. `,
`Cats & Dogs - Is it raining? `,
`Ketchup - Ketchup is made from tomatoes, onions, sugar, and spices. `,
`Ketchup & Mustard - The salsa revolution brought down their condiment empire. `,
`Cattle Ranch - Home on the range. `,
`Cavities - But I did brush my teeth! `,
`Cauliflower - Goes down easy when it's cheesy. `,
`Caves - Stalactites, stalagmites. Which go up and which go down? `,
// `Caves - Dark and cool, and sometimes home to bats. `,
`Caviar - It's not JUST fish eggs. It's . . . fish eggs . . . that cost a fortune . . . `,
`CD Players - Your portable, personal stereo system. `,
// `Celine Dion - 1968-, Canadian singer whose heart will go on, and on ... `,
`Cell Phones - Get off the phone or get off the road! `,
// `Cell Phones - Call home if you're going to be late. `,
// `Cesar Chavez - 1927-93, American labor leader who led the 1965 nationwide boycott of California grapes ... a bunch of sour grapes! `,
`Chain Letters - Send this game to ten of your friends and good luck will follow. Honest! `,
`Chain Link Fences - Good fences make good neighbors. `,
`Chains - Gold or iron: name your shackles. `,
// `Challenger Explosion - "Without a wish, without a will/ I stood upon that silent hill/ and stared into the sky ..." - Ralph Hodgeson `,
`Chameleons - The chameleon is a lizard that changes color when frightened -or is that a politician? `,
`Charging Rhinos - How do you stop a rhino from charging? Take away its credit cards. `,
`Charles & Diana - A right royal marriage. `,
`Charlie Brown - "Peanuts" cartoon character, friend of Linus and Lucy. `,
`Charlotte's Web - Award-winning book by E.B. White featuring Charlotte the spider, and a pig named Wilbur. `,
// `Chat Rooms - Electronic speakeasies for the information age. `,
`Cheerleaders - "Go, Team, Go!" `,
`Cheese - Swiss cheese, American cheese, cottage cheese. Say cheese! `,
`Cheese Sandwich - Two pieces of bread and a slice of cheese. Grill it, if you want. `,
`Cheesecake - A really tasty dish. `,
// `Cher - 1946- , American singer and actor, she makes aging look good. `,
`Cherries - And a cherry on top! `,
`Cherry Pie - A flaky pastry filled with cherries. `,
`Chewing Your Fingernails - Hungry? `,
`Chicken Nuggets - Bite-sized pieces of fried chicken. Finger food! `,
`Chicago - Third largest city in the United States. Our kind of town. `,
`Chicken Pox - Infectious disease usually contracted in childhood. Just don't scratch 'em! `,
// `Chicken Pox - An illness that comes with a fever and itchy red bumps. Don't scratch! `,
`Chickens - From incubator to rotisserie in 56 days! Run, chicken, run! `,
`Chickens - Hens and roosters. Cluck-cluck, cock-a-doodle-do! `,
`Chimpanzees - Sure, they're related to us; but they don't write, and they NEVER call! `,
// `China - The most populous country in the world. More than one-fifth of the world's total population lives within its borders. `,
`China - There are over one billion people living in the People's Republic of China. `,
`Chinatown - International travel, just around the corner. `,
`Chips & Dip - No double dipping! `,
`Chips & Salsa - Nacho average snack! `,
`Chocolate Milk - Good for you and tastes good too! `,
`Choir Boys - They sound angelic, but ... `,
`Chopsticks - A pair of small, slender sticks used for eating. Just try eating peas. `,
`Chorus Girls - Long legs and high kicks! `,
`Christmas - December 25th, a Christian holiday that is celebrated around the world. `,
`Churches - "Here is the church, and here is the steeple..." `,
`Chutes & Ladders - A game of ups and downs. `,
`Cigarette Burns - Another reason to give up smoking. `,
`Cigarettes - Mind if I smoke? `,
`Cinco de Mayo - Marks the victory of the Mexican Army over the French at the Battle of Puebla, in 1862. `,
`Cinderella - A storybook character who is helped by her fairy godmother. Bibbidi-bobbidi-boo! `,
// `Cindy Crawford - 1966- , American Supermodel. What dreams are made of. `,
// `Circus Peanuts - Chewy, orange marshmallow things shaped like peanuts. Seldom found at the circus. `,
// `Clark Gable - 1901-60, American film actor, noted as a romantic lead. Frankly, my dear, he didn't give a damn. `,
`Claude Monet - 1840-1926, French painter, regarded as one of the leaders on the impressionist movement. `,
`Clay - The oven where pottery is hardened is called a kiln. `,
`Cleaning The Bathroom - It's YOUR turn! `,
`Cleaning Your Room - It's no fun, but you have to do it. `,
`Cleopatra - c. 69-30 BC, Queen of Egypt, noted for love affairs with Julius Caesar and Mark Antony, which came back to bite her in the asp. `,
`Cleveland - "Cleveland rocks! Cleveland rocks!" - The Drew Carey Show `,
`Climbing A Ladder - Don't look down! `,
`Climbing A Tree - Don't go out on a limb! `,
// `Clint Eastwood - 1930-, American film actor and director, past mayor of Carmel, California. Has earned fistfuls of dollars. `,
`Cloned Sheep - Dolly good show! `,
`Clouds - I see an elephant! And that one looks like a rabbit. `,
`Clowns - They would be really funny if they weren't so darn scary. `,
// `Clowns - They often dress in silly outfits and paint their faces! `,
`Cocaine - Alkaloid obtained from leaves of the coca plant and used as a local anesthetic and abused as a drug. `,
`Cockles & Mussels - "Alive--alive-o!" I think I just lost my appetite. `,
`Cockroaches - Annoying insects that can survive a nuclear war. Fortunately, they can't survive the heel of your shoe. `,
`Coconuts - "Put the lime in the coconut, and drank them both up." -Harry Nillson `,
`Coffee - Two-thirds of the world's coffee beans are grown in Central and Southern America. `,
`Cold Pizza - The breakfast of champions. `,
// `Colin Powell - 1937-, U.S. Secretary of State and Chairman of the Join Chiefs of Staff during the Gulf War. We'd give him four stars. `,
`Collection Shells - She sells seashells by the seashore. `,
`Comic Books - THIS looks like a job for . . . somebody who draws Superman! `,
`Communists - "From each, according to their ability, to each according to their need." I need a new Ferrari. `,
`Commuting - The daily grind. And we're not talking coffee. `,
`Computer Hackers - We didn't mean to shut down the entire government ... `,
// `Computers - British mathematician Charles Babbage worked out the principles of the modern digital computer in the late 1800s. `,
`Computers - Great for games, homework, and e-mail. `,
`Confucius - c. 551-479 BC, K'ung Fu-Tzu, Chinese philosopher and one of the most influential figures in Chinese history. `,
`Conspiracy Theories - Oh, that was just a coincidence! `,
`Construction Workers - Hard hats -hard bodies. `,
`Convenience Stores - "Thank you come again." `,
`Cookies - Chocolate chip, oatmeal, sugar or peanut butter. `,
`Cooking Dinner - What's for dinner? `,
`Cops & Robbers - When fighting crime was just child's play. `,
`Coral Reef - Composed of the skeletons of marine organisms. Home to lots of tropical fish. `,
`Corn Fields - Knee high by the Fourth of July. `,
`Corn Flakes - Eat them fast or they'll get soggy. `,
// `Corn On The Cob - A grain native to the Americas, corn was a staple food for many centuries before corn holders were invented. `,
`Corn On The Cob - It's a summertime treat that gets stuck in your teeth. `,
`Corned Beef & Cabbage - It's not chopped liver. `,
`Corrugated Cardboard - When you want to think out of the box . . . `,
`Corvettes - In 1953, Chevrolet introduced the Corverre, the first mass-produced sports car with a fiberglass body. The perfect cure for a midlife crisis. `,
`Cottage Cheese - If it's so popular, where are all the Cottage Cheeseheads? `,
`Cotton Candy - Looks like cotton; tastes like candy. `,
`Coughing & Sneezing - And no cure in sight. `,
`Count Dracula - "I vant to suck your blood!" `,
`Country Music - Encompassing styles such as western swing, honky-tonk, bluegrass and rockabilly. Should mention a pickup truck and a dog named "Bo." `,
// `Cow-Pies - When dried, these "cow chips" are hurled discus-like over great distances. It's true. `,
// `Cowboys - Head 'em up and move 'em out! `,
`Cowboys - Men who take care of cattle on a ranch. `,
`Cowboys & Indians - How the west was won... and lost. `,
`Cows - Large farm animals raised for milk. Moo. `,
`Crabs - As crustaceans, crabs are related to lobster and shrimp. What do they all have in common? They all go well with butter. `,
// `Crash & Burn - Try, try again. `,
// `Crazy Horse - 1849?-77, chief of the Oglala Sioux. A leader in the Native American resistance to the westward expansion on the United States. `,
`Cream & Sugar - Do you want some coffee with that? `,
`Creamed Corn - Eat it, it's good for you. `,
`Crime & Punishment - Fyodor Dostoevsky's 1917 classic novel following the tormented life of the murderer Rodion Romanovich Roskolnikov. `,
`Crying - "Don't cry over spilled milk." `,
`Crystal Balls - I see a Green Apple card in your future. `,
`Cuba - Island republic in the Caribbean, just south of Florida. Beans and rice never tasted so good. `,
`Cults - They seemed nice ... `,
`Cup & Saucer - Tea Time! `,
`Cupcakes - Small cakes, the size of a cup. `,
`Curds & Whey - What? It's just cottage cheese? `,
// `Currier & Ives - The lithography shop operated from 1834 to 1907 and produced over 7500 titles, all of which could have been called "Life In America." `,
`Custer's Last Stand - 1866, Little Big Horn. Very big mistake. `,
`Cut & Curl - You'll look mah-velous! `,
`Cutting The Grass - Why cut it? It just grows back. `,
`D-Day, 1944 - On June 6, 1944 the Allied forces invaded France, employing over 10,000 airplanes, 5,000 ships, and 250,000 servicemen. `,
// `Dallas & Fort Worth - The heart & soul of Texas. `,
`Dance Class - Step, turn, hop, hop, kick... `,
`Dancing - Moving your feet and body in time with music. Cha-cha-cha. `,
`Dandruff - Dry skin on your scalp? Sounds a bit flaky. `,
// `Danielle Steel - 1947- , Prolific romance novelist. "Suddenly, Stephanie spotted Lance on the beach ..." `,
// `Danny DeVito - 1944- , American television, motion-picture actor, and director. Star of Taxi, Romancing The Stone, Twins, and Get Shorty. `,
`Dark Alleys - Don't go there! `,
// `Dark Alleys - I thought you brought the good flashlight! `,
`Darth Vader - "Luke ... (wheeze) .. I am ... (wheeze) ... your father ... and you don't write, you don't call ... NOTHING." `,
`Dating - First stage of the human mating ritual. `,
`David & Goliath - Bible story featuring the future king David and the Philistine giant Goliath. The bigger they come, the harder they fall. `,
// `David Letterman - 1947- , American television entertainer and talk-show host. And ... the Number One reason to watch him (drum roll, please): TOP TEN LISTS! `,
`Day Care Centers - Preschool for preschool. `,
`Daytime TV - Soap operas, game shows, talk shows and reruns ... is this a great country or what? `,
`Dead Fish - Floating in the water, washed up on shore, or at a fish market. `,
`Death & Dying - The only way out. `,
`Death & Taxes - The two certainties in life. `,
`Death Valley - Arid, desolate and hellish region of California. Named by a survivor of an attempted 1849 crossing. `,
`Deer Hunting - Nooo! Nooooo! Not BAMBI'S MOTHER! `,
// `Demi Moore - 1962-, American actor in St. Elmo's Fire, Ghost and GI Jane. `,
`Democrats - Their symbol is the donkey, or ass. Insert your own joke here. `,
// `Dennis Rodman - 1961- , American professional basketball player and full-time human oddity. `,
// `Denzel Washington - 1954- , American actor known for his powerful roles in such movies as Cry Freedom, Malcolm X, and Mississippi Masala. `,
`Detroit - The Motor City is the world's foremost automobile manufacturing center, and the tenth largest city in the U.S. `,
`Diamonds - The hard fact: they are just highly refractive crystalline allotropes. `,
`Dictionaries - Let me look that up! `,
`Dinner & A Movie - And a mortgage to pay for it. `,
`Dinosaurs - Reptiles that lived millions of years ago. Some, like the T. rex, were huge! `,
`Dirt - Good in the garden. `,
`Dirty Diapers - It must be time to change the baby! `,
`Dirty Dishes - That's why they make paper plates! `,
`Dirty Socks - Put them in the wash! `,
`Discos - Where you go to catch "Saturday Night Fever." `,
`Discovering America - 1492, Christopher Columbus discovered that America was discovered centuries before he arrived. `,
// `Disneyland - You've just won the "Pears to Pears(R) Grand Masters Tournament." Where're you gonna go? `,
`Disneyland - A theme park featuring cartoon characters like Mickey Mouse and Donald Duck.. `,
`Divorce - It's a trial separation that goes to trial. `,
// `Doctors - Over twenty years of education and they're still "practicing" medicine? `,
`Doctors - Stick out your tongue and say aaaaah! `,
`Doctors & Dentists - For a long life and healthy teeth. `,
`Dollars & Cents - "If it don't make dollars, it don't make sense." - DJ Quik `,
`Dodo Birds - A large, flightless bird of the island of Mauritius. Discovered by Europeans in 1598, extinct by 1681. `,
`Dog Days - 101 degrees in the shade. `,
`Dog Food - I like the chewy kind. `,
`Doing The Dishes - You wash, I'll watch. `,
// `Doing The Dishes - I'll wash the dishes and you can dry. `,
`Doing The Hokey-Pokey - That's what it's all about. `,
// `Dolly Parton - 1967- , American singer, songwriter, and actor. Known as much for her personal style as for her successful career. `,
`Dolphins - Dolphins are mammals that live in the sea, and Sea World. `,
`Donuts - In 1993, a doughnut weighing over 3,700 pounds was made in Utica, N.Y. `,
`Doorbells - Would someone please answer the door? `,
`Double Thick Malts - For a double thick ice cream headache. `,
`Dr. Evil - Arch-nemesis of Austin Powers. Riiiiiiight. `,
`Dr. Jekyll & Mr. Hyde - Robert Louis Stevenson's 1887 novel revealing the hypocrisy and innate evilness in society. The idea came to him in a dream - a bad dream. `,
// `Dr. Kevorkin - 1928- , Controversial advocate of doctor-assisted suicide. `,
// `Dr. Laura - 1947-, American conservative talk show host and promoter of family values. HER family values, that is . . . `,
`Dr. Seuss - 1904-1991, Theodor Suess Geisel , the cat who came up with "The Cat in the Hat." `,
`Dragons - Pretend animals that look like giant lizards with wings. Sometimes they breath fire! `,
// `Drew Barrymore - 1975-, heir to the Barrymore acting dynasty. Drew starred in ET, The Wedding Singer, Charlie's Angels, and countless tabloid stories. `,
// `Drew Carey - 1958-, American comedian and television star. Whose line is it anyway? His. `,
`Drinking & Driving - Friends don't let friends drive drunk. `,
`Driving A Car - In most states, you have to be 16 years old to drive a car. `,
`Driving Off A Cliff - It was either that or hire someone to do my takes. `,
`Drums - Beat it! `,
`Drunk Drivers - Number one highway safety problem. `,
`Ducks - Large birds with webbed feet and a flat bill. Quack-quack-quack! `,
`Duct Tape - All-purpose, ... all the time ... `,
`Dumb Blonde Jokes - Are they just naturally funny? `,
`Dumbo - A little elephant cartoon character. When he flaps his ears, he can fly! `,
`Dump Trucks - Large trucks that carry dirt, sand, and rocks. `,
`Dungeons & Dragons - Popular role-playing game featuring swords, sorcery and wizards. Repeat after me: it's a game... it's only a game... `,
// `Dustin Hoffman - 1937-, highly regarded actor of The Graduate, Midnight Cowboy, and Rainman. He's an excellent driver! `,
`E-Mail - You've got JUNK mail! `,
`Ear Wax - A waxy, yellowish substance that protects the ear from dust, bacteria, and from hearing things you don't want to hear. `,
`Early Morning - "The early bird gets the worm!" `,
`Ears - What? `,
`Earthquakes - The Richter scale is named after the American seismologist Charles Richter. Did the earth move for you? `,
`Earwigs - Nocturnal insects with abdominal pincers. Nothing to do with ears or wigs. `,
`East Coast - From New England to Florida. They're not like folks 'round here ... `,
`Eating Breakfast - It's always breakfast time at a truck stop. `,
`Ebony & Ivory - "Ebony and Ivory live together in perfect harmony." - Paul McCartney `,
// `Eddie Murphy - 1961-, American comedian, actor, and producer. Best known for his work in 48 Hours, Beverly Hills Cop and on Saturday Night Live. `,
`Egg Rolls - Crunchy rolls filled with vegetables and meat. Available at Chinese restaurants. `,
`Eggplant - Without it there would be no Eggplant Parmesan. `,
`Eggs - Birds, fish, snakes and insects all lay eggs. `,
`Eleanor Roosevelt - 1884-1962, first lady, social activist, author, lecturer, and U.S. representative to the United Nations. `,
`Electric Eels - Slippery and slimy snakelike fishes that emit electrical charges. The shocking truth! `,
`Electricity - The repulsive or attractive force between two stationary bodies. No problem unless one of those bodies is yours. `,
// `Elephants - The largest living land mammal, with two species: Indian and African. Not counting Dumbo, there are no American elephants. `,
`Elephants - Huge gray animals with large ears and trunks. Some elephants have tusks. `,
`Elevators - The 110-story Sears Tower in Chicago has 104 elevators. `,
// `Elizabeth Taylor - 1932- , American actor, noted for her lush beauty, emotional performances and multiple husbands. `,
`Elmo - A little, red, fuzzy guy from Sesame Street. Tickle me! `,
`Elvis Presley - 1935-77, American singer and actor and the king of rock-and-roll. His death left the music world all shook up. `,
`Emergency Rooms - Brings new meaning to he word "heartthrob." `,
// `Emily Dickinson - 1830-86, American poet, whose lyrics are psychologically astute treatments of love, death, and immortality. So there. `,
`Erasers - Because everybody makes mistakes. `,
`Ernest Hemingway - 1899-1961, American novelist and short-story writer, whose macho style is crisp, laconic and understated. `,
`Europe - The Old Country ... except to people who live there. `,
`Exorcism - To ceremoniously expel an evil spirit. `,
`Exterminators - Bugs, rats and vermin. It's time for chemical warfare. `,
`Eyes - Light-sensitive organ of vision in animals. See? `,
`Eyes - Flies have five eyes. `,
`Face Paint - You can be a clown, a pirate, a cat, or whatever you want. `,
`Factories - Oompa-Loompa! Willy Wonka and the Chocolate Factory! `,
// `Fairies - Tiny, mischievous, mythical beings with magic powers. They live in Fairyland. Really. `,
`Fairies - Tiny storybook characters with wings and magic powers. `,
// `Faith Hill - 1967-, American crossover country music artist. You just gotta have Faith. `,
`Falling Down - "What we call failure is not the falling down, but the staying down." -Mary Pickford `,
`Fame & Fortune - Everybody may have 15 minutes of fame, but fortune is another thing altogether. `,
`Family Reunions - Just to remind you why you moved away in the first place ... `,
`Family Vacations - Dad? Dad? Are we there yet? Are we there yet? Are we? Huh? Dad? `,
`Family Values - Often said but seldom understood. `,
`Farmers - There's a farmer in the dell. `,
`Farms - A place where animals and crops are raised for food. "Old McDonald had a farm." `,
`Fast Food - You want fries with that? `,
`Fat - I can't believe I ate the whooooooole thing. `,
`Fear & Loathing - In Las Vegas, or anywhere else. `,
`Feathers - Which weighs more, a pound of feathers or a pound of rocks? `,
// `Feathers - Feathers protect a bird's skin, keep them warm, and help them fly. `,
`Feminists - Political and social activists who support selected women's causes. `,
// `Ferdinand & Isabella - Late 15th century king and queen of Spain. They backed Christopher Columbus and benefitted royally. `,
`Fertilizer - Viagra for the garden. `,
`Festering Wounds - Quit picking at that! `,
`Fidel Castro - 1927-, Cuban revolutionary and Communist dictator since 1976. He earned a PhD in law in 1950. `,
// `Field & Stream - The hunter's best friend. `,
`Finger Painting - Just paint with your fingers. No brush needed! `,
`Fire - Don't get burned! `,
// `Firefighters - Emperor Augustus instituted a corps of fire-fighting "watchmen" in 24 B.C. Nero, on the other hand, fiddled while Rome burned. `,
`Firefighters - Their job is to put out fires. They also get to drive fire engines. `,
`Firestorms - Some severe wildfires require more than 10,000 firefighters. And, wouldn't ya know it, some idiot parked in front of the hydrant! `,
// `Fireworks - Includes firecrackers, Roman candles, and bottle rockets. It's all fun until someone loses an eye ... and a nose ... and an arm ... `,
`Fireworks - Bright, explosive displays often used for the 4th of July. Bang-Boom-Pop-Pop! Ohhh-Ahhh! `,
`First Man On The Moon - July 20, 1969. "That's one small step for a man, one giant leap for mankind." -Neil A. Armstrong `,
`Fish & Chips - Just wrap it in any old newspaper. `,
`Fishing - The perfect way to spend a summer day. Maybe you'll catch a big one! `,
`Flags - There are fifty stars and thirteen stripes on the flag of the United States of America. `,
// `Flannel Shirts - Pick your plaid. `,
`Flash Floods - Too late for sandbags! `,
`Flashlights - Good for camping and reading under the covers. `,
`Flies - A group of insects with wings. They enjoy picnics. `,
`Flip-Flops - It's the sound they make when you walk. `,
// `Flipper - American television dolphin of the 1960's ... like Lassie, only wetter. `,
`Floods - Heavy rains and melting snow can cause floods. `,
// `Florence Nightengale - 1820-1910, English nurse and health-care reformer. We've been singing her praises for years. `,
`Flour - Flour is made by grinding wheat and other grains. `,
`Flower Gardens - No weeds allowed. `,
`Flowers & Candy - When "I'm sorry" is not enough. `,
`Fly Fishing - ... if you can"t catch flies any OTHER way ... `,
`Flying A Kite - Don't let go of the string! `,
`Flying Monkeys - The reason why "The Wizard Of Oz" still gives us nightmares. `,
`Folk Music - When you're just fiddling around . . . `,
`Food & Shelter - Gotta have it. `,
`Food Poisoning - This chicken tastes kinda funny . . . `,
`Foot & Mouth - An infectious disease of animals with hooves. Not the same as foot-IN-mouth disease which affects everybody at one time or another. `,
// `Football - It's a ball AND a game. `,
// `Football Players - Punt, pass, and kick! `,
`Forest Fires - "Only YOU can prevent forest fires." The heat is on! `,
// `Forest Fires - Lightning can start forest fires. `,
`Forever & Ever - "Oh baby, I'm gonna love you forever / Forever and ever amen." - Randy Travis `,
// `Fort Knox - American military post in Kentucky, containing the greater part of the gold reserve of the U.S. government. `,
`Fortune Cookies - "You will soon eat a flat, dry, tasteless cookie . . ." `,
`Fortune Teller - "My crystal ball says ..." `,
// `Fourth Of July - "Independence Day" in the United States. "Thank Goodness We Got Rid of Them Day" in Britain. `,
`Fourth Of July - The United States Independence Day. Lots of picnics and fireworks! `,
`Frank Lloyd Wright - 1867-1959, pioneering American architect. Considered one of the greatest designers of the 20th century. `,
`Frank Sinatra - 1915-98, the greatest American pop singer of his generation, award winning film and television actor. Do-be do-be do, baby. `,
// `Freaks & Geeks - The 1999 television show, or those outside the social norm. `,
// `Freckles - No matter what they tell you, freckles won't grow together to form a great-looking tan. `,
`Freckles - The more the merrier! `,
// `Fred & Ginger - Fred Astair & Ginger Rogers - tap dancing their way into the hearts of millions. `,
// `Fred & Wilma - Meet the Flintstones. "Yabba-dabba-doooo!" `,
// `Fred Flintstone - Yaba-daba-dooooo! `,
`Freedom - Express yourself! `,
`French Fries - In Europe, French fries are usually eaten with a fork. `,
`French Wines - The perfect complement to an overpriced meal. `,
`Fresh Water Pearls - String them along ... `,
`Friction - Resistance to the motion of a body in contact with another body ... any body will do. `,
`Friends & Family - There when you need them. `,
`Frisbees - The frisbee was introduced to the market in 1948. Take one for a spin. `,
`Frog & Toad - Characters in a series of children's books by Arnold Lobel, or any of the millions of frogs and toads who choose not to wear clothes. `,
`Frogs - Some frogs can jump 20 feet. `,
`Frosty The Snowman - This snowman has a corncob pipe and a button nose. `,
`Frozen Peas - Right under the frozen pizza. `,
`Fund Raising - Hello ... my name is Jonathan, would you like to buy some fruit, magazines, candy bars, wreaths, pizzas ... ? `,
`Funerals - "He who dies with the most toys is, nonetheless, still dead." - Anonymous `,
// `Fur - The characteristic covering of mammals and people with money. `,
`Fur - The soft, hairy covering on the skin of some animals. `,
// `Fuzz - Lint ... Policemen ... Whatever ... `,
`Gall Bladder - Where excess bile is stored. Stored for what, we don't know. `,
`Gang Members - "When you're a Jet, you're a Jet all the way..." -West Side Story `,
`Garages - Little houses for cars. `,
`Garbage Cans - A restaurant for raccoons. `,
`Gardening - Get in touch with your roots. `,
// `Garrison Keillor - 1942- , American author and radio star. He shares the Midwest perspective with 2.6 million listeners each week on A Prairie Home Companion. `,
// `Garth Brooks - 1962- , American country music singer and songwriter. He's got friends in low places. `,
`Gas Stations - How far to the next gas station? `,
`Geishas - Japanese women training in traditional singing, dancing, and entertaining. Of course, you would never recognize them without all that make-up. `,
`Gen. George S. Patton - 1885-1945, the commander of the American Third Army during World War II. -a.k.a. Olf Blood and Guts `,
`Genetic Engineering - What DO you get when you cross a monkey with a potato? `,
// `George & Jane, His Wife - The Jetsons television show first aired in 1962. In spite of our best efforts, cars still can't fly. `,
`Ghosts & Goblins - "I see dead people." - Cole Sear, The Sixth Sense `,
`George W. Bush - 1946- , 43rd president of the United States. The second time ever that the son of a former president was elected to the office. `,
// `George Washington - 1732-99, First President of the United States. He chopped down a cherry tree to make false teeth, or something like that ... `,
`George Washington - First president of the United States. `,
// `Georgia O'Keeffe - 1887-1986, American abstract painter known for her still life compositions. Her skull paintings prove that beauty is more than skin deep. `,
`Getting A Haircut - It will always grow back. `,
`Getting A Hug - Hmmmm ... nice. `,
`Getting A Shot - It's better than getting sick! `,
`Getting Head Lice - Tiny insects that live on the human scalp. Millions of children get head lice each year. `,
`Getting Lost - Now, where did they go? `,
`Getting Mail - Letters, cards, magazines and packages. Is there anything for me? `,
`Getting Sick - Oh, I don't feel very good. `,
`Getting Stitches - Now they can sew you up or glue you back together. `,
`Getting The Flu - Stay home, drink juice and watch TV. `,
`Gettysburg, 1863 - The turning point of the American Civil War, a bit more than four score and seven years ago. `,
`Ghost Towns - Population unknown. `,
// `Ghosts - Nonmaterial embodiments or the essence of organisms (mostly human beings). Quite spirited `,
`Ghosts - A pale, shadowy form, and a favorite Halloween costume. `,
// `GI Joe - He's an "action figure," not a "doll." `,
`Giant Squid - Going fishing for giant squid? Nautilus I have to ... `,
// `Gila Monsters - The largest, and only poisonous lizard found in the United States. `,
// `Gilligan's Island - Who would have thought that you could make a radio out of coconuts. `,
`Ginger & Mary Ann - "Here on Gilligan's Isle." `,
// `Gingko Trees - An Asiatic tree, Gingko biloba, known for its fan shaped leaves. We can't remember what it's good for. `,
`Ginseng - Common name for plants of the ginseng family, source of a stimulant and a supposed aphrodisiac. `,
`Giraffes - Giraffes can grow to 18 feet tall and have been known to kill a lion with a single kick. Not just another pretty face. `,
// `Girl Scouts - I'll take six boxes of Thin Mints and three of the ... you know, the kind with the peanut butter. `,
`Girl Scouts - I will do my best to be honest and fair, friendly and helpful... and sell lots of cookies. `,
// `Girlfriends - Girlfriend - let's talk! `,
`Girlfriends - We're just friends! `,
`Girls - "Sugar and spice and everything nice." `,
`Giving A Hug - "One may give without loving; but none can love without giving." -Anonymous `,
`Glaciers - It'll be a cold day when we see THEM again ... `,
`Glass - Glass is made by melting sand with potash or other chemicals. `,
`Glazed Donuts - If you're going to be late, take a box of donuts. `,
`Global Warming - Is it hot in here, or is it just me? `,
`Globes - The world at your fingertips. `,
`Glue - Very sticky stuff! `,
`Go Karts - Go kart, go! `,
`Goats - Goats have short horns and beards. They'll eat anything. `,
`Going On A Cruise - Iceberg, dead ahead! `,
`Going On A Safari - Don't feed the lions! `,
`Going On Vacation - Pack your bags! `,
`Going To A Movie - Get some popcorn and watch the show. `,
`Going To Church - Weddings, funerals, bazaars, and bingo! `,
`Going To Grandma's - "Grandmother, what big teeth you have!" -Little Red Riding Hood `,
// `Going To School - Secondary education? It's elementary. `,
`Going To School - The easiest way to get an education. `,
`Going To The Dentist - This won't hurt a bit ... `,
// `Going To The Dentist - Have you brushed your teeth today? `,
`Going To The Gym - No pain, no gain. `,
`Gold - Rare yellow metal used to make coins and jewelry. `,
`Gold & Silver - There's a good reason Fort Knox is full of golg and not silver. `,
`Gold Chains - The more, the better. `,
`Goldfish - The pet, the carnival prize, or the snack cracker. `,
// `Goldfish - Little orange fish that you can keep as pets. `,
// `Goldie Hawn - 1945- , American actor and producer. Famous for playing ditzy blondes -really well! `,
`Golf-Ball-Sized Hail - ... which is almost as impressive as hail-sized golf balls ... `,
`Good & Plenty - The licorice candy was first produced in 1893, making it the oldest branded candy in the United States. `,
// `Goose & The Gander - If it's good for the goose... `,
`Gorillas - Large, strong members of the monkey family. Gorillas come from Africa. `,
`Gossip - Petty, backbiting rumor-mongering. See also: journalism. `,
`Gourmet Coffee Shops - I'll have a tall, double cappuccino, wet, with vanilla, half decaf, - to walk. `,
// `Grace Kelly - 1929-82, Princess of Monaco and American film star of Dial M for Murder, Rear Window, and To Catch a Thief. Always chic, always elegant. `,
`Graffiti - Art in a can. We"re drawn to it. `,
`Grape Jelly - It's perfect for peanut butter and jelly sandwiches. `,
`Grapefruit - Not a grape, but it is a fruit. `,
`Grapes - Small round fruit that grows in bunches, usually purple, red or green. They make good snacks! `,
`Grass Skirts - Hula loves you, baby? `,
`Grassy Hill - Good for rolling down, flying kites, and playing games. `,
`Grave Robbers - Famous for their bodies of work. `,
`Gravity - In 1684, the law of gravitation was formulated by English physicist Sir Isaac Newton, who recognized the gravity of the situation. `,
`Gravy - Sauce made from meat juices. Got to have it on mashed potatoes. `,
`Grease - Pretty slick! `,
`Grease & Grime - What would Martha do? `,
`Green Beans - Long, thin beans that you can eat raw or cooked. `,
`Greenpeace - International organization dedicated to preserving the Earth's natural resources, and its diverse plant and animal life. `,
`Grocery Stores - Good places to buy food, supplies and candy! `,
`Guitars - ROCK AND ROLL! `,
`Gummi Bears - Little rubbery candies shaped like bears. `,
`Gym Teachers - "I am a Physical Education Teacher. Call me a gym teacher again and you can drop and give me ten!" `,
`Gymnastics - Tucks, vaults and handsprings- it's harder than it looks. `,
`Haiku - Traditional form of Japanese poetry consisting of three lines, usually containing a reference to nature. `,
`Hair Transplants - Oh, it looks so natural ... `,
`Hairballs - Cough it up, kitty ... `,
// `Halloween - October 31, the eve of All Saints' Day, celebrated with costumes, treats, and scary stuff. Not just for kids any more! `,
`Halloween - The October 31st celebration featuring costumes, treats, and other spooky stuff. `,
`Ham Sandwhich - Ham is pork. Pork is pig. It's a pig sandwich! `,
`Hamburgers - Do you want fries with that? `,
`Hammer & Nails - "If I had a hammer..." - Peter, Paul and Mary `,
`Hammer & Sickle - An emblem of the Communist movement, now retired... as is the Soviet Union. `,
`Hammerhead Sharks - The name for these sharks comes from the unusual shape of their heads. `,
`Hammers - "I'd rather be a hammer than a nail." `,
`Hamsters - These little rodents store food in their cheeks. `,
`Hand Grenades - Close only counts in horseshoes and hand grenades! `,
`Handcuffs - "You have the right to remain silent..." `,
`Handguns - Source of a never-ending controversy as to how to get them out of the hands of the bad guys and into the hands of the good guys. `,
`Hang Gliding - Trust us. It's a breeze. `,
`Hangnails - We've fingered the cause of the pain. `,
`Hansel & Gretel - One of Grimm's grimmer fairy tales. `,
`Hanukkah - An eight day long Jewish celebration that usually occurs in December. `,
`Hard Boiled Eggs - Well, I'll be deviled . . . `,
// `Harrison Ford - 1942-, Iconic American actor. "Hokey religions and ancient weapons are no match for a blaster at your side, kid." `,
`Harry Potter - The hero in a series of books by J.K. Rowling featuring muggles and wizards. `,
// `Harry Potter - The hero in a series of books by J.K. Rowling featuring wizards and muggles. `,
`Harvard & Yale - "What? Like it's hard?" - Reese Witherspoon, Legally Blond `,
`Haunted House - If there's a ghost- it's haunted! `,
`Having A Baby - "Rock-a-bye baby, on the tree top ..." Who would put a kid on a tree top? `,
`Having A Party - Invitations, snacks, games, music... it's a party! `,
`Having An Operation - What a cutup! A real stitch. `,
`Hawaii - The eight islands that make up America's 50th state entered the Union on August 21, 1959. `,
`Hawks & Doves - The big birds of war and peace. `,
`Head Lice - Head lice suck blood from the scalp and spread like crazy. A REAL parasite. `,
`Heart & Soul - They're yours. All yours! `,
`Heaven & Hell - The ups and down of the afterlife. `,
`Helen Keller - 1880-1968, American author and lecturer who overcame deafness and blindness with the help of her companion, Anne Sullivan. `,
`Helicopters - The spinning blades keep the helicopter in the air- somehow. `,
`Herb Gardens - Rosemary, Basil, Chive . . . is it a herb garden or the cast from a British drama? `,
`Here & There - And everywhere. `,
`Hiccups - How do you, hic, get em? How do you, hic, get rid of "em? `,
`Hiding Places - It's a secret. `,
`High Heels - No running. `,
`High School - Most students start high school when they are fourteen. `,
// `High School Football - The whole ten yards! `,
`High School Reunions - See also: "root canal, as fun as ..." `,
`Hiking In The Woods - It's an adventure. `,
`Hillary Rodham Clinton - 1947- , New York Senator, lawyer, and former American First Lady. `,
`Hills & Valleys - Nature's little ups and down. `,
`Hip Hop - Musical and cultural movement that gained popularity in the 1980s. Yo, yo, yo. `,
`Hippopotamus - Hippos are also called "river horses" and only eat plants. `,
`Hiroshima - 1945 - "I am become death, the destroyer of worlds" - J. Robert Oppenheimer, on the detonation of the first atmoic bomb. `,
`Hit & Run - An automobile crash, or a baseball play. `,
// `Hitting A Home-Run - Going... going... CRASH... through the neighbor's window! `,
`HMOs - Heath Maintenance Organizations. Here's to your health ... `,
// `Hockey - Did you hear about the big fight last night? All of a sudden, a hockey game broke out! `,
`Hockey - Skate! Pass! Score! `,
`Hollywood - Motion picture and television industry center of the world. Hooray for Hollywood! `,
// `Hollywood & Vine - The Los Angeles street corner where dreams come true. `,
`Homeless Shelters - In the United States, nearly three-quarters of the help for the homeless comes from the private sector, mostly from church soup kitchens. `,
`Homework - Something to do during comercials. `,
`Homer Simpson - Fictional cartoon character created by Matt Groening. D'oh! `,
`Homework - Finally, something to do during commercials. `,
`Honey - A sweet, thick, gold liquid made by bees. `,
// `Hook & Ladder Trucks - One big reason to become a firefighter. `,
// `Hooligans - "Hey! Kids! Get outta my yard!" `,
// `Hootie & The Blowfish - One of the most commercially successful pop bands to emerge in the 1990s. I go blind when I think about them. `,
`Hopscotch - All you need is a sidewalk, chalk, and a rock. `,
`Horse & Cart - Get the order right! `,
`Horseback Riding - WHOAAA!!! `,
`Horses - Black Beauty, the Black Stallion, and Flicka are famous horses in literature. `,
`Hospital Gowns - Open all hours. `,
`Hospitals - The ambulance is the fastest way to get there. `,
`Hot Chocolate - A good drink on a cold day. Just add marshmallows! `,
`Hot Lava - There's no better way to serve it. `,
`Hot Tubs - Of course it's hot- it's a hot tub! `,
`Hot Wheels Cars - Small, metal cars to play with and collect. They can go over 300 miles per hour downhill! `,
`Hotdogs - A sausage served at ballgames and cookouts. They are NOT made from dogs! `,
`Hotels & Motels - Get a room! `,
`House & Home - And money pit. `,
`House Guests - How many visitors does it take to drive you crazy? Go on -take a guest! `,
// `Howard Stern - 1954-, American shock disc jockey. His autobiography is titled Private Parts. If only they WERE private. `,
`Hugs - There are bear hugs, Grandma hugs, friend hugs, and love hugs. `,
`Hummingbirds - Why do hummingbirds hum? Because they don't know the words ... ... da-dum, dum! `,
// `Humphrey Bogart - 1899-1957, American film actor, starred in such classics as The Maltese Falcon and Casablanca. "Here's looking at you kid." `,
`Hunters - Wolves, hawks, owls, and people all hunt for food. `,
`Husbands & Wives - For richer... hopefully. `,
`Ice - Good for drinks in the summer and skating in the winter. `,
`Ice & Snow - "We come from the land of the ice and snow/ From the midnight sun where the hot springs blow." - Led Zeppelin `,
`Ice Cream - "I scream, you scream, we all scream, for ice cream!" `,
`Ice Skating - You can do fancy turns, have a race, go backwards, or just glide. `,
`Icebergs - May reach 300 to 500 feet above the oceans's surface. Ask the captain of the Titanic about the 90 percent that's UNDER water. `,
`In A Coma - A deep, prolonged state of unconsciousness ... sometimes you just feel that way. `,
`In The Attic - Old clothes, old toys, old furniture, and more old stuff. `,
`In The Basement - You never know what you will find down there. `,
`In The Doghouse - All told, I'd rather be in the cathouse. `,
`Incense - Incense is better than no sense at all. `,
`Inchworm - An inchworm is actually a small, hairless caterpillar. `,
`India - The world's seventh largest country by area, but the second most populous, with one billion people. `,
`Indiana Jones - Fictional archeologist and action hero. Proof that a good hat and a whip can take you a long way. `,
`Industrial Revolution - The first Industrial Revolution occurred in Great Britain at the end of the 1700s. The second came with the invention of the "Clapper." `,
`Infomercials - One of these days, one of them may even say something informative. `,
`Inside The Sun - Consisting mostly of hydrogen, the temperature reaches almost 16,000,000 K (about 29,000,000 F). `,
`Intellectuals - They think they're so smart. `,
`Ireland - Island of the British Isles, west of Great Britain. Known for its distinctive traditional dance and music. `,
`Irrational Fears - What's that sound? `,
`Israel - Located on the Mediterranean, the state of Israel was reated by a 1948 U.N. mandate. `,
`Italy - European Republic, shaped like a boot - a very fashionable boot. `,
`Itchy Clothes - Rough, prickly, scratchy - they're awful! `,
// `Jack Nicholson - 1937- , American motion-picture actor of "Chinatown," "Terms Of Endearment" and "The Shining." He's as good as it gets! `,
`Jack The Ripper - Accused of murdering six women in 1888, and suspected in other murders. Still at large. `,
`Jackie Chan - 1954-, actor, director, martial artist. Screen name, Sing Lung, means "Becoming the Dragon." That's "MISTER Becoming the Dragon" to you! `,
// `Jacques Cousteau - 1910-97, French naval officer, marine explorer, and author. Best known as a documentary filmmaker. `,
`Jail - A place for keeping people who have broken the law. `,
`Jamaica - Third largest island of the Greater Antilles, south of Cuba. Tropical climate, reggae music, and jerk cooking. `,
`James Bond - Fictional British secret agent created by English author Ian Fleming. Shaken, but never stirred. `,
// `James Dean - 1931-55, American actor of film, stage, and television. His role in Rebel Without a Cause helped define "cool." `,
`Japan - An Asian constitutional monarchy. The capital city is Tokyo. Let's see ... sushi, Godzilla, earthquakes ... `,
`Japanese - How many Japanese does it take to screw in a light bulb? Who needs light bulbs when you've got OUR new technology! `,
`Jell-O - A solid, clear treat in lots of fruit flavors. It wiggles and jiggles! `,
`Jelly Beans - Well, as long as we HAVE to eat our vegetables ... `,
// `Jelly Beans - Jelly beans are now available in 50 different flavors! `,
// `Jenna & Barbara - President Bush's daughters, the "First Twins." `,
// `Jennifer Lopez - 1970-, American singer and actor of Selena, Money Train, and Maid In Manhattan. `,
// `Jerry Springer - 1944- , controversial talk-show host. Don't those people know that millions of us are watching? `,
// `Jesse Jackson - 1941-, American civil rights leader. Named to "The Gallup List of Ten Most Respected by Americans" for ten years. `,
// `Jesse Ventura - 1951-, wrestler, Navy Seal, and former governor of Minnesota. Author of I Ain't Got Time To Bleed. `,
// `Jim Carrey - 1962- , Canadian comedian and actor. Famous for outrageous faces, and dumb and dumber characters. `,
// `Jimmy Stewart - 1908-97, America's favorite self-image. Mr. Smith Goes to Washington, Rear Window, Vertigo, and It's a Wonderful Life, ... and it probably was. `,
// `Joan Of Arc - 1412-31, patron saint of France who decisively turned the tide of the Hundred Years' War, which really burned her up. `,
// `Jodie Foster - 1962- , American actor began her career on Mayberry, R.F.D. and went on to win Academy Awards for The Accused and Silence Of The Lambs. `,
`John F. Kennedy - 1917-63, 35th president of the US. "Ask not what your country can do for you; ask what you can do for your country." `,
// `John Glenn - 1921- , The first U.S. astronaut to orbit the earth in 1962, and a U.S. Senator. Never too old to shoot for the moon! `,
// `John Philip Sousa - 1854-1932, American bandmaster and composer of Stars and Stripes Forever. Known as "The March King." `,
// `John Travolta - 1954 - , American actor of "Welcome Back, Kotter," "Grease," "Saturday Night Fever" and "Pulp Fiction." That man can dance! `,
// `John Wayne - 1907-79, legendary American actor, "The Duke" starred in such classics as Stagecoach, The Sands of Iwo Jima and True Grit. `,
// `Johnny Depp - 1963-, American actor and heart-throb. From Cry-Baby to The Man Who Cried - he's as smooth as Chocolat. `,
`Jonah & The Whale - The greatest fish story ever told, in the Bible, that is. `,
// `Judge Judy - Ms. Sheindlin presides over real-life cases on this TV courtroom show. "I'm the boss, pearsauce!" `,
`Juggling - Start with two and see how you do. `,
// `Julia Roberts - 1967-, American actor and Pretty Woman. Also starred in Steel Magnolias, My Best Friend's Wedding, and Erin Brockovich. `,
`Jumping Rope - Twirl the rope and jump! `,
`Junk Mail - Contests, credit card applications, solicitations and political ads. `,
`Junkyard Dogs - Not as mean as bad, bad Leroy Brown. `,
`Jupiter - Story Problem: If one year on Jupiter equals 11.86 Earth years, and one day equals 9.92 Earth hours, how many Earth hours are there in a Jupiter year? `,
`Jurassic Park - 1993 film based on Michael Chrichton's book about dinosaurs brought back to life, with Oscar-winning visual effects. `,
`Kangaroos - Large animals from Australia that hop. Mother kangaroos carry their babies in pouches. `,
// `Katherine Hepburn - 1909-2003, American actor and winner of four Academy Awards. She starred in such classics as The African Queen. `,
// `Keanu Reeves - 1964- , American actor of Bill And Ted's Excellent Adventure, The Matrix and Speed. Keanu means "cool breeze over the mountains." `,
`Kickball - You'll get a kick out of it! `,
`Killer Whales - Black and white predatory whales. Boy, can they sing! `,
`Kilts - If Mel Gibson can wear one, so can you. `,
`Kindergarten - "A, B, C, D, E, F, G... Won't you sing along with me?" `,
`King Arthur - Legendary British king best known for Camelot and round tables. `,
`King Henry VIII - 1491-1547, King of England, and founder of the Church of England. Six wives, no waiting. `,
`King Tut - Boy king who ruled Egypt from 1333 to 1323 B.C., known for the great wealth of objects found in his tomb. He took it with him. `,
`Kiss & Tell - Best to keep your mouth shut. `,
`Kisses - Chocolate kisses are the best! `,
`Kittens - Baby cats, usually playful and fuzzy. Meow. `,
`Knife & Fork - Knife on the right, fork on the left. `,
`Knitting Needles - Knit one, pearl two . . . `,
`Knock-Knock Jokes - Who's there? `,
`Labor Unions - Look for the Union label. And, while you're at it, look for Jimmy Hoffa ... `,
`Lady & The Tramp - The 1955 Disney animated film featuring dogs, love and spaghetti. `,
`Ladybugs - Small, round red or orange beetles with black spots. They can fly! `,
// `Lance Armstrong - 1971-, American cyclist, cancer survivor and winner of the Tour De France - brought new meaning to the phrase "Going Postal." `,
// `Large Mouth Bass - Oh, please, let it not sing ... `,
`Las Vegas - The first casino opened in Las Vegas in 1946. Las Vegas ... or it that Lost Wages?" `,
// `Lassie - A famous collie, Lassie starred in her own TV show. What's that you say Lassie? Little Timmy's fallen down the well? `,
`Last Night - About last night . . . `,
`Last Will & Testament - It may be your only chance to get the last work on anything. `,
// `Laurel & Hardy - Classic fat-skinny comedy duo of the 1920s. `,
// `Laverne & Shirley - The 1970s sitcom phenomenon that defined Milwaukee for the world. And Milwaukee's still trying to live it down! `,
`Law & Order - The television show, or the concept. `,
`Lawyers - We'd throw some joke in here, but we're afraid of getting sued. `,
`Leaf Blowers - Toro, Toro, Toro! `,
`Learning Spanish - Who knows, maybe you'll need it someday. `,
`Learning To Ski - Put on the ski boots, then the skis, then get up to the top of the hill... `,
`Leather - Animal hide. Leather you like it or not. `,
`Leather & Lace - It's a texture thing. `,
`Leeches - Any mention of lawyers, agents, or reporters would be FAR too easy ... `,
`Legos - Get more blocks! We're building the Golden Gate Bridge. `,
`Legs - People have them, animals have them, even tables have them. `,
`Lemon & Lime - Pucker up. `,
`Lemon Meringue Pie - Tart, sweet and smooth. `,
`Lemonade - Needs more sugar! `,
`Lemons - When life gives you lemons, make lemonade ... or, in the case of a car, take it back. There's a law, you know! `,
`Lemons - Sour yellow fruit. Add sugar and water and you can make lemonade! `,
`Lenin's Tomb - We'd love to visit Lenin's Tomb, but it's probably just another communist plot. `,
`Leonardo Da Vinci - 1452-1519, Florentine artist, sculptor, architect, engineer, scientist, and all-around smartypants. `,
`Lethal Injection - It's a killer. `,
`Lewis & Clark - The early 1800s expedition covered over 8000 miles and confirmed that the Louisiana Purchase was a very good deal. `,
`Liberty & Justice - For all. `,
`Life Jackets - It won't work if you don't wear it! `,
`Lifeguard - A person whose job it is to help and protect swimmers. `,
// `Lightning - Electrical discharge between rain clouds, or between a rain cloud and the earth, or between a rain cloud and an idiot with a kite. `,
`Lightning - An electrical flash of light in the sky, usually during a rainstorm. `,
`Linguine With Clam Sauce - Pass the parmesan . . . `,
`Lions - King of the jungle. Roar! `,
`Lions & Tigers - And bears... `,
`Liposuction - Fatty tissue? That sucks . . . `,
`Listening To Music - Nobody's home... play it loud! `,
`Little Brown Mice - EEEK! `,
`Liver And Onions - An acquired taste. `,
`Lizards - The Komodo dragon is the largest living lizard. They can grow to over ten feet long. `,
`Llamas - South American animal related to the camel, raised for wool, and used as pack animals. `,
`Loan Sharks - As dangerous as "Jaws", but without the charisma. `,
`Lobster - Crustaceans closely related to freshwater crayfishes. Market price. `,
`Lobsters - Their large claws are actually their front pair of legs. `,
`Local Police - They know who you are and they know where you live. `,
`Loch Ness Monster - "Nessie," the legendary beast of Loch Ness, Scotland. It must be real, they have pictures. `,
// `Lock & Key - Quit picking on me! `,
// `Lock & Load - It's off to war we go. `,
`Log Cabins - Among the many Americans born in log cabins were Preisdents Harrison, Lincoln, and Grant. Just pass the maple syrup. `,
`Lollipops - Sucker! `,
`London - Founded even before the Romans reached England's shores, now the capital of Great Britain. `,
`Long Hair - Braid it, tie it in a ponytail, or just let it fly in the wind. `,
`Looking For A Job - Will work for fool ... `,
`Looney Tunes - Warner Brothers cartoons featuring Porky Pig and Bugs Bunny. `,
`Los Angeles - LA LA Land. `,
`Losing Your Backpack - "I know I had it on the bus..." `,
`Losing Your Job - They just didn't understand me! `,
`Love & Marriage - First comes love, then comes marriage... `,
`Love Letters - "Roses are red, violets are blue..." `,
`Lox & Bagels - A deli favorite. Pass the cream cheese! `,
// `Lucille Ball - 1911-89, American actor and comedian. You love Lucy? I love Lucy. `,
// `Lucy & Desi - Thirty years later and we still love Lucy. `,
`M & M's - Candy coated chocolates first sold in 1941. Now available in purple. `,
`Macaroni & Cheese - It's the easiest. `,
`Macaroni And Cheese - A good, hot meal that's fun to eat. `,
`Machine Guns - Automatic, rapid-fire, repeating weapons. The Gatling gun was used as early as the American Civil War. `,
`Mad Cow Disease - Degenerative brain disorder in cattle. The reason they don't know enough to come in out of the rain? `,
`Madame Curie - 1867-1934, French chemist and physicist who won a Nobel Prize for her work on radiation. Fun fact: A "curie" is a unit of radioactivity. `,
`Madeline - Brave storybook character who lived in an old house in Paris that was covered in vines. `,
// `Madonna - 1958-, American singer, songwriter, actor, writer, and 1980s pop icon. Blond Ambition. `,
// `Mae West - 1892-1980, American stage and film comedian. "Too much of a good thing can be wonderful." `,
`Magic Tricks - Now you see it, now you don't! `,
`Maggots - I though it was rice. `,
`Magic Tricks - "Nothin' up my sleeve ..." - Bullwinkle `,
`Mahatma Gandhi - 1869-1948, Indian leader and philosopher who preached nonviolence. Was assassinated for his efforts. `,
`Mail Carrier - A person who brings the mail to your house, no matter what the weather. `,
`Manhattan - I'll take Manhattan!. `,
`Maple Syrup - Made from the sweet sap of the maple tree or black maple tree, produced only in North America - a "must have" for pancakes. `,
`Mardi Gras - Fat Tuesday marks the final day before the Christian fast of Lent, a 40-day period of self-denial and abstinence. SO LET'S PARTY! `,
// `Marilyn Monroe - 1926-62, American movie star, pinup and sex symbol. Just ask the Kennedys. `,
// `Marlon Brando - 1924-, legendary America actor who starred in A Streetcar Named Desire and won awards for On the Waterfront and The Godfather. `,
`Mars - The fourth planet from the sun. Where men come from. `,
`Mark Twain - 1835-1910, American writer and humorist, best known for the adventures of Tom Sawyer and Huckleberry Finn. `,
`Marriage - If love and marriage go together like a horse and carriage ... who's the horse? `,
// `Martha Stewart - 1941-, television personality, magazine editor, and author. Domestic arts are her stock-in-trade. `,
// `Martin Luther King, Jr. - 1929-68, American civil rights leader and advocate of nonviolent resistance. Was assassinated for his efforts. `,
`Martin Luther King, Jr. - He believed that everyone should have equal rights, regardless of the color of their skin. `,
// `Mary-Kate And Ashley - The Olsen twins have been TV stars since the 1980s. They also have books and videos. `,
`Mashed Potatoes - Pile them up like a volcano and put butter in the middle. `,
`Math - Add, subtract, multiply and divide- or use a calculator! `,
`Matzo Balls - Soul for the chicken soup. `,
`Maui - Hawaiian volcanic island, 728 square feet in area. Heaven on Earth. `,
`Maximum Security Prison - When a regular strength prison just won't do. `,
`McDonald's - At a McDonald's restaurant in Mexico you can order a "hamburguesa." `,
`Me & My Shadow - "Strolling down the avenue..." `,
`Meat & Potatoes - A simpler meal for a simpler time. `,
`Meat Cleavers - No relation to Ward, June, or the Beaver ... `,
`Meat Markets - A cut above the rest. `,
`Meatballs - Like meatloaf, only smaller. `,
`Meatloaf - Large and intimidating -the dish not the singer! `,
// `Meg Ryan - 1961- , American actor and girl-next-door star of When Harry Met Sally, Sleepless In Seattle, and You've Got Mail. `,
// `Mel Gibson - 1956-, Australian actor. Known for The Road Warrior, Braveheart and :eatha; Weapon I, II, III, IV ... `,
`Men - REAL Men. `,
`Men In Black - We're not here. You don't see us. The government did NOT send us. `,
`Mensa High IQ Society - Members have IQ's in the top 2% of the population. `,
// `Meryl Streep - 1959-, accomplished American actor, two-time Oscar winner, with over a dozen Academy Award nominations. `,
`Mexico - Federal republic in North America. The capital and largest city is Mexico City. `,
// `Mexico - Country in North America, just south of the United States. Spanish is spoken in Mexico. `,
`Mice - "The best-laid schemes o' mice an' men ..." -Robert Burns `,
`Michael Jackson - 1958-, American popular singer, dancer, and songwriter. Welcome to Neverland. `,
// `Michael Jordon - 1963- , American professional basketball legend, led Chicago to six world championships. No bull. `,
`Michelangelo - 1475-1564, inspired Italian sculptor, architect, painter, and poet. A REAL Renaissance man. `,
// `Michelle Pfeiffer - 1957-, American actor whose career began with Grease 2. She'd like us to forget that but remember her Oscar nominations. `,
`Mickey & Minnie - Mouse, that is. Disney's dynamic duo. `,
`Mickey Mouse - Disney cartoon character, friends with Minnie Mouse and Goofy. `,
`Microsoft - A leading American software company. We'd say more but we don't want to monopolize your time ... `,
`Midlife Crisis - "Here comes your 19th nervous breakdown ..." -The Rolling Stone `,
`Midnight - Cinderella's curfew. `,
`Migraine Headaches - Not just any headache. `,
// `Mike Tyson - 1966- , American heavyweight boxer. Lend him your ear ... `,
// `Miles Davis - 1926-91, innovative, influential, and respected American jazz trumpter player and band layer. `,
`Milk - Three glasses a day will give you ... the gratitude of the dairy industry. `,
`Milk & Cookies - The ultimate after-school special. `,
`Milk Duds - Chocolate and caramel candy balls. Tooth extractions at no extra charge! `,
`Milking A Cow - They have machines for that now. `,
`Milwaukee - The Genuine American City. It's come along way since Laverne and Shirley. `,
`Miniature Golf - You don't have to be miniature to play! `,
`Minneapolis & St. Paul - The "Twin Cities" are Minnesota's largest population center. They may be twins but you can tell the difference. `,
`Mirrors - And now, a moment for reflection. `,
`Mittens - "Three little kittens; they lost their mittens." `,
`Mold - Fuzzy growth produced on organic matter by several types of fungi. Particularly attracted to students' refrigerators `,
`Mom & Apple Pie - Worth fighting for. `,
`Mom & Pop - Hey! Maybe they should open a store! `,
`Mom's Cooking - Just like Mom USED to make. `,
`Money - "The best things in life are free/ But you can give them to the birds and bees/ Just give me money ..." -Bradford and Gordy `,
`Monitor & The Merrimac - American Civil War ironclads, first fought each other in 1862. `,
`Monkeys - Monkeys see . . . `,
// `Monkeys - Monkeys are playful, intelligent mammals. They just monkey around! `,
// `Monster Trucks - Large, noisy trucks that drive over cars and crush them. `,
`Monsters - Some people think they live in closets, basements, or under beds. `,
`Moon & The Stars - You want what? `,
`Morticians - Why do you hang around with THOSE stiffs ...? `,
`Mosquito Bites - They just want your blood. `,
`Mosquitoes - They suck. `,
`Motorcycles - The air in your hair and bugs in your teeth. `,
// `Motorcycles - Feel the wind in your hair! Or... feel the wind on your helmet! `,
`Mount Rushmore - Memorial carved into the side of the Black Hills in South Dakota. Heads above all other monuments. `,
`Mount Vesuvius - Italian volcano that rises above the Bay of Naples and blew its top in 79 A.D., much to Pompeii's regret. `,
`Mountain Bikes - What goes up the mountain must come down. `,
`Mountains - Very high hills. Some have snow at the top, even in the summer! `,
`Mr. Potato Head - Mr. Potato Head was introduced in 1952. By now, that would be Grandpa Potato Head. `,
`MTV - "Video killed the radio star." -The Buggles `,
`Mud - Water. Dirt. You do the math. `,
// `Mud - Soft, wet, sticky, gooey, gritty, grimy dirt. `,
`Muddy Feet - Squish your toes! `,
`Mudslides - Chocolate drink or natural disaster ... both occur frequently in California. `,
`Muffins - "Do you know the Muffin Man?" `,
// `Muhammad Ali - 1942- , American heavyweight boxing champion. "Floats like a butterfly, stings like a bee." `,
`Mushrooms - It's a fungus. `,
`Music - Pick your favorite: country, pop, rock, rap, hip hop, jazz, or classical. `,
`Music Lessons - Practice, practice, practice. `,
`Musicals - South Pacific, The King and I, The Sound of Music, A Chorus Line, Cats, Rent ... `,
`Mustard - Made from seeds of the mustard plant. Spread on pretzels and hotdogs. `,
`Mutual Funds - Mutually benefits you and your broker. `,
`My 16th Birthday - Dad, can I have the keys to the car, please? `,
`My Baby Blanket - I don't care if it does have holes! `,
`My Bank Account - Speaking of theoretical mathematics and unreal numbers ... `,
`My Bathroom - "The bathroom was drenched with their splashings" -Aldous Huxley `,
`My Bedroom - "No one knows what goes on behind closed doors." -Charlie Rich `,
`My Best Friend - A person you can trust, no matter what. `,
`My Body - Mine is a temple. Specifically, the Temple of Doom ... `,
`My Boss - ... is an idiot. You know it; we know it. `,
`My Dad - Father, Daddy, Papa. `,
`My Dreams - "What dreams may come ..." -Shakespeare's Hamlet `,
`My Family - They'll drive you nuts. As long as you do the same to them, it's all even. `,
`My Family - Everyone's family is different. `,
`My Father - "Go ask your mother." `,
`My First Kiss - Sparks were flying. Of course, that could have been the braces ... `,
`My Friends - With friends like there, who needs enemies? `,
`My Friends - To have good friends, you have to be one. `,
`My Future - "The future's so bright, I gotta wear shades ..." -Timbuk-3 `,
`My Grandma - My mom or dad's mother. `,
`My Grandpa - My mom or dad's father. `,
`My Hair - Hair today, gone tomorrow ... `,
// `My Hair - You can curl it, cut it, and color it! `,
`My High School Prom - As if adolescence isn't awkward and painful enough ... `,
`My Home - There's no place like home! `,
`My Job - Love it or leave it. `,
`My Life - "There are places I'll remember/ All my life/ though some have changed . . ." - The Beatles `,
`My Love Life - "All you need is love ..." -The Beatles `,
`My Memories - Thanks for the memories . . . `,
`My Mind - It's a terrible thing to waste. `,
`My Mom - Mother, Mommy, Mama. `,
`My Mother - "Go ask your father." `,
`My Neighborhood - "Please, won't you be my neighbor?" -Fred Rogers `,
`My Past - What's past is past ... unless you're a politician ... `,
`My Personality - "I'm good enough, smart enough and, gosh darn it, people like me." -Stewart Smalley played by Al Franken `,
`My Refrigerator - It's a science experiment! `,
`My Room - Where I sleep and keep all my things. KEEP OUT! `,
`My School - "Be true to your school." `,
`My Shoes - Old shoes, new shoes, red shoes, blue shoes. `,
`My Stuffed Animals - The dog's name is Lucky, the bear is Teddy, and the duck is Quacker. `,
`My Teacher - If you can read this card, thank a teacher! `,
`My Town - Large or small, it's home. `,
`Nail Polish - Whatever color you want. `,
`Napoleon Bonaparte - 1769-1821, Emperor of France. Met his Waterloo at the Battle of Waterloo. The name should have tipped him off ... `,
`NASA - National Aeronautics and Space Administration, established in 1958 in part in response to the U.S.S.R. launching Sputnik. `,
// `NASCAR - Stock car racing began after World War II, breaking records for speed and for the number of advertisements on a single jacket. `,
`Nashville - Capital of Tennessee and capital of country music - also known as Nash Vegas. `,
`Neighbors - Turn down that music! `,
// `Neil Simon - 1927-, American producer, playwright, and screenwriter of The Odd Couple, Biloxi Blues, The Sunshine Boys, California Suite, and many more. `,
`New Orleans - The Big Easy. `,
`New Shoes - Make you feel like dancing ... `,
`New York City - America's most populous city. So good, they named it twice. `,
// `New York City - America's largest city, known for the Statue of Liberty. `,
`New Yorkers - Brash, brawny and full of bravado. `,
`Niagara Falls - Niagara Falls was formed about 12,000 years ago, when glaciers retreated north, and honeymooners approached from the south. `,
// `Niagara Falls - The 2nd largest waterfall in the world, located on the United States border with Canada. `,
// `Nicholas Cage - 1964- , American actor known for his edgy characters in Leaving Los Vegas, Raising Arizona, and Moonstruck. `,
`Night - You can see stars and the moon in the sky. `,
`Ninjas - Teenage mutant turtles need not apply. `,
`Nirvana - A state of supreme spiritual bliss and liberation. And then there's the band . . . `,
`Nobel Peace Prize - Established by Alfred Nobel. Swedish industrialist and inventor of dynamite. Led to an explosion of peace efforts. `,
`Noisy Neighbors - WHAT? I CAN'T HEAR YOU! `,
`Noodles - Most noodles are made with flour, water and eggs, but some contain seaweed or spinach. `,
// `Normal Rockwell - 1894-1978, American painter, illustrator and all-around interpreter of small town American life. `,
`North & South Dakota - It's all north. `,
`North Pole - The northern most point on the earth, but you're not going to find a pole there. `,
`Nosebleeds - Keep your chin up. `,
`*NSYNC - Popular boy band known for their dance routines and harmonies. Bye, Bye, Bye our albums! `,
`Nuclear Power Plants - "You've turned a potential Chernobyl into a mere Three Mile Island." -Montgomery Burns, "The Simpsons" `,
// `Nuts & Bolts - A good way to stay connected. `,
`NYPD - The New York Police Department. They're so good, they have their own TV show. `,
`Oatmeal - A hot cereal made from oats. It sticks to your ribs, and to the floor! `,
`Octopus - A sea animal with a soft, round body and eight long arms, called tentacles. `,
`Odds & Ends - It's in the junk drawer. `,
`Oil & Filter - Let me top that off for you. `,
`Oil & Vinegar - They don't mix, but we keep trying. `,
`Oil Spills - The American oil tanker, Exxon Valdez, went aground in Prince William Sound, Alaska, Mar. 24, 1989. Slick Move. `,
`Old Age - It looks good when you consider the alternative. `,
`Olive Oil - Derived from fresh ripe fruit, which contain about 20% oil. Better than "olive" the other oils. `,
`On The Roof - Come down this instant! `,
`On-Line Shopping - Enter your credit card number now. This is a secure site ... Sure it is ... `,
`Onions - Round root vegetables with a strong smell and taste. They might make you cry! `,
// `Oprah Winfrey - 1954- , Television talk show host, actor and all-around American success story. `,
`Oral Surgery - You said a mouthful. `,
`Orange Juice - Sunshine in a glass! `,
`Oranges - Face it ... nothing rhymes with orange. `,
`Oranges - Round orange fruit, often made into juice. Some oranges have navels. `,
`Ordinary People - Nothing special. `,
`Outer Space - Where the sun, moon, and planets are located. Maybe you'll visit there some day. `,
`Owls - Birds with large eyes and heads. They eat mice and snakes. Hoot-hoot. `,
`Oxygen - Oxygen was discovered in 1774. You'd think someone would have noticed it earlier. `,
`Pablo Picasso - 1881-1973, Spanish painter and sculptor, one of the greatest artists of the 20th century. If only he could draw eyes ... `,
`Pacific Ocean - The Pacific is the largest, and deepest, ocean on Earth. `,
`Pail & Shovel - I can dig it. `,
`Painting A Fence - A good way to earn some money. `,
`Pajamas - Clothes you sleep in. Some have feet! `,
`Pancakes - Some people call them flapjacks. `,
`Panda Bears - In China they're called "Xiongmao" which means giant cat bear. `,
`Panning For Gold - The dot-coms of the 1840s . . . `,
`Paper Route - It's a job. `,
`Parachutes - Put this on your back, jump out of the plane, and pull the cord. Ready? `,
`Parenting - The process of discovering you are becoming just like YOUR parents. `,
`Paris, France - The governmental, cultural and gastronomic capital of France. Or the world. Just ask the French. `,
`Parties - Birthday parties, slumber parties, Halloween parties. They're all fun! `,
// `Paul McCartney & Wings - Life after The Beatles. `,
`Paying Bills - Also known as "Debt Restructuring." `,
`Paying Taxes - Death or Taxes? Do we have to choose right away? `,
`Peace & Love - Flower Power! `,
`Peace & Quiet - Truly appreciated during parenthood. `,
`Peaches - Fuzzy fruit. `,
`Peaches & Cream - A great complexion and a great dessert. `,
`Peacocks - The show-offs of the bird world. `,
`Peanut Butter - A soft, creamy spread made from peanuts. Sometimes it sticks to the roof of your mouth. `,
`Peanut Butter & Jelly - On white bread; cut off the crusts. `,
`Peanuts - Peanuts are really a seed, not a pea or a nut. `,
`Peanuts & Popcorn - It's a crackerjack combination! `,
`Pearl Earrings - A good gift for Mother's Day! `,
// `Pebbles & Bamm-Bamm - The cartoon kids from The Flintstones. BAM-BAM, BAM-BAM, BAM-BAM. `,
`Pencil & Paper - We're drawn to them! `,
`Pencils - Three-fourths of all pencils made in the United States are yellow. `,
// `Penguins - Flightless, aquatic birds that reside in the Southern Hemisphere. All dressed up and no place to go. `,
`Penguins - Black and white sea birds found in Antarctica. They can't fly, but they sure can waddle. `,
// `Penn & Teller - Magicians, illusionists, entertainers, and comedians. `,
`Pennies - Heads or tails? `,
`Peppers - Sweet and crunchy, or hot and spicy! `,
`Perfume - What's that smell? `,
`Peter Pan - A book and movie character who could fly. He never wanted to grow up! `,
// `Pez Dispensers - Collectable candy dispensers first being sold in 1952. Believe it or not, there has never been an Elvis Pez dispenser. `,
// `Phone & Fax - Soon you won't need to leave the house at all! `,
`Picking Your Nose - Noses run in our family. `,
`Pickles - Dill or sweet? `,
`Picnics - Pack up your food and a blanket, and go to your favorite park or beach. `,
`Pierced Ears - Mom, when can I get my ears pierced? `,
`Pigeons - Birds with small heads, short necks, stout bodies, and an incredible attraction to statues. `,
// `Pigs - Domesticated mammal of the swine family. Thaaa ... thaaa ... that's all, folks! `,
`Pigs - Raised for their meat, including ham and bacon. `,
`Pikachu - Pika pika. `,
`Pillow Fights - He started it! `,
`Pillows - Pillow fight! `,
`Pilots - "Welcome aboard. Today we'll be flying at 30,000 feet." `,
`Pimples - Just in time for school pictures. `,
`Pinatas - Papier-mach‚ animals filled with candy and whacked with a stick. `,
`Pine Cones - Pine cones from Eastern White Pines can grow to eight inches in length. `,
`Pine Trees - Trees that stay green all year and have pinecones and needles. They smell great! `,
`Pineapple - Tropical fruit, or the less lush hand grenade. `,
// `Pinepears - Shaped like a football, tastes like a fruit. `,
`Pink Flamingos - Gracing America's lawns for more than 40 years - sold only in pairs. `,
`Pinocchio - Pinocchio was a wooden puppet who came to life. His nose grew each time he told a lie. `,
`Pins & Needles - It's all sewed up! `,
`Piranha - Carnivorous fish found in rivers of South America. When you feel like a bite ... `,
`Pirates - "Yo, ho, yo, ho, a pirate's life for me ..." - Pirates of the Caribbean `,
// `Pirates - People who rob ships at sea. Blackbeard was a famous pirate. `,
`Pit Bulls - Any of several crossbreeds of bulldogs with terriers. Or, several radio hosts we could mention. `,
`Pizza - Cheese, sausage, pepperoni, onions, and mushrooms. Pick your toppings! `,
`Plane Crashes - Statistically safer than driving ... unless you crash. `,
`Planting Flowers - "April showers bring May flowers." `,
`Plastic - Giant molecules of organic polymeric materials. Bags and bags of the stuff. `,
`Play-Doh - A colorful clay-like dough used for making shapes. `,
`Playgrounds - Some playgrounds have slides, swings, and sandboxes. `,
`Playing Checkers - A game for two using a checkerboard and 24 round game pieces. Jump, jump, jump - KING ME! `,
`Playing Chess - Has tantalized many of the world's greatest minds for almost 14 centuries. It just confuses the rest of us. `,
// `Playing Golf - For stress reduction. Now, get that head down and straighten your arm! `,
`Pluto - The ninth planet in the Solar System, or Mickey Mouse's dog. `,
`Poison Ivy - Itching for a walk in the woods? `,
// `Poison Ivy - Contact with the leaves of this plant can cause a serious, itchy rash. `,
// `Pokemon - Cute cartoon monsters you gotta catch. What you do with them is up to you ... `,
`Pokemon - A video game, card game and television show. I like Pikachu. `,
`Pole Vaulting - The sport where you can reach new heights. `,
`Pomp & Circumstance - La-de-da. `,
`Pond Scum - Simple organisms that carry out photosynthesis ... or spammers. `,
`Poodles - The only breed that is better groomed than their owners. `,
// `Popcorn - Air poppers are for air heads ... I say bring on the butter! `,
`Popcorn - A good movie-time snack. `,
`Porcupines - Quill-bearing rodents that can leave you in a prickly situation. `,
`Pork & Beans - Rustle us up some grub, Cookie. `,
`Porsche Boxster - A two-seat, six cylander roadster - elegant design and superior drivability. `,
`Postal Workers - "Neither snow, nor rain, nor heat, nor gloom of night, stays these couriers from the swift completion of their appointed rounds." `,
`Potato Chips - Plain, sour cream and onion, ranch, or barbecue chips. `,
`Pounding Nails - Use a hammer and watch your fingers. `,
`Power & Glory - The spoils of war. `,
`Power Drills - Carpenters use them, and so do dentists. `,
`Power Rangers - A television series about a group of teens fighting evil space aliens. `,
`Power Tools - "More power! More power! Argh! Argh!" -Tim, the Tool Man, Taylor, "Home Improvement" `,
`President Bush - 1946-, 43rd president of the United States. `,
`Pretzels - Pretzels were first made in Germany. Available straight, twisted, or knotted. `,
`Pride & Prejudice - Jane Austin's 1813 classic novel expounding on the consequences of pride. `,
`Prince Charming - The perfect man ... mythical, of course. `,
// `Prince Charming - The handsome prince who rescued Cinderella from her hard life. They lived happily ever after. `,
`Princess Di - 1962-97, beloved English Princess who died in an auto crash. "Good-bye England's Rose ..." -Elton John `,
`Pro Wrestling - They're just faking it. But then, so are we. `,
`Psychiatrists - "And how do you feel about that?" `,
`Psychics - The Psychic Friends Network went bankrupt in 1997. Perhaps they should have seen it coming ... `,
`Public Radio - "Good morning . . . . . This morning . . . . . . . . . . . .we have Wolfgang . . . Amadeus Mozart . . . for your listening pleasure . . ." `,
// `Puff Daddy - 1971- , American rap artist. "I'll be Missing You" shot him to stardom; no pun intended. `,
`Pulling Weeds - It's either this or chemical warfare. `,
// `Pulling Weeds - The job nobody likes to do. `,
`Pumping Iron - When a great weight needs to be lifted. `,
`Pumpkins - Bake it or carve it. Pumpkins are actually a fruit! `,
`Puppets - Finger puppets, hand puppets and string puppets. Kermit the Frog is a rod puppet. `,
// `Puppies - Young dogs. They'll chew on your shoes and bark all night. `,
`Pushups - Exercises, a type of bra, or the ice cream treat. `,
`Pyramids - Built by ancient civilizations, found mainly in Egypt, Guatemala, Honduras, Mexico and Peru. Probably the result of some pyramid scheme. `,
`Queen Elizabeth II - 1926-, Queen of the United Kingdom and Northern Ireland since 1952. Shame about the kids, though . . . `,
// `Quentin Terantino - 1963- , Groundbreaking American director and actor. Nice movies, but not nearly enough blood. `,
`Quicksand - Just don't let it get you down. `,
`R & B - Rhythm and Blues. `,
`R & D - Research and Development. `,
`R & R - Rest and relaxation, recreation, or could be recuperation. `,
`Rabbits - Small, furry animals with long ears and short, fluffy tails. They like carrots and other vegetables. `,
`Raccoons - They come out at night. The dark fur around their eyes looks like a mask. `,
`Race Car Drivers - Start your engines! `,
`Radios - In the 1940s, before television, families gathered together to listen to the radio. `,
`Raggedy Ann - a little red-headed rag doll with a triangle shaped nose. `,
`Ragweed - A weed of the genus Ambrosia. Nothing to sneeze at. `,
// `Rain - "When the rain comes, they run and hide their heads; they might as well be dead." -The Beatles `,
`Rain - "Rain, rain, go away, come again another day." `,
`Rain Forests - There is heavy rainfall throughout the year and lots of bugs. `,
`Rainbows - "Someday they'll find it/ The Rainbow Connection/ The lovers, the dreamers and me ..." -Kermit the Frog `,
`Rainbows - There are seven colors in a rainbow: red, orange, yellow, green, blue, indigo, and violet. `,
`Raisins - They're just dried grapes. `,
`Raking Leaves - Maybe they'll all just blow away! `,
// `Ramona - Main character in Beverly Cleary's "Ramona the Pest" and other books in the series. `,
`Rap Music - Rap is a popular form of music with a strong beat and rhyming lyrics. `,
`Rappers - PAENTAL ADVISORY EXPLICIT CONTENT Hasn't seemed to hurt sales... `,
`Rats - Gray or brown animals that look like very large mice. Usually pet rats are white. `,
`Raves - Neo-psychadelic all-night dance parties centered around acid house and techno music. All the rave. `,
`Reading & Writing - Old-fashioned skill, amazingly still useful today. `,
`Reading A Book - A good book is like traveling to a new world. `,
`Reading A Good Book - So many books, so little time. `,
`Recess - My favorite subject in school! `,
// `Recreational Vehicles - If they're trying to get away from it all, why are they taking it all with them? `,
`Recycling - More than one million tons of aluminum are NOT recycled each year. Where do you throw your cans? `,
`Red Raspberries - Worth a few scratches. `,
`Red Roses - Red roses are a symbol of love. `,
`Rednecks - "You might be a redneck if ..." -Jeff Foxworthy `,
`Redwood Forests - "From the Redwood Forests to the Gulf Stream Waters/ This land was made for you and me." -Woody Guthrie `,
`Reggae Music - This contemporary Caribbean music, originating in Jamaica, remains an influential style of popular music. Ya mon! `,
// `Regis & ... - Kathy Lee or Kelly - your choice. `,
// `Regis Philbin - 1934- , American talk and game show host. Who wants to be a millionaire? Regis, apparently. `,
`Remote Controls - The world's handiest invention. That is, if you can find it. `,
`Republicans - A U.S. political party symbolized by an elephant ... and don't forget it! `,
`Restaurants - It's good to try new things! `,
`Rice - A grain grown for food. Rice can be white, brown or black. `,
`Rice & Beans - South-of-the-border meat & potatoes. `,
`Rice Krispies Treats - How could you go wrong with Rice Krispies, marshmallows, and butter. `,
`Richard Nixon - 1913-94, 37th President of the United States and the only president to have resigned from office. At least that's what the tapes say ... `,
// `Richard Simmons - 1948-, American fitness guru famous for his extroverted style, short shorts and Sweatin' to the Oldies. `,
`Riding A Bike - Remember to wear your helmet. `,
`Riding A Horse - Grab the reins and hang on! `,
`Riding A Scooter - Where are the brakes? `,
`Rio De Janeiro - Vibrant Brazilian city and home to Carnival. Blame it on Rio! `,
`Rivers - Can you spell Mississippi? `,
`Road Kill - Mmmmmm. Them's good eatin'. `,
`Road Rage - Ten years ago we complained about potholes. NOW we're dodging pot-shots. `,
`Road Trips - "Get Your Kicks on Route 66." -Nelson Riddle `,
// `Robert DeNiro - 1943- , Pre-eminent American actor who earned Academy Awards for The Godfather II and Raging Bull. "Are you looking at me?" `,
`Robin Hood - Legendary British outlaw who stole from the rich and gave to the poor, known for his courage, skill, and Merry Men. `,
// `Robin Williams - 1952- , versatile American comedian and actor. The furriest man in show business. `,
`Robots - They should make a robot that does homework. `,
// `Rock & Roll - It'll never die. Unlike Rock and Roll musicians. `,
// `Rock And Roll -It's here to stay! `,
`Rock Candy - Large, clear sugar crystals- rock hard! `,
// `Rock Concert - If it's too loud - you're too old. `,
`Rock Concerts - Not on a school night! `,
`Rock Stars - Even the guys wear make-up! `,
`Rocket Scientists - Hey! They're not rocket scie ... oh ... never mind. `,
`Rocking Chairs - Rock-a-bye baby. `,
`Rocks - Rock collectors are sometimes called rockhounds. `,
`Rocky Mountains - These extend 2,000 miles from northeastern British Columbia to central New Mexico, and keep the Californians away from everyone else ... `,
`Rod & Reel - He took it hook, line, and sinker. `,
// `Rogers & Hammerstein - Kings of the Broadway Musical: The Sound of Music, The King and I, South Pacific, and many, many more. `,
`Roller Coaster - Roller coaster cars can go more than 70 miles per hour. `,
`Rollerblading - Faster than walking. `,
`Rolling The Car - You'll flip for this one ... `,
`Roman Numerals - There's a I in VII chance you'll know them. `,
`Romeo And Juliet - William Shakespeare's best known play, written in 1595. Youthful love and hasty temperaments. `,
`Ronald McDonald - The clown from McDonald's restaurants. `,
`Roosters - The barnyard alarm clock. `,
`Root Beer - A sweet, brown drink that is fizzy and foamy. Add ice cream to make a root beer float! `,
`Root Beer Floats - Actually, it's the ice cream that floats! `,
`Rope Burns - You were playing WHAT? `,
`Rosa Parks - 1913-, civil rights icon arrested in 1956 for violating U.S. segregation laws by refusing to give up her bus seat to a white passenger. `,
// `Rosie O'Donnell - 1962-, American actor and comedian. She's in a league of her own! `,
`Rubber Gloves - Just in case ... `,
`Rugrats - A cartoon about the adventures of Tommy, Chucky, Angelica, and Phil and Lil. `,
`Running A Marathon - 26 miles, 385 yards: the distance run by a Greek soldier from the town of Marathon to Athens in 490 BC. `,
`Running In A Race - A marathon is a 26 mile race. `,
// `Rush Limbaugh - 1951- , conservative talk-radio personality. Claims to host his radio show with half his brain tied behind his back, just to make it fair. `,
`Russia - The world's largest country, spanning 11 time zones. Famous for borscht, ballet, chess and vodka -just don't mix them. `,
`Rust - "Rust never sleeps." -Neil Young `,
`Rusty Nails - Good name for a country western singer. `,
`Saddam Hussein - 1937-, dictator of Iraq 1979-2003. `,
// `Sailors - "In the Navy, you can sail the seven seas ..." -The Village People `,
`Sailors - Get seasick? Don't become a sailor. `,
`Salads - Lettuce not knock the vegetarians. `,
// `Salads - Fruit salads, pasta salads, potato salads, and lettuce salads. `,
`Salsa Dancing - Popular form of Latin American dance. A little jazz, a little blues, a touch of rock and lots of heat. `,
`Salt - In ancient times salt was valuable. In fact, it was used as money. `,
// `Salt 'N Pepa - Extremely successful rap group formed in the 1980s, known for their portrayals of the woman's perspective on relationships. `,
`Salt & Pepper - "Pump it up a notch! BAM!" - Emeril Lagasse. `,
`Salvador Dali - 1904-89, Spansih artist best known for his dream imagery and surrealism, including the limp watches in The Persistence Of Memory. `,
// `Samuel L. Jackson - 1948-, powerful American actor of Pulp Fiction, Jackie Brown, and The Negotiator. `,
`San Francisco - California's City by the Bay. Where many hearts are left. `,
`Sand - The desert, the dunes, the beach, and in your shoes. `,
// `Sand & Surf - Life's a beach! `,
`Sand Castles - No dogs allowed. `,
// `Sandra Bullock - 1964-, American actor who starred in Speed, Miss Congeniality, and While You Were Sleeping. The classic girl-next-door. `,
`Saturday Cartoons - Get your blanket, a bowl of cereal and snuggle in for three hours of commercials. `,
`Saturn - Sixth planet from the sun, and the second largest in the solar system. Has a nice ring to it, don't you think? `,
`Scavenger Hunt - OK kids, here's your list: a marshmallow, a safety pin, a red rubber band, and a moon rock. Go find 'em! `,
`Scene Of The Crime - It was Colonel Mustard, in the library, with the candlestick. `,
`Scented Candles - You didn't have to BAKE an apple pie - just light a candle. `,
`Schindler's List - 1993 Steven Spielberg film. Powerful real-life story of a Catholic businessman who eventually saved over 1000 Jews in Nazi Poland. `,
`School Buses - Large, yellow buses used to take children to school. `,
`School Lunch - Hot lunch, cold lunch, or bring your own lunch. `,
`School Pictures - How do I look? `,
`Science Experiments - Your science experiment? I thought it was dinner! `,
`Science Fair Projects - No human subjects, please! `,
`Science Fiction - In a galaxy far, far away ... `,
`Science Tests - Multiple choice or essay. `,
`Scientists - Scientists study astronomy, biology, chemistry, geology, and other stuff. `,
`Scooby-Doo - TV cartoon dog who helps solve crimes. "Scooby-Doo, where are you?" `,
`Screaming - NOT SO LOUD! `,
`Screeching - Please stop. `,
// `Sean Connery - 1930- , Accomplished Scottish actor, although best known as the REAL Bond, JAMES Bond ... `,
`Seashells - The outer shells of sea animals. You can find them on the beach. `,
`Sesame Street - Children's television show featuring Big Bird. "Can you tell me how to get to Sesame Street?" `,
`Shake & Bake - ... and eat. `,
// `Shania Twain - 1965- , Canadian country singer and songwriter. "Shania" means "I'm on my way" in Ojibwa. `,
// `Sharks - Many species living today are similar to those from 100 million years ago. Because change is scary. `,
`Sharks - Meat-eating fish known for their speed, sharp teeth, and the large fins on their backs. `,
`Sharp Knives - Found in kitchen drawers, tackle boxes and butcher shops. `,
// `Shave & A Haircut - Two bits. `,
`Ships - Battleships, cruise ships, freighters, and oil tankers. `,
`Shipwrecks - "The lake it is said never gives up her dead . . ." - The Wreck of the Edmund Fitzgerald" `,
`Shoplifting - It's stealing and it's against the law. `,
`Shopping - It's shopping-whether you buy something or not. `,
`Shopping Mall - Three-quarters of the North American population visit a shopping mall at least once a month. `,
`Shrimp - Tiny to jumbo- they come in all sizes. `,
`Sigmund Freud - 1856-1939, Viennese psychologist and the originator of psychoanalysis and the Freudian slip. `,
`Silk - Produced as a cocoon covering by the silk worm, and used in fine fabrics and textiles. `,
`Silly Putty - It's putty in your hands! `,
`Sin & Redemption - Everybody deserves a second chance. `,
`Singing - Making music with your voice. La-la-la. `,
`Sisters - Sister, sister! `,
`Sitcoms - If they're so funny, WHY THE LAUGH TRACK? `,
`Skateboarding - It's just going downhill ... down stairs ... down ramps ... `,
`Skateboards - "Skateboarding is not a crime!" `,
`Skeletons - There are 206 bones in the human body. Count them! `,
`Skiing - The Super Ginat Slalom: Swiss for "suicide." `,
`Skin & Bones - What would you be without them? `,
// `Skinheads - Shaved heads, big boots. Some are Nazis, some are not. `,
// `Skinned Knees - Ouch! Ouch! OUCH! `,
`Skunks - Black and white striped mammals known for their offensive smelling defensive spray. `,
// `Skunks - Black, bushy-tailed animals with one or two white stripes down their backs. Stinky! `,
`Skydiving - Parachute canopies are usually made from nylon fabric that lasts for thousands of jumps - whether the skydiver does or not. `,
`Slash & Burn - And there goes another rain forest... `,
`Slasher Films - A real nightmare. `,
`Sledding - It would be more fun if you didn't have to climb back up the hill. `,
`Sleep - "Don't let the bedbugs bite." `,
`Sleeping Pills - I remember taking them ... I just ... don"t rememmer ... how mamy. `,
`Sleepovers - If you don't sleep, is it still a sleepover? `,
`Slice & Dice - A sharp knife is a safe knife. `,
`Slip & Fall - Watch out for ... too late! `,
`Splinters - The worst ones are under your fingernails. `,
// `Slobodan Milosevic - 1941-, former leader of Serbia, also known as "the Butcher of the Balkans." `,
`Sloppy Joes - My favorite recipe -open the can. `,
// `Smith & Wesson - Firearms when ready! `,
`Smithsonian Institution - Located in Washington, D.C., the largest museum complex in the world. Wouldn't that be a great garage sale? `,
`Smoke - "Where there's smoke, there's fire!" `,
// `Smoke & Mirrors - That's how we do it! `,
// `Snakes - Surprising, snakes move rapidly without legs. Also surprising, they find OTHER snakes attractive. `,
`Snakes - Long, thin reptiles without arms or legs. Their forked tongues are used for smelling. `,
`Sneezing - Ah-ah-ah-choo! `,
`Snips & Snails - And puppy dog tails. `,
`Snoopy - The little, white beagle from the "Peanuts" cartoon. `,
// `Snoopy & The Red Barron - Characters in the Peanuts comic strip. Talk about a dog fight! `,
`Snow - Transparent ice crystals which form around dust and other small particles. Get my drift? `,
`Snow Cones - You don't have to wait for snow. `,
`Snow White - "Mirror, mirror, on the wall, who is the fairest of them all?" `,
`Snowballs - Just right for throwing! `,
// `Snowboarding - Snowboarding was declared an official Olympic sport in 1994. `,
`Snowflakes - They say each one is different, but who would know? `,
`Snowstorm - Lots of snow blowing around. Maybe school will be closed! `,
`Soccer - A favorite team sport for kids. KICK IT! `,
`Social Security - American program designed to provide income and services in the event of retirement, sickness, disability, death or unemployment. `,
`Socks - "Black socks, they never get dirty, the longer you wear them the stronger they get." -Bill Harley `,
`Soldiers - Men and women who serve in the military. `,
`South Africa - Two oceans, rugged mountains, traditional villages, game sanctuaries, wineries...forget the past and bring on the tourists. `,
// `South Park - Highly-rated, highly offensive animated cartoon series. "Oh my God! We killed Kenny!" `,
`Soy Sauce - A brewed seasoning made from soybeans, wheat, and salt. `,
`Space & Time - Infinite. `,
`Spaghetti - Looks like a plate of worms! `,
`Spam - Mystery meat, or mystery E-mails ... `,
`Sparklers - They're still fireworks! `,
`Speeding Tickets - "No, officer, I don't have any idea how fast I was going." `,
`Spelling Bees - Spelling contests. They have nothing to do with bees. `,
`Spider-Man - He's a student. He's a superhuman crime fighter. He's Spider-Man! `,
// `Spiders - There are more than 34,000 species of spiders. Try not to think about THAT right before bedtime. `,
`Spiders - They have eight legs and they spin webs to catch their food. `,
`Spiders & Snakes - Creepy! Legs or no legs. `,
// `Spike Lee - 1957-, American film maker and Knicks fan. Best known for Do the Right Thing, Malcolm X, and 4 Little Girls. `,
`Spilled Milk - Got milk? WHOOPS! Apparently not ... `,
`Spinach - Raw or cooked- it's full of vitamins. `,
// `Spit - Ladies and gentlemen, straight from the Salivary Glands ... `,
`Spit - Spit that gum out right now! `,
`Spit & Polish - We could do with less spit and more polish. `,
`Spontaneous Combustion - The ignition of substances without application of an external heat source. A good plot for "The X-Files." `,
`Sport Utility Vehicles - Need new tires? `,
// `Sports Channels - Any team, any time. `,
`Square Dancing - "Swing your partner!" `,
`Squirrels - Small animals with big brown eyes and bushy tails. They like nuts and can run on telephone lines. `,
`Stalactites & Stalagmites - The ups and downs of spelunking. `,
`Stamp Collecting - If you can't lick 'em, collect 'em. `,
// `Stanley & Livingston - Britons who explored Africa, I presume. `,
`Star Fruit - Looks like plastic, tastes like lemons. `,
`Starry Night - A sky bright with stars, a classic Van Gogh painting, and a Don McLean song. Three cards in one! `,
`Stars & Stripes - Three cheers for the red, white, and blue! `,
`Starfish - A star-shaped sea creature with five or more arms. If one breaks off, another arm will grow. `,
`Stars - Points of sparkling light that you can see in the night sky. Make a wish! `,
`State Fair - Aw, gee whiz, a blue ribbon for Bessie! `,
`Steak And Potatoes - Hot off the grill! `,
`Stephen King - 1947- , American author of horror novels, who's sold more than 100 million copies of his books. Talk about frightening ... `,
// `Steve Martin - 1945- , American comedian, actor, writer, and "wild and crazy guy." `,
// `Steven Spielberg - 1947-, American movie director and producer, and overachiever. From E.T. to Schindler's List... too many to list. `,
// `Sticks & Stones - When words are not enough. `,
`Stocks & Bonds - At least they're worth the paper they're printed on... We hope. `,
`Stomach Ache - You ate the whole thing? `,
`Stonehenge - Prehistoric stone monument located north of Salisbury, England. `,
`Stop Signs - Gee, Officer, I THOUGHT it was green! `,
`Strained Peas - The strain comes when you have to eat them. `,
`Strawberries - Strawberry shortcake! `,
`Strawberry Shortcake - Summertime and the eating is easy ... `,
`Street Mimes - A mime is a terrible thing to waste. On second thought . . . `,
`Stretch Limos - Stretch your legs, stretch your wallet. `,
`Strip Malls - Almost as attractive as stip mines. `,
// `Stuart Little - A clever little mouse who is a character in a book and a movie. `,
// `Stubbed Toes - It'll feel better when it quits hurting. `,
`Stunt People - When you need someone to take the fall. `,
`Substitute Teachers - "Ms. Jones lets us eat candy and get drinks whenever we want!" `,
`Sugar & Spice - And everything nice. `,
`Suit and Tie - It's business as usual! `,
`Summer - SCHOOL'S OUT! `,
`Summer Camp - If the bugs don't get you, the poison ivy will! `,
// `Summer Camp - Day camps and sleepover camps. Either way, you'll have lots of fun. `,
`Sumo Wrestlers - Wrestlers usually weigh 300-400 pounds and win this Japanese form of wrestling by forcing an opponent out of the ring. `,
`Sunburns - Next time, use some sunscreen. `,
`Sunday Drivers - Now available ANY day of the week! `,
`Sunflower - Tall plants with large, yellow flowers. Toast the seeds for a tasty snack. `,
`Sugar - "Sugar is sweet and so are you." `,
`Sunken Ships - Early ships would often sink in battles or bad weather. `,
`Sunshine - Warms the Earth and helps plants to grow. `,
// `Superman - Fictional comic book superhero loved by Lois Lane and Jerry Seinfeld. `,
`Superman - Faster than a speeding bullet! `,
`Supermarkets - It's a meat market, bakery, flower shop, and toy store- all in one! `,
`Supermodels - Long legs = big bucks. `,
`Surf & Turf - Steak and lobster. No need to choose. `,
`Surfing - The waves or the web. `,
`Surfing The Net - www.otb-games.com `,
// `Surprise Parties - SURPRISE! Oh. He had a heart condition . . . that WAS a surprise . . . `,
`Surprise Parties - Everybody hide! `,
`Sushi - Who would ever have guessed that raw fish could be so fashionable? `,
`Swamps - Wet, spongy land, often covered with water. A great place to live- if you're a mosquito. `,
`Swans - The "Ugly Duckling" was actually a baby swan. `,
`Swimming - A great way to cool down on a hot summer day! `,
`Swiss Bank Accounts - Do you think everyone in Switzerland has one? `,
`Swiss Cheese - Guess it comes from holey cows ... `,
`Swiss Chocolate - "What use are cartridges in battle? I always carry chocolate instead." -George Bernard Shaw `,
`Swordfighting - As a sport, sword fighting is called "Fencing." It is an Olympic event. `,
`Tacos - Meat, cheese, and hot sauce all wrapped up in a tortilla. `,
// `Taking A Bath - Bathing facilities have been found in excavations in India from before 2000 BC. Soap-on-a-Rope hasn't. `,
`Taking A Bath - Don't Forget the bubbles and toys. `,
`Taking A Shower - That'll wake you up. `,
// `Talk Radio - Talk about air pollution. `,
`Tarred & Feathered - It's a sticky situation. `,
`Tarzan & Jane - He went ape over her. `,
// `Tattoo Parlors - "With nothing to show but this brand new tattoo . . . how I got it here I haven't a clue." - Jimmy Buffett `,
`Tattoos - Tattoos can be painful. Temporary tatoos don't hurt at all. `,
`Tea & Crumpets - Upper-crust toast & jelly. `,
`Teachers - If you can play this game, thank a teacher. `,
// `Teachers - "What do you mean, you didn't know there was a test today?" `,
`Teenagers - Ages thirteen to nineteen. `,
`Teeth - Adults have 32 permanent teeth. `,
`Telemarketers - "No, thank you ... No, I'm not interested ... No, I have to go now ..." `,
// `Teletubbies - Colorful characters with televisions in their stomachs. Tinky Winky is purple. `,
// `Televangelists - Not to be confused with Teletubbies. `,
// `Television - One-hundred and sixty-four channels, and nothing worth watching. `,
`Television - If you get your homework done... `,
`Telling Scary Stories - "It was a dark and stormy night . . ." `,
`Telling The Truth - "There are two kinds of truth. There are real truths and there are made-up truths." -Marion Barry, ex-mayor of Washington, D.C. `,
`Tents - A pup tent will hold one or two people, but a circus tent can hold hundreds. `,
`Terrorist Attack - We will never negotiate with terrorists. `,
`Texas - Famous for oil wells, barbecues, and cowboys. The capital of Texas is Austin. `,
// `Thanksgiving Day - The fourth Thursday of November in the U.S.; the second Monday in October in Canada. `,
`Thanksgiving Day - A harvest festival celebrated on the fourth Thursday in November in the U.S. `,
`The 1920s - Pros: the Jazz Age. Cons: Presidents who look like librarians. `,
`The 1950s - Pros: Barbies, barbecues, and bikinis. Cons: McCarthy, the Korean War, television. `,
`The 1960s - Pros: the Moon Lsnding, the music. Cons: hippies who refuse to believe they're over. `,
`The 1970s - Pros ... uh ... pros ... uh ... GIVE US A MINUTE, OKAY? `,
`The 1980s - Pros: meant the end of the 1970s. Cons: '80s nostalgia. `,
`The 1990s - Dot-coms, Clinton and designer coffee. The good old days. `,
`The 21st Century - The future is NOW! `,
`The Academy Awards - The statue known as "Oscar" weighs only eight and a half pounds. So why does it carry so much weight? `,
`The Atlantic & Pacific - Oceans apart. `,
// `The Baby-Sitters Club - This series of books, written by Ann M. Martin, is a favorite of girls, world-wide. `,
// `The Beach - A day at the beach is no day at the beach, ya know? `,
`The Beach - Sun, surf, and sand. `,
`The Beatles - 1960s British band. Only the most revolutionary, influential and universally acclaimed group of the 20th century. That's all. `,
`The Big Dipper - Group of stars in the Northern sky that form part of the constellation Ursa Major. `,
`The Birds & The Bees - We'll tell you about them sometime. `,
`The Chicken & The Egg - Which came first? The egg. Look it up! `,
// `The Chicken Dance - You put your hands in your armpits... `,
`The CIA - The Central Intelligence Agency is responsible for keeping the U.S. government informed of foreign actions affecting the nation's interest. `,
`The Circus - A show featuring trained animals, clowns and acrobats. `,
`The Cold War - The post-World War II struggle between the US and its allies, and the former USSR and its allies. Things could have gotten hot. `,
// `The Common Loon - A spotted, red-eyed diving bird -or various friends or family. `,
`The Dalai Lama - Title of the leader of Tibetan Buddhism, in exile since 1959. Hello, Dalai! `,
// `The Dallas Cowboys - National Football League team known for their cheerleaders and their performance, both on and off the field. `,
// `The Dixie Chicks - Female country and western band with pop leanings. Winners of multiple Country Music Association awards. Goodbye, Earl! `,
`The Dump - Just remember to recycle. `,
`The Earth - Third planet from the sun. Home to Earthlings. `,
`The Eiffel Tower - Designed and built by French engineer Alexandre Gustave Eiffel for the Paris World's Fair of 1889. `,
`The Electric Chair - In U.S. prisons, an alternating current of about 2000 volts is used for electrocution. `,
`The End Of The World - "It's the end of the world as we know it, and I feel fine ..." -REM `,
`The Everglades - A vast marsh covering much of southern Florida. Watch out for alligators! `,
`The Far Left - They get high Marx from some. `,
`The Far Right - Far right for some and far wrong for others. `,
`The FBI - The Federal Bureau of Investigation: the investigative agency for the U.S. Department of Justice. They're listening ... `,
`The First Day Of School - "Fear has many eyes." -Cervantes `,
// `The First Day Of School - Get your backpack, your lunch, and get going! `,
`The French Riviera - Holiday home of the rich, the famous, and the half-naked. `,
// `The Godfather - The 1972 critically acclaimed Mafia movie that made us as offer we couldn't refuse. `,
`The Grand Canyon - 217 miles long, 4 to 18 miles wide, and more than 1 mile deeps. Now THAT'S grand. `,
// `The Grateful Dead - American rock band, founded in 1965 and best known for their "Dead Head" fans. `,
`The Graveyard Shift - It WILL be the death of me . . . `,
`The Great Barrier Reef - Coral reefs, shoals and islets off the northern coast of Australia. Scuba heaven. `,
`The Great Chicago Fire - The noteworthy fire of 1871 ... a hot time in the old town ... `,
`The Great Depression - Prozac was invented six decades too late. `,
`The Great Wall Of China - A 1500 mile long wall across northern China. Built for fortification but better for tourism. `,
// `The Green Bay Packers - Twelve time National Football League world champions, beloved by "Cheeseheads" everywhere. Are those brats done yet? `,
`The Gulf War - January - February, 1991. This six week conflict with Iraq was also known as "Desert Storm." `,
`The Ice Age - Polarity analysis of deep-sea sediment suggests the Pleistocene age began more than 1.8 million years ago. Bla-bla-bla. `,
// `The Indy 500 - Contestants must drive the full 500 miles. Bathroom breaks ARE allowed. `,
`The Internet - Computer-based worldwide information network, and global shopping market. `,
`The IRS - The Internal Revenue Service: agency of the U.S. Department of the Treasury responsible for collecting taxes. A human audity. `,
// `The JFK Assassination - November 22, 1963. The funeral of President Kennedy was watched on television by millions around the world. `,
`The Judge - Smile when you play this card. `,
`The KKK - IF they're supposed to be the master race, why do they keep misspelling "Clan"? `,
`The Land Of Oz - "I've a feeling we're not in Kansas anymore, Toto." -Dorothy, "The Wizard Of Oz" `,
`The Last Day Of School - Almost as good as a birthday! `,
`The Library - Books, magazines, newspapers, tapes, and computers. SHHHH! `,
// `The Little Mermaid - The 1837 story by Hans Christian Anderson or the 1989 animated film by Disney. Guess which made more money? `,
`The Little Mermaid - A character in a folktale who gave up her home under the sea so that she could live on land. `,
`The Lunchroom - What's for lunch? `,
`The Mafia - A loose association of criminal groups, bound by a blood oath and sworn to secrecy. Of course, now we have to kill you. `,
`The Mall - Great place to shop and meet friends. `,
// `The Marx Brothers - Chico, Groucho, Harpo, amd sometimes Zeppo. Their 1930s films include Duck Soup and Animal Crackers. `,
`The Metric System - No, thank you. We like our inches and feet! `,
`The Midwest - America's central plains states. They're not like folks 'round here ... `,
`The Milky Way - The galaxy that includes the sun, its solar system, and a chewy layer of caramel. `,
`The Mississippi River - The Algonquin words "Misi sipi" mean "big river." What's Algonquin for "muddy"? `,
`The Moon - There's a new moon and there's a full moon, and sometimes there's a man in the moon. `,
`The Mounties - The Royal Canadian Mounted Police. They always get their man. `,
// `The National Enquirer - American tabloid newspaper. Inquiring minds want to know ... Why the heck does this thing sell? `,
// `The New York Yankees - Legendary American baseball team. With so much success, it's obvious why they're reviled. `,
`The North Pole - Things can only go south from here . . . `,
`The NRA - National Rifle Association. They're gunning for your vote. `,
// `The Ocean - How deep is the ocean? 12,000 feet. If they'd known that, maybe they wouldn't have written that stupid song. `,
`The Ocean - Almost three-fourths of the Earth's surface is covered by the four oceans. `,
`The Old Man And The Sea - Ernest Hemingway's classic novel - fishing, hunger, fishing, torment, fishing, personal loss ... fishing ... `,
`The Olympics - An international athletic competition held every four years. The thrill of victors and the agony of defeat. `,
`The Opera - It ain't over 'til the fat lady sings. Unfortunately, sometimes, not even then. `,
`The Ozone Layer - Short for ozonosphere. Theories about the ozone layer are full of holes. `,
`The Pentagon - The five-sided home of the U.S. Department of Defense. `,
`The Police - They keep order and arrest those who break the law. `,
`The President - A U.S. president must be at least 35 years old and a natural born citizen. `,
// `The Princess & The Pea - The true test of a princess, fairy tale or otherwise. `,
`The Pyramids - The Egyptian pyramids were built from about 2700 BC to about 1000 BC. Tut, tut, tut ... `,
`The Renaissance - Beginning in the 1300s, started in Italy and spread across Europe. Kind of like Espresso bars ... `,
// `The Rolling Stones - British "bad boy" rock band formed in 1962. Still touring? `,
`The San Andreas Fault - Geological feature in California stretching 600 miles. Like the state doesn't have enough faults already. `,
`The Scarlet Letter - Hawthorne's 1845 novel about Puritan New England, moral conflicts, guilt, and down-right nastiness. (It was an "A".) `,
`The South - Dixie: South of the Mason-Dixon line that is. They're not like folks 'round here ... `,
// `The Statue Of Liberty - "Give me your tired, your poor/ Your huddled masses yearning to breathe free ..." -Emma Lazarus `,
`The Statue Of Liberty - "Lady Liberty" was a gift to the U.S. from the people of France. `,
`The Super Bowl - Who needs another national holiday? `,
`The Supreme Court - The highest court in the United States. Robes, but no wigs. `,
`The Symphony - It's music to our ears. `,
// `The Three Stooges - Nyuk, nyuk, nyuk. A wiseguy, eh? `,
`The Three Tenors - Opera stars Placido Domingo, Jose Carreras, and Luciano Pavarotti began recording as The Three Tenors in 1990. `,
`The Titanic - It sank in 1912. Get over it! `,
`The U.S. Constitution - We the people . . . `,
`The Universe - Everything. The big "It." Huge. Massive. THAT big. `,
`The Vatican - The Papal State in the middle of Rome. Home of the Pope, Swiss Guards, and lots of pigeons. `,
`The Vietnam Memorial - "The Wall," built in 1982, was designed by 21-year-old architecture student, Maya Lin. `,
// `The Williams Sisters - Venus, 1980-, and Serena, 1981-, Williams, American tennis champs. One heck of a sister act. `,
`The Wright Brothers - In 1903, Wilbur and Orville made the first powered airplane flights in history. Although there were delays at the airport. `,
// `The YMCA - The Young Men's Christian Association has 30 million members in 110 countries. "It's fun to stay at the Y-M-C-A." -The Village Peopl `,
// `The Young & The Restless - Launched in 1973, this soap opera isn't young, but it's still restless. `,
`The Zoo - "Oh! Lions and tigers and bears. Oh my." `,
// `Thelma & Louise - 1991 Ridley Scott film starring Susan Sarandon and Geena Davis as two over-the-edge women. `,
`Thomas Edison - 1847-1931, American inventor, developed a light bulb, generator, sound-recorder, and motion picture projector. Show off. `,
// `Three Men & A Baby - The 1987 comedy film. You do the math. `,
`Throwing Rocks - Be careful so that you don't break any windows. `,
`Throwing Up - It's proof that you really are sick. `,
// `Thunder - "Here it comes again, Thunder and Lightning..." -ELO. `,
`Thunder - A booming sound wave created by the heat from lightning. `,
`Thunder & Lightning - Nature's fireworks. `,
`Thunderstorms - Don't stand under a tree if you hear thunder! `,
`Tibet - Mountainous region of China and religious enclave for a form of Buddhism called Lamaism. Known as the roof of the world. `,
`Ticks - All ticks are bloodsucking parasites, but not all bloodsucking parasites are ticks. `,
`Tidal Waves - The gigantic ocean waves that strike with tremendous force, and cause considerable damage to life and property. Kind of like Spring Break. `,
// `Tiger Woods - 1975- , American star of the golf circuit. Known for his athletic skill, and youthful, classic style. `,
`Tightrope Walking - If you get really good, you can join the circus. `,
// `Timbuktu - City of 20,000 located in the West African nation of Mali. The official name if Tombouctou. From here to Timbuktu. `,
`Time Travel - "What do you mean I missed my connection in the 14th Century?" `,
// `Timothy McVey - 1961-2001, the Oklahoma City Bomber. `,
`Toasted Marshmallows - How do you like yours - golden brown or flaming? `,
// `Toasted Marshmallows - Add chocolate and graham crackers and you'll wish you had s'more. `,
`Toasters - Wait -don't stick that fork in there! `,
`Tobacco Companies - Who says tobacco's not addictive? THEY can't give it up ... `,
`Toenails - A horse's foot is actually a toe. The hoof is a toenail. `,
`Toes - "This little piggy went to market ..." `,
`Tom & Jerry - A good chaser. `,
// `Tom Cruise - 1962-, American actor. It looked like Ricky Business early on, but by 1986 he was Top Gun. No Mission Impossible for him. `,
// `Tom Hanks - 1956-, American actor and star of such varied films as Big, Philadelphia, Forrest Gump, Saving Private Ryan and Castaway. `,
`Tomato Soup - Good with cheese sandwiches. `,
`Tomatoes - Most people don't know that a tomato is a fruit. `,
// `Tony Blair - 1951-, British Prime Minister, "We will not rest until this evil is driven from our world." Sept. 11, 2001. `,
`Tooth Fairy - Who knows what they do with all those baby teeth. `,
`Toothpaste - Brush and spit! `,
`Top Of A Rollercoaster - Just remember: what goes UP ... `,
`Tornadoes - Funnel-shaped cloud whirling destructively at speeds up to 300 mph. "Honey, do you hear a freight train ... Honey?" `,
`Toy Poodles - They are less than ten inches tall, from their shoulders to the floor. `,
`Toys - They're not just for kids, anymore ... `,
// `Toys - Stuffed animals, action figures, dolls, balls, and lots more. Everyone loves toys! `,
// `Track & Field - It's eventful. `,
`Tractors - "She thinks My Tractor's Sexy." - Kenny Chesney `,
`Trailer Parks - Also known as tornado magnets. `,
`Training Wheels - It's a four-wheeler. `,
`Trains - "The Little Engine That Could" is a story about a train that climbs over a mountain. `,
`Trampolines - Trampolines have been used in circuses wince the 18th century. Despite slumps in popularity, they always seem to bounce back! `,
`Treasure Hunting - Gold Doubloons! Gold Doubloons! AT A YARD SALE? `,
`Tree Huggers - "Environmentalists" to the left. "Wackos" to the right. `,
`Treehouse - A playhouse built in a tree. The Swiss Family Robinson lived in a treehouse on an island `,
`Trees - Some redwood trees in California are over 300 feet tall and thousands of years old. `,
// `Trekkies - Beam them up, PLEASE! `,
`Trinidad & Tobago - Tiny, lush Caribbean republic. One of the most prosperous countries in the area due to petroleum and natural gas production. `,
`Truck Drivers - See the country- or at least see the highways. `,
// `Truck Stops - Breakfast 24 hours a day and you're on your way. `,
`Truth & Justice - Sounds good on paper. `,
`Tulips - A sign of spring! `,
`Turkey & Stuffing - Get stuffed. `,
`Turkeys - Large birds raised for food. Popular at Thanksgiving. `,
`Turtles - They pull their legs and heads inside their shells for safety. `,
// `Tyra Banks - 1973-, American model, starred in Coyote Ugly. Probably the only time you'll see the words "ugly" and "Tyra Banks" in the same sentence. `,
`Tyrannosaurus Rex - Large carnivorous dinosaur of the latter part of the Mesozoic era. My, what big teeth you have! `,
`Umbrella Drinks - Extra fruit, please! `,
`Umbrellas - "Rain, rain, go away, come again another day." `,
`Under My Bed - A good place to hide, if it's not too messy. `,
`Underwear - "Let's keep this brief." `,
// `Underwear - Keep it clean! `,
`Unicorns - Imaginary horse-like animals. A long, pointed horn grown from the middle of their foreheads. `,
`United Nations - The U.N. was founded in 1945, after World War II ended. Its mission is to maintain world peace. If we ever achieve it, that is ... `,
`United States - It's about 2,500 miles, from sea to shining sea. `,
`Urban Sprawl - Oh give me a home where the edge of town roams . . . `,
`Vacations - "Vacation, all I ever wanted, Vacation, had to get away ..." -Go-Go's `,
`Vacuum Cleaners - It's a dirty job! `,
`Valentine's Day - Will you be my Valentine? `,
`Vampires - Legendary bloodsucking monsters. `,
`Vanilla Pudding - Now available frozen, on a stick. `,
`Velcro - A hook-and-loop fastener that can really grab you. `,
`Venus & Mars - As different as men & women. `,
`Viagra - It works for Bob Dole, it'll work for you. `,
`Victorian England - An era characterized by moral severity and pompous conservatism. `,
// `Video Games - Just how DO you get to the thirteenth level of "Doom"? `,
`Video Games - I told you ten hours a day was too much! `,
// `Vietnam, 1968 - More than 30,000 Americans had been killed in the Vietnam War by the end of 1968. `,
`Vincent Van Gogh - 1853-90, Dutch post-impressionist painter known for dramatic sunflowers and self-portraits. Only one of his paintings sold during his lifetime. `,
`Violins - It's a pain in the neck, but keep practicing. `,
`Volcanoes - Vents in the crust of the earth from which steam, debris and molten rock spew, with explosive results. `,
`Volleyball - Spike it! `,
`VW Beetles - The prototype for the original VW Beetle was developed in 1934, and production begin in 1945. Functional, yet so fashionable. `,
// `Waco, Texas - Texas city near where a 51-day standoff between law-enforcement officials and members of the Branch Davidians occurred in 1993. `,
`Waffles - Like pancakes with built-in syrup cups. `,
`Walking The Dog - It's good exercise. `,
`Wall Street - The financial center of the United States. See also: roller coaster. `,
`Walt Disney - 1901-1966, the head of some Mickey Mouse company. `,
`War and Peace - Tolstoy's 1805 epic novel of the Napoleonic wars, a celebration of Russian spirit. `,
// `Warts - Small, benign, circumscribed tumors of the outer layer of the skin. Warts and all! `,
`Warts - Small, hard lumps that grow on the skin. Anyone can get them, not just witches. `,
`Washer & Dryer - Take them out for a spin. `,
`Washington, DC - City named after George Washington, it's the capital of the United States. `,
`Watching Cartoons - Not just for kids. `,
// `Watching Football - Sheer athletic prowess by players in peak physical condition is a glorious thing to behold. Pass the chips and beer. `,
// `Watching Football - Isn't it more fun to PLAY football? `,
`Watching TV - Cartoons and commercials, movies, commercials, shows, commercials, sports, and commercials. `,
`Water - Pure water has no color, taste or smell. So, if it smells funny, don't drink it. `,
`Water Balloons - I'll fill them and you tie them. `,
`Water Guns - Don't take them to school! `,
`Water Parks - You can go down Dead Man's Drop and I'll take the Lazy River. `,
`Water Skiing - Try it on one ski. `,
`Waterbeds - Could serve as a safety precaution for those who smoke in bed. `,
`Waterfalls - "Don't go chasing waterfalls..." -TLC `,
// `Waterfalls - Water flowing from a cliff or other high place. Niagara Falls is over 160 feet high! `,
`Watermelon - How far can you spit the seeds? `,
// `Watermelons - Pardeeville, WI - home of the Watermelon Seed-Spitting & Speed-Eating Championship. The record is 2.5 lbs. of melon eaten in 3.5 seconds. `,
`Waterparks - Wet and wild! `,
`Waxing The Floor - It's a pain in the neck, and back, and knees . . . `,
`Weapons Dealers - OK, what kind you need? Assault, Automatic, Atomic ...? `,
// `Weddings - "Ding, dong, the bells are gonna chime ..." -My Fair Lady `,
`Weddings - Here comes the bride! `,
// `Weed & Feed - Make sure the grass is greener on YOUR side of the fence. `,
// `Weird Al Yankovic - 1959-, American musical humorist, born Alfred Matthew Yankovic, which is nothing to laugh about . . . `,
`Whales - Very large animals that live in oceans. They squirt water from a blowhole. `,
`Wheat - Mainly used in flour. World output of wheat is more than 600 million metric tons a year ... so someone's making a lot of dough. `,
// `Wheel Of Fortune - American TV game show, BIG MONEY! BIG MONEY!. `,
// `Whipped Cream - Great on strawberry shortcake, banana splits, chocolate pudding ... `,
`Whipped Cream - Sweet and fluffy! `,
`Whips - "Crack that whip ... whip it, whip it good." -Devo `,
`Whips & Chains - Popular before prison reform - the good old days. `,
`White Bread - Plain and simple. `,
`White Collar Crime - Three strikes and you're OUT . . . to a cozy little low-level detention facility with a pool and tennis court. `,
// `Whoopie Goldberg - 1950-, American actor and comedian. Starred in such movies as Ghost, which earned her an Academy Award. Whoopee! `,
// `Will & Grace - Popular sitcom debuted in 1998. Not your average next door neighbors. `,
// `Will Smith - 1968- , Successful American rap star, TV star and wildly successful motion picture star. He's got it all. We hate him. `,
`William Shakespeare - 1564-1616, The English poet and playwright. And all the world IS a stage ... `,
// `Wimbledon - Strawberries ... cream ... temper tantrums ... `,
`Windsurfing - Really just surfing for lazy people. `,
`Wine Tasting - Spit or swallow? `,
`Winnie The Pooh - There's never enough honey for Pooh Bear! `,
`Winning A Trophy - Congratulations! `,
`Winning The Lottery - The more you play, the more THEY win. `,
`Winter - The coldest season of the year. `,
// `Wishbone - Star of television and over 50 books. Wishbone is a Jack Russell terrier. `,
`Witch Hunts - Popular locations: Salem, Massachusetts and Washington, D.C. `,
`Witches - They are famous for their pointy noses, black hats and broomsticks. `,
`Women - REAL Women. `,
// `Women's Soccer - The 1999 World Cup finals was the most-watched women's sporting event in history. `,
// `Wood Chippers - "I guess that was your accomplice in the wood chipper." -Marge Gunderson, Fargo `,
`Woodpeckers - They find insects to eat by pecking holes in wood with their beaks. `,
// `Woodstock - The 1969 love, music and mud festival attended by 400,000. Or, the little yellow bird. `,
// `Woody Allen - 1935- , American comedian, actor and director, of Bananas, Annie Hall, Hannah and Her Sisters, and lots of New York Stories. `,
`Woolly Mammoth - These large hairy elephants are now extinct. `,
`Working Out - No pain, no gain. `,
`Worms - A favorite food of robins. `,
// `Worms - "A man may fish with the worm that hath eat of a king, and eat of the fish that has fed of that worm." -"Hamlet" Shakespeare `,
`Wrestling - A sport where two people try to force each other to the ground. No hitting allowed. `,
`Writing A Letter - Dear Mom, How are you? I am fine. `,
`X-Ray Vision - Available to Superman -for emergency use only. `,
`X-Rays - X-Rays were discovered in 1895 by the German physicist Wilhelm Conrad Roentgen. Now if they could just get those X-ray glasses down. `,
// `Xena, Warrior Princess - Popular TV fantasy, adventure program. Xena, played by Lucy Lawless, and her friend Gabrielle, seek adventure and fight evil. `,
`Yellowstone Park - Home to 3000 geysers and hot springs. More gas and hot air than Washington, D.C. `,
`Yin & Yang - Two elements that oppose each other and give life balance. If you're lucky. `,
`Yo-Yos - There are lots of tricks that you can do with a yo-yo. `,
`Zebras - The stripes on each zebra are in a slightly different pattern. `,
`Zen - Japanese form of Buddhism, originated in China. Zen again, maybe not. `,
// `Zippers - Zip it, zip it good. `,
`Zippers - Faster than buttons. `,
`Zombies - Undead ghouls that feed off of brains. So WE'RE safe . . . `,
`Zucchini - A squashed vegetable. `,
`Donald Trump - 45th President of the United States. Enjoys firing people. `,
`Barack Obama - 44th President of the United States. Yes we can. `,
`Settlers of Catan - A popular German resource collecting and building game. `,
`Pears to Pears - This game. The one you're playing right now. `,
`Sushi - Literally means vinegar rice, often made with raw fish. `,
`Google - I'm feeling lucky. `,
`Facebook - We're watching you. `,
`Uber - Vote yes on Prop 22. `,
`Instacart - We will deliver your toilet paper. `,
`Covid-19 - Yep, still going... `,
`Tik Tok - Tweens only. `,
`The New York Times - Have you ever read one back to back? `,
`Lyft - We're cooler than Uber. `,
`Netflix - Three, two, one, autoplay. `,
`YouTube - Watch your favorite 20-year-olds earn millions. `,
`Zoom - Videoconference company. That's the sound our stock makes when it's going up. `,
`Wikipedia - A crowdsourced encyclopedia that's surprisingly accurate. `,
`University of Pennsylvania - Don't you dare confuse us with Penn State. `,
`Slack - Let's make work unproductive. `,
`LinkedIn - Such ..*yawn* interesting.. updates. `,
`Google Maps - The only map you can trust. `,
`Spotify - How do they make money again? `,
`Gmail - Must.. not.. check.. ooh one new email! `,
`Chrome - Incognito mode is definitely used to plan surprise parties. `,
`Firefox - But we're so indie... `,
`WeChat - We have more active users than anyone can imagine. `,
`Pinterest - Literally only used for 2-3 purposes. `,
`Yelp - Food was fantastic, but service was so slow and didn't refill my water. 1 star. `,
`Android OS - It is a known fact that Android users don't spend any money. `,
`iPhone - We release the same thing every year but everyone keeps buying anyways :D `,
`Data Scientists - We know Python better than we know English. `,
`Software Engineers - We built the thing you're using right now. `,
`Product Managers - An inexplicable role in tech that tells the entire team what to build but has no formal authority. `,
`Product Designers - Must make everything look CONSISTENT. `,
`Amazon - Buy everything now. `,
`Emojis - 🍆 `,
`Google Translate - I can understand ALL the languages. `,
`Twitter - 140 characters is too long... `,
`Reddit - r/AMA `,
`Zillow - I just need to know how much my neighbor's house is worth. `,
`Costco - Everyone's favorite membership-only warehouse club. `,
`Steinway Grand Piano - Starting at only $100,000. `,
`Playstation - Pure-sute-shion. `,
`Walmart - We're family run... sort of. `,
`Xbox - We're so hip and not corporate. `,
`Animal Crossing - Don't worry about the debt situation. Let me help you expand your living space.. - Tom Nook. `,
`Legend of Zelda - Apparently some of the best games ever made. `,
`Super Mario series - So many... can't keep track.. `,
`Mario Kart - Learn driving skills very transferable to the real world. `,
`Grand Theft Auto - Stab, shoot, and drive your way out of everything. `,
`Moomins - A family of mystical and fantastical hippo-like creatures living in Scandinavia. `,
`Pluto - No longer classified as a planet as of 2006. `,
`Cthulhu - A fictional cosmic entity created by horror writer H. P. Lovecraft. Has many tentacles and smells bad. `,
`Minecraft - A sandbox video game where you can literally build anything you can think of out of giant blocks. `,
`PayPal - Used to pay for your eBay purchases. `,
`eBay - The place you go when you can't find what you want on Amazon. `,
`Tesla - The electric car company run by eccentric billionaire Elon Musk. `,
`Japanese - Nihongo o hanashimasu ka. `,
`Godzilla - Also known as GO-JI-RA. `,
`Frederic Chopin - Cough cough. `,
`Ludwig van Beethoven - Dot dot dot dash. `,
`Wolfgang Amadeus Mozart - Composed minuets at age 5, symphonies at age 8. `,
`Franz Liszt - The source of Lisztomania. Women would faint at his piano concerts. `,
`Johann Sebastian Bach - Not to be confused with Carl Philipp Emanuel Bach. `,
`Tetris - Everyone's dying for an I-block. `,
`The Sims - Play a more boring version of your life. `,
`Skyrim - 10 years after release, still selling for $60. `,
`Final Fantasy - Can someone please explain what is going on in the story? `,
`Samsung - Korean conglomerate that makes everything from washing machines to phones. `,
`Social Media - You can forget about your real social life. `,
`Lion King - Hakuna Matata. `,
`The Little Mermaid - Under the sea, fish eat each other. `,
`Toy Story - I am never throwing away an old toy ever again. `,
`Toyota - Boring, safe, and dependable. `,
`Michelin-Starred Restaurants - Costs a lot but tastes amazing. `,
`Social Distancing - No offense but I don't trust your germs. `,
`Muggles - The non-magical people in the Harry Potter world. They got gypped. `,
`Winston Churchill - The leader of the United Kingdom during World War II. A rotund orotund orator. `,
`Anime - Not cartoons. Totally different from cartoons. `,
`Manga - What really delineates whether something is a comic book or a manga? `,
`Elon Musk - Founder and CEO of way too many companies. `,
`Mark Zuckerberg - 36 years old and worth $100 billion. So that means $2.8 billion per year? `,
`Jeff Bezos - Admit it, you have given him so much money already. `,
`Sloths - Instead of eating more, they just move less. `,
`Louis Vuitton - Extremely expensive (possibly overpriced) handbags. `,
`Rolex Watches - They do exactly the same thing as your $10 watch. `,
`Greek Yogurt - Extremely thick yogurt. Very high in protein. `,
`Fermented Shark - Also known as Hakarl, national dish of Iceland consisting of shark that's been fermented and left to dry for 4-5 months. `,
`Haggis - Savory pudding made out of sheep guts and random parts. `,
`Ramen - Can either be instant or not. `,
`Hot Pot - Great for a cold blustery day. `,
`Pad Thai - Literally means Thai stir fry. Popularized by the Thai government to galvanize nationalism. `,
`Fried Chicken - Amazingly delicious for how simple it is. `,
`Taiyaki - A fish-shaped sweet desert from Japan often filled with red bean paste. `,
`General Tso's Chicken - Apparently General Tso was a real person. `,
`Caviar - Very expensive fish eggs. Officially only refers to the roe of sturgeons. `,
`Red Lobster - American casual chain of restaurants specializing in (so-so) seafood. `,
`Planet Earth - A critically acclaimed BBC nature documentary series narrated by David Attenborough. Rated 9.4 on IMDB! `,
];
const greenCards = [
'Absurd - (ridiculous, senseless, foolish)',
'Abundant - (plentiful, ample, numerous)',
'Addictive - (obsessive, consuming, captivating)',
'Adorable - (lovable, charming, delightful)',
// 'Adorable - (lovable, cute)',
'Aged - (old, ancient, mature)',
'Amazing - (astonishing, surprising, wonderful)',
// 'Amazing - (surprising, wonderful)',
'American - (U.S. Citizen, Yankee, Apple Pie)',
'Ancient - (elderly, old, antique)',
'Animated - (lively, exuberant, spirited)',
'Annoying - (irritating, bothersome, teasing)',
// 'Annoying - (bothersome, irritating)',
'Appetizing - (appealing, tasty, flavorful)',
'Armed & Dangerous - (hazardous, threatening, fortified)',
'Arrogant - (egotistical, overconfident, conceited)',
'Attractive - (alluring, engaging, good-looking)',
// 'Attractive - (pretty, good-looking)',
'Awesome - (amazing, remarkable, majestic)',
'Awful - (very bad, horrible)',
'Awkward - (clumsy, bumbling, uncoordinated)',
'Bad - (rotten, hurtful)',
'Bashful - (shy, timid, modest)',
'Beautiful - (pretty, lovely)',
'Believable - (trustworthy, credible, convincing)',
'Best - (greatest, finest)',
'Big - (large, huge)',
'Big & Tall - (large, bulky, gigantic)',
'Bitter - (sour, tart)',
'Black & Blue - (bruised, battered, rough)',
'Black & White - (indisputable, distinct, written)',
'Bogus - (fraudulent, phony, insincere)',
'Boisterous - (loud, rambunctious, rowdy)',
'Bold - (daring, brave, courageous)',
// 'Bold - (daring, courageous)',
'Boring - (dull, tedious, monotonous)',
// 'Boring - (not interesting, dull)',
'Brains & Brawn - (solid, strong, capable)',
'Brave - (fearless, courageous)',
'Bright - (brilliant, radiant, shiny)',
// 'Bright - (light, intelligent)',
'Bright & Shining - (radiant, sparkling, gleaming)',
'Brilliant - (dazzling, gleaming, intelligent)',
'Brutal - (cruel, crude, harsh)',
'Bumpy - (lumpy, bouncy)',
'Busy - (occupied, meddlesome, engrossed)',
// 'Busy - (active, unavailable)',
'Calm - (peaceful, tranquil, placid)',
// 'Calm - (peaceful, still)',
'Careful - (cautious, thoughtful)',
'Caring - (concerned, interested)',
'Casual - (easygoing, blase, nonchalant)',
'Charismatic - (alluring, magnetic, charming)',
'Charming - (captivating, enchanting, fascinating)',
// 'Charming - (pleasant, polite)',
'Cheerful - (happy, lively)',
'Cheesy - (trashy, tawdry, far-fetched)',
'Chewy - (gummy, rubbery, stringy)',
'Chewy - (gummy, rubbery)',
'Chubby - (plump, round)',
'Chunky - (lumpy, chubby, bumpy)',
'Classic - (timeless, definitive, vintage)',
'Clean - (washed, pure, tidy)',
// 'Clean - (spotless, clear)',
'Clear - (understandable, uncluttered, transparent)',
'Clever - (intelligent, ingenious, witty)',
'Clueless - (unaware, oblivious, ignorant)',
'Clumsy - (awkward, bumbling, uncoordinated)',
// 'Clumsy - (awkward, not graceful)',
'Cold - (chilly, icy, aloof)',
'Cold - (cool, chilly)',
'Colorful - (vivid, brilliant, kaleidoscopic)',
// 'Colorful - (full of color, bright)',
// 'Comfortable - (cozy, snug, restful)',
'Comfortable - (cozy, pleasant)',
'Comical - (funny, hilarious, amusing)',
'Complicated - (difficult, complex, involved)',
'Conceited - (vain, smug, self-centered)',
'Confused - (muddled, bewildered, perplexed)',
'Confusing - (puzzling, weird)',
'Controversial - (contentious, disputable, debatable)',
'Cool - (chilly, hip, cold-blooded)',
// 'Cool - (not hot, chilled)',
'Cool & Collected - (controlled, composed, restrained)',
'Corrupt - (dishonest, underhanded, shady)',
'Cosmic - (limitless, planetary, far out)',
'Cosmopolitan - (sophisticated, urbane, well-informed)',
'Costly - (expensive, valuable)',
'Courageous - (brave, gallant, dauntless)',
// 'Courageous - (brave, bold)',
'Cowardly - (fearful, afraid, spineless)',
'Cozy - (comfortable, snug, warm)',
// 'Cozy - (comfortable, warm)',
'Cranky - (crabby, cantankerous, grouchy)',
'Crazed - (insane, wild, deranged)',
'Crazy - (insane, bizarre, wacky)',
// 'Crazy - (silly, foolish)',
'Creative - (imaginative, artistic, original)',
'Creepy - (frightening, slithering, scary)',
// 'Creepy - (spooky, scary)',
'Creepy & Crawly - (frightening, ghastly, icky)',
'Crisp - (brittle, brisk, fresh)',
'Crisp & Delicious - (tasty, crunchy, savory)',
'Crooked - (bent, not straight)',
'Cruel - (mean, harsh, merciless)',
'Cruel & Unusual - (barbaric, merciless, unwarranted)',
'Crunchy - (crispy, crackling)',
'Cuddly - (loving, tender, huggable)',
// 'Cuddly - (cozy, soft)',
'Curved - (bent, rounded)',
'Cut & Dried - (settled, obvious, indisputable)',
'Cute - (pretty, perky, delightful)',
// 'Cute - (pretty, good-looking)',
'Cute & Cuddly - (adorable, precious, huggable)',
'Dainty - (delicate, fragile, thin)',
'Dainty - (delicate, elegant)',
'Dangerous - (risky, chancy, hazardous)',
// 'Dangerous - (unsafe, risky)',
'Daring - (brave, bold)',
'Dark - (unlit, morbid, sinister)',
// 'Dark - (without light, nearly black)',
'Dashing - (gallant, bold, elegant)',
'Dazed & Confused - (stunned, bewildered, disoriented)',
'Dead - (deceased, expired, unresponsive)',
'Dead & Gone - (deceased, defunct, passe)',
'Deadly - (fatal, lethal, murderous)',
'Delicate - (dainty, tender, elegant)',
// 'Delicate - (breakable, dainty)',
'Delicious - (tasty, pleasing, appetizing)',
// 'Delicious - (tasty, pleasing)',
'Delightful - (pleasing, enjoyable, charming)',
'Demanding - (difficult, exacting, bothersome)',
'Depressing - (dismal, gloomy, sad)',
'Desperate - (frantic, headlong, reckless)',
'Devious - (sneaky, shifty, tricky)',
'Difficult - (complicated, hard)',
'Dignified - (stately, honorable, distinguished)',
'Dirty - (unclean, soiled, impure)',
// 'Dirty - (unclean, filthy)',
'Disgusting - (sickening, horrible)',
'Distinguished - (dignified, extraordinary, acclaimed)',
'Disturbing - (unsettling, troubling, worrisome)',
'Down & Dirty - (nasty, vicious, unscrupulous)',
'Down & Out - (destitute, impoverished, penniless)',
'Dramatic - (exciting, sensational, theatrical)',
'Dreamy - (fanciful, whimsical, heavenly)',
'Drunk & Disorderly - (intoxicated, unruly, rowdy)',
'Dull - (boring, stupid, blunt)',
// 'Dull - (not sharp, plain)',
'Dumb - (silent, not smart)',
// 'Dumb & Dumber - (stupid, dull, rediculous)',
'Dysfunctional - (impaired, damaged, maladjusted)',
'Earthy - (unrefined, natural, crude)',
'Easy - (effortless, gentle, promiscuous)',
// 'Easy - (simple, not hard)',
'Eccentric - (peculiar, odd, bizarre)',
'Edgy - (irritable, nervous, tense)',
'Elderly - (old, aged)',
'Elitist - (snobbish, arrogant, smug)',
'Emotional - (passionate, moving, volatile)',
'Enchanting - (captivating, charming, spell-binding)',
'Endangered - (at risk, threatened, unprotected)',
'Energetic - (active, vigorous, forceful)',
// 'Energetic - (active, lively)',
// 'Enjoyable - (pleasurable, entertaining, fun)',
'Enjoyable - (pleasant, fun)',
'Enormous - (large, huge, gigantic)',
// 'Enormous - (huge, gigantic)',
// 'Entertaining - (amusing, festive, enjoyable)',
'Entertaining - (interesting, fun)',
'Eternal - (timeless, immortal, perpetual)',
'European - (of Europe, from Europe, about Europe)',
'Evil - (wicked, corrupt, depraved)',
'Excellent - (very good, outstanding)',
'Exciting - (thrilling, breathtaking, arousing)',
// 'Exciting - (thrilling, interesting)',
'Exhausting - (weakening, tiring, draining)',
'Expensive - (costly, valuable, exorbitant)',
// 'Expensive - (costly, high priced)',
'Explosive - (bursting, blasting, dangerous)',
'Exquisite - (excellent, refined, flawless)',
'Extreme - (exceptional, superlative, radical)',
'Fabulous - (marvelous, wonderful, incredible)',
'Fake - (unreal, counterfeit, deceptive)',
'Famous - (well-known, celebrated, distinguished)',
// 'Famous - (well-known, important)',
'Fancy - (showy, ornate, decorated)',
// 'Fancy - (decorated, elegant)',
'Fantastic - (awesome, outrageous, imaginary)',
'Fascinating - (interesting, attractive)',
'Fashionable - (stylish, dashing, current)',
'Fast - (swift, quick, rapid)',
// 'Fast - (speedy, quick)',
'Fast & Furious - (wild, reckless, breakneck)',
// 'Fast & Loose - (deceitful, fraudulent, reckless)',
'Fat - (plump, thick)',
// 'Fat & Happy - (content, satisfied, assured)',
'Favorite - (preferred, desired)',
'Fearful - (scared, worried)',
'Feminine - (womanly, ladylike, unmanly)',
'Filthy - (dirty, foul, unclean)',
'Fine - (worthy, delicate, all right)',
'Flaky - (foolish, eccentric, crispy)',
'Flamboyant - (ornate, pompous, extravagant)',
'Flat - (smooth, level)',
'Flavorful - (tasty, savory, pungent)',
// 'Flavorful - (tasty, appetizing)',
'Flawed - (imperfect, defective, unsound)',
'Flirtatious - (brazen, saucy, forward)',
'Foot Loose & Fancy Free - (lighthearted, carefree, spontaneous)',
'Foreign - (alien, unfamiliar, exotic)',
'Fragile - (delicate, frail, breakable)',
// 'Fragile - (delicate, weak)',
'Fragrant - (aromatic, odorous, perfumed)',
'Frail - (fragile, weak)',
'Frazzled - (exhausted, frayed, worn)',
'Fresh - (new, original, good)',
'Fresh - (new, clean)',
'Friendly - (affectionate, comforting, welcoming)',
// 'Friendly - (kind, nice)',
'Frightening - (scary, horrifying, awesome)',
// 'Frightening - (scary, horrifying)',
'Frivolous - (trivial, silly, shallow)',
'Funky - (groovy, psychedelic, hip)',
'Fun - (enjoyable, playful, amusing)',
// 'Fun - (enjoyable, playful)',
// 'Funny - (amusing, comic, odd)',
'Funny - (silly, goofy)',
'Furious - (angry, raging, wild)',
'Furry - (hairy, fuzzy)',
// 'Fuzzy - (downy, unclear, furry)',
'Fuzzy - (furry, fuzz-covered)',
'Gentle - (tame, mild)',
'Gigantic - (huge, large)',
'Glamorous - (beautiful, dazzling, stylish)',
'Glitzy - (flashy, showy, gaudy)',
'Global - (world-wide, spherical, universal)',
'Gloomy - (dreary, depressing, sullen)',
'Glorious - (magnificent, delightful, splendid)',
'Good - (not bad, fine)',
'Goody-Goody - (sweet, well-behaved, virtuous)',
'Goofy - (silly, foolish, giddy)',
// 'Goofy - (silly, weird)',
'Gorgeous - (beautiful, stunning, magnificent)',
// 'Gorgeous - (beautiful, dazzling)',
'Graceful - (elegant, supple, limber)',
// 'Graceful - (elegant, flowing)',
'Great - (very good, important)',
'Grueling - (demanding, exhausting, strenuous)',
'Gruesome - (ghastly, hideous, grisly)',
'Grungy - (dirty, shabby, seedy)',
'Hairy - (not bald, furry)',
'Hale & Hearty - (healthy, vigorous, robust)',
'Handsome - (attractive, elegant, fine)',
'Handy - (convenient, available, capable)',
// 'Handy - (useful, helpful)',
'Happy - (glad, jolly)',
'Hard - (not soft, difficult)',
'Hardworking - (industrious, diligent, busy)',
// 'Hardworking - (industrious, careful)',
// 'Harmful - (hurtful, unhealthy, damaging)',
'Harmful - (hurtful, damaging)',
'Harsh - (severe, glaring, brutal)',
'Haunting - (unforgettable, bewitching, unearthly)',
'Hazardous - (risky, dangerous, perilous)',
'Healthy - (hearty, robust, wholesome)',
// 'Healthy - (not sick, well)',
'Heartless - (insensitive, cruel, uncaring)',
'Heavy - (not light, bulky)',
'Helpful - (useful, assisting)',
// 'High & Dry - (abandoned, alone, helpless)',
// 'High & Low - (everywhere, universally, all over)',
'High & Mighty - (arrogant, conceited, vain)',
'Hilarious - (funny, witty, amusing)',
'Hit & Miss - (sporadic, unreliable, erratic)',
'Honest - (trustworthy, truthful)',
'Honorable - (honest, just, virtuous)',
'Hopeless - (pessimistic, desperate, downhearted)',
'Horrible - (frightening, awful)',
'Horrifying - (offensive, abominable, disgusting)',
'Hostile - (antagonistic, aggressive, warlike)',
'Hot - (blazing, heated, spicy)',
// 'Hot - (very warm, heated)',
'Hot & Bothered - (annoyed, irritated, provoked)',
'Hot & Cold - (ambivalent, indecisive, varying)',
'Hot & Heavy - (passionate, momentous, serious)',
'Hot & Muggy - (sultry, humid, oppressive)',
'Hot & Spicy - (zesty, stimulating, pungent)',
'Hot & Sweaty - (sweltering, intense, perspiring)',
'Huge - (gigantic, immense, important)',
// 'Huge - (big, large)',
'Humorous - (funny, amusing, comical)',
'Icky - (sickening, disgusting, repulsive)',
'Ideal - (perfect, flawless, model)',
'Idiotic - (foolish, dumb, moronic)',
'Important - (significant, substantial, momentous)',
// 'Important - (valuable, worthwhile)',
'Industrious - (diligent, busy, hard-working)',
'Influential - (powerful, prominent, important)',
'Innocent - (guiltless, pure, naive)',
'Insane - (psychotic, deranged, mad)',
'Inspirational - (exhilarating, inspiring, stimulating)',
'Insulting - (offending, discourteous, rude)',
'Intelligent - (bright, smart, brainy)',
'Intense - (extreme, passionate, strained)',
'Interesting - (fascinating, exciting)',
'Irresistible - (overpowering, overwhelming, compelling)',
'Irritating - (annoying, troublesome, provoking)',
'Jolly - (cheerful, joyous, merry)',
// 'Jolly - (cheerful, fun)',
'Juicy - (drippy, luscious, tantalizing)',
'Juicy - (wet, squishy)',
'Kind - (nice, helpful)',
'Large - (big, not small)',
'Lazy - (lifeless, apathetic, weary)',
// 'Lazy - (slow, careless)',
'Lean & Mean - (vigorous, fit, efficient)',
'Legendary - (famous, distinctive, prominent)',
'Lewd & Lascivious - (lustful, obscene, indecent)',
'Light - (not dark, not heavy)',
'Light & Fluffy - (billowy, airy, soft)',
'Little - (small, tiny)',
'Lively - (cheerful, active)',
'Long - (not short, stretched)',
'Long & Lean - (slender, lanky, wiry)',
'Loud - (noisy, boisterous, deafening)',
// 'Loud - (noisy, not quiet)',
'Loud & Clear - (definite, explicit, unequivocal)',
'Lovable - (adorable, endearing, cuddly)',
// 'Lovable - (adorable, enchanting)',
'Loving - (caring, kind)',
'Lucky - (fortunate, serendipitous, favored)',
// 'Lucky - (fortunate, favored)',
'Lumpy - (bumpy, clumpy)',
'Luscious - (delicious, savory, juicy)',
'Luxurious - (opulent, lavish, sumptuous)',
'Magical - (enchanting, miraculous, marvelous)',
// 'Magical - (mysterious, delightful)',
'Manly - (masculine, virile, strong)',
'Masculine - (male, manly, virile)',
'Mean - (malicious, ill-tempered, petty)',
// 'Mean - (unkind, nasty)',
'Meek - (shy, mild, timid)',
// 'Meek & Mild - (timid, docile, gentle)',
'Melodramatic - (theatrical, sensational, showy)',
'Mesmerizing - (fascinating, hypnotizing, charming)',
'Messy - (sloppy, disorderly, unclean)',
// 'Messy - (sloppy, dirty)',
'Mischievous - (naughty, prankish, sly)',
'Miserable - (wretched, pitiful, forlorn)',
// 'Miserable - (unhappy, sorrowful)',
'Misunderstood - (not grasped, not learned, not absorbed)',
'Modern - (contemporary, fashionable, trendy)',
'Mushy - (soft, squishy)',
'Mysterious - (secretive, puzzling, strange)',
// 'Mysterious - (strange, secretive)',
'Mystical - (spiritual, secretive, esoteric)',
'Naive - (unsophisticated, childlike, simple)',
'Nasty - (mean, inclement, offensive)',
// 'Nasty - (mean, wicked)',
'Natural - (pure, simple, unadorned)',
// 'Natural - (normal, pure)',
'Naughty & Nice - (impish, mischievous, playful)',
'Neat - (tidy, orderly, cool)',
// 'Neat - (clean, orderly)',
// 'Neat & Clean - (spotless, tidy, shipshape)',
'Neglected - (ignored, disregarded, rejected)',
'Nerdy - (unhip, uncool, dorky)',
'New - (fresh, modern)',
'New & Improved - (upgraded, enhanced, revised)',
'Nice - (pleasant, kind)',
'Noisy - (loud, not quiet)',
'Normal - (usual, common, ordinary)',
'Nutty - (kooky, foolish, nutlike)',
'Obnoxious - (offensive, repulsive, annoying)',
'Obscene - (offensive, indecent, lewd)',
'Odd - (different, eccentric, bizarre)',
// 'Odd - (unusual, strange)',
'Offensive - (insulting, vulgar, attacking)',
'Old - (aged, elderly, antiquated)',
// 'Old - (not new, used)',
'Old & Cranky - (crabby, cantankerous, aged)',
'Old & Wise - (experienced, judicious, shrewd)',
'On The Up & Up - (trustworthy, irreproachable, honest)',
'Orderly - (methodical, formal, systematic)',
'Ordinary - (usual, common, plain)',
// 'Ordinary - (normal, common)',
'Organic - (natural, clean, biological)',
'Outrageous - (shocking, scandalous, disgraceful)',
'Overwhelming - (exhaustive, breathtaking, monumental)',
'Painful - (hurtful, agonizing, unbearable)',
// 'Painful - (hurting, sore)',
'Pale - (faded, colorless)',
'Pathetic - (pitiful, distressing, heart-rending)',
'Patriotic - (nationalistic, loyal, public-spirited)',
'Peaceful - (serene, restful, calm)',
// 'Peaceful - (calm, quiet)',
'Perfect - (faultless, consummate, exact)',
// 'Perfect - (ideal, wonderful)',
'Perverse - (stubborn, obstinate, improper)',
'Philosophical - (thoughtful, contemplative, wise)',
'Phony - (false, artificial, imitation)',
'Plain - (simple, evident, ordinary)',
// 'Plain - (simple, dull)',
'Plain & Simple - (unadorned, uncomplicated, clear)',
'Playful - (fun, frisky, entertaining)',
// 'Playful - (fun, cheerful)',
'Pleasant - (enjoyable, nice)',
'Plug & Play - (effortless, automatic, self-operating)',
'Plump & Tender - (ripe, chubby, fleshy)',
'Polite - (respectful, well-mannered)',
'Poor - (not rich, unfortunate)',
'Popular - (well-liked, accepted, preferred)',
'Powerful - (strong, forceful, robust)',
// 'Powerful - (strong, forceful)',
'Practical - (useful, helpful)',
'Pretty - (lovely, attractive, good-looking)',
// 'Pretty - (good-looking, pleasing)',
'Prim & Proper - (reserved, modest, prudish)',
'Primitive - (prehistoric, primal, uncivilized)',
'Principled - (conscientious, ethical, scrupulous)',
'Profound - (deep, wise, thoughtful)',
'Proud - (dignified, satisfied)',
'Puffy - (swollen, billowy, bloated)',
'Pure - (innocent, unadulterated, chaste)',
'Quick - (fast, speedy)',
'Quick & Dirty - (cheap, shoddy, inferior)',
'Quiet - (peaceful, silent, calm)',
// 'Quiet - (silent, noiseless)',
'Radiant - (shining, glowing, sparkling)',
// 'Radical - (unconventional, revolutionary, extreme)',
'Rare - (scarce, unusual, half-cooked)',
'Raw - (crude, uncooked, harsh)',
'Realistic - (authentic, lifelike, reasonable)',
'Refreshing - (brisk, invigorating, rejuvenating)',
'Refined - (well-bred, purified, cultivated)',
'Relaxed - (calm, not tense)',
'Relaxing - (restful, calming, peaceful)',
'Repulsive - (disgusting, offensive, foul)',
'Respectable - (worthy, honorable, decent)',
'Responsible - (accountable, obligated, mature)',
'Revolutionary - (innovative, rebellious, radical)',
'Rich - (wealthy, affluent, moneyed)',
// 'Rich - (wealthy, not poor)',
'Ridiculous - (preposterous, absurd, ludicrous)',
'Risky - (hazardous, daring, speculative)',
'Rough - (scratchy, uneven, jagged)',
// 'Rough - (not smooth, not gentle)',
'Rough & Ready - (crude, makeshift, prepared)',
'Round - (circular, ring shaped)',
'Sad - (unhappy, gloomy)',
'Saintly - (virtuous, angelic, divine)',
'Sappy - (gooey, mushy, romantic)',
'Scary - (frightening, absurd, ugly)',
// 'Scary - (frightening, spooky)',
'Scenic - (picturesque, dramatic, panoramic)',
'Scented - (perfumed, fragrant)',
'Secretive - (concealed, covert, veiled)',
'Selfish - (stingy, greedy, miserly)',
'Sensational - (thrilling, startling, melodramatic)',
'Senseless - (meaningless, absurd, foolish)',
'Sensitive - (susceptible, sympathetic, tender)',
'Sensual - (tactile, pleasing, sexual)',
'Serious - (important, thoughtful)',
'Sexy - (arousing, appealing, seductive)',
'Shaggy - (bushy, stringy)',
'Shallow - (superficial, trivial, not deep)',
'Sharp - (pointed, keen, acute)',
// 'Sharp - (pointed, not rounded)',
'Shiny - (reflective, gleaming, polished)',
// 'Shiny - (bright, glossy)',
'Shocking - (frightening, electrifying, startling)',
'Short - (not long, not tall)',
'Short & Stout - (plump, portly, tubby)',
'Short & Sweet - (precise, clear-cut, succinct)',
'Shy - (bashful, timid, cautious)',
// 'Shy - (bashful, timid)',
'Sick & Tired - (worn out, exhausted, exasperated)',
'Sick & Twisted - (depraved, wicked, lascivious)',
'Sickening - (nauseating, disgusting, revolting)',
// 'Sickening - (disgusting, horrible)',
'Silent - (quiet, still)',
'Silky - (smooth, soft)',
// 'Silly - (goofy, absurd, nonsensical)',
'Silly - (foolish, goofy)',
'Simple - (plain, easy)',
'Skillful - (expert, talented)',
'Skinny - (thin, lean)',
'Slender - (slim, small)',
'Slimy - (slippery, gooey)',
'Slippery - (slick, sliding)',
'Sloppy - (messy, careless)',
'Slow - (not fast, pokey)',
'Slow & Steady - (reliable, deliberate, ponderous)',
'Sluggish - (inactive, lazy, slothful)',
'Small - (little, not large)',
'Smart - (intelligent, stylish, witty)',
// 'Smart - (intelligent, clever)',
'Smelly - (stinky, odorous, rank)',
// 'Smelly - (stinky, bad odor)',
'Smooth - (even, level, flat)',
// 'Smooth - (not bumpy, flat)',
'Smooth & Creamy - (silky, velvety, rich)',
'Snappy - (stylish, trendy, fast)',
'Sneaky - (tricky, mean)',
'Soft - (malleable, pliable, mushy)',
'Soft - (not hard, tender)',
'Sophisticated - (urbane, cosmopolitan, complex)',
'Sour - (bitter, tart)',
'Special - (distinctive, unique, original)',
// 'Special - (individual, unique)',
'Speedy - (quick, rapid, fast)',
// 'Speedy - (quick, fast)',
'Spic & Span - (spotless, tidy, clean)',
'Spicy - (flavorable, tangy, hot)',
'Spiritual - (religious, inspired, supernatural)',
'Spooky - (scary, weird, ghostly)',
// 'Spooky - (scary, frightening)',
'Sporty - (athletic, active)',
'Spotless - (clean, pure)',
'Spunky - (perky, lively, spirited)',
'Square - (rectangular, uncool, dull)',
'Squeaky Clean - (pure, immaculate, unapproachable)',
'Stereotyped - (pigeonholed, caricatured, characterized)',
'Sticky - (gummy, pasty)',
'Stinky - (smelly, bad odor)',
'Straight - (not curved, direct)',
'Strange - (odd, unusual)',
'Strong - (powerful, forceful)',
'Stunning - (astonishing, staggering, astounding)',
'Stupid - (ignorant, unintelligent, inane)',
'Sultry - (sweltering, humid, sensual)',
'Surprising - (unexpected, amazing)',
'Sweet - (sugary, caring, good)',
// 'Sweet - (sugary, nice)',
'Swift - (quick, speedy, expeditious)',
'Swift & Sure - (steady, prompt, definite)',
'Talented - (gifted, clever, skillful)',
// 'Talented - (skillful, gifted)',
'Tall - (not short, not low)',
'Tame - (subdued, gentle, trained)',
// 'Tame - (not wild, mild)',
'Tasty - (flavorful, savory, appetizing)',
// 'Tasty - (flavorful, yummy)',
'Technological - (scientific, futuristic, mechanical)',
'Temperamental - (moody, irritable, short-tempered)',
'Tempting - (seductive, enticing, alluring)',
'Tender - (soft, compassionate, fragile)',
'Terrible - (awful, dreadful)',
'Terrific - (sensational, fabulous, severe)',
'Thick - (wide, solid)',
'Thick & Chunky - (bulky, heavy, lumpy)',
'Thin - (skinny, narrow)',
'Thoughtful - (caring, unselfish)',
'Timeless - (classic, ageless, well-established)',
'Tiny - (little, very small)',
'Tormenting - (torturing, harassing, agonizing)',
'Torn & Tattered - (shabby, ragged, grungy)',
'Touch & Go - (indecisive, uncertain, insecure)',
'Touchy-Feely - (affectionate, tactile, huggy)',
'Tough - (strong, firm, difficult)',
'Tough - (strong, hard)',
'Trashy - (shameless, nasty, indecent)',
'Tried & True - (tested, proven, trustworthy)',
// 'True & Blue - (loyal, faithful, patriotic)',
'Trustworthy - (honest, reliable, unfailing)',
// 'Trustworthy - (dependable, honest)',
'Twisted - (distorted, warped, perverted)',
'Ugly - (not pretty, unpleasant)',
'Unbelievable - (incredible, far-fetched, impossible)',
'Unforgettable - (notable, impressive, remarkable)',
// 'Unforgettable - (memorable, treasured)',
'Unhappy - (sad, sorrowful)',
'Unhealthy - (risky, sickly, dangerous)',
'Unnatural - (abnormal, artificial, bizarre)',
'Unreal - (imaginary, illusionary, unbelievable)',
'Unscrupulous - (unethical, corrupt, unprincipled)',
'Unusual - (rare, odd, uncommon)',
'Untamed - (wild, natural)',
'Up & Coming - (promising, enterprising, gifted)',
'Up & Down - (volatile, variable, vertical)',
'Useful - (helpful, handy)',
'Useless - (worthless, ineffective, unneeded)',
// 'Useless - (worthless, not valuable)',
'Vain - (conceited, arrogant, fruitless)',
'Valuable - (expensive, important)',
'Violent - (furious, vicious, destructive)',
'Virtuous - (worthy, righteous, chaste)',
'Visionary - (idealistic, prophetic, far-seeing)',
'Warm - (tepid, mild, affectionate)',
// 'Warm - (heated, somewhat hot)',
'Warm & Cozy - (snug, comfy, friendly)',
'Warm & Fuzzy - (kindhearted, loving, affectionate)',
// 'Wash & Wear - (durable, easy-care, sturdy)',
'Weak - (not strong, sickly)',
'Weird - (abnormal, peculiar, odd)',
'Weird - (odd, mysterious)',
'Wet - (watery, soaked)',
'Whimsical - (humourous, peculiar, fanciful)',
'Wicked - (evil, corrupt, depraved)',
'Wide - (broad, thick)',
'Wild - (untamed, savage, ferocious)',
// 'Wild - (not tame, crazy)',
'Wild & Wooly - (untamed, uncontrolled, reckless)',
'Wired - (strained, tense, nervous)',
'Witty - (clever, humorous, cunning)',
// 'Woebegone - (dismal, sorrowful, bummed out)',
'Wonderful - (great, excellent)',
'Worldly - (experienced, sophisticated, materialistic)',
'Worthless - (useless, meaningless)',
'Young - (not old, new)',
'Young & Restless - (fidgety, impatient, flighty)',
'Yucky - (icky, sickening)',
'Zany - (crazy, funny, wacky)',
];
|
1abd10f40d3ce3b707d8fefca51562f607e33525
|
TypeScript
|
tai-deng/chicken
|
/chicken/assets/script/gamecore/.svn/pristine/1a/1abd10f40d3ce3b707d8fefca51562f607e33525.svn-base
| 2.5625
| 3
|
const {ccclass, property} = cc._decorator;
/**
* 定义位置常量
*/
export enum GameCoreLocation {
//顶部居中
TOP_CENTER = "TC",
//顶部靠左
TOP_LEFT = "TL",
//顶部靠右
TOP_RIGHT = "TR",
//底部居中
BOTTOM_CENTER = "BC",
//底部靠左
BOTTOM_LEFT = "BL",
//底部靠右
BOTTOM_RIGHT = "BR"
}
|
8c266923d19f194977754da21b27c3bdc840ffe4
|
TypeScript
|
crainsaw/SmartHeater
|
/src/heating/logic/trainItemGenerator.ts
| 2.890625
| 3
|
import { EnvironmentProvider, Environment } from '../../environment/environmentProvider';
import { TrainingItem } from './heatTimePredictor';
import HeaterController from './heaterController';
export type TrainItemListener = (item: TrainingItem) => void
/**
* Creates training items
*/
export default class TrainItemGenerator {
/**
*
*/
protected listeners: TrainItemListener[] = []
/**
*
* @param heaterController
* @param envReader
*/
constructor(heaterController: HeaterController, envReader: EnvironmentProvider) {
heaterController.addStatusChangeListener((toggled, enabled, targetTemp) => this.heaterListener(toggled, enabled, targetTemp))
envReader.subscribe((env) => this.envListener(env))
}
/**
*
*/
protected curItem: TrainingItem | null = null
/**
*
* @param enabled
* @param targetTemperature
*/
protected heaterListener(toggled: boolean, enabled: boolean, targetTemperature: number): void {
if (!toggled) return
if (enabled === false && this.curItem !== null) {
if (this.curItem.snapshots.length > 1) {
this.publishItem(this.curItem)
}
this.curItem = null
}
if (enabled === true) {
this.curItem = {
startTimestamp: Date.now(),
recentHeaterUsage: -1,
snapshots: []
}
}
}
/**
*
* @param environemt
*/
protected envListener(environemt: Environment) {
if (this.curItem !== null) {
const minsSinceStart = Math.round((Date.now() - this.curItem.startTimestamp) * 1.0 / 1000 / 60)
this.curItem.snapshots.push({
minsSinceStart: minsSinceStart,
environment: environemt
})
}
}
/**
*
* @param item
*/
protected publishItem(item: TrainingItem): void {
for (const listener of this.listeners) {
listener(item)
}
}
/**
*
* @param listener
*/
public addListener(listener: TrainItemListener): void {
this.listeners.push(listener)
}
}
|
c855491943f77848597fc7a738f2ab3d336f72f1
|
TypeScript
|
kentico-anthonym/kontent-delivery-sdk-js
|
/test-browser/setup/observable-factory.ts
| 2.65625
| 3
|
import { Observable, zip } from 'rxjs';
import { map } from 'rxjs/operators';
import { IDeliveryClient, IQueryConfig } from '../../lib';
import { AllTestObjects, Movie } from './models';
export class ObservableFactory {
private readonly movieCodename: string = 'warrior';
private readonly taxonomyCodename: string = 'movietype';
private readonly typeCodename: string = 'movie';
private readonly elementCodename: string = 'title';
/**
* Gets single observable containing all test object types
* @param client
* @param queryConfig
*/
getAllTestObjects(client: IDeliveryClient, queryConfig?: IQueryConfig): Observable<AllTestObjects> {
const all: AllTestObjects = new AllTestObjects();
if (!queryConfig) {
queryConfig = {};
}
const observables: Observable<any>[] = [];
const itemObs = client.item<Movie>(this.movieCodename).queryConfig(queryConfig).toObservable().pipe(map(r => all.item = r));
const itemsObs = client.items<Movie>().queryConfig(queryConfig).toObservable().pipe(map(r => all.items = r));
const taxonomyObs = client.taxonomy(this.taxonomyCodename).queryConfig(queryConfig).toObservable().pipe(map(r => all.taxonomy = r));
const taxonomiesObs = client.taxonomies().queryConfig(queryConfig).toObservable().pipe(map(r => all.taxonomies = r));
const typeObs = client.type(this.typeCodename).queryConfig(queryConfig).toObservable().pipe(map(r => all.type = r));
const typesObs = client.types().queryConfig(queryConfig).toObservable().pipe(map(r => all.types = r));
const elementObs = client.element(this.typeCodename, this.elementCodename).queryConfig(queryConfig).toObservable().pipe(map(r => all.element = r));
observables.push(itemObs);
observables.push(itemsObs);
observables.push(taxonomyObs);
observables.push(taxonomiesObs);
observables.push(typeObs);
observables.push(typesObs);
observables.push(elementObs);
const zippedObservable = this.zipObservables(observables);
return zippedObservable.pipe(map(() => all));
}
zipObservables(observables: Observable<any>[]): Observable<any[]> {
if (!observables) {
throw Error(`Given observables are not valid`);
}
if (!Array.isArray(observables)) {
throw Error(`Given observables are not in array`);
}
if (observables.length === 0) {
throw Error(`Observables array doesn't contain any observable`);
}
if (observables.length === 1) {
return observables[0];
}
let zippedObservable: Observable<any[]> = observables[0];
for (let i = 1; i < observables.length; i++) {
const currentObservable = observables[i];
zippedObservable = zip(zippedObservable, currentObservable);
}
return zippedObservable;
}
}
export const observableFactory = new ObservableFactory();
|
2edad4dc89660cf3b03bd5c3e2efe0c95ec22914
|
TypeScript
|
Esteban-Rocha/codefights
|
/js/src/century/century.ts
| 3.421875
| 3
|
// @ts-check
/**
* JavaScript Century Challenge
* @author Esteban Rocha
* @link https://github.com/Esteban-Rocha
*/
/**
* @param year number
* @return number
*/
function centuryFromYear(year: number) {
// Get param and calculate it's century
const result: number = Math.trunc((year + 99) / 100);
return result;
}
/**
* @return void
*/
export function test(): void {
// Run tests
console.log(centuryFromYear(5584));
console.log(centuryFromYear(295));
console.log(centuryFromYear(2013));
console.log(centuryFromYear(1495));
}
|
feebcc07f6368a0369193f4ebe9ec1c39b3be710
|
TypeScript
|
PRNDcompany/canvas-object
|
/src/graphics/Circle.ts
| 3.1875
| 3
|
import { DisplayObject, DisplayObjectOptions } from './DisplayObject';
const PI2 = Math.PI * 2;
export interface CircleOptions extends DisplayObjectOptions {
radius: number;
startAngle?: number;
endAngle?: number;
}
export class Circle extends DisplayObject {
public radius: number;
public startAngle: number;
public endAngle: number;
constructor({ position, radius, alpha, color, startAngle, endAngle, scale, rotation }: CircleOptions) {
super({ position, alpha, color, scale, rotation });
this.radius = radius;
this.startAngle = startAngle || 0;
this.endAngle = endAngle || PI2;
}
public render(context: CanvasRenderingContext2D) {
context.save();
context.beginPath();
context.fillStyle = this.color;
context.globalAlpha = this.alpha;
context.arc(this.position.x * this.scale, this.position.y * this.scale, this.radius * this.scale, this.startAngle, this.endAngle);
context.fill();
context.restore();
}
}
|
6acb7fb8b973bd55784ff31e63a82d1e00106a11
|
TypeScript
|
varundhariyal/Typescript-Class
|
/index.ts
| 2.71875
| 3
|
console.log('Youtube Class Section')
// youtube class
class YoutubeVideo {
// fields/properties with public access modifier
videoTitle: string;
numberOfViews: number;
youtubeChannel: string;
videoDescription: string;
numberOfLikes: number;
numberOfDislikes: number;
numberOfSubscriber: number;
numberOfComments: number;
upnextVideos: number;
// constructor
constructor(title: string, views: number, channel: string, aboutVideo: string, likes: number, dislikes: number, subscriber: number, comments: number, nextvideos: number) {
this.videoTitle = title;
this.numberOfViews = views;
this.youtubeChannel = channel;
this.numberOfLikes = likes;
this.videoDescription = aboutVideo;
this.numberOfDislikes = dislikes;
this.numberOfSubscriber = subscriber;
this.numberOfComments = comments;
this.upnextVideos = nextvideos;
}// end constructor
// setter method .Moreover,we can directly access fields as access modifier is public
getVideoTitle = () => {
return this.videoTitle;
}
getNumberOfViews = () => {
return this.numberOfViews;
}
getYoutubeChannel = () => {
return this.youtubeChannel;
}
getnumberOFLikes = () => {
return this.numberOfLikes;
}
getNumberOfDislikes = () => {
return this.numberOfDislikes;
}
getNumberOfSubscriber = () => {
return this.numberOfSubscriber;
}
getComments = () => {
return this.numberOfComments;
}
getNextVideo = () => {
return this.upnextVideos;
}
getAbout = () => {
return this.videoDescription;
}
// getter method
setViews = (viewsUpdate: number) => {
return this.numberOfViews = viewsUpdate;
}
setSubscriber = (updateSubscriber: number) => {
return this.numberOfSubscriber = updateSubscriber;
}
}
// end class
// defining a object
let Sanju = new YoutubeVideo('Sanju Official Trailer', 40000000, 'Fox Star Hindi', 'Sanju is a hilarious and heartbreaking exploration of one man’s battle against his own wild self and the formidable external forces trying to crush him. ', 795000, 32000, 1300000, 73000, 10)
console.log('Video Title', Sanju.getVideoTitle());
console.log('views =', Sanju.getNumberOfViews());
// update views
console.log('Updated Views =', Sanju.setViews(5000000));
console.log('Subscriber =', Sanju.getNumberOfSubscriber());
// update subscriber
console.log('Updated Subscriber =', Sanju.setSubscriber(1400000));
console.log('Likes=', Sanju.getnumberOFLikes());
console.log('Dislikes =', Sanju.getNumberOfDislikes());
console.log('Youtube Channel =', Sanju.getYoutubeChannel());
console.log('Video Description =', Sanju.getAbout());
console.log('Comments =', Sanju.getComments());
console.log('Upnext Videos =', Sanju.getNextVideo());
// Facebook class
class SocialProfile {
// will be using public access modifier & define fields inside a constructor
constructor(public profileName: string, public about: string, public birthday: string, public email: string, public phoneNumber: string, public currentPlace: string, public hometown: string, public education: string, public friends: number, public languages: string, public relationship: string, public numberOfPhotos: number, public pageLiked: number, public numberOfAppsandGames: number, public numberOfCheckins: number) {
this.profileName = profileName;
this.about = about;
this.birthday = birthday;
this.email = email;
this.phoneNumber = phoneNumber;
this.currentPlace = currentPlace;
this.hometown = hometown;
this.education = education;
this.friends = friends;
this.languages = languages;
this.relationship = relationship;
this.numberOfPhotos = numberOfPhotos;
this.pageLiked = pageLiked;
this.numberOfAppsandGames = numberOfAppsandGames;
this.numberOfCheckins = numberOfCheckins;
}
// getter method,we can directly access fields as access modifier is public also.
getage = () => {
return this.birthday;
}
getname = () => {
return this.profileName;
}
getabout = () => {
return this.about;
}
getemail = () => {
return this.email;
}
getphonenumber = () => {
return this.phoneNumber;
}
getcurrentplace = () => {
return this.currentPlace;
}
gethome = () => {
return this.hometown;
}
getedu = () => {
return this.education;
}
getfriends = () => {
return this.friends;
}
getlang = () => {
return this.languages;
}
getphotos = () => {
return this.numberOfPhotos;
}
getpagelike = () => {
return this.pageLiked;
}
getapp = () => {
return this.numberOfAppsandGames;
}
getcheckin = () => {
return this.numberOfCheckins;
}
// setter method
// update currentplace
setcurrentplace = (updateplace: string) => {
return this.currentPlace = updateplace;
}
// update number of friends
setfriends = (updatefriend: number) => {
return this.friends = updatefriend;
}
}
// define a object
console.log('Facebook Class Section')
let Varun = new SocialProfile('Varun Dhariyal', 'Rise Till Nirvana', '23 October', 'varundhariyal@gmail.com', '8800xxxxxx', 'Noida', 'Lucknow', 'Galgotias College', 1200, 'Hindi,English', 'Single', 23, 31, 5, 10)
console.log('Name=', Varun.profileName);
console.log('About Me=', Varun.about);
console.log('Birthday is on ', Varun.getage());
console.log('Email =', Varun.getemail());
console.log('Mobile NUmber ', Varun.getphonenumber());
console.log('Current place= ', Varun.getcurrentplace());
// update current place to delhi
console.log("updated current place=", Varun.setcurrentplace('Delhi'));
console.log("Hometown=", Varun.hometown);
console.log('Studies In ', Varun.getedu());
console.log('Friends =', Varun.friends);
// update friend count
console.log('Updated Friends Count =', Varun.setfriends(1223));
console.log('Languages Known ', Varun.languages);
console.log('Relationship Status ', Varun.relationship);
console.log('NUmber Of Photos Uploaded =', Varun.getphotos());
console.log("Pages Liked =", Varun.getpagelike());
console.log('Number of Apps & Games', Varun.getapp());
console.log('Number Of Checkins =', Varun.getcheckin());
|
a7b9d98a138b5b069951f804f137bef65860eeba
|
TypeScript
|
Kuroko5/syndicate-web-app
|
/src/app/pipes/name-format.pipe.ts
| 3.015625
| 3
|
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'nameFormat'
})
export class NameFormatPipe implements PipeTransform {
/**
* Capitalize the string
* @param str The string to captitalyze
*/
private capitalize(str: string): string {
return str[0].toUpperCase() + str.slice(1);
}
transform(value: any, ...args: any[]): any {
if (!value || !value.includes('.')) {
return value;
}
const splitted = value.split('.');
return `${this.capitalize(splitted[0])} ${this.capitalize(splitted[1])}`;
}
}
|
67e1ace1c24585636295b181ceca8034da7f5eea
|
TypeScript
|
Paulotx/ignite-tests-challenge
|
/src/modules/users/useCases/createUser/CreateUserUseCase.spec.ts
| 2.671875
| 3
|
import { InMemoryUsersRepository } from "../../repositories/in-memory/InMemoryUsersRepository";
import { CreateUserError } from "./CreateUserError";
import { CreateUserUseCase } from "./CreateUserUseCase";
let inMemoryUsersRepository: InMemoryUsersRepository;
let createUser: CreateUserUseCase;
describe("CreateUserUseCase", () => {
beforeEach(() => {
inMemoryUsersRepository = new InMemoryUsersRepository();
createUser = new CreateUserUseCase(inMemoryUsersRepository);
});
it("should be able to crate a new user", async () => {
const user = await createUser.execute({
name: "User",
email: "test@gmail.com",
password: "123456",
});
expect(user).toHaveProperty("id");
});
it("should not be able to create a new user with same email from another", async () => {
await createUser.execute({
name: "User 01",
email: "test@gmail.com",
password: "123456",
});
await expect(
createUser.execute({
name: "User 02",
email: "test@gmail.com",
password: "123456",
}),
).rejects.toBeInstanceOf(CreateUserError);
});
});
|
21919d6c83c207131a0f7a8e77d4452f5ea02688
|
TypeScript
|
ravisharmabhattarai/angular-component-architecture
|
/src/app/common-data/widgets.service.ts
| 2.578125
| 3
|
import { Injectable } from '@angular/core';
import { Widget } from './widget.model';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { of } from 'rxjs/observable/of';
import { UUID } from 'angular2-uuid';
const MOCK_WIDGETS = [
{
"id": 1,
"name": "Red Widget",
"price": 100,
"description": "This is a red widget"
},
{
"id": 2,
"name": "Orange Widget",
"price": 200,
"description": "This is an orange widget"
},
{
"id": 3,
"name": "Yellow Widget",
"price": 300,
"description": "This is a yellow widget"
},
{
"id": 4,
"name": "Green Widget",
"price": 400,
"description": "This is a green widget"
},
{
"id": 5,
"name": "Blue Widget",
"price": 500,
"description": "This is a blue widget"
},
{
"id": 6,
"name": "Indigo Widget",
"price": 600,
"description": "This is a indigo widget"
},
{
"id": 7,
"name": "Violet Widget",
"price": 700,
"description": "This is a violet widget"
}
];
@Injectable()
export class WidgetsService {
widgets = [...MOCK_WIDGETS] as Widget[];
constructor(private http: HttpClient) {
}
all() {
return of(this.widgets)
}
create(widget: Widget) {
const payload = {...widget, id: UUID.UUID()};
this.widgets = [...this.widgets, payload];
return of(payload);
}
update(widget: Widget) {
this.widgets = this.widgets.map(wdgt => {
if(widget.id === wdgt.id) {
return Object.assign({}, widget);
} else {
return wdgt;
}
})
return of(widget);
}
delete(widget: Widget) {
this.widgets = this.widgets.filter(wdgt => widget.id !== wdgt.id)
return of(widget);
}
}
|
348d897f345732ec7004847b5e4a9ab522ac5a1a
|
TypeScript
|
we-do-good-tech/wave2-project3
|
/src/saga/users/actions.ts
| 2.703125
| 3
|
import { usersTypes } from '../types';
import { IUsersState } from './reducer';
const loadUsers = () => {
return {
type: usersTypes.LOAD_USERS,
};
};
const updateUser = (name: string, id: string) => {
return {
type: usersTypes.UPDATE_USER,
payload: { name, id },
};
};
const setAdmin = (id: string, admin: boolean) => {
return {
type: usersTypes.SET_ADMIN,
payload: { id, admin },
};
};
const createUser = (username: string, password: string) => {
return {
type: usersTypes.CREATE_USER,
payload: { username, password },
};
};
const deleteUser = (id: string) => {
return {
type: usersTypes.DELETE_USER,
payload: { id },
};
};
const loadUsersFailed = (error: string) => {
return {
type: usersTypes.LOAD_USERS_FAILED,
payload: { error },
};
};
const loadUsersSuccess = (payload: Partial<IUsersState>) => {
return {
type: usersTypes.LOAD_USERS_SUCCESS,
payload: payload,
};
};
const usersActions = {
loadUsers,
createUser,
updateUser,
deleteUser,
loadUsersFailed,
loadUsersSuccess,
setAdmin,
};
export default usersActions;
|
18deaf91f39988097724a648e05db3a48444113b
|
TypeScript
|
Rainboylvx/pcs
|
/_src/frontEnd/src/utils.ts
| 2.96875
| 3
|
//[JavaScript 函数防抖的实现](https://www.freecodecamp.org/chinese/news/javascript-debounce-example/)
export function debounce(func:any, timeout = 300){
let timer:any;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
|
3666cbbe4a12c171fab8039fd3933317f3cb0a2c
|
TypeScript
|
cloudfoundry/stratos
|
/src/frontend/packages/store/src/entity-catalog/entity-catalog.store-setup.ts
| 2.71875
| 3
|
import { IRequestTypeState } from '../app-state';
export function getDefaultStateFromEntityCatalog<T = any>(entityKeys: string[], defaultState: T, initialState: IRequestTypeState) {
return entityKeys.reduce((currentState, entityKey) => {
if (currentState[entityKey]) {
return currentState;
}
return {
...currentState,
[entityKey]: defaultState
};
}, initialState) as T;
}
|
2405cd518e3c99461775d64b53dee3427e774189
|
TypeScript
|
agolomazov/react-hooks-ts
|
/src/features/todo/ducks/reducer.ts
| 2.984375
| 3
|
import { uuidv4 } from '../../../common/utils';
import {
TodoState,
TodoActionTypes,
TodoAdd,
Todo,
TodoCompleted,
TodoRemove,
Todos,
TodoSearch,
TODO_ADD,
TODO_COMPLETED,
TODO_REMOVE,
TODO_SEARCH,
TODO_FETCH_START,
TODO_FETCH_STOP,
TodoFill,
TODO_FILL,
} from '../types';
export const initialState: TodoState = {
todos: [],
search: {
searchText: ''
},
isLoading: false
};
const addTodo = (state: TodoState, { payload }: TodoAdd): TodoState => ({
...state,
todos: [
...state.todos,
{
...payload,
id: uuidv4()
}
]
});
const completedTodo = (state: TodoState, { payload }: TodoCompleted): TodoState => {
const todos = state.todos;
const newTodos = todos.map((todo: Todo): Todo => {
if (todo.id === payload.id) {
return {
...todo,
completed: payload.completed
};
}
return todo;
});
return {
...state,
todos: newTodos
};
};
const removeTodo = (state: TodoState, { payload }: TodoRemove): TodoState => {
const { todos } = state;
const newTodos: Todos = todos.filter((todo:Todo) => todo.id !== payload)
return {
...state,
todos: newTodos
}
};
const searchTodo = (state: TodoState, { payload }: TodoSearch): TodoState => ({
...state,
search: payload
});
const fetchStart = (state: TodoState): TodoState => ({
...state,
isLoading: true,
});
const fetchStop = (state: TodoState): TodoState => ({
...state,
isLoading: false,
});
const todoFill = (state: TodoState, { payload }: TodoFill): TodoState => ({
...state,
todos: payload
});
export const todoReducer = (
state = initialState,
action: TodoActionTypes
): TodoState => {
switch(action.type) {
case TODO_ADD:
return addTodo(state, action);
case TODO_COMPLETED:
return completedTodo(state, action);
case TODO_REMOVE:
return removeTodo(state, action);
case TODO_SEARCH:
return searchTodo(state, action);
case TODO_FETCH_START:
return fetchStart(state);
case TODO_FETCH_STOP:
return fetchStop(state);
case TODO_FILL:
return todoFill(state, action);
default:
return state;
}
};
|
e9a67950a50b8675374cd0b0924d02bac007761d
|
TypeScript
|
PineappleFinance/cheeseswap-api
|
/src/v2/summary.ts
| 2.546875
| 3
|
import { getAddress } from '@ethersproject/address'
import { APIGatewayProxyHandler } from 'aws-lambda'
import { createSuccessResponse, createServerErrorResponse } from '../utils/response'
import { getTopPairs } from './_shared'
interface ReturnShape {
[tokenIds: string]: { last_price: string; base_volume: string; quote_volume: string }
}
export const handler: APIGatewayProxyHandler = async () => {
try {
const pairs = await getTopPairs()
return createSuccessResponse(
pairs.reduce<ReturnShape>((accumulator, pair): any => {
const id0 = getAddress(pair.token0.id)
const id1 = getAddress(pair.token1.id)
accumulator[`${id0}_${id1}`] = {
last_price: pair.price ?? '0',
base_volume: pair.volumeToken0,
quote_volume: pair.volumeToken1
}
return accumulator
}, {})
)
} catch (error) {
return createServerErrorResponse(error)
}
}
|
111d6df817f6867878adb83151fdd1938e63509c
|
TypeScript
|
jo9182/daud
|
/Game.Engine/wwwroot/src/camera.ts
| 2.875
| 3
|
import { Vector2 } from "./Vector2";
import { Dimension2 } from "./Dimension2";
import * as PIXI from "pixi.js";
export class Camera {
distance: number;
lookat: number[];
size: Dimension2;
fieldOfView: number;
viewport: { rectangle: PIXI.Rectangle; scale: number[] };
aspectRatio: number;
constructor(size: Dimension2, settings = { fieldOfView: Math.PI / 4.0 }) {
this.distance = 1500.0;
this.lookat = [0, 0];
this.size = size;
this.fieldOfView = settings.fieldOfView || Math.PI / 4.0;
this.viewport = {
rectangle: new PIXI.Rectangle(0, 0, 0, 0),
scale: [1.0, 1.0],
};
this.updateViewport();
}
updateViewport() {
this.aspectRatio = this.size.width / this.size.height;
this.viewport.rectangle = new PIXI.Rectangle(
this.lookat[0] - (this.distance * Math.tan(this.fieldOfView)) / 2.0,
this.lookat[1] - (this.distance * Math.tan(this.fieldOfView)) / this.aspectRatio / 2.0,
this.distance * Math.tan(this.fieldOfView),
(this.distance * Math.tan(this.fieldOfView)) / this.aspectRatio
);
this.viewport.scale[0] = this.size.width / this.viewport.rectangle.width;
this.viewport.scale[1] = this.size.height / this.viewport.rectangle.height;
}
zoomTo(z) {
this.distance = z;
this.updateViewport();
}
moveTo(position: Vector2) {
this.lookat[0] = position.x;
this.lookat[1] = position.y;
this.updateViewport();
}
screenToWorld(pos: Vector2, obj: Vector2 = new Vector2(0, 0)) {
obj.x = pos.x / this.viewport.scale[0] + this.viewport.rectangle.left;
obj.y = pos.y / this.viewport.scale[1] + this.viewport.rectangle.top;
return obj;
}
}
|
6843c4f5658417a0d9665a631e4abdb82e4ab5f4
|
TypeScript
|
Isur/isomorphic-react-app
|
/src/Server/Modules/Sessions/session.service.ts
| 2.515625
| 3
|
import { Inject, Service } from "typedi";
import { Config } from "../../Config";
import SessionRepository from "./session.repository";
import { SessionObject } from "@shared/Interfaces/session.interface";
@Service()
class SessionService {
@Inject()
private readonly _config: Config;
@Inject()
private readonly _sessionRepository: SessionRepository;
public createSession = async (userId: string): Promise<string> => {
const expiry = new Date(Date.now() + this._config.cookies.maxAge);
const session = await this._sessionRepository.createSession(userId, expiry);
return session.id;
}
public endSession = async (sessionId: string): Promise<void> => {
await this._sessionRepository.deleteSession(sessionId);
}
public getSession = async (sessionId: string): Promise<SessionObject> => {
const session = await this._sessionRepository.findSession(sessionId);
return {
sessionId: session.id,
userId: session.userId,
expiryTime: session.expiryTime,
};
}
public deleteOldSessions = async (time: number): Promise<number> => {
return await this._sessionRepository.deleteOldSessions(time);
}
}
export default SessionService;
|
fa559e49aeb6beb14f7fa8692b839513d5a5753e
|
TypeScript
|
romefar/musify-frontend
|
/src/utils/calculateDuration.ts
| 2.9375
| 3
|
export const calculateDuration = (duration: number | undefined, ms = true) => {
const diff = ms ? 60000 : 60;
const appr = ms ? 1000 : 1;
const minutes = duration ? Math.floor(duration / diff) : null;
const seconds = duration ? (duration % diff) / appr : null;
if (!minutes || !seconds) {
return 'N/A';
}
const formattedSeconds = `${seconds}`.length === 1 ? `${seconds}0` : seconds;
const formattedDuration = `${minutes}:${formattedSeconds}`;
return formattedDuration;
};
|
b4b33df368320662f25ea0401c9685324eee2610
|
TypeScript
|
ryanroundhouse/version-finder-standalone
|
/src/Dependency.ts
| 2.90625
| 3
|
import Family from './Family';
export class Dependency {
id: number;
version: string;
supported: boolean;
family: Family;
dependencies: Dependency[];
constructor(id: number, family: Family, version: string, supported: boolean, dependencies: Dependency[]) {
this.id = id;
this.family = family;
this.version = version;
this.supported = supported;
this.dependencies = dependencies;
}
static compare(firstDependency: Dependency, secondDependency: Dependency): number {
return secondDependency.version.localeCompare(firstDependency.version);
}
static isGreaterThan(firstDependency: Dependency, secondDependency: Dependency): boolean {
return Dependency.compare(firstDependency, secondDependency) > 0;
}
}
export default Dependency;
|
87d407053cdc547cc9a4a41336c36f3b3cc7f67c
|
TypeScript
|
thesaikat/fiddle
|
/src/utils/focused-editor.ts
| 2.53125
| 3
|
import { Editor } from '../renderer/state';
/**
* Returns the currently focused editor.
*
* @returns {(MonacoType.editor.IStandaloneCodeEditor | null)}
*/
export function getFocusedEditor(): Editor | null {
const { editorMosaic } = window.ElectronFiddle.app.state;
for (const editor of editorMosaic.editors.values()) {
if (editor.hasTextFocus()) {
return editor;
}
}
return null;
}
|
7998a5c1dbf627d00093dd424b491ff881ab6d6a
|
TypeScript
|
4cadia-foundation/janus
|
/packages/indexer-core/src/Infra/Helper/ArrayHelper.ts
| 3.609375
| 4
|
export default class ArrayHelper {
public static Merge<T>(array1, array2): T[] {
const array = array1.concat(array2);
return this.Unique(array);
}
public static Unique<T>(array): T[] {
const a = array.concat();
for (let i = 0; i < a.length; ++i) {
for (let j = i + 1; j < a.length; ++j) {
if (a[i] === a[j]) {
a.splice(j--, 1);
}
}
}
return a;
}
}
|
279a3e42bb4c7aaeaa6b3900e19a4f83d37fee98
|
TypeScript
|
kvwillian/vimob
|
/src/models/Block.ts
| 2.609375
| 3
|
import DevelopmentReference from './DevelopmentReference';
export default class Block {
development: DevelopmentReference;
externalId: number;
name: string;
deliveryDate?: Date
constructor(
development: DevelopmentReference,
externalId: number,
name: string,
deliveryDate?: Date
) {
this.development = development;
this.externalId = externalId;
this.name = name;
this.deliveryDate = deliveryDate;
}
}
|
0d4202cb9ddb3db34641e6dff38ae16ea2e7af94
|
TypeScript
|
eboninger/MySpotifyBillboard
|
/angular/src/app/user/user.model.ts
| 2.5625
| 3
|
export class User {
Id: number;
AccessToken: string;
TokenType: string;
DisplayName: string;
Scope: string;
ExpirationTime: Date;
RefreshToken: string;
Email: string;
SpotifyId: string;
constructor (at, dn, e, et, id, rt, s, si, tt) {
this.Id = id;
this.AccessToken = at;
this.TokenType = tt;
this.DisplayName = dn;
this.Scope = s;
this.ExpirationTime = et;
this.RefreshToken = rt;
this.Email = e;
this.SpotifyId = si;
}
}
|
fff485c4474e39480a91d47db3b38e9eb0922103
|
TypeScript
|
taehwanno/instagram-shortcut-extension
|
/src/internal/node-to-html-element.ts
| 3.65625
| 4
|
/**
* Convert DOM Node to HTMLElement
*
* Based on DOM specification, HTMLCollection is a collection of object that extend an Element.
* In Chrome and Firefox both, those objects are HTMLElement.
* So I use an explicit type cast with 'as' keyword.
* @See https://dom.spec.whatwg.org/#htmlcollection
*
* @param {Node} node
* @return {HTMLElement}
*/
function nodeToHtmlElement(node: Node) {
const parentChildNodes = Array.from(node.parentElement.childNodes) as Node[];
const index = parentChildNodes.indexOf(node);
return node.parentElement.children[index] as HTMLElement;
}
export default nodeToHtmlElement;
|
f0f0ca3e4afe720b2033be1a80a5787021f7f944
|
TypeScript
|
sebgroup/frontend-tools
|
/src/CookieStorage/CookieStorage.ts
| 3.25
| 3
|
export interface SetItemOptions {
/** Expiration Date */
expires?: Date;
/** Maximum age in seconds */
maxAge?: number;
}
/**
* CookieStorage is a handler for reading and writing cookies in Javascript
* Usage is similar to `localStorage` and `sessionStorage`
*/
export class CookieStorage implements Storage {
get length(): number {
return this.keys().length;
}
/**
* Retrieve an item from the stored cookie
* @param key The key of the cookie to be retrieved
* @returns The value of the cookie, `null` if it doesn't exist
*/
getItem(key: string): string {
if (!key) {
return null;
}
return (
decodeURIComponent(
document.cookie.replace(
new RegExp(
"(?:(?:^|.*;)\\s*" +
encodeURIComponent(key).replace(
/[\-\.\+\*]/g,
"\\$&"
) +
"\\s*\\=\\s*([^;]*).*$)|^.*$"
),
"$1"
)
) || null
);
}
/**
* Sets an item to the stored cookie
* @param key The key of the cookie to be set
* @param value The value of the cookie
* @param options Available options are `expires`, `maxAge` and `secure` @see SetItemOptions interface for reference
* @returns `true` if successful
*/
setItem(key: string, value: any, options: SetItemOptions = {}): boolean {
if (!key || /^(?:expires|max\-age|path|domain|secure)$/i.test(key)) {
return false;
}
let expires: string = "";
let maxAge: string = "";
if (options) {
if (options.expires && options.expires instanceof Date) {
expires = "; Expires=" + options.expires.toUTCString();
}
if (
options.maxAge &&
typeof options.maxAge === "number" &&
options.maxAge !== Infinity
) {
maxAge = `; Max-age=${options.maxAge}`;
}
}
document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(
value
)}${expires}${maxAge}`;
return this.hasItem(key);
}
/**
* Remove an item from the stored cookie
* @param {string} key The key of the cookie to be removed
* @returns {boolean} `true` if successful
*/
removeItem(key: string): boolean {
if (this.hasItem(key)) {
document.cookie = `${encodeURIComponent(key)}=; max-age=-1`;
}
return !this.hasItem(key);
}
/**
* Verifies if an item exists in the cookie
* @param {string} key The key of the item to be verified
* @returns {boolean} `true` if it exists
*/
hasItem(key: string): boolean {
if (!key || /^(?:expires|max\-age|path|domain|secure)$/i.test(key)) {
return false;
}
return new RegExp(
"(?:^|;\\s*)" +
encodeURIComponent(key).replace(/[\-\.\+\*]/g, "\\$&") +
"\\s*\\="
).test(document.cookie);
}
clear(): void {
const cookies: Array<string> = document.cookie.split(";");
for (let i: number = 0; i < cookies.length; i++) {
const cookie: string = cookies[i];
const eqPos: number = cookie.indexOf("=");
const name: string = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
const value: string =
eqPos > -1 ? cookie.substr(eqPos + 1, cookie.length) : "";
document.cookie = `${name}${value ? "=" : ""}; max-age=-1`;
}
}
/**
* Retrives the list of keys in the stored cookie
* @returns The list of keys in the stored cookie
*/
keys(): Array<string> {
const aKeys: Array<string> = document.cookie
.replace(
/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,
""
)
.split(/\s*(?:\=[^;]*)?;\s*/);
for (let nLen: number = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) {
aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
}
return aKeys;
}
/**
* @param index The index of the array of keys
* @returns The key at the given index, if any
*/
key(index: number): string {
return this.keys()[index];
}
}
|
fb7bead56ec3328d603afce4d2cd82ff43af3c6b
|
TypeScript
|
balloon-chat/balloon-react
|
/src/data/redux/topic/slice.ts
| 2.53125
| 3
|
import { createSlice } from '@reduxjs/toolkit';
import {
EditTopicModes,
EditTopicStates,
topicStateName,
TopicStates,
TopicStateType,
} from 'src/data/redux/topic/state';
import {
editTopicReducer,
finishEditTopicReducer,
setTopicsReducer,
} from 'src/data/redux/topic/reducer';
import {
createTopic,
deriveTopic,
fetchTopic,
fetchTopicByCode,
fetchTopicsCreatedBy,
fetchTopicsFrom,
updateTopic,
} from 'src/data/redux/topic/action';
import { TopicEntity } from 'src/view/types/topic';
const initialState: TopicStateType = {
edit: null,
topics: [] as TopicEntity[],
} as const;
const topicSlice = createSlice({
name: topicStateName,
initialState,
reducers: {
editTopic: editTopicReducer,
finishEditTopic: finishEditTopicReducer,
setTopics: setTopicsReducer,
},
extraReducers: (builder) => {
builder
.addCase(createTopic.fulfilled, (state, { payload }) => ({
...state,
edit: {
mode: EditTopicModes.CREATE,
state: EditTopicStates.CREATED,
update: null,
create: { created: payload.created },
},
}))
.addCase(createTopic.rejected, (state) => ({
...state,
edit: {
mode: EditTopicModes.CREATE,
state: EditTopicStates.CREATE_TOPIC_ERROR,
update: null,
create: null,
},
}))
.addCase(deriveTopic.fulfilled, (state, { payload }) => ({
...state,
currentTopic: payload.topic,
}))
.addCase(fetchTopic.fulfilled, (state, { payload }) => ({
...state,
state: payload === undefined ? TopicStates.NOT_FOUND : undefined,
currentTopic: payload,
}))
.addCase(fetchTopicsFrom.fulfilled, (state, { payload }) => ({
...state,
topics: [...state.topics, ...payload],
}))
.addCase(fetchTopicsCreatedBy.fulfilled, (state, { payload }) => ({
...state,
topics: payload.topics,
}))
.addCase(fetchTopicByCode.rejected, (state) => ({
...state,
state: TopicStates.CANNOT_FIND_BY_CODE,
}))
.addCase(fetchTopicByCode.fulfilled, (state, { payload }) => ({
...state,
topicId: payload.topicId,
state: payload.topicId ? TopicStates.TOPIC_FOUND : TopicStates.CANNOT_FIND_BY_CODE,
}))
.addCase(updateTopic.fulfilled, (state, { payload }) => ({
...state,
edit: {
mode: EditTopicModes.UPDATE,
state: EditTopicStates.UPDATED,
update: { topic: payload.topic },
create: null,
},
}))
.addCase(updateTopic.rejected, (state) => ({
...state,
edit: {
mode: EditTopicModes.CREATE,
state: EditTopicStates.UPDATE_TOPIC_ERROR,
update: null,
create: null,
},
}));
},
});
export const {
editTopic,
finishEditTopic,
setTopics,
} = topicSlice.actions;
export const topicReducer = topicSlice.reducer;
|
7725490aca7334ab463b4e1df7276427278b1030
|
TypeScript
|
huiXinYiJi/rxjs
|
/observable_operator.ts
| 2.984375
| 3
|
import { Observable, from as ObFrom } from 'rxjs';
// 首先npm install --save rxjs-compat@6 向后兼容,再引入map和reduce
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/reduce';
let persons = [
{ name: 'Dave', age: 34, salary: 2000 },
{ name: 'Nick', age: 37, salary: 32000 },
{ name: 'Howie', age: 40, salary: 26000 },
{ name: 'Brian', age: 40, salary: 30000 },
{ name: 'Kevin', age: 47, salary: 24000 }
];
ObFrom(persons).map(p => p['salary'])
.reduce((total, current) => total+ current, 0)
.subscribe(
totalSalary => console.log(`Total salary is ${totalSalary}`),
err => console.log(err)
);
// 运行 ts-node observable_operator.ts
// 结果:
// Total salary is 114000
|
98b9a8ebd4021244dbd1f5f6702923796569e789
|
TypeScript
|
liurongqing/phaser3-tutorial-memory-match
|
/src/controllers/StartModal.ts
| 2.71875
| 3
|
import { TextureKeys } from '~/consts/index'
enum ModalState {
IDLE,
ENTERING,
EXITING
}
export default class StartModal {
private scene: Phaser.Scene
private panel: Phaser.GameObjects.RenderTexture
private startText: Phaser.GameObjects.Text
private state = ModalState.IDLE
get isExiting() {
return this.state === ModalState.EXITING
}
constructor(scene: Phaser.Scene) {
this.scene = scene
const { width, height } = scene.scale
this.panel = scene.add.nineslice(width * 0.5, height * 1.5, 500, 200, TextureKeys.UI_PANEL, 24)
.setOrigin(0.5)
.setData('sorted', true)
.setDepth(10000)
this.startText = scene.add.text(width * 0.5, height * 1.5, 'Press A to Start', {
fontSize: 32,
fontFamily: 'Rowdies'
})
.setColor('#000000')
.setData('sorted', true)
.setOrigin(0.5)
.setDepth(10001)
}
enter() {
this.state = ModalState.ENTERING
this.scene.tweens.add({
targets: [this.panel, this.startText],
y: this.scene.scale.height * 0.5,
duration: 500,
ease: Phaser.Math.Easing.Bounce.InOut,
onComplete: () => {
this.state = ModalState.IDLE
}
})
}
exit(callback: () => void) {
this.state = ModalState.EXITING
this.scene.tweens.add({
targets: [this.panel, this.startText],
y: this.scene.scale.height * 1.5,
duration: 300,
ease: Phaser.Math.Easing.Bounce.InOut,
onComplete: () => {
this.state = ModalState.IDLE
callback?.()
}
})
}
destroy() {
this.panel.destroy()
this.startText.destroy()
}
}
|
480956e6b818bfcb6a9596665cbaf576c8c1bf94
|
TypeScript
|
thanhbm-teko/showroom-app
|
/app/service/serviceProvider/pl/SearchRequestBuilder.ts
| 2.671875
| 3
|
export class SearchRequestBuilder {
searchRequest: PL.API.SearchRequest;
constructor(channel: PL.Channel, terminal: string, visitorId: string) {
this.searchRequest = { channel, terminal, visitorId, _page: 1, _limit: 10 };
}
setPage(page: number): SearchRequestBuilder {
this.searchRequest._page = page;
return this;
}
query(q: string): SearchRequestBuilder {
this.searchRequest.q = q;
return this;
}
sortBy(type: PL.SortType, branchCode: string): SearchRequestBuilder {
this.searchRequest._sort = type === 'stock' && branchCode ? `stock_${branchCode}` : type;
return this;
}
orderBy(type: PL.OrderType): SearchRequestBuilder {
this.searchRequest._order = type;
return this;
}
filterByPrice(priceGte: number, priceLte: number): SearchRequestBuilder {
if (priceGte) this.searchRequest.price_gte = priceGte;
if (priceLte) this.searchRequest.price_lte = priceLte;
return this;
}
filterCategories(categories: string[]): SearchRequestBuilder {
this.searchRequest.categories = categories.join(',');
return this;
}
build(): PL.API.SearchRequest {
return this.searchRequest;
}
}
|
9a6947d276ff597737e1865ad8e2673ede3eb77e
|
TypeScript
|
spark-js/spark
|
/src/lib/common/types.ts
| 3.046875
| 3
|
import { VNode } from '../vdom';
export type Constructor<T> = new (...args: any[]) => T;
/**
* Definition of Spark elements
*/
export interface SparkElementDefinition<T = object> {
/**
* Name of the custom element
*/
is: string;
/**
* Properties that are decorated with `ObserveAttribute` are placed into this array. This ensures that the browser will
* trigger `attributeChangedCallback` whenever those attributes are changed.
*/
observedAttributes: string[];
new(): SparkElement<T>
}
/**
* Instance of Spark elements
*/
export interface SparkElement<props> extends HTMLElement {
/**
* VNode that gets rendered into the dom. Uses `h`
*/
template: VNode;
/**
* Styles that are scoped to the element
*/
styles: string;
/**
* Internal. Used for TSX intellisense
*/
customAttributes: props;
__dom: VNode;
__rendering: boolean;
__attached: boolean;
__render: (immediate?: boolean) => () => void;
__observe: { [key: string]: any };
/**
* Whenever the element is attached to the dom, `connectedCallback` will be triggered.
*/
connectedCallback?(): void;
/**
* Whenever attributes that are decorated with `ObserveAttribute` are changed on the dom, `attributeChangeCallback`
* will be triggered.
*
* Make sure to call the super implementation if overriding.
*/
attributeChangedCallback?(name: string, oldvalue: any, newvalue: any): void
/**
* Call this function to re-render the current template
*/
rerender(): void;
}
|
56057c979f27b113ffd45d95a39e8ff7eafbbdaa
|
TypeScript
|
iricwang/TypeScriptToLua
|
/src/lualib/declarations/global.d.ts
| 2.6875
| 3
|
/* eslint-disable no-var */
/** @noSelfInFile */
declare var __TS__sourcemap: Record<number, number> | undefined;
declare var __TS__originalTraceback:
| ((this: void, thread?: any, message?: string, level?: number) => string)
| undefined;
// Override next declaration so we can omit extra return values
declare type NextEmptyCheck = (this: void, table: any, index: undefined) => unknown | undefined;
declare function tonumber(value: any, base?: number): number | undefined;
declare function type(
value: any
): "nil" | "number" | "string" | "boolean" | "table" | "function" | "thread" | "userdata";
declare function setmetatable<T extends object>(table: T, metatable: any): T;
declare function getmetatable<T extends object>(table: T): any;
declare function rawget<T, K extends keyof T>(table: T, key: K): T[K];
declare function rawset<T, K extends keyof T>(table: T, key: K, val: T[K]): void;
/** @tupleReturn */
declare function next<K, V>(table: Record<any, V>, index?: K): [K, V];
declare function pcall(func: () => any): any;
declare function unpack<T>(list: T[], i?: number, j?: number): T[];
declare function select<T>(index: number, ...args: T[]): T;
declare function select<T>(index: "#", ...args: T[]): number;
/**
* @luaIterator
* @tupleReturn
*/
type LuaTupleIterator<T extends any[]> = Iterable<T> & { " LuaTupleIterator": never };
declare function ipairs<T>(t: Record<number, T>): LuaTupleIterator<[number, T]>;
|
08c2b87c644c8bfd3e287611966619c6922242d8
|
TypeScript
|
Alexintosh/frontend
|
/src/config/types.ts
| 2.53125
| 3
|
export type PoolId = string; // je celkem jedno, co konrétně to bude, ale mohla by to být např. adresa chytrého kontraktu. Stejně jako např. na Balanceru v url: např. https://pools.balancer.exchange/#/pool/0x59a19d8c652fa0284f44113d0ff9aba70bd46fb4/
export interface InputInterface {
address: string; // '0x2bb665722a122dd8a80c9d8625430fa1bcc6c3fc'
exchange: string;
}
export interface PoolItemInterface {
exchange: string;
hodlReturnUsd: number; // difference in HODL value now and at the beginning
netReturnUsd: number; // difference in pool value now and at the beginning
dexReturnUsd: number; // fees - impermanent_loss - tx_cost
feesUsd: number; // total user's fee gains
impLossRel: number | undefined; // None in case of changes in lp balance
impLossUsd: number; // impermanent loss
txCostEth: number | undefined; // v ETH
endBalanceUsd: number;
userAddr: string;
poolId: string; // pool smart contract address
tokens: Array<{ [key: string]: {} }>;
tokenWeights: Array<number>;
endTokenBalance: Array<number>; // User token balances
endTokenPricesUsd: Array<number>;
start: number;
end: number;
tokenPriceUsd: Array<number>;
tokenBalanceDiffNoFees: Array<number>;
hodlReturnEth: number;
netReturnEth: number;
feesEth: number;
endBalanceEth: number;
}
export type PoolItemsInterface = Record<string, { [key: string]: PoolItemInterface }>;
export type PoolItemsDict = Record<string, PoolItemInterface>;
export interface PriceRatesInterface {
[key: string]: { [key: string]: number }; // key je FIAT, value je objekt obsahující ceny pro jednotlivé tokeny
}
|
c9f3d6ae015e8a975a173482cc8e89e8a67bfdf5
|
TypeScript
|
gabrielsimongianotti/wta
|
/backend/src/modules/merit/infra/typeorm/repositories/MeritRepository.ts
| 2.640625
| 3
|
import { getRepository, Repository } from 'typeorm';
import IMeritRepositoty from '@modules/merit/repositories/IMeritRepository';
import ICreateMeritDTO from '@modules/merit/dtos/ICreateMeritDTO';
import Merit from '@modules/merit/infra/typeorm/entities/Merit';
class MeritRepository implements IMeritRepositoty {
private ormRepository: Repository<Merit>;
constructor() {
this.ormRepository = getRepository(Merit);
}
public async create({
description,
name,
cost,
system,
type,
}: ICreateMeritDTO): Promise<Merit> {
const merit = this.ormRepository.create({
description,
name,
cost,
system,
type,
});
await this.ormRepository.save(merit);
return merit;
}
public async findByName(name: string): Promise<Merit | undefined> {
const merit = this.ormRepository.findOne({
where: { name },
});
return merit;
}
public async findAllMerits(): Promise<Merit[]> {
const merit = this.ormRepository.find();
return merit;
}
}
export default MeritRepository;
|
c556c74fd958fb51356232c6554741fdab3f03ed
|
TypeScript
|
tincapo/tech-test-ts
|
/src/utils.ts
| 3.234375
| 3
|
import { Comment, Post, User } from "./types";
export class Utils {
/**
* Method that will assing posts to relevant users object.
*
* @param users
* @param posts
*/
assignPostsToUsers(users: User[], posts: Post[]): void {
for (const user of users) {
user.posts = posts.filter(post => post.userId === user.id);
}
}
/**
* Method that will set popular flag on users object based on a given comment threshold.
* Requires posts to be populated on users object.
*
* @param users with posts alrady populated
* @param comments
*/
assignPopularFlagToUsers(users: User[], comments: Comment[], commentThreshold: number = 10): void {
if (users.some(user => user.posts === undefined)) {
throw new Error('Some users `posts` value is undefined. `posts` value is required to be populated.');
}
for (const user of users) {
user.popular = user.posts && user.posts.some(post => comments.filter(comment => comment.postId === post.id).length >= commentThreshold);
}
}
/**
* Method that will return flagged as popular users only.
*
* @param users
* @returns
*/
filterPopularUsers(users: User[]): User[] {
if (users.some(user => user.popular === undefined)) {
throw new Error('Some users `popular` value is undefined. `popular` value is required to be populated.');
}
return users.filter(user => user.popular);
}
}
|
11dd5b8fa44d18261f2d14929546b2384b5bab7a
|
TypeScript
|
abdallanayer/ng-bcomponents
|
/bcomponents/badge/badge.bcomponent.ts
| 2.71875
| 3
|
import {Component, Directive, Input, Output, EventEmitter, SimpleChange, ElementRef} from '@angular/core';
import {BComponent, BComponentInputs} from '../bcomponent';
export class BadgeBase extends BComponent {
@Input() value: number = 0;
@Output() change: EventEmitter<this> = new EventEmitter<this>();
constructor(el: ElementRef = void 0) {
super("badge", el);
}
ngOnChildChanges = (change?: {[property: string]: SimpleChange}) => {
if(!this.isNull(change) && change['value']) {
this.change.emit(this);
}
}
public Initialize = (value: number = 0): this => {
this.value = value;
if(this.ngOnChildChanges != null) this.ngOnChildChanges();
return this;
}
private isNumer = (): boolean => {
return typeof this.value === 'number';
}
/**
* Set the value of the badge
* @param {number} value - Value to set the badge to
* @memberOf BadgeBase
*/
public setValue = (value: number) => {
this.value = value;
}
/**
* Increase the value of the badge
* @param {number} by - Value to increase the badge number by. Defaults to 1
* @memberOf BadgeBase
*/
public increment = (by: number = 1) => {
if(this.isNumer()) { this.value += by; }
}
/**
* Decrease the value of the badge
* @param {number} by - Value to decrease the badge number by. Defaults to 1
* @memberOf BadgeBase
*/
public decrement = (by: number = 1) => {
if(this.isNumer()) { this.value -= by; }
}
}
@Component({
selector: "bc-badge",
templateUrl: "badge.bcomponent.html",
inputs: BComponentInputs
})
export class BadgeBComponent extends BadgeBase {
constructor(){ super(); }
}
@Directive({
selector: "[bc-badge]",
inputs: BComponentInputs
})
export class BadgeBDirective extends BadgeBase {
constructor(el: ElementRef) { super(el); }
}
|
6b163a92ecc37037abd0c28ed828f72b3e4712e4
|
TypeScript
|
amirulabu/aoc2020
|
/2/script2.ts
| 2.8125
| 3
|
import * as fs from "fs";
import { promisify } from "util";
const readFile = promisify(fs.readFile);
(async () => {
const data = await readFile("input.txt");
const cleanedData = data.toString("utf-8").split("\n");
// console.log(cleanedData);
const correctPasswords = cleanedData
.map((v: string) => {
const [_, pos1Str, pos2Str, letter, password] = v.match(
/^(\d+)-(\d+) (\w{1}): (\w*)$/
);
const pos1 = parseInt(pos1Str) - 1;
const pos2 = parseInt(pos2Str) - 1;
let pass: boolean;
if (
password.charAt(pos1) === letter &&
password.charAt(pos2) === letter
) {
pass = false;
} else if (
password.charAt(pos1) === letter ||
password.charAt(pos2) === letter
) {
pass = true;
} else {
pass = false;
}
return pass ? password : null;
})
.filter((v) => v !== null);
console.log("ans: ", correctPasswords.length);
process.exit(0);
})();
|
873caea5b0d5a74e58865c980c2a4d0df6af004a
|
TypeScript
|
Khan/wonder-blocks
|
/packages/wonder-blocks-i18n/src/functions/i18n-boxes.ts
| 2.984375
| 3
|
import type {IProvideTranslation} from "./types";
// c.f. http://www.alanflavell.org.uk/unicode/unidata25.html
// hollow (white) square; also try \u25a0 or \u25aa+b
export const BoxChar = "\u25a1";
const AlphaNumRegex = /\w/g;
export default class Boxes implements IProvideTranslation {
translate(input: string): string {
if (!input) {
return "";
}
if (input.startsWith("&")) {
return BoxChar;
}
return input.replace(AlphaNumRegex, BoxChar);
}
}
|
46d03f95018888a5d52bda81b9065f85e10ca870
|
TypeScript
|
maddalax/Logicful
|
/frontend/app/src/util/Nav.ts
| 2.90625
| 3
|
export function nameToInitials(name: string) {
if (!name) {
return undefined;
}
const split = name.split(" ");
let result = "";
split.forEach((s) => {
result += s[0];
});
return result;
}
|
62be53c3532da336de3cf08714929bad785e4c64
|
TypeScript
|
Reggino/adventofcode
|
/src/2019/08/index.ts
| 3.125
| 3
|
import { readFileSync } from "fs";
import { join } from "path";
const digits = readFileSync(join(__dirname, "./input.txt"), {
encoding: "utf-8"
})
.trim()
.split("")
.map(digit => Math.floor(parseInt(digit, 10)));
interface ILayer {
digits: number[];
count0: number;
count1: number;
count2: number;
}
const layers: ILayer[] = [];
while (digits.length) {
const layerDigits = digits.splice(0, 150);
layers.push({
digits: layerDigits,
count0: layerDigits.filter(digit => digit === 0).length,
count1: layerDigits.filter(digit => digit === 1).length,
count2: layerDigits.filter(digit => digit === 2).length
});
}
const minCount0 = layers.reduce(
(prev: number, layer: ILayer) => Math.min(prev, layer.count0),
999
);
const minCount0Layer = layers.find(
layer => layer.count0 === minCount0
) as ILayer;
// not 2809
// not 81
console.log(minCount0Layer.count1 * minCount0Layer.count2);
// 0 black
// 1 white
// 2 trans
const finalImage = layers.reduce((prev, layer) => {
layer.digits.forEach((digit, pos) => {
if (digit !== 2 && prev[pos] === 2) {
prev[pos] = digit;
}
});
return prev;
}, new Array(150).fill(2));
for (let y = 0; y < 6; y++) {
for (let x = 0; x < 25; x++) {
process.stdout.write(`${finalImage[y * 25 + x] ? "■" : " "}`);
}
process.stdout.write("\n");
}
|
2a6521dfc6dc8bf15a55e3da8e2a78ede2ea8361
|
TypeScript
|
sharegit/sharegit
|
/web/src/util/LocalStorageDictionary.ts
| 3.203125
| 3
|
import Dictionary from "util/Dictionary";
export default class LocalStorageDictionary<T = any> {
private storageName: string;
constructor(storageName: string) {
this.storageName = storageName;
}
private open(): Dictionary<T> {
const dictionary = localStorage.getItem(this.storageName)
if(dictionary == null)
return new Dictionary();
else
return Object.assign(new Dictionary<T>(), JSON.parse(dictionary) as Dictionary<T>);
}
private close(dictionary: Dictionary<T>) {
localStorage.setItem(this.storageName, JSON.stringify(dictionary));
}
getAll(): T[] {
const dictionary = this.open();
return dictionary.getAll();
}
get(key: string): T | undefined {
const dictionary: Dictionary<T> = this.open();
return dictionary.get(key);
}
put(key: string, value: T) {
const dictionary: Dictionary<T> = this.open();
dictionary.put(key, value);
this.close(dictionary);
}
remove(token: string) {
const dictionary: Dictionary<T> = this.open();
dictionary.remove(token);
this.close(dictionary);
}
}
|
72f35516c2e477172f8dbffac4e5c0917d00f2a0
|
TypeScript
|
Justin-ZS/bow
|
/src/modules/table.ts
| 2.640625
| 3
|
import {
ITable, TableData, GroupDescription, FieldDescription,
TableDescription, AggregateDescription, AggregateType,
} from 'Typings';
import { pick, omit } from 'PureUtils';
import { makeFieldDesc } from 'Utils';
import { getGroupDesc } from './group';
import { getIndexSet } from './filter';
import { getOrderedIndexes } from './order';
import { getAggregatedTable } from './aggregate';
import { getCalculatedTable } from './calculate';
export default class Table implements ITable {
private readonly data: TableData;
private readonly _fieldDescs: FieldDescription[];
private readonly _groupDescs: GroupDescription;
private readonly _visibleIndexSet: IndexSet;
private readonly _orderedIndexes: IndexArr;
public readonly totalRowCount: number;
static create(...args: ConstructorParameters<typeof Table>) {
return new Table(...args);
}
create(...args: ConstructorParameters<typeof Table>) {
return new Table(...args);
}
constructor(
data: TableData,
meta: {
fields: FieldDescription[],
rowCount: number,
},
filteredSet?: IndexSet,
groupDesc?: GroupDescription,
orderedIndexes?: IndexArr,
) {
this.data = data;
this._fieldDescs = meta.fields;
this.totalRowCount = meta.rowCount;
this._visibleIndexSet = filteredSet ?? null;
this._groupDescs = groupDesc ?? null;
this._orderedIndexes = orderedIndexes ?? null;
}
// #region getter
get isFiltered() {
return !!this._visibleIndexSet;
}
get isGrouped() {
return !!this._groupDescs;
}
get isOrdered() {
return !!this._orderedIndexes;
}
get rowCount() {
return this.isFiltered
? this._visibleIndexSet.size
: this.totalRowCount;
}
get colCount() {
return this._fieldDescs.length;
}
get columns() {
return this.data;
}
get groups() {
return this._groupDescs;
}
get fields() {
return this._fieldDescs;
}
// #endregion
// #region overwrite native api
get [Symbol.toStringTag]() {
if (!this._fieldDescs) return 'Object'; // bail if called on prototype
const nr = this.rowCount + ' row' + (this.rowCount !== 1 ? 's' : '');
const nc = this.colCount + ' col' + (this.colCount !== 1 ? 's' : '');
return `Table: ${nc} x ${nr}`
+ (this.isFiltered ? ` (${this.totalRowCount} backing)` : '')
+ (this.isGrouped ? `, ${this._groupDescs.size} groups` : '')
+ (this.isOrdered ? ', ordered' : '');
}
// #endregion
private checkRowIdxOverRange(rowIdx: number) {
if (rowIdx < 0 || rowIdx >= this.totalRowCount) {
throw Error('Row index over Range!');
}
}
private checkColIdxOverRange(colIdx: number) {
if (colIdx < 0 || colIdx >= this.colCount) {
throw Error('Column index over Range!');
}
}
public traverse(fn, noOrder = false) {
let rowIdx = 0;
let isDone = false;
const done = () => isDone = true;
const exec = (rowIdx) => isDone || fn(rowIdx, this.data, done);
if (!noOrder && this.isOrdered) {
this._orderedIndexes.forEach(exec);
return;
}
if (this.isFiltered) {
this._visibleIndexSet.forEach(exec);
return;
}
while (!isDone && rowIdx < this.totalRowCount) {
exec(rowIdx);
rowIdx += 1;
}
}
public clone({ data, meta, filterBy, groupBy, orderBy }: TableDescription) {
return Table.create(
data ?? this.data,
{
fields: meta?.fields ?? this._fieldDescs,
rowCount: meta?.rowCount ?? this.totalRowCount,
},
filterBy ?? this._visibleIndexSet,
groupBy ?? this._groupDescs,
orderBy ?? this._orderedIndexes
);
}
public getColumnByName(colName: string) {
return this.data[colName];
}
public getFieldDescriptionByName(colName: string) {
return this.fields.find(f => f.name === colName);
}
public getColumnByIdx(colIdx: number) {
this.checkColIdxOverRange(colIdx);
return this.data[this._fieldDescs[colIdx].name];
}
public getCell(colName: string, rowIdx: number) {
return this.getColumnByName(colName).getDatum(rowIdx);
}
public getRowByIdx(rowIdx: number) {
this.checkRowIdxOverRange(rowIdx);
return this.fields.map(f => this.data[f.name].getDatum(rowIdx));
}
public getRowDataByIdx(rowIdx: number): Record<string, unknown> {
const row = this.getRowByIdx(rowIdx);
const data = {};
this.fields.forEach((f, idx) => data[f.name] = row[idx]);
return data;
}
// #region manipulate columns
public extractColumnsByNames(...names: string[]) {
const fields = this.fields
.filter(f => names.includes(f.name))
.map((f, idx) => makeFieldDesc(f.name, idx, f.type));
const data = pick(names, this.data);
return this.clone({
data,
meta: { fields },
});
}
public removeColumnsByNames(...names: string[]) {
const fields = this.fields
.filter(f => !names.includes(f.name))
.map((f, idx) => makeFieldDesc(f.name, idx, f.type));
const data = omit(names, this.data);
return this.clone({
data,
meta: { fields },
});
}
public addColumnsByExpr(calcExpr: any) {
return getCalculatedTable(calcExpr, this);
}
// #endregion
// TODO: waiting for slice method in IColumn
public subsetRowsByRange(rangeFrom: number, rangeTo: number) {
this.checkRowIdxOverRange(rangeFrom);
this.checkRowIdxOverRange(rangeTo);
if (rangeTo < rangeFrom) throw Error('rangeTo should bigger than rangeFrom!');
// return this.clone({
// data: columns,
// meta: {
// rowCount: rangeTo - rangeFrom,
// }
// });
}
public groupBy(...names: string[]): Table {
return this.clone({ groupBy: getGroupDesc(names, this) });
}
public filterBy(filterPred: Predicate) {
return this.clone({ filterBy: getIndexSet(filterPred, this) });
}
public orderBy(comparator: Comparator) {
return this.clone({ orderBy: getOrderedIndexes(comparator, this) });
}
// TODO: use expression in parameters
public summarize(aggOpts: any) {
const isSumAgg = str => {
const reg = /sum\((.*)\)/i;
const result = reg.exec(str);
if (!result) return false;
if (result[1] === '') return false;
return true;
};
const getFieldName = str => /sum\((.*)\)/i.exec(str)[1];
const aggDescs: AggregateDescription[] = Object.entries(aggOpts)
.filter(([_, str]) => isSumAgg(str))
.map(([name, str]) => ({
name,
type: AggregateType.Sum,
field: this.getFieldDescriptionByName(getFieldName(str)),
}));
return getAggregatedTable(aggDescs, this);
}
// #region alias
public aggregate(...args: Parameters<Table['summarize']>) {
return this.summarize(...args);
}
public extractColumns(...args: Parameters<Table['extractColumnsByNames']>) {
return this.extractColumnsByNames(...args);
}
public deleteColumns(...args: Parameters<Table['removeColumnsByNames']>) {
return this.removeColumnsByNames(...args);
}
public addColumns(...args: Parameters<Table['addColumnsByExpr']>) {
return this.addColumnsByExpr(...args);
}
// #endregion
}
|
6ad4a3279a502c01e0e2dd73310b36c3dedeae18
|
TypeScript
|
elylucas/thinkster-nest-exercises
|
/section3/exercise3-solution/src/data/speaker.entity.ts
| 3.265625
| 3
|
// Exercise:
// Add decorators from class-validator to make sure that:
// 1) There is a value provided for name, that it is a string, and it is not empty
// 2) There is a value provided for hasSpokeBefore, and that it is a boolean
// 3) IF there is a value passed in for bio, make sure its a non-empty string
// (hint: you will need a new decorator not discussed yet) see docs at
// https://github.com/typestack/class-validator#validation-decorators
// Run POST and PUT requests to /speakers, /speakers/:id to make sure the validation logic is working properly
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
export class SpeakerEntity {
id: number;
@IsString({
message: 'Name must be a string'
})
@IsNotEmpty({
message: 'Name must not be an empty string'
})
name: string;
@IsOptional()
@IsString({
message: 'Bio must be a string'
})
@IsNotEmpty({
message: 'Bio must not be an empty string'
})
bio?: string;
@IsBoolean({
message: 'HasSpokenBefore must be a boolean'
})
hasSpokeBefore: boolean;
createdAt: Date = new Date();
createdBy: string;
}
|
c4b872002fa252db16438ef0461bdff33a967b8f
|
TypeScript
|
iloveivyxuan/vectorious
|
/src/core/multiply.ts
| 2.9375
| 3
|
import { get_type } from '../util';
import { NDArray } from './';
let nblas: any;
try {
nblas = require('nblas');
} catch (err) {}
NDArray.multiply = <T extends NDArray>(x: T | ArrayLike<any>, y: T | ArrayLike<any>): T =>
NDArray.array<T>(x).multiply(NDArray.array<T>(y));
NDArray.prototype.multiply = function<T extends NDArray>(this: T, x: T): T {
const [r1, c1] = this.shape;
const [r2, c2] = x.shape;
if (c1 !== r2) {
throw new Error('sizes do not match');
}
const y: NDArray = NDArray.matrix(r1, c2);
try {
if (!['float32', 'float64'].includes(this.dtype)) {
this.dtype = 'float32';
this.data = get_type(this.dtype).from(this.data);
}
const { data: d1 } = this;
const { data: d2 } = x;
const { data: d3 } = y;
if (this.dtype === 'float64') {
nblas.dgemm(nblas.NoTrans, nblas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);
} else if (this.dtype === 'float32') {
nblas.sgemm(nblas.NoTrans, nblas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);
}
} catch (err) {
const { data: d1 } = this;
const { data: d2 } = x;
const { data: d3 } = y;
let i: number;
let j: number;
let k: number;
let sum: number;
for (i = 0; i < r1; i += 1) {
for (j = 0; j < c2; j += 1) {
sum = 0;
for (k = 0; k < c1; k += 1) {
sum += d1[i * c1 + k] * d2[k * c2 + j];
}
d3[i * c2 + j] = sum;
}
}
}
return y as T;
};
|
591f1603e69dcc70b644ce1d8a557f65671af623
|
TypeScript
|
gradientK/angular_todolist
|
/src/app/components/todo-item/todo-item.component.ts
| 2.6875
| 3
|
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { TodoService } from '../../services/todo.service';
import { Todo } from 'src/app/models/Todo';
@Component({
selector: 'app-todo-item',
templateUrl: './todo-item.component.html',
styleUrls: ['./todo-item.component.scss']
})
export class TodoItemComponent implements OnInit {
@Input() todo: Todo = new Todo();
@Output() deleteTodoEmit: EventEmitter<Todo> = new EventEmitter();
@Output() saveTodoEmit: EventEmitter<Todo> = new EventEmitter();
editMode = false; // Used to signify when editing a Todo
public tempTitle = ''; // Used to edit/save todo Title
emptyTitle = false; // Used to check for empty input field
constructor(private todoService: TodoService) {
}
ngOnInit(): void {
}
/**
* Set Dynamic Classes
*/
setClasses(): any { // What is the type class of 'classes'
const classes = {
'is-complete': this.todo.completed
};
return classes;
}
/**
* onToggle
*/
onToggle(todo: Todo): void {
// Toggle in UI
todo.completed = !todo.completed;
// Toggle on server
this.todoService.toggleCompleted(todo).subscribe(() => console.log(todo));
}
/**
* onDelete Todo
*/
onDelete(todo: Todo): void {
this.deleteTodoEmit.emit(todo);
}
/**
* OnEdit Todo
*/
onEdit(todo: Todo): void {
this.tempTitle = todo.title;
this.editMode = true;
}
/**
* onCancelEdit
*/
onCancelEdit(todo: Todo): void {
this.editMode = false; // Update UI
this.emptyTitle = false; // Ensure set to false after exiting edit mode
}
/**
* onSave Todo
*/
onSave(todo: Todo): void {
// If input field is empty after editing
if (this.tempTitle === '') {
this.emptyTitle = true;
} else {
// Field is fine, proceed
this.editMode = false; // Update UI
this.todo.title = this.tempTitle; // Update Todo
// Update Server
this.todoService.updateSave(todo).subscribe(() => console.log(todo));
// Ensure error messsage is hidden
this.emptyTitle = false;
}
}
}
|
9ef8699f4a0b8f5f86e6ec35d526d710dc7a0d28
|
TypeScript
|
testnavot/theatre
|
/theatre/core/src/projects/initialiseProjectState.ts
| 2.546875
| 3
|
import type {Studio} from '@theatre/studio/Studio'
import delay from '@theatre/shared/utils/delay'
import {original} from 'immer'
import type Project from './Project'
import type {OnDiskState} from './store/storeTypes'
import globals from '@theatre/shared/globals'
/**
* @todo this could be turned into a simple derivation, like:
* editor.isReady: IDerivation<{isReady: true} | {isReady: false, reason: 'conflictBetweenDiskStateAndBrowserState'}>
*/
export default async function initialiseProjectState(
studio: Studio,
project: Project,
onDiskState: OnDiskState | undefined,
) {
/*
* If in the future we move to IndexedDB to store the state, we'll have
* to deal with it being async (as opposed to localStorage that is synchronous.)
* so here we're artifically delaying the loading of the state to make sure users
* don't count on the state always being already loaded synchronously
*/
await delay(0)
studio.transaction(({drafts}) => {
const projectId = project.address.projectId
drafts.ephemeral.coreByProject[projectId] = {
lastExportedObject: null,
loadingState: {type: 'loading'},
}
drafts.ahistoric.coreByProject[projectId] = {
ahistoricStuff: '',
}
function useInitialState() {
drafts.ephemeral.coreByProject[projectId].loadingState = {
type: 'loaded',
}
drafts.historic.coreByProject[projectId] = {
sheetsById: {},
definitionVersion: globals.currentProjectStateDefinitionVersion,
revisionHistory: [],
}
}
function useOnDiskState(state: OnDiskState) {
drafts.ephemeral.coreByProject[projectId].loadingState = {
type: 'loaded',
}
drafts.historic.coreByProject[projectId] = state
}
function useBrowserState() {
drafts.ephemeral.coreByProject[projectId].loadingState = {
type: 'loaded',
}
}
function browserStateIsNotBasedOnDiskState(onDiskState: OnDiskState) {
drafts.ephemeral.coreByProject[projectId].loadingState = {
type: 'browserStateIsNotBasedOnDiskState',
onDiskState,
}
}
const browserState = original(drafts.historic)?.coreByProject[
project.address.projectId
]
if (!browserState) {
if (!onDiskState) {
useInitialState()
} else {
useOnDiskState(onDiskState)
}
} else {
if (!onDiskState) {
useBrowserState()
} else {
if (
browserState.revisionHistory.indexOf(
onDiskState.revisionHistory[0],
) == -1
) {
browserStateIsNotBasedOnDiskState(onDiskState)
} else {
useBrowserState()
}
}
}
})
}
|
e3e2914d64299477a97b4f9fdf81cd3ab71f0d47
|
TypeScript
|
edges-games/escape
|
/assets/framework/components/gimmicks/ECRoundDetailEventData.ts
| 2.59375
| 3
|
import ECDetailEventData from "./ECDetailEventData";
import ECRoundItem from "./ECRoundItem";
const {ccclass, property} = cc._decorator;
@ccclass
export default class ECRoundDetailEventData extends ECDetailEventData
{
@property([ECRoundItem]) items:ECRoundItem[] = [];
@property([cc.Integer]) passwords:number[] = [];
private excuting:boolean;
onInitialize()
{
this.node.on(cc.Node.EventType.TOUCH_START,this.onTouchStart,this);
}
onTouchStart(touch)
{
if(this.isCompleted) return;
for (let i=0;i<this.items.length;i++)
{
let item:ECRoundItem = this.items[i];
if(item != null)
{
const world = (item.getComponent(cc.PolygonCollider) as any).world;
if (cc.Intersection.pointInPolygon(touch.getLocation(), world.points))
{
this.clickRound(item);
return;
}
}
}
}
onDestroy()
{
this.node.off(cc.Node.EventType.TOUCH_START,this.onTouchStart,this);
}
public clickRound(item:ECRoundItem)
{
if(!this.excuting)
{
this.excuting = true;
let index:number = item.index;
index++;
if(index >= item.angles.length)
{
index = 0;
}
item.index = index;
cc.tween(item.node).to(0.5,{angle:-item.angles[item.index]}).call(()=>{this.onRoteted(item)}).start();
}
}
onRoteted(item:ECRoundItem)
{
this.excuting = false;
if(item.index == item.angles.length - 1)
{
item.index = 0;
item.node.angle = 0;
}
this.check();
if(this.isCompleted)
{
this.unlock(false);
}
}
check()
{
for(let i = 0;i<this.passwords.length;i++)
{
if(this.passwords[i] != this.items[i].index)
{
return;
}
}
this.isCompleted = true;
}
}
|
c1436670f04fdd31e083a41e5c4d8d74c1691bf8
|
TypeScript
|
ArcticZeroo/canvas-simulation
|
/src/util/DrawUtil.ts
| 3.0625
| 3
|
import Vector from '../Vector';
import RandomUtil from './RandomUtil';
export default abstract class DrawUtil {
static createShapePath(context: CanvasRenderingContext2D, points: Vector[]): void {
if (!points || !points.length) {
return;
}
console.log(points);
const [startingPoint] = points;
context.beginPath();
context.moveTo(startingPoint.x, startingPoint.y);
for (let i = 1; i < points.length; ++i) {
const point = points[i];
context.lineTo(point.x, point.y);
}
context.closePath();
}
static wobbleLine(context: CanvasRenderingContext2D, currentPosition: Vector, destination: Vector, wobbleDeltaLength: number, wobbleMagnitude: number = 0.05) {
console.log('Wobbling line from', currentPosition, 'to', destination);
if (wobbleDeltaLength <= 0 || wobbleDeltaLength >= 1) {
console.log('Wobble is not between 0 and 1 exclusive.');
context.lineTo(destination.x, destination.y);
}
console.log(destination.subtract(currentPosition));
const deltaPerWobble = destination.subtract(currentPosition).multiplyScalar(wobbleDeltaLength);
const deltaNormalized = deltaPerWobble.normalize();
// Intentionally reversed
const deltaWeights = new Vector(deltaNormalized.y, deltaNormalized.x);
const wobbleCount = Math.floor(1 / wobbleDeltaLength);
console.log(wobbleCount, 'wobbles will occur with a delta of', deltaPerWobble, 'each');
for (let i = 0; i < wobbleCount; ++i) {
const nextEndPoint = currentPosition.add(deltaPerWobble);
console.log(i, 'wobble beginning from', currentPosition, 'to', nextEndPoint);
const wobbleX = RandomUtil.getCenteredRandom(wobbleMagnitude) * deltaPerWobble.x * deltaWeights.x;
const wobbleY = RandomUtil.getCenteredRandom(wobbleMagnitude) * deltaPerWobble.y * deltaWeights.y;
console.log('wobble amount (x, y):', wobbleX, wobbleY);
context.lineTo(nextEndPoint.x + wobbleX, nextEndPoint.y + wobbleY);
currentPosition = nextEndPoint;
}
}
}
|
44a8dfdde58aeace61a44cfcbaec68a99d3dfad1
|
TypeScript
|
kashif-ali-khan/credit-card-app
|
/src/app/validators/expirydate.validator.ts
| 2.890625
| 3
|
import { AbstractControl, ValidationErrors } from '@angular/forms';
export class ExpiryDateValidator {
static expiryDate(control: AbstractControl): ValidationErrors | null {
const input = control.value;
if (input.match(/^(0\d|1[0-2])\/\d{2}$/)) {
const {0: month, 1: year} = input.split("/");
// get midnight of first day of the next month
const expiry = new Date(+"20"+year, month);
const current = new Date();
if(expiry.getTime() > current.getTime()){
return null;
}else{
return {expiryDate:true}
}
} {
return {expiryDate:true}
}
return null;
}
}
|
d91b218c52861ca9822f13b7a3562b631e11c4d9
|
TypeScript
|
ecanro/Curso_TypeScript
|
/src/section2/variables.ts
| 2.796875
| 3
|
//Declarar
let myVar;
//Inicializar
myVar = true;
//Declarar e Inicializar
let team = "Barcelona"
//Constantes
const pi = 3.14;
|
22562c8cce57fead60775730e451ef8ff0d46d49
|
TypeScript
|
LouisRvlE/codeflix.prelude.01
|
/ex26.ts
| 3.140625
| 3
|
function isAlpha(str= ''): boolean {
for (let char of str) {
if (!char.match(/[A-Z,a-z]+/g)) {
return false
}
}
return true
}
console.log(isAlpha("Chopper"))
console.log(isAlpha("Chopper!"))
console.log(isAlpha("Chopper and Usopp"))
|
cadd7ac72bbf6f3b3afd8cce1c1a2a049f39d61a
|
TypeScript
|
khanglqse/jobfinder
|
/src/app/shared/services/scroll-to-element/scroll-to-element.service.ts
| 2.703125
| 3
|
import { Injectable } from '@angular/core';
@Injectable()
export class ScrollToElementService {
constructor() { }
scroll(element, to = 0, duration = 500) {
const start = element.scrollTop;
const change = to - start;
let currentTime = 0;
const increment = 20;
const animateScroll = () => {
currentTime += increment;
const val = this.easeInOut(currentTime, start, change, duration);
element.scrollTop = val;
if (currentTime < duration) {
setTimeout(animateScroll, increment);
}
};
animateScroll();
}
private easeInOut(t, b, c, d) {
t /= d / 2;
if (t < 1) {
return c / 2 * t * t + b;
}
t--;
return -c / 2 * (t * (t - 2) - 1) + b;
}
}
|
f7c5c54eb2abe7992e653ad65c062efe594e9147
|
TypeScript
|
ericgio/react-bootstrap-typeahead
|
/src/utils/defaultFilterBy.ts
| 3.1875
| 3
|
import isEqual from 'fast-deep-equal';
import getOptionProperty from './getOptionProperty';
import { isFunction, isString } from './nodash';
import stripDiacritics from './stripDiacritics';
import warn from './warn';
import type { LabelKey, Option } from '../types';
interface Props {
caseSensitive: boolean;
filterBy: string[];
ignoreDiacritics: boolean;
labelKey: LabelKey;
multiple: boolean;
selected: Option[];
text: string;
}
function isMatch(input: string, string: string, props: Props): boolean {
let searchStr = input;
let str = string;
if (!props.caseSensitive) {
searchStr = searchStr.toLowerCase();
str = str.toLowerCase();
}
if (props.ignoreDiacritics) {
searchStr = stripDiacritics(searchStr);
str = stripDiacritics(str);
}
return str.indexOf(searchStr) !== -1;
}
/**
* Default algorithm for filtering results.
*/
export default function defaultFilterBy(option: Option, props: Props): boolean {
const { filterBy, labelKey, multiple, selected, text } = props;
// Don't show selected options in the menu for the multi-select case.
if (multiple && selected.some((o) => isEqual(o, option))) {
return false;
}
if (isFunction(labelKey)) {
return isMatch(text, labelKey(option), props);
}
const fields: string[] = filterBy.slice();
if (isString(labelKey)) {
// Add the `labelKey` field to the list of fields if it isn't already there.
if (fields.indexOf(labelKey) === -1) {
fields.unshift(labelKey);
}
}
if (isString(option)) {
warn(
fields.length <= 1,
'You cannot filter by properties when `option` is a string.'
);
return isMatch(text, option, props);
}
return fields.some((field: string) => {
let value = getOptionProperty(option, field);
if (!isString(value)) {
warn(
false,
'Fields passed to `filterBy` should have string values. Value will ' +
'be converted to a string; results may be unexpected.'
);
value = String(value);
}
return isMatch(text, value as string, props);
});
}
|
f5b77bd804afcda4e3f4f0c6f47cf6d01c52232e
|
TypeScript
|
AnnaKuvarina/js_ts_features_examples
|
/enums.ts
| 3.75
| 4
|
type PizzaSize = 'little' | 'medium' | 'large';
enum PizzaSize2 {
small = 's',
medium = 'm',
large = 'l',
}
console.log(PizzaSize2);
function cookPizza(size: PizzaSize2): string {
switch (size) {
case PizzaSize2.small:
return 'One person pizza';
case PizzaSize2.medium:
return 'Usual pizza';
case PizzaSize2.large:
return 'The biggest pizza';
}
}
const pizza1 = cookPizza(PizzaSize2.large);
console.log(pizza1);
const array: Array<any> = []
|
c754ce96d3316e124ead98964baa0f088af1b771
|
TypeScript
|
Andrew4d3/typescript-maxi-course
|
/sections/section07/native/main.ts
| 4.0625
| 4
|
// With TS Generics we are able to create a component that can work over a variety of types rather than a single one
// Arrays and Promises are some primitive types where we can use this feature
// TS will know we are defining an Array of strings here
const myArray: Array<string> = ["foo", "bar"]; // this is equivalent to string[]
// We can also specify the type that a Promise will resolve to
const myPromise: Promise<string> = new Promise((resolve) => {
setTimeout(() => {
resolve("foo"); // TS will know this function can only receive a string
}, 100);
});
myPromise.then((response) => {
// response is infered as string here, since it was declared by our promise generic
console.log(response.split("")); // TS can use string native methods like "split"
});
|
5d236978f41ea93b5bde1cef28705d8d8bec25e7
|
TypeScript
|
kimanhou/Shoreditch
|
/src/model/Place.ts
| 2.765625
| 3
|
import Social, { SocialMediaPlatform } from "./Social";
import Tag from "./Tag";
export default class Place {
name : string;
socialMedia : Social[];
tags : Tag[];
description : string;
shortName : string;
photoPlaceUrl : string;
photoFoodUrl : string;
constructor(name : string, socialMedia : Social[], tags : Tag[], description : string, shortName : string, photoPlaceUrl : string, photoFoodUrl : string) {
this.name = name;
this.socialMedia = socialMedia;
this.tags = tags;
this.description = description;
this.shortName = shortName;
this.photoPlaceUrl = photoPlaceUrl;
this.photoFoodUrl = photoFoodUrl;
}
getInstagram = () => {
var temp = this.socialMedia.find(t => t.platform == SocialMediaPlatform.INSTAGRAM);
if (temp !== undefined) {
return temp.name;
}
return '';
}
}
|
f4b349c69bd1a6243e5aecd81359d11962a9abdf
|
TypeScript
|
hbadri1/Ionic3_Ebook_MuhammedInTheBible
|
/src/pages/debook/debook.ts
| 2.515625
| 3
|
import { Component } from '@angular/core';
import { NavController, MenuController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { AlertController } from 'ionic-angular';
@Component({
selector: 'page-debook',
templateUrl: 'debook.html'
})
export class DeBookPage {
booktitle = "Grundlagen des Islam";
chapterTitles: any[];
constructor(
public navCtrl: NavController,
public menu: MenuController,
private statusBar: StatusBar,
private alertCtrl: AlertController) {
this.initializeItems();
}
/**
*
* @param el Scrolling to the searched chapter from the summary
*/
goToChapter(index: number) {
this.menu.close();
}
/**
* Display fullscreen
*/
goToFullScreen() {
this.statusBar.hide();
}
/**
* Alert the definition of some Quran verses
* @param text
*/
presentAlert(text: string) {
let alert = this.alertCtrl.create({
title: 'Information',
message: text,
cssClass: 'alert',
buttons: ['Ok']
});
alert.present();
}
/**
*
* @param ev Seach in Summary menu (we need those 2 functions)
*/
getItems(ev: any) {
// Reset items back to all of the items
this.initializeItems();
// set val to the value of the searchbar
let val = ev.target.value;
// if the value is an empty string don't filter the items
if (val && val.trim() != '') {
this.chapterTitles = this.chapterTitles.filter((item) => {
return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}
}
/**
*
*/
initializeItems() {
this.chapterTitles = [
"Vorwort"
];
}
}
|
2493b2ea6ca5a1968f5505939331036c7771d625
|
TypeScript
|
SergNosov/DocRepoNG
|
/src/app/service_rest/impl/DoctypesServiceImpl.ts
| 2.96875
| 3
|
import {Observable} from "rxjs";
import {CommonMessage} from "../../model/Common-message";
import {Injectable} from "@angular/core";
import {DoctypesService} from "../interface/DoctypesService";
import {DoctypesDaoImpl} from "../../dao/impl/DoctypesDaoImp";
import {Doctype} from "../../model/Doctype";
@Injectable({
providedIn: 'root'
})
export class DoctypesServiceImpl implements DoctypesService {
constructor(private doctypeDao: DoctypesDaoImpl) {
}
delete(id: number): Observable<CommonMessage> {
return this.doctypeDao.delete(id);
}
getAll(): Observable<Doctype[]> {
return this.doctypeDao.getAll();
}
getById(id: number): Observable<Doctype> {
return this.doctypeDao.getById(id);
}
saveOrUpdate(doctype: Doctype): Observable<Doctype> {
if (doctype.id == 0) {
return this.doctypeDao.save(doctype);
} else {
return this.doctypeDao.update(doctype);
}
}
public isEquals(x: Doctype, y: Doctype): boolean {
// console.log('x: '+x.id+';'+'x.title: '+x.title+ ' ; '+'y: '+y.id+';'+'y.title: '+y.title);
if (x === y) {
return true; // if both x and y are null or undefined and exactly the same
// console.log("7");
} else if (!(x instanceof Object) || !(y instanceof Object)) {
// console.log("1");
return false; // if they are not strictly equal, they both need to be Objects
} else if (x.constructor !== y.constructor) {
// they must have the exact same prototype chain, the closest we can do is
// test their constructor.
// console.log("2");
//console.log("x:"+x.constructor +'\n'+"y:"+y.constructor );
return false;
} else {
for (const p in x) {
if (!x.hasOwnProperty(p)) {
continue; // other properties were tested using x.constructor === y.constructor
}
if (!y.hasOwnProperty(p)) {
// console.log("3");
return false; // allows to compare x[ p ] and y[ p ] when set to undefined
}
if (x[p] === y[p]) {
// console.log('x[p]: '+x[p]+ ';'+'y[p]: '+y[p]);
continue; // if they have the same strict value or identity then they are equal
}
if (typeof (x[p]) !== 'object') {
// console.log("4");
return false; // Numbers, Strings, Functions, Booleans must be strictly equal
}
if (!this.isEquals(x[p], y[p])) {
// console.log("5");
return false;
}
}
for (const p in y) {
if (y.hasOwnProperty(p) && !x.hasOwnProperty(p)) {
// console.log("6");
return false;
}
}
console.log('изменений нет:'+'\n'+'x: '+x.id+';'+'x.title: '+x.title+ ' ; '+'y: '+y.id+';'+'y.title: '+y.title);
return true;
}
}
}
|
840047ab15fda936136d9452fd6e66a5af50d345
|
TypeScript
|
cmarcio/bookstore-api
|
/src/services/BookService.ts
| 2.6875
| 3
|
import { ObjectID } from 'mongodb';
import { ApplicationError, ErrorCode } from '../models/ApplicationError';
import { IBook } from '../interfaces/IBook';
import { BookDao } from '../models/BookDao';
const bookDao = new BookDao();
/**
* Save a new book document in the database
*/
const insertBook = async (newBook: IBook): Promise<void> => {
const sameISBN = await getBookByISBN(newBook.isbn);
if (sameISBN) {
throw new ApplicationError(ErrorCode.BOOK_ALREADY_EXISTS);
}
await bookDao.insertOne(newBook);
};
/**
* Get all book documents from the database
*/
const getBooks = async (): Promise<IBook[]> => {
// TODO implement paginantion
const books = await bookDao.find({});
return books;
};
/**
* Get a book document by the id attribute
*/
const getBookById = async (id: string): Promise<IBook> => {
const book = await bookDao.findOne({ _id: new ObjectID(id) });
if (book) {
return book;
} else {
throw new ApplicationError(ErrorCode.BOOK_NOT_FOUND_BY_ID);
}
};
/**
* Get a book document by the isbn attribute
*/
const getBookByISBN = async (isbn: string): Promise<IBook> => {
const book = await bookDao.findOne({ isbn });
return book;
};
export const BookService = {
insertBook,
getBooks,
getBookById,
}
|
3bc311e41c9f78b27682566f4ae890e8ecc07969
|
TypeScript
|
NotJackDaniels/SportDiary
|
/source/services/StorageService/StorageService.ts
| 2.59375
| 3
|
import AsyncStorage from '@react-native-community/async-storage';
import StorageServiceInterface from './StorageServiceInterface';
export default class StorageService implements StorageServiceInterface {
SaveInStorage = async (exercise: any) => {
let exercises: any = await AsyncStorage.getItem('Exercises');
if (exercises) {
exercises = JSON.parse(exercises);
exercises.push(exercise);
await AsyncStorage.setItem('Exercises', JSON.stringify(exercises));
} else {
exercises = [];
exercises.push(exercise);
console.warn('added!');
await AsyncStorage.setItem('Exercises', JSON.stringify(exercises));
}
};
GetExercises = async () => {
return await AsyncStorage.getItem('Exercises');
};
DeleteExercise = async (item: any) => {
let exercises: any = await AsyncStorage.getItem('Exercises');
if (exercises) {
exercises = JSON.parse(exercises);
let alteredTasks = exercises.filter(function (e: any) {
return e.id !== item.id;
});
AsyncStorage.removeItem('Exercises');
AsyncStorage.setItem('Exercises', JSON.stringify(alteredTasks));
}
};
EditExercise = async (item: any) => {
let exercises: any = await AsyncStorage.getItem('Exercises');
if (exercises) {
exercises = JSON.parse(exercises);
let alteredTasks = exercises.filter(function (e: any) {
return e.id !== item.id;
});
AsyncStorage.removeItem('Exercises');
alteredTasks.push(item);
AsyncStorage.setItem('Exercises', JSON.stringify(alteredTasks));
}
};
}
|
c4e748fde9edfa915a02a55956b059ab30b9eb15
|
TypeScript
|
artalar/bacon.js
|
/test/eventstream.ts
| 3.296875
| 3
|
import * as Bacon from "..";
import { expect } from "chai";
import { expectStreamEvents, testSideEffects, once, deferred } from "./util/SpecHelper";
describe("EventStream constructor", () =>
it("Provides a way to create a new EventStream", function() {
const values: string[] = [];
const subscribe = function(sink: Bacon.EventSink<string>) {
sink(new Bacon.Next("hello"));
sink(new Bacon.End());
return function() {};
};
const s = new Bacon.EventStream(new Bacon.Desc("context", "method", ["arg"]), subscribe);
s.onValue(x => { values.push(x); return Bacon.more });
expect(s.toString()).to.equal("context.method(arg)");
deferred(() => expect(values).to.deep.equal(["hello"]));
})
);
describe("Observable.name", function() {
it("sets return value of toString and inspect", function() {
expect(Bacon.never().name("one").toString()).to.equal("one");
expect(Bacon.never().name("one").inspect()).to.equal("one");
});
it("modifies the stream in place", function() {
const obs = Bacon.never();
obs.name("one");
expect(obs.toString()).to.equal("one");
});
it("supports composition", () => expect(Bacon.never().name("raimo").toProperty().inspect()).to.equal("raimo.toProperty()"));
});
describe("Observable.withDescription", function() {
it("affects toString and inspect", () => expect(Bacon.never().withDescription("Bacon", "una", "mas").inspect()).to.equal("Bacon.una(mas)"));
it("affects desc", function() {
const description = Bacon.never().withDescription("Bacon", "una", "mas").desc;
expect(description.context).to.equal("Bacon");
expect(description.method).to.equal("una");
expect(description.args).to.deep.equal(["mas"]);
});
});
describe("EventStream.subscribe", () =>
it("asserts that argument is function", function() {
const f = () => Bacon.never<string>().subscribe(<any>"a string");
expect(f).to.throw(Error);
})
);
describe("EventStream.onValue", testSideEffects(once, "onValue"));
describe("EventStream.forEach", testSideEffects(once, "forEach"));
describe("Bacon.never", () =>
describe("should send just end", () =>
expectStreamEvents(
() => Bacon.never(),
[])
)
);
|
de857f8d457c60a6e9842f3c34f5792ad97d7d0f
|
TypeScript
|
ionous/en-inflectors
|
/src/adjective/regexp_rules.ts
| 3.65625
| 4
|
const syllablesNum = (str: string) => str.split(/[aiouy]+e*|e(?!d$|ly).|[td]ed|le$/).length;
export default [
// delicious => more delicious
{
test: (str: string) => syllablesNum(str) > 3 && !(syllablesNum(str) < 5 && /y$/.test(str)),
comp: (str: string) => "more " + str,
supr: (str: string) => "most " + str
},
// boring => more boring
{
test: (str: string) => syllablesNum(str) > 2 && /ing$/.test(str),
comp: (str: string) => "more " + str,
supr: (str: string) => "most " + str
},
// crowded => more crowded
{
test: (str: string) => syllablesNum(str) > 2 && /ed$/.test(str),
comp: (str: string) => "more " + str,
supr: (str: string) => "most " + str
},
// big => bigger
{
test: (str: string) => /[^aeiouy][aeiouy][^rwaeiouy]$/.test(str),
comp: (str: string) => str.replace(/([^aeiouy])$/, "$1$1er"),
supr: (str: string) => str.replace(/([^aeiouy])$/, "$1$1est"),
},
// heavy => heavier
{
test: (str: string) => /y$/.test(str),
comp: (str: string) => str.replace(/y$/, "ier"),
supr: (str: string) => str.replace(/y$/, "iest"),
},
// handsome => handsomer
{
test: (str: string) => /e$/.test(str),
comp: (str: string) => str.replace(/e$/, "er"),
supr: (str: string) => str.replace(/e$/, "est"),
},
// all other cases
{
test: (str: string) => true,
comp: (str: string) => str + "er",
supr: (str: string) => str + "est",
}
];
|
c6b41fe3b65609c65280c5ce3fe76f1bdec84c39
|
TypeScript
|
xTCry/bwLoader
|
/src/AppReader.ts
| 2.671875
| 3
|
import cheerio from 'cheerio';
import axios from 'axios';
import { sleep } from './tools';
export type ChunkFiles = { [key: string]: string };
export interface IExtrStr2Obj {
names: ChunkFiles;
hashes: ChunkFiles;
result: ChunkFiles;
}
export default class AppReader {
constructor(public url: string) {}
async start() {
let { data: html } = await AppReader.getPage(this.url);
let data = AppReader.getResources(html);
let res = AppReader.parseResources(data);
return {
main: data,
parsed: res,
};
}
static parseResources(data: {
js: { src?: string; data?: string }[];
css: { href: string }[];
}): {
js: string[];
css: string[];
static: {
js: string[];
css: string[];
};
staticName: string;
} {
// Get chunks
let contentWPJ: string = data.js
.filter((e) => e.hasOwnProperty('data'))
.map((e) => e.data)
.filter((e) => e.includes('window.webpackJsonp') || (e.includes('webpackJsonp') && e.includes('chunk')))[0];
const regexChunkTemplate = (type) =>
new RegExp(
`("static\\/${type}\\/"\\+\\({(?<names>.*)}\\[(.*)\\]\\|\\|(.*)\\)\\+"\\."\\+{)(?<hashes>.*)(}\\[(.*)\\]\\+"\\.chunk\\.${type}")`,
'i'
);
// Search for chunks (loadable)
const chunksJSdata = contentWPJ?.match(regexChunkTemplate('js'))?.groups || {};
const chunksCSSdata = contentWPJ?.match(regexChunkTemplate('css'))?.groups || {};
const chunkJSObj = AppReader.extactStrToObject(chunksJSdata, '.chunk');
const chunkCSSObj = AppReader.extactStrToObject(chunksCSSdata, '.chunk');
const regexTemplate = (type) =>
new RegExp(
`(\\.\\/)?(?<_static>[a-z]+)(\\/${type}\\/)?(?<code>[A-b0-9\\-]+)[\\.-](?<name>[A-b0-9\\-]+(\\.chunk)?)\\.${type}`,
'i'
);
const regexChunkJS = regexTemplate('js');
const regexChunkCSS = regexTemplate('css');
// ! bad practice of using this crutch. Remake
let staticName = '';
const getMatch = (data: string, regex) => {
let { _static, code, name } = data.match(regex)?.groups;
staticName = staticName || _static;
return { code, name, _static };
};
// Get chunks
const listJS = data.js.filter((e) => e.hasOwnProperty('src'));
const otherJS: string[] = [];
const chunkJS: ChunkFiles = {};
for (let { src } of listJS) {
if (src.includes('://')) continue;
if (!src.includes('.min.') && regexChunkJS.test(src)) {
let { code, name, _static } = getMatch(src, regexChunkJS);
if (!_static || staticName) {
chunkJS[code] = `${code}.${name}`;
}
} else {
otherJS.push(src);
}
}
const listCSS = data.css.filter((e) => e.hasOwnProperty('href'));
const otherCSS: string[] = [];
const chunkCSS: ChunkFiles = {};
for (let { href } of listCSS) {
if (href.includes('://')) continue;
if (regexChunkCSS.test(href)) {
let { code, name, _static } = getMatch(href, regexChunkCSS);
if (!_static || staticName) {
chunkCSS[code] = `${code}.${name}`;
}
} else {
otherCSS.push(href);
}
}
let js = [...Object.values(chunkJS), ...[], ...Object.values(chunkJSObj.result)].map(
(e) => `${staticName}/js/${e}.js`
);
let css = [...Object.values(chunkCSS), ...Object.values(chunkCSSObj.result)].map(
(e) => `${staticName}/css/${e}.css`
);
return {
js: otherJS,
css: otherCSS,
static: {
js,
css,
},
staticName,
};
}
static async getPage(url) {
let response = undefined;
let attemptsCount = 3;
try {
do {
try {
response = axios(url, {
timeout: 10e3,
maxRedirects: 10,
});
attemptsCount = 0;
} catch (err) {
--attemptsCount;
if (attemptsCount === 0) {
throw err;
}
}
await sleep(1e3);
} while (attemptsCount > 0);
} catch (error) {
console.error(error);
}
return response;
}
static getResources(data): { js: ({ src: string } | { data: string })[]; css: { href: string }[] } {
const $ = cheerio.load(data);
let output = {
js: [],
css: [],
};
$('script')
.get()
.forEach((elem) => {
let data = elem.attribs['src']
? {
src: elem.attribs['src'],
}
: elem.children.length > 0
? {
data: elem.children[0].data,
}
: false;
data && output.js.push(data);
});
$('link')
.get()
.filter((e) => e.attribs['href'])
.map((e) => e.attribs['href'])
.forEach((href) => {
if (href.split('.').pop() == 'css' && !output.css.map((e) => e.href).includes(href)) {
output.css.push({ href });
}
});
// $('style')
// .get()
// .forEach((elem) => {
// let data = elem.children.length > 0 ? { data: elem.children[0].data } : {};
// output.js.push(data);
// });
return output;
}
static extactStrToObject(
{ names: strNames = '', hashes: strHashes = '' },
additionalPostfix: string = ''
): IExtrStr2Obj {
strNames = strNames.replace(/['"]+/g, '');
strHashes = strHashes.replace(/['"]+/g, '');
const names = strNames
.split(',')
.filter(Boolean)
.reduce((prev, el) => {
const [code, name] = el.split(':');
return { ...prev, [code]: name };
}, {});
const hashes = strHashes
.split(',')
.filter(Boolean)
.reduce((prev, el) => {
const [code, name] = el.split(':');
return { ...prev, [code]: name };
}, {});
const result = Object.entries(hashes).reduce((prev, [code, name]) => {
return { ...prev, [code]: `${names[code] || code}.${name}${additionalPostfix}` };
}, {});
return { names, hashes, result };
}
}
export const getMe = async (url) => {
const reader = new AppReader(url);
return await reader.start();
};
|
e9f765b0f701c313b510b2a20fdfbc780288710a
|
TypeScript
|
omni360/Wonder.js
|
/src/event/handler/DomEventHandler.ts
| 2.53125
| 3
|
/// <reference path="../../filePath.d.ts"/>
module wd {
export abstract class DomEventHandler extends EventHandler{
public off(eventName:EventName):void;
public off(eventName:EventName, handler:Function):void;
public off(uid:number, eventName:EventName):void;
public off(target:GameObject, eventName:EventName):void;
public off(target:GameObject, eventName:EventName, handler:Function):void;
public off(...args) {
var self = this,
dom = this.getDom(),
eventRegister = EventRegister.getInstance(),
eventOffDataList:wdCb.Collection<EventOffData> = null;
eventOffDataList = eventRegister.remove.apply(eventRegister, args);
if(eventOffDataList){
eventOffDataList.forEach((list:wdCb.Collection<EventOffData>) => {
list.forEach((eventOffData:EventOffData) => {
self._unBind(dom, eventOffData.eventName, eventOffData.domHandler);
});
})
}
this.clearHandler();
}
protected abstract getDom();
protected abstract triggerDomEvent(event:Event, eventName:EventName, target:GameObject);
protected abstract addEngineHandler(target:GameObject, eventName:EventName, handler:Function);
@virtual
protected clearHandler(){
}
protected buildDomHandler(target:GameObject, eventName:EventName){
var self = this,
context = root;
return wdCb.EventUtils.bindEvent(context, function (event) {
self.triggerDomEvent(event, eventName, target);
});
}
protected handler(target:GameObject, eventName:EventName, handler:Function, priority:number){
var domHandler = null,
originHandler = handler;
handler = this.addEngineHandler(target, eventName, handler);
if (!EventRegister.getInstance().isBinded(target, eventName)) {
domHandler = this._bind(this.getDom(), eventName, target);
}
else{
domHandler = EventRegister.getInstance().getDomHandler(target, eventName);
}
EventRegister.getInstance().register(
target,
eventName,
handler,
originHandler,
domHandler,
priority
);
}
private _bind(dom:any, eventName:EventName, target:GameObject){
var domHandler = null;
domHandler = this.buildDomHandler(target, eventName);
wdCb.EventUtils.addEvent(
dom,
EventNameHandler.handleEventName(eventName),
domHandler
);
return domHandler;
}
private _unBind(dom, eventName, handler){
wdCb.EventUtils.removeEvent(dom, eventName, handler);
}
}
}
|
f6f9e08553b5f788a46359bbce8ace2df270dc6d
|
TypeScript
|
jitendrapanwar/todolist-angular4
|
/src/app/services/storage.service.ts
| 2.765625
| 3
|
import { TodoModel } from "../todolist/TodoModel";
import { LoginModel } from '../login/LoginModel';
export class TodoStorage {
constructor(){}
LOGINDATA = "logindata"
TODOITEMS = 'todoitems';
USERLOGGED = 'userlogged'
getTodos (): TodoModel[] {
return JSON.parse(localStorage.getItem(this.TODOITEMS) || '[]');
}
setTodos(todos: TodoModel[]) {
localStorage.setItem(this.TODOITEMS, JSON.stringify(todos));
}
setLogin(user:LoginModel) {
localStorage.setItem(this.LOGINDATA, JSON.stringify(user));
localStorage.setItem(this.USERLOGGED, 'true');
}
getLogin(): LoginModel {
return JSON.parse(localStorage.getItem(this.LOGINDATA));
}
logoutUser() {
localStorage.setItem(this.USERLOGGED, 'false');
//localStorage.removeItem(this.LOGINDATA);
}
isLogin() {
const result = localStorage.getItem(this.USERLOGGED);
if(result == 'false') return false;
return true;
}
}
|
24adb574d4ab65f15ed59ffc682ea12608ea7ead
|
TypeScript
|
Seaviello/sharelist-backend
|
/src/resolvers/Mutation.ts
| 2.578125
| 3
|
import * as bcrypt from 'bcryptjs';
import * as jwt from 'jsonwebtoken';
import { MutationResolvers } from '../generated/graphqlgen';
export const Mutation: MutationResolvers.Type = {
...MutationResolvers.defaultResolvers,
async signup(parent, args, ctx, info) {
const {name, email: rawEmail, password: rawPassword} = args;
const email = rawEmail.toLowerCase();
const password = await bcrypt.hash(rawPassword, 33);
const user = await ctx.db.createUser({name, email, password});
const token = jwt.sign({ userId: user.id }, process.env.APP_SECRET!);
ctx.response.cookie('token', token, {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 365, // 1 year cookie
});
return user;
},
async signin(parent, {email, password}, ctx, info) {
const user = await ctx.db.user({ email } );
if (!user) {
// TODO set 404
throw new Error(`No such user found for email ${email}`);
}
// 2. Check if their password is correct
const valid = await bcrypt.compare(password, user.password);
if (!valid) {
// TODO set more meaningful information
throw new Error('Invalid Password!');
}
// 3. generate the JWT Token
const token = jwt.sign({ userId: user.id }, process.env.APP_SECRET!);
// 4. Set the cookie with the token
ctx.response.cookie('token', token, {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 14,
});
// 5. Return the user
return user;
},
};
|
8d9158af74a02a7991404736919f7b1b9b1387c6
|
TypeScript
|
MTG-Paradox-Engine/mtg-paradox-engine
|
/src/Paradox/GameAction/BeginUpkeepStep.ts
| 2.953125
| 3
|
import { Game } from "../Game";
import { TurnPhase, TurnStep } from "../GameState";
import { ChangeTurnStep } from "./ChangeTurnStep";
export class BeginUpkeepStep extends ChangeTurnStep {
readonly phase: TurnPhase.Beginning;
readonly step: TurnStep.Upkeep;
actOnImpl2(game: Game): void {
// 503. Upkeep Step
// 503.1. The upkeep step has no turn-based actions. Once it begins, the active player
// gets priority. (See rule 117, “Timing and Priority.”)
// TODO
// 503.1a Any abilities that triggered during the untap step and any abilities that
// triggered at the beginning of the upkeep are put onto the stack before the active
// player gets priority; the order in which they triggered doesn’t matter. (See rule
// 603, “Handling Triggered Abilities.”)
// TODO
}
}
|
a8726d1c4222f9ae2eaf2e581c19f9eb5d2f1715
|
TypeScript
|
Sinabro-DSM/MiniTwit-Back-End
|
/src/controller/user/controller.ts
| 2.515625
| 3
|
import { Request, Response, NextFunction } from "express";
import * as mail from "../../config/mailConfig";
import * as query from "./query";
import { mkAccess, mkRefresh } from "./mkToken";
export const emailSend = async (
req: Request,
res: Response,
next: NextFunction
) => {
const email = req.body.email;
const user: any = await query.findUserByEmail(email);
if (user) throw new Error("이미 있는 아이디");
const randomNumber = query.mkRandomNumber();
const mailOption = mail.setMailOption(email, randomNumber);
mail.transporter.sendMail(mailOption, (err, info) => {
if (err) throw new Error(err.message);
else res.status(200).json({ message: "이메일 전송 성공", randomNumber });
});
};
export const signUp = async (
req: Request,
res: Response,
next: NextFunction
) => {
const { email, password, nickname } = req.body;
const id: string = await query.mkId();
const encodedPassword: string = await query.passwordEncoding(password);
await query.createUser(id, email, encodedPassword, nickname);
res.status(200).json({ message: "회원가입 성공" });
};
export const login = async (
req: Request,
res: Response,
next: NextFunction
) => {
const { email, password } = req.body;
const user: any = await query.findUserByEmail(email);
if (!user) throw new Error("존재하지 않는 유저");
if (!(await query.passwordCompare(password, user.password)))
res.status(409).json({ message: "로그인 실패" });
const accessToken = await mkAccess(req, user);
const refreshToken = await mkRefresh(req, user);
res.status(200).json({
message: "로그인 성공",
accessToken,
refreshToken,
});
};
export const refresh = async (
req: Request,
res: Response,
next: NextFunction
) => {
const id: string = req["decoded"].id;
const user: any = await query.findUserById(id);
const accessToken = await mkAccess(req, user);
res.status(200).json({ message: "성공", accessToken });
};
|
7d31135e69dd0b433e75216072f11c543cefb485
|
TypeScript
|
thegoncharoffs/angular-sandbox
|
/src/app/examples/interval/interval.component.ts
| 2.53125
| 3
|
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
import {interval, Subscription} from 'rxjs';
@Component({
selector: 'app-interval',
templateUrl: './interval.component.html',
styleUrls: ['./interval.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class IntervalComponent implements OnInit, OnDestroy {
private subscription: Subscription;
public ngOnInit(): void {
//emit value in sequence every 1 second
const source = interval(1000);
//output: 0,1,2,3,4,5....
this.subscription = source.subscribe(val => console.log(val));
}
public ngOnDestroy(): void {
this.subscription.unsubscribe();
}
}
|
2560674c34fab382c53892e47893a4e37bd432b0
|
TypeScript
|
tmxkwkfgka/modoo_server_public
|
/src/api/Place/GetDailyDistance/GetDailyDistance.resolvers.ts
| 2.703125
| 3
|
import Whichi from "../../../entities/Whichi";
import { GetDailyDistanceResponse } from "../../../types/graph";
import { Resolvers } from "../../../types/resolvers";
import privateResolver from "../../../utils/privateResolver";
import { Between } from "typeorm";
import Place from "../../../entities/Place";
const moment = require('moment')
const resolvers: Resolvers = {
Query: {
GetDailyDistance: privateResolver(
async (_, args, { req }): Promise<GetDailyDistanceResponse> => {
const {whichiId, from, to} = args;
try {
const whichi = await Whichi.findOne(
{ id: whichiId }
);
console.log("from to datetime", typeof from, to)
//날짜 필터 되어 있으면
if(from && to){
console.log("from to datetime", typeof from, to)
//let matchFrom = from.match(/([12]\d{3}.(0[1-9]|1[0-2]).(0[1-9]|[12]\d|3[01])) ([01][0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9]|)/g)
//let matchTo = to.match(/([12]\d{3}.(0[1-9]|1[0-2]).(0[1-9]|[12]\d|3[01])) ([01][0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9]|)/g)
//넘어온 문자열이 date 타입일경우
//console.log("from to = ", matchFrom[0], matchTo[0])
//if(matchFrom && matchTo && matchFrom[0] && matchTo[0]){
const fromStr = moment(from).format('YYYY.MM.DD')
const toStr = moment(new Date(moment(to).year(), moment(to).month(), moment(to).date(), 23, 59, 59)).format('YYYY.MM.DD HH:mm:ss');
if (whichi) {
const places = await Place.find({
where : {
imei : whichi.imei,
createdAt: Between(fromStr, toStr)
}
})
let resultArr : any = []
let descArr = places.sort((a,b)=>new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
// 유효한 위도경도 값을 가진 place만 배열에저장
descArr = descArr.filter((place)=>{
return ((-90 <= place.lat) && (place.lat <= 90)) && ((-180 <= place.lng) && (place.lng <= 180))
})
let sumDisKm = 0;
let sumDisFeet = 0;
let sumDisKnot = 0;
let sumSpeed = 0;
let speedIndex = 0;
console.log("desc arr = ", descArr)
for(let i=0; i<descArr.length-1; i++){
let first = new Date(descArr[i].createdAt)
let second = new Date(descArr[i+1].createdAt)
let diskm: any = distance(descArr[i].lat, descArr[i].lng, descArr[i+1].lat, descArr[i+1].lng, 'K').toFixed(2)
let disfeet: any = distance(descArr[i].lat, descArr[i].lng, descArr[i+1].lat, descArr[i+1].lng, 'F').toFixed(2)
let disknot: any = distance(descArr[i].lat, descArr[i].lng, descArr[i+1].lat, descArr[i+1].lng, 'N').toFixed(2)
let speed: any = descArr[i].speed? descArr[i].speed : 0;
if(first.getFullYear() == second.getFullYear() && first.getMonth() == second.getMonth() && first.getDate() == second.getDate() && (i+1 != descArr.length-1)){
// 같은 날이면
sumDisKm += diskm*1
sumDisFeet += disfeet*1
sumDisKnot += disknot*1
sumSpeed += speed
}else{
// 같은날이 아니면 array에 push하고 sum값은 초기화
console.log(sumDisKm.toFixed(2), first)
resultArr.push({
km: sumDisKm,
feet: sumDisFeet,
knot: sumDisKnot,
speed: sumSpeed / (i-speedIndex+1),
date: moment(first).format('YYYY-MM-DD'),
})
sumDisKm = 0;
sumDisFeet = 0;
sumDisKnot = 0;
speedIndex = i+1;
sumSpeed = 0;
}
}
// return res.json({
// descArr
// })
// const fields = ['date', 'km', 'feet', 'knot'];
// const opts = { fields };
// const parser = new Parser(opts)
// const csv = parser.parse(resultArr);
let kmsum = 0;
let feetsum = 0;
let knotsum = 0;
let speedsum = 0;
//let arrlen = resultArr.length;
resultArr.forEach((ob)=>{
kmsum += ob.km;
feetsum += ob.feet;
knotsum += ob.knot;
speedsum += ob.speed;
})
return {
ok: true,
error: null,
resultArr,
kmsum,
feetsum,
knotsum,
speedavg: speedsum / descArr.length
};
}else{
return {
ok: false,
resultArr: null,
kmsum: null,
feetsum: null,
knotsum: null,
speedavg: null,
error: "whichi not found"
};
}
// }
}
return {
ok: false,
resultArr: null,
kmsum: null,
feetsum: null,
knotsum: null,
speedavg: null,
error: "invalid argument"
};
}catch (error) {
return {
ok: false,
resultArr: null,
kmsum: null,
feetsum: null,
knotsum: null,
speedavg: null,
error
};
}
}
)
}
};
function distance(lat1, lon1, lat2, lon2, unit) {
if (((lat1 == lat2) && (lon1 == lon2)) || !(lat1 && lon1 && lat2 && lon2)) {
return 0;
}
else {
var radlat1 = Math.PI * lat1/180;
var radlat2 = Math.PI * lat2/180;
var theta = lon1-lon2;
var radtheta = Math.PI * theta/180;
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
if (dist > 1) {
dist = 1;
}
dist = Math.acos(dist);
dist = dist * 180/Math.PI;
dist = dist * 60 * 1.1515;
if (unit=="K") { dist = dist * 1.609344 }
if (unit=="N") { dist = dist * 0.8684 }
if (unit=="F") { dist = dist * 5280.00016896}
return dist;
}
}
export default resolvers;
|
fdcaae242d5ca110d9fbe9ecae9ea36e189c0d7f
|
TypeScript
|
artsy/eigen
|
/src/app/Scenes/SellWithArtsy/SubmitArtwork/UploadPhotos/utils/calculatePhotoSize.ts
| 3.015625
| 3
|
import { Photo } from "app/Scenes/SellWithArtsy/SubmitArtwork/UploadPhotos/validation"
import { transformBytesToSize } from "app/utils/transformBytesToSize"
const TOTAL_SIZE_LIMIT_IN_BYTES = 30000000
// calculates a photos size from Bytes to unit and return updated photo
export const calculateSinglePhotoSize = (photo: Photo): Photo => {
if (photo.automaticallyAdded) {
photo.sizeDisplayValue = "Automatically added"
return photo
}
if (!photo.size) {
photo.error = true
photo.sizeDisplayValue = "Size not found"
return photo
}
photo.sizeDisplayValue = transformBytesToSize(photo.size)
return photo
}
// calculates the total size of an array of photos
export const getPhotosSize = (photos: Photo[]) => {
const allPhotosSize = photos.reduce((acc: number, cv: Photo) => {
acc = acc + (cv?.size || 0)
return acc
}, 0)
return allPhotosSize
}
// calculates all photos' size and returns if total size exceeds limit
export const isSizeLimitExceeded = (photos: Photo[]): boolean => {
const allPhotosSize = getPhotosSize(photos)
return allPhotosSize > TOTAL_SIZE_LIMIT_IN_BYTES
}
|
8359c011bb4499fb8179b8ffc13cd3f6b2ff5455
|
TypeScript
|
acateland/collectable
|
/packages/sorted-set/tests/functions/add.ts
| 3.125
| 3
|
import {assert} from 'chai';
import {modify, isMutable, isImmutable} from '@collectable/core';
import {SortedSetStructure, add, has, size} from '../../src';
import {fromStringArray} from '../test-utils';
suite('[SortedSet]', () => {
suite('add()', () => {
suite('when the item already exists in the set', () => {
let set0: SortedSetStructure<string>, set1: SortedSetStructure<string>;
setup(() => {
set0 = fromStringArray(['D', 'A', 'B']);
set1 = add('B', set0);
});
test('the set size does not change', () => {
assert.strictEqual(size(set0), 3);
assert.strictEqual(size(set1), 3);
});
test('the input set is returned', () => {
assert.strictEqual(set0, set1);
});
test('the specified item can still be retrieved from the set', () => {
assert.isTrue(has('B', set1));
});
});
suite('when the item does not exist in the set', () => {
let set0: SortedSetStructure<string>, set1: SortedSetStructure<string>;
suite('if the input set is mutable', () => {
suiteSetup(() => {
set0 = modify(fromStringArray(['A', 'B', 'D']));
set1 = add('C', set0);
});
test('the input set is returned', () => {
assert.strictEqual(set0, set1);
});
test('the input set is still mutable', () => {
assert.isTrue(isMutable(set1));
});
test('the set size is incremented', () => {
assert.strictEqual(size(set1), 4);
});
test('the added item can be retrieved from the set', () => {
assert.isTrue(has('C', set1));
});
test('all expected members exist in the set in the correct order', () => {
assert.deepEqual(Array.from(set1), ['A', 'B', 'C', 'D']);
});
});
suite('if the input set is immutable', () => {
suiteSetup(() => {
set0 = fromStringArray(['A', 'B', 'D']);
set1 = add('C', set0);
});
test('the input set is not modified', () => {
assert.deepEqual(Array.from(set0), ['A', 'B', 'D']);
assert.strictEqual(size(set0), 3);
assert.isTrue(isImmutable(set0));
});
test('a new immutable set is returned', () => {
assert.isTrue(isImmutable(set1));
});
test('the size of the new set is one greater than that of the input set', () => {
assert.strictEqual(size(set1), 4);
});
test('the new set has all of the items in the input set', () => {
for(let c of Array.from(set0)) {
assert.isTrue(has(c, set1));
}
});
test('the added item can be retrieved from the new set', () => {
assert.isTrue(has('C', set1));
});
test('all expected members exist in the new set in the correct order', () => {
assert.deepEqual(Array.from(set1), ['A', 'B', 'C', 'D']);
});
});
});
});
});
|
5a147e0e1063ed9929ece43f142130f0bb8ef18a
|
TypeScript
|
palexcast/foos-rating
|
/src/app/shared/services/history.service.ts
| 2.515625
| 3
|
import {Injectable} from '@angular/core';
import {AngularFirestore, AngularFirestoreCollection} from '@angular/fire/firestore';
import {HistoryModel} from '../models/history.model';
import {combineLatest, Observable} from 'rxjs';
import {TeamHistoryModel} from '../models/team-history.model';
import {GenericHistoryModel} from '../models/generic-history.model';
import {map, tap} from 'rxjs/operators';
@Injectable()
export class HistoryService {
private historyCollection: AngularFirestoreCollection<HistoryModel>;
private teamHistoryCollection: AngularFirestoreCollection<TeamHistoryModel>;
constructor(private afs: AngularFirestore) {
}
private static convertUserHistory(history: HistoryModel): GenericHistoryModel {
return new GenericHistoryModel({
created: history.created,
lastUpdated: history.lastUpdated,
winnerName: history.player1Name,
winnerOldRating: history.player1OldRating,
winnerNewRating: history.player1NewRating,
loserName: history.player2Name,
loserOldRating: history.player2OldRating,
loserNewRating: history.player2NewRating
});
}
private static convertTeamHistory(history: TeamHistoryModel): GenericHistoryModel {
return new GenericHistoryModel({
created: history.created,
lastUpdated: history.lastUpdated,
winnerName: history.team1Name,
winnerOldRating: history.team1OldRating,
winnerNewRating: history.team1NewRating,
loserName: history.team2Name,
loserOldRating: history.team2OldRating,
loserNewRating: history.team2NewRating
});
}
getSoloHistory(top: number): Observable<HistoryModel[]> {
this.historyCollection = this.afs.collection<HistoryModel>('history', ref => {
return ref.orderBy('created', 'desc').limit(top);
});
return this.historyCollection.valueChanges();
}
getTeamHistory(top: number): Observable<TeamHistoryModel[]> {
this.teamHistoryCollection = this.afs.collection<TeamHistoryModel>('team-history', ref => {
return ref.orderBy('created', 'desc').limit(top);
});
return this.teamHistoryCollection.valueChanges();
}
getJointHistory(top: number): Observable<GenericHistoryModel[]> {
return combineLatest(this.getSoloHistory(top), this.getTeamHistory(top)).pipe(
map(([userHistory, teamHistory]) => {
return userHistory.map(h => HistoryService.convertUserHistory(h))
.concat(teamHistory.map(h => HistoryService.convertTeamHistory(h)));
}),
tap(history => history.sort((a, b) => b.created - a.created)),
map(history => history.splice(0, top)),
);
}
}
|
876af6a48051ebc300b3a1d13a5d46c4c90588bf
|
TypeScript
|
ValeryiaMIRON/english-for-kids
|
/english-for-kids/src/components/switch/switch.ts
| 2.734375
| 3
|
import './switch.scss';
import { BaseComponent } from '../base-component';
import { store, getMode } from '../../store/store';
import { Mode } from '../../types/types';
export class Switch extends BaseComponent {
onClickHandler: (mode: Mode) => void;
pushSwitch: () => void;
constructor(onClickHandler: (mode: Mode) => void, pushSwitch: () => void) {
super('div', ['switch-wrapper']);
this.element.innerHTML = `
<label class="switch">
<input type="checkbox" class="switch-input" checked="">
<span class="switch-span" data-on="Train" data-off="Play"></span>
<span class="switch-handle"></span>
</label>
`;
this.onClickHandler = onClickHandler;
this.pushSwitch = pushSwitch;
this.event();
}
event = (): void => {
this.element.querySelector('input')?.addEventListener('click', () => {
store.mode = getMode() === Mode.TRAIN ? Mode.PLAY : Mode.TRAIN;
this.onClickHandler(store.mode);
this.pushSwitch();
});
};
}
|
8d85c2595e2a36215aa1c377013364e1e935dc48
|
TypeScript
|
Santiago1934/compuStore-ecommerce
|
/api/src/models/Review.ts
| 2.640625
| 3
|
import { Association, DataTypes, Model, Optional, Sequelize,
//BelongsToOne Model,
BelongsToGetAssociationMixin,
BelongsToSetAssociationMixin,
BelongsToCreateAssociationMixin,
} from 'sequelize';
import { Product } from './Product';
import { User } from './User';
export interface ReviewAttributesI {
id:number;
text:string;
rating:number;
title:string;
userId: string;
}
export interface ReviewCreationAttributesI extends Optional<ReviewAttributesI, 'id'> {}
export class Review extends Model<ReviewAttributesI, ReviewCreationAttributesI>
implements ReviewAttributesI{
public id!: number;
public text!: string;
public title!: string;
public rating!: number;
public userId!: string;
public readonly createdAt!:Date;
public readonly updatedAt!:Date;
public getReviews!: BelongsToGetAssociationMixin<Review>
public setReview!: BelongsToSetAssociationMixin<Review[], number>
public createReview!: BelongsToCreateAssociationMixin<Review>
public readonly product?: Product;
public static associations:{
product: Association<Review, Product>
user: Association<Review, User>
}
}
export function ReviewFactory(sequelize: Sequelize){
Review.init({
id:{
type: DataTypes.INTEGER,
autoIncrement:true,
primaryKey: true,
},
userId:{
type: DataTypes.STRING,
},
text:{
type: DataTypes.TEXT,
},
rating:{
type: DataTypes.INTEGER,
},
title:{
type: DataTypes.TEXT,
}
},{
tableName: 'reviews',
sequelize
});
return Review;
}
|
405bbd731b0436e90d18cba4cea66fce71f3ab11
|
TypeScript
|
nkint/umbrella
|
/packages/transducers/src/xform/converge.ts
| 3.140625
| 3
|
import { Predicate2, SEMAPHORE } from "@thi.ng/api";
import { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import { ensureReduced } from "../reduced";
/**
* Transducer which for each input `x` (apart from the very first one)
* applies given predicate `pred` to previous input and `x`. Only passes
* values downstream as long as the predicate returns a falsy result.
* Once the result is truthy, `x` is considered converged and the
* transformation is terminated (by emitting a `reduced()` value).
*
* This can be used to limit processing of inputs only as long as
* there're noticeable changes (according to the predicate) and then
* stop the transducer pipeline once results have converged.
*
* ```
* // process as long as difference to prev value is >= 0.01
* [...converge(
* // predicate
* (a, b) => Math.abs(a - b) < 0.01,
* // input sequence
* iterate((x, i) => x + Math.pow(2, -i), 0)
* )]
* // [ 0, 0.5, 0.75, 0.875, 0.9375, 0.96875, 0.984375, 0.9921875 ]
* ```
*
* @see takeWhile
*
* @param pred
* @param src
*/
export function converge<T>(pred?: Predicate2<T>): Transducer<T, T>;
export function converge<T>(
pred: Predicate2<T>,
src: Iterable<T>
): IterableIterator<T>;
export function converge<T>(...args: any[]): any {
return (
$iter(converge, args) ||
((rfn: Reducer<any, T>) => {
const r = rfn[2];
const pred = args[0];
let prev: any = SEMAPHORE;
let done = false;
return compR(rfn, (acc, x: T) => {
if (done || (prev !== SEMAPHORE && pred(prev, x))) {
done = true;
return ensureReduced(r(acc, x));
}
prev = x;
return r(acc, x);
});
})
);
}
|
d9db46f04461be8e0518642cfcfef41c6368dbf9
|
TypeScript
|
Muhitori/Shop
|
/apps/server/src/database/migrations/20201215price.migration.ts
| 2.65625
| 3
|
import {
MigrationInterface,
QueryRunner,
Table,
TableForeignKey
} from 'typeorm'
import { Country } from '../../entities/country.entity'
export class PriceMigration20201215235634 implements MigrationInterface {
private tableName = 'Prices'
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: this.tableName,
columns: [
{
name: 'id',
type: 'uuid',
default: 'uuid_generate_v4()',
isPrimary: true
},
{
name: 'value',
type: 'double precision',
isNullable: false
},
{
name: 'discount',
type: 'int',
isNullable: true
},
{
name: 'currency',
type: 'varchar',
length: '255',
isNullable: false
},
{
name: 'countryId',
type: 'uuid',
isNullable: false
},
{
name: 'createdAt',
type: 'timestamptz',
default: 'now()',
isNullable: false
},
{
name: 'updatedAt',
type: 'timestamptz',
isNullable: true
},
{
name: 'deletedAt',
type: 'timestamptz',
isNullable: true
}
]
})
)
await queryRunner.createForeignKey(
this.tableName,
new TableForeignKey({
columnNames: ['countryId'],
referencedColumnNames: ['id'],
referencedTableName: 'Countries',
onDelete: 'CASCADE'
})
)
const [
{ id }
]: Country[] = await queryRunner.query(
'SELECT id FROM "Countries" WHERE name = $1',
['Ukraine']
)
await queryRunner.query(
'INSERT INTO "Prices"("id", "value", "discount", "currency", "countryId") VALUES (DEFAULT, $1, $2, $3, $4);',
[100, 0, 'Dollar', id]
)
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable(this.tableName)
}
}
|
6b1798639feccecbb356ae32ffc64e087e462843
|
TypeScript
|
Vadorequest/ejs-locals
|
/app/lib/Block.ts
| 3.125
| 3
|
///<reference path='./../lib/def/defLoader.d.ts'/>
export class Block {
public html: any = new Array();
/**
* Convert HTML to string.
* @return {string}
*/
public toString() {
return this.html.join('\n');
}
/**
* Append a new HTML block.
* @param more
*/
public append(more) {
this.html.push(more);
}
/**
* Prepend an HTML block, so it's like append it but at the beginning of the array.
* @param more
*/
public prepend(more) {
this.html.unshift(more);
}
/**
* Replace the whole HTML block by a new array.
* @param instead
*/
public replace(instead) {
this.html = [ instead ];
}
}
|
957f1dc8f3e286ee424b953e851bddc9c4f79287
|
TypeScript
|
MakersExtia/DispoBox
|
/Ionic2App/src/utilities/Utils.ts
| 2.921875
| 3
|
export class Utils {
static ISODateString(d) {
function pad(n) {
return n<10 ? '0'+n : n
}
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
+ pad(d.getUTCDate())+'T'
+ pad(d.getUTCHours())+':'
+ pad(d.getUTCMinutes())+':'
+ pad(d.getUTCSeconds())+'Z';
}
static extractTime(date: Date) {
return (date.getHours() >= 10 ? date.getHours() : '0' + date.getHours()) + 'H' + (date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes());
}
}
|
2392899dc6a9380e5f9c1b48b9405430ae972553
|
TypeScript
|
theramidev/Music_Reproductor_App
|
/src/app/database/SongController.ts
| 2.96875
| 3
|
import {SQLiteDatabase, ResultSet} from 'react-native-sqlite-storage';
import {ISong, MSong} from '../models/song.model';
import {IReproduction, MReproduction} from '../models/reproduction.model';
import fs from 'react-native-fs';
class SongController {
private tableSong: string = 'song';
private tableReproduction: string = 'reproduction';
/**
*
* @param database Base de datos local
* @param path Ruta del archivo que se va a borrar
* @return
*/
public deleteFile(path: string): Promise<boolean> {
return new Promise(async (resolve, reject) => {
try {
console.log(path);
const existFile = await fs.exists(path);
console.log(existFile);
if (existFile) {
await fs.unlink(path);
}
resolve(true);
} catch (error) {
console.error('Delete File Error: ', error);
reject(false);
}
});
}
/**
* @description Actuaiza una canción
* @param database Base de datos local
* @param songId Id de la canción
* @param title Título de la canción
* @param author Author de la canción
* @param album Albúm de la canción
* @param lyrics Letra de la canción
* @param cover Cover o portada de la canción
* @return Promise<void>
*/
public async updateSong(
database: SQLiteDatabase,
songId: string,
title: string,
author: string | null = null,
album: string | null = null,
lyrics: string | null = null,
cover: string | null = null,
): Promise<void> {
try {
const statement = `UPDATE ${this.tableSong} SET title=?, author=?, album=?, lyrics=?,
cover=? WHERE id=?`;
const params = [title, author, album, lyrics, cover, songId];
await database.executeSql(statement, params);
} catch (error) {
console.error('UpdateSong Error: ', error);
Promise.reject(error);
}
}
/**
* @description Busca una o unas canciones especificas
* @param database Base de datos local
* @param words Palabras o nombre de la canción que se va a buscar
* @return Promise<MSong[]>
*/
public getSongsSearch(
database: SQLiteDatabase,
words: string,
): Promise<MSong[]> {
return new Promise(async (resolve, reject) => {
try {
const allSongs = await this.getSongs(database);
const searchSongs: MSong[] = allSongs.filter(song => {
return song.title.toLowerCase().indexOf(words.toLowerCase()) !== -1;
});
resolve(searchSongs);
} catch (error) {
console.error('Error getSongsSearch: ', error);
reject(error);
}
});
}
/**
* @description Actualiza una canción a favorito o no
* @param database Base de datos local
* @param songId Id de la canción que se va a modificar
* @param isFavorite Si es favorito o no
* @return Promise<void>
*/
public async updateSongToFavorite(
database: SQLiteDatabase,
songId: string,
isFavorite: boolean,
): Promise<void> {
try {
const statement: string = `UPDATE ${this.tableSong} SET isFavorite = ?
WHERE id = ?`;
const params = [isFavorite ? 1 : 0, songId];
await database.executeSql(statement, params);
} catch (error) {
console.error('updateSongToFavoriteDB: ', error);
Promise.reject(error);
}
}
/**
* @description Obtiene los favoritos de la base de datos
* @param database Base de datos local
* @return Promise<MSong[]>
*/
public async getFavoriteSongs(database: SQLiteDatabase): Promise<MSong[]> {
return new Promise(async (resolve, reject) => {
try {
const statement: string = `SELECT * FROM ${this.tableSong}
WHERE isFavorite = 1`;
const [result]: [ResultSet] = await database.executeSql(statement);
const songs: MSong[] = result.rows.raw().map((song: ISong) => {
return new MSong(song);
});
resolve(songs);
} catch (error) {
console.error('getFavoriteSongsDB: ', error);
reject(error);
}
});
}
/**
* @description Inserta en la base de datos la última canción en reproducirse
* @param database Base de datos local
* @param songId Id de al canción
* @return Promise<any>
*/
public async setReproduction(
database: SQLiteDatabase,
songId: string,
): Promise<any> {
return new Promise(async (resolve, reject) => {
try {
const reproductions: MReproduction[] = await this.getReproductions(
database,
);
const found: MReproduction | undefined = reproductions.find(
reproduction => reproduction.song.id === songId,
);
if (found) {
await this.deleteReproduction(database, found.reprodcutionId);
}
const statement: string = `INSERT INTO ${this.tableReproduction}
(id_song, create_date) VALUES (?, ?)`;
await database.executeSql(statement, [songId, new Date().getTime()]);
resolve(true);
} catch (error) {
console.error(error);
reject(error);
}
});
}
/**
* @description Obtiene las últimas 20 reproducciones
* @param database Base de datos local
* @return Promise<MReproduction[]>
*/
public async getReproductions(
database: SQLiteDatabase,
): Promise<MReproduction[]> {
return new Promise(async (resolve, reject) => {
try {
const statement: string = `SELECT a.id AS reproductionId, a.create_date, b.id AS songId,
b.title, b.duration, b.path, b.isFavorite, b.author, b.album, b.genre, b.lyrics, b.cover
FROM ${this.tableReproduction} AS a INNER JOIN ${this.tableSong} AS b
ON a.id_song = b.id ORDER BY a.id DESC LIMIT 20`;
const [result]: [ResultSet] = await database.executeSql(statement);
const reproductions: MReproduction[] = result.rows
.raw()
.map((reproduction: IReproduction) => {
return new MReproduction(reproduction);
});
resolve(reproductions);
} catch (error) {
console.error('Error getReproductions: ', error);
reject(error);
}
});
}
/**
* @description Elimina una reproducción de la base de datos
* @param database Base de datos local
* @param reproductionId Id de la repdroducción
* @return Promise<any>
*/
public async deleteReproduction(
database: SQLiteDatabase,
reproductionId: number,
): Promise<any> {
return new Promise((resolve, reject) => {
try {
const statement: string = `DELETE FROM ${this.tableReproduction}
WHERE id = ?`;
database.executeSql(statement, [reproductionId]);
resolve(true);
} catch (error) {
console.error(error);
reject(error);
}
});
}
/**
* @description Inserta las canciones en la abse de datos
* @param database Base de datos local
* @param songs Canciones que van a ser agregadas
* @return Promise<any>
*/
public async setSongs(
database: SQLiteDatabase,
songs: ISong[],
): Promise<any> {
try {
for (const song of songs) {
const {
id,
title,
duration,
path,
author,
album,
genre,
lyrics,
cover,
} = song;
const existSongInDB: boolean = await this.existSong(database, song.id);
if (!existSongInDB) {
const statement: string = `INSERT INTO ${this.tableSong}
(id, title, duration, path, author, album, genre, lyrics, cover)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`;
const params = [
id,
title,
duration,
path,
author,
album,
genre,
lyrics,
cover,
];
await database.executeSql(statement, params);
}
}
const databaseSongs: MSong[] = await this.getSongs(database);
for (const song of databaseSongs) {
const found: ISong | undefined = songs.find(songFind => {
if (songFind.id === song.id) {
return true;
}
});
if (!found) {
await this.deleteSong(database, song.id);
}
}
} catch (error) {
console.error('Error setSongs DB: ', error);
Promise.reject(error);
}
}
/**
* @description Obtiene TODAS las canciones de la base de datos local
* @param database Base de datos local
* @return Promise<MSong[]>
*/
public async getSongs(database: SQLiteDatabase): Promise<MSong[]> {
return new Promise(async (resolve, reject) => {
try {
const statement: string = `SELECT * FROM ${this.tableSong} ORDER BY title ASC`;
const [result]: [ResultSet] = await database.executeSql(statement);
// console.log('Result getSongs: ', result.rows.raw());
const songs: MSong[] = result.rows
.raw()
.map((song: ISong) => new MSong(song));
resolve(songs);
} catch (error) {
console.error('Error getSongs DB: ', error);
reject(error);
}
});
}
/**
* @description Obtiene UNA canción
* @param database Base de datos local
* @param songId Id de la canción que se va a buscar
* @return Promise<MSong[] | undefined>
*/
public async getSongById(
database: SQLiteDatabase,
songId: string,
): Promise<MSong | undefined> {
return new Promise(async (resolve, reject) => {
try {
const statement: string = `SELECT * FROM ${this.tableSong} WHERE id = ?`;
const [result]: [ResultSet] = await database.executeSql(statement, [
songId,
]);
// console.log('Result getSongbyId DB: ', result.rows.item(0));
resolve(
result.rows.item(0)
? new MSong(result.rows.item(0))
: result.rows.item(0),
);
} catch (error) {
console.error('Error getSongById DB: ', error);
reject(error);
}
});
}
/**
* @description Elimina una canción de la base de datos
* @param database Base de datos local
* @param songId Id de la canción
*/
public async deleteSong(
database: SQLiteDatabase,
songId: string,
): Promise<any> {
return new Promise(async (resolve, reject) => {
try {
console.log(songId);
const statement: string = `DELETE FROM ${this.tableSong} WHERE id = ?`;
await database.executeSql(statement, [songId]);
resolve(true);
} catch (error) {
console.error('Error Delete Song: ', error);
reject(error);
}
});
}
/**
* @description Verifica si una cacnión existe en a base de datos
* @param database Base de datos local
* @param songId Id de la canción
* @return Promise<boolean>
*/
public async existSong(
database: SQLiteDatabase,
songId: string,
): Promise<boolean> {
return new Promise(async (resolve, reject) => {
try {
const song = await this.getSongById(database, songId);
if (song) {
resolve(true);
}
resolve(false);
} catch (error) {
console.error('Error existSong DB: ', error);
reject(error);
}
});
}
}
export default new SongController();
|
8064efdb49722e2342c7c1f0ac8f6cc83da4e367
|
TypeScript
|
ofuangka/prop-messages
|
/ui/src/app/arrow/arrow.component.ts
| 2.578125
| 3
|
import { Component, AfterViewInit, Input, ElementRef, ViewChild } from '@angular/core';
const DEFAULT_WIDTH = 5,
DEFAULT_HEIGHT = 10,
DEFAULT_THICKNESS = 2,
DEFAULT_COLOR = '#999999';
@Component({
selector: 'arrow',
template: '<canvas #arrowCanvas></canvas>',
styleUrls: ['./arrow.component.css']
})
export class ArrowComponent implements AfterViewInit {
@ViewChild('arrowCanvas')
canvas: ElementRef;
@Input()
dir = "right";
@Input()
width = DEFAULT_WIDTH;
@Input()
height = DEFAULT_HEIGHT;
@Input()
thickness = DEFAULT_THICKNESS;
@Input()
color = DEFAULT_COLOR;
constructor(private element: ElementRef) { }
ngAfterViewInit() {
var context: CanvasRenderingContext2D = this.canvas.nativeElement.getContext('2d'),
numericWidth = Number(this.width),
numericHeight = Number(this.height),
numericThickness = Number(this.thickness),
topLeft = [numericThickness, numericThickness],
topRight = [numericThickness + numericWidth, numericThickness],
bottomLeft = [numericThickness, numericThickness + numericHeight],
bottomRight = [numericThickness + numericWidth, numericThickness + numericHeight],
centerX = (numericWidth + 2 * numericThickness) / 2,
centerY = (numericHeight + 2 * numericThickness) / 2,
centerTop = [centerX, numericThickness],
centerRight = [numericThickness + numericWidth, centerY],
centerBottom = [centerX, numericThickness + numericHeight],
centerLeft = [numericThickness, centerY],
totalWidth = this.canvas.nativeElement.width = numericWidth + 2 * numericThickness,
totalHeight = this.canvas.nativeElement.height = numericHeight + 2 * numericThickness;
context.beginPath();
switch (this.dir) {
case 'up':
context.moveTo(bottomLeft[0], bottomLeft[1]);
context.lineTo(centerTop[0], centerTop[1]);
context.lineTo(bottomRight[0], bottomRight[1]);
break;
case 'right':
context.moveTo(topLeft[0], topLeft[1]);
context.lineTo(centerRight[0], centerRight[1]);
context.lineTo(bottomLeft[0], bottomLeft[1]);
break;
case 'bottom':
context.moveTo(topLeft[0], topLeft[1]);
context.lineTo(centerBottom[0], centerBottom[1]);
context.lineTo(topRight[0], topRight[1]);
break;
case 'left':
context.moveTo(topRight[0], topRight[1]);
context.lineTo(centerLeft[0], centerLeft[1]);
context.lineTo(bottomRight[0], bottomRight[1]);
break;
}
context.lineWidth = this.thickness;
context.strokeStyle = this.color;
context.stroke();
}
}
|
0a54206c5e9215ddea8e58aa502a3acac999b4da
|
TypeScript
|
dwjohnston/geoart-take-100
|
/src/PureModel/DrawMakers/DotMaker.ts
| 2.65625
| 3
|
import { IDrawMaker } from "../AbstractModelItem";
import { Circle } from "../Drawables/Circle";
import { AbstractValueMaker } from "../ValueMakers/AbstractValueMaker";
import { PossiblePositionMakers } from "../ValueMakers/PositionMakers";
export class DotMaker implements IDrawMaker {
private p1: AbstractValueMaker<PossiblePositionMakers>;
constructor(params: { p1: AbstractValueMaker<PossiblePositionMakers> }) {
const { p1 } = params;
this.p1 = p1;
}
getDrawables() {
return {
temp: [
// new Circle(this.p1.getValue(), 0.005, "rgba(255, 0, 0, 1)")
],
paint: [
new Circle(this.p1.getValue(), 0.0025, "rgba(255, 230, 230, 0.3)"),
],
};
}
}
|
7aee24f8079250bd1603ed427529d800bd497f17
|
TypeScript
|
trungphancode/learn-rxjs
|
/src/operators/pipe_if.ts
| 2.96875
| 3
|
import {ObservableInput, UnaryFunction} from 'rxjs/src/internal/types';
import {defer} from 'rxjs';
/**
* Conditionally selects pipe for the stream. The condition is evaluated at
* subscription time.
*/
export function pipeIf<T, R>(
condition: () => boolean,
truePipe: UnaryFunction<T, R>,
falsePipe: UnaryFunction<T, R>) {
return (stream: T) => defer(() => {
if (condition()) {
return truePipe(stream) as unknown as ObservableInput<unknown>;
} else {
return falsePipe(stream) as unknown as ObservableInput<unknown>;
}
});
}
|
30f3433deb6349fae1c36bd6e365a105303c901b
|
TypeScript
|
kaylinpham/simple-todo-nestjs
|
/src/todo/dto/todo.dto.ts
| 2.59375
| 3
|
import { ApiProperty } from "@nestjs/swagger";
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from "class-validator";
export class CreateTodoDto {
@IsNotEmpty()
@IsString()
@ApiProperty()
title: string;
@IsNotEmpty()
@IsString()
@ApiProperty()
userId: string
}
export class UpdateTodoDto {
@IsOptional()
@IsString()
@ApiProperty()
@ApiProperty({
required: false,
})
title?: string;
@IsOptional()
@IsBoolean()
@ApiProperty({
required: false,
})
completed?: boolean;
}
export class TodoDto {
@ApiProperty()
id: string;
@ApiProperty()
title: string;
@ApiProperty()
completed: boolean;
@ApiProperty()
userId: string
@ApiProperty()
createdAt: Date
@ApiProperty()
updatedAt: Date
}
|
be9f05a4aa2cfdabbc04889510df7024224fb2e9
|
TypeScript
|
BenChung/GradualComparison
|
/examples/strongscript/4.ts
| 3.09375
| 3
|
class A {
foo() : !number { return 1 }
}
class B {
foo() : !string {return "meh"}
}
class D {
ref : !A
anyref : any
main() : !B {
this.ref = new A()
this.anyref = this.ref
return this.anyref
}
}
|
f527807209f0f45ac3bf7180b636d018d390f069
|
TypeScript
|
spinnaker/deck
|
/packages/core/src/cluster/ClusterRuleMatcher.spec.ts
| 2.875
| 3
|
import type { IClusterMatcher, IClusterMatchRule } from './ClusterRuleMatcher';
import { DefaultClusterMatcher } from './ClusterRuleMatcher';
describe('CustomRuleMatcher', () => {
let matcher: IClusterMatcher;
const account = 'test';
const location = 'us-east-1';
const stack = 'stack';
const detail = 'detail';
const clusterName = 'myapp-stack-detail';
beforeEach(() => {
matcher = new DefaultClusterMatcher();
});
it('returns null when no rules match on account, location, or stack/detail', () => {
expect(matcher.getMatchingRule(account, location, clusterName, null)).toBe(null);
});
it('returns null when no rules match on account, location, or stack/detail', () => {
const rules: IClusterMatchRule[] = [{ account, location, stack: '*', detail: '*', priority: 1 }];
expect(matcher.getMatchingRule('prod', location, clusterName, rules)).toBe(null);
});
it('returns rule based on location if accounts are identical', () => {
const expected: IClusterMatchRule = { account, location, stack: '*', detail: '*', priority: 1 };
const rules: IClusterMatchRule[] = [{ account, location: '*', stack: '*', detail: '*', priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('returns rule based on stack if account and location are identical', () => {
const expected: IClusterMatchRule = { account, location, stack, detail: '*', priority: 1 };
const rules: IClusterMatchRule[] = [{ account, location, stack: '*', detail: '*', priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('returns rule based on detail if account, location, and stack are identical', () => {
const expected: IClusterMatchRule = { account, location, stack, detail, priority: 1 };
const rules: IClusterMatchRule[] = [{ account, location, stack, detail: '*', priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('returns rule based on priority if all other fields match', () => {
const expected: IClusterMatchRule = { account, location, stack, detail, priority: 1 };
const rules: IClusterMatchRule[] = [{ account, location, stack, detail, priority: 2 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('specific account takes priority over all other wildcard fields', () => {
const expected: IClusterMatchRule = { account, location: '*', stack: '*', detail: '*', priority: 1 };
const rules: IClusterMatchRule[] = [{ account: '*', location, stack, detail, priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('specific location takes priority over wildcard stack, detail', () => {
const expected: IClusterMatchRule = { account, location, stack: '*', detail: '*', priority: 1 };
const rules: IClusterMatchRule[] = [{ account, location: '*', stack, detail, priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('specific stack takes priority over wildcard detail', () => {
const expected: IClusterMatchRule = { account, location, stack, detail: '*', priority: 2 };
const rules: IClusterMatchRule[] = [{ account, location, stack: '*', detail, priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('specific detail takes priority over priority', () => {
const expected: IClusterMatchRule = { account, location, stack, detail, priority: 2 };
const rules: IClusterMatchRule[] = [{ account, location, stack, detail: '*', priority: 1 }, expected];
expect(matcher.getMatchingRule(account, location, clusterName, rules)).toBe(expected);
});
it('handles clusters without account or details values', () => {
const expected: IClusterMatchRule = { account: '*', location: '*', stack: '*', detail: '*', priority: 1 };
expect(matcher.getMatchingRule(account, location, 'myapp', [expected])).toBe(expected);
});
it('handles rules without account or details values, preferring them to wildcards', () => {
let expected: IClusterMatchRule = { account: '*', location: '*', stack: null, detail: null, priority: 1 };
expect(matcher.getMatchingRule(account, location, 'myapp', [expected])).toBe(expected);
expected = { account: '*', location: '*', stack: '', detail: '', priority: 1 };
expect(matcher.getMatchingRule(account, location, 'myapp', [expected])).toBe(expected);
});
});
|