hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
012aa08782cc27ec9da6e2ae779ba6e1216520e1 | 3,031 | js | JavaScript | src/js/particleData.js | nerdmanship/WeCon | dffbf6bced08828d782c987e23b1e4ddfd767359 | [
"MIT"
] | null | null | null | src/js/particleData.js | nerdmanship/WeCon | dffbf6bced08828d782c987e23b1e4ddfd767359 | [
"MIT"
] | null | null | null | src/js/particleData.js | nerdmanship/WeCon | dffbf6bced08828d782c987e23b1e4ddfd767359 | [
"MIT"
] | null | null | null | // Particle data
var p = [
{
name: "particle0",
bp: {
xMax: random(-125, -175),
yMax: random(0,40),
sMax: random(0.5,1),
fill: colors.successGreen
},
sp: {
xMax: random(-125, -175),
yMax: random(30,50),
sMax: random(0.5,1),
fill: colors.dataBlue
},
h: {
xMax: random(-135, -175),
yMax: random(20,60),
sMax: random(0.5,1),
fill: colors.heartRed
}
},
{
name: "particle1",
bp: {
xMax: random(-125, -175),
yMax: random(-60,-10),
sMax: random(0.4,0.8),
fill: colors.successGreen
},
sp: {
xMax: random(-125, -175),
yMax: random(-60,-10),
sMax: 0,
fill: colors.dataBlue
},
h: {
xMax: random(-155, -185),
yMax: random(-60,-10),
sMax: random(0.4,0.8),
fill: colors.heartRed
}
},
{
name: "particle2",
bp: {
xMax: random(-125, -175),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.successGreen
},
sp: {
xMax: random(-125, -175),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.dataBlue
},
h: {
xMax: random(-155, -185),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.heartRed
}
},
{
name: "particle3",
bp: {
xMax: random(-110,-90),
yMax: random(-125, -200),
sMax: random(0.3,0.6),
fill: colors.successGreen
},
sp: {
xMax: random(-110,-90),
yMax: random(-125, -200),
sMax: random(0.3,0.6),
fill: colors.dataBlue
},
h: {
xMax: random(-110,-90),
yMax: random(-165, -175),
sMax: random(0.3,0.6),
fill: colors.heartRed
}
},
{
name: "particle4",
bp: {
xMax: random(125, 175),
yMax: random(0,40),
sMax: random(0.5,1),
fill: colors.successGreen
},
sp: {
xMax: random(125, 175),
yMax: random(0,40),
sMax: 0,
fill: colors.dataBlue
},
h: {
xMax: random(125, 155),
yMax: random(40,80),
sMax: 0.5,
fill: colors.heartRed
}
},
{
name: "particle5",
bp: {
xMax: random(125, 175),
yMax: random(-60,-10),
sMax: random(0.4,0.8),
fill: colors.successGreen
},
sp: {
xMax: random(125, 175),
yMax: random(-150,-120),
sMax: random(0.4,0.8),
fill: colors.dataBlue
},
h: {
xMax: random(155, 185),
yMax: random(-60,-10),
sMax: random(0.4,0.8),
fill: colors.heartRed
}
},
{
name: "particle6",
bp: {
xMax: random(125, 175),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.successGreen
},
sp: {
xMax: random(125, 175),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.dataBlue
},
h: {
xMax: random(155, 195),
yMax: random(-110,-70),
sMax: random(0.3,0.6),
fill: colors.heartRed
}
}
]; | 20.206667 | 31 | 0.47839 |
012b926946716b98431d601969352b02871b77e8 | 242 | js | JavaScript | tests/utils/loadAddressShares.js | miklt/lido-subgraph | c2d74cac02d803288fe66f35ce242c04f9f704c5 | [
"MIT"
] | 4 | 2021-05-19T20:40:03.000Z | 2021-09-15T09:58:23.000Z | tests/utils/loadAddressShares.js | miklt/lido-subgraph | c2d74cac02d803288fe66f35ce242c04f9f704c5 | [
"MIT"
] | 3 | 2021-04-21T13:56:12.000Z | 2021-10-19T22:05:16.000Z | tests/utils/loadAddressShares.js | miklt/lido-subgraph | c2d74cac02d803288fe66f35ce242c04f9f704c5 | [
"MIT"
] | 2 | 2021-08-01T22:59:11.000Z | 2021-11-14T20:30:56.000Z | import { subgraphFetch, gql } from '.'
export const loadAddressShares = async (address) => {
const query = gql`
{
shares(id: "${address}") {
shares
}
}
`
return (await subgraphFetch(query)).shares.shares
}
| 17.285714 | 53 | 0.582645 |
012ccef29d358327ed0f150c67628bff61b1ea80 | 12,067 | js | JavaScript | src/vuex/state/index.js | Voorsie/moontography | 4cdb6c0b984fd0b6d619d91ccd3e219c1787817a | [
"MIT"
] | null | null | null | src/vuex/state/index.js | Voorsie/moontography | 4cdb6c0b984fd0b6d619d91ccd3e219c1787817a | [
"MIT"
] | null | null | null | src/vuex/state/index.js | Voorsie/moontography | 4cdb6c0b984fd0b6d619d91ccd3e219c1787817a | [
"MIT"
] | null | null | null | import airdropper from "./airdropper";
import asaas from "./asaas";
import faas from "./faas";
import kether from "./kether";
import passwordManager from "./passwordManager";
import trustedTimestamping from "./trustedTimestamping";
export default {
...airdropper,
...asaas,
...faas,
...kether,
...passwordManager,
...trustedTimestamping,
globalError: null,
globalLoading: false,
initLoading: true,
refreshableInterval: null,
route: null,
zeroAddy: "0x0000000000000000000000000000000000000000",
moralisApiKey:
"NSKfhloCF479195Dcy17lo4WWGyx4kQENDhK3iOlXpRSM8wto3aS64t10sfsrbFi",
activeNetwork: localStorage.activeNetwork || "eth",
mtgyCircSupply: "0",
mtgyTotSupply: "0",
mtgyPriceUsd: "0",
currentBlock: "0",
mtgyTokenInfo: {
community_data: {},
market_data: {
market_cap: {},
fully_diluted_valuation: {},
total_volume: {},
},
},
mtgyChart: [],
web3: {
instance: null,
isConnected: false,
chainId: null,
address: "",
userMtgyBalance: "",
mainCurrencyBalance: "",
},
selectedAddressInfo: {
address: "",
name: "",
symbol: "",
decimals: "",
userBalance: "",
},
eth: {
networks: [
{
name: "Binance Smart Chain",
short_name: "bsc",
chain: "smartchain",
network: "mainnet",
chain_id: 56,
network_id: 56,
explorer_url: "https://bscscan.com",
rpc_url: "https://bsc-dataseed.binance.org/",
blocks_per_day: 28800,
native_currency: {
symbol: "BNB",
name: "BNB",
decimals: 18,
contractAddress: "",
balance: "",
},
logo: `img/bsc.png`,
contracts: {
mtgy: "0x025c9f1146d4d94F8F369B9d98104300A3c8ca23",
mtgySpend: "0x8F70517bc8D336dB91f5f3f8aBB4B58e61786B83",
airdropper: "0xeFD47d675683c2788f8171Fede12A1505D07c2B2",
atomicSwap: "0x5b88b0CFAF3f97fb1a66B16681F6E502Ec03627e",
atomicSwap_V1: "0x3d2C8A4a5785fce1bCF86481510d505371c0556d",
passwordManager: "0xf67f6A36d751677D67069F359Be7623c4ea04524",
trustedTimestamping: "0x5Cfc47359381526615F7EB91D8460F4Eb73534e1",
faas: "0xaA0c2852F5391919b8AcE9ac079cf3791E5fE7e7",
faas_V12: "0xdBD8E0c519B0832a2037D18f32f304C3aDDEA723",
faas_V13: "0x1e07f7ad3e722F434604e7617d6DAe0a9A48a878",
},
buy: {
link:
"https://exchange.pancakeswap.finance/#/swap?inputCurrency=0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c&outputCurrency=0x025c9f1146d4d94f8f369b9d98104300a3c8ca23",
img: "img/pancakeswap.png",
text: "PancakeSwap",
},
},
{
name: "Ethereum Mainnet",
short_name: "eth",
chain: "ETH",
network: "mainnet",
chain_id: 1,
network_id: 1,
explorer_url: "https://etherscan.io",
rpc_url: "https://mainnet.infura.io/v3/%API_KEY%",
blocks_per_day: 6450,
native_currency: {
symbol: "ETH",
name: "Ethereum",
decimals: 18,
contractAddress: "",
balance: "",
},
contracts: {
mtgy: "0x025c9f1146d4d94F8F369B9d98104300A3c8ca23",
mtgySpend: "0x8A31f723FBfa371308e5f5Dd637246E0F6C573a5",
airdropper: "0x8f70517bc8d336db91f5f3f8abb4b58e61786b83",
atomicSwap: "0xa6C81ea7a97432f330F878650A5d5d376795D919",
atomicSwap_V1: "0x48d6F1Fa74ec4E752b5f7f3cf112aC783251713D",
passwordManager: "0xc8DD32752abe732Bc586dd42740895B6736619e2",
trustedTimestamping: "0x266BFfc052a5F02d4797A3DD99C3455Ac9D49eb6",
faas: "0x306996a2F45F3CA3472cABa245d772D566d4aab7",
faas_V13: "0x5Cfc47359381526615F7EB91D8460F4Eb73534e1",
kether: "0xb5fe93ccfec708145d6278b0c71ce60aa75ef925",
ketherNFT: "0x7bb952AB78b28a62b1525acA54A71E7Aa6177645",
ketherNFTLoaner: "0x6d02744ef4418CB0D72f54c1eE53140430b9dBEd",
},
buy: {
link:
"https://app.uniswap.org/#/swap?outputCurrency=0x025c9f1146d4d94f8f369b9d98104300a3c8ca23",
img: "img/uniswap.png",
text: "Uniswap",
},
},
{
name: "Kucoin Mainnet",
short_name: "kcc",
chain: "KCC",
network: "mainnet",
chain_id: 321,
network_id: 1,
explorer_url: "https://explorer.kcc.io/en",
rpc_url: "https://rpc-mainnet.kcc.network",
blocks_per_day: 14400,
native_currency: {
symbol: "KCS",
name: "KCS",
decimals: 18,
contractAddress: "",
balance: "",
},
logo: `img/kucoin.png`,
contracts: {
mtgy: "0xee00ef5a7ec4fdbd04eee39d60fe11c0ded65e73",
mtgySpend: "0x2060539895f6ef746336471001cEC66BfBf591d9",
airdropper: "0x025c9f1146d4d94F8F369B9d98104300A3c8ca23",
atomicSwap: "0xae31AbAef5F7000E469AED538f8e2A2a88661fF1",
atomicSwap_V1: "0x455D17B815f822F2D8aFd3Aa15F18518427E201e",
passwordManager: "0x8A31f723FBfa371308e5f5Dd637246E0F6C573a5",
trustedTimestamping: "0xc8DD32752abe732Bc586dd42740895B6736619e2",
faas: "0x51807E0745bC0c4A2534Ca7531F20E3C0F2a73Dc",
faas_V13: "0x04113Df9713E857FF25c8D46295637ef4cBA7263",
},
buy: {
link: "https://koffeeswap.exchange/#/pro",
img: "img/koffeeswap.png",
text: "KoffeeSwap",
},
},
{
name: "Polygon Mainnet",
short_name: "matic",
chain: "MATIC",
network: "mainnet",
chain_id: 137,
network_id: 1,
explorer_url: "https://polygonscan.com/",
rpc_url: "https://matic-mainnet.chainstacklabs.com",
blocks_per_day: 33200,
native_currency: {
symbol: "MATIC",
name: "MATIC",
decimals: 18,
contractAddress: "",
balance: "",
},
logo: `img/polygon.png`,
contracts: {
mtgy: "0x04113Df9713E857FF25c8D46295637ef4cBA7263",
mtgySpend: "0x025c9f1146d4d94F8F369B9d98104300A3c8ca23",
airdropper: "0x8A31f723FBfa371308e5f5Dd637246E0F6C573a5",
atomicSwap: "0x8F70517bc8D336dB91f5f3f8aBB4B58e61786B83",
atomicSwap_V1: "0xc39E5a234Fe2CAD49263d985FF2178eeA1A06916",
passwordManager: "0xc8DD32752abe732Bc586dd42740895B6736619e2",
trustedTimestamping: "0x266BFfc052a5F02d4797A3DD99C3455Ac9D49eb6",
faas: "0x40c29F3A0248Dd2d8Eb5917E8de1574dE9f9A253",
faas_V13: "0xf99693b010e35B38274835CE91ccCBb1eB89B32A",
},
// buy: {
// link: "https://koffeeswap.exchange/#/pro",
// img: "img/koffeeswap.png",
// text: "KoffeeSwap",
// },
},
// {
// name: "Ethereum Ropsten",
// short_name: "rop",
// chain: "ETH",
// network: "ropsten",
// chain_id: 3,
// network_id: 3,
// rpc_url: "https://ropsten.infura.io/v3/%API_KEY%",
// native_currency: {
// symbol: "ETH",
// name: "Ethereum",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
{
name: "Ethereum Rinkeby",
short_name: "rinkeby",
chain: "ETH",
network: "rinkeby",
chain_id: 4,
network_id: 4,
explorer_url: "https://rinkeby.etherscan.io",
rpc_url: "https://rinkeby.infura.io/v3/%API_KEY%",
blocks_per_day: 6450,
native_currency: {
symbol: "ETH",
name: "Ethereum",
decimals: "18",
contractAddress: "",
balance: "",
},
contracts: {
mtgy: "0xB0c227318439Aed30140e1E589a3c3b514d15BDF",
mtgySpend: "0xD3d649fB54266EB65693b051539295493e79836F",
airdropper: "0x94E9cEE0Af5aF7347D1e4D82cC1e3e446b0e2B4a",
atomicSwap: "0x9Ea2E96614931E7ad88F1FBcD83198e0cC98e471",
passwordManager: "0xAb6A86dE3B47A0e71a097a84ec8Bdf7AaB0A52b6",
trustedTimestamping: "0x2a1D590BC4C86bbb9118ED4f61e2D139c738cA0C",
faas: "0xEC517E8d195A62DEFEb30ce63CebfCE610bF39E4",
kether: "0xb88404dd8fe4969ef67841250baef7f04f6b1a5e",
ketherNFT: "0xB7fCb57a5ce2F50C3203ccda27c05AEAdAF2C221",
ketherNFTLoaner: "0xFe06A1E83Dc24a1EF7bdCa74D708522AADA152c5",
},
},
// {
// name: "Ethereum Görli",
// short_name: "gor",
// chain: "ETH",
// network: "goerli",
// chain_id: 5,
// network_id: 5,
// rpc_url: "https://goerli.infura.io/v3/%API_KEY%",
// native_currency: {
// symbol: "ETH",
// name: "Ethereum",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "RSK Mainnet",
// short_name: "rsk",
// chain: "RSK",
// network: "mainnet",
// chain_id: 30,
// network_id: 30,
// rpc_url: "https://public-node.rsk.co",
// native_currency: {
// symbol: "RSK",
// name: "RSK",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "Ethereum Kovan",
// short_name: "kov",
// chain: "ETH",
// network: "kovan",
// chain_id: 42,
// network_id: 42,
// rpc_url: "https://kovan.infura.io/v3/%API_KEY%",
// native_currency: {
// symbol: "ETH",
// name: "Ethereum",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "Ethereum Classic Mainnet",
// short_name: "etc",
// chain: "ETC",
// network: "mainnet",
// chain_id: 61,
// network_id: 1,
// rpc_url: "https://ethereumclassic.network",
// native_currency: {
// symbol: "ETH",
// name: "Ethereum",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "POA Network Sokol",
// short_name: "poa",
// chain: "POA",
// network: "sokol",
// chain_id: 77,
// network_id: 77,
// rpc_url: "https://sokol.poa.network",
// native_currency: {
// symbol: "POA",
// name: "POA",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "POA Network Core",
// short_name: "skl",
// chain: "POA",
// network: "core",
// chain_id: 99,
// network_id: 99,
// rpc_url: "https://core.poa.network",
// native_currency: {
// symbol: "POA",
// name: "POA",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "xDAI Chain",
// short_name: "xdai",
// chain: "POA",
// network: "dai",
// chain_id: 100,
// network_id: 100,
// rpc_url: "https://dai.poa.network",
// native_currency: {
// symbol: "xDAI",
// name: "xDAI",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
// {
// name: "Callisto Mainnet",
// short_name: "clo",
// chain: "callisto",
// network: "mainnet",
// chain_id: 820,
// network_id: 1,
// rpc_url: "https://clo-geth.0xinfra.com/",
// native_currency: {
// symbol: "CLO",
// name: "CLO",
// decimals: "18",
// contractAddress: "",
// balance: ""
// }
// },
],
},
xlm: {
usdToSend: "5",
},
};
| 31.342857 | 173 | 0.547692 |
012ce79ad235d67ad07dbbb5b3051e8751bd151d | 815 | js | JavaScript | config.js | Atlas-2005/discord-bot | 98801a8bd700e3e769cf27afea3cd78ea7598aaf | [
"MIT"
] | null | null | null | config.js | Atlas-2005/discord-bot | 98801a8bd700e3e769cf27afea3cd78ea7598aaf | [
"MIT"
] | null | null | null | config.js | Atlas-2005/discord-bot | 98801a8bd700e3e769cf27afea3cd78ea7598aaf | [
"MIT"
] | null | null | null | // Uncomment settings that you want enabled
// Fill discord token in if you are not using github secrets. Otherwise keep it as "0"
var discord_token = "0";
// Set your prefix for the deploy command below
var prefix = "?";
// Use the following section to setup your discord bot status, fill what you want the bot to say in the qotation marks, and set 1 or 2 for before now playing or after.
var status = "Test";
var zone = 1;
// DON'T TOUCH ANYTHING BELOW THIS!!!
if (discord_token => 0) {
var token = process.env.TOKEN
} else {
var token = discord_token
}
if (zone => 1) {
var statusp = status;
var statusa = "";
} else {
var statusp = "";
var statusa = status;
}
module.exports = {
"prefix": prefix,
"statusp": statusp,
"statusa": statusa,
"token": token
};
| 23.970588 | 167 | 0.64908 |
012ce8302d8a44163bd045eaac0bbca1765ac517 | 320 | js | JavaScript | src/actions/UserDataActions.js | haughank/regulus | 241c35264816aca6c655276ab08d4ad662aef98d | [
"MIT"
] | null | null | null | src/actions/UserDataActions.js | haughank/regulus | 241c35264816aca6c655276ab08d4ad662aef98d | [
"MIT"
] | null | null | null | src/actions/UserDataActions.js | haughank/regulus | 241c35264816aca6c655276ab08d4ad662aef98d | [
"MIT"
] | null | null | null | import * as types from '../constants/UserDataActionTypes';
export function updateUserData(data) {
console.log('about to create action to update user data:' + data);
return {
type: types.UPDATE_USER_DATA,
uid: data.uid,
firstName: data.firstName,
lastName: data.lastName,
email: data.email
};
} | 26.666667 | 68 | 0.696875 |
012d13a078258c71310e6cca64b32682d4e01abb | 2,051 | js | JavaScript | Source/Utility/PlatformHelper.js | thiscouldbebetter/GameFrameworkTS | 096501b98415077b0f76b21380237ca7e1da7fb6 | [
"MIT"
] | 4 | 2020-11-09T10:30:52.000Z | 2021-12-22T01:30:08.000Z | Source/Utility/PlatformHelper.js | thiscouldbebetter/GameFrameworkTS | 096501b98415077b0f76b21380237ca7e1da7fb6 | [
"MIT"
] | null | null | null | Source/Utility/PlatformHelper.js | thiscouldbebetter/GameFrameworkTS | 096501b98415077b0f76b21380237ca7e1da7fb6 | [
"MIT"
] | null | null | null | "use strict";
var ThisCouldBeBetter;
(function (ThisCouldBeBetter) {
var GameFramework;
(function (GameFramework) {
class PlatformHelper {
platformableAdd(platformable) {
var platformableAsDomElement = platformable.toDomElement(this);
if (platformableAsDomElement != null) {
this.divMain.appendChild(platformableAsDomElement);
}
}
platformableHide(platformable) {
platformable.toDomElement(this).style.display = "none";
}
platformableRemove(platformable) {
var platformableAsDomElement = platformable.toDomElement(this);
if (platformableAsDomElement != null) {
if (platformableAsDomElement.parentElement == this.divMain) {
this.divMain.removeChild(platformableAsDomElement);
}
}
}
platformableShow(platformable) {
platformable.toDomElement(this).style.display = null;
}
initialize(universe) {
var divMain = this.divMain;
if (divMain == null) {
var d = document;
divMain = d.createElement("div");
divMain.id = "divMain";
divMain.style.position = "absolute";
divMain.style.left = "50%";
divMain.style.top = "50%";
d.body.appendChild(divMain);
this.divMain = divMain;
}
var display = universe.display;
divMain.style.marginLeft = "" + (0 - display.sizeInPixels.x / 2);
divMain.style.marginTop = "" + (0 - display.sizeInPixels.y / 2);
}
}
GameFramework.PlatformHelper = PlatformHelper;
})(GameFramework = ThisCouldBeBetter.GameFramework || (ThisCouldBeBetter.GameFramework = {}));
})(ThisCouldBeBetter || (ThisCouldBeBetter = {}));
| 43.638298 | 98 | 0.531936 |
012d1e4c46b8f5e152b3937e33d493ed9a23028e | 224 | js | JavaScript | vendor/RxJS/add/operator/takeUntil.js | mgechev/closure-compiler-angular-bundling | 0887631ec6bf8423ecc245e523b023f06bb6d7ee | [
"MIT"
] | 9 | 2016-08-22T21:16:00.000Z | 2018-11-27T20:09:49.000Z | vendor/RxJS/add/operator/takeUntil.js | mgechev/closure-compiler-angular-bundling | 0887631ec6bf8423ecc245e523b023f06bb6d7ee | [
"MIT"
] | null | null | null | vendor/RxJS/add/operator/takeUntil.js | mgechev/closure-compiler-angular-bundling | 0887631ec6bf8423ecc245e523b023f06bb6d7ee | [
"MIT"
] | 7 | 2016-08-22T21:16:03.000Z | 2020-05-15T11:49:31.000Z | goog.module('rxjs$add$operator$takeUntil');
var Observable_1 = goog.require('rxjs$Observable');
var takeUntil_1 = goog.require('rxjs$operator$takeUntil');
Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil;
| 44.8 | 68 | 0.803571 |
012da57c5f6a359de8a3f8ce6c37fd3decaf8de1 | 2,706 | js | JavaScript | src/vigenere-cipher.js | polivodichka/basic-js | e5fe44bf0c3274b9ae8c523428b915acc89c5d01 | [
"MIT"
] | null | null | null | src/vigenere-cipher.js | polivodichka/basic-js | e5fe44bf0c3274b9ae8c523428b915acc89c5d01 | [
"MIT"
] | null | null | null | src/vigenere-cipher.js | polivodichka/basic-js | e5fe44bf0c3274b9ae8c523428b915acc89c5d01 | [
"MIT"
] | null | null | null | const { NotImplementedError } = require('../extensions/index.js');
/**
* Implement class VigenereCipheringMachine that allows us to create
* direct and reverse ciphering machines according to task description
*
* @example
*
* const directMachine = new VigenereCipheringMachine();
*
* const reverseMachine = new VigenereCipheringMachine(false);
*
* directMachine.encrypt('attack at dawn!', 'alphonse') => 'AEIHQX SX DLLU!'
*
* directMachine.decrypt('AEIHQX SX DLLU!', 'alphonse') => 'ATTACK AT DAWN!'
*
* reverseMachine.encrypt('attack at dawn!', 'alphonse') => '!ULLD XS XQHIEA'
*
* reverseMachine.decrypt('AEIHQX SX DLLU!', 'alphonse') => '!NWAD TA KCATTA'
*
*/
class VigenereCipheringMachine {
constructor(direct = true){
this.directMachine = direct;
}
encrypt(message, key) {
try {
let koef = Math.ceil((message.length / key.length));
key = (key.repeat(koef)).toLowerCase();
message = message.toLowerCase();
let startPosition = 'a'.charCodeAt(0);
let alphabetLength = 26;
let answer = [];
let spaceCounter = 0;
for (let i = 0; i < message.length; i++) {
if (/\W| |[0-9]/.exec(message[i])) {
answer.push(message[i]);
spaceCounter++;
} else {
let currentCode = message.charCodeAt(i) - startPosition;
let shif = key.charCodeAt(i - spaceCounter) - startPosition;
answer.push(String.fromCharCode(startPosition + ((currentCode + shif) % alphabetLength)));
}
}
return (this.directMachine)?answer.join('').toUpperCase():answer.reverse().join('').toUpperCase();
} catch (error) {
throw new Error("Incorrect arguments!");
}
}
decrypt(message, key) {
try {
let koef = Math.ceil((message.length / key.length));
key = (key.repeat(koef)).toLowerCase();
message = message.toLowerCase();
let startPosition = 'a'.charCodeAt(0);
let alphabetLength = 26;
let answer = [];
let spaceCounter = 0;
for (let i = 0; i < message.length; i++) {
if (/\W| |[0-9]/.exec(message[i])) {
answer.push(message[i]);
spaceCounter++;
} else {
let currentCode = message.charCodeAt(i) - startPosition;
let shif = key.charCodeAt(i - spaceCounter) - startPosition;
answer.push(String.fromCharCode(startPosition + ((currentCode - shif + alphabetLength) % alphabetLength)));
}
}
return (this.directMachine)?answer.join('').toUpperCase():answer.reverse().join('').toUpperCase();
} catch (error) {
throw new Error("Incorrect arguments!");
}
}
}
module.exports = {
VigenereCipheringMachine
};
| 31.835294 | 117 | 0.613452 |
012ddbad2943906e47113bb1a65f6363c89453c4 | 5,796 | js | JavaScript | consumer-service/app/lib/sync-task.js | benjay10/app-poc-diff | 13e4ab68bd5408317ec9cd46b24acc470c4056d3 | [
"MIT"
] | null | null | null | consumer-service/app/lib/sync-task.js | benjay10/app-poc-diff | 13e4ab68bd5408317ec9cd46b24acc470c4056d3 | [
"MIT"
] | null | null | null | consumer-service/app/lib/sync-task.js | benjay10/app-poc-diff | 13e4ab68bd5408317ec9cd46b24acc470c4056d3 | [
"MIT"
] | null | null | null | import fs from 'fs-extra';
import { querySudo as query, updateSudo as update } from '@lblod/mu-auth-sudo';
import mu, { sparqlEscapeDateTime, uuid } from 'mu';
const TASK_NOT_STARTED_STATUS = 'http://mu.semte.ch/services/poc-diff-consumer-service/sync-task-statuses/not-started';
const TASK_ONGOING_STATUS = 'http://mu.semte.ch/services/poc-diff-consumer-service/sync-task-statuses/ongoing';
const TASK_SUCCESS_STATUS = 'http://mu.semte.ch/services/poc-diff-consumer-service/sync-task-statuses/success';
const TASK_FAILED_STATUS = 'http://mu.semte.ch/services/poc-diff-consumer-service/sync-task-statuses/failed';
class SyncTask {
constructor({ uri, since, until, created, status }) {
this.uri = uri;
this.since = since;
this.until = until;
this.created = created;
this.status = status;
this.handledFiles = 0;
this.latestDeltaMs = 0;
this.files = [];
}
get latestDelta() {
return new Date(this.latestDeltaMs);
}
get totalFiles() {
return this.files.length;
}
async execute() {
try {
console.log(`Found ${this.totalFiles} new files to be consumed`);
if (this.totalFiles) {
await this.consumeNext();
}
} catch (e) {
console.log(`Something went wrong while consuming the files`, e);
}
}
async consumeNext() {
const file = this.files[this.handledFiles];
await file.consume(async (file, isSuccess) => {
this.handledFiles++;
console.log(`Consumed ${this.handledFiles}/${this.totalFiles} files`);
this.updateStatus(file, isSuccess);
if (this.status == TASK_SUCCESS_STATUS && this.handledFiles < this.totalFiles) {
await this.consumeNext();
} else {
await this.finish();
}
});
};
updateStatus(file, isSuccess) {
if (isSuccess && this.status != TASK_FAILED_STATUS) {
this.status = TASK_SUCCESS_STATUS;
const deltaMs = Date.parse(file.created);
if (deltaMs > this.latestDeltaMs) {
this.latestDeltaMs = deltaMs;
}
} else if (!isSuccess) {
this.status = TASK_FAILED_STATUS;
}
}
async finish() {
if (this.status == TASK_SUCCESS_STATUS) {
console.log(`Finished task with status ${this.status}. Most recent delta file consumed is created at ${this.latestDelta.toISOString()}.`);
} else {
console.log(`Failed to finish sync task. Skipping the remaining files. Most recent delta file successfully consumed is created at ${this.latestDelta.toISOString()}.`);
}
await this.writeStatus();
await insertNextSyncTask(this.latestDelta);
}
async writeStatus() {
await update(`
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
DELETE {
GRAPH ?g {
<${this.uri}> ext:taskStatus ?status ;
ext:deltaUntil ?latestDelta .
}
} INSERT {
GRAPH ?g {
<${this.uri}> ext:taskStatus <${this.status}> ;
ext:deltaUntil ${sparqlEscapeDateTime(this.latestDelta)} .
}
} WHERE {
GRAPH ?g {
<${this.uri}> ext:taskStatus ?status .
OPTIONAL { <${this.uri}> ext:deltaUntil ?latestDelta . }
}
}
`);
}
}
async function insertNextSyncTask(since = new Date()) {
const uuid = mu.uuid();
const uri = `http://mu.semte.ch/services/poc-diff-consumer-service/sync-tasks/${uuid}`;
await update(`
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
INSERT DATA {
GRAPH <http://mu.semte.ch/graphs/public> {
<${uri}> a ext:SyncTask ;
mu:uuid "${uuid}" ;
ext:taskStatus <${TASK_NOT_STARTED_STATUS}> ;
ext:deltaSince ${sparqlEscapeDateTime(since)} ;
dct:created ${sparqlEscapeDateTime(new Date())} .
}
}
`);
console.log(`Scheduled new sync task to ingest diff files since ${since.toISOString()}`);
}
async function getNextSyncTask() {
const result = await query(`
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?s ?since ?created WHERE {
?s a ext:SyncTask ;
ext:taskStatus <${TASK_NOT_STARTED_STATUS}> ;
ext:deltaSince ?since ;
dct:created ?created .
} ORDER BY ?since LIMIT 1
`);
if (result.results.bindings.length) {
const b = result.results.bindings[0];
return new SyncTask({
uri: b['s'].value,
status: TASK_NOT_STARTED_STATUS,
since: new Date(Date.parse(b['since'].value)),
created: new Date(Date.parse(b['created'].value))
});
} else {
return null;
}
}
async function getLatestSyncTask() {
const result = await query(`
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT ?s ?status ?latestDelta ?created WHERE {
?s a ext:SyncTask ;
ext:taskStatus ?status ;
ext:deltaUntil ?latestDelta ;
dct:created ?created .
} ORDER BY DESC(?latestDelta) LIMIT 1
`);
if (result.results.bindings.length) {
const b = result.results.bindings[0];
return new SyncTask({
uri: b['s'].value,
status: b['status'].value,
until: new Date(Date.parse(b['latestDelta'].value)),
created: new Date(Date.parse(b['created'].value))
});
} else {
return null;
}
}
export default SyncTask;
export {
getNextSyncTask,
getLatestSyncTask,
insertNextSyncTask
}
| 30.829787 | 173 | 0.618875 |
012f7e3d66e62352c59eacc123490bf03361a643 | 991 | js | JavaScript | src/engine-actions/unlock-wallet.spec.js | crypdex/sparkswap-lnd-engine | 6ea450eecfb190032a7b10fcc9d3bea137e54f36 | [
"MIT"
] | 1 | 2020-04-12T09:38:30.000Z | 2020-04-12T09:38:30.000Z | src/engine-actions/unlock-wallet.spec.js | crypdex/sparkswap-lnd-engine | 6ea450eecfb190032a7b10fcc9d3bea137e54f36 | [
"MIT"
] | null | null | null | src/engine-actions/unlock-wallet.spec.js | crypdex/sparkswap-lnd-engine | 6ea450eecfb190032a7b10fcc9d3bea137e54f36 | [
"MIT"
] | null | null | null | const path = require('path')
const { expect, rewire, sinon } = require('test/test-helper')
const unlockWallet = rewire(path.resolve(__dirname, 'unlock-wallet'))
describe('unlock-wallet', () => {
const walletPassword = 'mypassword'
let lndUnlockWalletStub
let engine
let bufferStub
let buffer
beforeEach(() => {
engine = {
walletUnlocker: sinon.stub
}
buffer = sinon.stub()
bufferStub = {
from: sinon.stub().returns(buffer)
}
lndUnlockWalletStub = sinon.stub()
unlockWallet.__set__('lndUnlockWallet', lndUnlockWalletStub)
unlockWallet.__set__('Buffer', bufferStub)
})
beforeEach(async () => {
await unlockWallet.call(engine, walletPassword)
})
it('converts a string to buffer', () => {
expect(bufferStub.from).to.have.been.calledWith(walletPassword, sinon.match.any)
})
it('unlocks a wallet', () => {
expect(lndUnlockWalletStub).to.have.been.calledWith(buffer, { client: engine.walletUnlocker })
})
})
| 24.775 | 98 | 0.673058 |
0130d8a77734ae07aa2fd60ceecce0e69d6bf5ae | 245 | js | JavaScript | dashboard/src/store/TemplateStore.js | qaiserlab/oshop | e8846baa62ef2852f2d0d591488b8edac4a96542 | [
"MIT"
] | null | null | null | dashboard/src/store/TemplateStore.js | qaiserlab/oshop | e8846baa62ef2852f2d0d591488b8edac4a96542 | [
"MIT"
] | 4 | 2021-01-06T06:20:39.000Z | 2022-02-13T17:28:41.000Z | dashboard/src/store/TemplateStore.js | qaiserlab/oshop | e8846baa62ef2852f2d0d591488b8edac4a96542 | [
"MIT"
] | null | null | null | export default {
namespaced: true,
state: {
rs: [
{ id: 'Default' },
{ id: 'Profile' },
{ id: 'InfoLayanan' },
{ id: 'Contact' },
],
},
getters: {
rs(state) {
return state.rs;
},
},
}
| 11.136364 | 28 | 0.412245 |
0130e3af283faa5cb65829a76cb909093085178f | 629 | js | JavaScript | src/components/options/dimension-selection.js | kylebarron/landsat8.earth | dbe94b105cc41ae0679f81e90a7438b71b0db0e7 | [
"MIT"
] | 31 | 2020-07-13T08:16:54.000Z | 2022-03-28T02:48:01.000Z | src/components/options/dimension-selection.js | kylebarron/landsat8.earth | dbe94b105cc41ae0679f81e90a7438b71b0db0e7 | [
"MIT"
] | 8 | 2020-07-13T05:54:09.000Z | 2020-09-11T03:43:15.000Z | src/components/options/dimension-selection.js | kylebarron/landsat8.earth | dbe94b105cc41ae0679f81e90a7438b71b0db0e7 | [
"MIT"
] | 3 | 2020-09-09T05:55:05.000Z | 2021-04-24T07:17:49.000Z | import React from 'react';
import {Button} from 'semantic-ui-react';
export default function DimensionSelection(props) {
const {map3d, onChange, viewState} = props;
return (
<Button.Group>
<Button
active={!map3d}
onClick={() =>
onChange({
map3d: false,
viewState: {...viewState, pitch: 0, bearing: 0},
})
}
>
2D
</Button>
<Button
active={map3d}
onClick={() =>
onChange({map3d: true, viewState: {...viewState, pitch: 50}})
}
>
3D
</Button>
</Button.Group>
);
}
| 20.966667 | 71 | 0.494436 |
013249731110d98be94b2c74ec46558d9c462f5c | 3,613 | js | JavaScript | source/ContentScript/language/javascript.js | CoolRice/git-outline | d8c72915fbdcdda2f084288da637e0887a321871 | [
"MIT"
] | 1 | 2020-11-29T12:05:14.000Z | 2020-11-29T12:05:14.000Z | source/ContentScript/language/javascript.js | CoolRice/Git-Outline | d8c72915fbdcdda2f084288da637e0887a321871 | [
"MIT"
] | null | null | null | source/ContentScript/language/javascript.js | CoolRice/Git-Outline | d8c72915fbdcdda2f084288da637e0887a321871 | [
"MIT"
] | null | null | null | import {parse} from '@babel/parser';
import traverse from '@babel/traverse';
const JSImpl = {};
const presetPlugins = [
'classPrivateProperties',
'classPrivateMethods',
'classStaticBlock',
'decimal',
['decorators', {decoratorsBeforeExport: true}],
'doExpressions',
'exportDefaultFrom',
'functionBind',
'importAssertions',
'moduleStringNames',
'partialApplication',
['pipelineOperator', {proposal: 'smart'}],
'privateIn',
['recordAndTuple', {syntaxType: 'hash'}],
'throwExpressions',
'topLevelAwait',
];
const config = {
sourceType: 'module',
errorRecovery: true,
plugins: [...['jsx', 'flow', 'classProperties'], ...presetPlugins],
};
const dealVariableDeclaration = (declaration) => {
const result = [];
declaration.declarations.forEach((item) => {
if (item.id.type === 'ObjectPattern' && item.id.properties) {
item.id.properties.forEach((i) => {
result.push({
name: i.key.name,
line: i.key.loc.start.line,
type: 'var',
});
});
} else {
result.push({
name: item.id.name,
line: item.id.loc.start.line,
type: 'var',
});
}
});
return result;
};
const dealFunctionDeclaration = (declaration) => {
return {
name: declaration.id.name,
line: declaration.loc.start.line,
type: 'func',
};
};
const dealClassDecalaration = (declaration) => {
return {
name: declaration.id.name,
line: declaration.loc.start.line,
type: 'class',
};
};
const dealExportDefaultDeclaration = (item) => {
if (item.declaration) {
if (item.declaration.type === 'VariableDeclaration') {
return dealVariableDeclaration(item.declaration);
}
if (item.declaration.type === 'FunctionDeclaration') {
return dealFunctionDeclaration(item.declaration);
}
if (item.declaration.type === 'ClassDeclaration') {
return dealClassDecalaration(item.declaration);
}
}
};
const dealExportNamedDeclaration = (item) => {
return dealExportDefaultDeclaration(item);
};
const dealTypeAlias = (item) => {
return {
name: item.id.name,
line: item.loc.start.line,
type: 'type',
};
};
const walk = (ast) => {
let outlines = [];
traverse(ast, {
Program(path) {
// console.log(path.node.body)
path.node.body.forEach((item) => {
if (item) {
let outline;
if (item.type === 'VariableDeclaration') {
outlines = outlines.concat(dealVariableDeclaration(item));
}
if (item.type === 'FunctionDeclaration') {
outlines.push(dealFunctionDeclaration(item));
}
if (item.type === 'ClassDeclaration') {
outlines.push(dealClassDecalaration(item));
}
if (item.type === 'ExportDefaultDeclaration') {
outlines.push(dealExportDefaultDeclaration(item));
}
if (item.type === 'ExportNamedDeclaration' && item.declaration) {
outline = dealExportNamedDeclaration(item);
if (outline) {
if (outline instanceof Array) {
outlines = outlines.concat(outline);
} else {
outlines.push(outline);
}
}
}
if (item.type === 'TypeAlias') {
outlines.push(dealTypeAlias(item));
}
}
});
},
});
return outlines;
};
const parser = (literal) => {
const ast = parse(literal, config);
return walk(ast);
};
JSImpl.parser = parser;
JSImpl.presetPlugins = presetPlugins;
JSImpl.walk = walk;
export default JSImpl;
| 24.746575 | 75 | 0.591198 |
013267d9ea8945b10403ac7e6e98b13b263c188a | 88,140 | js | JavaScript | software/js/splitflapjs/src/proto_gen/splitflap_proto.js | nintando64/nintando-splitflap | 1440aba54d5b0d822ec5da68762431879988d7ef | [
"Apache-2.0"
] | null | null | null | software/js/splitflapjs/src/proto_gen/splitflap_proto.js | nintando64/nintando-splitflap | 1440aba54d5b0d822ec5da68762431879988d7ef | [
"Apache-2.0"
] | null | null | null | software/js/splitflapjs/src/proto_gen/splitflap_proto.js | nintando64/nintando-splitflap | 1440aba54d5b0d822ec5da68762431879988d7ef | [
"Apache-2.0"
] | null | null | null | /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("protobufjs/minimal"));
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.PB = (function() {
/**
* Namespace PB.
* @exports PB
* @namespace
*/
var PB = {};
PB.SplitflapState = (function() {
/**
* Properties of a SplitflapState.
* @memberof PB
* @interface ISplitflapState
* @property {Array.<PB.SplitflapState.IModuleState>|null} [modules] SplitflapState modules
*/
/**
* Constructs a new SplitflapState.
* @memberof PB
* @classdesc Represents a SplitflapState.
* @implements ISplitflapState
* @constructor
* @param {PB.ISplitflapState=} [properties] Properties to set
*/
function SplitflapState(properties) {
this.modules = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* SplitflapState modules.
* @member {Array.<PB.SplitflapState.IModuleState>} modules
* @memberof PB.SplitflapState
* @instance
*/
SplitflapState.prototype.modules = $util.emptyArray;
/**
* Creates a new SplitflapState instance using the specified properties.
* @function create
* @memberof PB.SplitflapState
* @static
* @param {PB.ISplitflapState=} [properties] Properties to set
* @returns {PB.SplitflapState} SplitflapState instance
*/
SplitflapState.create = function create(properties) {
return new SplitflapState(properties);
};
/**
* Encodes the specified SplitflapState message. Does not implicitly {@link PB.SplitflapState.verify|verify} messages.
* @function encode
* @memberof PB.SplitflapState
* @static
* @param {PB.ISplitflapState} message SplitflapState message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SplitflapState.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.modules != null && message.modules.length)
for (var i = 0; i < message.modules.length; ++i)
$root.PB.SplitflapState.ModuleState.encode(message.modules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified SplitflapState message, length delimited. Does not implicitly {@link PB.SplitflapState.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.SplitflapState
* @static
* @param {PB.ISplitflapState} message SplitflapState message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SplitflapState.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a SplitflapState message from the specified reader or buffer.
* @function decode
* @memberof PB.SplitflapState
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.SplitflapState} SplitflapState
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SplitflapState.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.SplitflapState();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (!(message.modules && message.modules.length))
message.modules = [];
message.modules.push($root.PB.SplitflapState.ModuleState.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a SplitflapState message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.SplitflapState
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.SplitflapState} SplitflapState
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SplitflapState.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a SplitflapState message.
* @function verify
* @memberof PB.SplitflapState
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
SplitflapState.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.modules != null && message.hasOwnProperty("modules")) {
if (!Array.isArray(message.modules))
return "modules: array expected";
for (var i = 0; i < message.modules.length; ++i) {
var error = $root.PB.SplitflapState.ModuleState.verify(message.modules[i]);
if (error)
return "modules." + error;
}
}
return null;
};
/**
* Creates a SplitflapState message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.SplitflapState
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.SplitflapState} SplitflapState
*/
SplitflapState.fromObject = function fromObject(object) {
if (object instanceof $root.PB.SplitflapState)
return object;
var message = new $root.PB.SplitflapState();
if (object.modules) {
if (!Array.isArray(object.modules))
throw TypeError(".PB.SplitflapState.modules: array expected");
message.modules = [];
for (var i = 0; i < object.modules.length; ++i) {
if (typeof object.modules[i] !== "object")
throw TypeError(".PB.SplitflapState.modules: object expected");
message.modules[i] = $root.PB.SplitflapState.ModuleState.fromObject(object.modules[i]);
}
}
return message;
};
/**
* Creates a plain object from a SplitflapState message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.SplitflapState
* @static
* @param {PB.SplitflapState} message SplitflapState
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
SplitflapState.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.modules = [];
if (message.modules && message.modules.length) {
object.modules = [];
for (var j = 0; j < message.modules.length; ++j)
object.modules[j] = $root.PB.SplitflapState.ModuleState.toObject(message.modules[j], options);
}
return object;
};
/**
* Converts this SplitflapState to JSON.
* @function toJSON
* @memberof PB.SplitflapState
* @instance
* @returns {Object.<string,*>} JSON object
*/
SplitflapState.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
SplitflapState.ModuleState = (function() {
/**
* Properties of a ModuleState.
* @memberof PB.SplitflapState
* @interface IModuleState
* @property {PB.SplitflapState.ModuleState.State|null} [state] ModuleState state
* @property {number|null} [flapIndex] ModuleState flapIndex
* @property {boolean|null} [moving] ModuleState moving
* @property {boolean|null} [homeState] ModuleState homeState
* @property {number|null} [countUnexpectedHome] ModuleState countUnexpectedHome
* @property {number|null} [countMissedHome] ModuleState countMissedHome
*/
/**
* Constructs a new ModuleState.
* @memberof PB.SplitflapState
* @classdesc Represents a ModuleState.
* @implements IModuleState
* @constructor
* @param {PB.SplitflapState.IModuleState=} [properties] Properties to set
*/
function ModuleState(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ModuleState state.
* @member {PB.SplitflapState.ModuleState.State} state
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.state = 0;
/**
* ModuleState flapIndex.
* @member {number} flapIndex
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.flapIndex = 0;
/**
* ModuleState moving.
* @member {boolean} moving
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.moving = false;
/**
* ModuleState homeState.
* @member {boolean} homeState
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.homeState = false;
/**
* ModuleState countUnexpectedHome.
* @member {number} countUnexpectedHome
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.countUnexpectedHome = 0;
/**
* ModuleState countMissedHome.
* @member {number} countMissedHome
* @memberof PB.SplitflapState.ModuleState
* @instance
*/
ModuleState.prototype.countMissedHome = 0;
/**
* Creates a new ModuleState instance using the specified properties.
* @function create
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {PB.SplitflapState.IModuleState=} [properties] Properties to set
* @returns {PB.SplitflapState.ModuleState} ModuleState instance
*/
ModuleState.create = function create(properties) {
return new ModuleState(properties);
};
/**
* Encodes the specified ModuleState message. Does not implicitly {@link PB.SplitflapState.ModuleState.verify|verify} messages.
* @function encode
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {PB.SplitflapState.IModuleState} message ModuleState message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ModuleState.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.state != null && Object.hasOwnProperty.call(message, "state"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state);
if (message.flapIndex != null && Object.hasOwnProperty.call(message, "flapIndex"))
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.flapIndex);
if (message.moving != null && Object.hasOwnProperty.call(message, "moving"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.moving);
if (message.homeState != null && Object.hasOwnProperty.call(message, "homeState"))
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.homeState);
if (message.countUnexpectedHome != null && Object.hasOwnProperty.call(message, "countUnexpectedHome"))
writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.countUnexpectedHome);
if (message.countMissedHome != null && Object.hasOwnProperty.call(message, "countMissedHome"))
writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.countMissedHome);
return writer;
};
/**
* Encodes the specified ModuleState message, length delimited. Does not implicitly {@link PB.SplitflapState.ModuleState.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {PB.SplitflapState.IModuleState} message ModuleState message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ModuleState.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ModuleState message from the specified reader or buffer.
* @function decode
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.SplitflapState.ModuleState} ModuleState
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ModuleState.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.SplitflapState.ModuleState();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.state = reader.int32();
break;
case 2:
message.flapIndex = reader.uint32();
break;
case 3:
message.moving = reader.bool();
break;
case 4:
message.homeState = reader.bool();
break;
case 5:
message.countUnexpectedHome = reader.uint32();
break;
case 6:
message.countMissedHome = reader.uint32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ModuleState message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.SplitflapState.ModuleState} ModuleState
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ModuleState.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ModuleState message.
* @function verify
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ModuleState.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.state != null && message.hasOwnProperty("state"))
switch (message.state) {
default:
return "state: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
break;
}
if (message.flapIndex != null && message.hasOwnProperty("flapIndex"))
if (!$util.isInteger(message.flapIndex))
return "flapIndex: integer expected";
if (message.moving != null && message.hasOwnProperty("moving"))
if (typeof message.moving !== "boolean")
return "moving: boolean expected";
if (message.homeState != null && message.hasOwnProperty("homeState"))
if (typeof message.homeState !== "boolean")
return "homeState: boolean expected";
if (message.countUnexpectedHome != null && message.hasOwnProperty("countUnexpectedHome"))
if (!$util.isInteger(message.countUnexpectedHome))
return "countUnexpectedHome: integer expected";
if (message.countMissedHome != null && message.hasOwnProperty("countMissedHome"))
if (!$util.isInteger(message.countMissedHome))
return "countMissedHome: integer expected";
return null;
};
/**
* Creates a ModuleState message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.SplitflapState.ModuleState} ModuleState
*/
ModuleState.fromObject = function fromObject(object) {
if (object instanceof $root.PB.SplitflapState.ModuleState)
return object;
var message = new $root.PB.SplitflapState.ModuleState();
switch (object.state) {
case "NORMAL":
case 0:
message.state = 0;
break;
case "LOOK_FOR_HOME":
case 1:
message.state = 1;
break;
case "SENSOR_ERROR":
case 2:
message.state = 2;
break;
case "PANIC":
case 3:
message.state = 3;
break;
case "STATE_DISABLED":
case 4:
message.state = 4;
break;
}
if (object.flapIndex != null)
message.flapIndex = object.flapIndex >>> 0;
if (object.moving != null)
message.moving = Boolean(object.moving);
if (object.homeState != null)
message.homeState = Boolean(object.homeState);
if (object.countUnexpectedHome != null)
message.countUnexpectedHome = object.countUnexpectedHome >>> 0;
if (object.countMissedHome != null)
message.countMissedHome = object.countMissedHome >>> 0;
return message;
};
/**
* Creates a plain object from a ModuleState message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.SplitflapState.ModuleState
* @static
* @param {PB.SplitflapState.ModuleState} message ModuleState
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ModuleState.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.state = options.enums === String ? "NORMAL" : 0;
object.flapIndex = 0;
object.moving = false;
object.homeState = false;
object.countUnexpectedHome = 0;
object.countMissedHome = 0;
}
if (message.state != null && message.hasOwnProperty("state"))
object.state = options.enums === String ? $root.PB.SplitflapState.ModuleState.State[message.state] : message.state;
if (message.flapIndex != null && message.hasOwnProperty("flapIndex"))
object.flapIndex = message.flapIndex;
if (message.moving != null && message.hasOwnProperty("moving"))
object.moving = message.moving;
if (message.homeState != null && message.hasOwnProperty("homeState"))
object.homeState = message.homeState;
if (message.countUnexpectedHome != null && message.hasOwnProperty("countUnexpectedHome"))
object.countUnexpectedHome = message.countUnexpectedHome;
if (message.countMissedHome != null && message.hasOwnProperty("countMissedHome"))
object.countMissedHome = message.countMissedHome;
return object;
};
/**
* Converts this ModuleState to JSON.
* @function toJSON
* @memberof PB.SplitflapState.ModuleState
* @instance
* @returns {Object.<string,*>} JSON object
*/
ModuleState.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* State enum.
* @name PB.SplitflapState.ModuleState.State
* @enum {number}
* @property {number} NORMAL=0 NORMAL value
* @property {number} LOOK_FOR_HOME=1 LOOK_FOR_HOME value
* @property {number} SENSOR_ERROR=2 SENSOR_ERROR value
* @property {number} PANIC=3 PANIC value
* @property {number} STATE_DISABLED=4 STATE_DISABLED value
*/
ModuleState.State = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "NORMAL"] = 0;
values[valuesById[1] = "LOOK_FOR_HOME"] = 1;
values[valuesById[2] = "SENSOR_ERROR"] = 2;
values[valuesById[3] = "PANIC"] = 3;
values[valuesById[4] = "STATE_DISABLED"] = 4;
return values;
})();
return ModuleState;
})();
return SplitflapState;
})();
PB.Log = (function() {
/**
* Properties of a Log.
* @memberof PB
* @interface ILog
* @property {string|null} [msg] Log msg
*/
/**
* Constructs a new Log.
* @memberof PB
* @classdesc Represents a Log.
* @implements ILog
* @constructor
* @param {PB.ILog=} [properties] Properties to set
*/
function Log(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Log msg.
* @member {string} msg
* @memberof PB.Log
* @instance
*/
Log.prototype.msg = "";
/**
* Creates a new Log instance using the specified properties.
* @function create
* @memberof PB.Log
* @static
* @param {PB.ILog=} [properties] Properties to set
* @returns {PB.Log} Log instance
*/
Log.create = function create(properties) {
return new Log(properties);
};
/**
* Encodes the specified Log message. Does not implicitly {@link PB.Log.verify|verify} messages.
* @function encode
* @memberof PB.Log
* @static
* @param {PB.ILog} message Log message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Log.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.msg != null && Object.hasOwnProperty.call(message, "msg"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.msg);
return writer;
};
/**
* Encodes the specified Log message, length delimited. Does not implicitly {@link PB.Log.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.Log
* @static
* @param {PB.ILog} message Log message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Log.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Log message from the specified reader or buffer.
* @function decode
* @memberof PB.Log
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.Log} Log
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Log.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.Log();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.msg = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Log message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.Log
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.Log} Log
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Log.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Log message.
* @function verify
* @memberof PB.Log
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Log.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.msg != null && message.hasOwnProperty("msg"))
if (!$util.isString(message.msg))
return "msg: string expected";
return null;
};
/**
* Creates a Log message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.Log
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.Log} Log
*/
Log.fromObject = function fromObject(object) {
if (object instanceof $root.PB.Log)
return object;
var message = new $root.PB.Log();
if (object.msg != null)
message.msg = String(object.msg);
return message;
};
/**
* Creates a plain object from a Log message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.Log
* @static
* @param {PB.Log} message Log
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Log.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.msg = "";
if (message.msg != null && message.hasOwnProperty("msg"))
object.msg = message.msg;
return object;
};
/**
* Converts this Log to JSON.
* @function toJSON
* @memberof PB.Log
* @instance
* @returns {Object.<string,*>} JSON object
*/
Log.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Log;
})();
PB.Ack = (function() {
/**
* Properties of an Ack.
* @memberof PB
* @interface IAck
* @property {number|null} [nonce] Ack nonce
*/
/**
* Constructs a new Ack.
* @memberof PB
* @classdesc Represents an Ack.
* @implements IAck
* @constructor
* @param {PB.IAck=} [properties] Properties to set
*/
function Ack(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Ack nonce.
* @member {number} nonce
* @memberof PB.Ack
* @instance
*/
Ack.prototype.nonce = 0;
/**
* Creates a new Ack instance using the specified properties.
* @function create
* @memberof PB.Ack
* @static
* @param {PB.IAck=} [properties] Properties to set
* @returns {PB.Ack} Ack instance
*/
Ack.create = function create(properties) {
return new Ack(properties);
};
/**
* Encodes the specified Ack message. Does not implicitly {@link PB.Ack.verify|verify} messages.
* @function encode
* @memberof PB.Ack
* @static
* @param {PB.IAck} message Ack message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Ack.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.nonce);
return writer;
};
/**
* Encodes the specified Ack message, length delimited. Does not implicitly {@link PB.Ack.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.Ack
* @static
* @param {PB.IAck} message Ack message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Ack.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an Ack message from the specified reader or buffer.
* @function decode
* @memberof PB.Ack
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.Ack} Ack
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Ack.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.Ack();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.nonce = reader.uint32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an Ack message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.Ack
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.Ack} Ack
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Ack.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an Ack message.
* @function verify
* @memberof PB.Ack
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Ack.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.nonce != null && message.hasOwnProperty("nonce"))
if (!$util.isInteger(message.nonce))
return "nonce: integer expected";
return null;
};
/**
* Creates an Ack message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.Ack
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.Ack} Ack
*/
Ack.fromObject = function fromObject(object) {
if (object instanceof $root.PB.Ack)
return object;
var message = new $root.PB.Ack();
if (object.nonce != null)
message.nonce = object.nonce >>> 0;
return message;
};
/**
* Creates a plain object from an Ack message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.Ack
* @static
* @param {PB.Ack} message Ack
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Ack.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.nonce = 0;
if (message.nonce != null && message.hasOwnProperty("nonce"))
object.nonce = message.nonce;
return object;
};
/**
* Converts this Ack to JSON.
* @function toJSON
* @memberof PB.Ack
* @instance
* @returns {Object.<string,*>} JSON object
*/
Ack.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Ack;
})();
PB.FromSplitflap = (function() {
/**
* Properties of a FromSplitflap.
* @memberof PB
* @interface IFromSplitflap
* @property {PB.ISplitflapState|null} [splitflapState] FromSplitflap splitflapState
* @property {PB.ILog|null} [log] FromSplitflap log
* @property {PB.IAck|null} [ack] FromSplitflap ack
*/
/**
* Constructs a new FromSplitflap.
* @memberof PB
* @classdesc Represents a FromSplitflap.
* @implements IFromSplitflap
* @constructor
* @param {PB.IFromSplitflap=} [properties] Properties to set
*/
function FromSplitflap(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* FromSplitflap splitflapState.
* @member {PB.ISplitflapState|null|undefined} splitflapState
* @memberof PB.FromSplitflap
* @instance
*/
FromSplitflap.prototype.splitflapState = null;
/**
* FromSplitflap log.
* @member {PB.ILog|null|undefined} log
* @memberof PB.FromSplitflap
* @instance
*/
FromSplitflap.prototype.log = null;
/**
* FromSplitflap ack.
* @member {PB.IAck|null|undefined} ack
* @memberof PB.FromSplitflap
* @instance
*/
FromSplitflap.prototype.ack = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* FromSplitflap payload.
* @member {"splitflapState"|"log"|"ack"|undefined} payload
* @memberof PB.FromSplitflap
* @instance
*/
Object.defineProperty(FromSplitflap.prototype, "payload", {
get: $util.oneOfGetter($oneOfFields = ["splitflapState", "log", "ack"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new FromSplitflap instance using the specified properties.
* @function create
* @memberof PB.FromSplitflap
* @static
* @param {PB.IFromSplitflap=} [properties] Properties to set
* @returns {PB.FromSplitflap} FromSplitflap instance
*/
FromSplitflap.create = function create(properties) {
return new FromSplitflap(properties);
};
/**
* Encodes the specified FromSplitflap message. Does not implicitly {@link PB.FromSplitflap.verify|verify} messages.
* @function encode
* @memberof PB.FromSplitflap
* @static
* @param {PB.IFromSplitflap} message FromSplitflap message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FromSplitflap.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.splitflapState != null && Object.hasOwnProperty.call(message, "splitflapState"))
$root.PB.SplitflapState.encode(message.splitflapState, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.log != null && Object.hasOwnProperty.call(message, "log"))
$root.PB.Log.encode(message.log, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.ack != null && Object.hasOwnProperty.call(message, "ack"))
$root.PB.Ack.encode(message.ack, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
return writer;
};
/**
* Encodes the specified FromSplitflap message, length delimited. Does not implicitly {@link PB.FromSplitflap.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.FromSplitflap
* @static
* @param {PB.IFromSplitflap} message FromSplitflap message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
FromSplitflap.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a FromSplitflap message from the specified reader or buffer.
* @function decode
* @memberof PB.FromSplitflap
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.FromSplitflap} FromSplitflap
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
FromSplitflap.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.FromSplitflap();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.splitflapState = $root.PB.SplitflapState.decode(reader, reader.uint32());
break;
case 2:
message.log = $root.PB.Log.decode(reader, reader.uint32());
break;
case 3:
message.ack = $root.PB.Ack.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a FromSplitflap message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.FromSplitflap
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.FromSplitflap} FromSplitflap
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
FromSplitflap.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a FromSplitflap message.
* @function verify
* @memberof PB.FromSplitflap
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
FromSplitflap.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.splitflapState != null && message.hasOwnProperty("splitflapState")) {
properties.payload = 1;
{
var error = $root.PB.SplitflapState.verify(message.splitflapState);
if (error)
return "splitflapState." + error;
}
}
if (message.log != null && message.hasOwnProperty("log")) {
if (properties.payload === 1)
return "payload: multiple values";
properties.payload = 1;
{
var error = $root.PB.Log.verify(message.log);
if (error)
return "log." + error;
}
}
if (message.ack != null && message.hasOwnProperty("ack")) {
if (properties.payload === 1)
return "payload: multiple values";
properties.payload = 1;
{
var error = $root.PB.Ack.verify(message.ack);
if (error)
return "ack." + error;
}
}
return null;
};
/**
* Creates a FromSplitflap message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.FromSplitflap
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.FromSplitflap} FromSplitflap
*/
FromSplitflap.fromObject = function fromObject(object) {
if (object instanceof $root.PB.FromSplitflap)
return object;
var message = new $root.PB.FromSplitflap();
if (object.splitflapState != null) {
if (typeof object.splitflapState !== "object")
throw TypeError(".PB.FromSplitflap.splitflapState: object expected");
message.splitflapState = $root.PB.SplitflapState.fromObject(object.splitflapState);
}
if (object.log != null) {
if (typeof object.log !== "object")
throw TypeError(".PB.FromSplitflap.log: object expected");
message.log = $root.PB.Log.fromObject(object.log);
}
if (object.ack != null) {
if (typeof object.ack !== "object")
throw TypeError(".PB.FromSplitflap.ack: object expected");
message.ack = $root.PB.Ack.fromObject(object.ack);
}
return message;
};
/**
* Creates a plain object from a FromSplitflap message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.FromSplitflap
* @static
* @param {PB.FromSplitflap} message FromSplitflap
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
FromSplitflap.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.splitflapState != null && message.hasOwnProperty("splitflapState")) {
object.splitflapState = $root.PB.SplitflapState.toObject(message.splitflapState, options);
if (options.oneofs)
object.payload = "splitflapState";
}
if (message.log != null && message.hasOwnProperty("log")) {
object.log = $root.PB.Log.toObject(message.log, options);
if (options.oneofs)
object.payload = "log";
}
if (message.ack != null && message.hasOwnProperty("ack")) {
object.ack = $root.PB.Ack.toObject(message.ack, options);
if (options.oneofs)
object.payload = "ack";
}
return object;
};
/**
* Converts this FromSplitflap to JSON.
* @function toJSON
* @memberof PB.FromSplitflap
* @instance
* @returns {Object.<string,*>} JSON object
*/
FromSplitflap.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return FromSplitflap;
})();
PB.SplitflapCommand = (function() {
/**
* Properties of a SplitflapCommand.
* @memberof PB
* @interface ISplitflapCommand
* @property {Array.<PB.SplitflapCommand.IModuleCommand>|null} [modules] SplitflapCommand modules
*/
/**
* Constructs a new SplitflapCommand.
* @memberof PB
* @classdesc Represents a SplitflapCommand.
* @implements ISplitflapCommand
* @constructor
* @param {PB.ISplitflapCommand=} [properties] Properties to set
*/
function SplitflapCommand(properties) {
this.modules = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* SplitflapCommand modules.
* @member {Array.<PB.SplitflapCommand.IModuleCommand>} modules
* @memberof PB.SplitflapCommand
* @instance
*/
SplitflapCommand.prototype.modules = $util.emptyArray;
/**
* Creates a new SplitflapCommand instance using the specified properties.
* @function create
* @memberof PB.SplitflapCommand
* @static
* @param {PB.ISplitflapCommand=} [properties] Properties to set
* @returns {PB.SplitflapCommand} SplitflapCommand instance
*/
SplitflapCommand.create = function create(properties) {
return new SplitflapCommand(properties);
};
/**
* Encodes the specified SplitflapCommand message. Does not implicitly {@link PB.SplitflapCommand.verify|verify} messages.
* @function encode
* @memberof PB.SplitflapCommand
* @static
* @param {PB.ISplitflapCommand} message SplitflapCommand message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SplitflapCommand.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.modules != null && message.modules.length)
for (var i = 0; i < message.modules.length; ++i)
$root.PB.SplitflapCommand.ModuleCommand.encode(message.modules[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified SplitflapCommand message, length delimited. Does not implicitly {@link PB.SplitflapCommand.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.SplitflapCommand
* @static
* @param {PB.ISplitflapCommand} message SplitflapCommand message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
SplitflapCommand.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a SplitflapCommand message from the specified reader or buffer.
* @function decode
* @memberof PB.SplitflapCommand
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.SplitflapCommand} SplitflapCommand
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SplitflapCommand.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.SplitflapCommand();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (!(message.modules && message.modules.length))
message.modules = [];
message.modules.push($root.PB.SplitflapCommand.ModuleCommand.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a SplitflapCommand message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.SplitflapCommand
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.SplitflapCommand} SplitflapCommand
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
SplitflapCommand.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a SplitflapCommand message.
* @function verify
* @memberof PB.SplitflapCommand
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
SplitflapCommand.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.modules != null && message.hasOwnProperty("modules")) {
if (!Array.isArray(message.modules))
return "modules: array expected";
for (var i = 0; i < message.modules.length; ++i) {
var error = $root.PB.SplitflapCommand.ModuleCommand.verify(message.modules[i]);
if (error)
return "modules." + error;
}
}
return null;
};
/**
* Creates a SplitflapCommand message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.SplitflapCommand
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.SplitflapCommand} SplitflapCommand
*/
SplitflapCommand.fromObject = function fromObject(object) {
if (object instanceof $root.PB.SplitflapCommand)
return object;
var message = new $root.PB.SplitflapCommand();
if (object.modules) {
if (!Array.isArray(object.modules))
throw TypeError(".PB.SplitflapCommand.modules: array expected");
message.modules = [];
for (var i = 0; i < object.modules.length; ++i) {
if (typeof object.modules[i] !== "object")
throw TypeError(".PB.SplitflapCommand.modules: object expected");
message.modules[i] = $root.PB.SplitflapCommand.ModuleCommand.fromObject(object.modules[i]);
}
}
return message;
};
/**
* Creates a plain object from a SplitflapCommand message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.SplitflapCommand
* @static
* @param {PB.SplitflapCommand} message SplitflapCommand
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
SplitflapCommand.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.modules = [];
if (message.modules && message.modules.length) {
object.modules = [];
for (var j = 0; j < message.modules.length; ++j)
object.modules[j] = $root.PB.SplitflapCommand.ModuleCommand.toObject(message.modules[j], options);
}
return object;
};
/**
* Converts this SplitflapCommand to JSON.
* @function toJSON
* @memberof PB.SplitflapCommand
* @instance
* @returns {Object.<string,*>} JSON object
*/
SplitflapCommand.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
SplitflapCommand.ModuleCommand = (function() {
/**
* Properties of a ModuleCommand.
* @memberof PB.SplitflapCommand
* @interface IModuleCommand
* @property {PB.SplitflapCommand.ModuleCommand.Action|null} [action] ModuleCommand action
* @property {number|null} [param] ModuleCommand param
*/
/**
* Constructs a new ModuleCommand.
* @memberof PB.SplitflapCommand
* @classdesc Represents a ModuleCommand.
* @implements IModuleCommand
* @constructor
* @param {PB.SplitflapCommand.IModuleCommand=} [properties] Properties to set
*/
function ModuleCommand(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ModuleCommand action.
* @member {PB.SplitflapCommand.ModuleCommand.Action} action
* @memberof PB.SplitflapCommand.ModuleCommand
* @instance
*/
ModuleCommand.prototype.action = 0;
/**
* ModuleCommand param.
* @member {number} param
* @memberof PB.SplitflapCommand.ModuleCommand
* @instance
*/
ModuleCommand.prototype.param = 0;
/**
* Creates a new ModuleCommand instance using the specified properties.
* @function create
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {PB.SplitflapCommand.IModuleCommand=} [properties] Properties to set
* @returns {PB.SplitflapCommand.ModuleCommand} ModuleCommand instance
*/
ModuleCommand.create = function create(properties) {
return new ModuleCommand(properties);
};
/**
* Encodes the specified ModuleCommand message. Does not implicitly {@link PB.SplitflapCommand.ModuleCommand.verify|verify} messages.
* @function encode
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {PB.SplitflapCommand.IModuleCommand} message ModuleCommand message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ModuleCommand.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.action != null && Object.hasOwnProperty.call(message, "action"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action);
if (message.param != null && Object.hasOwnProperty.call(message, "param"))
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.param);
return writer;
};
/**
* Encodes the specified ModuleCommand message, length delimited. Does not implicitly {@link PB.SplitflapCommand.ModuleCommand.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {PB.SplitflapCommand.IModuleCommand} message ModuleCommand message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ModuleCommand.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ModuleCommand message from the specified reader or buffer.
* @function decode
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.SplitflapCommand.ModuleCommand} ModuleCommand
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ModuleCommand.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.SplitflapCommand.ModuleCommand();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.action = reader.int32();
break;
case 2:
message.param = reader.uint32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ModuleCommand message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.SplitflapCommand.ModuleCommand} ModuleCommand
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ModuleCommand.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ModuleCommand message.
* @function verify
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ModuleCommand.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.action != null && message.hasOwnProperty("action"))
switch (message.action) {
default:
return "action: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (message.param != null && message.hasOwnProperty("param"))
if (!$util.isInteger(message.param))
return "param: integer expected";
return null;
};
/**
* Creates a ModuleCommand message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.SplitflapCommand.ModuleCommand} ModuleCommand
*/
ModuleCommand.fromObject = function fromObject(object) {
if (object instanceof $root.PB.SplitflapCommand.ModuleCommand)
return object;
var message = new $root.PB.SplitflapCommand.ModuleCommand();
switch (object.action) {
case "NO_OP":
case 0:
message.action = 0;
break;
case "GO_TO_FLAP":
case 1:
message.action = 1;
break;
case "RESET_AND_HOME":
case 2:
message.action = 2;
break;
}
if (object.param != null)
message.param = object.param >>> 0;
return message;
};
/**
* Creates a plain object from a ModuleCommand message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.SplitflapCommand.ModuleCommand
* @static
* @param {PB.SplitflapCommand.ModuleCommand} message ModuleCommand
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ModuleCommand.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.action = options.enums === String ? "NO_OP" : 0;
object.param = 0;
}
if (message.action != null && message.hasOwnProperty("action"))
object.action = options.enums === String ? $root.PB.SplitflapCommand.ModuleCommand.Action[message.action] : message.action;
if (message.param != null && message.hasOwnProperty("param"))
object.param = message.param;
return object;
};
/**
* Converts this ModuleCommand to JSON.
* @function toJSON
* @memberof PB.SplitflapCommand.ModuleCommand
* @instance
* @returns {Object.<string,*>} JSON object
*/
ModuleCommand.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Action enum.
* @name PB.SplitflapCommand.ModuleCommand.Action
* @enum {number}
* @property {number} NO_OP=0 NO_OP value
* @property {number} GO_TO_FLAP=1 GO_TO_FLAP value
* @property {number} RESET_AND_HOME=2 RESET_AND_HOME value
*/
ModuleCommand.Action = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "NO_OP"] = 0;
values[valuesById[1] = "GO_TO_FLAP"] = 1;
values[valuesById[2] = "RESET_AND_HOME"] = 2;
return values;
})();
return ModuleCommand;
})();
return SplitflapCommand;
})();
PB.ToSplitflap = (function() {
/**
* Properties of a ToSplitflap.
* @memberof PB
* @interface IToSplitflap
* @property {number|null} [nonce] ToSplitflap nonce
* @property {PB.ISplitflapCommand|null} [splitflapCommand] ToSplitflap splitflapCommand
*/
/**
* Constructs a new ToSplitflap.
* @memberof PB
* @classdesc Represents a ToSplitflap.
* @implements IToSplitflap
* @constructor
* @param {PB.IToSplitflap=} [properties] Properties to set
*/
function ToSplitflap(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ToSplitflap nonce.
* @member {number} nonce
* @memberof PB.ToSplitflap
* @instance
*/
ToSplitflap.prototype.nonce = 0;
/**
* ToSplitflap splitflapCommand.
* @member {PB.ISplitflapCommand|null|undefined} splitflapCommand
* @memberof PB.ToSplitflap
* @instance
*/
ToSplitflap.prototype.splitflapCommand = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* ToSplitflap payload.
* @member {"splitflapCommand"|undefined} payload
* @memberof PB.ToSplitflap
* @instance
*/
Object.defineProperty(ToSplitflap.prototype, "payload", {
get: $util.oneOfGetter($oneOfFields = ["splitflapCommand"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new ToSplitflap instance using the specified properties.
* @function create
* @memberof PB.ToSplitflap
* @static
* @param {PB.IToSplitflap=} [properties] Properties to set
* @returns {PB.ToSplitflap} ToSplitflap instance
*/
ToSplitflap.create = function create(properties) {
return new ToSplitflap(properties);
};
/**
* Encodes the specified ToSplitflap message. Does not implicitly {@link PB.ToSplitflap.verify|verify} messages.
* @function encode
* @memberof PB.ToSplitflap
* @static
* @param {PB.IToSplitflap} message ToSplitflap message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ToSplitflap.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.nonce);
if (message.splitflapCommand != null && Object.hasOwnProperty.call(message, "splitflapCommand"))
$root.PB.SplitflapCommand.encode(message.splitflapCommand, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified ToSplitflap message, length delimited. Does not implicitly {@link PB.ToSplitflap.verify|verify} messages.
* @function encodeDelimited
* @memberof PB.ToSplitflap
* @static
* @param {PB.IToSplitflap} message ToSplitflap message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ToSplitflap.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ToSplitflap message from the specified reader or buffer.
* @function decode
* @memberof PB.ToSplitflap
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {PB.ToSplitflap} ToSplitflap
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ToSplitflap.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.PB.ToSplitflap();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.nonce = reader.uint32();
break;
case 2:
message.splitflapCommand = $root.PB.SplitflapCommand.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ToSplitflap message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof PB.ToSplitflap
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {PB.ToSplitflap} ToSplitflap
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ToSplitflap.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ToSplitflap message.
* @function verify
* @memberof PB.ToSplitflap
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ToSplitflap.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.nonce != null && message.hasOwnProperty("nonce"))
if (!$util.isInteger(message.nonce))
return "nonce: integer expected";
if (message.splitflapCommand != null && message.hasOwnProperty("splitflapCommand")) {
properties.payload = 1;
{
var error = $root.PB.SplitflapCommand.verify(message.splitflapCommand);
if (error)
return "splitflapCommand." + error;
}
}
return null;
};
/**
* Creates a ToSplitflap message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PB.ToSplitflap
* @static
* @param {Object.<string,*>} object Plain object
* @returns {PB.ToSplitflap} ToSplitflap
*/
ToSplitflap.fromObject = function fromObject(object) {
if (object instanceof $root.PB.ToSplitflap)
return object;
var message = new $root.PB.ToSplitflap();
if (object.nonce != null)
message.nonce = object.nonce >>> 0;
if (object.splitflapCommand != null) {
if (typeof object.splitflapCommand !== "object")
throw TypeError(".PB.ToSplitflap.splitflapCommand: object expected");
message.splitflapCommand = $root.PB.SplitflapCommand.fromObject(object.splitflapCommand);
}
return message;
};
/**
* Creates a plain object from a ToSplitflap message. Also converts values to other types if specified.
* @function toObject
* @memberof PB.ToSplitflap
* @static
* @param {PB.ToSplitflap} message ToSplitflap
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ToSplitflap.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.nonce = 0;
if (message.nonce != null && message.hasOwnProperty("nonce"))
object.nonce = message.nonce;
if (message.splitflapCommand != null && message.hasOwnProperty("splitflapCommand")) {
object.splitflapCommand = $root.PB.SplitflapCommand.toObject(message.splitflapCommand, options);
if (options.oneofs)
object.payload = "splitflapCommand";
}
return object;
};
/**
* Converts this ToSplitflap to JSON.
* @function toJSON
* @memberof PB.ToSplitflap
* @instance
* @returns {Object.<string,*>} JSON object
*/
ToSplitflap.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return ToSplitflap;
})();
return PB;
})();
return $root;
});
| 45.76324 | 167 | 0.491389 |
0133274ab14b93965d1907aacb996fe345726d45 | 2,178 | js | JavaScript | public/js/dev.js | amitjans/Eva | 4a438213a571dd9056c29a5e50f991fe16ca7c6c | [
"MIT"
] | 2 | 2021-02-01T10:19:14.000Z | 2021-03-24T00:19:39.000Z | public/js/dev.js | amitjans/Eva | 4a438213a571dd9056c29a5e50f991fe16ca7c6c | [
"MIT"
] | 10 | 2021-03-06T00:43:49.000Z | 2022-02-27T19:50:46.000Z | public/js/dev.js | amitjans/Eva | 4a438213a571dd9056c29a5e50f991fe16ca7c6c | [
"MIT"
] | 2 | 2021-11-18T18:51:46.000Z | 2022-03-15T18:35:12.000Z | function newlocale(target, source = 'es') {
$.ajax({
method: "POST",
url: `dev/locale/?target=${target}&source=${source}`,
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(lang[source])
})
.done(function (msg) {
notify('Ok');
});
}
function updatelocale(target, source = 'es') {
let temp = {};
temp[target] = lang[target];
temp[source] = lang[source];
$.ajax({
method: "PUT",
url: `dev/locale/?target=${target}&source=${source}`,
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(temp)
})
.done(function (msg) {
notify('Ok');
});
}
function updateAllLocale(source = 'es') {
$.ajax({
method: "PUT",
url: `dev/locale/?source=${source}`,
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(lang)
})
.done(function (msg) {
notify('Ok');
});
}
function rosco(data) {
let abecedario = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm', 'n', 'ñ', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z'];
for (let i = 0; i < data.length; i++) {
const element = data[i];
$.ajax({
method: "POST",
url: `/api/common?db=scriptdata`,
dataType: "json",
contentType: 'application/json',
data: JSON.stringify({
campo1: equalsIgnoringCase(element.respuesta[0], abecedario[i]) ? abecedario[i].toUpperCase() : `Contiene la ${abecedario[i].toUpperCase()}`,
campo2: element.pregunta,
campo3: capitalize(element.respuesta).split(',').map(x => x.trim()).join('/'),
campo4: abecedario[i].toUpperCase(),
script: '7b711eab-20cb-4ebc-bc46-51752003b8b8'
})
}).done(function (msg) {
});
}
}
function capitalize([first, ...rest]) {
return `${first.toUpperCase()}${rest.join('').toLowerCase()}`;
}
function equalsIgnoringCase(text, other) {
return text.localeCompare(other, undefined, { sensitivity: 'base' }) === 0;
} | 30.676056 | 157 | 0.518825 |
0133a737b9379e317ae5e88a65843c19e9d94619 | 944 | js | JavaScript | api/user-router.js | bw-deforestationdashboard/back-end | 7aa2bc9b5804ac91e5b4b3e7070f44bf6642bab2 | [
"MIT"
] | null | null | null | api/user-router.js | bw-deforestationdashboard/back-end | 7aa2bc9b5804ac91e5b4b3e7070f44bf6642bab2 | [
"MIT"
] | 2 | 2021-05-10T09:58:45.000Z | 2021-09-01T21:27:43.000Z | api/user-router.js | bw-deforestationdashboard/back-end | 7aa2bc9b5804ac91e5b4b3e7070f44bf6642bab2 | [
"MIT"
] | null | null | null | const router = require('express').Router();
const Users = require('./user-model.js');
const restricted = require('./restricted-middleware.js');
router.get('/users', restricted, (req, res) => {
Users.get()
.then(users => {
res.json({ users, decodedToken: req.decodedToken });
})
.catch(error => {
res.send(error);
});
});
router.put('/users/:id', (req, res) => {
Users.update(req.params.id, req.body)
.then(updated => {
res.status(201).json(updated);
})
.catch(err => {
res.status(404).json(err);
});
});
// delete contacts
router.delete('/users/:id', (req, res) => {
let deleteUser = req.params.id;
Users.remove(deleteUser)
.then(deleted => {
res.status(201).json(deleted);
})
.catch(err => {
res.status(404).json(err);
});
});
module.exports = router; | 23.02439 | 64 | 0.51589 |
01372c7783448da0a137937c6442839db4adb386 | 1,216 | js | JavaScript | qbot/ui/appContainer.js | dennisdunn/botlab | b0ff58e89658d6ebf884a42b919ceb7251609f26 | [
"MIT"
] | null | null | null | qbot/ui/appContainer.js | dennisdunn/botlab | b0ff58e89658d6ebf884a42b919ceb7251609f26 | [
"MIT"
] | null | null | null | qbot/ui/appContainer.js | dennisdunn/botlab | b0ff58e89658d6ebf884a42b919ceb7251609f26 | [
"MIT"
] | null | null | null | import React from 'react'
import { connect } from 'react-redux'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import Surface from './components/surface'
import Shape from './components/shape'
import Arc from './components/arc'
import ActionFactory from './lib/actionCreators'
import * as Actions from './lib/actions'
class AppContainer extends React.Component {
constructor(props) {
super(props)
this.clickHandler = this.clickHandler.bind(this)
}
clickHandler(eventArgs) {
let { dispatch } = this.props
let action = ActionFactory[eventArgs.action](eventArgs)
dispatch(action)
}
render() {
return (
<MuiThemeProvider>
<div style={{ position: 'relative' }}>
<Surface id='graphics' size='310' onClick={this.clickHandler}>
<Shape styles={{ fillStyle: 'blue' }}>
<Arc start={{ r: 100, theta: 0 }} end={{ r: 100, theta: Math.PI }}></Arc>
</Shape>
</Surface>
</div>
</MuiThemeProvider>
);
}
}
export default connect(state => state)(AppContainer)
| 32 | 101 | 0.578947 |
013739aa443528eaca9a0a03910e9ee5db8e4b59 | 286 | js | JavaScript | src/wrap/render.js | ParasolJS/parasol-es | 31fcdaeb2358873d473f5aa8a08eb94bc232f8d8 | [
"MIT"
] | 21 | 2019-04-09T09:42:35.000Z | 2021-07-28T04:05:49.000Z | src/wrap/render.js | joshhjacobson/ParaSol | 31fcdaeb2358873d473f5aa8a08eb94bc232f8d8 | [
"MIT"
] | 16 | 2018-09-27T23:13:25.000Z | 2018-11-29T04:35:05.000Z | src/wrap/render.js | joshhjacobson/ParaSol | 31fcdaeb2358873d473f5aa8a08eb94bc232f8d8 | [
"MIT"
] | 4 | 2019-03-21T04:19:36.000Z | 2020-05-11T18:01:06.000Z | // parcoords wrapper: render and update charts, maintain config
const render = (config, ps, flags) =>
function() {
ps.charts.forEach((pc, i) => {
pc.hideAxis(config.partition[i])
.render()
.updateAxes(0);
});
return this;
};
export default render;
| 23.833333 | 63 | 0.604895 |
0138e0a0c03cbbe36cf7ba684b3df86cda4bdadc | 603 | js | JavaScript | src/Task.js | shooksm/rbd-eggheadio-course | 75590e991da208d83734d94fca27beda59a1807e | [
"MIT"
] | null | null | null | src/Task.js | shooksm/rbd-eggheadio-course | 75590e991da208d83734d94fca27beda59a1807e | [
"MIT"
] | 5 | 2021-09-02T05:38:15.000Z | 2022-02-26T22:47:22.000Z | src/Task.js | shooksm/rbd-eggheadio-course | 75590e991da208d83734d94fca27beda59a1807e | [
"MIT"
] | null | null | null | import React from 'react';
import styled from 'styled-components/macro';
import { Draggable } from 'react-beautiful-dnd';
const Container = styled.div`
background-color: white;
border: 1px solid lightgrey;
border-radius: 2px;
padding: 8px;
margin-bottom: 8px;
`;
const Task = ({ task, index }) => (
<Draggable draggableId={task.id} index={index}>
{(provided) => (
<Container
{...provided.draggableProps}
{...provided.dragHandleProps}
ref={provided.innerRef}
>
{task.content}
</Container>
)}
</Draggable>
);
export default Task;
| 21.535714 | 49 | 0.630182 |
013a3d652ad0bf20edb30857d1482071a67c1217 | 377 | js | JavaScript | src/pages/collection/styles.js | fhalbiero/crwn-clothing | a40e621b62e739d9d14218c1a8de9b41ba71b4a2 | [
"MIT"
] | 1 | 2020-09-14T11:59:43.000Z | 2020-09-14T11:59:43.000Z | src/pages/collection/styles.js | fhalbiero/crwn-clothing | a40e621b62e739d9d14218c1a8de9b41ba71b4a2 | [
"MIT"
] | 7 | 2021-03-09T17:44:03.000Z | 2022-02-26T17:50:22.000Z | src/pages/collection/styles.js | fhalbiero/crwn-clothing | a40e621b62e739d9d14218c1a8de9b41ba71b4a2 | [
"MIT"
] | null | null | null | import styled from 'styled-components';
export const Container = styled.div`
display: flex;
flex-direction: column;
.title {
font-size: 38px;
margin: 0 auto 30px;
}
.items {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: 10px;
& .collection-item {
margin-bottom: 30px;
}
}
`; | 17.952381 | 45 | 0.559682 |
013bc8bfde03380a98d1699014d4485c5862ee1e | 829 | js | JavaScript | src/tests/integration/operators.test.js | nerdo/alma | dbc8c40f4a1e2e332bbb982c2326b448f0b954cf | [
"MIT"
] | null | null | null | src/tests/integration/operators.test.js | nerdo/alma | dbc8c40f4a1e2e332bbb982c2326b448f0b954cf | [
"MIT"
] | null | null | null | src/tests/integration/operators.test.js | nerdo/alma | dbc8c40f4a1e2e332bbb982c2326b448f0b954cf | [
"MIT"
] | null | null | null | /* global describe, test, expect */
import { Engine } from '../../Engine'
import { TestPresenter } from '../../adapters/TestPresenter'
import { Counter } from './Counter'
import { conformanceTests } from '../../interfaces/OperatorInterface.conformanceTests'
describe('operators', () => {
conformanceTests(
{
Counter: () => new Counter()
},
describe,
test,
expect
)
test('simple counter', () => {
const presenter = new TestPresenter()
const engine = new Engine(presenter)
const counter = new Counter()
engine.getModel().setOpTree({ counter })
engine.reset().start()
expect(presenter.state.counter.value).toBe(0)
counter.increment()
expect(presenter.state.counter.value).toBe(1)
counter.decrement()
expect(presenter.state.counter.value).toBe(0)
})
})
| 24.382353 | 86 | 0.648975 |
013ccc8ec71d7b81d3148fce2151b653fa9763cf | 4,471 | js | JavaScript | src/layout.js | feldhaus/pixi-solitaire | 1a068083620facae67d9ccb43fafa09e60453b84 | [
"MIT"
] | 1 | 2019-01-15T17:06:20.000Z | 2019-01-15T17:06:20.000Z | src/layout.js | feldhaus/pixi-solitaire | 1a068083620facae67d9ccb43fafa09e60453b84 | [
"MIT"
] | null | null | null | src/layout.js | feldhaus/pixi-solitaire | 1a068083620facae67d9ccb43fafa09e60453b84 | [
"MIT"
] | 1 | 2018-12-21T11:35:41.000Z | 2018-12-21T11:35:41.000Z |
import { CARD_WIDTH, CARD_HEIGHT } from './card';
const LANDSCAPE_COLS = 9;
const LANDSCAPE_ROWS = 4;
const PORTRAIT_COLS = 7;
export const HUD_HEIGHT = 60;
function setupDeck({ deck, cardSize, cardArea }) {
deck.cards.forEach((card) => {
card.resize(cardSize.width, cardSize.height);
card.area.copyFrom(cardArea);
});
}
export function setupLandscape({
width,
height,
deck,
stock,
waste,
foundation,
tableau,
barLeft,
barRight,
barTop,
btnRestart,
btnNew,
}) {
const cols = LANDSCAPE_COLS;
const rows = LANDSCAPE_ROWS;
const newHeight = (height - HUD_HEIGHT) / rows;
const cardHeight = newHeight * 0.8;
const cardSize = {
width: (CARD_WIDTH * cardHeight) / CARD_HEIGHT,
height: cardHeight,
};
const margin = {
x: (width - cardSize.width * cols) / cols,
y: newHeight * 0.2,
};
const padding = {
x: margin.x * 0.5,
y: margin.y * 0.5,
};
const cardArea = {
x: cardSize.width + margin.x,
y: cardSize.height + margin.y,
};
setupDeck({ deck, cardSize, cardArea });
// position and resize stock pile
stock.position.set(padding.x, padding.y + HUD_HEIGHT);
stock.resize(cardSize.width, cardSize.height);
// position and resize waste pile
waste.position.set(
padding.x,
padding.y + cardArea.y + HUD_HEIGHT,
);
waste.resize(cardSize.width, cardSize.height, 'vertical');
// position and resize foundation piles
foundation.forEach((pile, index) => {
pile.position.set(
padding.x + (cols - 1) * cardArea.x,
padding.y + index * cardArea.y + HUD_HEIGHT,
);
pile.resize(cardSize.width, cardSize.height);
});
// position and resize tableau piles
tableau.forEach((pile, index) => {
pile.position.set(
padding.x + (index + 1) * cardArea.x,
padding.y + HUD_HEIGHT,
);
pile.resize(cardSize.width, cardSize.height);
});
barLeft.visible = true;
barLeft.width = cardArea.x;
barLeft.height = height;
barRight.visible = true;
barRight.x = width;
barRight.width = cardArea.x;
barRight.height = height;
barTop.width = width;
barTop.height = HUD_HEIGHT;
btnRestart.position.set(cardArea.x + 10, height - 10);
btnNew.position.set(width - cardArea.x - 10, height - 10);
}
export function setupPortrait({
width,
height,
deck,
stock,
waste,
foundation,
tableau,
barLeft,
barRight,
barTop,
btnRestart,
btnNew,
}) {
const cols = PORTRAIT_COLS;
const newWidth = width / cols;
const cardWidth = newWidth * 0.8;
const cardSize = {
width: cardWidth,
height: (CARD_HEIGHT * cardWidth) / CARD_WIDTH,
};
const margin = {
x: newWidth * 0.2,
y: newWidth * 0.2,
};
const padding = {
x: margin.x * 0.5,
y: margin.y * 0.5,
};
const cardArea = {
x: cardSize.width + margin.x,
y: cardSize.height + margin.y,
};
setupDeck({ deck, cardSize, cardArea });
// position and resize stock pile
stock.position.set(padding.x, padding.y + HUD_HEIGHT);
stock.resize(cardSize.width, cardSize.height);
// position and resize waste pile
waste.position.set(
padding.x + cardArea.x,
padding.y + HUD_HEIGHT,
);
waste.resize(cardSize.width, cardSize.height, 'horizontal');
// position and resize foundation piles
foundation.forEach((pile, index) => {
pile.position.set(
padding.x + (3 + index) * cardArea.x,
padding.y + HUD_HEIGHT,
);
pile.resize(cardSize.width, cardSize.height);
});
// position and resize tableau piles
tableau.forEach((pile, index) => {
pile.position.set(
padding.x + index * cardArea.x,
padding.y + cardArea.y + HUD_HEIGHT,
);
pile.resize(cardSize.width, cardSize.height);
});
barLeft.visible = false;
barRight.visible = false;
barTop.width = width;
barTop.height = HUD_HEIGHT;
btnRestart.position.set(10, height - 10);
btnNew.position.set(width - 10, height - 10);
}
export function setupLayout({
width,
height,
deck,
stock,
waste,
foundation,
tableau,
barLeft,
barRight,
barTop,
btnRestart,
btnNew,
txtTimer,
txtScore,
}) {
const ratio = width / height;
const options = {
width,
height,
deck,
stock,
waste,
foundation,
tableau,
barLeft,
barRight,
barTop,
btnRestart,
btnNew,
};
if (ratio > 1.6) {
setupLandscape(options);
} else {
setupPortrait(options);
}
txtTimer.x = width * 0.5 - 10;
txtScore.x = width * 0.5 + 10;
}
| 21.089623 | 62 | 0.638336 |
013cea46651c3bdbb1b3742437dc15dca48acafa | 1,305 | js | JavaScript | src/Categories.js | rafapaivadeandrade/Commit | b9d6c52d47bfec52be0f7ca56a89a282ba0d838b | [
"MIT"
] | null | null | null | src/Categories.js | rafapaivadeandrade/Commit | b9d6c52d47bfec52be0f7ca56a89a282ba0d838b | [
"MIT"
] | null | null | null | src/Categories.js | rafapaivadeandrade/Commit | b9d6c52d47bfec52be0f7ca56a89a282ba0d838b | [
"MIT"
] | null | null | null | import React from "react";
import HeaderInternal from "./HeaderInternal";
import Category from "./Category";
import Announce from "./Announce";
import { Link, Route } from "react-router-dom";
class Categories extends React.Component {
render() {
return (
<>
<HeaderInternal />
<div className="container" style={{ paddingTop: "120px" }}>
<h1>Categories:</h1>
<div className="row">
<div className="col-lg-4">
<ul>
{this.props.categories.map((category) => {
return (
<li key={category.url}>
<Link to={`/categories/${category.url}`}>
{category.category}
</Link>
</li>
);
})}
</ul>
</div>
<div className="col-lg-8">
<Route
path="/categories/:urlCategory"
exact
component={Category}
/>
<Route
path="/categories/:urlCategory/:idAnnounce"
render={(props) => <Announce {...props} />}
/>
</div>
</div>
</div>
</>
);
}
}
export default Categories;
| 27.765957 | 67 | 0.434483 |
013d0e096f3c165c23492a73254b1829a4a9c6ca | 128 | js | JavaScript | api/main/card/index.js | 531828014/lavas-webApp | 9439d7e90c2f5d9266c8d053ad8f0f87bdfe5d6a | [
"MIT"
] | 2 | 2019-03-28T09:26:28.000Z | 2019-05-21T09:46:25.000Z | api/main/user-manage/index.js | 531828014/lavas-webApp | 9439d7e90c2f5d9266c8d053ad8f0f87bdfe5d6a | [
"MIT"
] | null | null | null | api/main/user-manage/index.js | 531828014/lavas-webApp | 9439d7e90c2f5d9266c8d053ad8f0f87bdfe5d6a | [
"MIT"
] | null | null | null | import Add from './add'
import List from './list'
import Remove from './remove'
export default {
Add,
List,
Remove
} | 16 | 29 | 0.640625 |
013d1eb7ba16fb6168a978064f99950ca3654e6a | 2,464 | js | JavaScript | ci/tests/puppeteer/scenarios/ticket-validation-cas-renew/script.js | zieka/cas | 5b80fe06ea3810620c7938535ca48c0ca24ef908 | [
"Apache-2.0"
] | null | null | null | ci/tests/puppeteer/scenarios/ticket-validation-cas-renew/script.js | zieka/cas | 5b80fe06ea3810620c7938535ca48c0ca24ef908 | [
"Apache-2.0"
] | 1 | 2021-12-01T06:14:47.000Z | 2021-12-01T06:14:47.000Z | ci/tests/puppeteer/scenarios/ticket-validation-cas-renew/script.js | zieka/cas | 5b80fe06ea3810620c7938535ca48c0ca24ef908 | [
"Apache-2.0"
] | 1 | 2021-08-03T06:16:33.000Z | 2021-08-03T06:16:33.000Z | const puppeteer = require('puppeteer');
const assert = require('assert');
const https = require('https');
const cas = require('../../cas.js');
(async () => {
for (const endpoint of ["validate", "serviceValidate", "p3/serviceValidate"]) {
console.log("Checking validation endpoint: " + endpoint);
const browser = await puppeteer.launch(cas.browserOptions());
const page = await cas.newPage(browser);
const service1 = "https://httpbin.org/get";
console.log("Logging into " + service1 + " without renew to create SSO");
await page.goto("https://localhost:8443/cas/login?service=" + service1);
await cas.loginWith(page, "casuser", "Mellon");
let ticket = await cas.assertTicketParameter(page);
let body = await validate(endpoint, service1, ticket, false)
if (endpoint === "validate") {
assert(body === "yes\ncasuser\n")
} else {
assert(body.includes("<cas:authenticationSuccess>"))
}
const service2 = "https://httpbin.org/get";
console.log("Logging into " + service2 + " to validate with renew=true and existing SSO");
await page.goto("https://localhost:8443/cas/login?service=" + service2);
ticket = await cas.assertTicketParameter(page);
body = await validate(endpoint, service2, ticket, true);
if (endpoint === "validate") {
assert(body === "no\n\n")
} else {
assert(body.includes('<cas:authenticationFailure code="INVALID_TICKET">'))
}
await browser.close();
}
})();
async function validate(endpoint, service, ticket, renew = false) {
let httpGet = options => {
return new Promise((resolve, reject) => {
https.get(options, res => {
res.setEncoding('utf8');
const body = [];
res.on('data', chunk => body.push(chunk));
res.on('end', () => resolve(body.join('')));
}).on('error', reject);
});
};
let path = "/cas/" + endpoint + "?service=" + service + "&ticket=" + ticket;
if (renew) {
path = path + "&renew=true";
}
console.log("Validating " + path);
let result = await httpGet({
protocol: 'https:',
hostname: 'localhost',
port: 8443,
path: path,
method: 'GET',
rejectUnauthorized: false,
});
console.log(result);
return result;
}
| 34.222222 | 98 | 0.568182 |
013d2865e6100dedc3a52b4629087d5ce13d71eb | 3,035 | js | JavaScript | src/blk/ui/screens/gamescreen.js | thuhuong2k/blk-game | 3c4b39f6227aa521ecd832795d5aebf417640265 | [
"ECL-2.0",
"Apache-2.0"
] | 39 | 2015-03-14T04:07:52.000Z | 2022-03-03T19:54:03.000Z | src/blk/ui/screens/gamescreen.js | thuhuong2k/blk-game | 3c4b39f6227aa521ecd832795d5aebf417640265 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/blk/ui/screens/gamescreen.js | thuhuong2k/blk-game | 3c4b39f6227aa521ecd832795d5aebf417640265 | [
"ECL-2.0",
"Apache-2.0"
] | 31 | 2015-02-12T11:31:31.000Z | 2022-03-17T23:26:05.000Z | /**
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author benvanik@google.com (Ben Vanik)
*/
goog.provide('blk.ui.screens.GameScreen');
goog.require('blk.game.fps.FpsClientController');
goog.require('gf.ui.Screen');
/**
* Game screen.
* @constructor
* @extends {gf.ui.Screen}
* @param {!blk.game.client.ClientGame} game Client game.
* @param {!gf.net.ClientSession} session Connected network session.
*/
blk.ui.screens.GameScreen = function(game, session) {
// TODO(benvanik): game string
var hashToken = 'game-' + 'url';
goog.base(this,
hashToken,
gf.ui.Screen.Flags.COVERS_DISPLAY |
gf.ui.Screen.Flags.OPAQUE |
gf.ui.Screen.Flags.MODAL_INPUT);
// TODO(benvanik): pull from options? etc
var controllerCtor = blk.game.fps.FpsClientController;
/**
* @private
* @type {!blk.game.client.ClientGame}
*/
this.game_ = game;
/**
* @private
* @type {!gf.dom.Display}
*/
this.display_ = game.getDisplay();
/**
* Client controller instance.
* @private
* @type {!blk.game.client.ClientController}
*/
this.controller_ = new controllerCtor(game, session);
this.registerDisposable(this.controller_);
};
goog.inherits(blk.ui.screens.GameScreen, gf.ui.Screen);
/**
* @override
*/
blk.ui.screens.GameScreen.prototype.enterDocument = function() {
goog.base(this, 'enterDocument');
// Load the game and start when ready
var deferred = this.controller_.load();
deferred.addCallbacks(
function() {
// Show the (already created) main display
this.display_.setVisible(true);
// Start the game
this.game_.startTicking();
}, function(arg) {
// Throw?
}, this);
};
/**
* @override
*/
blk.ui.screens.GameScreen.prototype.exitDocument = function() {
// Hide the main display - we don't remove/kill it here
this.display_.setVisible(false);
// Stop ticking
this.game_.stopTicking();
goog.base(this, 'exitDocument');
};
/**
* Refreshes settings from the user settings object.
*/
blk.ui.screens.GameScreen.prototype.refreshSettings = function() {
this.controller_.refreshSettings();
};
/**
* @override
*/
blk.ui.screens.GameScreen.prototype.update = function(frame) {
goog.base(this, 'update', frame);
this.controller_.update(frame);
};
/**
* @override
*/
blk.ui.screens.GameScreen.prototype.render = function(frame) {
goog.base(this, 'render', frame);
this.controller_.render(frame);
};
| 23.527132 | 75 | 0.6771 |
013efedfac684c55dfc9a59efef622ea8264cd58 | 1,200 | js | JavaScript | component/icons/save.js | quentin-sensome/xunit-viewer | 3d7ed9d7641f395733542155d6e0d44597aa8649 | [
"MIT"
] | 1 | 2019-04-04T18:32:00.000Z | 2019-04-04T18:32:00.000Z | component/icons/save.js | quentin-sensome/xunit-viewer | 3d7ed9d7641f395733542155d6e0d44597aa8649 | [
"MIT"
] | null | null | null | component/icons/save.js | quentin-sensome/xunit-viewer | 3d7ed9d7641f395733542155d6e0d44597aa8649 | [
"MIT"
] | 1 | 2019-04-04T18:34:02.000Z | 2019-04-04T18:34:02.000Z | import React from 'react'
export default function anonymous(params
/**/) {
var evalColor = function () {
if (typeof params.color === 'function') {
return params.color;
} else {
return function () {
return params.color;
};
}
}();
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return React.createElement('svg', _extends({}, params, { viewBox: '0 0 1792 1792' }), React.createElement('path', { d: 'M512 1536h768v-384h-768v384zm896 0h128v-896q0-14-10-38.5t-20-34.5l-281-281q-10-10-34-20t-39-10v416q0 40-28 68t-68 28h-576q-40 0-68-28t-28-68v-416h-128v1280h128v-416q0-40 28-68t68-28h832q40 0 68 28t28 68v416zm-384-928v-320q0-13-9.5-22.5t-22.5-9.5h-192q-13 0-22.5 9.5t-9.5 22.5v320q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5zm640 32v928q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h928q40 0 88 20t76 48l280 280q28 28 48 76t20 88z' }));;
} | 46.153846 | 582 | 0.628333 |
013f0cb35a2d722deebf5f61df2d4da295bb774f | 2,037 | js | JavaScript | packages/js/api-core-tests/utils/request.js | bhrugesh96/woocommerce | bad34444382629e3889c8c327741b9f835a7c9e1 | [
"Apache-2.0"
] | null | null | null | packages/js/api-core-tests/utils/request.js | bhrugesh96/woocommerce | bad34444382629e3889c8c327741b9f835a7c9e1 | [
"Apache-2.0"
] | null | null | null | packages/js/api-core-tests/utils/request.js | bhrugesh96/woocommerce | bad34444382629e3889c8c327741b9f835a7c9e1 | [
"Apache-2.0"
] | null | null | null | require( 'dotenv' ).config();
const { USER_KEY, USER_SECRET } = process.env;
const request = require( 'supertest' )( API_PATH );
/**
* Make a GET request.
*
* @param {string} requestPath The path of the request.
* @param {Object} queryString Optional. An object of one or more `key: value` query string parameters.
* @return {Response}
*/
const getRequest = async ( requestPath, queryString = {} ) => {
const response = await request
.get( requestPath )
.set( 'Accept', 'application/json' )
.query( queryString )
.auth( USER_KEY, USER_SECRET );
return response;
};
/**
* Make a POST request.
*
* @param {string} requestPath The path of the request.
* @param {Object} requestBody The body of the request to submit.
* @return {Response}
*/
const postRequest = async ( requestPath, requestBody ) => {
const response = await request
.post( requestPath )
.send( requestBody )
.set( 'Accept', 'application/json' )
.auth( USER_KEY, USER_SECRET );
return response;
};
/**
* Make a PUT request.
*
* @param {string} requestPath The path of the request.
* @param {Object} requestBody The body of the request to submit.
* @return {Request}
*/
const putRequest = async ( requestPath, requestBody ) => {
const response = await request
.put( requestPath )
.send( requestBody )
.set( 'Accept', 'application/json' )
.auth( USER_KEY, USER_SECRET );
return response;
};
/**
* Make a DELETE request, optionally deleting the resource permanently.
*
* @param {string} requestPath The path of the request.
* @param {boolean} deletePermanently Flag to permanently delete the resource.
* @return {Response}
*/
const deleteRequest = async ( requestPath, deletePermanently = false ) => {
const requestBody = deletePermanently ? { force: true } : {};
const response = await request
.delete( requestPath )
.set( 'Accept', 'application/json' )
.send( requestBody )
.auth( USER_KEY, USER_SECRET );
return response;
};
module.exports = { getRequest, postRequest, putRequest, deleteRequest };
| 28.690141 | 103 | 0.686303 |
013f55e83f2840d73de6f9ae116d4cf08374a497 | 1,994 | js | JavaScript | src/script/ui/items/components/SelectableItem.js | brakkum/Track-OOT | ecb9f581d88c0f06ca72f64c66b510cd9a6e6215 | [
"MIT"
] | null | null | null | src/script/ui/items/components/SelectableItem.js | brakkum/Track-OOT | ecb9f581d88c0f06ca72f64c66b510cd9a6e6215 | [
"MIT"
] | null | null | null | src/script/ui/items/components/SelectableItem.js | brakkum/Track-OOT | ecb9f581d88c0f06ca72f64c66b510cd9a6e6215 | [
"MIT"
] | null | null | null | import GlobalStyle from "/emcJS/util/GlobalStyle.js";
import ItemStates from "/script/state/ItemStates.js";
import iOSTouchHandler from "/script/util/iOSTouchHandler.js";
const STYLE = new GlobalStyle(`
* {
position: relative;
box-sizing: border-box;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
:host {
display: inline-flex;
width: 40px;
height: 40px;
cursor: pointer;
background-size: 80%;
background-repeat: no-repeat;
background-position: center;
background-origin: border-box;
}
:host(:hover) {
background-size: 100%;
}
`);
class HTMLTrackerSelectableItem extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: 'open'});
STYLE.apply(this.shadowRoot);
/* --- */
this.addEventListener("click", event => this.select(event));
/* fck iOS */
iOSTouchHandler.register(this);
}
get ref() {
return this.getAttribute('ref');
}
set ref(val) {
this.setAttribute('ref', val);
}
static get observedAttributes() {
return ['ref'];
}
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue != newValue) {
const state = ItemStates.get(this.ref);
const data = state.props;
switch (name) {
case 'ref':
if (Array.isArray(data.images)) {
this.style.backgroundImage = `url("${data.images[0]}")`;
} else {
this.style.backgroundImage = `url("${data.images}")`;
}
break;
}
}
}
select(event) {
if (!event) return;
event.preventDefault();
const ev = new Event("select");
ev.item = this.ref;
this.dispatchEvent(ev);
return false;
}
}
customElements.define('ootrt-selectableitem', HTMLTrackerSelectableItem);
| 24.317073 | 80 | 0.55667 |
013f88183035ac52ca06a4f103cea623d88e1139 | 2,042 | js | JavaScript | public/js/inquiry/result.js | smarttheater/legacy-reservation | 467d3c2eea4fa77a6ce7d09e2d85cf068fb012bc | [
"FTL"
] | null | null | null | public/js/inquiry/result.js | smarttheater/legacy-reservation | 467d3c2eea4fa77a6ce7d09e2d85cf068fb012bc | [
"FTL"
] | 4 | 2021-10-20T22:43:02.000Z | 2021-10-20T22:43:04.000Z | public/js/inquiry/result.js | smarttheater/legacy-reservation | 467d3c2eea4fa77a6ce7d09e2d85cf068fb012bc | [
"FTL"
] | null | null | null | $(function() {
if (!window.ttts.isCancellable) {
return false;
}
var $modal_cancelreservation = $('#modal_cancelreservation');
/**
* キャンセル(確定)
* @function cancel
* @returns {void}
*/
var cancel = function() {
var $dfd = $.Deferred();
$('.btn-close').hide();
var $error_message = $('#error_cancel').text('');
var payment_no = $modal_cancelreservation[0].getAttribute('data-paymentNo');
$error_message.text('');
$.ajax({
dataType: 'json',
url: '/inquiry/search/cancel',
type: 'POST',
data: {
payment_no: payment_no
}
}).done(function() {
$modal_cancelreservation.modal('hide');
$('#modal_cancelcompleted').modal({
backdrop: 'static',
keyboard: false
});
return;
}).fail(function(jqxhr, textStatus, error) {
try {
var res = JSON.parse(jqxhr.responseText);
$error_message.text(res.errors[0].message);
} catch (e) {
$error_message.text(error);
}
}).always(function() {
$('.btn-close').show();
$dfd.resolve();
});
return $dfd.promise();
};
// キャンセル(ポップアップ表示)
$(document).on('click', '.btn-cancel', function(event) {
event.preventDefault();
$modal_cancelreservation.modal({
backdrop: 'static',
keyboard: false
}).click(function(e) {
e.stopPropagation();
});
});
// キャンセル(確定)
var busy_cancel = false;
$('#btn_execcancel').click(function(e) {
e.preventDefault();
if (busy_cancel) { return false; }
busy_cancel = true;
var $btn = $(this);
$btn.addClass('is-processing');
cancel().always(function() {
$btn.removeClass('is-processing');
busy_cancel = false;
});
});
});
| 28.361111 | 84 | 0.484819 |
01416c0244aa27fc2d5556b580c7aa356df6bee6 | 3,786 | js | JavaScript | tests/config/configUtil.js | esemeniuc/refocus | d05019795d837892c2049409f05ff9c310a97c41 | [
"BSD-3-Clause"
] | 131 | 2016-09-27T12:39:58.000Z | 2021-12-21T08:36:12.000Z | tests/config/configUtil.js | esemeniuc/refocus | d05019795d837892c2049409f05ff9c310a97c41 | [
"BSD-3-Clause"
] | 1,146 | 2016-09-23T17:51:18.000Z | 2022-02-15T00:49:14.000Z | tests/config/configUtil.js | esemeniuc/refocus | d05019795d837892c2049409f05ff9c310a97c41 | [
"BSD-3-Clause"
] | 50 | 2016-09-30T15:59:46.000Z | 2021-11-18T17:32:56.000Z | /**
* Copyright (c) 2016, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or
* https://opensource.org/licenses/BSD-3-Clause
*/
/**
* tests/config/configUtil.js
*
* Tests config utilities
*/
'use strict';
const expect = require('chai').expect;
const configUtil = require('../../config/configUtil');
const NOT_ALLOWED = 'Your IP address is not allowed. Verify your ' +
'network address and your Refocus IP settings';
describe('tests/config/configUtil.js >', () => {
describe('IP List >', () => {
it('parse default IP list', () => {
const iplist = configUtil.parseIPlist('[[0.0.0.0,255.255.255.255]]');
expect(iplist).to.have.length(1);
expect(iplist).to.be.eql([['0.0.0.0', '255.255.255.255']]);
});
it('parse IP list with space around opening bracket', () => {
const iplist =
configUtil.parseIPlist('[ [1.2.3.4,1.2.3.8],[7.6.5.4,7.6.9.9]]');
expect(iplist).to.have.length(2);
expect(iplist).to.be.eql([
['1.2.3.4', '1.2.3.8'],
['7.6.5.4', '7.6.9.9'],
]);
});
it('parse IP list with space around closing bracket', () => {
const iplist =
configUtil.parseIPlist('[[1.2.3.4,1.2.3.8],[7.6.5.4,7.6.9.9 ] ]');
expect(iplist).to.have.length(2);
expect(iplist).to.be.eql([
['1.2.3.4', '1.2.3.8'],
['7.6.5.4', '7.6.9.9'],
]);
});
it('parse IP list with space around comma', () => {
const iplist =
configUtil.parseIPlist('[[1.2.3.4, 1.2.3.8], [7.6.5.4,7.6.9.9]]');
expect(iplist).to.have.length(2);
expect(iplist).to.be.eql([
['1.2.3.4', '1.2.3.8'],
['7.6.5.4', '7.6.9.9'],
]);
});
it('parse IP list with misc spaces', () => {
const iplist = configUtil
.parseIPlist('[ [ 1.2.3.4, 1.2.3.8], [7.6.5.4, 7.6.9.9 ] ]');
expect(iplist).to.have.length(2);
expect(iplist).to.be.eql([
['1.2.3.4', '1.2.3.8'],
['7.6.5.4', '7.6.9.9'],
]);
});
it('error parsing IP list with wrong format', () => {
expect(configUtil.parseIPlist.bind(
configUtil.parseIPlist, '[ [ 1.2.3.4, 1.2.3.8], [7.6.5.4] ]')
)
.to.throw(NOT_ALLOWED);
});
});
describe('csvToArray >', () => {
it('undefined string', () => {
expect(configUtil.csvToArray(undefined)).to.be.eql([]);
});
it('null string', () => {
expect(configUtil.csvToArray(null)).to.be.eql([]);
});
it('zero-length string', () => {
expect(configUtil.csvToArray('')).to.be.eql([]);
});
it('single element', () => {
expect(configUtil.csvToArray('abc')).to.be.eql(['abc']);
});
it('multiple elements with extra left and right padding', () => {
expect(configUtil.csvToArray('abc,def , ghi'))
.to.be.eql(['abc', 'def', 'ghi']);
});
}); // csvToArray
describe('getReadReplicas >', () => {
it('only bad entry will return undefined', () => {
const pe = { REPLICAS: 'test' };
expect(configUtil.getReadReplicas(pe, 'REPLICAS')).to.be.eql(undefined);
});
it('without Replicas env variable return undefined', () => {
const pe = {};
expect(configUtil.getReadReplicas(pe, 'REPLICAS')).to.be.eql(undefined);
});
it('Replicas env variable with correct env variables', () => {
const pe = { REPLICAS: 'test', test: 'testURL' };
expect(configUtil.getReadReplicas(pe, 'REPLICAS')).to.be.eql(['testURL']);
});
it('Replicas env variable with bad env variables', () => {
const pe = { REPLICAS: 'test, test1', test: 'testURL' };
expect(configUtil.getReadReplicas(pe, 'REPLICAS')).to.be.eql(['testURL']);
});
});
});
| 31.289256 | 80 | 0.548072 |
01426b7a8a8befe9a31593cdf6c0c85f41b9c576 | 518 | js | JavaScript | src/hooks/useLocalStorage.js | ArzateCompany/comment-section | 1addd2662b14f92884f4e9c26d7bf8105989db43 | [
"MIT"
] | null | null | null | src/hooks/useLocalStorage.js | ArzateCompany/comment-section | 1addd2662b14f92884f4e9c26d7bf8105989db43 | [
"MIT"
] | null | null | null | src/hooks/useLocalStorage.js | ArzateCompany/comment-section | 1addd2662b14f92884f4e9c26d7bf8105989db43 | [
"MIT"
] | null | null | null | import { useEffect, useState } from 'react'
export default function useLocalStorage(key) {
const [storage, setStorage] = useState([])
const updateStorage = (items) => {
window.localStorage.setItem(key, JSON.stringify(items))
}
const getStorage = () => {
try {
const data = JSON.parse(window.localStorage.getItem(key)) || []
setStorage(data)
} catch (error) {
console.error(error.message)
}
}
useEffect(() => {
getStorage()
}, [])
return {
storage,
getStorage,
updateStorage,
}
}
| 17.862069 | 66 | 0.650579 |
01443edf5d57957c7d30cf799e444e07b5f0f0ae | 790 | js | JavaScript | resources/assets/js/store/modules/actions.js | eagle7410/laravel-bank | db21d83f376ba168722739af7dd3cf7b7a4b16ec | [
"MIT"
] | 15 | 2018-02-03T19:48:57.000Z | 2022-03-03T16:04:03.000Z | resources/assets/js/store/modules/actions.js | eagle7410/laravel-bank | db21d83f376ba168722739af7dd3cf7b7a4b16ec | [
"MIT"
] | null | null | null | resources/assets/js/store/modules/actions.js | eagle7410/laravel-bank | db21d83f376ba168722739af7dd3cf7b7a4b16ec | [
"MIT"
] | 3 | 2018-07-24T12:16:29.000Z | 2020-04-16T13:45:50.000Z | export default {
state: {
items: [],
isInit : false,
},
mutations: {
setActions(state, actions) {
if (Array.isArray(actions) && actions.length) {
state.items = actions;
state.isInit = true;
}
},
addAction (state, action) {
if (action) {
state.items.push(action);
}
},
updateAction (state, action) {
if (!action) {
return false;
}
let oldAction = state.items.find(el => el.id == action.id);
for (let p in oldAction) {
if (action[p] && p !== 'id') {
oldAction[p] = action[p];
}
}
}
}
}
| 23.939394 | 71 | 0.389873 |
01447b57b41d2cd0ba1349fb9d52104904f5f087 | 2,305 | js | JavaScript | dev/_/components/js/workspaceEditView.js | Swarthmore/juxtaphor | fce918a68e2d82c15c7408432b0e9309664631d5 | [
"BSD-3-Clause"
] | null | null | null | dev/_/components/js/workspaceEditView.js | Swarthmore/juxtaphor | fce918a68e2d82c15c7408432b0e9309664631d5 | [
"BSD-3-Clause"
] | null | null | null | dev/_/components/js/workspaceEditView.js | Swarthmore/juxtaphor | fce918a68e2d82c15c7408432b0e9309664631d5 | [
"BSD-3-Clause"
] | null | null | null | //////////////////////////////////////////////////////////////////////
// WorkspaceEditView is a view contained within a modal that //
// allows the user to remove existing workspaces and add their own. //
//////////////////////////////////////////////////////////////////////
AV.WorkspaceEditView = Backbone.View.extend({
el: '#workspaceModal',
template: _.template($('#workspace_edit_template').html()),
error: '<div class="alert alert-danger" role="alert">' +
'Workspace names must be alphanumeric, and not greater than 20 ' +
'characters long. </div>',
events: {
'click #deleteWorkspaceButton': 'delete',
'click #newWorkspaceButton': 'newWorkspace'
},
initialize: function(){
this.listenTo(this.collection, "all", this.render);
// When the modal is closed, make the route reflect this.
$('workspaceModal').on('hidden.bs.modal', function(){
router.navigate('', {trigger: false, replace: true});
});
},
render: function(){
$('#workspace-modal-body').empty().html(this.template(
{workspaces: this.collection.models}));
},
showModal: function() {
$('#workspaceModal').modal({show: true});
},
delete: function(ev) {
var idToDelete = $(ev.currentTarget).data('value');
var sourceToRemove = this.collection.find(function (source) {
return source.id == idToDelete;});
sourceToRemove.url = '/juxta/workspace/' + sourceToRemove.get('name');
sourceToRemove.destroy();
this.render();
},
newWorkspace: function() {
var workspaceName = $('#workspaceName').val();
// /[^a-z0-9]/i is a regular expression that
// matches any character that is not alphanumeric
if (workspaceName.length > 20 ||
workspaceName.length < 1 ||
workspaceName.match(/[^a-z0-9]/i)) {
//Show the error message to the user.
$('#workspaceName').before(this.error);
} else {
json_post('/juxta/workspace',
{name: workspaceName},
_.bind(function(){
this.collection.fetch();
this.render();
}, this));
}
}
});
| 40.438596 | 77 | 0.529718 |
014522147ecfdc2fabafcd1183e96a3e50c42f48 | 594 | js | JavaScript | data/train/js/0a44a3808950a9122b6d4301ca2cbc12b13816b8content-service-factory.js | aliostad/deep-learning-lang-detection | d6b031f3ebc690cf2ffd0ae1b08ffa8fb3b38a62 | [
"MIT"
] | 84 | 2017-10-25T15:49:21.000Z | 2021-11-28T21:25:54.000Z | data/train/js/0a44a3808950a9122b6d4301ca2cbc12b13816b8content-service-factory.js | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 5 | 2018-03-29T11:50:46.000Z | 2021-04-26T13:33:18.000Z | data/train/js/0a44a3808950a9122b6d4301ca2cbc12b13816b8content-service-factory.js | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 24 | 2017-11-22T08:31:00.000Z | 2022-03-27T01:22:31.000Z | (function () {
'use strict';
/**
* @ngdoc service
* @name home.factory:ContentService
*
* @description
*
*/
angular
.module('home')
.factory('ContentService', ContentService);
function ContentService(ConstantService) {
var ContentServiceBase = {
getContent: function (obj, lang) {
return ConstantService.getObj(obj, 'cart.' + lang + '.content');
},
getErrorMessages: function (obj, lang) {
return ConstantService.getObj(obj, 'cart.' + lang + '.errorMessages');
}
};
return ContentServiceBase;
}
}());
| 19.8 | 78 | 0.597643 |
0146350839336604778688a8f67a1a91ec596ab3 | 1,705 | js | JavaScript | api/authorizer/handler.js | andreciornavei/serverless | 8e7e50b19848ba9367199cdfb2763c5c483abe0a | [
"MIT"
] | null | null | null | api/authorizer/handler.js | andreciornavei/serverless | 8e7e50b19848ba9367199cdfb2763c5c483abe0a | [
"MIT"
] | null | null | null | api/authorizer/handler.js | andreciornavei/serverless | 8e7e50b19848ba9367199cdfb2763c5c483abe0a | [
"MIT"
] | null | null | null | // A simple token-based authorizer example to demonstrate how to use an authorization token
// to allow or deny a request. In this example, the caller named 'user' is allowed to invoke
// a request if the client-supplied token value is 'allow'. The caller is not allowed to invoke
// the request if the token value is 'deny'. If the token value is 'unauthorized' or an empty
// string, the authorizer function returns an HTTP 401 status code. For any other token value,
// the authorizer returns an HTTP 500 status code.
// Note that token values are case-sensitive.
const jwt = require("jsonwebtoken");
exports.authorizer = function (event, context, callback) {
const token = event.authorizationToken;
try {
const user = jwt.verify(token, process.env.JWT_SECRET);
callback(null, generatePolicy("user", "Allow", event.methodArn, user));
} catch (error) {
console.log(error);
callback(null, generatePolicy("user", "Deny", event.methodArn));
}
};
// Help function to generate an IAM policy
const generatePolicy = function (principalId, effect, resource, user) {
const authResponse = {};
authResponse.principalId = principalId;
if (effect && resource) {
const policyDocument = {};
policyDocument.Version = "2012-10-17";
policyDocument.Statement = [];
const statementOne = {};
statementOne.Action = "execute-api:Invoke";
statementOne.Effect = effect;
statementOne.Resource = resource;
policyDocument.Statement[0] = statementOne;
authResponse.policyDocument = policyDocument;
}
// Optional output with custom properties of the String, Number or Boolean type.
if (user) {
authResponse.context = user;
}
return authResponse;
};
| 38.75 | 95 | 0.720235 |
01465448b5c94505096be141eb86f56be1f5cc36 | 869 | js | JavaScript | app/src/lib/debugger/client/fake_cri.js | oddui/webdriver-extension | 251fd87b23f6a45ba1e38e05cec51d895b2728e5 | [
"Apache-2.0"
] | 1 | 2017-08-11T21:46:24.000Z | 2017-08-11T21:46:24.000Z | app/src/lib/debugger/client/fake_cri.js | oddui/webdriver-extension | 251fd87b23f6a45ba1e38e05cec51d895b2728e5 | [
"Apache-2.0"
] | 7 | 2016-06-10T09:23:45.000Z | 2017-08-11T01:48:42.000Z | app/src/lib/debugger/client/fake_cri.js | oddui/webdriver-extension | 251fd87b23f6a45ba1e38e05cec51d895b2728e5 | [
"Apache-2.0"
] | null | null | null | const EventEmitter = require('events');
class Chrome extends EventEmitter {
static List() {
return Promise.resolve([]);
}
static New() {
return Promise.resolve({ id: '1' });
}
static Close() {
return Promise.resolve();
}
constructor(options) {
super();
this.host_ = options.host;
this.port_ = options.port;
this.commandDuration_ = 0;
}
setCommandDuration(duration) {
this.commandDuration_ = duration;
}
send(method, params, cb) {
setTimeout(() => cb(false, {}), this.commandDuration_);
// reset command duration to 0
this.setCommandDuration(0);
}
close() {
return Promise.resolve();
}
}
module.exports = function(options) {
return Promise.resolve(new Chrome(options));
};
module.exports.List = Chrome.List;
module.exports.New = Chrome.New;
module.exports.Close = Chrome.Close;
| 17.38 | 59 | 0.64672 |
0147e631a084f78b46a4345fe270d881a7f890bc | 495 | js | JavaScript | app/components/LogoutButton/LogoutButtonContainer.js | MogSogeking/CommandScreen | 62fdbb403a71c451b8bb6f3909cc5628e18a7c61 | [
"MIT"
] | null | null | null | app/components/LogoutButton/LogoutButtonContainer.js | MogSogeking/CommandScreen | 62fdbb403a71c451b8bb6f3909cc5628e18a7c61 | [
"MIT"
] | 10 | 2020-09-04T17:39:03.000Z | 2022-03-25T18:40:19.000Z | app/components/LogoutButton/LogoutButtonContainer.js | MogSogeking/CommandScreen | 62fdbb403a71c451b8bb6f3909cc5628e18a7c61 | [
"MIT"
] | null | null | null | import { connect } from 'react-redux'
import LogoutButton from './LogoutButton'
import { purgeProfile } from '../../redux/actions/global'
import { purgeCart } from '../../redux/actions/command';
import { purgeAchievement } from '../../redux/actions/achievements';
const mapDispatchToProps = dispatch => ({
logout: () => {
dispatch(purgeProfile())
dispatch(purgeCart())
dispatch(purgeAchievement())
}
})
export default connect(
undefined,
mapDispatchToProps,
)(LogoutButton) | 27.5 | 68 | 0.69899 |
0149e932ac7f22838cb46e515abaca7786c093a3 | 402 | js | JavaScript | addon/mixins/tooltip.js | BellGasp/ember-dashboard-controls | 5271d59f9b39ba22c7f33f9892812f07ed82485c | [
"MIT"
] | 5 | 2017-06-22T11:03:31.000Z | 2019-06-05T16:33:32.000Z | addon/mixins/tooltip.js | BellGasp/ember-dashboard-controls | 5271d59f9b39ba22c7f33f9892812f07ed82485c | [
"MIT"
] | 6 | 2017-07-26T21:35:32.000Z | 2021-05-06T16:33:08.000Z | addon/mixins/tooltip.js | BellGasp/ember-dashboard-controls | 5271d59f9b39ba22c7f33f9892812f07ed82485c | [
"MIT"
] | null | null | null | import Mixin from '@ember/object/mixin';
import { on } from '@ember/object/evented';
import { observer } from '@ember/object';
import { schedule } from '@ember/runloop';
export default Mixin.create({
initTooltip: on('didInsertElement', observer('title', function () {
schedule('afterRender', this, () => {
this.$('[data-toggle="tooltip"]').tooltip('dispose').tooltip();
});
})),
});
| 30.923077 | 69 | 0.644279 |
014a0073e8186b9cb9866b02c4f9395ad8bf10a7 | 500 | js | JavaScript | lib/createVolumeNode.js | appgine/sound | 472a92c05c018cc65ad997e2de2fb2d537cb1b59 | [
"MIT"
] | null | null | null | lib/createVolumeNode.js | appgine/sound | 472a92c05c018cc65ad997e2de2fb2d537cb1b59 | [
"MIT"
] | null | null | null | lib/createVolumeNode.js | appgine/sound | 472a92c05c018cc65ad997e2de2fb2d537cb1b59 | [
"MIT"
] | null | null | null |
export default function createVolumeNode() {
let volume = 1.0;
let connected = [];
const gain = {};
Object.defineProperty(gain, 'value', {
get() { return volume; },
set(_volume) {
volume = Math.max(Math.min(_volume, 1.0), 0);
connected.forEach(source => source.volume = volume);
}
});
return {
gain,
connect(source) {
if (source instanceof HTMLMediaElement) {
source.volume = volume;
connected.push(source);
}
},
disconnect() {
connected = [];
}
}
}
| 17.241379 | 55 | 0.612 |
014c26d261f5c241f571de331540ef3e1ff49097 | 51,125 | js | JavaScript | cards.js | SliceOfBread/tm-cards | cae188af9c974b966c4966fcf1743bf2f00a58f9 | [
"MIT"
] | 1 | 2020-12-29T18:31:47.000Z | 2020-12-29T18:31:47.000Z | cards.js | SliceOfBread/tm-cards | cae188af9c974b966c4966fcf1743bf2f00a58f9 | [
"MIT"
] | null | null | null | cards.js | SliceOfBread/tm-cards | cae188af9c974b966c4966fcf1743bf2f00a58f9 | [
"MIT"
] | null | null | null | // all names have spaces, dashes, apostrophes removed
// oAllCards[name]
// .cardNum = card number string
// .type = [corp|prel|proj]
// .tags
const oAllCards = {
"CrediCor":{cardNum:"Z01",type:"corp",tags:[],resources:{mc:57},prod:{},color:"blue",cardExtra:"Effect:\n-20: 4\n(Effect: After you pay for a card or standard project with a basic cost of 20 mc or more, you gain 4 mc.)"},
"EcoLine":{cardNum:"Z02",type:"corp",tags:["plant"],resources:{mc:36,plant:3},prod:{plant:2},color:"blue",cardExtra:"Effect:\n7 plant -> Greenery Tile\n(Effect: You may always pay 7 plants, instead of 8, to place 1 greenery.)"},
"Helion":{cardNum:"Z03",type:"corp",tags:["space"], resources:{mc:42},prod:{heat:3},color:"blue",cardExtra:"Effect:\nX heat = X mc\n(Effect: You may use heat as mc. You may not use mc as heat.)"},
"MiningGuild":{cardNum:"Z04",type:"corp",tags:["building","building"],resources:{mc:30,steel:5},prod:{steel:1},color:"blue",cardExtra:"Effect:\nsteel/ti: (Effect: Each time you get any steel or ti as a placement bonus on the map, increase your steel production 1 step.)"},
"InterplanetaryCinematics":{cardNum:"Z05",type:"corp",tags:["building"], resources:{mc:30,steel:20},prod:{},color:"blue",cardExtra:"Effect:\nEvent: 2 mc\n(Effect: Each time you play an event, you gain 2 mc.)"},
"Inventrix":{cardNum:"Z06",type:"corp",tags:["science"], resources:{mc:45,card:3},prod:{},color:"blue",cardExtra:"Effect:\nRequirements: O2/Ocean/Temp: +/- 2\n(Effect: Your temperature, oxygen, and ocean requirements are +2 or -2 steps, your choice in each case.)"},
"PhoboLog":{cardNum:"Z07",type:"corp",tags:["space"], resources:{mc:23,ti:10},prod:{},color:"blue",cardExtra:"Effect:\nti: +1 mc\n(Effect: Your ti resources are each worth 1 mc extra.)\n--- Ed. note: It is not \"Phoblog.\""},
"TharsisRepublic":{cardNum:"Z08",type:"corp",tags:["building"], resources:{mc:40,city:1},prod:{},color:"blue",cardExtra:"Effect:\nany-City*: mc:1\nCity: 3 mc\n(Effect: Whenever any city tile is placed ON MARS, increase your mc production 1 step. When you place a city tile, gain 3 mc.)\n-- Ed. note: Some printings don't have the word \"corporation\" at the top of this card. This is a misprint."},
"Thorgate":{cardNum:"Z09",type:"corp",tags:["power"], resources:{mc:48},prod:{energy:1},color:"blue",discount:{power:3},cardExtra:"Effect:\n(Effect: When playing a power card OR THE STANDARD PROJECT POWER plant, you pay 6 it."},
"UnitedNationsMarsInitiative":{cardNum:"Z10",type:"corp",tags:["earth"],resources:{mc:40},prod:{},color:"blue",cardExtra:"Action:\n3 mc -> TR*\n(Action: If your Terraform Rating was raised this generations, you may pay 3 mc to raise it 1 step more.)"},
"Teractor":{cardNum:"Z11",type:"corp",tags:["earth"],resources:{mc:60},prod:{},color:"blue",discount:{earth:3},cardExtra:""},
"SaturnSystems":{cardNum:"Z12",type:"corp",tags:["jovian"],resources:{mc:42},prod:{ti:1},color:"blue",cardExtra:"Effect:\nany-Jovian: mc:1\n(Effect: Each time any Jovian tag is put into play, including this, increase your mc production 1 step.)"},
"CheungShingMARS":{cardNum:"Z18",type:"corp",tags:["building"], resources:{mc:44},prod:{mc:3},color:"blue",discount:{building:2},cardExtra:""},
"PointLuna":{cardNum:"Z19",type:"corp",tags:["earth","space"],resources:{mc:38},prod:{ti:1},color:"blue",cardExtra:"Effect:\nEarth: +Card\n(Effect: When you play an Earth tag, including this, draw a card.)"},
"RobinsonIndustries":{cardNum:"Z20",type:"corp",tags:[],resources:{mc:47},prod:{},color:"blue",cardExtra:"Action:\n4 mc -> Increase ? 1*\n(Action: Spend 4 mc to increase (one of) your LOWEST PRODUCTION 1 step.)"},
"ValleyTrust":{cardNum:"Z21",type:"corp",tags:["earth"],resources:{mc:37,prelude:1},prod:{},color:"blue",discount:{science:2},cardExtra:"As your first action, draw 3 Prelude cards, and play one of them. Discard the other two.)\n"},
"Vitor":{cardNum:"Z22",type:"corp",tags:["earth"],resources:{mc:45,award:1},prod:{},color:"blue",cardExtra:"Effect:\nVP: ?*: 3 mc\n(Effect: When you play a card with a NON-NEGATIVE VP icon, including this, gain 3 mc.)"},
"AlliedBanks":{cardNum:"P01",type:"prel",tags:["earth"],resources:{mc:3},prod:{mc:4},color:"green",cardExtra:""},
"AquiferTurbines":{cardNum:"P02",type:"prel",tags:["power"], resources:{mc:-3,ocean:1},prod:{energy:2},color:"green",cardExtra:""},
"Biofuels":{cardNum:"P03",type:"prel",tags:["microbe"],resources:{plant:2},prod:{plant:1,energy:1},color:"green",cardExtra:""},
"Biolab":{cardNum:"P04",type:"prel",tags:["science"], resources:{plant:1,card:3},prod:{},color:"green",cardExtra:""},
"BiosphereSupport":{cardNum:"P05",type:"prel",tags:["plant"],resources:{},prod:{mc:-1,plant:2},color:"green",cardExtra:""},
"BusinessEmpire":{cardNum:"P06",type:"prel",tags:["earth"],resources:{mc:-6},prod:{mc:6},color:"green",cardExtra:""},
"DomeFarming":{cardNum:"P07",type:"prel",tags:["plant","building"],resources:{},prod:{mc:2,plant:1},color:"green",cardExtra:""},
"Donation":{cardNum:"P08",type:"prel",resources:{mc:21},prod:{},color:"green",cardExtra:""},
"EarlySettlement":{cardNum:"P09",type:"prel",tags:["city","building"],resources:{city:1},prod:{plant:1},color:"green",cardExtra:""},
"EcologyExperts":{cardNum:"P10",type:"prel",tags:["plant","microbe"],resources:{},prod:{plant:1},color:"green",cardExtra:"PLAY A CARD FROM HAND, IGNORING GLOBAL REQUIREMENTS\n(Increase your plant production 1 step.)"},
"EccentricSponsor":{cardNum:"P11",type:"prel",resources:{},prod:{},color:"green",cardExtra:"PLAY A CARD FROM HAND, REDUCING ITS COST BY 25 mc"},
"ExperimentalForest":{cardNum:"P12",type:"prel",tags:["plant"],resources:{greenery:1,"draw":{plant:2}},prod:{},color:"green",cardExtra:""},
"GalileanMining":{cardNum:"P13",type:"prel",tags:["jovian"],resources:{mc:-5},prod:{ti:2},color:"green",cardExtra:""},
"GreatAquifer":{cardNum:"P14",type:"prel",resources:{ocean:2},prod:{},color:"green",cardExtra:""},
"HugeAsteroid":{cardNum:"P15",type:"prel",resources:{temp:3, mc:-5},prod:{},color:"green",cardExtra:""},
"IoResearchOutpost":{cardNum:"P16",type:"prel",tags:["science","jovian"],resources:{card:1},prod:{ti:1},color:"green",cardExtra:""},
"Loan":{cardNum:"P17",type:"prel",resources:{mc:30},prod:{mc:-2},color:"green",cardExtra:""},
"MartianIndustries":{cardNum:"P18",type:"prel",tags:["building"], resources:{mc:6},prod:{energy:1,steel:1},color:"green",cardExtra:""},
"MetalRichAsteroid":{cardNum:"P19",type:"prel",resources:{temp:1,steel:4,ti:4},prod:{},color:"green",cardExtra:""},
"MetalsCompany":{cardNum:"P20",type:"prel",resources:{},prod:{mc:1,steel:1,ti:1},color:"green",cardExtra:""},
"MiningOperations":{cardNum:"P21",type:"prel",tags:["building"], resources:{steel:4},prod:{steel:2},color:"green",cardExtra:""},
"Mohole":{cardNum:"P22",type:"prel",tags:["building"], resources:{heat:3},prod:{heat:3},color:"green",cardExtra:""},
"MoholeExcavation":{cardNum:"P23",type:"prel",tags:["building"], resources:{heat:2},prod:{heat:2,steel:1},color:"green",cardExtra:""},
"NitrogenDelivery":{cardNum:"P24",type:"prel",resources:{tr:1,mc:5},prod:{plant:1},color:"green",cardExtra:""},
"OrbitalConstructionYard":{cardNum:"P25",type:"prel",tags:["space"], resources:{ti:4},prod:{ti:1},color:"green",cardExtra:""},
"PolarIndustries":{cardNum:"P26",type:"prel",tags:["building"], resources:{ocean:1},prod:{heat:2},color:"green",cardExtra:""},
"PowerGeneration":{cardNum:"P27",type:"prel",tags:["power"], resources:{},prod:{energy:3},color:"green",cardExtra:""},
"ResearchNetwork":{cardNum:"P28",type:"prel",tags:["wild"],resources:{card:3},prod:{mc:1},color:"green",cardExtra:""},
"SelfSufficientSettlement":{cardNum:"P29",type:"prel",tags:["city","building"],resources:{city:1},prod:{mc:2},color:"green",cardExtra:""},
"SmeltingPlant":{cardNum:"P30",type:"prel",tags:["building"], resources:{o2:2,steel:5},prod:{},color:"green",cardExtra:""},
"SocietySupport":{cardNum:"P31",type:"prel",resources:{},prod:{mc:-1,plant:1,energy:1,heat:1},color:"green",cardExtra:""},
"Supplier":{cardNum:"P32",type:"prel",tags:["power"], resources:{steel:4},prod:{energy:2},color:"green",cardExtra:""},
"SupplyDrop":{cardNum:"P33",type:"prel",resources:{ti:3,steel:8,plant:3},prod:{},color:"green",cardExtra:""},
"UNMIContractor":{cardNum:"P34",type:"prel",tags:["earth"],resources:{tr:3,card:1},prod:{},color:"green",cardExtra:""},
"AcquiredSpaceAgency":{cardNum:"P35",type:"prel",resources:{ti:6,"draw":{space:2}},prod:{},color:"green",cardExtra:""},
"ColonizerTrainingCamp":{cardNum:"001",type:"proj",tags:["jovian","building"],"cost":"8",resources:{},prod:{},"req":{maxo2:5},vp:2,color:"green",cardExtra:""},
"AsteroidMiningConsortium":{cardNum:"002",type:"proj",tags:["jovian"],"cost":"13",resources:{},prod:{ti:1},"req":{ti:1},vp:1,"reduce":{ti:1},color:"green",cardExtra:""},
"DeepWellHeating":{cardNum:"003",type:"proj",tags:["power","building"],"cost":"13",resources:{temp:1},prod:{energy:1},color:"green",cardExtra:""},
"CloudSeeding":{cardNum:"004",type:"proj","cost":"11",resources:{},prod:{mc:-1,plant:2},"req":{ocean:3},"reduce":{heat:1},color:"green",cardExtra:""},
"SearchForLife":{cardNum:"005",type:"proj",tags:["science"], "cost":"3",resources:{},prod:{},"req":{maxo2:6},color:"blue",cardExtra:"1 mc -> Microbe*: Science Resource\n(Action: Spend 1 mc to reveal and discard the top card of the draw deck. If that card has a Microbe tag, add a Science resource here.)\n(3 VPs if you have one or more Science resources here.)\nVP: Science Resource*: 3\n"},
"InventorsGuild":{cardNum:"006",type:"proj",tags:["science"], "cost":"9",resources:{},prod:{},color:"blue",cardExtra:"-> Action: LOOK AT THE TOP CARD AND EITHER BUY IT OR DISCARD IT"},
"MartianRails":{cardNum:"007",type:"proj",tags:["building"], "cost":"13",resources:{},prod:{},color:"blue",cardExtra:"energy -> mc/any-City*\n(Action: Spend 1 energy to gain 1 mc for each City tile ON MARS.)"},
"Capital":{cardNum:"008",type:"proj",tags:["city","building"],"cost":"26",resources:{},prod:{mc:5,"energy":-2},"req":{ocean:4},color:"green",cardExtra:"Special Tile\n(Place this tile. 1 ADDITIONAL VP FOR EACH OCEAN TILE ADJACENT TO THIS CITY TILE.)\nVP: 1/Ocean*"},
"Asteroid":{cardNum:"009",type:"proj",tags:["space"],tags:["event"],"cost":"14",resources:{temp:1, ti:2},prod:{},color:"red","remove":{plant:3},cardExtra:""},
"Comet":{cardNum:"010",type:"proj",tags:["space"],tags:["event"],"cost":"21",resources:{ocean:1,temp:1},prod:{},color:"red","remove":{plant:3},cardExtra:""},
"BigAsteroid":{cardNum:"011",type:"proj",tags:["space"],tags:["event"],"cost":"27",resources:{temp:2, ti:4},prod:{},color:"red","remove":{plant:4},cardExtra:""},
"WaterImportFromEuropa":{cardNum:"012",type:"proj",tags:["jovian","space"],"cost":"25",resources:{},prod:{},color:"blue",cardExtra:"12 mc (ti) -> Ocean Tile\n(Action: Pay 12 mc to place an ocean tile. ti MAY BE USED as if playing a Space card.)\n------\n(1 VP for each Jovian tag you have.)\nVP: 1/Jovian"},
"SpaceElevator":{cardNum:"013",type:"proj",tags:["space","building"],"cost":"27",resources:{},prod:{ti:1},vp:2,color:"blue",cardExtra:"steel -> 5 mc\n(Action: Spend 1 steel to gain 5 mc.)\n"},
"DevelopmentCenter":{cardNum:"014",type:"proj",tags:["science","building"],"cost":"11",resources:{},prod:{},color:"blue",cardExtra:"energy -> +Card\n(Action: Spend 1 energy to draw a card.)"},
"EquatorialMagnetizer":{cardNum:"015",type:"proj",tags:["building"], "cost":"11",resources:{},prod:{},color:"blue",cardExtra:"Decrease energy 1 -> TR\n(Action: Decrease your energy production 1 step to increase your terraform rating 1 step.)"},
"DomedCrater":{cardNum:"016",type:"proj",tags:["city","building"],"cost":"24",resources:{city:1,plant:3},prod:{"energy":-1,mc:3,},"req":{maxo2:7},vp:1,color:"green",cardExtra:""},
"NoctisCity":{cardNum:"017",type:"proj",tags:["city","building"],"cost":"18",resources:{},prod:{"energy":-1,mc:3,},color:"green",cardExtra:"City Tile*\n(Place a City ON THE RESERVED AREA, disregarding normal placement restrictions.)"},
"MethaneFromTitan":{cardNum:"018",type:"proj",tags:["jovian","space"],"cost":"28",resources:{},prod:{heat:2,plant:2},"req":{o2:2},vp:2,color:"green",cardExtra:""},
"ImportedHydrogen":{cardNum:"019",type:"proj",tags:["earth","space","event"],"cost":"16",resources:{ocean:1},prod:{},color:"red",cardExtra:"3 plants OR 3 Microbe* Resource OR 2 Animal* resource\n(Gain 3 plants, or add 3 Microbes or 2 Animals to ANOTHER card.)"},
"ResearchOutpost":{cardNum:"020",type:"proj",tags:["science", "city","building"],"cost":"18",resources:{},prod:{},color:"blue",discount:{any:1},cardExtra:"City Tile*\n(Place a city tile NEXT TO NO OTHER TILE.)"},
"PhobosSpaceHaven":{cardNum:"021",type:"proj",tags:["space","city"],"cost":"25",resources:{},prod:{ti:1},vp:3,color:"green",cardExtra:"City Tile*\n(Increase your ti production 1 step and place a City tile ON THE RESERVED AREA.)\n"},
"BlackPolarDust":{cardNum:"022",type:"proj","cost":"15",resources:{ocean:1},prod:{heat:3,mc:-2},color:"green",cardExtra:""},
"ArcticAlgae":{cardNum:"023",type:"proj",tags:["plant"],"cost":"12",resources:{plant:1},prod:{},"req":{"maxtemp":-12},color:"blue",cardExtra:"any-Ocean Tile: plant plant\n(Effect: When anyone places an ocean tile, gain 2 plants.)\n------\n\n(It must be -12 C or colder to play. Gain 1 plant.)"},
"Predators":{cardNum:"024",type:"proj",tags:["animal"],"cost":"14",resources:{},prod:{},"req":{o2:11},color:"blue",cardExtra:"any-Animal Resource -> Animal Resource\n(Action: Remove 1 Animal from any card and add it to this card.)\n------\n(Requires 11% oxygen. 1 VP per Animal on this card.)\nVP: 1/Animal"},
"SpaceStation":{cardNum:"025",type:"proj",tags:["space"], "cost":"10",resources:{},prod:{},vp:1,color:"blue",discount:{space:2},cardExtra:""},
"EOSChasmaNationalPark":{cardNum:"026",type:"proj",tags:["plant","building"],"cost":"16",resources:{plant:3},prod:{mc:2,},"req":{"temp":-12},vp:1,color:"green",cardExtra:"Animal* Resource\n(Add 1 Animal TO ANY ANIMAL CARD.)\n"},
"InterstellarColonyShip":{cardNum:"027",type:"proj",tags:["earth","space","event"],"cost":"24",resources:{},prod:{},"req":{science:5},vp:4,color:"red",cardExtra:""},
"SecurityFleet":{cardNum:"028",type:"proj",tags:["space"], "cost":"12",resources:{},prod:{},color:"blue",cardExtra:"ti -> Fighter Resource\n(Action: Spend 1 ti to add 1 fighter resource to this card.)\n------\n(1 VP for each fighter resource on this card.)\nVP: 1/Fighter Resource"},
"CupolaCity":{cardNum:"029",type:"proj",tags:["city","building"],"cost":"16",resources:{city:1},prod:{"energy":-1,mc:3,},"req":{maxo2:9},color:"green",cardExtra:""},
"LunarBeam":{cardNum:"030",type:"proj",tags:["earth","power"],"cost":"13",resources:{},prod:{heat:2,energy:2,mc:-2},color:"green",cardExtra:""},
"OptimalAerobraking":{cardNum:"031",type:"proj",tags:["space"], "cost":"7",resources:{},prod:{},color:"blue",cardExtra:"Space Event: 3 mc heat heat heat\n(Effect: When you play a Space Event, you gain 3 mc and 3 heat.)"},
"UndergroundCity":{cardNum:"032",type:"proj",tags:["city","building"],"cost":"18",resources:{city:1},prod:{"energy":-2,steel:2},color:"green",cardExtra:""},
"RegolithEaters":{cardNum:"033",type:"proj",tags:["science","microbe"],"cost":"13",resources:{},prod:{},color:"blue",cardExtra:"-> Microbe\nOR Microbe Microbe -> O2\n(Action: Add 1 Microbe to this card, or remove 2 Microbes from this card to raise oxygen level 1 step.)"},
"GHGProducingBacteria":{cardNum:"034",type:"proj",tags:["science","microbe"],"cost":"8",resources:{},prod:{},"req":{o2:4},color:"blue",cardExtra:"-> Microbe Resource\nOR Microbe Resource Microbe Resource -> TempUp 1\n(Action: Add 1 Microbe to this card, or remove 2 Microbes to raise temperature 1 step.)\n------\n(Requires 4% oxygen.)"},
"Ants":{cardNum:"035",type:"proj",tags:["microbe"],"cost":"9",resources:{},prod:{},"req":{o2:4},color:"blue",cardExtra:"any-Microbe Resource -> Microbe Resource\n(Action: Remove 1 Microbe from any card to add 1 to this card.)\n------\n(Requires 4% oxygen. 1 VP per 2 Microbes on this card.)\nVP: 1/2 Microbe Resource"},
"ReleaseOfInertGases":{cardNum:"036",type:"proj",tags:["event"],"cost":"14",resources:{tr:2},prod:{},color:"red",cardExtra:""},
"NitrogenRichAsteroid":{cardNum:"037",type:"proj",tags:["space"],tags:["event"],"cost":"31",resources:{tr:2,temp:1},prod:{plant:1},color:"red",cardExtra:"Increase plant 1 OR\nIf 3 plant tags:(Raise your terraforming rating 2 steps and temperature 1 step. Increase your plant production 1 step, or 4 steps if you have 3 plant tags.)"},
"RoverConstruction":{cardNum:"038",type:"proj",tags:["building"], "cost":"8",resources:{},prod:{},vp:1,color:"blue",cardExtra:"any-City: 2\n(Effect: When any City tile is placed, gain 2 mc.)\n------\n"},
"DeimosDown":{cardNum:"039",type:"proj",tags:["space"],tags:["event"],"cost":"31",resources:{temp:3,steel:4},prod:{},color:"red","remove":{plant:8},cardExtra:""},
"AsteroidMining":{cardNum:"040",type:"proj",tags:["jovian","space"],"cost":"30",resources:{},prod:{ti:2},vp:2,color:"green",cardExtra:""},
"FoodFactory":{cardNum:"041",type:"proj",tags:["building"], "cost":"12",resources:{},prod:{mc:4,"plant":-1},vp:1,color:"green",cardExtra:""},
"ArchaeBacteria":{cardNum:"042",type:"proj",tags:["microbe"],"cost":"6",resources:{},prod:{plant:1},"req":{"maxtemp":-18},color:"green",cardExtra:""},
"CarbonateProcessing":{cardNum:"043",type:"proj",tags:["building"], "cost":"6",resources:{},prod:{"energy":-1,heat:3},color:"green",cardExtra:""},
"NaturalPreserve":{cardNum:"044",type:"proj",tags:["science","building"],"cost":"9",resources:{},prod:{mc:1,},"req":{maxo2:4},vp:1,color:"green",cardExtra:"Special Tile*\n(Place this tile NEXT TO NO OTHER TILE.)\n"},
"NuclearPower":{cardNum:"045",type:"proj",tags:["power","building"],"cost":"10",resources:{},prod:{energy:3,mc:-2},color:"green",cardExtra:""},
"LightningHarvest":{cardNum:"046",type:"proj",tags:["power"], "cost":"8",resources:{},prod:{energy:1,mc:1},"req":{science:3},vp:1,color:"green",cardExtra:""},
"Algae":{cardNum:"047",type:"proj",tags:["plant"],"cost":"10",resources:{plant:1},prod:{plant:2},"req":{ocean:5},color:"green",cardExtra:""},
"AdaptedLichen":{cardNum:"048",type:"proj",tags:["plant"],"cost":"9",resources:{},prod:{plant:1},color:"green",cardExtra:""},
"Tardigrades":{cardNum:"049",type:"proj",tags:["microbe"],"cost":"4",resources:{},prod:{},color:"blue",cardExtra:"-> Microbe Resource\n(Action: Add 1 Microbe to this card.)\n------\n(1 VP per 4 Microbes on this card.)\nVP: 1/4 Microbe Resource)"},
"Virus":{cardNum:"050",type:"proj",tags:["microbe","event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"Remove 2 any-Animal OR -5 any-plant\n(Remove up to 2 Animals or 5 plants from any player.)"},
"MirandaResort":{cardNum:"051",type:"proj",tags:["jovian","space"],"cost":"12",resources:{},prod:{},vp:1,color:"green",cardExtra:"Increase mc/Earth\n(Increase your mc production 1 step for each Earth tag you have.)\n"},
"Fish":{cardNum:"052",type:"proj",tags:["animal"],"cost":"9",resources:{},prod:{},"req":{temp:2},color:"blue",cardExtra:"-> Animal Resource\n(Action: Add 1 Animal to this card.)\n------\nReduce any-plant 1\n(Requires +2 C or warmer. Decrease any plant production 1 step. 1 VP for each Animal on this card.)\nVP: 1/Animal Resource"},
"LakeMarineris":{cardNum:"053",type:"proj","cost":"18",resources:{ocean:2},prod:{},"req":{temp:0},vp:2,color:"green",cardExtra:""},
"SmallAnimals":{cardNum:"054",type:"proj",tags:["animal"],"cost":"6",resources:{},prod:{},"req":{o2:6},"reduce":{plant:1},color:"blue",cardExtra:"-> Animal Resource\n(Action: Add 1 Animal to this card.)\n------\n\n(Requires 6% oxygen. Decrease any plant production 1 step. 1 VP per 2 Animals on this card.)\nVP: 1/2 Animal Resource"},
"KelpFarming":{cardNum:"055",type:"proj",tags:["plant"],"cost":"17",resources:{plant:2},prod:{mc:2,plant:3},"req":{ocean:6},vp:1,color:"green",cardExtra:""},
"Mine":{cardNum:"056",type:"proj",tags:["building"], "cost":"4",resources:{},prod:{steel:1},color:"green",cardExtra:""},
"VestaShipyard":{cardNum:"057",type:"proj",tags:["jovian","space"],"cost":"15",resources:{},prod:{ti:1},vp:1,color:"green",cardExtra:""},
"BeamFromAThoriumAsteroid":{cardNum:"058",type:"proj",tags:["jovian"],tags:["space","power"],"cost":"32",resources:{},prod:{heat:3,energy:3},"req":{jovian:1},vp:1,color:"green",cardExtra:""},
"Mangrove":{cardNum:"059",type:"proj",tags:["plant"],"cost":"12",resources:{},prod:{},"req":{temp:4},vp:1,color:"green",cardExtra:"Greenery Tile*\n(Place a greenery tile ON AN AREA RESERVED FOR OCEAN and raise oxygen 1 step. Disregard normal placement restrictions for this.)\n"},
"Trees":{cardNum:"060",type:"proj",tags:["plant"],"cost":"13",resources:{plant:1},prod:{plant:3},"req":{"temp":-4},vp:1,color:"green",cardExtra:""},
"GreatEscarpmentConsortium":{cardNum:"061",type:"proj","cost":"6",resources:{},prod:{steel:1},"req":{},"reduce":{steel:1},color:"green",cardExtra:"(Decrease any steel production 1 step and increase your own 1 step.)"},
"MineralDeposit":{cardNum:"062",type:"proj",tags:["event"],"cost":"5",resources:{steel:5},prod:{},color:"red",cardExtra:""},
"MiningExpedition":{cardNum:"063",type:"proj",tags:["event"],"cost":"12",resources:{o2:1,steel:2},prod:{},color:"red",cardExtra:"(Remove 2 plants from any player.)"},
"MiningArea":{cardNum:"064",type:"proj",tags:["building"], "cost":"4",resources:{},prod:{},color:"green",cardExtra:"Special Tile*\n[Increase steel 1 OR ti 1]*\n(Place this tile on an area with a steel or ti placement bonus, adjacent to another of your tiles. Increase your production of that resource 1 step.)"},
"BuildingIndustries":{cardNum:"065",type:"proj",tags:["building"], "cost":"6",resources:{},prod:{"energy":-1,steel:2},color:"green",cardExtra:""},
"LandClaim":{cardNum:"066",type:"proj",tags:["event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"PLACE YOUR MARKER ON A NON-RESERVED AREA. ONLY YOU MAY PLACE A TILE HERE."},
"MiningRights":{cardNum:"067",type:"proj",tags:["building"], "cost":"9",resources:{},prod:{},color:"green",cardExtra:"Special Tile*\nIncrease steel 1 or ti 1\n(Place this tile on an area with a steel or ti placement bonus. Increase that production 1 step.)"},
"Sponsors":{cardNum:"068",type:"proj",tags:["earth"],"cost":"6",resources:{},prod:{mc:2},color:"green",cardExtra:""},
"ElectroCatapult":{cardNum:"069",type:"proj",tags:["building"], "cost":"17",resources:{},prod:{"energy":-1},"req":{maxo2:8},vp:1,color:"blue",cardExtra:"plant/steel -> 7 mc\n(Action: Spend 1 plant or 1 steel to gain 7 mc.)"},
"EarthCatapult":{cardNum:"070",type:"proj",tags:["earth"],"cost":"23",resources:{},prod:{},vp:2,color:"blue",discount:{any:2},cardExtra:""},
"AdvancedAlloys":{cardNum:"071",type:"proj",tags:["science"], "cost":"9",resources:{},prod:{},color:"blue",cardExtra:"ti: +1 mc\nsteel: +1mc\n(Effect: Each ti you have is worth 1 mc extra. Each steel you have is worth 1 mc extra.)"},
"Birds":{cardNum:"072",type:"proj",tags:["animal"],"cost":"10",resources:{},prod:{},"req":{o2:13},"reduce":{plant:2},color:"blue",cardExtra:"-> Animal Resource\n(Action: Add an Animal to this card.)\n------\n\n(Requires 13% oxygen. Decrease any plant production 2 steps. 1 VP for each Animal on this card.)\nVP: 1/Animal"},
"MarsUniversity":{cardNum:"073",type:"proj",tags:["science","building"],"cost":"8",resources:{},prod:{},vp:1,color:"blue",cardExtra:"Science: -Card +Card\nEffect: When you play a Science tag, including this, you may discard a card from hand to draw a card.\n------\n"},
"ViralEnhancers":{cardNum:"074",type:"proj",tags:["science","microbe"],"cost":"9",resources:{},prod:{},color:"blue",cardExtra:"plant/Microbe/Animallant/Microbe*/Animal*\n(Effect: When you play a plant, Microbe, or an Animal tag, including this, gain 1 plant or add 1 resource TO THAT CARD.)"},
"TowingAComet":{cardNum:"075",type:"proj",tags:["space"],tags:["event"],"cost":"23",resources:{ocean:1,o2:1,plant:2},prod:{},color:"red",cardExtra:""},
"SpaceMirrors":{cardNum:"076",type:"proj",tags:["power","space"],"cost":"3",resources:{},prod:{energy:1},color:"blue",cardExtra:"7 mc -> (Action: Spend 7 mc to increase your energy production 1 step.)"},
"SolarWindPower":{cardNum:"077",type:"proj",tags:["science"],tags:["space","power"],"cost":"11",resources:{ti:2},prod:{energy:1},color:"green",cardExtra:""},
"IceAsteroid":{cardNum:"078",type:"proj",tags:["space"],tags:["event"],"cost":"23",resources:{ocean:2},prod:{},color:"red",cardExtra:""},
"QuantumExtractor":{cardNum:"079",type:"proj",tags:["science","power"],"cost":"13",resources:{},prod:{energy:4},"req":{science:4},color:"blue",discount:{space:2},cardExtra:""},
"GiantIceAsteroid":{cardNum:"080",type:"proj",tags:["space"],tags:["event"],"cost":"36",resources:{ocean:2,temp:2},prod:{},color:"red","remove":{plant:6},cardExtra:""},
"GanymedeColony":{cardNum:"081",type:"proj",tags:["jovian"],tags:["space","city"],"cost":"20",resources:{},prod:{},color:"green",cardExtra:"City Tile*\n(Place a City tile ON THE RESERVED AREA. 1 VP per Jovian tag you have.)\nVP: 1/Jovian"},
"CallistoPenalMines":{cardNum:"082",type:"proj",tags:["jovian","space"],"cost":"24",resources:{},prod:{mc:3,},vp:2,color:"green",cardExtra:""},
"GiantSpaceMirror":{cardNum:"083",type:"proj",tags:["power","space"],"cost":"17",resources:{},prod:{energy:3},color:"green",cardExtra:""},
"TransNeptuneProbe":{cardNum:"084",type:"proj",tags:["science","space"],"cost":"6",resources:{},prod:{},vp:1,color:"green",cardExtra:""},
"CommercialDistrict":{cardNum:"085",type:"proj",tags:["building"], "cost":"16",resources:{},prod:{"energy":-1,mc:4,energy:1},color:"green",cardExtra:"Special Tile\n( Place this tile. 1 VP PER ADJACENT CITY TILE.)\nVP: 1/City*"},
"RoboticWorkforce":{cardNum:"086",type:"proj",tags:["science"], "cost":"9",resources:{},prod:{},color:"green",cardExtra:"COPY A Building.\n(Duplicate only the production box of one of your Building cards.)"},
"Grass":{cardNum:"087",type:"proj",tags:["plant"],"cost":"11",resources:{plant:3},prod:{plant:1},"req":{"temp":-16},color:"green",cardExtra:""},
"Heather":{cardNum:"088",type:"proj",tags:["plant"],"cost":"6",resources:{plant:1},prod:{plant:1},"req":{"temp":-14},color:"green",cardExtra:""},
"PeroxidePower":{cardNum:"089",type:"proj",tags:["power","building"],"cost":"7",resources:{},prod:{mc:-1,energy:2},color:"green",cardExtra:""},
"Research":{cardNum:"090",type:"proj",tags:["science","science"],"cost":"11",resources:{card:2},prod:{},vp:1,color:"green",cardExtra:""},
"GeneRepair":{cardNum:"091",type:"proj",tags:["science"], "cost":"12",resources:{},prod:{mc:2,},"req":{science:3},vp:2,color:"green",cardExtra:""},
"IoMiningIndustries":{cardNum:"092",type:"proj",tags:["jovian","space"],"cost":"41",resources:{},prod:{mc:2,ti:2},color:"green",cardExtra:"1 VP per Jovian tag you have.)\n1/Jovian"},
"Bushes":{cardNum:"093",type:"proj",tags:["plant"],"cost":"10",resources:{plant:2},prod:{plant:2},"req":{"temp":-10},color:"green",cardExtra:""},
"MassConverter":{cardNum:"094",type:"proj",tags:["science","power"],"cost":"8",resources:{},prod:{energy:6},"req":{science:5},color:"blue",discount:{space:2},cardExtra:""},
"PhysicsComplex":{cardNum:"095",type:"proj",tags:["science","building"],"cost":"12",resources:{},prod:{},color:"blue",cardExtra:"6 energy -> Science Resource\n(Action: Spend 6 energy to add a Science resource to this card.)\n------\n(2 VP for each Science resource on this card.)\nVP: 2/Science Resource"},
"Greenhouses":{cardNum:"096",type:"proj",tags:["plant","building"],"cost":"6",resources:{},prod:{},color:"green",cardExtra:"plant/any-City\n(Gain 1 plant for each City tile in play.)"},
"NuclearZone":{cardNum:"097",type:"proj",tags:["earth"],"cost":"10",resources:{temp:2},prod:{},"vp":-2,color:"green",cardExtra:"Special Tile\n(Place this tile.)\n"},
"TropicalResort":{cardNum:"098",type:"proj",tags:["building"], "cost":"13",resources:{},prod:{mc:3,"heat":-2},vp:2,color:"green",cardExtra:""},
"TollStation":{cardNum:"099",type:"proj",tags:["space"], "cost":"12",resources:{},prod:{},color:"green",cardExtra:"Increase 1 mc/Space*\n(Increase your mc production 1 step for each Space tag OPPONENTS have.)"},
"FueledGenerators":{cardNum:"100",type:"proj",tags:["power","building"],"cost":"1",resources:{},prod:{mc:-1,energy:1},color:"green",cardExtra:""},
"Ironworks":{cardNum:"101",type:"proj",tags:["building"], "cost":"11",resources:{},prod:{},color:"green",cardExtra:"4 energy -> steel O2\n(Action Spend 4 energy to gain 1 steel and increase oxygen 1 step.)"},
"PowerGrid":{cardNum:"102",type:"proj",tags:["power"], "cost":"18",resources:{},prod:{},color:"green",cardExtra:"Increase energy/energy tag\n(Increase your energy production step for each energy tag you have, including this.)"},
"Steelworks":{cardNum:"103",type:"proj",tags:["building"], "cost":"15",resources:{},prod:{},color:"blue",cardExtra:"4 energy -> steel steel O2\n(Action: Spend 4 energy to gain 2 steel and increase oxygen 1 step.)"},
"OreProcessor":{cardNum:"104",type:"proj",tags:["building"], "cost":"13",resources:{},prod:{},color:"blue",cardExtra:"4 energy -> ti O2\n(Action: Spend 4 energy to gain 1 ti and increase oxygen 1 step.)"},
"EarthOffice":{cardNum:"105",type:"proj",tags:["earth"],"cost":"1",resources:{},prod:{},color:"blue",discount:{earth:3},cardExtra:""},
"AcquiredCompany":{cardNum:"106",type:"proj",tags:["earth"],"cost":"10",resources:{},prod:{mc:3,},color:"green",cardExtra:""},
"MediaArchives":{cardNum:"107",type:"proj",tags:["earth"],"cost":"8",resources:{},prod:{},color:"green",cardExtra:"1 mc/Event*\n(Gain 1 mc for each Event EVER PLAYED by all players.)"},
"OpenCity":{cardNum:"108",type:"proj",tags:["city","building"],"cost":"23",resources:{city:1,plant:2},prod:{"energy":-1,mc:4,energy:1},"req":{o2:12},vp:1,color:"green",cardExtra:""},
"MediaGroup":{cardNum:"109",type:"proj",tags:["earth"],"cost":"6",resources:{},prod:{},color:"blue",cardExtra:"Event: 3 mc\n(Effect: After you play an Event card, you gain 3 mc.)"},
"BusinessNetwork":{cardNum:"110",type:"proj",tags:["earth"],"cost":"4",resources:{},prod:{mc:1},color:"blue",cardExtra:"-> Action: LOOK AT THE TOP CARD AND EITHER BUY IT OR DISCARD IT\n------\n(Decrease your mc production 1 step.)"},
"BusinessContacts":{cardNum:"111",type:"proj",tags:["earth"],tags:["event"],"cost":"7",resources:{},prod:{},color:"red",cardExtra:"LOOK AT THE TOP 4 CARDS FROM THE DECK. TAKE 2 OF THEM INTO HAND AND DISCARD THE OTHER 2"},
"BribedCommittee":{cardNum:"112",type:"proj",tags:["earth"],tags:["event"],"cost":"7",resources:{tr:2},prod:{},"vp":-2,color:"red",cardExtra:""},
"SolarPower":{cardNum:"113",type:"proj",tags:["power","building"],"cost":"11",resources:{},prod:{energy:1},vp:1,color:"green",cardExtra:""},
"BreathingFilters":{cardNum:"114",type:"proj",tags:["science"], "cost":"11",resources:{},prod:{},"req":{o2:7},vp:2,color:"green",cardExtra:""},
"ArtificialPhotosynthesis":{cardNum:"115",type:"proj",tags:["science"], "cost":"12",resources:{},prod:{},color:"green",cardExtra:"Increase plant 1 OR energy 2\n(Increase your plant production 1 step or your energy production 2 steps.)"},
"ArtificialLake":{cardNum:"116",type:"proj",tags:["building"], "cost":"15",resources:{ocean:1},prod:{},"req":{"temp":-6},vp:1,color:"green",cardExtra:"Ocean Tile*\n(Requires -6 C or warmer. Place 1 ocean tile ON AN AREA NOT RESERVED FOR OCEAN.)\n"},
"GeothermalPower":{cardNum:"117",type:"proj",tags:["power","building"],"cost":"11",resources:{},prod:{energy:2},color:"green",cardExtra:""},
"Farming":{cardNum:"118",type:"proj",tags:["plant"],"cost":"16",resources:{plant:2},prod:{mc:2,plant:2},"req":{temp:4},vp:2,color:"green",cardExtra:""},
"DustSeals":{cardNum:"119",type:"proj","cost":"2",resources:{},prod:{},"req":{maxocean:3},vp:1,color:"green",cardExtra:""},
"UrbanizedArea":{cardNum:"120",type:"proj",tags:["city","building"],"cost":"10",resources:{},prod:{"energy":-1,mc:2,energy:1},color:"green",cardExtra:"City Tile*\n( Place a City tile ADJACENT TO AT LEAST 2 OTHER CITY TILES.)"},
"Sabotage":{cardNum:"121",type:"proj",tags:["event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"-3 any-ti OR -4 any-steel OR -7 any-mc\n(Remove up to 3 ti from any player, or 4 steel, or 7 mc.)"},
"Moss":{cardNum:"122",type:"proj",tags:["plant"],"cost":"4",resources:{"plant":-1},prod:{plant:1},"req":{ocean:3},color:"green",cardExtra:""},
"IndustrialCenter":{cardNum:"123",type:"proj",tags:["building"], "cost":"4",resources:{},prod:{},color:"blue",cardExtra:"7 mc -> steel production\n(Action: Spend 7 mc to increase your steel production 1 step.)\n------\nSpecial Tile*\n(Place this tile ADJACENT TO A CITY TILE.)"},
"HiredRaiders":{cardNum:"124",type:"proj",tags:["event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"STEAL 2 any-steel\nOR STEAL 3 any-mc\n(Steal up to 2 steal, or 3 mc from any player.)"},
"Hackers":{cardNum:"125",type:"proj","cost":"3",resources:{},prod:{"energy":-1,mc:2,energy:1},"vp":-1,"reduce":{mc:2},color:"green",cardExtra:""},
"GHGFactories":{cardNum:"126",type:"proj",tags:["building"], "cost":"11",resources:{},prod:{"energy":-1,heat:4},color:"green",cardExtra:""},
"SubterraneanReservoir":{cardNum:"127",type:"proj",tags:["event"],"cost":"11",resources:{ocean:1},prod:{},color:"red",cardExtra:""},
"EcologicalZone":{cardNum:"128",type:"proj",tags:["animal","plant"],"cost":"12",resources:{},prod:{},"req":{greenery:1},color:"blue",cardExtra:"Animal/plant: Animal Resource\n(Effect: When you play an Animal or plant tag (including these 2), add an Animal to this card.)\n------\nSpecial Tile*\n(Requires that you have a greenery tile. Place this tile adjacent to any greenery tile. 1 VP per 2 Animals on this card.)\nVP: 1/2 Animal Resource"},
"Zeppelins":{cardNum:"129",type:"proj","cost":"13",resources:{},prod:{},"req":{o2:5},vp:1,color:"green",cardExtra:"Increase mc/any-City*\n(Increase your mc production 1 step for each City tile ON MARS.)\n"},
"Worms":{cardNum:"130",type:"proj",tags:["microbe"],"cost":"8",resources:{},prod:{},"req":{o2:4},color:"green",cardExtra:"Increase plant/2 Microbe tags\n(Increase your plant production 1 step for every 2 Microbe tags you have, including this.)"},
"Decomposers":{cardNum:"131",type:"proj",tags:["microbe"],"cost":"5",resources:{},prod:{},"req":{o2:3},color:"blue",cardExtra:"Animal/plant/Microbe: Microbe Resource\n(Effect: When you play an Animal, plant, or Microbe tag, including this, add a Microbe to this card.)\n------\n( 1 VP per 3 Microbes on this card.)\nVP: 1/3 Microbe Resource"},
"FusionPower":{cardNum:"132",type:"proj",tags:["science"],tags:["power","building"],"cost":"14",resources:{},prod:{energy:3},"req":{energy:2},color:"green",cardExtra:""},
"SymbioticFungus":{cardNum:"133",type:"proj",tags:["microbe"],"cost":"4",resources:{},prod:{},"req":{"temp":-14},color:"blue",cardExtra:"-> Microbe* Resource\n(Action: Add a Microbe to ANOTHER card.)\n"},
"ExtremeColdFungus":{cardNum:"134",type:"proj",tags:["microbe"],"cost":"13",resources:{},prod:{},"req":{"maxtemp":-10},color:"blue",cardExtra:"-> plant\nOR -> Microbe Microbe*\n(Action: Gain 1 plant or add 2 Microbes to ANOTHER card.)\n------\n(It must be -10 C or colder.)"},
"AdvancedEcosystems":{cardNum:"135",type:"proj",tags:["plant","microbe","animal"],"cost":"11",resources:{},prod:{},"req":{plant:1,animal:1,microbe:1},vp:3,color:"green",cardExtra:""},
"GreatDam":{cardNum:"136",type:"proj",tags:["power","building"],"cost":"12",resources:{},prod:{energy:2},"req":{ocean:4},vp:1,color:"green",cardExtra:""},
"Cartel":{cardNum:"137",type:"proj",tags:["earth"],"cost":"8",resources:{},prod:{mc:1},color:"green",cardExtra:"(Increase your mc production 1 step for each Earth tag you have, including this.)"},
"StripMine":{cardNum:"138",type:"proj",tags:["building"], "cost":"25",resources:{o2:2},prod:{"energy":-2,steel:2,ti:1},color:"green",cardExtra:""},
"WavePower":{cardNum:"139",type:"proj",tags:["power"], "cost":"8",resources:{},prod:{energy:1},"req":{ocean:3},vp:1,color:"green",cardExtra:""},
"LavaFlows":{cardNum:"140",type:"proj",tags:["event"],"cost":"18",resources:{temp:2},prod:{},color:"red",cardExtra:"Special Tile*\n(place this tile ON EITHER THARSIS THOLUS, ASCRAEUS MONS, PAVONIS MONS OR ARSIA MONS.)"},
"PowerPlant":{cardNum:"141",type:"proj",tags:["power","building"],"cost":"4",resources:{},prod:{energy:1},color:"green",cardExtra:""},
"MoholeArea":{cardNum:"142",type:"proj",tags:["building"], "cost":"20",resources:{},prod:{heat:4},color:"green",cardExtra:"Special Tile*\n(Increase your heat production 4 steps. Place this tile ON AN AREA RESERVED FOR OCEAN.)"},
"LargeConvoy":{cardNum:"143",type:"proj",tags:["earth","space","event"],"cost":"36",resources:{ocean:1,card:2},prod:{},vp:2,color:"red",cardExtra:"5 plant/4 Animal* Resource\n(Gain 5 plants or add 4 Animals to ANOTHER card.)\n"},
"TitaniumMine":{cardNum:"144",type:"proj",tags:["building"], "cost":"7",resources:{},prod:{ti:1},color:"green",cardExtra:""},
"TectonicStressPower":{cardNum:"145",type:"proj",tags:["power","building"],"cost":"18",resources:{},prod:{energy:3},"req":{science:2},vp:1,color:"green",cardExtra:""},
"NitrophilicMoss":{cardNum:"146",type:"proj",tags:["plant"],"cost":"8",resources:{"plant":-2},prod:{plant:2},"req":{ocean:3},color:"green",cardExtra:""},
"Herbivores":{cardNum:"147",type:"proj",tags:["animal"],"cost":"12",resources:{},prod:{},"req":{o2:8},"reduce":{plant:1},color:"blue",cardExtra:"plantation: Animal Resource\n(Effect: When you place a greenery tile, add an Animal to this card.)\n------\nAnimal Resource\n\n( Add 1 Animal to this card. Decrease any plant production 1 step. 1 VP per 2 Animals on this card.)\nVP: 1/2 Animal Resource"},
"Insects":{cardNum:"148",type:"proj",tags:["microbe"],"cost":"9",resources:{},prod:{},"req":{o2:6},color:"green",cardExtra:"\nIncrease plant/plant tag\n(Increase your plant production 1 step for each plant tag you have.)"},
"CEOsFavoriteProject":{cardNum:"149",type:"proj",tags:["event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"ADD 1 RESOURCE TO A CARD WITH AT LEAST 1 RESOURCE ON IT"},
"AntiGravityTechnology":{cardNum:"150",type:"proj",tags:["science"], "cost":"14",resources:{},prod:{},"req":{science:7},vp:3,color:"blue",discount:{any:2},cardExtra:""},
"InvestmentLoan":{cardNum:"151",type:"proj",tags:["earth"],tags:["event"],"cost":"3",resources:{mc:10},prod:{mc:-1},color:"red",cardExtra:""},
"Insulation":{cardNum:"152",type:"proj","cost":"2",resources:{},prod:{},color:"green",cardExtra:"Decrease heat X\nmc:X\n(Decrease your heat production any number of steps and increase your mc production the same number of steps.)"},
"AdaptationTechnology":{cardNum:"153",type:"proj",tags:["science"], "cost":"12",resources:{},prod:{},vp:1,color:"blue",cardExtra:"Requirements: O2/Ocean/Temp: +/- 2\n(Effect: Your global requirements are +2 or -2 steps, your choice in each case.)\n"},
"CaretakerContract":{cardNum:"154",type:"proj","cost":"3",resources:{},prod:{},"req":{temp:0},color:"blue",cardExtra:"8 heat -> TR\n(Action: Spend 8 heat to increase your terraform rating 1 step.)\n------\n(Requires 0 C or warmer.)"},
"DesignedMicroOrganisms":{cardNum:"155",type:"proj",tags:["science","microbe"],"cost":"16",resources:{},prod:{plant:2},"req":{"maxtemp":-14},color:"green",cardExtra:""},
"StandardTechnology":{cardNum:"156",type:"proj",tags:["science"], "cost":"6",resources:{},prod:{},color:"blue",cardExtra:"Standard Projects: 3 mc\n(Effect: After you pay for a standard project, except selling patents, you gain 3 mc.)"},
"NitriteReducingBacteria":{cardNum:"157",type:"proj",tags:["microbe"],"cost":"11",resources:{},prod:{},color:"blue",cardExtra:"-> Microbe Resource\nOR 3 Microbe Resource -> TR\n(Action: Add 1 Microbe to this card, or remove 3 Microbes to increase your TR 1 step.\n------\nMicrobe Microbe Microbe (Add 3 Microbes to this card.)"},
"IndustrialMicrobes":{cardNum:"158",type:"proj",tags:["microbe","building"],"cost":"12",resources:{},prod:{energy:1,steel:1},color:"green",cardExtra:""},
"Lichen":{cardNum:"159",type:"proj",tags:["plant"],"cost":"7",resources:{},prod:{plant:1},"req":{"temp":-24},color:"green",cardExtra:""},
"PowerSupplyConsortium":{cardNum:"160",type:"proj",tags:["power"], "cost":"5",resources:{},prod:{energy:1},"req":{energy:2},"reduce":{energy:1},color:"green",cardExtra:""},
"ConvoyFromEuropa":{cardNum:"161",type:"proj",tags:["space"],tags:["event"],"cost":"15",resources:{ocean:1,card:1},prod:{},color:"red",cardExtra:""},
"ImportedGHG":{cardNum:"162",type:"proj",tags:["earth","space","event"],"cost":"7",resources:{heat:3},prod:{heat:1},color:"red",cardExtra:""},
"ImportedNitrogen":{cardNum:"163",type:"proj",tags:["earth","space","event"],"cost":"23",resources:{tr:1,plant:4},prod:{},color:"red",cardExtra:"Gain Microbe* 3\nGain Animal* 2\n(Add 3 Microbes to ANOTHER card and 2 Animals to ANOTHER card.)"},
"MicroMills":{cardNum:"164",type:"proj","cost":"3",resources:{},prod:{heat:1},color:"green",cardExtra:""},
"MagneticFieldGenerators":{cardNum:"165",type:"proj",tags:["building"], "cost":"20",resources:{tr:3},prod:{"energy":-4,plant:2},color:"green",cardExtra:""},
"Shuttles":{cardNum:"166",type:"proj",tags:["space"], "cost":"10",resources:{},prod:{"energy":-1,mc:2},"req":{o2:5},vp:1,color:"blue",discount:{space:2},cardExtra:""},
"ImportOfAdvancedGHG":{cardNum:"167",type:"proj",tags:["earth","space","event"],"cost":"9",resources:{},prod:{heat:2},color:"red",cardExtra:""},
"Windmills":{cardNum:"168",type:"proj",tags:["power","building"],"cost":"6",resources:{},prod:{energy:1},"req":{o2:7},vp:1,color:"green",cardExtra:""},
"TundraFarming":{cardNum:"169",type:"proj",tags:["plant"],"cost":"16",resources:{plant:1},prod:{mc:2,plant:1},"req":{"temp":-6},vp:2,color:"green",cardExtra:""},
"AerobrakedAmmoniaAsteroid":{cardNum:"170",type:"proj",tags:["space"],tags:["event"],"cost":"26",resources:{},prod:{heat:3,plant:1},color:"red",cardExtra:"Microbe* Microbe*\n(Add 2 Microbes to ANOTHER card. Increase your heat production 3 steps and your plant productions 1 step.)"},
"MagneticFieldDome":{cardNum:"171",type:"proj",tags:["building"], "cost":"5",resources:{tr:1},prod:{"energy":-2,plant:1},color:"green",cardExtra:""},
"Pets":{cardNum:"172",type:"proj",tags:["earth"],tags:["animal"],"cost":"10",resources:{},prod:{},color:"blue",cardExtra:"any-City: Animal Resource\nANIMALS MAY NOT BE REMOVED FROM THIS CARD.\n(Effect: When any City tile is placed, add an Animal to this card.)\n------\nAnimal Resource\n(Add 1 Animal to this card. 1 VP per 2 Animals here.)\nVP: 1/2 Animal Resource"},
"ProtectedHabitats":{cardNum:"173",type:"proj","cost":"5",resources:{},prod:{},color:"green",cardExtra:"OPPONENTS MAY NOT REMOVE YOUR\nplant Animal Microbe"},
"ProtectedValley":{cardNum:"174",type:"proj",tags:["plant","building"],"cost":"23",resources:{greenery:1},prod:{mc:2},color:"green",cardExtra:"(Place on a greenery tile ON AN AREA RESERVED FOR OCEAN, disregarding normal placement restrictions, and increase oxygen 1 step.)"},
"Satellites":{cardNum:"175",type:"proj",tags:["space"], "cost":"10",resources:{},prod:{mc:1},color:"green",cardExtra:"/Space.\n(Increase your mc production 1 step for each Space tag you have, including this.)"},
"NoctisFarming":{cardNum:"176",type:"proj",tags:["plant","building"],"cost":"10",resources:{plant:2},prod:{mc:1,},"req":{"temp":-20},vp:1,color:"green",cardExtra:""},
"WaterSplittingPlant":{cardNum:"177",type:"proj",tags:["building"], "cost":"12",resources:{},prod:{},"req":{ocean:2},color:"blue",cardExtra:"energy energy energy -> O2\n(Action: Spend 3 energy to raise oxygen 1 step.)\n------\n(Requires 2 ocean tiles.)"},
"HeatTrappers":{cardNum:"178",type:"proj",tags:["power","building"],"cost":"6",resources:{},prod:{energy:1},"vp":-1,"reduce":{heat:2},color:"green",cardExtra:" "},
"SoilFactory":{cardNum:"179",type:"proj",tags:["building"], "cost":"9",resources:{},prod:{"energy":-1,plant:1},vp:1,color:"green",cardExtra:""},
"FuelFactory":{cardNum:"180",type:"proj",tags:["building"], "cost":"6",resources:{},prod:{"energy":-1,mc:1,energy:1,ti:1},color:"green",cardExtra:""},
"IceCapMelting":{cardNum:"181",type:"proj",tags:["event"],"cost":"5",resources:{ocean:1},prod:{},"req":{temp:2},color:"red",cardExtra:""},
"CorporateStronghold":{cardNum:"182",type:"proj",tags:["city","building"],"cost":"11",resources:{city:1},prod:{"energy":-1,mc:3,energy:1},"vp":-2,color:"green",cardExtra:""},
"BiomassCombustors":{cardNum:"183",type:"proj",tags:["power","building"],"cost":"4",resources:{},prod:{energy:2},"req":{o2:6},"vp":-1,"reduce":{plant:1},color:"green",cardExtra:""},
"Livestock":{cardNum:"184",type:"proj",tags:["animal"],"cost":"13",resources:{},prod:{mc:2,},"req":{o2:9},color:"blue",cardExtra:"-> Animal\n(Action: Add 1 Animal to this card.)\n------\nReduce plant 1\n(Requires 9% oxygen. Decrease your plant production 1 step and increase your mc production 2 steps. 1 VP for each Animal on this card.\nVP: 1/Animal"},
"OlympusConference":{cardNum:"185",type:"proj",tags:["science"],tags:["earth","building"],"cost":"10",resources:{},prod:{},color:"blue",cardExtra:"Science: Science Resource OR -Science Resource +Card\n(When you play a Science tag, including this, either add a Science resource to this card, or remove a Science resource from this card to draw a card.)\n------\nVP: 1\n--- Ed. note: This should likely say .Effect:. on the card."},
"RadSuits":{cardNum:"186",type:"proj","cost":"6",resources:{},prod:{mc:1},"req":{city:2},vp:1,color:"green",cardExtra:""},
"AquiferPumping":{cardNum:"187",type:"proj",tags:["building"], "cost":"18",resources:{},prod:{},color:"blue",cardExtra:"8 mc (steel) -> Ocean Tile\n(Action: Spend 8 mc to place 1 ocean tile. STEEL MAY BE USED as if you were playing a Building card.)"},
"Flooding":{cardNum:"188",type:"proj",tags:["event"],"cost":"7",resources:{ocean:1},prod:{},"vp":-1,color:"red",cardExtra:"-4 mc*\n(IF THERE ARE TILES ADJACENT TO THIS OCEAN TILE, YOU MAY REMOVE 4 mc FROM THE OWNER OF ONE OF THOSE TILES.)\n"},
"EnergySaving":{cardNum:"189",type:"proj",tags:["power"], "cost":"15",resources:{},prod:{},color:"green",cardExtra:"Increase energy/City*\n(Increase your energy production 1 step for each City tile in play.)"},
"LocalHeatTrapping":{cardNum:"190",type:"proj",tags:["event"],"cost":"1",resources:{},prod:{},color:"red",cardExtra:"-5 heat +4 plant OR +2 Animal* Resource\n(Spend 5 heat to gain either 4 plants, or to add 2 Animals to ANOTHER card.)"},
"PermafrostExtraction":{cardNum:"191",type:"proj",tags:["event"],"cost":"8",resources:{ocean:1},prod:{},"req":{"temp":-8},color:"red",cardExtra:""},
"InventionContest":{cardNum:"192",type:"proj",tags:["science"],tags:["event"],"cost":"2",resources:{},prod:{},color:"red",cardExtra:"LOOK AT THE TOP 3 CARDS FROM THE DECK. TAKE 1 OF THEM INTO HAND AND DISCARD THE OTHER 2"},
"Plantation":{cardNum:"193",type:"proj",tags:["plant"],"cost":"15",resources:{greenery:1},prod:{},"req":{science:2},color:"green",cardExtra:""},
"PowerInfrastructure":{cardNum:"194",type:"proj",tags:["power","building"],"cost":"4",resources:{},prod:{},color:"blue",cardExtra:"X energy -> X mc\n(Action: Spend any amount of energy and gain that amount of mc.)"},
"IndenturedWorkers":{cardNum:"195",type:"proj",tags:["event"],"cost":"0",resources:{},prod:{},"vp":-1,color:"red",cardExtra:"NEXT CARD: -8 mc\n(The next card you play this generation costs 8 mc less.)\n"},
"LagrangeObservatory":{cardNum:"196",type:"proj",tags:["science","space"],"cost":"9",resources:{card:1},prod:{},vp:1,color:"green",cardExtra:""},
"TerraformingGanymede":{cardNum:"197",type:"proj",tags:["jovian","space"],"cost":"33",resources:{},prod:{},vp:2,color:"green",cardExtra:"TR/Jovian\n(Raise your TR 1 step for each Jovian tag you have, including this.)\n"},
"ImmigrationShuttles":{cardNum:"198",type:"proj",tags:["earth","space"],"cost":"31",resources:{},prod:{mc:5,},color:"green",cardExtra:"(1 VP for every 3rd City in play.)\nVP: 1/3 City"},
"RestrictedArea":{cardNum:"199",type:"proj",tags:["science"], "cost":"11",resources:{},prod:{},color:"blue",cardExtra:"2 mc -> +Card\n(Action: Spend 2 mc to draw a card.)\n------\nSpecial Tile\n(Place this tile.)"},
"ImmigrantCity":{cardNum:"200",type:"proj",tags:["city","building"],"cost":"13",resources:{city:1},prod:{"energy":-1,mc:2},color:"blue",cardExtra:"City*: mc:1\n(Effect: Each time a City tile is placed, including this, increase your mc production 1 step.)\n------\n( and decrease your mc production 2 steps. Place a City tile.)"},
"EnergyTapping":{cardNum:"201",type:"proj",tags:["power"], "cost":"3",resources:{},prod:{energy:1},"vp":-1,"reduce":{energy:1},color:"green",cardExtra:""},
"UndergroundDetonations":{cardNum:"202",type:"proj",tags:["building"], "cost":"6",resources:{},prod:{},color:"green",cardExtra:"10 mc -> 2 heat Production"},
"Soletta":{cardNum:"203",type:"proj",tags:["space"], "cost":"35",resources:{},prod:{heat:7},color:"green",cardExtra:""},
"TechnologyDemonstration":{cardNum:"204",type:"proj",tags:["science"],tags:["space"],tags:["event"],"cost":"5",resources:{card:2},prod:{},color:"red",cardExtra:""},
"RadChemFactory":{cardNum:"205",type:"proj",tags:["building"], "cost":"8",resources:{tr:2},prod:{"energy":-1,},color:"green",cardExtra:""},
"SpecialDesign":{cardNum:"206",type:"proj",tags:["science"],tags:["event"],"cost":"4",resources:{},prod:{},color:"red",cardExtra:"Requirement: O2/Ocean/Temperature: +/-2\n(The next card you play this generation is +2 or -2 in global requirements, your choice.)"},
"MedicalLab":{cardNum:"207",type:"proj",tags:["science","building"],"cost":"13",resources:{},prod:{},vp:1,color:"green",cardExtra:"Increase mc/2 Building\n(Increase your mc production 1 step for every 2 Building tags you have, including this.)\n"},
"AICentral":{cardNum:"208",type:"proj",tags:["science","building"],"cost":"21",resources:{},prod:{"energy":-1},"req":{science:3},vp:1,color:"blue",cardExtra:"-> +Card +Card\n(Action: Draw 2 cards.)\n------\n(Requires 3 Science tags to play. .)\n"},
"HousePrinting":{cardNum:"P36",type:"proj",tags:["building"], "cost":"10",resources:{},prod:{steel:1},vp:1,color:"green",cardExtra:""},
"LavaTubeSettlement":{cardNum:"P37",type:"proj",tags:["city","building"],"cost":"15",resources:{city:1},prod:{"energy":-1,mc:2,},color:"green",cardExtra:"(Place a City tile ON A VOLCANIC AREA, same as Lava Flows, regardless of adjacent cities.)"},
"MartianSurvey":{cardNum:"P38",type:"proj",tags:["science"],tags:["event"],"cost":"9",resources:{card:2},prod:{},"req":{maxo2:4},vp:1,color:"red",cardExtra:""},
"Psychrophiles":{cardNum:"P39",type:"proj",tags:["microbe"],"cost":"2",resources:{},prod:{},"req":{"maxtemp":-20},color:"blue",cardExtra:"-> Microbe\nplant cards: Microbe = 2mc\n(Action: Add a microbe to this card.\nEffect: When paying for a plant card, microbes here may be used as 2 mc each.)\n------\n(Requires temperature -20 C or colder.)"},
"ResearchCoordination":{cardNum:"P40",type:"proj",tags:["wild"],"cost":"4",resources:{},prod:{},color:"green",cardExtra:""},
"SFMemorial":{cardNum:"P41",type:"proj",tags:["building"], "cost":"7",resources:{card:1},prod:{},vp:1,color:"green",cardExtra:""},
"SpaceHotels":{cardNum:"P42",type:"proj",tags:["earth","space"],"cost":"12",resources:{},prod:{mc:4},"req":{earth:2},color:"green",cardExtra:""},
};
| 185.235507 | 444 | 0.680293 |
014db81d6b0d5687e39d01688fe091bbead9db43 | 246 | js | JavaScript | packages/core/test/common/logger.js | antongolub/common-middlewares | 011d8639eba9e3f520fe54a47fb78b8bebf6287e | [
"MIT"
] | 1 | 2018-11-07T13:38:30.000Z | 2018-11-07T13:38:30.000Z | packages/core/test/common/logger.js | antongolub/common-middlewares | 011d8639eba9e3f520fe54a47fb78b8bebf6287e | [
"MIT"
] | 95 | 2018-11-08T13:02:50.000Z | 2022-03-18T15:39:33.000Z | packages/core/test/common/logger.js | antongolub/common-middlewares | 011d8639eba9e3f520fe54a47fb78b8bebf6287e | [
"MIT"
] | 2 | 2020-10-19T20:36:29.000Z | 2021-11-24T23:03:27.000Z | import logger from '../../src/common/logger'
describe('common/logger', () => {
it('exposes standard console', () => {
['info', 'warn', 'error', 'debug'].forEach(method => {
expect(logger[method]).toBe(console[method])
})
})
})
| 24.6 | 58 | 0.573171 |
015028601117d98a32c9360e0da1622f939011ea | 2,126 | js | JavaScript | App.js | Sudo-Aryan/Safe-Fi | 797d784975de25c96dc62740ebc7d040bc093049 | [
"MIT"
] | 3 | 2021-11-14T05:47:44.000Z | 2021-11-14T07:48:37.000Z | App.js | Sudo-Aryan/Safe-Fi | 797d784975de25c96dc62740ebc7d040bc093049 | [
"MIT"
] | null | null | null | App.js | Sudo-Aryan/Safe-Fi | 797d784975de25c96dc62740ebc7d040bc093049 | [
"MIT"
] | null | null | null | window.addEventListener("load", () => {
let long;
let lat;
let tempretureDegree = document.querySelector('.tempreture-degree');
let tempretureLocation = document.querySelector('.tempreture-location');
let tempretureDescription = document.querySelector('.tempreture-description');
let death = document.querySelector('.death-count');
let recovered = document.querySelector('.recovered-count');
let date = document.querySelector('.date-updated');
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(position => {
long = position.coords.longitude;
lat = position.coords.latitude;
const api = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&appid=45028a535ec41a756e2d679a2331062b`;
fetch(api)
.then(response => {
return response.json();
})
.then(data => {
console.log(data);
const {temp} = data.main;
const {name} = data;
const {description} = data.weather[0];
// set dom elements from the api
tempretureDegree.textContent = Math.floor(parseInt(temp)-273.15);
tempretureLocation.textContent = name;
tempretureDescription.textContent = description;
});
const api2 = `https://covid19.mathdro.id/api/countries/India`;
fetch(api2)
.then(response => {
return response.json();
})
.then(data => {
console.log(data);
const value1 = data.deaths.value;
death.textContent = value1;
const {value} = data.recovered;
recovered.textContent = value;
const {lastUpdate} = data;
date.textContent = lastUpdate.substring(0,10);
});
});
}
}); | 37.964286 | 137 | 0.514111 |
0152556fb991c543e975c3e7f33a0cc32e320232 | 517 | js | JavaScript | src/template/routes.js | cforclown/CLDashboard | 28eb6e8bc64db6158cc5dc71246fd0041e76b81f | [
"MIT"
] | null | null | null | src/template/routes.js | cforclown/CLDashboard | 28eb6e8bc64db6158cc5dc71246fd0041e76b81f | [
"MIT"
] | null | null | null | src/template/routes.js | cforclown/CLDashboard | 28eb6e8bc64db6158cc5dc71246fd0041e76b81f | [
"MIT"
] | null | null | null | import React from 'react'
const Dashboard = React.lazy(() => import('../views/dashboard'));
const Siswa = React.lazy(() => import('../views/siswa'));
const TahunPelajaran = React.lazy(() => import('../views/tahun-pelajaran'));
const routes = [
{ path: '/', exact: true, name: 'Dashboard', component: Dashboard, },
{ path: '/tahun-pelajaran', exact: true, name: 'Tahun Pelajaran', component: TahunPelajaran, },
{ path: '/siswa', exact: true, name: 'Siswa', component: Siswa, },
];
export default routes; | 39.769231 | 99 | 0.646035 |
0152bd02bf6316924d0eea44de3c14250fe8ff96 | 1,542 | js | JavaScript | public/assets/frontend/js/custom.js | shamimtpi/CHAMBER | db9b0468fa6a4f35225827d94b0ff13755d8295f | [
"MIT"
] | null | null | null | public/assets/frontend/js/custom.js | shamimtpi/CHAMBER | db9b0468fa6a4f35225827d94b0ff13755d8295f | [
"MIT"
] | null | null | null | public/assets/frontend/js/custom.js | shamimtpi/CHAMBER | db9b0468fa6a4f35225827d94b0ff13755d8295f | [
"MIT"
] | null | null | null |
// 9. Gallery Slider
$('.gellary-slider').owlCarousel({
responsiveClass:true,
margin:30,
dots: true,
autoWidth:false,
autoplay:true,
autoplayTimeout: 3000,
autoplayStopOnLast: false,
responsive:{
0:{
items:1
},
600:{
items:2
},
800:{
items:2
},
1200:{
items:3
}
}
});
// 9. Gallery Slider
$('.event-slider').owlCarousel({
responsiveClass:true,
margin:30,
dots: true,
autoWidth:false,
autoplay:true,
autoplayTimeout: 3000,
autoplayStopOnLast: false,
responsive:{
0:{
items:1
},
600:{
items:2
},
800:{
items:2
},
1200:{
items:3
}
}
});
// 9. client slider
$('.client-slider').owlCarousel({
responsiveClass:true,
margin:30,
dots: false,
autoWidth:false,
autoplay:true,
autoplayTimeout: 3000,
autoplayStopOnLast: false,
responsive:{
0:{
items:2
},
600:{
items:3
},
800:{
items:4
},
1200:{
items:5
}
}
});
| 20.025974 | 38 | 0.359922 |
0153cb58e1bf320b56e3c1c54643cc3ad10e5f1a | 197 | js | JavaScript | client/js/AppDispatcher.js | ruippeixotog/botarena | 0c4ad0f1298c64a220744297715f27fc2b567290 | [
"MIT"
] | 1 | 2015-10-05T23:57:35.000Z | 2015-10-05T23:57:35.000Z | client/js/AppDispatcher.js | ruippeixotog/botarena | 0c4ad0f1298c64a220744297715f27fc2b567290 | [
"MIT"
] | null | null | null | client/js/AppDispatcher.js | ruippeixotog/botarena | 0c4ad0f1298c64a220744297715f27fc2b567290 | [
"MIT"
] | null | null | null | import { Dispatcher } from "flux";
let dispatcher = new Dispatcher();
dispatcher.dispatchNext = function (obj) {
setTimeout(() => { dispatcher.dispatch(obj); });
};
export default dispatcher;
| 19.7 | 50 | 0.695431 |
0153e7ae3eb78633011ed9e801bb24d9c0dee8bd | 1,187 | js | JavaScript | js/project/filter/filter_implicity_functions.js | AmandaCleto/courses | 036f0d58c6f1ccfcefe4d18c1db35e24f6124256 | [
"MIT"
] | 1 | 2021-11-27T19:53:13.000Z | 2021-11-27T19:53:13.000Z | js/project/filter/filter_implicity_functions.js | AmandaCleto/cod3r--javascript-funcional-e-reativo-pense-como-um-desenvolvedor-javascript | 036f0d58c6f1ccfcefe4d18c1db35e24f6124256 | [
"MIT"
] | null | null | null | js/project/filter/filter_implicity_functions.js | AmandaCleto/cod3r--javascript-funcional-e-reativo-pense-como-um-desenvolvedor-javascript | 036f0d58c6f1ccfcefe4d18c1db35e24f6124256 | [
"MIT"
] | null | null | null | const path = require("path");
const fn = require("./implicity_functions");
const caminho = path.join(__dirname, "../", "/data");
const simbolos = [
'.', '?', '-', ',', '"', '♪', '_', '<i>', '</i>',
'\r', '[', ']', '(', ')',
]
function agruparPalavras(palavras) {
return Object.values(palavras.reduce((acc, palavra) => {
const palavraMinuscula = palavra.toLowerCase();
const quantidade = acc[palavraMinuscula] ? acc[palavraMinuscula].quantidade + 1: 1;
acc[palavraMinuscula] = {
palavra: palavraMinuscula,
quantidade,
}
return acc;
}, {}));
}
fn.lerDiretorio(caminho)
.then(fn.filtrarElementosTerminadosCom(".srt"))
.then(fn.lerArquivos)
.then(fn.mesclarElementos)
.then(fn.separarTextoPor('\n'))
.then(fn.removerSeVazio)
.then(fn.removerSeIncluir('-->'))
.then(fn.removerSeApenasNumero)
.then(fn.removerSimbolos(simbolos))
.then(fn.mesclarElementos)
.then(fn.separarTextoPor(' '))
.then(fn.removerSeVazio)
.then(fn.removerSeApenasNumero)
.then(agruparPalavras)
.then(fn.ordernarAtributoNumerico('quantidade', 'descendente'))
.then(console.log);
| 30.435897 | 91 | 0.617523 |
0154104f5d102337ab55d7062154a4be0bdcf697 | 1,690 | js | JavaScript | gatsby-config.js | nikhilasrani/blog | 410409c0868ab6b28c35d3ca200c64fd7a978633 | [
"MIT"
] | null | null | null | gatsby-config.js | nikhilasrani/blog | 410409c0868ab6b28c35d3ca200c64fd7a978633 | [
"MIT"
] | 7 | 2021-03-09T01:06:03.000Z | 2022-02-17T20:17:22.000Z | gatsby-config.js | nikhilasrani/blog | 410409c0868ab6b28c35d3ca200c64fd7a978633 | [
"MIT"
] | null | null | null | module.exports = {
siteMetadata: {
title: `Nikhil Asrani`,
description: `I am a Frontend Developer based in Bangalore, India. This website is a portfolio of my work`,
author: `Nikhil Asrani`,
},
plugins: [
{
resolve: "gatsby-plugin-google-analytics",
options: {
trackingId: "UA-136692219-1",
},
},
"gatsby-plugin-emotion",
"gatsby-plugin-react-helmet",
"gatsby-transformer-remark",
"gatsby-plugin-catch-links",
{
resolve: "gatsby-source-filesystem",
options: {
name: "pages",
path: `${__dirname}/src/pages`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
"gatsby-transformer-sharp",
"gatsby-plugin-sharp",
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#000000`,
theme_color: `#000000`,
display: `minimal-ui`,
icon: `src/images/favicon/favicon-32x32.png`, // This path is relative to the root of the site.
},
},
{
resolve: `gatsby-plugin-prefetch-google-fonts`,
options: {
fonts: [
{
family: `Montserrat`,
},
{
family: `Source Sans Pro`,
},
{
family: `Space Mono`,
},
],
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.app/offline
// 'gatsby-plugin-offline',
],
}
| 24.852941 | 111 | 0.533728 |
0154eaa7e90e2b49adbb678ec1ab8c3548b4bb1d | 157 | js | JavaScript | demos/node_modules/vbjs/dist/1.3.5/min/extensions/HTMLElement/overflownY.js | vbilopav/vbjs | c4c7676200996c60dcd723184a68db4e0e816dea | [
"MIT"
] | 9 | 2018-09-03T11:08:37.000Z | 2021-12-06T21:43:14.000Z | demos/node_modules/vbjs/dist/1.3.5/min/extensions/HTMLElement/overflownY.js | vbilopav/vbjs | c4c7676200996c60dcd723184a68db4e0e816dea | [
"MIT"
] | 4 | 2018-09-03T14:55:01.000Z | 2018-09-05T03:52:47.000Z | src/vbjs/dist/1.3.5/min/extensions/HTMLElement/overflownY.js | vbilopav/vbjs | c4c7676200996c60dcd723184a68db4e0e816dea | [
"MIT"
] | 1 | 2020-12-07T18:30:47.000Z | 2020-12-07T18:30:47.000Z | define(["sys/models/test-proto"],e=>{e(HTMLElement,["overflownY"]),HTMLElement.prototype.overflownY=function(){return this.scrollHeight>this.clientHeight}}); | 157 | 157 | 0.783439 |
015be7213185d3ceea265beb6a836aea0739c5bc | 1,871 | js | JavaScript | frontend/src/store/index.js | Maqomed/coding-challenge-frontend | 96c35b687a7bea76d34f8f3ab8f34dee4bc8d703 | [
"MIT"
] | null | null | null | frontend/src/store/index.js | Maqomed/coding-challenge-frontend | 96c35b687a7bea76d34f8f3ab8f34dee4bc8d703 | [
"MIT"
] | null | null | null | frontend/src/store/index.js | Maqomed/coding-challenge-frontend | 96c35b687a7bea76d34f8f3ab8f34dee4bc8d703 | [
"MIT"
] | null | null | null | import axios from 'axios'
import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex);
let BASE_URL = process.env.BASE_URL
//to handle state
const state = {
agents: [],
logs: [],
resolutions: [],
loadStatus: true
}
//to handle state
const getters = {}
//to handle actions
const actions = {
getAllData({commit}) {
commit('SET_LOAD_STATUS', true);
Promise.all([
axios.get(BASE_URL + 'agents').then((response) => response.data),
axios.get(BASE_URL + 'logs').then((response) => response.data),
axios.get(BASE_URL + 'resolutions').then((response) => response.data)
]).then(([agents, logs, resolutions]) => {
commit('SET_AGENTS', agents);
commit('SET_LOGS', logs);
commit('SET_RESOLUTIONS', resolutions);
commit('SET_LOAD_STATUS', false);
});
},
getAgents({ commit }) {
axios.get(BASE_URL + 'agents')
.then(response => {
commit('SET_AGENTS', response.data)
})
},
getLogs({ commit }) {
axios.get(BASE_URL + 'logs')
.then(response => {
commit('SET_LOGS', response.data)
})
},
getResolutions({ commit }) {
axios.get(BASE_URL + 'resolutions')
.then(response => {
commit('SET_RESOLUTIONS', response.data)
})
}
}
//to handle mutations
const mutations = {
SET_AGENTS(state, agents) {
state.agents = agents
},
SET_LOGS(state, logs) {
state.logs = logs
},
SET_RESOLUTIONS(state, resolutions) {
state.resolutions = resolutions
},
SET_LOAD_STATUS(state, loadStatus) {
state.loadStatus = loadStatus
}
}
//export store module
export default new Vuex.Store({
state,
getters,
actions,
mutations
}) | 24.298701 | 81 | 0.555852 |
015c0cc457d98b1811142a1b89bca43a0da50818 | 8,368 | js | JavaScript | src/main/webapp/widgets/RelatedTableCharts/setting/LayerChooser.js | emkgth/clean-water | d333aae1487fd7b620521038acee4590801f2c45 | [
"Apache-2.0"
] | null | null | null | src/main/webapp/widgets/RelatedTableCharts/setting/LayerChooser.js | emkgth/clean-water | d333aae1487fd7b620521038acee4590801f2c45 | [
"Apache-2.0"
] | null | null | null | src/main/webapp/widgets/RelatedTableCharts/setting/LayerChooser.js | emkgth/clean-water | d333aae1487fd7b620521038acee4590801f2c45 | [
"Apache-2.0"
] | null | null | null | // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.15/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.
//>>built
require({cache:{"url:widgets/RelatedTableCharts/setting/LayerChooser.html":'\x3cdiv style\x3d"width: 100%; height: 100%;"\x3e\r\n \x3cdiv class\x3d"esriCTLayerSelectorDiv"\x3e\r\n \x3cdiv class\x3d"esriCTLayerChooserContainer row"\x3e\r\n \x3cdiv class\x3d"esriCTlabel esriCTLabelContainer" title\x3d"${nls.layerChooser.selectPolygonLayerLabel}"\x3e\r\n ${nls.layerChooser.selectPolygonLayerLabel}\r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"esriCTLayerField"\x3e\r\n \x3cdiv data-dojo-attach-point\x3d"itemSelectDiv"\x3e\r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"esriCTHint"\x3e\r\n ${nls.layerChooser.selectPolygonLayerHintText}\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"esriCTLayerChooserContainer row"\x3e\r\n \x3cdiv class\x3d"esriCTlabel esriCTLabelContainer" title\x3d"${nls.layerChooser.selectRelatedTableLayerLabel}"\x3e\r\n ${nls.layerChooser.selectRelatedTableLayerLabel}\r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"esriCTLayerField"\x3e\r\n \x3cselect data-dojo-attach-point\x3d"relationshipSelect" style\x3d"width: 232px;" data-dojo-type\x3d"dijit/form/Select"\x3e\r\n \x3c/select\x3e\r\n \x3cdiv class\x3d"esriCTHint"\x3e\r\n ${nls.layerChooser.selectRelatedTableLayerHintText}\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3cdiv data-dojo-attach-point\x3d"buttonsDiv" class\x3d"buttonsDiv"\x3e\r\n \x3cdiv class\x3d"button-container button-container-absolute" style\x3d"padding: 0px;"\x3e\r\n \x3cdiv class\x3d"jimu-btn jimu-float-trailing jimu-leading-margin1 jimu-state-disabled"\r\n data-dojo-attach-point\x3d"okButton" tabindex\x3d"0"\x3e\r\n ${nls.ok}\x3c/div\x3e\r\n \x3cdiv class\x3d"jimu-btn jimu-float-trailing jimu-leading-margin1" data-dojo-attach-point\x3d"cancelButton" tabindex\x3d"0"\x3e\r\n ${nls.cancel}\x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n\x3c/div\x3e\r\n'}});
define("dojo/_base/declare jimu/BaseWidgetSetting dijit/_WidgetsInTemplateMixin dojo/_base/lang dojo/_base/array dojo/promise/all dojo/Deferred dojo/on dojo/dom-class dojo/text!./LayerChooser.html jimu/dijit/LayerChooserFromMap jimu/dijit/LayerChooserFromMapWithDropbox esri/request jimu/dijit/Message dojo/domReady!".split(" "),function(p,q,r,e,k,t,u,m,n,v,l,w,x,y){return p([q,r],{baseClass:"jimu-widget-RelatedTableCharts-setting",templateString:v,selectRouteURL:null,agolFlag:!1,serviceFlag:!1,_numberFieldTypes:["esriFieldTypeSmallInteger",
"esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble"],startup:function(){this.inherited(arguments)},postCreate:function(){this._createPolygonChooserArgs();this.own(m(this.cancelButton,"click",e.hitch(this,function(a){this.onCancleClick(a)})));this.own(m(this.okButton,"click",e.hitch(this,this._onOKButtonClicked)))},_getGeometryType:function(a){switch(a){case "esriGeometryPolygon":return"polygon";case "esriGeometryPolyline":return"polyline";case "esriGeometryPoint":return"point";default:return"*"}},
_createPolygonChooserArgs:function(){var a=[];a.push(this.geometryType);a=l.createFeaturelayerFilter(a,!1);var f=l.createQueryableLayerFilter();a={multiple:!1,createMapResponse:this.map.webMapResponse,showLayerTypes:["FeatureLayer"],filter:l.andCombineFilters([a,f])};a=new l(a);a=new w({layerChooser:a});a.placeAt(this.itemSelectDiv);a.startup();this.own(m(a,"selection-change",e.hitch(this,this._createRelatedTableOptions)))},_createRelatedTableOptions:function(a){var f=[];if(a&&0<a.length){this.polygonLayer=
a[0];this.polygonLayerInfo={url:this.polygonLayer.url,geometryType:this._getGeometryType(this.polygonLayer.geometryType),supportsDistinct:!1};this.polygonLayer.advancedQueryCapabilities&&this.polygonLayer.advancedQueryCapabilities.supportsDistinct&&(this.polygonLayerInfo.supportsDistinct=!0);this.polygonLayer.fields&&(this.polygonLayerInfo.fields=e.clone(this.polygonLayer.fields));this.polygonLayerInfo.layerId=this.polygonLayer.layerId?this.polygonLayer.layerId:this.polygonLayer.url.substr(this.polygonLayer.url.lastIndexOf("/")+
1,this.polygonLayer.url.length);var c=this.polygonLayer.url.substr(0,this.polygonLayer.url.lastIndexOf("/")+1);this.polygonLayerInfo.baseURL=c;this.polygonLayerInfo=e.mixin(this.polygonLayerInfo,this._getLayerDetailsFromMap(c,this.polygonLayerInfo.layerId));this.relatedTableInfo=[];var b=[];k.forEach(this.polygonLayer.relationships,e.hitch(this,function(d){var h=new u;b.push(h);x({url:c+d.relatedTableId,content:{f:"json"},handleAs:"json"}).then(e.hitch(this,function(g){h.resolve(g)}),e.hitch(this,
function(){h.resolve()}))}));t(b).then(e.hitch(this,function(d){var h,g;for(g=0;g<d.length;g++)d[g].fields&&(h=k.some(d[g].fields,e.hitch(this,function(z){return 0<=this._numberFieldTypes.indexOf(z.type)})))&&(h={url:c+d[g].id,baseURL:c,relationShipId:this.polygonLayer.relationships[g].id,layerId:d[g].id,title:this.polygonLayer.relationships[g].name},h.fields=e.clone(d[g].fields),h=e.mixin(h,this._getLayerDetailsFromMap(c,d[g].id)),h=e.mixin(h,this._getLayerDetailsFromMapTables(c,d[g].id)),h.title&&
(this.relatedTableInfo[f.length]=h,f.push({label:this.relatedTableInfo[f.length].title,value:f.length})));0<f.length?(this.relationshipSelect.options.length=0,f[0].selected=!0,this.relationshipSelect.addOption(f),n.remove(this.okButton,"jimu-state-disabled")):this._resetRelatedLayerSelector()}),e.hitch(this,function(){this._resetRelatedLayerSelector()}))}else this._resetRelatedLayerSelector()},_resetRelatedLayerSelector:function(){this.relationshipSelect.value="";this.relationshipSelect.options.length=
0;this.relationshipSelect.addOption({value:"",label:"",selected:!0});n.add(this.okButton,"jimu-state-disabled")},_getLayerDetailsFromMap:function(a,f){var c={};this.map&&this.map.webMapResponse&&this.map.webMapResponse.itemInfo&&this.map.webMapResponse.itemInfo.itemData&&this.map.webMapResponse.itemInfo.itemData.operationalLayers&&k.forEach(this.map.webMapResponse.itemInfo.itemData.operationalLayers,e.hitch(this,function(b){b.layerObject&&("ArcGISMapServiceLayer"===b.layerType||"ArcGISTiledMapServiceLayer"===
b.layerType?a.substring(0,a.length-1)===b.url&&(k.forEach(b.resourceInfo.layers,e.hitch(this,function(d){d.id===parseInt(f,10)&&(c.title=d.name)})),k.forEach(b.layers,e.hitch(this,function(d){d.id===parseInt(f,10)&&(d.name&&(c.title=d.name),c.popupInfo=d.popupInfo,d.layerDefinition&&d.layerDefinition.definitionExpression&&(c.definitionExpression=d.layerDefinition.definitionExpression))}))):b.url.replace(/.*?:\/\//g,"")===(a+f).replace(/.*?:\/\//g,"")&&(c.title=b.title,c.popupInfo=b.popupInfo,b.layerDefinition&&
b.layerDefinition.definitionExpression&&(c.definitionExpression=b.layerDefinition.definitionExpression)))}));return c},_getLayerDetailsFromMapTables:function(a,f){var c={};this.map&&this.map.webMapResponse&&this.map.webMapResponse.itemInfo&&this.map.webMapResponse.itemInfo.itemData&&this.map.webMapResponse.itemInfo.itemData.tables&&k.forEach(this.map.webMapResponse.itemInfo.itemData.tables,e.hitch(this,function(b){b.url.replace(/.*?:\/\//g,"")===(a+f).replace(/.*?:\/\//g,"")&&(c.title=b.title,c.popupInfo=
b.popupInfo,b.layerDefinition&&b.layerDefinition.definitionExpression&&(c.definitionExpression=b.layerDefinition.definitionExpression))}));return c},_onOKButtonClicked:function(){if(!n.contains(this.okButton,"jimu-state-disabled"))if(this.polygonLayerInfo){if(""===this.relationshipSelect.value)return this._errorMessage(this.nls.layerChooser.errorInSelectingRelatedLayer),!1;var a={polygonLayerInfo:this.polygonLayerInfo,relatedLayerInfo:this.relatedTableInfo[this.relationshipSelect.value]};this.onOkClick(a)}else return this._errorMessage(this.nls.layerChooser.errorInSelectingPolygonLayer),
!1},_errorMessage:function(a){(new y({message:a})).message=a},onOkClick:function(a){return a},onCancleClick:function(a){return a}})}); | 523 | 2,249 | 0.75239 |
015cc7c6048bc0d1e03bba35542686bb6e3e2899 | 2,692 | js | JavaScript | 45/tests.js | clemenshelm/advent-of-code-2017 | 926afe634194003589a04e34ef9da8d1ac40ec2b | [
"MIT"
] | 3 | 2017-12-01T07:29:52.000Z | 2017-12-11T17:15:02.000Z | 45/tests.js | clemenshelm/adventofcode-2017 | 926afe634194003589a04e34ef9da8d1ac40ec2b | [
"MIT"
] | null | null | null | 45/tests.js | clemenshelm/adventofcode-2017 | 926afe634194003589a04e34ef9da8d1ac40ec2b | [
"MIT"
] | null | null | null | const assert = require('assert');
const processor = require('./processor.js');
describe('executing a number of commands', () => {
it('sets register a to 1', () => {
const proc = processor(['set a 1']);
assert.deepEqual(proc.next().value, { lastCmd: 'set', registers: { a: 1 } });
});
it('subtracts 2 from register a', () => {
const proc = processor(['set a 3', 'sub a 2']);
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'sub', registers: { a: 1 } });
});
it('subtracts 1 from non-existing register a', () => {
const proc = processor(['sub a 1']);
assert.deepEqual(proc.next().value, { lastCmd: 'sub', registers: { a: -1 } });
});
it('multiplies a by 3', () => {
const proc = processor(['set a 2', 'mul a 3']);
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'mul', registers: { a: 6 } });
});
it('squares a', () => {
const proc = processor(['set a 4', 'mul a a']);
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'mul', registers: { a: 16 } });
});
it('multiplies a by a non-existing register', () => {
const proc = processor(['set a 2', 'mul a b']);
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'mul', registers: { a: 0 } });
});
it('sets register b to register a', () => {
const proc = processor(['set a 1', 'set b a']);
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'set', registers: { a: 1, b: 1 } });
});
it('jumps if the register is greater than 0', () => {
const proc = processor(['set a 4', 'sub a 1', 'jnz a -1']);
proc.next();
proc.next();
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'sub', registers: { a: 2 } });
});
it('doesn’t jump if the given register is 0', () => {
const proc = processor(['set a 0', 'jnz a -1', 'set a 1']);
proc.next();
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'set', registers: { a: 1 } });
});
it('jumps if the given register is lower than 0', () => {
const proc = processor(['set a -12', 'jnz a -1', 'set a 1'], 0, [[], []]);
proc.next();
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'set', registers: { a: -12 } });
});
it('jumps if the given number is lower than 0', () => {
const proc = processor(['set a -12', 'jnz -2 -1', 'set a 1'], 0, [[], []]);
proc.next();
proc.next();
assert.deepEqual(proc.next().value, { lastCmd: 'set', registers: { a: -12 } });
});
it('terminates when there are no more instructions', () => {
const proc = processor(['set a 0'], 0, [[], []]);
proc.next();
assert(proc.next().done);
})
});
| 33.65 | 87 | 0.544205 |
015d1e0f58ba842382abdff839838407cabbcc41 | 2,146 | js | JavaScript | src/index.js | slaytr/myWebsite | 6379731ece9ce639e17e0e1ea9b3c3a8900d909b | [
"MIT"
] | 1 | 2021-06-04T00:45:17.000Z | 2021-06-04T00:45:17.000Z | src/index.js | slaytr/myWebsite | 6379731ece9ce639e17e0e1ea9b3c3a8900d909b | [
"MIT"
] | 15 | 2020-09-04T22:16:57.000Z | 2021-05-19T23:32:13.000Z | src/index.js | slaytr/myWebsite | 6379731ece9ce639e17e0e1ea9b3c3a8900d909b | [
"MIT"
] | null | null | null | import React from "react";
import ReactDOM from "react-dom";
import {createBrowserHistory} from "history";
import {Router, Route, Switch} from "react-router-dom";
// import LegendaryCursor from "legendary-cursor";
import "assets/scss/material-kit-react.scss?v=1.10.0";
// pages for this product
import Components from "views/Components/Components.js";
import LandingPage from "views/LandingPage/LandingPage.js";
import ProfilePage from "views/ProfilePage/ProfilePage.js";
import LoginPage from "views/LoginPage/LoginPage.js";
import SolutionsPage from "views/SolutionsPage/SolutionsPage";
import DeepSummaryPage from "views/SolutionsPage/Solutions/DeepSummaryPage";
import OpenSourcePage from "./views/OpenSourcePage/OpenSourcePage";
import NotFoundPage from "./views/NotFoundPage/NotFoundPage";
var hist = createBrowserHistory();
ReactDOM.render(
<Router history={hist}>
<Switch>
<Route exact path="/" component={LandingPage}/>
<Route exact path="/solutions" component={SolutionsPage}/>
<Route exact path="/solutions/deep-summary" component={DeepSummaryPage}/>
<Route exact path="/open-source" component={OpenSourcePage}/>
<Route exact path="/profile-page" component={ProfilePage}/>
<Route exact path="/login-page" component={LoginPage}/>
<Route exact path="/components" component={Components}/>
<Route component={NotFoundPage}/>
</Switch>
</Router>,
document.getElementById("root")
);
// window.addEventListener("load", () => {
// LegendaryCursor.init({
// lineSize: 0.15,
// opacityDecrement: 0.8,
// speedExpFactor: 0.8,
// lineExpFactor: 0.6,
// sparklesCount: 65,
// maxOpacity: 0.90, // should be a number between [0 ... 1]
// // texture1: "http://path_to_texture", // texture displayed on mouse hover
// // texture2: "http://path_to_texture", // texture displayed on mouse click
// // texture3: "http://path_to_texture", // texture displayed on sparkles
// });
// }); | 43.795918 | 98 | 0.654706 |
015d2b6ed1a15ed1fa4daebc52dea112ebd1b201 | 861 | js | JavaScript | assets/docs/search/functions_4.js | tsing-test/jittor-blog | 2583ddc8fd57308c46b2f6437830af01a3b817c7 | [
"MIT"
] | null | null | null | assets/docs/search/functions_4.js | tsing-test/jittor-blog | 2583ddc8fd57308c46b2f6437830af01a3b817c7 | [
"MIT"
] | null | null | null | assets/docs/search/functions_4.js | tsing-test/jittor-blog | 2583ddc8fd57308c46b2f6437830af01a3b817c7 | [
"MIT"
] | null | null | null | var searchData=
[
['reindexop',['ReindexOp',['../structjittor_1_1_reindex_op.html#ac0c65453c2096d16f4c3fe93aa702275',1,'jittor::ReindexOp::ReindexOp(Var *x, NanoVector shape, vector< string > &&indexes, float64 overflow_value=0, vector< string > &&overflow_conditions={}, vector< Var * > &&extras={})'],['../structjittor_1_1_reindex_op.html#a7db48990ab450c4af7b0dfbfb18e5c66',1,'jittor::ReindexOp::ReindexOp(Var *x, vector< Var * > &&indexes, float64 overflow_value=0, vector< string > &&overflow_conditions={})']]],
['reindexreduceop',['ReindexReduceOp',['../structjittor_1_1_reindex_reduce_op.html#a4aa2d854c9fc9c19b84dcbbe2a17d0e4',1,'jittor::ReindexReduceOp']]],
['report',['report',['../structjittor_1_1_profiler.html#aad1bfde642b764c64b2553e327e94fe6',1,'jittor::Profiler']]]
];
| 123 | 570 | 0.754936 |
015db75d766d2f9741a1956703c0e3f1d6fc5ad8 | 1,007 | js | JavaScript | test/angular-tests/test-button.js | noriega3/mui | 9cedd9b2087ba5cd8c69802fd4c0c71ae02ce383 | [
"MIT"
] | 4,354 | 2015-05-10T03:41:54.000Z | 2022-03-25T16:46:58.000Z | test/angular-tests/test-button.js | noriega3/mui | 9cedd9b2087ba5cd8c69802fd4c0c71ae02ce383 | [
"MIT"
] | 304 | 2015-05-10T04:46:01.000Z | 2022-03-24T07:20:07.000Z | test/angular-tests/test-button.js | borisdamevin/mui | 12834583eea2b07dc841b8c676784eb5a1f091c9 | [
"MIT"
] | 611 | 2015-05-10T00:16:04.000Z | 2022-03-10T14:24:37.000Z | /**
* MUI test angular button module
* @module test/angular-tests/test-button
*/
import assert from 'assert';
let helpers = require('./angular-helper'),
ngModule = helpers.module,
inject = helpers.inject,
jqLite = helpers.jqLite;
require('../../src/angular/button.js');
describe('angular/button', function() {
let compile, scope;
beforeEach(function() {
ngModule('mui.button');
inject(function($compile, $rootScope) {
compile = $compile;
scope = $rootScope.$new();
});
});
afterEach(function() {
scope.$destroy();
});
it('renders properly', function() {
let buttonEl = compile('<mui-button>test</mui-button>')(scope)[0];
assert.equal(buttonEl.tagName, 'BUTTON');
assert.equal(jqLite.hasClass(buttonEl, 'mui-btn'), true);
});
it('renders type attribute', function() {
let s = '<mui-button type="button">test</mui-button>';
let element = compile(s)(scope);
assert.equal(element.attr('type'), 'button');
});
});
| 21.425532 | 70 | 0.625621 |
015de2266e8ff694d12e8a7eefdf42af1742e6b6 | 394 | js | JavaScript | src/models/authentication.model.js | mubashirhanif/smart-matching-server | fbe3a7ce09f22a439c680c78b5d926ad76fcb452 | [
"MIT"
] | null | null | null | src/models/authentication.model.js | mubashirhanif/smart-matching-server | fbe3a7ce09f22a439c680c78b5d926ad76fcb452 | [
"MIT"
] | null | null | null | src/models/authentication.model.js | mubashirhanif/smart-matching-server | fbe3a7ce09f22a439c680c78b5d926ad76fcb452 | [
"MIT"
] | null | null | null | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
let authenticationSchema = new Schema({
name: {
type: String,
index: true,
unique: true
},
password: {
type: String
},
token: String,
create_time: Date
}, {
collection: 'authentications'
})
module.exports = mongoose.model('Authentication', authenticationSchema)
| 19.7 | 71 | 0.626904 |
01609c6d0b012c4fac56583a21a7689207f506ae | 429 | js | JavaScript | test/utils.js | boopathi/graphql-schema-linter | 4a0df3ea40831b3826c8c83a921194f2ba4f973a | [
"MIT"
] | null | null | null | test/utils.js | boopathi/graphql-schema-linter | 4a0df3ea40831b3826c8c83a921194f2ba4f973a | [
"MIT"
] | null | null | null | test/utils.js | boopathi/graphql-schema-linter | 4a0df3ea40831b3826c8c83a921194f2ba4f973a | [
"MIT"
] | null | null | null | import { parse } from 'graphql';
import { validate } from 'graphql/validation';
import { buildASTSchema } from 'graphql/utilities/buildASTSchema';
export function validateSchemaString(schemaString, rules) {
const ast = parse(`
type QueryRoot {
a: String
}
${schemaString}
schema {
query: QueryRoot
}
`);
const astSchema = buildASTSchema(ast);
return validate(astSchema, ast, rules);
}
| 20.428571 | 66 | 0.67366 |
0160abdfd060d59f6d6c7d27ee795f790cfc9337 | 286 | js | JavaScript | src/util.js | fossabot/merge | c456ae77536b6846cee19f060a0495b06336ec08 | [
"MIT"
] | 1 | 2019-09-23T07:17:58.000Z | 2019-09-23T07:17:58.000Z | src/util.js | fossabot/merge | c456ae77536b6846cee19f060a0495b06336ec08 | [
"MIT"
] | null | null | null | src/util.js | fossabot/merge | c456ae77536b6846cee19f060a0495b06336ec08 | [
"MIT"
] | 1 | 2019-12-02T07:19:24.000Z | 2019-12-02T07:19:24.000Z | export const isType = type => obj =>
({}.toString.call(obj).toLowerCase() === `[object ${type}]`)
export const isArray = isType('array')
export const isObject = isType('object')
export const isIterable = object =>
object !== null && typeof object[Symbol.iterator] === 'function'
| 28.6 | 66 | 0.667832 |
0160f134dc497870fccb5767103d2ae334a6e13c | 323 | js | JavaScript | crates/swc/tests/tsc-references/classAbstractAsIdentifier_es5.1.normal.js | fireairforce/swc | 06c1b3ecb558527aef81da1cbfca756fbc495553 | [
"Apache-2.0"
] | 1 | 2022-03-25T05:35:24.000Z | 2022-03-25T05:35:24.000Z | crates/swc/tests/tsc-references/classAbstractAsIdentifier_es5.1.normal.js | fireairforce/swc | 06c1b3ecb558527aef81da1cbfca756fbc495553 | [
"Apache-2.0"
] | null | null | null | crates/swc/tests/tsc-references/classAbstractAsIdentifier_es5.1.normal.js | fireairforce/swc | 06c1b3ecb558527aef81da1cbfca756fbc495553 | [
"Apache-2.0"
] | null | null | null | import * as swcHelpers from "@swc/helpers";
var abstract = /*#__PURE__*/ function() {
"use strict";
function abstract() {
swcHelpers.classCallCheck(this, abstract);
}
var _proto = abstract.prototype;
_proto.foo = function foo() {
return 1;
};
return abstract;
}();
new abstract;
| 23.071429 | 50 | 0.613003 |
016174e84543f238d29115b0dd725ded304738ff | 549 | js | JavaScript | app/components/create-session-message.js | ani4aniket/open-event-frontend | 45018cf3a164deb9d6581a40f94250296e08ea78 | [
"Apache-2.0"
] | 3 | 2020-05-08T18:29:51.000Z | 2020-11-21T11:59:42.000Z | app/components/create-session-message.js | aknrg77/open-event-frontend | 07e9f3b419d32f59507d08eeeb755b25439c7d6f | [
"Apache-2.0"
] | 1 | 2019-10-15T20:46:15.000Z | 2019-10-15T20:46:15.000Z | app/components/create-session-message.js | aknrg77/open-event-frontend | 07e9f3b419d32f59507d08eeeb755b25439c7d6f | [
"Apache-2.0"
] | 1 | 2019-12-17T07:16:21.000Z | 2019-12-17T07:16:21.000Z | import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
isMessageVisible : true,
shouldShowMessage : computed('session.isAuthenticated', 'isMessageVisible', 'isNewSpeaker', 'isNewSession', function() {
let speakerIDlength = this.data.userSpeaker ? this.data.userSpeaker.toArray().length : 0;
return this.session.isAuthenticated
&& this.isMessageVisible
&& !this.isNewSpeaker
&& this.isNewSession
&& (speakerIDlength > 0);
})
});
| 34.3125 | 122 | 0.68306 |
0161b65e6503f0f602323090a1d8bbe372d64a8e | 4,143 | js | JavaScript | node/tempHire/client/app/model/modelBuilder.js | Breeze/breeze.js.samples | de6a267fdca4b0b8c17f8040138d275a64d6dc37 | [
"MIT"
] | 65 | 2015-01-03T16:16:18.000Z | 2021-05-08T09:01:54.000Z | net/TempHire-Angular/TempHire/App/model/modelBuilder.js | Breeze/breeze.js.samples | de6a267fdca4b0b8c17f8040138d275a64d6dc37 | [
"MIT"
] | 15 | 2015-01-03T18:28:12.000Z | 2020-11-07T09:40:43.000Z | node/tempHire/client/app/model/modelBuilder.js | Breeze/breeze.js.samples | de6a267fdca4b0b8c17f8040138d275a64d6dc37 | [
"MIT"
] | 78 | 2015-01-19T23:45:37.000Z | 2020-05-25T13:39:33.000Z | (function(angular) {
'use strict';
var model = angular.module('model', []);
model.factory('modelBuilder', [factory]);
function factory() {
var self = {
extendMetadata: extendMetadata
};
return self;
function extendMetadata(metadataStore) {
extendStaffingResource(metadataStore);
extendAddress(metadataStore);
extendPhoneNumber(metadataStore);
}
function extendStaffingResource(metadataStore) {
var staffingResourceCtor = function () {
this.id = breeze.core.getUuid();
};
staffingResourceCtor.prototype.addAddress = function (typeId) {
return this.entityAspect.entityManager.createEntity('Address', { addressTypeId: typeId, staffingResourceId: this.id });
};
staffingResourceCtor.prototype.addPhoneNumber = function (typeId) {
return this.entityAspect.entityManager.createEntity('PhoneNumber', { phoneNumberTypeId: typeId, staffingResourceId: this.id });
};
staffingResourceCtor.prototype.deletePhoneNumber = function (phoneNumber) {
ensureEntityType(phoneNumber, 'PhoneNumber');
this.throwIfNotOwnerOf(phoneNumber);
phoneNumber.entityAspect.setDeleted();
};
staffingResourceCtor.prototype.setPrimaryPhoneNumber = function (phoneNumber) {
ensureEntityType(phoneNumber, 'PhoneNumber');
this.throwIfNotOwnerOf(phoneNumber);
this.phoneNumbers.forEach(function (x) {
x.primary = false;
});
phoneNumber.primary = true;
};
staffingResourceCtor.prototype.deleteAddress = function (address) {
ensureEntityType(address, 'Address');
this.throwIfNotOwnerOf(address);
address.entityAspect.setDeleted();
};
staffingResourceCtor.prototype.setPrimaryAddress = function (address) {
ensureEntityType(address, 'Address');
this.throwIfNotOwnerOf(address);
this.addresses.forEach(function (x) {
x.primary = false;
});
address.primary = true;
};
staffingResourceCtor.prototype.throwIfNotOwnerOf = function (obj) {
if (!obj.staffingResourceId || obj.staffingResourceId !== this.id) {
throw new Error('Object is not associated with current StaffingResource');
}
};
var staffingResourceInitializer = function (staffingResource) {
Object.defineProperty(staffingResourceCtor.prototype, 'fullName', {
enumerable: true,
configurable: true,
get: function() {
if (this.middleName) {
return this.firstName + ' ' + this.middleName + ' ' + this.lastName;
}
return this.firstName + ' ' + this.lastName;
}
});
};
metadataStore.registerEntityTypeCtor('StaffingResource', staffingResourceCtor, staffingResourceInitializer);
}
function extendAddress(metadataStore) {
var addressCtor = function () {
this.id = breeze.core.getUuid();
};
metadataStore.registerEntityTypeCtor('Address', addressCtor);
}
function extendPhoneNumber(metadataStore) {
var phoneNumberCtor = function () {
this.id = breeze.core.getUuid();
};
metadataStore.registerEntityTypeCtor('PhoneNumber', phoneNumberCtor);
}
function ensureEntityType(obj, entityTypeName) {
if (!obj.entityType || obj.entityType.shortName !== entityTypeName) {
throw new Error('Object must be an entity of type ' + entityTypeName);
}
}
}
})(window.angular); | 36.026087 | 143 | 0.560222 |
0162676c7a362f36a3782aa2d15dc53f5bafa6de | 3,961 | js | JavaScript | dist/spec/overlays.spec.js | curveship/room-of-requirement | b94c279d1178099421f21d8a587bbad4ab0bed4a | [
"MIT"
] | null | null | null | dist/spec/overlays.spec.js | curveship/room-of-requirement | b94c279d1178099421f21d8a587bbad4ab0bed4a | [
"MIT"
] | null | null | null | dist/spec/overlays.spec.js | curveship/room-of-requirement | b94c279d1178099421f21d8a587bbad4ab0bed4a | [
"MIT"
] | null | null | null | "use strict";
const room_of_requirement_1 = require('../room-of-requirement');
describe("overlays", function () {
it("should extend dependency network with new values", function () {
var deps = room_of_requirement_1.root({});
expect(() => deps.foo).toThrowError(/foo/);
deps = deps({ foo: _ => 1 });
expect(deps.foo).toEqual(1);
});
it("should use last defined rule", function () {
var deps = room_of_requirement_1.root({
foo: () => 1,
})({
foo: () => 2
});
expect(deps.foo).toEqual(2);
});
it("should use earlier rules if they're the latest", function () {
var deps = room_of_requirement_1.root({
foo: () => 1,
})({
foo: () => 2
})({
bar: () => 3
});
expect(deps.foo).toEqual(2);
});
it("should use last nested rule", function () {
var deps = room_of_requirement_1.root({
foo: {
bar: () => 1
}
})({
foo: {
bar: () => 2
}
});
expect(deps.foo.bar).toEqual(2);
});
it("should use earlier nested rules if they're the latest", function () {
var deps = room_of_requirement_1.root({
foo: {
bar: () => 1
}
})({
foo: {
bleck: () => 2
}
});
expect(deps.foo.bar).toEqual(1);
});
it("should not leak definitions to earlier caches", function () {
var deps1 = room_of_requirement_1.root({
foo: () => 1
}), deps2 = deps1({
bar: () => 2
});
expect(deps2.bar).toEqual(2);
expect(() => deps1.bar).toThrowError(/bar/);
});
it("should not leak definitions to sibling caches", function () {
var deps1 = room_of_requirement_1.root({
foo: () => 1
}), deps2 = deps1({
bar: () => 2
}), deps3 = deps1({
bleck: () => 3
});
expect(deps2.bar).toEqual(2);
expect(() => deps3.bar).toThrowError(/bar/);
});
it("should throw if new values shadow namespaces", function () {
var deps = room_of_requirement_1.root({
foo: {
bar: () => 1
}
});
expect(() => deps({ foo: _ => 1 })).toThrowError(/shadow/);
});
it("should throw if new namespaces shadow values", function () {
var deps = room_of_requirement_1.root({
foo: () => 1
});
expect(() => deps({ foo: { bar: _ => 1 } })).toThrowError(/shadow/);
});
it("should work for sub-namespaces", function () {
var deps = room_of_requirement_1.root({
foo: {
bar: () => 1
}
});
expect(deps.foo({ bar: () => 2 }).bar).toEqual(2);
});
it("should use relative depedencies from a sub-namespaces", function () {
var deps = room_of_requirement_1.root({
foo: {
bar: () => 1
}
});
expect(deps.foo({ bleck: ({ bar }) => bar }).bleck).toEqual(1);
});
it("should work inside a resolution", function () {
var deps = room_of_requirement_1.root({
bar: ({ foo }) => foo,
barForFoo: _ => (foo) => _({ foo: () => foo }).bar
});
expect(deps.barForFoo(1)).toBe(1);
});
it("should account for new rules inside a resolution", function () {
var deps1 = room_of_requirement_1.root({
bar: ({ foo }) => foo,
barForFoo: ({ _ }) => (foo) => _({ foo: () => foo }).bar
}), deps2 = deps1({
bar: ({ foo }) => foo * 2
});
expect(deps1.barForFoo(1)).toBe(1);
expect(deps2({ foo: () => 1 }).bar).toBe(2);
expect(deps2.barForFoo(1)).toBe(2);
});
});
//# sourceMappingURL=overlays.spec.js.map | 32.735537 | 77 | 0.461752 |
01626c509a69f783101592e5c6d1929be4165ece | 1,319 | js | JavaScript | fixtures/ember-new-prod/concat-stats-for/2-ember.js/@ember/-internals/views/lib/system/jquery.js | mike-north/ember-asset-size-report | b248508d0908cab390ba9a15c76e89ac11abb046 | [
"BSD-2-Clause"
] | 1 | 2019-12-04T17:12:24.000Z | 2019-12-04T17:12:24.000Z | fixtures/ember-new-prod/concat-stats-for/2-ember.js/@ember/-internals/views/lib/system/jquery.js | mike-north/ember-asset-size-report | b248508d0908cab390ba9a15c76e89ac11abb046 | [
"BSD-2-Clause"
] | null | null | null | fixtures/ember-new-prod/concat-stats-for/2-ember.js/@ember/-internals/views/lib/system/jquery.js | mike-north/ember-asset-size-report | b248508d0908cab390ba9a15c76e89ac11abb046 | [
"BSD-2-Clause"
] | null | null | null | define("@ember/-internals/views/lib/system/jquery", ["exports", "@ember/-internals/environment", "@ember/-internals/browser-environment", "@ember/deprecated-features"], function (_exports, _environment, _browserEnvironment, _deprecatedFeatures) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.jQueryDisabled = _exports.jQuery = void 0;
var jQuery;
_exports.jQuery = jQuery;
var jQueryDisabled = !_deprecatedFeatures.JQUERY_INTEGRATION || _environment.ENV._JQUERY_INTEGRATION === false;
_exports.jQueryDisabled = jQueryDisabled;
if (_deprecatedFeatures.JQUERY_INTEGRATION && _browserEnvironment.hasDOM) {
_exports.jQuery = jQuery = _environment.context.imports.jQuery;
if (!jQueryDisabled && jQuery) {
if (jQuery.event.addProp) {
jQuery.event.addProp('dataTransfer');
} else {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents
['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend'].forEach(function (eventName) {
jQuery.event.fixHooks[eventName] = {
props: ['dataTransfer']
};
});
}
} else {
_exports.jQuery = jQuery = undefined;
_exports.jQueryDisabled = jQueryDisabled = true;
}
}
}); | 41.21875 | 246 | 0.679303 |
0162d49c064691b4bdc0c08dd10a05f96f45cf8c | 5,556 | js | JavaScript | src/js/js/cart.js | tianshaojun/kangjia | fc966d71f6bc82eabdef960f42d57271eda87212 | [
"MIT"
] | 1 | 2020-05-23T01:55:01.000Z | 2020-05-23T01:55:01.000Z | src/js/js/cart.js | tianshaojun/kangjia | fc966d71f6bc82eabdef960f42d57271eda87212 | [
"MIT"
] | null | null | null | src/js/js/cart.js | tianshaojun/kangjia | fc966d71f6bc82eabdef960f42d57271eda87212 | [
"MIT"
] | null | null | null | var shopping=$('#shopping');
$.ajax({
type:'get',
url:'/product/GetProductActivitiesAsync',
dataType:'json',
data:{
pid:'95390'
},
success:function(data){
// console.log(data);
var str='';
for(var i=0;i<data.shopHotORStoreManagers.length;i++){
// console.log(data)
for(var key in localStorage){
if(parseInt(key) == data.shopHotORStoreManagers[i].ProductId){
str+=`<ul class="shops">
<li><input type="checkbox" class='single'></li>
<li>
<img src="${data.shopHotORStoreManagers[i].ImageUrl}">
<span>${data.shopHotORStoreManagers[i].ProductName}</span>
</li>
<li>${'¥'+data.shopHotORStoreManagers[i].SalePrice}</li>
<li>
<div class="sub" data_url='${data.shopHotORStoreManagers[i].ProductId}'>-</div>
<input type="text" value='${localStorage[key]}'>
<div class="add" data_url='${data.shopHotORStoreManagers[i].ProductId}'>+</div>
</li>
<li>${'¥'+data.shopHotORStoreManagers[i].SalePrice*parseInt(localStorage[key])}</li>
<li class='del' data_id='${data.shopHotORStoreManagers[i].ProductId}'>删除</li>
</ul>`
}
}
}
var html=shopping.html();
shopping.html(html+str);
$(document).click(function(e){
var e=e||event;
var target=$(e.target);
// 删除
if(target.attr('class') == 'del'){
var id=target.attr('data_id');
for(i in localStorage){
if(parseInt(i)==id){
localStorage.sum-=localStorage[i];
delete localStorage[i];
}
}
target.parent().remove();
}
//点击-号
if(target.attr('class') == 'sub'){
var id=target.attr('data_url');
for(var key in localStorage){
if(parseInt(key)==id){
if(localStorage[key]<=0){
localStorage[key]=0;
}else{
localStorage[key]--;
}
}
}
localStorage.sum--;
if(localStorage.sum<=0){
localStorage.sum=0;
}
//小计
var singleTotal=target.parent().next();
//数量
var mid=target.next();
// console.log(mid)
var midVal=mid.val();
//单价
var price=target.parent().prev().text();
var singleprice=price.slice(1);
midVal--;
if(midVal<=0){
mid.val(0);
singleTotal.text('¥'+'0.00');
}else{
mid.val(midVal);
//计算单品单价
singleTotal.text('¥'+midVal*singleprice);
}
}
//点击+号
if(target.attr('class') == 'add'){
var id=target.attr('data_url');
for(var key in localStorage){
if(parseInt(key)==id){
localStorage[key]++;
}
}
localStorage.sum++;
//小计
var singleTotal=target.parent().next();
//单价
var price=target.parent().prev().text();
var singleprice=price.slice(1);
var mid=target.prev();
var midVal=mid.val();
midVal++;
mid.val(midVal);
//计算单品单价
singleTotal.text('¥'+midVal*singleprice);
}
//全选反选
var single=$('.single');
var all1=$('#all1');
var all2=$('#all2');
if(target.attr('id') == 'all1'){
if(all1.prop('checked')){
single.each(function(i){
single.eq(i).prop('checked',true);
})
all2.prop('checked',true);
}else{
single.each(function(i){
single.eq(i).prop('checked',false);
})
all2.prop('checked',false);
}
}
if(target.attr('id') == 'all2'){
if(all2.prop('checked')){
single.each(function(i){
single.eq(i).prop('checked',true);
})
all1.prop('checked',true);
}else{
single.each(function(i){
single.eq(i).prop('checked',false);
})
all1.prop('checked',false);
}
}
//如果子类全选中,则全选按钮选中,反之全选按钮不选中
var flag=true;
var sum=0;
var sumPrice=0;
var seleted=$('.seleted');
single.each(function(i){
if(single.eq(i).prop('checked')){
sum+=Number(single.eq(i).parent().parent().children().eq(3).children().eq(1).val());
sumPrice+=Number(single.eq(i).parent().parent().children().eq(4).text().slice(1));
//删除选中的商品
if(target.attr('class') == 'seleted'){
single.eq(i).parent().parent().remove();
}
}
if(!single.eq(i).prop('checked')){
flag=false;
}
})
var totalprice=$('#totalPrice');
var totalNum=$('#totalNum');
totalprice.text('¥'+sumPrice);
totalNum.text(sum);
if(flag){
all1.prop('checked',true);
all2.prop('checked',true);
}else{
all1.prop('checked',false);
all2.prop('checked',false);
}
}) //事件代理
}, //成功的回调
error:function(e){
console.log(e);
}
}) //ajax
| 27.78 | 106 | 0.454104 |
0163715e17549d3b8827204084f2254e3d66ddb3 | 1,107 | js | JavaScript | client/src/components/contacts/Contacts.js | fjcasti1/contact-keeper | 2143a5ed99ad35a2c4a9ed2ae8f787f454b1c697 | [
"MIT"
] | null | null | null | client/src/components/contacts/Contacts.js | fjcasti1/contact-keeper | 2143a5ed99ad35a2c4a9ed2ae8f787f454b1c697 | [
"MIT"
] | null | null | null | client/src/components/contacts/Contacts.js | fjcasti1/contact-keeper | 2143a5ed99ad35a2c4a9ed2ae8f787f454b1c697 | [
"MIT"
] | null | null | null | import React, { Fragment, useContext, useEffect } from 'react';
import ContactContext from '../../context/contact/contactContext';
import ContactItem from './ContactItem';
import Spinner from '../layout/Spinner';
import { motion } from 'framer-motion';
const Contacts = () => {
const { contacts, filtered, getContacts, loading } = useContext(ContactContext);
useEffect(() => {
getContacts();
// eslint-disable-next-line
}, []);
if (contacts !== null && !loading && contacts.length === 0) {
return <h4>Please add a contact</h4>;
}
let showContacts;
if (filtered !== null) {
showContacts = filtered;
} else {
showContacts = contacts;
}
return contacts !== null && !loading ? (
<Fragment>
{showContacts.map((contact) => (
<motion.div
key={contact._id}
layout
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.2 }}
>
<ContactItem contact={contact} />
</motion.div>
))}
</Fragment>
) : (
<Spinner />
);
};
export default Contacts;
| 24.065217 | 82 | 0.579946 |
0163ac8d1ac9a89278017d23c0370ff8fdf4f019 | 751 | js | JavaScript | src/components/Main.js | hekar/ircdc-react | 454ce77a18b15754d1421ddb2f7c898a871f8726 | [
"MIT"
] | null | null | null | src/components/Main.js | hekar/ircdc-react | 454ce77a18b15754d1421ddb2f7c898a871f8726 | [
"MIT"
] | null | null | null | src/components/Main.js | hekar/ircdc-react | 454ce77a18b15754d1421ddb2f7c898a871f8726 | [
"MIT"
] | null | null | null | require('normalize.css');
require('styles/App.css');
import $ from 'jquery';
import React from 'react';
import ReactCss from 'reactcss';
import Channel from './Channel';
import ChannelList from './ChannelList';
import { flex } from '../styles/';
export default class AppComponent extends ReactCss.Component {
classes() {
return {
'default': {
flex: Object.assign({ height: '100vh' }, flex)
}
};
}
constructor(props) {
super(props);
this.defaultProps = {
}
}
componentWillMount() {
$.get('//localhost:9071/api/messages/a/a/a');
}
render() {
const session = {};
return (
<div is="flex">
<ChannelList />
<Channel session={session} />
</div>
);
}
}
| 18.317073 | 62 | 0.584554 |
0164e3b1f57ad294364914dd404fef8d7105dc08 | 3,565 | js | JavaScript | dist/21.cbfd2493.js | blukmays/vue-material | 13ff5a75f29f73f33ac46e10fa64b56d2624dbb7 | [
"MIT"
] | null | null | null | dist/21.cbfd2493.js | blukmays/vue-material | 13ff5a75f29f73f33ac46e10fa64b56d2624dbb7 | [
"MIT"
] | 1 | 2019-10-31T16:18:54.000Z | 2019-11-02T22:40:15.000Z | dist/21.cbfd2493.js | blukmays/vue-material | 13ff5a75f29f73f33ac46e10fa64b56d2624dbb7 | [
"MIT"
] | null | null | null | webpackJsonp([21],{"./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue":function(e,s,t){"use strict";function o(e){t('./node_modules/extract-text-webpack-plugin/dist/loader.js?{"omit":1,"remove":true}!./node_modules/vue-style-loader/index.js!./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/style-compiler/index.js?{"vue":true,"id":"data-v-cb79b610","scoped":true,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue')}var a,l,d,n,r,u,i,c,m,p;Object.defineProperty(s,"__esModule",{value:!0}),a=t("./node_modules/babel-loader/lib/index.js?cacheDirectory=true!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue"),l=t.n(a);for(d in a)"default"!==d&&(function(e){t.d(s,e,(function(){return a[e]}))})(d);n=t('./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-cb79b610","hasScoped":true,"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue'),r=t("./node_modules/vue-loader/lib/component-normalizer.js"),u=!1,i=o,c="data-v-cb79b610",m=null,p=r(l.a,n.a,u,i,c,m),s.default=p.exports},"./node_modules/babel-loader/lib/index.js?cacheDirectory=true!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue":function(e,s,t){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.default={name:"TabCustomTemplate",data:function(){return{newPosts:0,checkInterval:null}},methods:{clearCheckPosts:function(){window.clearInterval(this.checkInterval),this.checkInterval=null},clearNewPosts:function(){this.clearCheckPosts(),this.newPosts=0},checkNewPosts:function(e){var s=this;"tab-posts"===e||this.checkInterval||(this.checkInterval=window.setInterval((function(){99===s.newPosts?(s.newPosts="99+",s.clearCheckPosts()):s.newPosts++}),1e3))}},mounted:function(){this.checkNewPosts()}}},'./node_modules/extract-text-webpack-plugin/dist/loader.js?{"omit":1,"remove":true}!./node_modules/vue-style-loader/index.js!./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/style-compiler/index.js?{"vue":true,"id":"data-v-cb79b610","scoped":true,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue':function(e,s){},'./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-cb79b610","hasScoped":true,"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./docs/app/pages/Components/Tabs/examples/TabCustomTemplate.vue':function(e,s,t){"use strict";var o=function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",[t("md-tabs",{on:{"md-changed":e.checkNewPosts},scopedSlots:e._u([{key:"md-tab",fn:function(s){var o=s.tab;return[e._v("\n "+e._s(o.label)+" "),o.data.badge?t("i",{staticClass:"badge"},[e._v(e._s(o.data.badge))]):e._e()]}}])},[e._v(" "),t("md-tab",{attrs:{id:"tab-home","md-label":"Home"}}),e._v(" "),t("md-tab",{attrs:{id:"tab-pages","md-label":"Pages"}}),e._v(" "),t("md-tab",{attrs:{id:"tab-posts","md-label":"Posts","md-template-data":{badge:e.newPosts}},on:{click:e.clearNewPosts}}),e._v(" "),t("md-tab",{attrs:{id:"tab-favorites","md-label":"Favorites"}})],1)],1)},a=[],l={render:o,staticRenderFns:a};s.a=l}}); | 3,565 | 3,565 | 0.73352 |
0166b4fd30e4f3f57691e4a4873c3289cacba4e2 | 2,144 | js | JavaScript | Falling SnowFlakes Effect/script/script.js | sakshiv278/WebDev-ProjectKart | b336f45b16268dc748af5d52bdb0023deecb5eee | [
"MIT"
] | null | null | null | Falling SnowFlakes Effect/script/script.js | sakshiv278/WebDev-ProjectKart | b336f45b16268dc748af5d52bdb0023deecb5eee | [
"MIT"
] | null | null | null | Falling SnowFlakes Effect/script/script.js | sakshiv278/WebDev-ProjectKart | b336f45b16268dc748af5d52bdb0023deecb5eee | [
"MIT"
] | null | null | null |
const canvas = document.querySelector('canvas')
const c = canvas.getContext('2d')
canvas.width = innerWidth
canvas.height = innerHeight
const attributes = {
particleCount: 400,
particleSize: 3,
fallingSpeed: 1,
colors: ['#3dc8f2', '#c5d0d4', '#fff', ]
}
const mouse = {
x: innerWidth / 2,
y: innerHeight / 2
}
addEventListener('mousemove', event => {
mouse.x = event.clientX
mouse.y = event.clientY
})
addEventListener('resize', () => {
canvas.width = innerWidth
canvas.height = innerHeight
init()
})
function randomIntFromRange(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
function randomColor(colors) {
return colors[Math.floor(Math.random() * colors.length)]
}
function distance(x1, y1, x2, y2) {
const xDist = x2 - x1
const yDist = y2 - y1
return Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2))
}
function Particle(x, y, radius, color, radians) {
this.x = x;
this.y = y;
this.radius = radius;
this.color = color;
this.radians = radians;
this.velocity = 0.005;
this.update = () => {
this.radians += this.velocity;
this.x = x + Math.cos(this.radians) * 400 ;
this.y = y + Math.tan(this.radians) * 600 ;
this.draw();
}
this.draw = () => {
c.beginPath()
c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false)
c.fillStyle = this.color
c.fill()
c.closePath()
}
}
let particles;
function init() {
particles = [];
for (let i = 0; i < attributes.particleCount; i++) {
particles.push(
new Particle(
Math.random() * canvas.width,
Math.random() * canvas.height,
randomIntFromRange(0.5, attributes.particleSize),
randomColor(attributes.colors),
Math.random() * 80
)
);
}
console.log(particles);
}
function animate() {
requestAnimationFrame(animate)
c.clearRect(0, 0, canvas.width, canvas.height)
particles.forEach(particle => {
particle.update();
});
}
init()
animate()
| 19.669725 | 65 | 0.577425 |
0167b97344f2f8b674a86e064b0a514853424b62 | 783 | js | JavaScript | deploy/package-native.js | ubavic/lamassu-machine | 742de417524a9623d741317e84fb76168bcf3d2a | [
"Unlicense"
] | 87 | 2015-02-11T07:47:35.000Z | 2022-02-08T22:09:26.000Z | deploy/package-native.js | ubavic/lamassu-machine | 742de417524a9623d741317e84fb76168bcf3d2a | [
"Unlicense"
] | 452 | 2015-01-14T01:57:03.000Z | 2021-11-29T16:20:48.000Z | deploy/package-native.js | ubavic/lamassu-machine | 742de417524a9623d741317e84fb76168bcf3d2a | [
"Unlicense"
] | 156 | 2015-01-24T22:50:14.000Z | 2022-03-23T06:35:10.000Z | #!/usr/bin/env node
/*
Use ``npm install --global-style`` on a target device to build all node_modules.
Then use this script to package native_modules.tgz and
decompress to hardware/codebase/<device>
*/
const fs = require('fs')
const cp = require('child_process')
const mm = fs.readdirSync('./node_modules')
const pathList = mm
.filter(m => {
const nativePath = `./node_modules/${m}/build/Release`
return fs.existsSync(nativePath)
})
.map(m => `./node_modules/${m}`)
if (pathList.length === 0) {
console.log('No native modules')
process.exit(1)
}
const cmd = `tar -czf native_modules.tgz ${pathList.join(' ')}`
try {
cp.execSync(cmd)
console.log('Successfully built native_modules.tgz.')
process.exit(0)
} catch (err) {
console.log(err)
process.exit(2)
}
| 20.076923 | 80 | 0.687101 |
01685e9183a765ffefa722eeac4abbeb885a5e96 | 1,054 | js | JavaScript | migrations/20180920120934_reviews.js | sofwerx/AAD-API | 3454bfcbe3f8640f415a7c00c1f4037df6dbe927 | [
"MIT"
] | null | null | null | migrations/20180920120934_reviews.js | sofwerx/AAD-API | 3454bfcbe3f8640f415a7c00c1f4037df6dbe927 | [
"MIT"
] | null | null | null | migrations/20180920120934_reviews.js | sofwerx/AAD-API | 3454bfcbe3f8640f415a7c00c1f4037df6dbe927 | [
"MIT"
] | 1 | 2018-09-19T20:58:26.000Z | 2018-09-19T20:58:26.000Z | exports.up = (knex, Promise) => {
return knex.schema.createTable('reviews', (table) => {
// TABLE COLUMN DEFINITIONS HERE
table.increments().primary()
table.string('username').references('username').inTable('users').nullable().onDelete('CASCADE')
table.string('tool_name').nullable()
table.string('int_type').nullable()
table.boolean('sharable').nullable()
table.string('text', 3000).nullable()
table.string('firstName').nullable()
table.string('lastName').nullable()
table.string('jobTitle').nullable()
table.string('company').nullable()
table.integer('rating').nullable()
table.string('path').nullable()
table.string('answer_1').nullable()
table.string('answer_2').nullable()
table.string('answer_3').nullable()
table.string('answer_4').nullable()
table.string('answer_5').nullable()
table.timestamps(true, true)
})
}
exports.down = function(knex, Promise) {
return knex.schema.dropTableIfExists('reviews')
} | 40.538462 | 101 | 0.639469 |
016b318c0636943e8d80b486ab8bc66c6f6c619f | 1,567 | js | JavaScript | .eslintrc.js | azerothcore/ac-node-server | 891f17f4d15f97be452ec80406be12035b2ef62a | [
"MIT"
] | 2 | 2020-06-23T08:38:00.000Z | 2020-11-16T17:41:44.000Z | .eslintrc.js | azerothcore/acore-node-server | 891f17f4d15f97be452ec80406be12035b2ef62a | [
"MIT"
] | 3 | 2020-05-04T19:16:26.000Z | 2020-05-07T17:40:55.000Z | .eslintrc.js | azerothcore/ac-node-server | 891f17f4d15f97be452ec80406be12035b2ef62a | [
"MIT"
] | 2 | 2020-06-24T01:03:17.000Z | 2020-11-16T17:41:46.000Z | module.exports = {
env: {
// supporting all kind of environment
// to build universal lib
browser: true,
commonjs: true,
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'google', // google style guide
'plugin:jest/recommended', // jest support
'plugin:jest/style', // style for jest files
'plugin:jsdoc/recommended', // jsdoc rules to document code
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['json', 'import', 'jsdoc', 'jest', '@typescript-eslint'],
ignorePatterns: ['/*', '!src'],
rules: {
'require-jsdoc': 0, // jsdoc is not mandatory on functions
// disable eslint jsdoc internal check, already done by "jsdoc" plugin
'valid-jsdoc': 0,
'max-len': 0, // disable max length check of code lines
// disable the rule for all files
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/camelcase': 'off',
'jsdoc/require-param-type': 'off',
'new-cap': 0,
'jsdoc/require-returns': 'off',
'jsdoc/require-param-description': 'off',
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['error'],
},
},
],
settings: {
jsdoc: {
preferredTypes: {
object: 'Object',
},
},
},
};
| 27.982143 | 74 | 0.606254 |
016d31d0aac8ae121c35f60bfdde03f176d155e0 | 2,959 | js | JavaScript | dist/observables/binding/ViewFlipper.binding.js | lightningkite/butterfly-web | a369b6aa8e243e6a8f1894cbb97f945206367260 | [
"MIT"
] | 1 | 2022-01-06T14:33:58.000Z | 2022-01-06T14:33:58.000Z | dist/observables/binding/ViewFlipper.binding.js | lightningkite/butterfly-web | a369b6aa8e243e6a8f1894cbb97f945206367260 | [
"MIT"
] | null | null | null | dist/observables/binding/ViewFlipper.binding.js | lightningkite/butterfly-web | a369b6aa8e243e6a8f1894cbb97f945206367260 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const DisposeCondition_ext_1 = require("../../rx/DisposeCondition.ext");
//! Declares com.lightningkite.butterfly.observables.binding.bindLoading>android.widget.ViewFlipper
function xViewFlipperBindLoading(this_, loading, color = null) {
var _a;
const mainChild = this_.firstElementChild;
const loadingChild = (_a = this_.children.item(1)) !== null && _a !== void 0 ? _a : (() => {
const newElement = document.createElement("div");
newElement.classList.add("butterfly-flipper-progress");
newElement.classList.add("khr");
this_.appendChild(newElement);
return newElement;
})();
const animation = "butterfly-animate-fade";
let currentView = mainChild;
let hiddenView = loadingChild;
DisposeCondition_ext_1.xDisposableUntil(loading.onChange.subscribe((e) => {
if (e) {
hiddenView = mainChild;
currentView = loadingChild;
}
else {
currentView = mainChild;
hiddenView = loadingChild;
}
// currentView.style.removeProperty("animation");
// hiddenView.style.removeProperty("animation");
// currentView.style.removeProperty("visibility");
// hiddenView.style.removeProperty("visibility");
const viewOut = hiddenView;
const viewIn = currentView;
viewOut.style.setProperty("visibility", "hidden", "important");
viewIn.style.removeProperty("visibility");
// //animate out
// const animationOut = `${animation}-out`;
// let animOutHandler: (ev: AnimationEvent) => void;
// animOutHandler = (ev: AnimationEvent) => {
// if (ev.animationName === animationOut) {
// viewOut.onanimationend = null;
// viewOut.style.visibility = "hidden";
// }
// };
// viewOut.onanimationend = animOutHandler;
// viewOut.style.animation = `${animationOut} 0.25s`;
//
// //animate in
// const animationIn = `${animation}-in`;
// let animInHandler: (ev: AnimationEvent) => void;
// animInHandler = (ev: AnimationEvent) => {
// if (ev.animationName === animationIn) {
// viewIn.onanimationend = null;
// viewIn.style.removeProperty("animation");
// }
// };
// viewIn.onanimationend = animInHandler;
// viewIn.style.animation = `${animationIn} 0.25s`;
}), DisposeCondition_ext_1.xViewRemovedGet(this_));
if (loading.value) {
hiddenView = mainChild;
currentView = loadingChild;
}
else {
currentView = mainChild;
hiddenView = loadingChild;
}
hiddenView.style.setProperty("visibility", "hidden", "important");
}
exports.xViewFlipperBindLoading = xViewFlipperBindLoading;
//# sourceMappingURL=ViewFlipper.binding.js.map | 42.271429 | 99 | 0.612369 |
016d57c959a95b25c00d19d04e095667c3823591 | 230 | js | JavaScript | clientserver.js | AaronFilson/omnifilter-client | a87d770ba35ccf3ac2dbdb9e5f9581e8367acb9e | [
"MIT"
] | null | null | null | clientserver.js | AaronFilson/omnifilter-client | a87d770ba35ccf3ac2dbdb9e5f9581e8367acb9e | [
"MIT"
] | null | null | null | clientserver.js | AaronFilson/omnifilter-client | a87d770ba35ccf3ac2dbdb9e5f9581e8367acb9e | [
"MIT"
] | null | null | null | const express = require('express');
var myPort = process.env.PORT || process.env.$PORT || 5000;
express().use(express.static(__dirname + '/build'))
.listen(myPort, () => console.log('Client server up on port ' + myPort + '.'));
| 46 | 81 | 0.66087 |
016d8c7fc45623ae584c131f1d09d9e8bce2be9c | 1,643 | js | JavaScript | node_modules/@rxweb/reactive-form-validators/esm5/util/check-length.js | rohitgituser/co-connect-demo | 3ddd1aae289970847fe54a5c28c4be9d7bf7c4ed | [
"MIT"
] | null | null | null | node_modules/@rxweb/reactive-form-validators/esm5/util/check-length.js | rohitgituser/co-connect-demo | 3ddd1aae289970847fe54a5c28c4be9d7bf7c4ed | [
"MIT"
] | 1 | 2022-03-02T09:39:09.000Z | 2022-03-02T09:39:09.000Z | node_modules/@rxweb/reactive-form-validators/esm5/util/check-length.js | rohitgituser/co-connect-demo | 3ddd1aae289970847fe54a5c28c4be9d7bf7c4ed | [
"MIT"
] | null | null | null | import * as tslib_1 from "tslib";
export function checkLength(length, checks) {
var e_1, _a;
var isPassed = false;
try {
for (var checks_1 = tslib_1.__values(checks), checks_1_1 = checks_1.next(); !checks_1_1.done; checks_1_1 = checks_1.next()) {
var check = checks_1_1.value;
isPassed = (check == length);
if (isPassed)
break;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (checks_1_1 && !checks_1_1.done && (_a = checks_1.return)) _a.call(checks_1);
}
finally { if (e_1) throw e_1.error; }
}
return isPassed;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2stbGVuZ3RoLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHJ4d2ViL3JlYWN0aXZlLWZvcm0tdmFsaWRhdG9ycy8iLCJzb3VyY2VzIjpbInV0aWwvY2hlY2stbGVuZ3RoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFNLFVBQVUsV0FBVyxDQUFDLE1BQWMsRUFBRSxNQUFnQjs7SUFDMUQsSUFBSSxRQUFRLEdBQUcsS0FBSyxDQUFDOztRQUNyQixLQUFrQixJQUFBLFdBQUEsaUJBQUEsTUFBTSxDQUFBLDhCQUFBLGtEQUFFO1lBQXJCLElBQUksS0FBSyxtQkFBQTtZQUNaLFFBQVEsR0FBRyxDQUFDLEtBQUssSUFBSSxNQUFNLENBQUMsQ0FBQTtZQUM1QixJQUFJLFFBQVE7Z0JBQ1YsTUFBTTtTQUNUOzs7Ozs7Ozs7SUFDRCxPQUFPLFFBQVEsQ0FBQztBQUNsQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGNoZWNrTGVuZ3RoKGxlbmd0aDogbnVtYmVyLCBjaGVja3M6IG51bWJlcltdKTogYm9vbGVhbiB7XHJcbiAgbGV0IGlzUGFzc2VkID0gZmFsc2U7XHJcbiAgZm9yIChsZXQgY2hlY2sgb2YgY2hlY2tzKSB7XHJcbiAgICBpc1Bhc3NlZCA9IChjaGVjayA9PSBsZW5ndGgpXHJcbiAgICBpZiAoaXNQYXNzZWQpXHJcbiAgICAgIGJyZWFrO1xyXG4gIH1cclxuICByZXR1cm4gaXNQYXNzZWQ7XHJcbn1cclxuIl19 | 74.681818 | 954 | 0.797931 |
0170d5c78aa3bc97501db29658a6f57e4cfeb516 | 74 | js | JavaScript | test/manual/src/preloaded2.js | sebastianseilund/extract-css-chunks-webpack-plugin | c644b00f3ea17ec553ade6457439bffeef7dae54 | [
"MIT"
] | null | null | null | test/manual/src/preloaded2.js | sebastianseilund/extract-css-chunks-webpack-plugin | c644b00f3ea17ec553ade6457439bffeef7dae54 | [
"MIT"
] | null | null | null | test/manual/src/preloaded2.js | sebastianseilund/extract-css-chunks-webpack-plugin | c644b00f3ea17ec553ade6457439bffeef7dae54 | [
"MIT"
] | null | null | null | import './preloaded2.css';
alert('Ok'); // eslint-disable-line no-alert
| 18.5 | 45 | 0.675676 |
0172bb51a0a188211458d4dba65096de9c0f285a | 1,520 | js | JavaScript | src/components/CopyColumns/CopyColumns.js | webdevboy/gatsbyjs-tk | 0e99c2dadfdf6988b10f93773f48d6fce6bd71ca | [
"MIT"
] | 1 | 2020-09-01T14:10:36.000Z | 2020-09-01T14:10:36.000Z | src/components/CopyColumns/CopyColumns.js | webdevboy/gatsbyjs-tk | 0e99c2dadfdf6988b10f93773f48d6fce6bd71ca | [
"MIT"
] | 22 | 2020-06-10T10:43:41.000Z | 2022-01-26T11:18:34.000Z | src/components/CopyColumns/CopyColumns.js | webdevboy/gatsbyjs-tk | 0e99c2dadfdf6988b10f93773f48d6fce6bd71ca | [
"MIT"
] | null | null | null | import React from 'react';
import { MEDIUM_BREAKPOINT, XLARGE_BREAKPOINT } from 'src/utils/breakpoints';
import { isBrowser } from 'src/utils/auth';
import './CopyColumns.scss';
export default function CopyColumns({ columns, theme }) {
const mobileCopyExists = columns && columns.find(allCopy => allCopy.mobileCopy != null);
return (
<section className={`copy-columns columns-${columns ? columns.length : 0} ${theme}`}>
{columns && columns.map((col, i) => (
<div
key={i}
className="group"
>
{col.icon && (
<span className="icon-container">
<img
className="icon"
src={col.icon.sourceUrl}
alt={col.altText || 'Icon'}
/>
</span>
)}
{col.headline && <h4 className="headline" dangerouslySetInnerHTML={{ __html: col.headline }} />}
{col.subheader && <p className="subhead" dangerouslySetInnerHTML={{ __html: col.subheader }} />}
{col.mobileCopy && <div
className="mobile-copy"
dangerouslySetInnerHTML={{ __html: col.mobileCopy && col.mobileCopy.replace && col.mobileCopy.replace('<tab>', '<tab />') }}
/>}
<div
className={`copy ${mobileCopyExists ? 'uncolumn' : ''}`}
dangerouslySetInnerHTML={{ __html: col.columnCopy && col.columnCopy.replace && col.columnCopy.replace('<tab>', '<tab />') }}
/>
</div>
))}
</section>
);
}
| 37.073171 | 137 | 0.555263 |
0173f3775828363ad28f636c2915eed82dc129bc | 54 | js | JavaScript | common/models/blood.js | safe-plant/safeplant-api | 180f0cc178b236984bf5789b29be7eb3355bda70 | [
"MIT"
] | null | null | null | common/models/blood.js | safe-plant/safeplant-api | 180f0cc178b236984bf5789b29be7eb3355bda70 | [
"MIT"
] | null | null | null | common/models/blood.js | safe-plant/safeplant-api | 180f0cc178b236984bf5789b29be7eb3355bda70 | [
"MIT"
] | 1 | 2019-05-02T16:43:17.000Z | 2019-05-02T16:43:17.000Z | 'use strict';
module.exports = function(Blood) {
};
| 9 | 34 | 0.648148 |
01747508e383a2ccec5ec3c5f45a6fc47a5374a4 | 88 | js | JavaScript | day/03-webpack/34/webpack/src/index.js | forwendy/frontend-interview | 53f9a5a211e33c36430ef2df54526c42938d92a2 | [
"MIT"
] | 1 | 2022-02-15T07:10:05.000Z | 2022-02-15T07:10:05.000Z | day/03-webpack/34/webpack/src/index.js | forwendy/frontend-interview | 53f9a5a211e33c36430ef2df54526c42938d92a2 | [
"MIT"
] | null | null | null | day/03-webpack/34/webpack/src/index.js | forwendy/frontend-interview | 53f9a5a211e33c36430ef2df54526c42938d92a2 | [
"MIT"
] | null | null | null | import { add } from "./add";
import hello from "./hello.txt";
console.log(add(3, 3));
| 14.666667 | 32 | 0.613636 |
017578f0319b6c7e00623f2b6a5c9f456e3f719d | 2,729 | js | JavaScript | React/src/components/floor/FloorAdd.js | yucellsarikaya/ReactJS-SpringBoot-Mysql | 9e952b2f1d4be622aca26dd6363dfed6cc60d5ad | [
"MIT"
] | 1 | 2021-06-30T12:21:16.000Z | 2021-06-30T12:21:16.000Z | React/src/components/floor/FloorAdd.js | yucellsarikaya/ReactJS-SpringBoot-Mysql | 9e952b2f1d4be622aca26dd6363dfed6cc60d5ad | [
"MIT"
] | null | null | null | React/src/components/floor/FloorAdd.js | yucellsarikaya/ReactJS-SpringBoot-Mysql | 9e952b2f1d4be622aca26dd6363dfed6cc60d5ad | [
"MIT"
] | null | null | null | import React, { useState, useEffect } from 'react'
import buildingService from '../../services/buildingServices/buildingService'
import floorService from '../../services/floorServices/floorService'
import alertify from "alertifyjs"
import { useHistory } from "react-router-dom";
export default function FloorAdd() {
const [buildings, setBuildings] = useState([])
const [floorName, setFloorName] = useState("")
const [floorFk, setFloorFk] = useState("")
let history = useHistory();
useEffect(() => {
buildingService.listBuilding().then(result => {
setBuildings(result.data)
})
}, [])
const handleChange = (e) => {
setFloorFk(e.target.value)
}
const saveFloor = (e) => {
e.preventDefault()
let floor = { floorname: floorName, floorfk: floorFk };
floorService.createFloor(floor).then(res => alertify.success("Kat Eklendi", 1.5), history.push('/floor')).catch(err => alertify.error("Bir hata oluştu", 1.5));
}
return (
<div>
<div className="container">
<div className="card col-md-6 offset-md-3 offset-md-3">
<div className="text-center">Kat Ekle</div>
<div className="card-body">
<form>
<div className="form-group">
<label>Kat Numarası</label>
<input
placeholder="Kat Numarsı Giriniz"
name="floorName"
type="number"
className="form-control"
onChange={e => setFloorName(e.target.value)}
value={floorName}
/>
</div>
<br></br>
<div className="form-group">
<select class="form-select" onChange={handleChange}>
<option selected></option>
{
buildings.map((building) => (
<option value={building.id}>{building.buildingname}</option>
))
}
</select>
</div>
<button className="btn btn-success" onClick={saveFloor}>Kayıt Et</button>
</form>
</div>
</div>
</div>
</div>
)
}
| 40.731343 | 167 | 0.434591 |
0177151744ebe08199c2e090a3368c6d4b5508e8 | 4,720 | js | JavaScript | dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js | hispindia/MAHARASHTRA-2.13 | f50ec5b3ca2c5fabb43058166fd0c0fbbaa946a9 | [
"BSD-3-Clause"
] | null | null | null | dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js | hispindia/MAHARASHTRA-2.13 | f50ec5b3ca2c5fabb43058166fd0c0fbbaa946a9 | [
"BSD-3-Clause"
] | null | null | null | dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js | hispindia/MAHARASHTRA-2.13 | f50ec5b3ca2c5fabb43058166fd0c0fbbaa946a9 | [
"BSD-3-Clause"
] | null | null | null | // -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
function showPatientAttributeDetails( patientAttributeId )
{
jQuery.getJSON( 'getPatientAttribute.action', { id: patientAttributeId },
function ( json ) {
setInnerHTML( 'nameField', json.patientAttribute.name );
setInnerHTML( 'descriptionField', json.patientAttribute.description );
var mandatory = ( json.patientAttribute.mandatory == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'mandatoryField', mandatory );
var inherit = ( json.patientAttribute.inherit == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'inheritField', inherit );
var valueType = json.patientAttribute.valueType;
var typeMap = patientAttributeTypeMap();
setInnerHTML( 'valueTypeField', typeMap[valueType] );
showDetails();
});
}
function patientAttributeTypeMap()
{
var typeMap = [];
typeMap['number'] = i18n_number;
typeMap['string'] = i18n_text;
typeMap['bool'] = i18n_yes_no;
typeMap['trueOnly'] = i18n_yes_only;
typeMap['date'] = i18n_date;
typeMap['combo'] = i18n_attribute_combo_type;
return typeMap;
}
// -----------------------------------------------------------------------------
// Remove Patient Attribute
// -----------------------------------------------------------------------------
function removePatientAttribute( patientAttributeId, name )
{
removeItem( patientAttributeId, name, i18n_confirm_delete, 'removePatientAttribute.action' );
}
ATTRIBUTE_OPTION =
{
selectValueType : function (this_)
{
if ( jQuery(this_).val() == "combo" )
{
showById("attributeComboRow");
if( jQuery("#attrOptionContainer").find("input").length ==0 )
{
ATTRIBUTE_OPTION.addOption();
ATTRIBUTE_OPTION.addOption();
}
}
else if (jQuery(this_).val() == "calculated"){
if( jQuery("#availableAttribute option").length == 0 )
{
jQuery.getJSON( 'getCalPatientAttributeParams.action', { },
function ( json ) {
var patientAttributes = jQuery("#availableAttribute");
patientAttributes.append( "<option value='[current_date:0]' title='" + i18n_current_date + "'>" + i18n_current_date + "</option>" );
patientAttributes.append( "<option value='[CP:0]' title='" + i18n_date_of_birth + "'>" + i18n_date_of_birth + "</option>" );
for ( i in json.programs )
{
var id = "[PG:" + json.programs[i].id + ".dateOfIncident]";
patientAttributes.append( "<option value='" + id + "' title='" + json.programs[i].name + "( " + i18n_incident_date + " )" + "'>" + json.programs[i].name + "( " + i18n_incident_date + " )" + "</option>" );
var id = "[PG:" + json.programs[i].id + ".enrollmentDate]";
patientAttributes.append( "<option value='" + id + "' title='" + json.programs[i].name + "( " + i18n_enrollment_date + " )" + "'>" + json.programs[i].name + "( " + i18n_enrollment_date + " )" + "</option>" );
}
for ( i in json.patientAttributes )
{
var id = "[CA:" + json.patientAttributes[i].id + "]";
patientAttributes.append( "<option value='" + id + "' title='" + json.patientAttributes[i].name + "'>" + json.patientAttributes[i].name + "</option>" );
}
});
}
hideById("attributeComboRow");
}
else
{
hideById("attributeComboRow");
}
},
checkOnSubmit : function ()
{
if( jQuery("#valueType").val() != "combo" )
{
jQuery("#attrOptionContainer").children().remove();
return true;
}else {
$("input","#attrOptionContainer").each(function(){
if( !jQuery(this).val() )
jQuery(this).remove();
});
if( $("input","#attrOptionContainer").length < 2)
{
alert(i118_at_least_2_option);
return false;
}else return true;
}
},
addOption : function ()
{
jQuery("#attrOptionContainer").append(ATTRIBUTE_OPTION.createInput());
},
remove : function (this_, optionId)
{
if( jQuery(this_).siblings("input").attr("name") != "attrOptions")
{
jQuery.get("removePatientAttributeOption.action?id="+optionId,function(data){
if( data.response == "success")
{
jQuery(this_).parent().parent().remove();
showSuccessMessage( data.message );
}else
{
showErrorMessage( data.message );
}
});
}else
{
jQuery(this_).parent().parent().remove();
}
},
removeInAddForm : function(this_)
{
jQuery(this_).parent().parent().remove();
},
createInput : function ()
{
return "<tr><td><input type='text' name='attrOptions' /><a href='#' style='text-decoration: none; margin-left:0.5em;' title='"+i18n_remove_option+"' onClick='ATTRIBUTE_OPTION.remove(this,null)'>[ - ]</a></td></tr>";
}
}
| 33.956835 | 218 | 0.594068 |
01775c21f0beddc9f01270f4c8005afb928a962b | 68 | js | JavaScript | packages/taro-redux-h5/src/index.js | UchihaObitoZzz/taro | 4564acdd425cfeac060947c1a43a433612e3ba99 | [
"MIT"
] | 2 | 2019-03-05T09:28:39.000Z | 2021-11-09T03:10:16.000Z | packages/taro-redux-h5/src/index.js | UchihaObitoZzz/taro | 4564acdd425cfeac060947c1a43a433612e3ba99 | [
"MIT"
] | 29 | 2020-09-05T00:57:25.000Z | 2022-02-26T14:48:52.000Z | packages/taro-redux-h5/src/index.js | UchihaObitoZzz/taro | 4564acdd425cfeac060947c1a43a433612e3ba99 | [
"MIT"
] | 2 | 2020-10-07T02:48:39.000Z | 2021-11-09T03:10:22.000Z | export { Provider, connect, connectAdvanced } from '../react-redux'
| 34 | 67 | 0.735294 |
0177c2282bcf2cdb71ad0dc816d93827464500d4 | 23,367 | js | JavaScript | www/js/ajax/api/scripts/graphics.js | GeoinformationSystems/geooperator-browser | dd34647a83941daeba6b9d1cfef6f1e05ed890ae | [
"CC-BY-4.0"
] | 6 | 2015-03-23T16:56:41.000Z | 2020-01-21T09:34:14.000Z | www/js/ajax/api/scripts/graphics.js | GeoinformationSystems/geooperator-browser | dd34647a83941daeba6b9d1cfef6f1e05ed890ae | [
"CC-BY-4.0"
] | 9 | 2015-06-04T19:16:03.000Z | 2015-08-03T17:01:30.000Z | www/js/ajax/api/scripts/graphics.js | GeoinformationSystems/geooperator-browser | dd34647a83941daeba6b9d1cfef6f1e05ed890ae | [
"CC-BY-4.0"
] | 5 | 2015-03-18T20:37:09.000Z | 2018-11-15T11:59:59.000Z | /**
* @fileOverview Graphics utility functions and constants
* @name SimileAjax.Graphics
*/
SimileAjax.Graphics = new Object();
/**
* A boolean value indicating whether PNG translucency is supported on the
* user's browser or not.
*
* @type Boolean
*/
SimileAjax.Graphics.pngIsTranslucent = (!SimileAjax.Platform.browser.isIE) || (SimileAjax.Platform.browser.majorVersion > 6);
/*==================================================
* Opacity, translucency
*==================================================
*/
SimileAjax.Graphics._createTranslucentImage1 = function(url, verticalAlign) {
var elmt = document.createElement("img");
elmt.setAttribute("src", url);
if (verticalAlign != null) {
elmt.style.verticalAlign = verticalAlign;
}
return elmt;
};
SimileAjax.Graphics._createTranslucentImage2 = function(url, verticalAlign) {
var elmt = document.createElement("img");
elmt.style.width = "1px"; // just so that IE will calculate the size property
elmt.style.height = "1px";
elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image')";
elmt.style.verticalAlign = (verticalAlign != null) ? verticalAlign : "middle";
return elmt;
};
/**
* Creates a DOM element for an <code>img</code> tag using the URL given. This
* is a convenience method that automatically includes the necessary CSS to
* allow for translucency, even on IE.
*
* @function
* @param {String} url the URL to the image
* @param {String} verticalAlign the CSS value for the image's vertical-align
* @return {Element} a DOM element containing the <code>img</code> tag
*/
SimileAjax.Graphics.createTranslucentImage = SimileAjax.Graphics.pngIsTranslucent ?
SimileAjax.Graphics._createTranslucentImage1 :
SimileAjax.Graphics._createTranslucentImage2;
SimileAjax.Graphics._createTranslucentImageHTML1 = function(url, verticalAlign) {
return "<img src=\"" + url + "\"" +
(verticalAlign != null ? " style=\"vertical-align: " + verticalAlign + ";\"" : "") +
" />";
};
SimileAjax.Graphics._createTranslucentImageHTML2 = function(url, verticalAlign) {
var style =
"width: 1px; height: 1px; " +
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image');" +
(verticalAlign != null ? " vertical-align: " + verticalAlign + ";" : "");
return "<img src='" + url + "' style=\"" + style + "\" />";
};
/**
* Creates an HTML string for an <code>img</code> tag using the URL given.
* This is a convenience method that automatically includes the necessary CSS
* to allow for translucency, even on IE.
*
* @function
* @param {String} url the URL to the image
* @param {String} verticalAlign the CSS value for the image's vertical-align
* @return {String} a string containing the <code>img</code> tag
*/
SimileAjax.Graphics.createTranslucentImageHTML = SimileAjax.Graphics.pngIsTranslucent ?
SimileAjax.Graphics._createTranslucentImageHTML1 :
SimileAjax.Graphics._createTranslucentImageHTML2;
/**
* Sets the opacity on the given DOM element.
*
* @param {Element} elmt the DOM element to set the opacity on
* @param {Number} opacity an integer from 0 to 100 specifying the opacity
*/
SimileAjax.Graphics.setOpacity = function(elmt, opacity) {
if (SimileAjax.Platform.browser.isIE) {
elmt.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity=" + opacity + ")";
} else {
var o = (opacity / 100).toString();
elmt.style.opacity = o;
elmt.style.MozOpacity = o;
}
};
/*==================================================
* Bubble
*==================================================
*/
SimileAjax.Graphics._bubbleMargins = {
top: 33,
bottom: 42,
left: 33,
right: 40
}
// pixels from boundary of the whole bubble div to the tip of the arrow
SimileAjax.Graphics._arrowOffsets = {
top: 0,
bottom: 9,
left: 1,
right: 8
}
SimileAjax.Graphics._bubblePadding = 15;
SimileAjax.Graphics._bubblePointOffset = 6;
SimileAjax.Graphics._halfArrowWidth = 18;
/**
* Creates a nice, rounded bubble popup with the given content in a div,
* page coordinates and a suggested width. The bubble will point to the
* location on the page as described by pageX and pageY. All measurements
* should be given in pixels.
*
* @param {Element} the content div
* @param {Number} pageX the x coordinate of the point to point to
* @param {Number} pageY the y coordinate of the point to point to
* @param {Number} contentWidth a suggested width of the content
* @param {String} orientation a string ("top", "bottom", "left", or "right")
* that describes the orientation of the arrow on the bubble
*/
SimileAjax.Graphics.createBubbleForContentAndPoint = function(div, pageX, pageY, contentWidth, orientation) {
if (typeof contentWidth != "number") {
contentWidth = 300;
}
div.style.position = "absolute";
div.style.left = "-5000px";
div.style.top = "0px";
div.style.width = contentWidth + "px";
document.body.appendChild(div);
window.setTimeout(function() {
var width = div.scrollWidth + 10;
var height = div.scrollHeight + 10;
var bubble = SimileAjax.Graphics.createBubbleForPoint(pageX, pageY, width, height, orientation);
document.body.removeChild(div);
div.style.position = "static";
div.style.left = "";
div.style.top = "";
div.style.width = width + "px";
bubble.content.appendChild(div);
}, 200);
};
/**
* Creates a nice, rounded bubble popup with the given page coordinates and
* content dimensions. The bubble will point to the location on the page
* as described by pageX and pageY. All measurements should be given in
* pixels.
*
* @param {Number} pageX the x coordinate of the point to point to
* @param {Number} pageY the y coordinate of the point to point to
* @param {Number} contentWidth the width of the content box in the bubble
* @param {Number} contentHeight the height of the content box in the bubble
* @param {String} orientation a string ("top", "bottom", "left", or "right")
* that describes the orientation of the arrow on the bubble
* @return {Element} a DOM element for the newly created bubble
*/
SimileAjax.Graphics.createBubbleForPoint = function(pageX, pageY, contentWidth, contentHeight, orientation) {
function getWindowDims() {
if (typeof window.innerHeight == 'number') {
return { w:window.innerWidth, h:window.innerHeight }; // Non-IE
} else if (document.documentElement && document.documentElement.clientHeight) {
return { // IE6+, in "standards compliant mode"
w:document.documentElement.clientWidth,
h:document.documentElement.clientHeight
};
} else if (document.body && document.body.clientHeight) {
return { // IE 4 compatible
w:document.body.clientWidth,
h:document.body.clientHeight
};
}
}
var close = function() {
if (!bubble._closed) {
document.body.removeChild(bubble._div);
bubble._doc = null;
bubble._div = null;
bubble._content = null;
bubble._closed = true;
}
}
var bubble = {
_closed: false
};
var dims = getWindowDims();
var docWidth = dims.w;
var docHeight = dims.h;
var margins = SimileAjax.Graphics._bubbleMargins;
contentWidth = parseInt(contentWidth, 10); // harden against bad input bugs
contentHeight = parseInt(contentHeight, 10); // getting numbers-as-strings
var bubbleWidth = margins.left + contentWidth + margins.right;
var bubbleHeight = margins.top + contentHeight + margins.bottom;
var pngIsTranslucent = SimileAjax.Graphics.pngIsTranslucent;
var urlPrefix = SimileAjax.urlPrefix;
var setImg = function(elmt, url, width, height) {
elmt.style.position = "absolute";
elmt.style.width = width + "px";
elmt.style.height = height + "px";
if (pngIsTranslucent) {
elmt.style.background = "url(" + url + ")";
} else {
elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')";
}
}
var div = document.createElement("div");
div.style.width = bubbleWidth + "px";
div.style.height = bubbleHeight + "px";
div.style.position = "absolute";
div.style.zIndex = 1000;
var layer = SimileAjax.WindowManager.pushLayer(close, true, div);
bubble._div = div;
bubble.close = function() { SimileAjax.WindowManager.popLayer(layer); }
var divInner = document.createElement("div");
divInner.style.width = "100%";
divInner.style.height = "100%";
divInner.style.position = "relative";
div.appendChild(divInner);
var createImg = function(url, left, top, width, height) {
var divImg = document.createElement("div");
divImg.style.left = left + "px";
divImg.style.top = top + "px";
setImg(divImg, url, width, height);
divInner.appendChild(divImg);
}
createImg(urlPrefix + "images/bubble-top-left.png", 0, 0, margins.left, margins.top);
createImg(urlPrefix + "images/bubble-top.png", margins.left, 0, contentWidth, margins.top);
createImg(urlPrefix + "images/bubble-top-right.png", margins.left + contentWidth, 0, margins.right, margins.top);
createImg(urlPrefix + "images/bubble-left.png", 0, margins.top, margins.left, contentHeight);
createImg(urlPrefix + "images/bubble-right.png", margins.left + contentWidth, margins.top, margins.right, contentHeight);
createImg(urlPrefix + "images/bubble-bottom-left.png", 0, margins.top + contentHeight, margins.left, margins.bottom);
createImg(urlPrefix + "images/bubble-bottom.png", margins.left, margins.top + contentHeight, contentWidth, margins.bottom);
createImg(urlPrefix + "images/bubble-bottom-right.png", margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom);
var divClose = document.createElement("div");
divClose.style.left = (bubbleWidth - margins.right + SimileAjax.Graphics._bubblePadding - 16 - 2) + "px";
divClose.style.top = (margins.top - SimileAjax.Graphics._bubblePadding + 1) + "px";
divClose.style.cursor = "pointer";
setImg(divClose, urlPrefix + "images/close-button.png", 16, 16);
SimileAjax.WindowManager.registerEventWithObject(divClose, "click", bubble, "close");
divInner.appendChild(divClose);
var divContent = document.createElement("div");
divContent.style.position = "absolute";
divContent.style.left = margins.left + "px";
divContent.style.top = margins.top + "px";
divContent.style.width = contentWidth + "px";
divContent.style.height = contentHeight + "px";
divContent.style.overflow = "auto";
divContent.style.background = "white";
divInner.appendChild(divContent);
bubble.content = divContent;
(function() {
if (pageX - SimileAjax.Graphics._halfArrowWidth - SimileAjax.Graphics._bubblePadding > 0 &&
pageX + SimileAjax.Graphics._halfArrowWidth + SimileAjax.Graphics._bubblePadding < docWidth) {
var left = pageX - Math.round(contentWidth / 2) - margins.left;
left = pageX < (docWidth / 2) ?
Math.max(left, -(margins.left - SimileAjax.Graphics._bubblePadding)) :
Math.min(left, docWidth + (margins.right - SimileAjax.Graphics._bubblePadding) - bubbleWidth);
if ((orientation && orientation == "top") || (!orientation && (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight > 0))) { // top
var divImg = document.createElement("div");
divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
divImg.style.top = (margins.top + contentHeight) + "px";
setImg(divImg, urlPrefix + "images/bubble-bottom-arrow.png", 37, margins.bottom);
divInner.appendChild(divImg);
div.style.left = left + "px";
div.style.top = (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight +
SimileAjax.Graphics._arrowOffsets.bottom) + "px";
return;
} else if ((orientation && orientation == "bottom") || (!orientation && (pageY + SimileAjax.Graphics._bubblePointOffset + bubbleHeight < docHeight))) { // bottom
var divImg = document.createElement("div");
divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
divImg.style.top = "0px";
setImg(divImg, urlPrefix + "images/bubble-top-arrow.png", 37, margins.top);
divInner.appendChild(divImg);
div.style.left = left + "px";
div.style.top = (pageY + SimileAjax.Graphics._bubblePointOffset -
SimileAjax.Graphics._arrowOffsets.top) + "px";
return;
}
}
var top = pageY - Math.round(contentHeight / 2) - margins.top;
top = pageY < (docHeight / 2) ?
Math.max(top, -(margins.top - SimileAjax.Graphics._bubblePadding)) :
Math.min(top, docHeight + (margins.bottom - SimileAjax.Graphics._bubblePadding) - bubbleHeight);
if ((orientation && orientation == "left") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth > 0))) { // left
var divImg = document.createElement("div");
divImg.style.left = (margins.left + contentWidth) + "px";
divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
setImg(divImg, urlPrefix + "images/bubble-right-arrow.png", margins.right, 37);
divInner.appendChild(divImg);
div.style.left = (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth +
SimileAjax.Graphics._arrowOffsets.right) + "px";
div.style.top = top + "px";
} else if ((orientation && orientation == "right") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth < docWidth))) { // right
var divImg = document.createElement("div");
divImg.style.left = "0px";
divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
setImg(divImg, urlPrefix + "images/bubble-left-arrow.png", margins.left, 37);
divInner.appendChild(divImg);
div.style.left = (pageX + SimileAjax.Graphics._bubblePointOffset -
SimileAjax.Graphics._arrowOffsets.left) + "px";
div.style.top = top + "px";
}
})();
document.body.appendChild(div);
return bubble;
};
/**
* Creates a floating, rounded message bubble in the center of the window for
* displaying modal information, e.g. "Loading..."
*
* @param {Document} doc the root document for the page to render on
* @param {Object} an object with two properties, contentDiv and containerDiv,
* consisting of the newly created DOM elements
*/
SimileAjax.Graphics.createMessageBubble = function(doc) {
var containerDiv = doc.createElement("div");
if (SimileAjax.Graphics.pngIsTranslucent) {
var topDiv = doc.createElement("div");
topDiv.style.height = "33px";
topDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-left.png) top left no-repeat";
topDiv.style.paddingLeft = "44px";
containerDiv.appendChild(topDiv);
var topRightDiv = doc.createElement("div");
topRightDiv.style.height = "33px";
topRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-right.png) top right no-repeat";
topDiv.appendChild(topRightDiv);
var middleDiv = doc.createElement("div");
middleDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-left.png) top left repeat-y";
middleDiv.style.paddingLeft = "44px";
containerDiv.appendChild(middleDiv);
var middleRightDiv = doc.createElement("div");
middleRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-right.png) top right repeat-y";
middleRightDiv.style.paddingRight = "44px";
middleDiv.appendChild(middleRightDiv);
var contentDiv = doc.createElement("div");
middleRightDiv.appendChild(contentDiv);
var bottomDiv = doc.createElement("div");
bottomDiv.style.height = "55px";
bottomDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-left.png) bottom left no-repeat";
bottomDiv.style.paddingLeft = "44px";
containerDiv.appendChild(bottomDiv);
var bottomRightDiv = doc.createElement("div");
bottomRightDiv.style.height = "55px";
bottomRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-right.png) bottom right no-repeat";
bottomDiv.appendChild(bottomRightDiv);
} else {
containerDiv.style.border = "2px solid #7777AA";
containerDiv.style.padding = "20px";
containerDiv.style.background = "white";
SimileAjax.Graphics.setOpacity(containerDiv, 90);
var contentDiv = doc.createElement("div");
containerDiv.appendChild(contentDiv);
}
return {
containerDiv: containerDiv,
contentDiv: contentDiv
};
};
/*==================================================
* Animation
*==================================================
*/
/**
* Creates an animation for a function, and an interval of values. The word
* "animation" here is used in the sense of repeatedly calling a function with
* a current value from within an interval, and a delta value.
*
* @param {Function} f a function to be called every 50 milliseconds throughout
* the animation duration, of the form f(current, delta), where current is
* the current value within the range and delta is the current change.
* @param {Number} from a starting value
* @param {Number} to an ending value
* @param {Number} duration the duration of the animation in milliseconds
* @param {Function} [cont] an optional function that is called at the end of
* the animation, i.e. a continuation.
* @return {SimileAjax.Graphics._Animation} a new animation object
*/
SimileAjax.Graphics.createAnimation = function(f, from, to, duration, cont) {
return new SimileAjax.Graphics._Animation(f, from, to, duration, cont);
};
SimileAjax.Graphics._Animation = function(f, from, to, duration, cont) {
this.f = f;
this.cont = (typeof cont == "function") ? cont : function() {};
this.from = from;
this.to = to;
this.current = from;
this.duration = duration;
this.start = new Date().getTime();
this.timePassed = 0;
};
/**
* Runs this animation.
*/
SimileAjax.Graphics._Animation.prototype.run = function() {
var a = this;
window.setTimeout(function() { a.step(); }, 50);
};
/**
* Increments this animation by one step, and then continues the animation with
* <code>run()</code>.
*/
SimileAjax.Graphics._Animation.prototype.step = function() {
this.timePassed += 50;
var timePassedFraction = this.timePassed / this.duration;
var parameterFraction = -Math.cos(timePassedFraction * Math.PI) / 2 + 0.5;
var current = parameterFraction * (this.to - this.from) + this.from;
try {
this.f(current, current - this.current);
} catch (e) {
}
this.current = current;
if (this.timePassed < this.duration) {
this.run();
} else {
this.f(this.to, 0);
this["cont"]();
}
};
/*==================================================
* CopyPasteButton
*
* Adapted from http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/techPreview.html.
*==================================================
*/
/**
* Creates a button and textarea for displaying structured data and copying it
* to the clipboard. The data is dynamically generated by the given
* createDataFunction parameter.
*
* @param {String} image an image URL to use as the background for the
* generated box
* @param {Number} width the width in pixels of the generated box
* @param {Number} height the height in pixels of the generated box
* @param {Function} createDataFunction a function that is called with no
* arguments to generate the structured data
* @return a new DOM element
*/
SimileAjax.Graphics.createStructuredDataCopyButton = function(image, width, height, createDataFunction) {
var div = document.createElement("div");
div.style.position = "relative";
div.style.display = "inline";
div.style.width = width + "px";
div.style.height = height + "px";
div.style.overflow = "hidden";
div.style.margin = "2px";
if (SimileAjax.Graphics.pngIsTranslucent) {
div.style.background = "url(" + image + ") no-repeat";
} else {
div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + image +"', sizingMethod='image')";
}
var style;
if (SimileAjax.Platform.browser.isIE) {
style = "filter:alpha(opacity=0)";
} else {
style = "opacity: 0";
}
div.innerHTML = "<textarea rows='1' autocomplete='off' value='none' style='" + style + "' />";
var textarea = div.firstChild;
textarea.style.width = width + "px";
textarea.style.height = height + "px";
textarea.onmousedown = function(evt) {
evt = (evt) ? evt : ((event) ? event : null);
if (evt.button == 2) {
textarea.value = createDataFunction();
textarea.select();
}
};
return div;
};
SimileAjax.Graphics.getFontRenderingContext = function(elmt, width) {
return new SimileAjax.Graphics._FontRenderingContext(elmt, width);
};
SimileAjax.Graphics._FontRenderingContext = function(elmt, width) {
this._elmt = elmt;
this._elmt.style.visibility = "hidden";
if (typeof width == "string") {
this._elmt.style.width = width;
} else if (typeof width == "number") {
this._elmt.style.width = width + "px";
}
};
SimileAjax.Graphics._FontRenderingContext.prototype.dispose = function() {
this._elmt = null;
};
SimileAjax.Graphics._FontRenderingContext.prototype.update = function() {
this._elmt.innerHTML = "A";
this._lineHeight = this._elmt.offsetHeight;
};
SimileAjax.Graphics._FontRenderingContext.prototype.computeSize = function(text) {
this._elmt.innerHTML = text;
return {
width: this._elmt.offsetWidth,
height: this._elmt.offsetHeight
};
};
SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight = function() {
return this._lineHeight;
};
| 40.780105 | 173 | 0.636667 |
0178767bbc204cb8531f9b913925b3592ef9348b | 776 | js | JavaScript | app/components/MinimalLayout/index.js | bkcom/bku-front-end-template | c902fb41b1c91439f50b16d74154fb8de9be2a51 | [
"MIT"
] | null | null | null | app/components/MinimalLayout/index.js | bkcom/bku-front-end-template | c902fb41b1c91439f50b16d74154fb8de9be2a51 | [
"MIT"
] | null | null | null | app/components/MinimalLayout/index.js | bkcom/bku-front-end-template | c902fb41b1c91439f50b16d74154fb8de9be2a51 | [
"MIT"
] | null | null | null | /**
*
* Minimal
*
*/
import React, { memo } from 'react';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/styles';
import TopbarMinimal from 'components/TopbarMinimal/Loadable';
import Footer from 'components/Footer';
const useStyles = makeStyles(() => ({
root: {
paddingTop: 64,
height: '100%'
},
content: {
height: '100%'
}
}));
function MinimalLayout(props) {
const { children } = props;
const classes = useStyles();
return (
<div className={classes.root}>
<TopbarMinimal />
<main className={classes.content}>{children}</main>
<Footer/>
</div>
);
};
MinimalLayout.propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
export default memo(MinimalLayout);
| 17.244444 | 63 | 0.641753 |
01789a0271f4405061c579d3dd70a4fa76263b43 | 470 | js | JavaScript | src/api/login.js | MusicCore/vue-musiccore | dd93e88216d443ba648fceba517ea9fa2ee37db9 | [
"MIT"
] | null | null | null | src/api/login.js | MusicCore/vue-musiccore | dd93e88216d443ba648fceba517ea9fa2ee37db9 | [
"MIT"
] | null | null | null | src/api/login.js | MusicCore/vue-musiccore | dd93e88216d443ba648fceba517ea9fa2ee37db9 | [
"MIT"
] | null | null | null | import request from '@/utils/request'
export function login(account, password) {
return request({
url: '/api/vue/login',
method: 'post',
data: {
account,
password
}
})
}
export function getInfo(token, account, password) {
return request({
url: '/api/vue/info',
method: 'post',
params: { token, account, password }
})
}
export function logout() {
return request({
url: '/api/vue/logout',
method: 'post'
})
}
| 16.785714 | 51 | 0.595745 |
0178b19b8391fd424257818183d3f516ae7b3b35 | 1,628 | js | JavaScript | test.js | stoeffel/partition-all | 6f9941bee4f290845269d7d8e915e9a8b0040238 | [
"MIT"
] | 11 | 2015-02-11T11:37:27.000Z | 2020-12-17T16:03:42.000Z | test.js | stoeffel/partition-all | 6f9941bee4f290845269d7d8e915e9a8b0040238 | [
"MIT"
] | null | null | null | test.js | stoeffel/partition-all | 6f9941bee4f290845269d7d8e915e9a8b0040238 | [
"MIT"
] | null | null | null | "use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var partitionAll = _interopRequire(require("./index.js"));
var expect = _interopRequire(require("expect.js"));
it("#partition-all", function () {
expect(partitionAll).to.be.a.Function;
expect(partitionAll(1)).to.be.a.Function;
expect(function () {
return partitionAll("1", []);
}).to.throwException();
expect(function () {
return partitionAll(null, []);
}).to.throwException();
expect(function () {
return partitionAll(0, {});
}).to.throwException();
expect(function () {
return partitionAll(0, null);
}).to.throwException();
expect(partitionAll(0)([])).to.eql([]);
expect(partitionAll(0)([1])).to.eql([1]);
expect(partitionAll(0)([1, 2])).to.eql([1, 2]);
expect(partitionAll(1)([])).to.eql([]);
expect(partitionAll(1)([1])).to.eql([[1]]);
expect(partitionAll(1)([1, 2])).to.eql([[1], [2]]);
expect(partitionAll(2)([1, 2])).to.eql([[1, 2]]);
expect(partitionAll(2)([1, 2, 3])).to.eql([[1, 2], [3]]);
expect(partitionAll(2)([1, 2, 3, 4])).to.eql([[1, 2], [3, 4]]);
expect(partitionAll(2)([1, 2, 3, 4, 5])).to.eql([[1, 2], [3, 4], [5]]);
expect(partitionAll(3)([1, 2])).to.eql([[1, 2]]);
expect(partitionAll(3)([1, 2, 3])).to.eql([[1, 2, 3]]);
expect(partitionAll(3)([1, 2, 3, 4])).to.eql([[1, 2, 3], [4]]);
expect(partitionAll(3)([1, 2, 3, 4, 5])).to.eql([[1, 2, 3], [4, 5]]);
expect(partitionAll(3)([1, 2, 3, 4, 5, 6])).to.eql([[1, 2, 3], [4, 5, 6]]);
expect(partitionAll(3)([1, 2, 3, 4, 5, 6, 7])).to.eql([[1, 2, 3], [4, 5, 6], [7]]);
}); | 33.916667 | 94 | 0.566339 |
01792b0434b1b4f2128fdaffbc5175e5f5a83e00 | 433 | js | JavaScript | src/utilities/storage.js | shegsteham/Fast-Food | 97b8bc17a470a72e2f0b4e6cfd539a4b4b66297b | [
"MIT"
] | 1 | 2020-07-24T02:53:49.000Z | 2020-07-24T02:53:49.000Z | src/utilities/storage.js | shegsteham/Fast-Food | 97b8bc17a470a72e2f0b4e6cfd539a4b4b66297b | [
"MIT"
] | null | null | null | src/utilities/storage.js | shegsteham/Fast-Food | 97b8bc17a470a72e2f0b4e6cfd539a4b4b66297b | [
"MIT"
] | 1 | 2021-04-11T16:18:54.000Z | 2021-04-11T16:18:54.000Z | /* eslint-disable no-template-curly-in-string */
const storage = (store, data) => {
const initial = JSON.parse(localStorage.getItem(`${store}`));
if (initial) {
const update = JSON.stringify(initial.concat(data));
localStorage.setItem(`${store}`, update);
return initial.concat(data);
}
const update = JSON.stringify(data);
localStorage.setItem(`${store}`, update);
return data;
};
export default storage;
| 25.470588 | 63 | 0.676674 |
0179f66b8146201a77bb70500ceb8226587a20e4 | 1,061 | js | JavaScript | client/src/components/Dashboard/Highscore.js | 1dv611-softhouse/softhouse | 0361aac9c14be0c0a9cc6b0442ecf95e850bd32e | [
"MIT"
] | null | null | null | client/src/components/Dashboard/Highscore.js | 1dv611-softhouse/softhouse | 0361aac9c14be0c0a9cc6b0442ecf95e850bd32e | [
"MIT"
] | null | null | null | client/src/components/Dashboard/Highscore.js | 1dv611-softhouse/softhouse | 0361aac9c14be0c0a9cc6b0442ecf95e850bd32e | [
"MIT"
] | null | null | null | /**
* The highscore component.
*
* @version 1.0.0
*/
import '../../styles/highscore.css'
import { useEffect, useState } from 'react'
function Highscore() {
const [highscores, setHighscores] = useState([])
/**
* Fetches the best 10 highscores from the database the first time components renders.
*/
useEffect(() => {
fetch('https://irv6hogkji.execute-api.eu-west-1.amazonaws.com/Production')
.then((response) => response.json())
.then((data) => {
const sortedHighscores = data.body.Items.sort(
(a, b) => b.score - a.score
).slice(0, 10)
setHighscores(sortedHighscores)
})
}, [])
return (
<div className="highscore-container">
<h1 className="highscore-header">Highscore</h1>
<ol className="highscore-list">
{highscores.map((highscore, index) => {
return (
<li key={index}>
{highscore.username} <span>{highscore.score}</span>
</li>
)
})}
</ol>
</div>
)
}
export default Highscore
| 23.577778 | 88 | 0.572102 |
017a2b976634d399894b1efe5d27b5b0f106a54b | 706 | js | JavaScript | src/routes/index.js | pl12133/uscensus-data-map | 3bfc8f5b28fdf7c73cad588e87fa3773ec941037 | [
"MIT"
] | 1 | 2020-09-10T20:54:29.000Z | 2020-09-10T20:54:29.000Z | src/routes/index.js | pl12133/uscensus-data-map | 3bfc8f5b28fdf7c73cad588e87fa3773ec941037 | [
"MIT"
] | 1 | 2020-09-10T21:03:38.000Z | 2020-09-10T21:03:38.000Z | src/routes/index.js | pl12133/uscensus-data-map | 3bfc8f5b28fdf7c73cad588e87fa3773ec941037 | [
"MIT"
] | 1 | 2020-09-10T20:54:34.000Z | 2020-09-10T20:54:34.000Z | /* eslint-disable no-unused-vars*/
import React from 'react';
/* eslint-enable no-unused-vars*/
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import HomePage from 'containers/HomePage/';
import About from 'containers/About/';
import Page404 from 'containers/Page404/';
import DataMap from 'containers/DataMap';
import App from 'containers/App/';
const Routes = () => (
<Router history={browserHistory}>
<Route path='/' component={App}>
<IndexRoute component={HomePage} />
<Route path='about' component={About} />
<Route path='map' component={DataMap} />
<Route path='*' component={Page404} />
</Route>
</Router>
);
export default Routes;
| 28.24 | 73 | 0.68272 |
017dc3a73598db2b5559cf11a33ac4d1235d24ad | 2,685 | js | JavaScript | node_modules/@jsonforms/core/lib/reducers/i18n.js | Chrisphyne/performance-monitoring | c60e460bccbe73205b8b08eec7f791e946b82af1 | [
"Apache-2.0"
] | null | null | null | node_modules/@jsonforms/core/lib/reducers/i18n.js | Chrisphyne/performance-monitoring | c60e460bccbe73205b8b08eec7f791e946b82af1 | [
"Apache-2.0"
] | null | null | null | node_modules/@jsonforms/core/lib/reducers/i18n.js | Chrisphyne/performance-monitoring | c60e460bccbe73205b8b08eec7f791e946b82af1 | [
"Apache-2.0"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/*
The MIT License
Copyright (c) 2017-2019 EclipseSource Munich
https://github.com/eclipsesource/jsonforms
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var actions_1 = require("../actions");
var __1 = require("..");
var initState = {
locale: undefined,
localizedSchemas: new Map(),
localizedUISchemas: new Map()
};
exports.i18nReducer = function (state, action) {
if (state === void 0) { state = initState; }
switch (action.type) {
case actions_1.SET_LOCALIZED_SCHEMAS:
return tslib_1.__assign(tslib_1.__assign({}, state), { localizedSchemas: action.localizedSchemas });
case __1.SET_LOCALIZED_UISCHEMAS:
return tslib_1.__assign(tslib_1.__assign({}, state), { localizedUISchemas: action.localizedUISchemas });
case actions_1.SET_LOCALE:
return tslib_1.__assign(tslib_1.__assign({}, state), { locale: action.locale === undefined ? navigator.languages[0] : action.locale });
default:
return state;
}
};
exports.fetchLocale = function (state) {
if (state === undefined) {
return undefined;
}
return state.locale;
};
exports.findLocalizedSchema = function (locale) { return function (state) {
if (state === undefined) {
return undefined;
}
return state.localizedSchemas.get(locale);
}; };
exports.findLocalizedUISchema = function (locale) { return function (state) {
if (state === undefined) {
return undefined;
}
return state.localizedUISchemas.get(locale);
}; };
//# sourceMappingURL=i18n.js.map | 40.681818 | 147 | 0.70987 |
017f96432cabc1bdf1e3e080aacbea9818528dd4 | 445 | js | JavaScript | client/src/components/SongButton/SongButton.js | jnel-221/kARaoke | d6251f89effea9682b01bf319beb1f8c665141dd | [
"MIT"
] | 2 | 2021-05-07T02:17:58.000Z | 2021-05-08T17:36:50.000Z | client/src/components/SongButton/SongButton.js | jnel-221/kARaoke | d6251f89effea9682b01bf319beb1f8c665141dd | [
"MIT"
] | 3 | 2021-05-20T00:46:32.000Z | 2021-05-25T00:55:12.000Z | client/src/components/SongButton/SongButton.js | jnel-221/kARaoke | d6251f89effea9682b01bf319beb1f8c665141dd | [
"MIT"
] | 4 | 2021-05-08T18:45:02.000Z | 2021-06-03T20:42:41.000Z | import React from "react";
import "./style.css";
function SongButton({ id, title, costume, cover, src, filter, handleClick }) {
// console.log("songbutton props: ", id, title, costume, src, filter)
return (
<>
<div className={"class" + id} id={id} src={src} data-title={title} data-cover={cover} data-costume={costume} data-filter={filter} onClick={(e) => handleClick(e)}>{title} </div>
</>
);
}
export default SongButton;
| 31.785714 | 182 | 0.644944 |
018101e8d9647f187f6dbbf2216452f01bf61f54 | 6,550 | js | JavaScript | routes/catalogo.js | pamaco2/xplora | 5f4c4cdd17ff80c6c4fd387ff1f76c886ac336f2 | [
"MIT"
] | null | null | null | routes/catalogo.js | pamaco2/xplora | 5f4c4cdd17ff80c6c4fd387ff1f76c886ac336f2 | [
"MIT"
] | null | null | null | routes/catalogo.js | pamaco2/xplora | 5f4c4cdd17ff80c6c4fd387ff1f76c886ac336f2 | [
"MIT"
] | null | null | null | var express = require('express');
var router = express.Router();
var request = require('request');
var bcrypt = require('bcrypt');
var EmailTemplate = require('email-templates');
var async = require('async');
var nodemailer = require('nodemailer');
var pug = require('pug');
var mcache = require('memory-cache');
var Datos = require('../config/setup');
var moment = require('moment');
var fs = require('fs');
/* gestión de usuario */
var User = require('../models/usuarios/usuarios').User;
var Privilegios = require('../models/privilegios/privilegios').Privilegios;
var Productos = require('../models/productos/productos').Productos;
var cache = (duration) => {
return (req, res, next) => {
let key = '__express__' + req.originalUrl || req.url
let cachedBody = mcache.get(key)
if (cachedBody) {
res.send(cachedBody)
return
} else {
res.sendResponse = res.send
res.send = (body) => {
mcache.put(key, body, duration * 1000);
res.sendResponse(body)
}
next()
}
}
}
/* GET users listing. */
router.get('/', function(req, res, next) {
var nvlMetodo = 0; // Nivel del metodo (publico)
var privUser = 0;
bcrypt.hash(Datos.codejs, 10).then(function(hashedPassword)
{
if(req.session.privilegio) {privUser = req.session.privilegio;}
if(privUser < nvlMetodo){ res.render('errors/error401', {data:Datos, usuario: req.session, id:req.query.id || "", target: req.originalUrl || "" });}else
{
var query = Productos.find({});
//query.where(estado,true);
query.exec(function (err, docsAll) {
if(err){console.log('Error recuperando items');}
res.render('catalogo', {data:Datos, hash:hashedPassword, sesion: req.session, items: docsAll});
});
}
});
}); // --Cierre metodo
/* GET users listing. */
router.get('/item', function(req, res, next) {
var nvlMetodo = 0; // Nivel del metodo (publico)
var privUser = 0;
aliasItem = req.query.al;
bcrypt.hash(Datos.codejs, 10).then(function(hashedPassword)
{
if(req.session.privilegio) {privUser = req.session.privilegio;}
if(privUser < nvlMetodo){ res.render('errors/error401', {data:Datos, usuario: req.session.usuario, target: req.originalUrl || "" });}else
{
var query = Productos.findOne({"alias":aliasItem}, function (err, doc) { if(err){console.log('Error recuperando item');}
if(doc.length==0)
{
var id = "";var url = req.originalUrl || "";
res.render('errors/error404', {data:Datos, usuario: req.session.usuario, id:id, target: url });
}else{
res.render('item', {hash:hashedPassword,data:Datos, item:doc, sesion: req.session});
}
});
}
});
});
/* POST API de logueo por ajax */
router.post('/jslistasolicitudes', function(req, res, next) {
var nvlMetodo = 4; // Nivel del metodo (publico)
var privUser = 0;
var hash = "";
// Validando instancia
if(!bcrypt.compareSync(Datos.codejs ,req.body.hash)){ return res.send({estado:false,mensaje:"Error de instancia."});/* Error de instancia */ }else
{ // Reescribe privilegios del cliente si existe sesión
if(req.session.privilegio) {privUser = req.session.privilegio;}
// Validando privilegios del usuario
if(privUser<nvlMetodo){ res.send({estado:false,mensaje:"Privilegios insuficientes."});/* No autorizado (401) */ }else
{ // Comprobar captcha
var COOK = JSON.parse(req.cookies.listar_solicitudes);
var PAG = COOK.pagina * COOK.limit;
var PPAG = COOK.limit;
console.log(COOK)
var PAGS = 1;
var query = Cotizaciones.find({$or: [{nombre:new RegExp(COOK.texto, 'i') },{email:new RegExp(COOK.texto, 'i') }]});
query.sort('-creado');
query.exec(function (err, docsAll) {
if(err){console.log('Error recuperando solicitudes');}
var queryII = Cotizaciones.find({$or: [{nombre:new RegExp(COOK.texto, 'i') },{email:new RegExp(COOK.texto, 'i') }]});
var cantidadItems = docsAll.length;
if(cantidadItems>PPAG){
var factor = cantidadItems % PPAG;
PAGS = parseInt(cantidadItems / PPAG);
if(factor!=0)
{
PAGS++;
}
}
queryII.limit(PPAG);
queryII.skip(PAG);
queryII.sort('-creado');
queryII.exec(function (errr, docsSelect) {
if(errr){console.log('Error recuperando solicitudes');}
var registros = [];
for (i=0;i<docsSelect.length;i++) {
registros[i] = {
id:docsSelect[i]._id,
nombre:docsSelect[i].nombre,
email:docsSelect[i].email,
nota:docsSelect[i].nota,
estado:docsSelect[i].estado,
creado:moment(docsSelect[i].creado).format('DD-MM-YY HH:mm:ss'),
autor:docsSelect[i].autor,
vehiculo:docsSelect[i].vehiculo
}
}
res.json({estado:true, mensaje:'Petición completa', datos:registros, paginacion: PAGS, pagina: COOK.pagina});
res.end();
});
});
} // Comprobación de privilegios del usuario
} // Comprobación de hash(petición ajax)
}); // Cierre de método
/* POST API de logueo por ajax */
router.post('/jseliminarsolicitud', function(req, res, next) {
var nvlMetodo = 4; // Nivel del metodo (publico)
var privUser = 0;
// Validando instancia
if(!bcrypt.compareSync(Datos.codejs ,req.body.hash)){ return res.send({estado:false,mensaje:"Error de instancia."});/* Error de instancia */ }else
{ // Reescribe privilegios del cliente si existe sesión
if(req.session.privilegio) {privUser = req.session.privilegio;}
// Validando privilegios del usuario
if(privUser<nvlMetodo){ res.send({estado:false,mensaje:"Privilegios insuficientes."});/* No autorizado (401) */ }else
{ // Comprobar captcha
var idItem = req.body.id || '';
Cotizaciones.remove({_id: idItem}, function(error){
if(error){
res.send({estado:true,mensaje:"Error al intentar eliminar el registro."});
}else{
res.send({estado:true,mensaje:"Registro eliminado correctamente."});
}
});
} // Comprobación de privilegios del usuario
} // Comprobación de hash(petición ajax)
}); // Cierre de método
// crear un objeto de transporte reutilizable usando SMTP transport
var transporter = nodemailer.createTransport({
host: Datos.mail_smtp_host,
port: Datos.mail_smtp_port ,secure: false, // true for 465, false for other ports
auth: {user: Datos.mail_smtp_user, pass: Datos.mail_smtp_pass},
tls: { rejectUnauthorized: false}/* do not fail on invalid certs*/
});
module.exports = router;
| 29.504505 | 157 | 0.642595 |
0182055caeea9379b7bb623635f763f71fd43d78 | 1,122 | js | JavaScript | src/components/ProjectCreator.js | leegenes/protrackt-frontend | bc536a96800f065138f9c7826aa82be5f4f14774 | [
"MIT"
] | null | null | null | src/components/ProjectCreator.js | leegenes/protrackt-frontend | bc536a96800f065138f9c7826aa82be5f4f14774 | [
"MIT"
] | null | null | null | src/components/ProjectCreator.js | leegenes/protrackt-frontend | bc536a96800f065138f9c7826aa82be5f4f14774 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import './project_creator.css';
const ProjectCreator = (props) => {
const organizationOptions = props.organizations.orgs.map((organization) => {
return (
<option className="form-option"
key={organization.name}>
{ organization.name }
</option>
);
});
return (
<div className="project-creator-container">
<div className="section-header" id="creator-header">
Add a new project
</div>
<form className='project-creator-form'>
<input className="creator-field" name="project name" placeholder="Project Name"></input>
<br/>
<input className="creator-field" name="project description" placeholder="Project Description"></input>
<br/>
<select className="creator-field" name="organization">
<option className="form-option">Add a new organization</option>
{ organizationOptions }
</select>
</form>
</div>
)
}
export default ProjectCreator;
ProjectCreator.propTypes = {
organizations: PropTypes.object.isRequired
}
| 28.05 | 110 | 0.646168 |
0182a7ecc23dccbaf52e7fdb11cf7aee0c6a8434 | 811 | js | JavaScript | src/config_service.js | puresec/lambda-config-rules | 50a3a36ac47490e9e9457f5fedfc3edace7377e2 | [
"MIT"
] | 17 | 2018-10-18T05:12:56.000Z | 2021-08-11T20:09:10.000Z | src/config_service.js | puresec/lambda-config-rules | 50a3a36ac47490e9e9457f5fedfc3edace7377e2 | [
"MIT"
] | 1 | 2019-04-16T00:31:19.000Z | 2019-04-16T06:05:36.000Z | src/config_service.js | puresec/lambda-config-rules | 50a3a36ac47490e9e9457f5fedfc3edace7377e2 | [
"MIT"
] | 4 | 2018-12-03T17:19:54.000Z | 2021-06-17T12:36:46.000Z | 'use strict';
const AWS = require('aws-sdk');
require('./aws_sdk_hooks');
const config = new AWS.ConfigService({});
function chunkArray(myArray, chunk_size) {
let results = [];
while (myArray.length) {
results.push(myArray.splice(0, chunk_size));
}
return results;
}
async function putEvaluations(params) {
let evaluationsChunks = chunkArray(params.Evaluations, 100);
await Promise.all(evaluationsChunks.map(async (evaluationsChunk) => {
let result = await config.putEvaluations({
Evaluations: evaluationsChunk,
ResultToken: params.ResultToken,
TestMode: params.TestMode
}).promise();
if ('FailedEvaluations' in result && result.FailedEvaluations.length > 0) {
throw Error(JSON.stringify(result));
}
}));
}
module.exports = {
putEvaluations
};
| 23.171429 | 79 | 0.691739 |
0185f148794828c45e4160ff53511bc4f908a4bc | 2,684 | js | JavaScript | app/utils/wowhead/artifactCalculatorHash.js | pc035860/wow-ap-level | a9878d3a79ca8a41551d3a3010b242e36a4b13bc | [
"MIT"
] | 13 | 2017-04-05T06:05:12.000Z | 2019-03-24T14:15:05.000Z | app/utils/wowhead/artifactCalculatorHash.js | pc035860/wow-ap-level | a9878d3a79ca8a41551d3a3010b242e36a4b13bc | [
"MIT"
] | 15 | 2017-06-27T03:37:26.000Z | 2022-03-08T22:44:10.000Z | app/utils/wowhead/artifactCalculatorHash.js | pc035860/wow-ap-level | a9878d3a79ca8a41551d3a3010b242e36a4b13bc | [
"MIT"
] | 1 | 2017-08-24T07:33:27.000Z | 2017-08-24T07:33:27.000Z | /* eslint-disable */
import createArtifactStruct from './createArtifactStruct';
import { ARTIFACT_ITEMS, B64ARRAY } from './constants';
function r(z, u) {
var y = [];
for (var t = (u - 1); t >= 0; t--) {
y[t] = z & 15;
z = z >> 4
}
return y
}
function m(w) {
var v = [];
var u;
for (var t = 0; t < w.length; t += 2) {
u = w[t] << 4;
if (t + 1 < w.length) {
u |= w[t + 1]
}
v.push(u)
}
return v
}
function l(u) {
var w = 0
, v = 0;
for (var t = 0; t < u.length; t++) {
w = (w + u[t]) % 255;
v = (v + w) % 255
}
return [u.length, v, w]
}
function h(B) {
try {
if (window.btoa) {
return window.btoa(String.fromCharCode.apply(null, B)).replace(new RegExp("\\+","g"), B64ARRAY[62]).replace(new RegExp("/","g"), B64ARRAY[63]).replace(/=+$/, "")
}
} catch (v) {
void (0)
}
var t = "";
var C, z, y = 0;
var D, A, x, w = "";
var u = 0;
while (u < B.length) {
C = (u >= B.length) ? NaN : B[u++];
z = (u >= B.length) ? NaN : B[u++];
y = (u >= B.length) ? NaN : B[u++];
D = C >> 2;
A = ((C & 3) << 4) | (z >> 4);
x = ((z & 15) << 2) | (y >> 6);
w = y & 63;
if (isNaN(z)) {
x = w = 64
} else {
if (isNaN(y)) {
w = 64
}
}
t = t + B64ARRAY.charAt(D) + B64ARRAY.charAt(A) + B64ARRAY.charAt(x) + B64ARRAY.charAt(w);
C = z = y = 0;
D = A = x = w = ""
}
if (t.indexOf(B64ARRAY.charAt(64)) > 0) {
t = t.substr(0, t.indexOf(B64ARRAY.charAt(64)))
}
return t
}
export default function artifactCalculatorHash(artifactData) {
const artStruct = createArtifactStruct(artifactData);
var t, y = [];
y.push(2);
y = y.concat(r(artStruct.artifact, 2));
var w = 0
, z = [];
if (ARTIFACT_ITEMS.hasOwnProperty(artStruct.artifact)) {
for (t = 0; t < ARTIFACT_ITEMS[artStruct.artifact].relics.length && t < 4; t++) {
if (!artStruct.relics.hasOwnProperty(t)) {
continue
}
w |= Math.pow(2, t);
z = z.concat(r(artStruct.relics[t].item, 5))
}
}
y.push(w);
y = y.concat(z);
for (t in artStruct.powers) {
if (!artStruct.powers.hasOwnProperty(t)) {
continue
}
y = y.concat(r(parseInt(t, 10), 3));
y = y.concat(r(artStruct.powers[t], 2))
}
var u = m(y);
var v = l(u);
for (t = v.length - 1; t >= 0; t--) {
u.unshift(v[t])
}
return h(u)
}
| 24.851852 | 173 | 0.436289 |
0186268ac806bdac5b85bcc47245c06d4fbc63af | 292 | js | JavaScript | Rules/Captured.js | civ-clone/core-city | 9b97100f5804f11f93301b573d5d3730aef46ff3 | [
"MIT"
] | null | null | null | Rules/Captured.js | civ-clone/core-city | 9b97100f5804f11f93301b573d5d3730aef46ff3 | [
"MIT"
] | null | null | null | Rules/Captured.js | civ-clone/core-city | 9b97100f5804f11f93301b573d5d3730aef46ff3 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Captured = void 0;
const Rule_1 = require("@civ-clone/core-rule/Rule");
class Captured extends Rule_1.default {
}
exports.Captured = Captured;
exports.default = Captured;
//# sourceMappingURL=Captured.js.map | 32.444444 | 62 | 0.753425 |
01865dc15dce52ff17354ec2e94ce58c55dfdd18 | 4,006 | js | JavaScript | src/assets/iconfont/iconfont.js | 690243004/jqsv | 68c148815613358f916956b539f8783a61259bdd | [
"MIT"
] | 2 | 2020-04-13T14:53:34.000Z | 2020-08-13T13:51:59.000Z | src/assets/iconfont/iconfont.js | 690243004/jqsv | 68c148815613358f916956b539f8783a61259bdd | [
"MIT"
] | 5 | 2020-04-13T09:18:13.000Z | 2022-02-27T02:58:28.000Z | src/assets/iconfont/iconfont.js | 690243004/jqsv | 68c148815613358f916956b539f8783a61259bdd | [
"MIT"
] | null | null | null | !(function (d) {
let t,
a =
'<svg><symbol id="iconmoduanzuoyouzhankai_o" viewBox="0 0 1024 1024"><path d="M814.933333 512l-98.133333-98.133333 29.866667-29.866667 149.333333 149.333333-149.333333 149.333334-29.866667-29.866667 98.133333-98.133333H554.666667v-42.666667h260.266666zM209.066667 512H469.333333v42.666667H209.066667l98.133333 98.133333-29.866667 29.866667L128 533.333333 277.333333 384l29.866667 29.866667L209.066667 512z" fill="#444444" ></path></symbol><symbol id="iconicon-test" viewBox="0 0 1024 1024"><path d="M816.512 368.192l-55.36 32A285.632 285.632 0 0 1 800 544c0 158.816-129.184 288-288 288-106.368 0-199.264-58.144-249.12-144.16A285.856 285.856 0 0 1 224 544c0-158.816 129.216-288 288-288v96l192-128-192-128v96C317.92 192 160 349.888 160 544c0 64.064 17.504 124 47.52 175.808C268.48 824.96 381.984 896 512 896c194.112 0 352-157.92 352-352 0-64.064-17.472-124-47.488-175.808" fill="#181818" ></path></symbol><symbol id="iconicon-test1" viewBox="0 0 1024 1024"><path d="M512 896C299.936 896 128 724.064 128 512S299.936 128 512 128s384 171.936 384 384-171.936 384-384 384m0-832C264.96 64 64 264.96 64 512s200.96 448 448 448 448-200.96 448-448S759.04 64 512 64" fill="#181818" ></path><path d="M665.376 313.376L512 466.752l-153.376-153.376-45.248 45.248L466.752 512l-153.376 153.376 45.248 45.248L512 557.248l153.376 153.376 45.248-45.248L557.248 512l153.376-153.376z" fill="#181818" ></path></symbol><symbol id="iconicon-test2" viewBox="0 0 1024 1024"><path d="M512 896C299.936 896 128 724.064 128 512S299.936 128 512 128s384 171.936 384 384-171.936 384-384 384m0-832C264.96 64 64 264.96 64 512s200.96 448 448 448 448-200.96 448-448S759.04 64 512 64" fill="#181818" ></path><path d="M480 768h64v-288h-64zM512 272a48 48 0 1 0 0 96 48 48 0 0 0 0-96" fill="#181818" ></path></symbol><symbol id="icongengduo" viewBox="0 0 1024 1024"><path d="M298.666667 586.666667a74.666667 74.666667 0 1 1 0-149.333334 74.666667 74.666667 0 0 1 0 149.333334z m213.333333 0a74.666667 74.666667 0 1 1 0-149.333334 74.666667 74.666667 0 0 1 0 149.333334z m213.333333 0a74.666667 74.666667 0 1 1 0-149.333334 74.666667 74.666667 0 0 1 0 149.333334z" ></path></symbol></svg>',
e = (t = document.getElementsByTagName('script'))[
t.length - 1
].getAttribute('data-injectcss')
if (e && !d.__iconfont__svg__cssinject__) {
d.__iconfont__svg__cssinject__ = !0
try {
document.write(
'<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>'
)
} catch (t) {
console && console.log(t)
}
}
!(function (t) {
if (document.addEventListener)
if (~['complete', 'loaded', 'interactive'].indexOf(document.readyState))
setTimeout(t, 0)
else {
var e = function () {
document.removeEventListener('DOMContentLoaded', e, !1), t()
}
document.addEventListener('DOMContentLoaded', e, !1)
}
else
document.attachEvent &&
((o = t),
(i = d.document),
(l = !1),
(a = function () {
try {
i.documentElement.doScroll('left')
} catch (t) {
return void setTimeout(a, 50)
}
n()
})(),
(i.onreadystatechange = function () {
'complete' == i.readyState && ((i.onreadystatechange = null), n())
}))
function n() {
l || ((l = !0), o())
}
let o, i, l, a
})(function () {
let t, e, n, o, i, l
;((t = document.createElement('div')).innerHTML = a),
(a = null),
(e = t.getElementsByTagName('svg')[0]) &&
(e.setAttribute('aria-hidden', 'true'),
(e.style.position = 'absolute'),
(e.style.width = 0),
(e.style.height = 0),
(e.style.overflow = 'hidden'),
(n = e),
(o = document.body).firstChild
? ((i = n), (l = o.firstChild).parentNode.insertBefore(i, l))
: o.appendChild(n))
})
})(window)
| 62.59375 | 2,152 | 0.636046 |
0186ae855e78af0cb077823976f135e93bb1d4f1 | 51 | js | JavaScript | packages/@memserver/cli/src/commands/sync.js | izelnakri/memserver | 3db14525db59923d6433322190dfd392c68e24cb | [
"MIT"
] | 10 | 2018-01-28T15:42:24.000Z | 2021-06-14T03:47:46.000Z | packages/@memserver/cli/src/commands/sync.js | izelnakri/memserver | 3db14525db59923d6433322190dfd392c68e24cb | [
"MIT"
] | 204 | 2019-12-30T05:07:10.000Z | 2022-03-30T11:07:01.000Z | packages/@memoria/cli/src/commands/sync.js | izelnakri/memoria | b2bc01c12d4ec8cc83da27c80878166a6928526f | [
"MIT"
] | 1 | 2020-08-31T04:42:07.000Z | 2020-08-31T04:42:07.000Z | // TODO: this should target URL or post init state
| 25.5 | 50 | 0.745098 |
0187a9371547f0fe574512ddd1bb3fbe8e019154 | 1,559 | js | JavaScript | Programadorabordo/05-operadores-logicos.js | wrico/CursoJS | 3cea9e393104cafd016faf60a6591ae995328012 | [
"MIT"
] | null | null | null | Programadorabordo/05-operadores-logicos.js | wrico/CursoJS | 3cea9e393104cafd016faf60a6591ae995328012 | [
"MIT"
] | null | null | null | Programadorabordo/05-operadores-logicos.js | wrico/CursoJS | 3cea9e393104cafd016faf60a6591ae995328012 | [
"MIT"
] | null | null | null |
var a = true;
var b = false;
console.log(!a);
console.log(!b);
console.log('!!a', !!a);
console.log('!!b', !!b);
// null, undefined, '', false, 0
//
console.log(!!null);
console.log(!!undefined);
console.log(!!'');
console.log(!!0);
console.log(!!'texto');
console.log(!!20);
console.log(10 && 'texto' && 'Programador');
console.log(null && 'Programador a Bordo');
console.log('Passa' && 0 && 'Dev');
console.log('Passou' && null);
console.log('Passou' && 0);
console.log("false" && 100 && '' && 'teste' && null);
console.log(10 > 5 && 7 < 10);
console.log(10 > 5 && 10 > 11);
console.log(null || 'Programador a Bordo');
console.log(null || 'Programador a Bordo' || 26);
console.log(null || '' || 26);
console.log('Programador a Bordo' || 'teste');
console.log(10 > 5 || 10 < 11);
console.log(10 > 11 || 12 > 11); // Procura e imprime o primeiro .T.
console.log(10 < 5 || 10 > 11);
console.log(null || false || 0);
console.log('Programador' && 2050 || '' && 26);
console.log('Programador' && 2050 && 'a Bordo' || 0);
console.log(null || !'' && 'Programador')
// isNaN ?
var valor = 1.5;
var teste = "a";
console.log(!isNaN(valor)); /* retorna false negando fica true, 1.5 é tipo numérico */
console.log(!isNaN(teste)); /* retorna true negando fica falso, "a" não é um número */
// Calcula IMC
var imc = function(peso, altura=1.83){
if (peso == null) {
console.log("peso não informado")
return 0
} else {
var vimc=peso/altura**2
console.log("IMC ->" , vimc.toFixed(2))
return vimc
}
}
imc(80)
| 18.783133 | 86 | 0.58948 |
0188532da5ee6b934743a3e0a151af82f978a421 | 289 | js | JavaScript | src/lib/__utils__/capitalize_multiple_words.js | anthonyjshaw/whodunnit | aa9b51b27a23861fa1165d62fb19bc816663fc64 | [
"MIT"
] | null | null | null | src/lib/__utils__/capitalize_multiple_words.js | anthonyjshaw/whodunnit | aa9b51b27a23861fa1165d62fb19bc816663fc64 | [
"MIT"
] | null | null | null | src/lib/__utils__/capitalize_multiple_words.js | anthonyjshaw/whodunnit | aa9b51b27a23861fa1165d62fb19bc816663fc64 | [
"MIT"
] | null | null | null | import { capitalize } from "./capitalize";
const capitalizeMultipleWords = (str) => {
if (str.split(' ').length === 1) {
return capitalize(str);
} else {
const sentence = str.split(' ');
return sentence.map(e => capitalize(e)).join(' ');
}
}
export { capitalizeMultipleWords }; | 24.083333 | 53 | 0.636678 |
018934a87c068383bc72a20e9df70959cf27a53d | 5,009 | js | JavaScript | src/node_modules/_datdot-service-helpers/load-feed.js | ninabreznik/service.js | f4e0f63253a576bd4b59ea0eb990ca1c49ad6159 | [
"MIT"
] | 2 | 2021-01-06T12:23:03.000Z | 2021-09-08T03:22:11.000Z | src/node_modules/_datdot-service-helpers/load-feed.js | ninabreznik/service.js | f4e0f63253a576bd4b59ea0eb990ca1c49ad6159 | [
"MIT"
] | null | null | null | src/node_modules/_datdot-service-helpers/load-feed.js | ninabreznik/service.js | f4e0f63253a576bd4b59ea0eb990ca1c49ad6159 | [
"MIT"
] | 2 | 2020-06-19T19:22:24.000Z | 2021-03-29T20:03:21.000Z | const hyperswarm = require('hyperswarm')
const hypercore = require('hypercore')
const RAM = require('random-access-memory')
const FeedStorage = require('_datdot-service-helpers/feed-storage.js')
const sub = require('subleveldown')
const ready = require('_datdot-service-helpers/hypercore-ready')
module.exports = load_feed
async function load_feed ({ newfeed, targets, role, swarmAPI, chainAPI, task_id, account, feedkey, next, onmessage, log }) {
const stringkey = feedkey.toString('hex')
const name = `datdot-hoster-${stringkey}`
var feed
var discovery
var ext
// if (newfeed) {
// feed = new hypercore(RAM, feedkey, { valueEncoding: 'binary', sparse: true })
// feed.on('error', async (err) => log({ type: 'feed', data: { text: 'feed: error', err } }))
// const discovery = await swarmAPI.join_topic({ swarmAPI, feed, role, account, mode: { server: false, client: true }, log })
// await storage.add_task(task_id, onconnection, log)
// }
if (account.cache[stringkey]) {
feed = account.cache[stringkey].feed
log({ type: role, data: { text: `Existing feed`, key: feed.key.toString('hex') } })
if (role === 'hoster') {
ext = account.cache[stringkey].ext
if (!ext) {
ext = feed.registerExtension(name, { encoding: 'binary ', onmessage, onerror })
log({ type: role, data: { text: `New extension`, stringkey } })
account.cache[stringkey].ext = ext
} else log({ type: role, data: { text: `Existing extension`, stringkey } })
if (!account.storages.has(stringkey)) {
log({ type: role, data: { text: `New storage for feed, existing cache`, stringkey } })
const db = sub(account.db, stringkey, { valueEncoding: 'binary' })
const storage = new FeedStorage({ db, feed, log })
account.storages.set(stringkey, storage)
}
}
account.cache[stringkey].tasks[task_id] = { onconnection, log }
} else {
feed = new hypercore(RAM, feedkey, { valueEncoding: 'binary', sparse: true })
await ready(feed)
feed.on('error', async (err) => log({ type: 'feed', data: { text: 'feed: error', err } }))
discovery = await swarmAPI.join_topic({ swarmAPI, feed, role, account, mode: { server: false, client: true }, log })
if (role === 'hoster') {
log({ type: role, data: { text: `New storage for feed, new cache`, stringkey } })
const db = sub(account.db, stringkey, { valueEncoding: 'binary' })
const storage = new FeedStorage({ db, feed, log })
account.storages.set(stringkey, storage)
ext = feed.registerExtension(name, { encoding: 'binary ', onmessage, onerror })
log({ type: role, data: { text: `New feed, new extension`, key: feed.key.toString('hex') } })
} else log({ type: role, data: { text: `New feed`, stringkey } })
console.log({ text: 'load_feed', feed })
account.cache[stringkey] = { feed, discovery, ext, tasks: { task_id: { onconnection, log } }, log }
}
async function onconnection (socket, protocolStream) {
const remotekey = socket.remotePublicKey
const remotestringkey = remotekey.toString('hex')
log({ type: role, data: { text: `onconnection callback`, role, task_id, feed: feed.key.toString('hex'), socket: socket.isInnitiator, remotestringkey, targets } })
if (targets) {
var targets_copy = [...targets]
log({ type: role, data: { text: `Target IDs`, targets } })
for (var i = 0, len = targets_copy.length; i < len; i++) {
const hosterID = targets_copy[i]
const hosterkey = await chainAPI.getHosterKey(hosterID)
log({ type: 'attestor challenge', data: { text: `Comparing keys`, hosterID, peer: remotekey.toString('hex'), hoster: hosterkey.toString('hex') } })
if (remotekey.equals(hosterkey)) {
log({ type: role, data: { text: `Calling next with hosterID`, role, id: hosterID, feed: feed.key.toString('hex') } })
feed.replicate(protocolStream)
targets_copy.splice(i, 1)
return next({ feed, hosterID, otherIsInitiator: socket.isInitiator, log })
}
}
} else {
log({ type: role, data: { text: `Calling next`, role, len: feed.length, ext: !ext ? 'undefined' : 'extension' } })
feed.replicate(protocolStream)
next({ ext, feed, otherIsInitiator: socket.isInitiator, log })
}
}
// function onmessage (perf_sig,hosterKey) {
// extensions[name].callbacks.forEach(done => done(null, perf_sig, hosterKey))
// }
function onerror (err/* peerSocket???*/) {
// TODO: disconnect from peer
log({ type: 'fail', data: 'err extension message' })
}
}
| 53.860215 | 171 | 0.586145 |