text stringlengths 7 3.69M |
|---|
import React, {
useEffect,
Fragment,
useState,
useRef,
} from 'react'
import {
View,
Text,
Image,
Keyboard,
FlatList,
TextInput,
TouchableHighlight,
} from 'react-native'
import { useDispatch, useSelector } from 'react-redux'
import { getNavigator } from '@configs/router'
import _ from 'lodash'
im... |
import React from 'react';
import {
Title,
TextBlock,
InvasivePotential,
Resources,
Resource,
Summary,
SexualReproduction,
AsexualReproduction,
EcologicalNiche,
PopulationDensity,
EnvironmentImpact,
ManagementMethod,
ManagementApplication,
OriginalArea,
SecondaryArea,
Introduction,
Breeding,
CaseImage... |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// #1 Array copying
exports.numbers = [1, 2, 3, 4, 5];
exports.originalNumbers = exports.numbers.map(number => number);
console.log("Original code #1:");
console.log(exports.originalNumbers);
// refactor here
exports.newNumbers = [...exports.n... |
Discourse.KbObjShowWithBreadcrumbController = Discourse.ObjectController.extend({
// loading flag, with initial settings
loading: null,
// KbObjPage instance that represents the list of related kb objs shown on the page
relatedObjPage: null,
// KbFilterBlock object for tags, to be used in the minifilter
t... |
function show (props, children) {
return props.when ? children : []
}
export default show
|
import React from 'react'
import Router from 'next/router'
import Head from 'next/head'
import Link from 'next/link'
import { NextAuth } from 'next-auth/client'
import Cookies from 'universal-cookie'
import Package from '../package'
import Styles from '../css/index.scss'
import Menu from './menu'
import CssBaseline fro... |
$(document).ready( function(){
//done [questao_id, 0|1] 0 errado, 1 certo
var done = [],
global_questao = {}
questaoselecionada = 5,
global_alternativas = [],
global_array = [],
num_questoes = 2;
localStorage.setItem('neuro4_certo', 0)
localStorage.setItem('neuro4_errado', 0)
$.getJSON("js/casos... |
module.exports = async function(context) {
// context.x_state; shareable var scope contents between commands and methods.
String.prototype.replaceAll = function(strReplace, strWith) {
// See http://stackoverflow.com/a/3561711/556609
var esc = strReplace.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
... |
import React from "react";
import {Card, Icon, Steps} from "antd";
const Step = Steps.Step;
const WithIcon = () => {
return (
<Card className="gx-card" title="With Icon">
<Steps>
<Step status="finish" title="Login" icon={<Icon type="user"/>}/>
<Step status="finish" title="Verific... |
let _prop = 0;
const AnimatedProperties = {
Rotation: {
X: _prop++,
},
Position: {
Y: _prop++,
Z: _prop++,
}
}
const HitType = {
Bookmark: _prop++,
}
window.onload = _ => {
const TAU = 6.283;
// l(inearly)-(int)erp(olates) between a and b based on ratio [0, 1] t
function ler... |
import React, { useCallback, useMemo } from 'react';
import { FormGroup, MenuItem } from '@blueprintjs/core';
import { Suggest } from '@blueprintjs/select';
import { useLocation, useSearch } from '../hooks';
import './PlaceSearch.scss';
export default React.memo(function PlaceSearch({ onSelectLocation }) {
const [lo... |
import { moduleFor, test } from 'ember-qunit';
moduleFor('model:endpoint');
//test('it exists', function(assert) {
// var model = this.subject();
// // var store = this.store();
// assert.ok(!!model);
//});
test('urlSegments break down URL properly', function (assert) {
var model = this.subject({
url: "http... |
/*
* TODO:
* When a key is found in .get(), be sure to set() it in all stores that do not have it
* this should be pretty easy because just need to set() in stores with index less than
* the index of the store that found it, and we don't care about the callbacks.
*/
var Queue = require('dank-queue'),
map =... |
import React, { Component } from 'react';
import { getValidationRules, testValidationRules } from './validation-rules';
const Validator = (ComposedComponent) => {
class ValidatorComponent extends Component {
constructor(props) {
super(props);
this.state = {
isValid: true,
validationMessage: '',
va... |
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Button,
ScrollView,
TextInput,
KeyboardAvoidingView,
Picker,
TouchableOpacity,
Dimensions,
} from 'react-native';
import {connect} from 'react-redux';
import {bindActionCreators } from 'redux'... |
import axios from "axios";
const URL = "https://cars-project-api.netlify.app/.netlify/functions/cars";
export const getCars = () => async (dispatch) => {
const { data } = await axios.get(URL);
dispatch({
type: "GET_CARS",
payload: data,
});
};
|
import Vue from "vue";
import Vuex from "vuex";
import moviesList from "./moviesList";
import search from "./search";
Vue.use(Vuex);
export default function () {
const Store = new Vuex.Store({
modules: {
moviesList,
search
}
});
return Store;
}
|
import React, { Component, useState } from "react";
import { Mutation, Query } from "react-apollo";
import gql from "graphql-tag";
import Router from "next/router";
import Form from "./styles/Form";
import formatMoney from "../lib/formatMoney";
import Error from "./ErrorMessage";
const SINGLE_POST_QUERY = gql`
query... |
`use strict`;
const secret = Array.from(document.getElementsByClassName('secret'))[0];
const navigation = Array.from(document.getElementsByTagName('nav'))[0];
let keys = [];
document.addEventListener('keypress', function(event) {
keys.push(event.code);
if(keys.length > 9) {
keys = keys.slice(- 9);
}
if(keys.join... |
define(['angular', 'jquery', 'rd.core', 'css!rd.styles.Input','css!rd.styles.FontAwesome', 'css!rd.styles.Bootstrap'], function() {
var inputApp = angular.module("rd.controls.Input", ['rd.core']);
inputApp.directive('rdkInput', ['Utils', 'EventService', 'EventTypes','$timeout', function(Utils, EventService, E... |
const db = require('../db/dreckl')
const abwesenheitDB = db.abwesenheit
const deleteAbwesenheit = (req, res) => {
abwesenheitDB.update(null, null, null, null, () => {
res.send('Reset "abwesenheit".')
})
}
module.exports = deleteAbwesenheit
|
import { Card } from "./Card";
export class Form {
constructor() {
this.form = document.querySelector('.form');
this.btn = document.querySelector('.btn');
this.form = document.querySelector('form');
this.titleInput = document.querySelector('.form__input--title');
this.descriptionInput = document.... |
/**
* Created by Osvaldo Miguel Junior on 22/07/15.
*/
var path = require('path');
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var rtcLogin = require('./rtc/rtcLoginManager.js');
var banco = require('./db/');
var fs = r... |
//线程间不像进程之间那样存在很大的独立性,一个进程的多个线程共享进程内部的很多资源,线程间可以互写对方的堆栈,
//而不同的进程则无法对其他进程的地址空间进行写操作。因此,在实现多线程编程中,应设计合理的同步通信机制,避免数据冲突的现象发生。
//每次fork都是独立全新的进程,有独立全新的v8,每次至少要30毫秒和10mb内存。
const fork = require('child_process').fork; //复制进程
const cpus = require('os').cpus(); //系统多核CPU数量 一般多少核就是多少进程
process.on('message', f... |
/** 设置取月份日期控件 */
function setMonthDate(){
//设置月份 只能选择年和月
$('#month').datebox({
onShowPanel: function () {//显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层
span.trigger('click'); //触发click事件弹出月份层
if (!tds) setTimeout(function () {//延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔
td... |
$(function(){
showProblem();
$("#problem_btn_create_save").on("click",function(){
alert(123);
addProblem();
});
$(".data-table").on("click", ".problem_btn_edit", function () {
var problem=null;
var problem = $(this).parent().parent().data("problem");
alert(problem);
$("#pr... |
const alphabeticShift = inputString => {
const abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a'];
return inputString.split('').map(x => abc[abc.indexOf(x)+1]).join('');
}
// const alphabeticShift = inputString => {
// return inputString.sp... |
var searchData=
[
['gfxprimitivesresizeactivity_2ejava',['GfxPrimitivesResizeActivity.java',['../_gfx_primitives_resize_activity_8java.html',1,'']]],
['gridbackgrounddrawable_2ejava',['GridBackgroundDrawable.java',['../_grid_background_drawable_8java.html',1,'']]]
];
|
const changeImage = () => {
'use strict';
document.addEventListener('mouseover', (event) => {
if(event.target.matches('.command__photo')){
event.target.src = event.target.dataset.img;
}
});
document.addEventListener('mouseout', event => {
if(event.target.matches('.com... |
function runTest()
{
FBTest.openNewTab(basePath + "console/5945/issue5945.html", function(win)
{
FBTest.openFirebug(function()
{
FBTest.enableConsolePanel(function(win)
{
FBTest.setPref("showCSSErrors", true);
var config = {tagName: "div",... |
import React from "react";
import "bootstrap/dist/css/bootstrap.min.css";
import { Modal} from "react-bootstrap";
const ModalContainer = ({ children, openModal, closeModal }) => {
return (
<Modal size="sm"show={openModal} onHide={closeModal} animation={false} >
{children}
</Modal>
);
};
ex... |
app.service('firebaseService', ['$q', function($q) {
var auth;
var storage;
var database;
var fire;
var config = {
apiKey: "AIzaSyCgHMiZtZJ0dlr2EsRTGvqZIw8aunROeEw",
authDomain: "template-91ca8.firebaseapp.com",
databaseURL: "https://template-91ca8.firebaseio.com",
projectId: "template-91ca8"... |
$(function () {
$.ajax({
url: 'http://ec2-52-87-51-134.compute-1.amazonaws.com:3000/calories',
type: 'GET',
success: function (data) {
var chartProperties = {
"caption": "Calories Burned",
"subcaption": "In the Past Week",
"... |
/**
* Description: 登录页面交互
* Author: jiangfeng (jiangfeng@tomstaff.com)
* Update: 2013-07-31 10:38
*/
$(function($){
var conts = $('#J_steptip').html();
JEND.load('util.dialog', function() {
JEND.page.popbox({
content: conts,
callback: function(elm) {
_self._scrollBtn();
elm.find... |
/*
Introduction
Digital Cypher assigns to each letter of the alphabet unique number.
For example:
a b c d e f g h i j k l m
1 2 3 4 5 6 7 8 9 10 11 12 13
n o p q r s t u v w x y z
14 15 16 17 18 19 20 21 22 23 24 25 26
Instead of letters in encrypted word we write the corresponding... |
import React, { Component } from 'react';
class StopWatch extends Component {
constructor(props){
super(props);
this.state = {
secondsElapsed: 0,
};
this.timer = null;
}
handleStartClick() {
this.timer = setInterval( () =>
this.setState({
secondsElapsed: this.state.second... |
import React from "react";
import {configure, shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import withActiveItem from '../with-active-item/with-active-item.jsx';
const Movie = {
id: `1`,
title: `Orlando`,
img: `img/orlando.jpg`,
video: `https://download.blender.org/durian/trailer/sint... |
/**
* Record of all DOM elements in memory
*/
/*global define */
define([], function () {
'use strict';
var dom = {
canvas: null,
$canvas: null,
toolbar: null,
$toolbar: null,
toolbarUpload: null,
$toolbarUpload: null,
toolbarLayer: null,
$to... |
import './style/main.scss';
const headerItems = document.querySelectorAll('[data-rel]');
headerItems.forEach((item)=>{
item.addEventListener('click', (e)=>{
e.preventDefault();
let rel = document.querySelector(`.${e.target.getAttribute('data-rel')}`);
let menu = document.querySelector('.header__m_menu.o... |
var express = require('express');
var router = express.Router();
const yelp = require('yelp-fusion');
router.get('/', function (req, res) {
var YELP_ID = "CMtBgncyN7TNiZowQ-Lun5bL7_SpWyI7uwtFz_jz7WfKlTNS_hhp-L91vkKhk7uN8kcSzXiB9RG57PZHqYLW2Xgy7jeowqoc-hlJsnl-BfkYO2fNmozYwxlZ8DmwWnYx";
const client = yelp.clie... |
/* 🤖 this file was generated by svg-to-ts*/
export const EOSIconsHighlightAlt = {
name: 'highlight_alt',
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 5h-2V3h2v2zm-2 16h2v-2.59L19.59 21 21 19.59 18.41 17H21v-2h-6v6zm4-12h2V7h-2v2zm0 4h2v-2h-2v2zm-8 8h2v-2h-2v2zM7 5h2V3H7v2zM3 ... |
let codex = makeCodex();
let currentBook = null;
let currentChapter = null;
let currentPage = null;
$("#bookSelect").on("change", selectBook);
$("#chapterSelect").on("change", selectChapter);
$("#pageSelect").on("change", selectPage);
$(".pager").on("click", navigate);
for (book of codex.books) {
$("#bookSelect"... |
import React, { Suspense, useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import './index.css';
import Router from './navigation/Router';
if (process.env.NODE_ENV === 'production') {
console.log = () => {};
console.warn = () => {};
console.e... |
//Selecting Elements
const form = document.querySelector('form');
const loadingImg = document.querySelector('.loading-img');
const resultat = document.querySelector('.resultat');
// Add event listener to the form
form.addEventListener('submit',loadingImgFun);
// Display the loading image and using setTimeout method
... |
"use strict";
App.factory("ItemService", ["$http", "$q", function($http, $q){
var factory = {
fetchAllItems: fetchAllItems,
createItem: createItem,
updateItem: updateItem,
deleteItem: deleteItem,
showItem: showItem,
uploadFileToUrl: uploadFileToUrl
};
return... |
const fsExtra = require('fs-extra');
const fs = require('fs');
const pathConverter = require('path');
function genetatePath(path) {
if (!path) path = [];
try {
return pathConverter.join(__dirname + path.join('/'));
} catch (error) {
console.log(error);
return '';
}
}
async func... |
import React, { Component } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
export default class TableRow extends Component {
render() {
return (
<React.Fragment>
<tr>
<td>{this.props.user.username}</td>
<td>{this.props.user.name}</td>
<... |
const ObjectClass = require('./object');
const Bullet = require('./bullet');
const Constants = require('../shared/constants');
const { getRandomMath } = require('./utils');
class Player extends ObjectClass {
constructor(id, username, x, y) {
super(id, x, y, Math.random() * 2 * Math.PI, Constants.PLAYER_SPEED);
... |
import React from "react";
import styled from "@emotion/styled";
import { Button } from "../../components/Button";
import { Input } from "../../components/Input";
import PropTypes from "prop-types";
const PokePickerForm = styled.form`
display: flex;
flex-direction: column;
justify-content: center;
background-c... |
//Alissa Diaz h3 ©2016
function setup() {
createCanvas(1000,700);
background(0);
var j = 100;
var x = 500;
for(var y=1; y<700; y=y+20) {
fill(244, 202, 255, y*.1);
strokeWeight(5)
stroke(162, 0, 64)
ellipse(x, y, x-450, y*0.5)
fill(250, 0.1);
stroke(20, 115, 186)
strokeWeight(5)
... |
export default class ScoreComponent{
static score;
static start(){
ScoreComponent.score = 100;
}
static setScore(newScore){
ScoreComponent.score = newScore;
}
static getScore(){
return ScoreComponent.score;
}
static removeScore(amount){
ScoreCom... |
import React from 'react';
const getSeason = (lat, month) => {
let hemisphere;
if(lat > 0 ){hemisphere = 'Northern'}
else {hemisphere = 'Southern'}
if(hemisphere === 'Northern'){
if(month >= 0 && month <= 2 || month >= 9){
return 'Winter';
} else {
return 'Sum... |
"use strict";
/* global assert calculator */
/* comment out the following for the browser */
const assert = require("assert"); //always need this with node
const myExports = require("./app.js"); //with node need the name of your file with your functions here
const calculator = myExports.calculator; //do this for al... |
class Dustbin{
constructor(x,y,width,height){
var options = {
isStatic: true
}
this.bottomBody=Bodies.rectangle(x,y,width,height,options)
World.add(world,this.bottomBody)
this.leftBody=Bodies.rectangle(x-width/2,y-width/2,height,width,options)
World.add(w... |
'use strict';
/* Defines application and its dependencies */
var lostAndFoundApp = angular.module('lostAndFoundApp', ['ngRoute', 'chart.js']);
/* Configures URL fragment routing, e.g. #/product/1 */
lostAndFoundApp.config(function ($routeProvider) {
$routeProvider.
when('/', {templateUrl: 'partials/i... |
$(function() {
$('#tabs').tabs({
active: 0
});
$('.table tbody tr td .delete').click(function(){
var link = $(this);
$.confirm({
'title' : 'Подтверждение удаления',
'message' : 'Вы решили удалить пункт. <br />После удаления его нельзя будет восстановить! Продолжаем?',
... |
import React from "react";
import Button from "@material-ui/core/Button";
import { makeStyles, createStyles, Theme } from "@material-ui/core/styles";
import SearchIcon from "@material-ui/icons/Search";
import TextField from "@material-ui/core/TextField";
import IconButton from "@material-ui/core/IconButton";
impo... |
var canvas = document.getElementById("myCanvas1");
var ctx = canvas.getContext("2d");
ctx.font = "30px Arial";
ctx.fillText("Hello Bilal",10,50);
var canvas1 = document.getElementById("myCanvas2");
var ctx1 = canvas1.getContext("2d");
ctx1.font = "30px Arial";
ctx1.strokeText("Hello Bilal",10,50);
var canvas2 = docum... |
'use strict';
const Boom = require('boom');
const knex = require('../connection');
const _ = require('lodash');
function serializeAdminWaytasks (knexResult, queryString) {
let meta = knexResult[0];
let hasTasks;
if (knexResult.length === 0) {
// If no results were returned, the area doesn't exist
return... |
import React from 'react';
import cc from 'classcat';
import { useState, useEffect } from 'react';
import { useTagHolder } from '@hooks/useTagHolder';
import { supabase } from '@util/supabase';
export const TagSelecter = (props) => {
const { onChange = () => {} } = props;
const [tag, setTag] = useState([]);
cons... |
import Router from 'koa-router'
import {base_API} from '../config'
import UserController from '../Controller/UserController'
import ArticleController from '../Controller/ArticleController'
//引入文章相关的控制器
import checkToken from '../utils/checkToken'
const router = new Router()
router.get('/',async ctx=>{
ctx.body = '欢... |
import * as types from "../constants";
import { request, getHeader } from "../../utils/request";
import store from "../store";
export async function registerStudent(data, resolve = () => { }) {
const header = await getHeader();
store.dispatch({
type: types.REGISTER_STUDENT_API,
});
return request()
.po... |
/*There is a new alien language which uses the latin alphabet.
However, the order among letters are unknown to you.
You receive a list of non-empty words from the dictionary,
where words are sorted lexicographically by the rules of this new language.
Derive the order of letters in this language. */
/*Example 1:
Inp... |
const http = require('http')
const path = require('path')
const express = require('express')
const socketIo = require('socket.io')
const Readline = require('@serialport/parser-readline')
const SerialPort = require('serialport')
const app = express()
const server = http.createServer(app)
const io = socketIo.listen(se... |
let fs = require('fs');
let uuid = require('uuid');
let path = require('path');
let Hooks = require('../../../helpers/hooks');
let Files = require('../../../helpers/files');
module.exports = (GuiaDespacho) => {
GuiaDespacho.beforeRemote('asignarDocumentosFile', Hooks.beforeRemoteFormData);
/*cuerpo*/
Gui... |
import {throttle} from 'lodash';
export default Vue => {
class ReactiveListener {
constructor({ el, src, elRenderer, options }) {
this.el = el;
this.src = src;
this.elRenderer = elRenderer;
this.options = options;
this.state = {};
}
// 判断是否渲染
checkInView() {
let {to... |
$('.panel-footer-revenue').click(function () {
var today = new Date().toISOString().split('T')[0]
var a = new Date();
var yesterday = new Date(a.setDate(a.getDate() - 1)).toISOString().split('T')[0];
var params = {
start_date: yesterday,
end_date: today
}
MP.api.jql( function main() {
return... |
P.models.calendars = {}; |
import React, { useState } from 'react';
import { Table, Input, Form, Button, Popconfirm, DatePicker, Select, Divider, message } from 'antd';
import locale from 'antd/es/date-picker/locale/zh_CN';
import RiderModal from '@/components/RiderModal';
import { $axios } from '@/utils/interceptor';
import moment from 'moment... |
const express = require('express');
const server = express();
const PORT = 3002;
const Pool = require('pg').Pool;
//var pg = new pg.Pool(config);
const pool = new Pool({
user: 'postgres',
database: 'practicedocker',
password: 'password',
port: 5432
});
//const pool = new pg.Pool(pool)
//pg.connect('pos... |
(function () {
'use strict';
function getActiveCount() {
return 2;
}
function getConnections() {
return [
{
"name": "OracleDBConn",
"status": "Active",
"description": "Connection definition for Oracle DB",
"typ... |
import React from 'react'
import './App.css'
const Table = (props) => {
const { headers, rows } = props;
return (
<div>
<table className="table table-bordered table-hover">
<TableHeader headers={headers}></TableHeader>
<TableBody headers={headers} rows={rows}></TableBody>
</ta... |
export const getCommentsByCourseId = state => {
return state.comments.reduce(
(obj, t) => {
obj[t.course] = obj[t.course] || []
obj[t.course].push(t)
return obj
},
{}
)
}
export const getCoursesById = state => {
return state.courses.reduce(
(obj, t) => {
obj[t.id] = t
... |
'use strict';
var app = angular.module('app');
app.controller('chartItemFormatterCtrl', function appCtrl($scope) {
// data context
$scope.ctx = {
chart: null,
pts1: []
};
var ptsCount = 300;
for (var i = 0; i < ptsCount; i++) {
$scope.ctx.pts1.push({ x: 0.16 * i, y: Math... |
import Map from './map'
import Music from '../../music/music'
import GameEnd from './gameEnd'
import GameModal from './gameModal'
import DataBus from '../../databus'
import { ajax } from '../../base/ajax'
import DataStore from '../../base/helper';
let databus = new DataBus()
const screenWidth = window.innerWidth;
con... |
export function getNasaPics() {
return fetch('/api/nasa-mars')
.then(res => res.json())
}
export function getDailyPics() {
return fetch('/api/nasa-daily')
.then(res => res.json())
}
export function getRandomPic() {
return fetch('/api/')
.then(res => res.json())
}
// using GET
export function getMyD... |
const { GetPasswordHash, Find } = require("../useCases/User");
const { signIn } = require("../services/auth");
async function SignIn(req, res) {
try {
const { username, password } = req.body;
if (!username || !password)
return res.status(406).json({ error: "empty field" });
const exists = await F... |
// Задача 1
// let i = 3;
//
// while(i) {
// console.log( i-- );
// }
// ответ: 3 2 1
// Задача 2
// Префиксный вариант
// let i = 0;
// while (++i < 5) console.log(i);
//
// console.log("\n==============\n");
//
// // Постфиксный вариант
// i = 0;
// while (i++ < 5) console.log(i);
// Задача 3
// При помощи цик... |
import Head from 'next/head'
import Link from 'next/link'
import styles from '../styles/Home.module.css'
import Card from '../components/card'
import React, { useState} from 'react'
import { css } from '@emotion/react'
import Footer from '../components/footer'
import Navbar from '../components/navbar'
const Home = ()... |
var pad = function(num) {
return (num <= 9 ? ('0' + num) : num);
};
module.exports = function(timestamp) {
var date = new Date(timestamp);
var year = date.getFullYear();
var month = (date.getMonth() + 1);
var day = date.getDate();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.... |
const sign_in_btn = document.querySelector("#sign-in-btn");
const sign_up_btn = document.querySelector("#sign-up-btn");
const sign_in_btn_1 = document.querySelector("#sign-in-btn-1");
const sign_up_btn_1 = document.querySelector("#sign-up-btn-1");
const container = document.querySelector(".container-1");
sign_up_btn... |
// Write a function that takes CamelCase string and returns the string in snake_case notation.
// E.g. 'MoviesAndBooks' --> 'movies_and_books'
const camelCase = str => {
let newStr = str.split('');
newStr.map((letter, i) => {
if(newStr[i] === newStr[i].toUpperCase()) {
newStr[i] = newStr[i].toLo... |
let o = {},
p = {
a : 123
},
a = new WeakMap( [
[ o, '123213' ]
] );
// 通过key获取数据
console.log( a.get( o ) );
|
var longestCommonPrefix = function(strs) {
if (strs.length == 0) {
return "";
}
if (strs.length == 1) {
return strs[0];
}
// ["flower","flow","flight"]
let result = "";
let limit = strs.length;
let charIndex = 0;
while (true) {
let prev = strs[0][charIndex];
for (let i = 1; i < limit; ... |
import React from 'react'
import { Point } from './HoverPoint'
import { meterDistance } from '../utils/grid'
const MARGIN = 10
function DistanceDot( { position, previous } )
{
if ( !position )
{
return null
}
return (
<g>
<Point position={ position } />
{ ... |
export default {
name: 'Winchester',
bio: 'Winchester grew up in a colony of peaceful mousefolk nomads. Young and yearning for adventure, he left his colony and ventured to the city. After getting tied up in a criminal ring he longed to return to his family and began to search for them. Shortly into his search he s... |
// Color varialbes
const BLACK = '#000000'
const WHITE = '#ffffff'
const RED = '#f44'
const BLUE = '#1989fa'
const ORANGE = '#ff976a'
const ORANGE_DARK = '#ed6a0c'
const ORANGE_LIGHT = '#fffbe8'
const GREEN = '#07c160'
const GRAY = '#c8c9cc'
const GRAY_LIGHT = '#e5e5e5'
const GRAY_DARKER = '#7d7e80'
const GRAY_DARK = '... |
import React from 'react';
import { shallow } from 'enzyme';
import renderer from 'react-test-renderer';
import RepoItem from './RepoItem';
import { repos } from './../ReposList/repos';
describe('RepoItem suite', () => {
it('should render the RepoItem component', () => {
const comp = <RepoItem repo={repos[0]} /... |
const assert = require('assert')
const { create, sign_transaction } = require('./keypair.js')
const { Transaction, SignedTransaction } = require('./types.js')
const { prefix_remove, prefix_prepend, to_buffer } = require('./utils.js')
describe('utils', () => {
describe('keypair.js', () => {
it('create()', () => {
... |
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
render() {
return (
<Html lang="es">
<Head>
<link async rel="preconnect" href="https://fonts.gstatic.com" />
<link async rel="preconnect" href="https://fonts.googleapis.com... |
Trix.config.blockAttributes['code'] = {
tagName: 'cb',
terminal: 'true',
text: {
plaintext: true
}
};
Trix.config.textAttributes['code2'] = {
tagName: 'code',
terminal: 'true',
text: {
plaintext: true
}
};
Trix.config.blockAttributes['pre'] = {
t... |
//recurso do ES2015
const pessoa = {
nome: 'Ana',
idade: 5,
endereco:{
logradouro: 'Rua ABC',
numero: 1000
}
}
//operador de Destructuring
const{nome , idade} = pessoa //tirar de dentro do objeto pessoa o nome e a idade
console.log(nome,idade)
const{nome: n, idade: i} = pessoa //tira... |
import { sum, avg } from "./math"
const LinearRegression = (data) => {
let
x_avg, // average of independent variable x
y_avg, // average of dependent variable y
num, // numerator : Sum of (xi - x)(yi - y)
den, // denominator : (xi - x)**2
m, // slope
b, // intercept
sse //... |
var yaml = require('yamljs'),
config = yaml.load('./gulp/config.yml')
;
if(!config.tasks.fonts) return
var browserSync = require('browser-sync'),
changed = require('gulp-changed'),
gulp = require('gulp'),
path = require('path')
;
var paths = {
src: path.join(config.root.src, config.ta... |
import Header from '../components/Header'
import Footer from '../components/Footer'
export default {
name: 'Home',
data() {
return {
step: 1000,
seconds: 1,
date: new Date().toLocaleString()
}
},
components: {
Header,
Footer
},
mounted() {
this._updateDate()
},
... |
/**
* Capitalize a string.
*/
export const capitalize = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
};
export function isUndefined (value) {
return typeof value === 'undefined' || value === undefined;
} |
let lat, long;
function initMap() {
// The location of Uluru
const copenahgen = { lat: 55.71, lng: 12.57 };
// The map, centered at Uluru
const map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: copenahgen,
});
infoWindow = new google.maps.InfoWindow(... |
//如果是手机端登入 则跳转到手机端
function CheckMobileAndRedirect(url)
{
if (CheckIsMobile() && url!=null && url!='' && url!=undefined)
{
window.top.location = url;
}
}
//如果是手机端登入 则将下载地址改为手机的
function CheckMobileAndReplaceUrl(url) {
if (CheckIsMobile() && url != null && url != '' && url != undefin... |
/**
* eskinView module : Canvas Drawing and manipulation goes here
* this is private module wont be exposed outside the library
*/
/**
* Creates eskinView object
* @constructor
* @param {String} rootElem rootDiv( fully qulified jquery selector) in which this model will be rendered
*/
function eskinView(rootElem... |
import React from 'react'
import { View, StyleSheet } from 'react-native'
import Paddings from '../Enums/Paddings'
import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
import AppColors from '../Colors/AppColors';
export default Avatar = props => {
return (
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.