blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
cc36928c86ec3827c1aa1b79ebbab04da9ce7706 | JavaScript | viraj1607/assign1 | /src/App.js | UTF-8 | 1,255 | 2.515625 | 3 | [] | no_license | import {Component} from "react";
import Func from "./components/func"
import Clss from "./components/clss";
class App extends Component{
state={
cls:false,
func:false,
};
render(){
return(
<div className="App">
<h1 className="heading"> Styling using Functional and Class Component</h1>... | true |
8af3cdceeec75b407aec3f926c02863753570768 | JavaScript | reidmit/scrabbler | /src/trie-builder.js | UTF-8 | 4,581 | 3.015625 | 3 | [] | no_license | var fs = require('fs');
//32176105 bytes (32.2 mb - lol)
// some naive things: every child initialized to {}, children prop, $ prop (bool), _ prop
// fixes: children only init when needed, children renamed to _
// way faster!
//3307411 bytes (3.3 mb - a whole order of magnitude better)
//fixes: got rid of _ prop, ... | true |
f807a11f8d50d6fb593f45e70cd6ef92b1ce6552 | JavaScript | pubannotation/textae | /src/lib/Editor/AnnotationData/ModelContainer/index.js | UTF-8 | 1,531 | 2.546875 | 3 | [
"MIT"
] | permissive | export default class ModelContainer {
constructor(emitter, name) {
this._emitter = emitter
this._name = name
this._container = new Map()
}
_toModel(rowDatum) {
return rowDatum
}
addSource(source, type) {
for (const instance of source.map((r) => this._toModel(r, type))) {
this._addT... | true |
949a199fc6c1ddc63c9c08b54bd0c2ba736d80d4 | JavaScript | chatiana/cakesOclock2 | /routes/products.js | UTF-8 | 4,176 | 2.546875 | 3 | [] | no_license | /*
* GET products listing.
*/
exports.list = function(req, res){
req.getConnection(function(err,connection){
var queryString = 'SELECT p.*, c.cat_name cat_name, MIN(ps.price) min_price FROM products p INNER JOIN categories c USING (cat_id) INNER JOIN product_size ps ON ps.product_id = p.id GROUP BY ... | true |
d3c14a99962cbec2171c197776417aece5ba95cc | JavaScript | amiv-eth/amiv-website | /src/models/language.js | UTF-8 | 4,922 | 2.53125 | 3 | [
"ISC"
] | permissive | import m from 'mithril';
import i18next from 'i18next';
import LngDetector from 'i18next-browser-languagedetector';
import german from '../languages/de';
import english from '../languages/en';
function setLanguageAttribute() {
document.documentElement.setAttribute('lang', i18next.language);
}
/**
* Check if a give... | true |
62526de89fd429f7c6f49658b917651c946d8d81 | JavaScript | maheeri/js120 | /lesson_2/function.js | UTF-8 | 177 | 3.40625 | 3 | [] | no_license | // NOTE: Run this code from a file; don't use the REPL
bar();
function bar() {
console.log("this is bar");
}
foo();
const foo = function() {
console.log("this is foo");
}; | true |
528294022ba92d0fd777ec1c8b387b0950ecc1d8 | JavaScript | Wayne-Bai/AST-normalize | /data/DamonOehlman/tile5/dist/engines/static.js | UTF-8 | 1,575 | 2.59375 | 3 | [] | no_license | /**
# GENERATOR: static
*/
T5.Registry.register('generator', 'static', function(params) {
params = T5.ex({
tiles: [],
loadTimeout: 10000
}, params);
/* internals */
function loadTileImage(tileData, callback) {
T5.getImage(tileData.url, function(image) {
// c... | true |
6a44b48e8a5cf65d7bef36e0baf3ab06ab041168 | JavaScript | kiminohero/TodoApp | /client/src/action/index.js | UTF-8 | 1,339 | 2.515625 | 3 | [] | no_license | import axios from "axios";
import {
ADD_TODO,
DELETE_TODO,
UPDATE_TODO,
DONE_TODO,
FETCH_TODO,
FETCH_USER
} from "./types";
export const fetchUser = () => async dispatch => {
const res = await axios.get("/api/current_user");
dispatch({
type: FETCH_USER,
payload: res.data.currentUser
});
};
e... | true |
7decfcad549d74da549d8dad12353d9eb0b0b0ca | JavaScript | natalieg/dci-javascript | /w6/1-event/script.js | UTF-8 | 370 | 2.9375 | 3 | [] | no_license | let btn = document.getElementById("myBtn");
let tog = 0;
btn.addEventListener("click", function(){
if(tog == 0){
this.style.backgroundColor = "rgb(240, 160, 240)";
this.style.fontSize = "20px";
tog = 1;
} else {
this.style.backgroundColor = "rgb(0, 205, 191)";
this.style... | true |
1227965f1d92e6939daf330eb97dc66b4155f56a | JavaScript | Quan-HHH/test | /exercise/flatten.js | UTF-8 | 499 | 3.9375 | 4 | [] | no_license | // 实现一个对象的 flatten 方法,如下
const obj = {
a: {
b: 1,
c: 2,
d: { e: 5 }
},
b: [1, 3, { a: 2, b: 3 }],
c: 3
}
const foo = function (obj) {
let resObj = {}
const helper = () => {
}
Object.keys(obj).forEach((key) => {
helper(key)
})
}
foo(obj)
// fl... | true |
cf4bf0ebceff26b6def7129a955e2b2139b80750 | JavaScript | acjones617/kiwi-node | /app/scripts/services/NumberParser.js | UTF-8 | 2,568 | 3.40625 | 3 | [] | no_license | 'use strict';
angular.module('KiwiApp')
.factory('NumberParser', function() {
/**
* Compares the original value to the rest of the values and
* processes is what is to be a valid format for the rest of the
* values.
* @param {[string]} original [the original value]
* @param {[array]} r... | true |
047c6f67267557c0fd62cc0aa8d542b114e4b565 | JavaScript | a1044187112/pure | /73h/__PUBLIC__/common/lib/i-pay/wx-pay.js | UTF-8 | 2,760 | 2.5625 | 3 | [] | no_license | // JavaScript Document
/*
微信支付类
静态类
*/
var WxPay = { //初始化对象
redirectUrl : "", //url
payParamStr : "", //支付参数字符串
btnSelr : "", //按钮选择器
//初始化数据,指定按钮选择器、跳转url、支付参数字符串
initData:function(btn_selr,re_url, param_str){
WxPay.redirectUrl = re_url;
WxPay.payParamStr = param_str;
//绑定按钮点击事件
WxPay.btnSelr = bt... | true |
8dde1d0dae22c0263d2f2fe682b697f0d0bbe8c9 | JavaScript | bovenson/mindshare | /static/mindmap/js/new-mind.js | UTF-8 | 3,357 | 2.5625 | 3 | [] | no_license | /* js 提交创建主题请求 */
var POST_NEW_MIND = {
actionUrl: '/new-mind/',
actionForm: '#newMindForm',
postSuccess: function (data) {
if (data['res'] === 'error') {
// 出错
var msg = data['msg'];
for (var i=0; i < msg.length; ++i) {
if (msg[i][1]) {
... | true |
15984825a1d63fa9e8f0bfc495ebf48fdca4ec7f | JavaScript | baekrxnn/giphy | /js/script.js | UTF-8 | 1,853 | 3.125 | 3 | [] | no_license | // *************************** YOUR CODE BELOW *******************************
//******************TEST EARLY AND OFTEN USING console.log() ******************
//****************** SERIOUSLY TEST USING console.log()!!! ******************
/* global $ */
let api_url= "https://api.giphy.com/v1/gifs/search?q=puppy&rating=g... | true |
6a0058f566a49e9022f095b628b3050b8e44c4f7 | JavaScript | VenelinGP/JavaScripts-Fundamentals | /Array Methods/3. Underage people/script.js | UTF-8 | 1,571 | 4.34375 | 4 | [
"MIT"
] | permissive | /**
* Created by NoName on 6/8/2015.
*/
/**
* 3. Underage people
*
* Write a function that prints all underaged persons of an array of person
* Use Array#filter and Array#forEach
* Use only array methods and no regular loops (for, while)
* */
function makePerson(fname, lname, age, gender) {
return {
... | true |
c1bae2b94092ee663857c53785f269396fbd36c4 | JavaScript | Lighthouse-Projects-2021/lotide | /eqObjects.js | UTF-8 | 1,785 | 4.1875 | 4 | [] | no_license | const assertEqual = function (actual, expected) {
if (actual === expected) {
console.log(`✅✅✅Assertion Passed: ${actual} === ${expected}`);
} else {
console.log(`🛑🛑🛑Assertion Failed: ${actual} !== ${expected}`);
}
};
const eqArrays = function (arr1, arr2) {
if (arr1.length !== arr2.length) {
retu... | true |
0c7b5e279e1b72cd15666cb123ce0c04d9411a01 | JavaScript | kenchoong/greenbook-app | /pages/api/location.js | UTF-8 | 3,164 | 2.796875 | 3 | [] | no_license | /* fetch and cache a users approximate city/state from ip */
import fetch from 'isomorphic-unfetch'
const AWS = require("aws-sdk");
AWS.config.update({
region: "us-east-2",
accessKeyId: process.env.AWS_ACCESSKEY_ID,
secretAccessKey: process.env.AWS_ACCESSKEY_SECRET
});
var docClient = new AWS.DynamoDB.DocumentC... | true |
bd0c94ee0889fd0754267ec7adfda500272c73be | JavaScript | mooree1892/stock-watch-list | /js/memory.js | UTF-8 | 1,487 | 2.546875 | 3 | [] | no_license | 'use strict';
/*Variables*/
var appmemory = new SR.AppMemory(SR.AppID, SR.UserID),
lists = {
ticker: {},
ticks: {}
};
/*Initiate AppMemory*/
appmemory.save('list',[
'AAPL',
'ARI',
'Z',
'GOOG',
'AA',
'A',
'TSLA'
]).then(function () {});
appmemory.save('settings',{
'companyname': true,
'number' : true,... | true |
a5c5ba2049309a5461131842865297af1fc9a6ba | JavaScript | chromium/chromium | /third_party/blink/web_tests/external/wpt/fetch/range/resources/utils.js | UTF-8 | 954 | 3.15625 | 3 | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"MIT",
"Apache-2.0"
] | permissive | function loadScript(url, { doc = document }={}) {
return new Promise((resolve, reject) => {
const script = doc.createElement('script');
script.onload = () => resolve();
script.onerror = () => reject(Error("Script load failed"));
script.src = url;
doc.body.appendChild(script);
})
}
function prel... | true |
a7fb39c12c26a2a3cd098cf48c7de75fb1b80be4 | JavaScript | likaiji/erzhizhuanzhuanwang | /public/javascript/index.js | UTF-8 | 6,657 | 2.953125 | 3 | [] | no_license | /**
* Created by Administrator on 2016/12/21.
*/
window.onload=function(){
/*轮播部分*/
/*定义函数*/
function index(n){
var index=0; //获取下标
/*定义方法*/
function scrollImg(index) {
var imgWidth=document.getElementById("m1").width;
//通过js改变左边距
document.getElementById("carouselContentTop").st... | true |
cd5001d3bb5f9dd6dce4561adcacc92dbf629201 | JavaScript | Moneebakiani/MWA | /Day09/Question1/meanPaintings/api/controller/reviews.controller.js | UTF-8 | 6,960 | 2.671875 | 3 | [] | no_license | const mongoose = require("mongoose");
const Painting = mongoose.model("Painting");
const addReview = function (req, res, painting) {
painting.reviews = painting.reviews ? painting.reviews : [];
painting.reviews.name = req.body.name;
painting.reviews.review = req.body.review;
painting.reviews.createdOn... | true |
d145a0913c7fe2e38dc02fb9f97373021e8cc56e | JavaScript | dslyvka/goit-js-hw-12-countries | /src/js/app.js | UTF-8 | 1,713 | 2.6875 | 3 | [] | no_license | import debounce from 'lodash.debounce';
import countryMarkup from '../countryMarkup.hbs';
import countriesMarkup from '../countriesMarkup.hbs';
import { error, defaults } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import '@pnotify/core/dist/BrightTheme.css';
defaults.delay = 2000;
const searchRef... | true |
422c9518f1a54512101a5f21655ebb7f6088ba08 | JavaScript | sali6798/README-generator | /generateREADME.js | UTF-8 | 2,413 | 3.15625 | 3 | [] | no_license | const axios = require("axios");
require("dotenv").config();
const config = { headers: { accept: "application/json", authorization: "token " + process.env.AUTH_TOKEN }};
function getUserInfo(username) {
return axios
// API call to github API using user's name
.get(`https://api.github.com/users/${use... | true |
70f660d06abb9f2a82215454149e90d29b54e4ad | JavaScript | javascript666666/class_example | /example/adddata&localstorge - 副本/js/index.js | UTF-8 | 2,884 | 2.828125 | 3 | [] | no_license | (function(){
function createLi(){
var li = document.createElement("li");
var str = '<div class="icon">'
+'<input type="checkbox" class="checkInput" />'
+'</div>'
+'<strong class="fileTitle" style="display:none;">新建文件夹</strong>'
+'<div class="clearFix edtor" style="display:block;">'
... | true |
f8fde15e7994ef18744a7e0279c67f863b565eea | JavaScript | Adnan-110/LetsUpgrade-JavaScript | /Day 4/Question_3_4.js | UTF-8 | 1,216 | 3.296875 | 3 | [] | no_license | let Student = [
{
name: "Abhishek",
age: 31,
country: "India",
hobbies: ["Swimming", "Dancing", "Cricket", "Workout"],
},
{
name: "Raj",
age: 22,
country: "India",
hobbies: ["Reading", "Dancing", "Cricket", "Workout", "Acting0"],
},
{
name: "Simran",
age: 19,
countr... | true |
83e4f128baf0435142b8c2e638597f812edfc19b | JavaScript | james-huston/sprocket | /lib/sprocketServer.js | UTF-8 | 1,998 | 2.515625 | 3 | [] | no_license | var axon = require('axon');
var emitter = require('events').EventEmitter;
var util = require('util');
module.exports = SprocketServer;
function SprocketServer(port) {
this.port = port || 14000;
emitter.call(this);
this.responder = axon.socket('rep');
this.responder.on('message', this.emitMessage.bind(this)... | true |
f50800d44b64a6463e7de942c2e9f264297a38ce | JavaScript | Francisco-Castro/js-for-zipcode | /js/09-for-loop.js | UTF-8 | 213 | 3.390625 | 3 | [] | no_license | let salaries = [65000, 70000, 75000];
let total = 0;
for (let i = 0; i < salaries.length; i++) {
total += salaries[i];
}
// for (const salary of salaries) {
// total += salary;
// }
console.log(total);
| true |
2ce52a6ac92ec5863577c833731d272bf2f24b45 | JavaScript | dodisutarya/javascript | /array-splice.js | UTF-8 | 175 | 2.671875 | 3 | [] | no_license | function panggilSplice(){
var kota = ['jakarta', 'medan', 'padang','malang'];
console.log(kota)
kota.splice(2,0,'bandung')
return kota
}
console.log(panggilSplice())
| true |
5035e3fed38816bb75dd9885707c0e0f68a2b9a7 | JavaScript | Automedon/Codewars | /6-kyu-part1/Sometimes.js | UTF-8 | 1,089 | 4.625 | 5 | [
"MIT"
] | permissive | /*
Description:
A function that works sometimes
This kata is heavily influenced by the Once kata. It just adds a few extra steps to test fundamentals.
Implement a function sometimes that takes another funciton as an argument and returns a new version of that function that will behave as the following:
// Example func... | true |
ad8474b1c92577bd7ea867219e8d7efea4c07255 | JavaScript | ihqn/vue-finance | /vue/asset/js/cw.js | UTF-8 | 12,359 | 2.515625 | 3 | [] | no_license | function getDate(url, cb) {
fetch(url)
.then(
function(response) {
if (response.status !== 200) {
console.log("存在一个问题,状态码为:" + response.status);
return;
}
//检查响应文本
response.json().then(functio... | true |
f49c8c3dae23529c59d33368db84a918d4e12607 | JavaScript | DevBrasil/hackacom-core-api | /src/controllers/User/methods/updatePassword.js | UTF-8 | 1,693 | 2.5625 | 3 | [] | no_license | const {
SALT_NUMBER
} = process.env
const exception = require('../../../middlewares/catchException');
const bcrypt = require('bcrypt');
const User = require('../../../models/User');
/**
* @api {put} /user/:id/password Atualizar senha de um usuário
* @apiVersion 1.0.0
* @apiName updatePassword
* @apiGroup Usuár... | true |
8a7b8f4ef850a370e443ecc34390e5ef84c927de | JavaScript | aandroomeedaa/h8-p0-w3 | /excercise5-PALINDROME.js | UTF-8 | 543 | 3.984375 | 4 | [] | no_license |
function palindrome(kata)
{
var status = true
var tampung=''
for(var i = kata.length -1; i>=0 ; i--)
{
tampung= tampung + kata[i]
}
if (tampung === kata)
{
status = true
}
else
{
status = false
}
return (status)
}
// TEST CASE... | true |
b61655852d2c2e56b9770aca8817670abe222693 | JavaScript | deadlysyn/fullstackbootcamp | /todolist/todos.js | UTF-8 | 892 | 3.125 | 3 | [] | no_license | // NOTE: use 'on' vs 'click' to ensure listeners are added
// to future items that get added to page. note trick of
// selecting ul then targeting the li within the call to 'on'.
// toggle todos
$("ul").on("click", "li", function() {
$(this).toggleClass("completed");
});
// delete todos
$("ul").on("click", "span"... | true |
6f86dba5ba9e0d968ab1e9674ade538b02a06e06 | JavaScript | sarita-coder/javascript | /Ejercicios_tipos_de_datos__variables_y_operadores/Ejercicios tipos de datos, variables y operadores/Ejercicio3 - Formato de output/Problema/main.js | UTF-8 | 889 | 2.9375 | 3 | [] | no_license | // Escribe aquí tu codigo Javascript
function formato_out(){
var nombre=prompt("Ingrese su nombre: ");
var apellido=prompt("Ingrese su primer apellido: ");
var ciudad=prompt("Ingrese el nombre de la ciudad: ");
alert("========================\n Hola "+nombre+" "+apellido+"\n Adios ha... | true |
6e9f685a939134283d965b32dba67d383245e28e | JavaScript | roryabraham/10am-processor | /tenAMProcessor.js | UTF-8 | 7,179 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env node
const _ = require('underscore');
const {existsSync, readFileSync} = require('fs');
const { exit } = require('process');
const parseCSV = require('csv-parse/lib/sync');
const YEARS = ['2019', '2020', '2021'];
const MONTHS = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', '... | true |
e4fc31cb0598ffcc25e8b4fea264ddb278b16018 | JavaScript | yared123yared/yared1 | /User_login_website(php)/user_login_application/new_login.js | UTF-8 | 1,744 | 2.78125 | 3 | [] | no_license | function submit(){
// alert("hey dude");
// var row_index_to_delete=" ";
// alert("login");
row_index_to_delete="";
var user_name=document.getElementById("name").value;
// alert(user_name);
var password=document.getElementById("pass").value;
// alert(password);
// alert("it is okay"... | true |
b4dcabc967afb37cad63147f105d3cdaa635232d | JavaScript | Serezon/Home_work | /react/my-app/src/App.js | UTF-8 | 2,477 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import Items from "./components/Items";
import Filters from "./components/Filters";
import Pagination from "./components/Pagination";
import useDebounce from "./hooks/useDebounce";
import NameSearch from "./components/NameSearch";
import "./App.css";
function App()... | true |
d02f7d1ab69942be2885a2291db9ef8a076c7249 | JavaScript | programmer-prashant/TQ_React_Assignments | /src/assignmemnts/props_state/StateDemo.jsx | UTF-8 | 443 | 2.953125 | 3 | [] | no_license | //8. WAP to generate following output using state and setstate
import React, { Component } from 'react';
export class StateDemo extends Component {
state = {
msg: 'Welcome Visitor',
};
render() {
return (
<div>
<h2>{this.state.msg}</h2>
<button
onClick={() => {
this.setState({
msg:... | true |
44b44ec8c61b6b813ef7d418d1d1d205ff4a83bd | JavaScript | favourch/student-is | /public/js/views/settings/terms.js | UTF-8 | 2,632 | 2.59375 | 3 | [
"MIT"
] | permissive | define([
'jquery',
'underscore',
'backbone',
'collections/users/terms',
'views/settings/term',
'text!templates/settings/terms.html',
'bootstrap',
'jqueryui'
], function($, _, Backbone, TermsCol, TermView, termsTpl){
var Terms = Backbone.View.extend({
tagName: 'div',
template: _.template(termsTpl),
e... | true |
01cdd5d2dd2d40a933258d106ce631ef635093cc | JavaScript | guymguym/noobaa-core | /src/test/unit_tests/test_nb_native_b64.js | UTF-8 | 1,373 | 2.625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | /* Copyright (C) 2016 NooBaa */
'use strict';
const mocha = require('mocha');
const assert = require('assert');
const crypto = require('crypto');
const nb_native = require('../../util/nb_native');
mocha.describe('nb_native b64', function() {
function b64(input) {
const input_b64 = input.toString('base64'... | true |
892c1dbd1a500ea23b653d4e60635cec38afedce | JavaScript | kporcelainluv/problems | /Leetcode/lettersOnPhone.js | UTF-8 | 367 | 3.125 | 3 | [] | no_license | var findDisappearedNumbers = function(nums) {
const n = nums.length;
nums.sort((a, b) => a - b);
const nums1 = [...new Set(nums)];
const res = [];
let i = 0;
let x = 1;
while (i < n && x <= n) {
if (nums1[i] !== x) {
res.push(x);
} else {
i += 1;
}
x += 1;
}
return res... | true |
28d28192cb8e048da07c35c94730e12db19caa17 | JavaScript | front-end-by-rimantas/19-grupe-portfolio-neuron | /js/components/shopCardsRender/shopCardRender.js | UTF-8 | 1,111 | 2.6875 | 3 | [
"MIT"
] | permissive | import { isValidShopCard } from "./isValidShopCard.js";
/**
* Funkcija kuri generuoja korteliu turini SHOP kortelems
* @param {string} selector CSS like selektorius, kaip rasti norima vieta turinio generavimui
* @param {Object} shopCardsData Sarasas objektu aprassanciu kiekviena shop Cards data
* @returns {*}
*/
f... | true |
fa2092af2e73fb1d5d83ead5364af69c71d18f63 | JavaScript | Ghanshyamjha85/tweEther | /client/components/utils/TweetBox.jsx | UTF-8 | 2,543 | 2.53125 | 3 | [] | no_license | import React from "react";
import { Button } from "@material-ui/core";
import { createTweet } from "../../web3/tweets"
import Avatar from "../Avtar";
class TweetBox extends React.Component {
state = {
text: "",
textCount: 0,
}
handleChange = e => {
var text = e.target.value
... | true |
7a90aef5be86611905f3900cafa2d136eeaf9df6 | JavaScript | lee-mihye/sichime | /js/linksys.js | UTF-8 | 1,014 | 2.703125 | 3 | [] | no_license | /// 버튼 클릭하면 원하는 위치로 이동 JS - linksys.js ///
$(function () { /////// jQB ///////////////////////
console.log("로딩완료!");
//////// 상단 코멘트 클릭시 하단 리뷰로 이동/////////
$(".comment").click(function (e) {
e.preventDefault();
var offset = $("#url_copy_2").offset();
$("html,body").animate({
... | true |
5aabbdef7f10c24b8615a4f13d92f3d65234d9f4 | JavaScript | bevanme/etch-a-sketch | /etch-a-sketch.js | UTF-8 | 2,111 | 3.671875 | 4 | [] | no_license | // select elements on page - canvas, shake button
const canvas = document.querySelector('#etch-a-sketch');
const ctx = canvas.getContext('2d'); // see three.js for examples of 3D
const shakebutton = document.querySelector('.shake');
const MOVE_AMOUNT = 10;
// set up our canvas for drawing
//const width = canvas.width;... | true |
b0ad6838c49a93c9240181bd9f1db78a1f4724d9 | JavaScript | baardvark/dstore | /client/src/components/Items.js | UTF-8 | 1,832 | 2.5625 | 3 | [] | no_license | import React from "react";
import axios from "axios";
import { Link, } from "react-router-dom";
import { Button, Card, Header, } from "semantic-ui-react";
class Items extends React.Component {
state = { items: [], };
componentDidMount() {
const { departmentId } = this.props
axios.get(`/api/departments/${d... | true |
7f38a0a406a3bab3cc44f9ad89cd1c147caadf5f | JavaScript | tmuz19/Trivia-Game | /assets/javascript/app.js | UTF-8 | 5,408 | 2.8125 | 3 | [] | no_license | var gameArea = $("#game-area");
var countStartNumber = 30;
$(document).on('click', '#start-over', function (e) {
startGame.reset();
});
$(document).on('click', '.answer-button', function (e) {
startGame.clicked(e);
});
$(document).on('click', '#start', function (e) {
$('#subcontainer').prepend('<h2>Time ... | true |
f7f46cbd488e4c9a08471a9d4cac06c0cc27cc54 | JavaScript | terryp/node_scratch | /learning/jsis/playing_with_functions/05_playing_with_functions.js | UTF-8 | 989 | 4.65625 | 5 | [] | no_license |
'use strict';
/*
You're not going to understand callbacks, if you don't understand functions!
Functions are first class citizens!
1. Put a function in a variable.
2. Put a function in a container / object.
*/
var util = require('util');
function what_are_you(a) {
console.log(typeof(a));
console.log(uti... | true |
9045be1780af7e50b38e4630e171d8c6500489e2 | JavaScript | eveborgia/udacity-p6-classic-arcade-game-clone | /js/app.js | UTF-8 | 3,035 | 3.53125 | 4 | [
"MIT"
] | permissive | (function () {
'use strict';
}());
const allEnemies = [];
const enemyLocation = [58, 140, 225];
let player;
// Enemies our player must avoid
const Enemy = function (x, y, speed) {
// Variables applied to each of the instances
this.x = x;
this.y = y;
this.speed = speed;
// The image/sprite for our Enemies
... | true |
41cc0acf88ffca989034653185c118d064464df7 | JavaScript | hugdubois/wk_job | /apps/wk_job_web/assets/js/services.js | UTF-8 | 1,221 | 2.515625 | 3 | [] | no_license | import PropTypes from "prop-types"
const apiBaseUrl = "/api/v1" // https://localhost:4000
const wsBbaseUrl = "" // ws://localhost:4000
const errorMessage = (code) => {
switch (code) {
case 400:
return "Bad Request"
case 404:
return "Not Found"
case 409:
return "Conflict"
case 422:
... | true |
9e17846c4cbb0300ffb3b20f8b8a679b4d3739dc | JavaScript | X20Network/x20-auction-contract | /test/big-auction.js | UTF-8 | 1,895 | 2.5625 | 3 | [] | no_license | const Auction = artifacts.require("Auction");
const FixedSupplyToken = artifacts.require("FixedSupplyToken");
contract('Auction', async (accounts) => {
it("should execute a big auction correctly", async () => {
let auction = await Auction.deployed();
let token = await FixedSupplyToken.deployed();
... | true |
ec53b4af6aa4259b623e2b81e5f0e1f0039797c6 | JavaScript | wso2/carbon-analytics | /components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/commons/js/utils/alerts.js | UTF-8 | 8,394 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
*/
define(['log', 'jquery', 'lodash'], function (log, $, _) {
var AlertsManager = {};
/**
* Shows success alert.
* Usage: success("Successfully done"), success({messag... | true |
ca2ac115f6967f6324d0ef1a3e787712b5590872 | JavaScript | farrukhayazqazi/tripmanual | /frontend/src/components/user/CreateBooking.jsx | UTF-8 | 10,344 | 2.8125 | 3 | [] | no_license | import React from 'react'
import { Component } from 'react';
import axios from 'axios';
class CreateBooking extends Component{
state = {
NumOfTravellers : 1,
travelersDetail: [{ firstName: '', lastName: '', address: '', city: '', address: '', phoneNumber: '', city: '', state: '', zip: ''}], ... | true |
30392e854623201321152b0444971b9b93719310 | JavaScript | AnthonyGIS/WebLayout | /L_WebLayout/Demos/弹窗/_遮罩/_水波动效果的遮罩/index.js | UTF-8 | 3,340 | 2.90625 | 3 | [] | no_license | // usage:
// Dialog.init('测试文字') //默认
// Dialog.init('测试文字',2000) //第二个参数时间,2秒后自动关闭
// Dialog.init('测试文字',{
// time : 1000, //自动关闭
// maskClick : false, //点击背景层是否关闭弹层
// mask : false, //是否显示遮罩
// title : '是否删除?', //添加标题
// index : 1, //设置索引,用于close方法
// addClass : 'bgRed', //追加class
// style : 'color:red', //追加cs... | true |
c61ccbd12f07b446a58511fc843c8eb084a80275 | JavaScript | OlehMarch/ort_csharp_js | /JavaScript/Bubbles/CollisionDetector.js | UTF-8 | 1,064 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | /********************* Collision detection ******************** */
function CollisionDetector() {
}
CollisionDetector.isBubbleBorderCollides = function (circle, lineStart, lineEnd) {
var p1 = Vector.sub(lineStart, circle.center);
var p2 = Vector.sub(lineEnd, circle.center);
var deltaLine = Vector.sub(... | true |
e2309b500a093be1e09f445f644553a81e949279 | JavaScript | katsube/neec2018A | /nodejs/mysql/mysql2.js | UTF-8 | 1,331 | 2.640625 | 3 | [] | no_license | /**
* MySQLへの接続とINSERT分の発行及びトランザクション
* https://github.com/mysqljs/mysql
*/
//-------------------------
// ライブラリ
//-------------------------
const mysql = require('mysql');
//-------------------------
// 接続
//-------------------------
const connection = mysql.createConnection({
host : 'localhost',
user : ... | true |
57bfc5b804a22e0918b433c8aa6222e18e9ab1e2 | JavaScript | david-f/eclairjs | /server/src/main/resources/eclairjs/ml/feature/NGram.js | UTF-8 | 3,297 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016 IBM Corp.
*
* 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/li... | true |
d8828ac3a56ba53ced312a6d5f9b5a61d5d014f4 | JavaScript | sharryhong/full-stack | /javascript/vanillajs-component/src/app.js | UTF-8 | 2,220 | 2.6875 | 3 | [] | no_license | import Component from "./core/Component.js";
import ItemAppender from "./components/ItemAppender.js";
import Items from "./components/Items.js";
import ItemFilter from "./components/ItemFilter.js";
class App extends Component {
setup() {
this.$state = {
filterName: "all",
items: [
{
... | true |
aa7243fef66afec44cbf354738380f0d973f6389 | JavaScript | HuyCam/Redux-Simple-Starter | /src/containers/book-list.js | UTF-8 | 1,580 | 2.828125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import { connect } from 'react-redux';
import selectBook from '../actions/index'; // get the action creator
import { bindActionCreators } from 'redux'; // this will make the action flow in reducer to reproduce state
class BookList extends Component {
renderList() {
... | true |
3a9806e1822a5ce8228468a053de725a4768897b | JavaScript | Beeee/pipeline-test | /src/main/resources/static/app.js | UTF-8 | 3,515 | 2.53125 | 3 | [] | no_license | var stompClient = null;
function setConnected(connected) {
$("#connect").prop("disabled", connected);
$("#disconnect").prop("disabled", !connected);
if (connected) {
$("#conversation").show();
}
else {
$("#conversation").hide();
}
}
function connect() {
var socket = new Soc... | true |
15541f6a082f083cc46c57b189951b11d7456445 | JavaScript | AAI-USZ/FixJS | /input/100+/after/c1d17e83149a526953ccae923045a5425f63d41e_0_1.js | UTF-8 | 679 | 2.671875 | 3 | [
"MIT"
] | permissive | function(uri) {
var script = document.createElement('script');
var load_callback = function() {
JX.Resource._complete(uri);
};
var error_callback = function() {
JX.$E('Resource: JS file download failure: ' + uri);
};
JX.copy(script, {
type: 'text/javascript',... | true |
62e653262260c32915608e288e68a49dae3741f3 | JavaScript | JeresB/RudbyClub | /js/updateHTML.js | UTF-8 | 713 | 2.796875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$(".modif").click(function(event) {
var id = $(this).attr("id");
id = id.substr(7);
var textID = document.getElementById(id);
var saveText = textID.innerText || textID.textContent;
textID.innerHTML = '';
var input = '';
input += '<input id = "texte" name = ... | true |
2cd39a3950f5aafb91cbf0d22d1214e280b63978 | JavaScript | santdoyle/coderhouse | /Clase17SQLParte2/ejemplos/batch_async_await.js | UTF-8 | 1,213 | 2.8125 | 3 | [] | no_license | const {options} = require("./options/MariaDB");
const knex = require("knex")(options);
const cars = [
{name: "Audi", price: 52642},
{name: "Mercedes", price: 57127},
{name: "Skoda", price: 9000},
{name: "Volvo", price: 29000},
{name: "Bentley", price: 350000},
{name: "Citroen", price: 21000},
... | true |
178f112131b677293c367446a2742e76a7016dd2 | JavaScript | luofeihu/jmgraph | /src/shapes/jmBezier.js | UTF-8 | 2,918 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* 贝塞尔曲线,继承jmPath
* N阶,参数points中为控制点
*
* @class jmBezier
* @for jmGraph
* @module jmGraph
* @param {jmGraph} graph 画布
* @param {object} params 参数
*/
function jmBezier(graph,params) {
if(!params) params = {};
/**
* 当前对象类型名
*
* @property type
* @type string
*/
this.type = 'jm... | true |
635ca4248bad4d255014a06c8c4f46d55a9b35d9 | JavaScript | FaraazH/Portfolio3 | /js/chromatic.js | UTF-8 | 6,529 | 2.84375 | 3 | [] | no_license | //WINDOW SIZE
let reSize = () => document.documentElement.style.setProperty("--vh", window.innerHeight * 0.01 + "px");
reSize();
window.addEventListener("resize", reSize);
//ACTIVE NAVIGATION
let active = 0;
for (let i = 0; i < document.links.length; i++) {
if(document.links[i].href === document.URL) {
ac... | true |
91da03a985fabf1a029df66892cb3d3d179ff616 | JavaScript | Fundamentos2020/sillon_del_entretenimiento | /JS/registro.js | UTF-8 | 2,935 | 2.921875 | 3 | [] | no_license |
/* Boton de registro. */
var boton_registro = document.getElementById('boton_registro');
boton_registro.onclick = async function() {
var d = await RegistrarUsuario()
if( ExisteSesion() )
window.location.href = 'index.html' ;
};
/* Registrar un usuario */
async function RegistrarUsuario() {
var n... | true |
930e4c49bcd02df019c5f06e18e061f4e93bf588 | JavaScript | MatthewAguiar/tic-tac-toe | /public/scripts/Board.js | UTF-8 | 1,791 | 3.65625 | 4 | [] | no_license |
class Board
{
constructor(size)
{
this.clickbox_array = [];
this.size = -1;
this.total_clickboxes = -1;
this.set_board_size(size);
this.set_total_clickboxes(9);
this.set_clickbox_array();
}
set_clickbox_array()
{
let x1, y1, x2, y2, coordinate_incrementer, total_cl... | true |
270761608daa1d3a83d98b067937c88b28007e59 | JavaScript | Killercodes/TwitterBot | /NodeJs/ClassBot.js | UTF-8 | 9,553 | 2.609375 | 3 | [] | no_license | // Twitter Bot ver 1.0
function TwitterBot(twitterName) {
var twit = require("twit");
var config = require("./" + twitterName + ".js");
var T = new twit(config);
var stream = T.stream("user");
var dataResult = undefined;
var botName = twitterName;
var fs = require('fs');
... | true |
274ec89cd59fa681f6723c6d787e91e9ea580819 | JavaScript | zhangming123456/mmtc-merchant-h5-master | /src/tools/date/range.js | UTF-8 | 714 | 2.9375 | 3 | [] | no_license | const Format = require('./format')
function strToDate (date) {
if (typeof date === 'string') {
let arr = date.split(/[- : \/]/),
_date = new Date(arr[0], arr[1] - 1, arr[2], arr[3] || 0, arr[4] || 0, arr[5] || 0)
return _date
} else if (date instanceof Date) {
return new Date()
} else if (typeo... | true |
195ee931cfb4151cb31a3986244f35424ead0c73 | JavaScript | am242/mange_rent | /client/dashbord.js | UTF-8 | 1,562 | 3.1875 | 3 | [] | no_license | const addDaysByweek = () => {
const todayDate = new Date(),
dayToday = todayDate.setDate(todayDate.getDate() + 1)
// add date for all days
Array.from(document.querySelectorAll('div')).map((el) => {
if (Number(el.getAttribute("id") >= 0)) {
const div = document.createElement('di... | true |
e053b23f24d3135332ec10d18ecb49a01f33011f | JavaScript | jcmastropieri/homechef | /script.js | UTF-8 | 9,353 | 3.09375 | 3 | [] | no_license | var MondayBreakfastTitle = localStorage.getItem("MondayBreakfast");
var MondayLunchTitle = localStorage.getItem("MondayLunch");
var MondayDinnerTitle = localStorage.getItem("MondayDinner");
var TuesdayBreakfastTitle = localStorage.getItem("TuesdayBreakfast");
var TuesdayLunchTitle = localStorage... | true |
1a60a5e9d88b212d3dd9bad65775d3cd68209373 | JavaScript | Kibod/Partenon | /public/js/observers.js | UTF-8 | 1,538 | 2.546875 | 3 | [] | no_license | const logo = document.querySelector(".logo-container");
const header = document.querySelector(".main-header");
const sectionOne = document.querySelector(".intersection");
const headerOptions = {
rootMargin: "-70px 0px 0px 0px"
};
const headerObserver = new IntersectionObserver (function (
entries,
section... | true |
56f862f3e36187950e87b698696efd65ba121a69 | JavaScript | BoazArdel/SomeJS | /1/index.js | UTF-8 | 819 | 3.609375 | 4 | [] | no_license | class Person {
constructor(name,age,pass) {
this._name = name;
this._age = age;
this._pass = pass;
this._height = NaN
}
get name() {
console.log("used getter")
return this._name
}
set name(newName) { this._name=newName; }
get Height() { return... | true |
3da4dab2388757b35f1917e23fa3c97fbde74ec7 | JavaScript | Soraya97/VisualDon | /20200228/theorie/json/prepareData.js | UTF-8 | 254 | 2.5625 | 3 | [] | no_license | const data = require('./dataBase.json')
const result = data
.filter(d => d.plz === '1000')
.filter(d => d.sexcode ==='w')
.map(d => ({nom: d.nachname, nb: d.anzahl}))
console.log(JSON.stringify(result, null, 2));
// node prepareDate > data.json
| true |
89f6f02ea5aac2498a3a9ebddc4cac59ef303444 | JavaScript | cdg77/adventure-game | /snippets.js | UTF-8 | 303 | 3.140625 | 3 | [] | no_license | //we want to know where we are
//what direction we are going
//where do we end up
var direction = room.north;
var resultRoom;
mapArray.forEach(function(room) {
if (room.name === direction) {
console.log(room.name);
resultRoom = room;
}
});
return resultRoom; | true |
255b1cac9f822ce69c49c4e810cb2f64fbb56290 | JavaScript | ILLYAKO/beer-showcase | /src/components/BeerList/index.js | UTF-8 | 1,029 | 2.53125 | 3 | [] | no_license | import React, { useEffect, useState, useContext } from "react";
import axios from "axios";
import BeerItem from "../BeerItem/index";
import { BeerContext } from "../../BeerContext";
import "./style.css";
const BeerList = () => {
const beerWanted = useContext(BeerContext);
const [beerData, setBeerData] = useState(... | true |
2e1a3f2ba47a6557c2937e8273f9c6edbf8fdf70 | JavaScript | Planet-Shine/math-pads | /src/utils/keyAssigner.js | UTF-8 | 1,204 | 3.09375 | 3 | [] | no_license |
class KeyAssigner {
assign(from, to, keys) {
this.assignTo(to, keys, this.extractFrom(from, keys));
}
assignTo(target, keys = [], value) {
var result = target || getCurrentEmptyResult(keys[0]),
length = keys.length;
function getCurrentEmptyResult(nextKey) {
... | true |
9a8a1cf6ed288ab52284455725bb67b49cdd5d0f | JavaScript | Rnulanz/constructor_word_guess | /main.js | UTF-8 | 4,242 | 3.40625 | 3 | [] | no_license | var Word = require('./word.js');
var inquirer = require('inquirer');
var letterArray = "abcdefghijklmnopqrstuvwxyz";
var mlbTeams = [
"white sox",
"red sox",
"indians",
"royals",
"twins",
"orioles",
"yankees",
"rays",
"blue jays",
"astros",
"angels",
"athletics",
"... | true |
6ddcdb799e6a8e1e27d6144b80b40b0dd2d1918f | JavaScript | mdojic/genre-lyrics-crawler | /js/genre_artists/reading/genre_artists_reader.js | UTF-8 | 1,725 | 2.625 | 3 | [] | no_license | // Generated by CoffeeScript 1.12.6
(function() {
this.GenreArtistsReader = (function() {
function GenreArtistsReader(parentContext1, callbackFunction1, readAllArtists1) {
this.parentContext = parentContext1;
this.callbackFunction = callbackFunction1;
this.readAllArtists = readAllArtists1;
... | true |
709e7ead70c75da05c9c4c9ba2c424bbbd15cec4 | JavaScript | Shivlock221b/third-try | /Lec3/activity /allMatches.js | UTF-8 | 739 | 2.53125 | 3 | [] | no_license | const request = require("request");
const cheerio = require("cheerio");
const getMatch = require("./match");
function getALlMatches(link) {
request(link, cb);
}
function cb(error, response, data) {
if (error == null) {
parseData(data);
} else if (reasponse.statusCode == 404) {
console.log(... | true |
158cc45f20b6e4053b41a6b12f3dcfebbc4c3dea | JavaScript | rodrigovallades/react-chat | /src/App.js | UTF-8 | 1,146 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
import Chat from './components/chat/Chat'
class App extends Component {
constructor(props) {
super(props)
this.state = {
chats: [],
}
}
renderChats = () => {
if (!this.state.chats.length) {
return ( <p className="nochats">Esta aplicação em Re... | true |
66a64500b7dbbf0a58106b52254e58927ad9b12f | JavaScript | DanteNiewenhuis/graphics | /framework2/gimbal/main.js | UTF-8 | 10,610 | 2.546875 | 3 | [] | no_license | /* Computer Graphics, Assignment 2, Translations, Rotations and Scaling
*
* Description ..... Draw teapots that can be interactively rotated with the mouse
* Created by ...... Daan Kruis
* Original by ..... Paul Melis
*
* Student name .... Dante Niewenhuis, Thomas Bellucci
* Student email ... th.bellucci@gmail.c... | true |
d26745080eed3892e0b61e6ff0afb041d87fa057 | JavaScript | Dojo-Bahia/dojos-em-ssa | /2012-11-21-node_js-radialistas_associados/megasena.js | UTF-8 | 682 | 2.6875 | 3 | [] | no_license | var http = require('http');
var util = require('util');
var fs = require('fs');
exports.downloadZip = function(callback){
var file = fs.createWriteStream('/tmp/resultado.zip');
var con = http.get("http://www1.caixa.gov.br/loterias/_arquivos/loterias/D_megase.zip", function(res) {
//console.log("Got response: ... | true |
935440de536c3a556b9730c657cac303360939de | JavaScript | cyro-hub/alhaddah | /public/js/register.js | UTF-8 | 1,336 | 3.046875 | 3 | [] | no_license | let input = document.getElementsByTagName("input");
let name_error = document.getElementById("error-username");
let password_error = document.getElementById("error-password");
let passwordC_error = document.getElementById("error-passwordc");
name_error.style.display = "none";
password_error.style.display = "none";
pas... | true |
0265ec8e034458eabefcd46b3e28756cfe184934 | JavaScript | jwayneroth/js-automata | /js/lib/ta.js | UTF-8 | 31,161 | 2.671875 | 3 | [] | no_license | (function($, scope) {
function TA(config) {
var config = config || {};
var defaults = {
type: '4ARGBA',
lattice: 'centered',
scale: 10,
seeds: .1,
fps: 18,
color_one: {r:255,g:255,b:255,a:255},
color_two: {r:33,g:33,b:33,a:100},
animeID: null
};
$.extend(this, defaults, config);
... | true |
c68f1f6d89fa2149e6c888f5ba24ee667b3e7c3a | JavaScript | ilelandhayes/Team-Profile-Generator | /test/Engineer.test.js | UTF-8 | 1,624 | 3.109375 | 3 | [
"MIT"
] | permissive | const Engineer = require("../lib/Engineer");
describe("Engineer", () => {
describe("initialization", () => {
it("check to see if the new object is an instance of Engineer", () => {
const newEng = new Engineer();
expect(newEng instanceof Engineer).toEqual(true);
});
... | true |
84c61f09fa5ea6dbd2bdeb3a725b90e8fe80b369 | JavaScript | utasibence/terminalwebsite | /app.js | UTF-8 | 682 | 2.953125 | 3 | [] | no_license | const cursor_text = document.getElementById('cursor_text');
function clock() {
const fullDate = new Date();
let milliseconds = fullDate.getMilliseconds();
const cursor = document.getElementById('cursor');
if (milliseconds < 500) {
cursor.innerHTML = " |";
} else {
cursor.innerHTML = "... | true |
4afd534186de01e17af3cfe748b2083ea57cb2d4 | JavaScript | Eluetkehans/data_structures_and_algorithems_1 | /unique.js | UTF-8 | 281 | 2.65625 | 3 | [] | no_license | var unique = module.exports = exports = function(array) {
seen = {};
newArray = [];
count = 0;
for (var i = 0 ; i < array.length; i++) {
if (!seen[array[i]]) {
seen[array[i]] = true;
newArray[count] = array[i];
count++;
}
}
return newArray;
}; | true |
1f2f58e0ce14bfa855283870ec66a31f253ff8b8 | JavaScript | nilswalk/parallel-flickr | /www/javascript/cwf.js | UTF-8 | 9,267 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | /* contacts who've faved (cwf) */
/* TO DO: put all of this in to the barest amount of closure-fu
* so that it's all scoped locally to cwf stuff...
*/
var photos = new Array();
var thumbs = new Array();
var images = new Array();
var count_photos = 0;
var count_updates = 0;
var can_fave = 0;
var idx = 0;
functio... | true |
bdeb43c39622f3a3f74b2cec4fcb81d6da633147 | JavaScript | dannyandreev/rc0521-code-solutions | /array-manipulation-3/src/unique.js | UTF-8 | 344 | 3.734375 | 4 | [] | no_license | /* exported unique */
function unique(array) {
var newArray = [];
for (var i = 0; i < array.length; i++) {
var repeats = false;
for (var j = 0; j < newArray.length; j++) {
if (array[i] === newArray[j]) {
repeats = true;
}
}
if (!repeats) {
newArray.push(array[i]);
}
... | true |
59df7bb28a13b4d9ac75d6068ff91c8c8e784a73 | JavaScript | daunjeong824/React_Repo | /schedule/src/Counter.js | UTF-8 | 821 | 3.046875 | 3 | [] | no_license | import React, {Component} from 'react';
class Counter extends Component {
state = {
number : 0,
notChanged : 1
}
render() {
const { number, notChanged } = this.state; // this.state로 state 조회
return(
<div>
<h1>{number}</h1>
<h2>NO CHANGE!... | true |
35b2c85dd02bbc0e6f76bbc14084e84450221b1e | JavaScript | amorajuno/nutriapp | /nutriappv0/src/Pages/Home/index.js | UTF-8 | 1,213 | 2.59375 | 3 | [] | no_license | import { useEffect, useState } from 'react';
import api from '../../services/api';
import { Link } from 'react-router-dom';
import '../Home/Home.css';
export default function Home() {
const [posts, setPosts] = useState([]); // usar uma lista vazia para a requisição da API
useEffect(() => {
async fun... | true |
30339a7f0c1efbf4d2f140c770d5e87677a63aa7 | JavaScript | kjphelps90/investment-portfolio | /public/js/login.js | UTF-8 | 930 | 3.203125 | 3 | [
"MIT"
] | permissive | //Login or signup functions
const loginFormHandler = async (event) => {
event.preventDefault();
// Collect values from the login form
const username = document.getElementById("username").value.trim();
const password = document.getElementById("password").value.trim();
if (username && password) {
// Send ... | true |
6e852f36ee3a792db8c090ce8b9dee057cf47afc | JavaScript | aivazis/feynman | /src/store/diagram/elements/tests/elements.test.js | UTF-8 | 17,554 | 2.578125 | 3 | [] | no_license | // local imports
import { createStore } from 'store'
import reducer from '..'
import {
selectElements,
addAnchors,
clearSelection,
mergeElements,
addPropagators,
setElementAttrs,
deleteElements,
clearElements,
deleteSelection,
} from 'actions/elements'
import { setGridSize } from 'ac... | true |
33f61c393d8b3c1406160f42b98f423c6b3172f8 | JavaScript | seifooriamin/invoice-angular | /dist/invoice-angular/assets/js/localStorageClear.js | UTF-8 | 463 | 2.8125 | 3 | [] | no_license | window.onbeforeunload = function(e) {
let date = Date.now();
localStorage.setItem("lastactivity", date);
};
window.onload = function() {
let date1 = localStorage.getItem('lastactivity');
let date2 = Date.now();
if (date1 !== undefined) {
let difference = date2 - date1;
let diff = (... | true |
bee795d945ae0ff3bfb536c1d6561635e3ad2e4a | JavaScript | kyla-joaquin/movies-application | /src/edit.js | UTF-8 | 1,695 | 3.15625 | 3 | [] | no_license | "use strict";
//changing the movie's info
export const editMovie = (id, editedMovie) => {
fetch(`./api/movies/${id}`, {
"method": "PUT",
"headers": {
"Content-Type": "application/json"},
body: JSON.stringify(editedMovie)})
.then(response => JSON.stringify(response));
};
... | true |
3e7bde8308bc09342ac3c02f70bebe6a0aaad890 | JavaScript | ShamilWeb/772513-code-and-magick-18 | /js/dialog.js | UTF-8 | 5,533 | 2.703125 | 3 | [] | no_license | 'use strict';
(function () {
var setupOpen = document.querySelector('.setup-open');
var setupClose = window.util.setup.querySelector('.setup-close');
var setupUserName = window.util.setup.querySelector('.setup-user-name');
var ESC_KEYCODE = 27;
var ENTER_KEYCODE = 13;
var START_DIALOG_TOP = 80;
var START_... | true |
ce60fb2b67db9db62592bfb8ac31396ae9086c04 | JavaScript | alforstudy/webpack-react | /src/components/class关键字测试.js | UTF-8 | 1,380 | 4.34375 | 4 | [] | no_license | console.log("-----------------------")
class ShengWu{
constructor(name,age){
this.name = name
this.age = age
}
say(){
console.log("不说人话")
}
}
function Person(name,age){
this.name = name
this.age = age
}
Person.info = "人"
//实例属性可以通过实例直接访问
//静态属性只能通过类来访问
let p1 = new Pers... | true |
a45e3cda851ce07f35c8aa35a1d3cac3e425b95b | JavaScript | ricsoh/expo--pcmob3-project3 | /screens/NotesScreen.js | UTF-8 | 4,633 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { StyleSheet, Text, View, TouchableOpacity, FlatList } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { MaterialIcons } from '@expo/vector-icons';
import * as SQLite from "expo-sqlite";
// Open database if exists else create
const d... | true |
249c0041bd63579999cf81336794eb6d73c3ade7 | JavaScript | mornSea/WEB | /FM/Vue/Vue项目实战.js | UTF-8 | 118,942 | 3.15625 | 3 | [] | no_license | // 基础
//1.3 第一个应用 (html略, 只是vue要放body中, 最好在body之首)
var app = new Vue({ //新建Vue实例
el: '#root', //根dom的CSS选择器 找到id为root的元素 设为应用的根
data(){ //数据
return {
message: 'Hello, Vue',
}
},
... | true |