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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7eae916cf8a5186bc616c6bf868f401c3e161297 | JavaScript | eidietrich/bdc-reporting-viz | /app/components/Typeahead.jsx | UTF-8 | 3,071 | 2.78125 | 3 | [] | no_license | import React, { Component } from 'react';
import { FormControl, InputGroup, ControlLabel } from 'react-bootstrap';
import onClickOutside from 'react-onclickoutside';
// options is array of {key: '...', 'label': '...'} objects
// label for display, key for return value
class Typeahead extends React.Component {
cons... | true |
3b21ffd1298035397ea43a6954447e487a32c5d4 | JavaScript | acruikshank/chat.os | /test/mock_socket_server.js | UTF-8 | 957 | 2.59375 | 3 | [
"MIT"
] | permissive | var events = require('events')
function bind(o,prop) { return function() { o[prop].apply(o, Array.prototype.slice.call(arguments,0) )}; }
module.exports.MockServer = function() {
var sockets = [];
var emitter = new events.EventEmitter();
return {
connect : function( identity ) {
var socket = MockSocket();
... | true |
570db184d11f785cf42bc9414251da64ba43b15c | JavaScript | Kireck211/actividad-sesion23 | /frontend/js/editStudent.js | UTF-8 | 1,539 | 2.78125 | 3 | [] | no_license | function getStudent(id) {
$.ajax({
url: 'http://localhost:3000/students/' + id,
method: 'GET',
headers: {
'x-auth': getToken()
},
success: ({student}) => {
Object.keys(student)
.forEach(property => {
if (property === 'birth')
student[property] = student[pr... | true |
7ab5daaebb0d24ad0388f4dfadb53280ce2623ad | JavaScript | nlnadialigia/IGTI | /Modulo-03/cc-desafio-01/react-classes/src/helpers/dateTimeHelpers.js | UTF-8 | 565 | 2.96875 | 3 | [
"MIT"
] | permissive | function getNewTimestamp() {
const date = new Date();
const year = date.getUTCFullYear();
const month = `0${date.getUTCMonth() + 1}`.slice(-2);
const day = `0${date.getUTCDate()}`.slice(-2);
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const millis... | true |
7021cb1cf44f6df06721f896b7f5c48b3f27119e | JavaScript | tireptor/web_js | /modification_attributs/exercice3.js | UTF-8 | 419 | 3.359375 | 3 | [] | no_license | var paragraph = document.getElementById('myP');
var first = paragraph.firstChild;
var last = paragraph.lastChild;
var children = paragraph.childNodes;
for (var i = 0, c = children.length; i < c; i++) {
if (children[i].nodeType === Node.ELEMENT_NODE) { // C'est un élément HTML
alert(children[i].firstChild.da... | true |
d6041299ae865a86a41b5dd31638c8c0c0aa10d2 | JavaScript | khaibr20/hippo-club-frontend | /src/Components/Utils/Common.js | UTF-8 | 653 | 2.90625 | 3 | [] | no_license | // return the user data from the session storage
export const getUser = () => {
const userStr = localStorage.getItem("user")
if (userStr) return JSON.parse(userStr)
return null
}
// return the token from the session storage
export const getId = () => {
return localStorage.getItem("id") || null
}
// remove the t... | true |
84abd503c8d575c9fd363a374116110d0915aa93 | JavaScript | wlwl2/data-visualizations-and-maps | /maps/leaftlet/js/script.js | UTF-8 | 3,062 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | const southWest = L.latLng(-89.98155760646617, -225)
const northEast = L.latLng(89.99346179538875, 225)
const bounds = L.latLngBounds(southWest, northEast)
let mymap = L.map('mapid',
{
maxBounds: bounds,
center: bounds.getCenter(),
maxBoundsViscosity: 1.0
}
).setView([51.505, -0.09], 2)
L.tileLayer(
'https:/... | true |
620995fa782fc01186c3cf8e1523b73497b1a197 | JavaScript | usmanbaloch21/chipShop | /Deals/pieExpiryDeal.js | UTF-8 | 655 | 2.71875 | 3 | [] | no_license | const Pie = require("../Products/Pie.js");
const currentDate = new Date();
const constants = require("../Constants/constants.js");
const pieExpiryDeal = function(basket) {
if (basket.products.length === 0){
return new Error("Basket Is Empty Cannot Apply Expiry Discount")
}
let discountValue = 0;
... | true |
f33fc33d5f3e192cf44d63b68cd7c49b455f6a5d | JavaScript | CatEars/auto-scaling-thesis-work | /health-master/src/container-start-times-benchmark/do-scaling.js | UTF-8 | 3,307 | 2.734375 | 3 | [] | no_license | const { execSync } = require('child_process')
const fs = require('fs')
const sleep = require('sleep-promise')
const path = require('path')
const TenSeconds = 10000
const OneMinute = TenSeconds * 6
const ElevenMinutes = OneMinute * 11
// Setup values in ContainerValues.
// These are [0, X], [X-1, X], [X, 0] and [X, X-... | true |
751453209a929f4b040d573f5132a809dc84bbe8 | JavaScript | acarlstein/manual-fill | /dialog.js | UTF-8 | 1,904 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* For some unknown reason, chrome insist on trying to trigger the script
* prior the DOM Tree being created from the page.
*/
window.onload = function(){
window.resizeTo(260, 230);
let form = document.forms[0];
if (form){
chrome.storage.sync.get(["words"], function(loaded){
if (loaded.has... | true |
3a668c2033315e6481609a4c1ddaf22b1fe70ee4 | JavaScript | Xaz16/advent-of-code-2020 | /2/main-first-part.mjs | UTF-8 | 1,553 | 3.234375 | 3 | [] | no_license | import { INPUT } from "./input.mjs";
/**
* @param {string} password
* @param {object} policy
*/
const isPasswordValid = (password, policy) => {
const passwordChars = password.split("");
const validForChars = [];
const invalidForChars = [];
for (const char in policy) {
const { min, max } =... | true |
af1b62d59a9d743599286ff34bd73e193b511e64 | JavaScript | derenio/async_presentation | /promise_chain.js | UTF-8 | 515 | 3.4375 | 3 | [] | no_license | const p1 = Promise.resolve(42)
console.log(p1); // Promise { 42 }
const p2 = p1.then(result => [result, 9000])
.then(result => [...result, Number.POSITIVE_INFINITY])
.then(result => {
throw [...result, 'throwing the ball'];
}).catch(result => {
return [...result, 'caught the ball'];
}).then(result => [... | true |
d6d0a7ab5292a6dbd7b88d9589b5c7c4b472c804 | JavaScript | tn819/ejs_jswp | /4-50_call_apply_bind.js | UTF-8 | 796 | 3.90625 | 4 | [
"MIT"
] | permissive | var person = {
firstname: 'John',
lastname: 'Doe',
getFullName: function() {
var fullname = this.firstname + ' ' + this.lastname;
return fullname;
}
}
var logName = function (lang1, lang2) {
console.log('Logged: ' + this.getFullName());
console.log('Arguments: ' + lang1 + lang2);
console.lo... | true |
4b5d6ed29fcfb82f581489dc92e299e460afa2c6 | JavaScript | int64ago/getlink-extension | /js/background.js | UTF-8 | 3,315 | 2.578125 | 3 | [] | no_license | (function() {
var DEFAULT = {
authKey: 'getlink',
server: 'https://pub.get-link.xyz/uptoken'
};
function copyTextToClipboard(text) {
var copyFrom, body;
copyFrom = document.createElement("textarea");
copyFrom.textContent = text;
body = document.getElementsByT... | true |
7735f0566355d65fce391f3923ad45e9365e5ae7 | JavaScript | blackLYH/E-sub | /E-sub/public/javascripts/email.js | UTF-8 | 2,567 | 2.578125 | 3 | [
"MIT"
] | permissive | //email.js
// 引入 nodemailer
var nodemailer = require('nodemailer');
var mysql = require('mysql');
var connection = mysql.createConnection({
host: '45.76.169.253',
user: 'hxm',
password: '123456',
database: 'esub'
});
// 创建一个SMTP客户端配置
var config = {
host: 'smtp.163.com',
port: 25,
auth: {
... | true |
149ded0160b8c24631bdce257d0dc119aafc11f8 | JavaScript | GrahamQuan/React-Tutorial | /04-react-component/src/12_组件内容的补充/01_ref的转发.js | UTF-8 | 789 | 2.671875 | 3 | [] | no_license | import React, { PureComponent, createRef, forwardRef, createFactory } from 'react'
class Home extends PureComponent {
render() {
return (
<div>
Home
</div>
)
}
}
// forwardRef 接受函数组件,返回一个组件
const About = forwardRef((porps, ref) => {
return (
<h3 ref={ref}>about</h3>
)
})
expor... | true |
c15fd2ef37f27c909497f7ca0fb94e836fe3c545 | JavaScript | Munishkin/codewars | /js/captain-planet/captain-planet.js | UTF-8 | 1,404 | 3.265625 | 3 | [] | no_license | const parseData = () => {
// Remember, your data is in a global variable dataFile
dataArray = dataFile.split('\n')
highest = {
'Ammonia' : 0,
'Nitrogen Oxide' : 0,
'Carbon Monoxide' : 0
};
countries = {
'Ammonia' : [],
'Nitrogen Oxide' : [],
'Carbon Monoxide' : []
};
for (let i = ... | true |
37360e21531b7020b80d99dff91c11fb87da8473 | JavaScript | zmx2321/FrontEnd | /JavaScript/NumberOfLslands/js/index.js | UTF-8 | 1,507 | 3.515625 | 4 | [] | no_license | /**
* @param {character[][]} grid
* @return {number}
*/
var numIslands = function(grid) {
var m = grid.length;
if (m === 0) return 0;
var n = grid[0].length;
if (n === 0) return 0;
var allOnes = new Map();
for (var i = 0; i < m; i++) {
for (var j = 0; j < n; j++) {
if (gri... | true |
f87e6a861c7e302d7d626fdbeefcfdc1cb4e1c3b | JavaScript | 63365369/reactnd-contacts-server | /src/App.js | UTF-8 | 1,720 | 2.6875 | 3 | [] | no_license | import React from 'react'
// import * as BooksAPI from './BooksAPI'
import './App.css'
import { Route } from 'react-router-dom'
import ListBooks from './ListBooks.js'
import SearchBooks from './SearchBooks.js'
import * as BooksAPI from './BooksAPI.js'
class BooksApp extends React.Component {
state = {
/**
*... | true |
9eae463b42f5eb772e89bca072a1892bfc991229 | JavaScript | RaquelCanosa2020/entregas-hab | /js2/entrega-7/Temperaturas_tabla/www/js/main.js | UTF-8 | 1,702 | 3.5625 | 4 | [] | no_license | const temperaturas = [
{
city: "A coruña",
min: 17,
max: 23,
},
{
city: "Ferrol",
min: 15,
max: 27,
},
{
city: "Lugo",
min: 12,
max: 31,
},
{
city: "Ourense",
min: 18,
max: 35,
},
{
city: "Pontevedra",
min: 18,
max: 29,
},
];
// Temp. meno... | true |
9e0ac4d4df3b2742f3968b6ea45485ba5e77ccae | JavaScript | RunningCoderLee/selector | /src/utils.js | UTF-8 | 263 | 2.640625 | 3 | [] | no_license | export const TypeOf = (obj) => {
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
};
export const isSelectTag = (element) => {
if (element.nodeType === Node.ELEMENT_NODE) {
return element.tagName === 'SELECT'
}
return false;
}; | true |
e74e503020f9c652c57a9a46263bf2b44382605a | JavaScript | dfewless2019/ImageShareV1 | /imageshare/scripts/loginResetPassword.js | UTF-8 | 646 | 2.6875 | 3 | [] | no_license | var RESETPW=(function(){
var verifyEamil=function(){
var eamilVal = $("#txtEmail").val();
var lastAtPos = eamilVal.lastIndexOf('@');
var lastDotPos = eamilVal.lastIndexOf('.');
if(lastAtPos < lastDotPos && lastAtPos > 0 && eamilVal.indexOf('@@') == -1 && lastDotPos > 2 && (eamilVal.le... | true |
d4cbc2e787974de081f271c4172deda43848bd59 | JavaScript | rarescosma/edu.learn | /_archive/nodeschool/03.bytewiser/07.array-buffers.js | UTF-8 | 395 | 3.734375 | 4 | [] | no_license | /**
* Take the integer from process.argv[2] and write it as the first element in a single element Uint32Array.
*
* Then create a Uint16Array from the Array Buffer of the Uint32Array and
* log out to the console the JSON stringified version of the Uint16Array.
*/
var ui32 = new Uint32Array([+process.argv[2]]);
va... | true |
df8a62ada8df37b478ca90d6a5effa1c04949a53 | JavaScript | kevinhynes/shlack | /static/login.js | UTF-8 | 597 | 2.71875 | 3 | [] | no_license | $(document).ready(function() {
// Resizing Messages
const mql = window.matchMedia('(max-width: 767px)')
resizeLoginContainer(mql)
mql.addEventListener('change', resizeLoginContainer)
})
function resizeLoginContainer(mql) {
const navbar = document.getElementById("navbar")
const login_page = do... | true |
142feb279551b56bedd9454b886ebed7344132fc | JavaScript | codefellows/seattle-code-301d76 | /class-01/react-app/src/App.js | UTF-8 | 477 | 2.703125 | 3 | [] | no_license | import React from 'react'; // the "import" keyword will import a file or a package
import Board from './board.js';
// the code in the return statement is called jsx -> javascript extension
// this is used as a way for us to combine HTML/JS syntax together
class App extends React.Component {
render() {
return (
... | true |
d92027da1ae1ed681191e1d9bae7b7d98321be40 | JavaScript | melaniebanville/hec-h2020-public | /cours-05 (JavaScript 1)/2-pendant-la-seance/2.2-variables-et-donnees/2.2.3-demo-chaines-de-caracteres/app.js | UTF-8 | 304 | 3.203125 | 3 | [] | no_license | console.log("Bonjour à toute la classe");
console.log('Bonjour à toute la classe');
console.log("Bonjour j'ai mal à la tête");
console.log('Voici ses mots: "Bravo à tous!"');
console.log('Voici ce qu\'il a dit: "Bravo à tous"');
var prenom = "Daniel";
console.log('Son prénom est ' + prenom);
| true |
e0fd4ea7826a849d2973e55f4c5eabfdfd0970af | JavaScript | panakran/ajax-requests | /js/domutils.js | UTF-8 | 4,328 | 2.71875 | 3 | [
"MIT"
] | permissive | import { ERROR_STATUS_CLASS, SUCCESS_STATUS_CLASS, EXEC_TIME_SELECTOR, STATUS_SELECTOR, SIDE_BAR_ELEMENT_CLASSES, REMOVE_SAVED_ICON_CLASSES, REMOVE_SAVED_BUTTON_CLASSES } from './constants';
import { Utils } from "./utils.js";
import { Persist } from './persist';
/**
* render new value to innerHTML
* @param {type} el... | true |
e2377520b6178911b27636481fbaab08261564e0 | JavaScript | thaqueubc/Memory-Match-Game | /scripts/scripts.js | UTF-8 | 6,540 | 3.234375 | 3 | [] | no_license | var cards = document.querySelectorAll('.memory-card');
const hardCards = ['java', 'python', 'react', 'bootstrap', 'aws', 'angular'];
var totalClicks = 0;
var timeStart;
var hardMode = false;
let hasFlippedCard = false;
let lockBoard = false;
let firstCard, secondCard;
// <== Main Game Methods ==>
function flipCard() ... | true |
613aee318f291ab89149b1e8b081fd5968658b9a | JavaScript | thomasJang/password | /src/jquery.password.js | UTF-8 | 7,666 | 2.71875 | 3 | [
"MIT"
] | permissive | (function( $ ){
var methods = {
init : function( options ) {
var settings = $.extend( {
minLength:8,
minAcceptableScore: 30,
allowSpace:false,
change:function() {},
strengthIndicator:null,
strengthIndicatorBars: '<div class="pw_strengthIndicator"><div class="strength weak">Weak</div><div ... | true |
b892c258070742ef6aff595e64e3f373137cccdf | JavaScript | amudar/hyf-javascript1 | /week1/step3.js | UTF-8 | 166 | 3.265625 | 3 | [] | no_license | 'use strict';
let x ;
console.log('the value of my variable x will be: undefined');
console.log(x);
x = 2018;
console.log('the value of x is 2018');
console.log(x);
| true |
51d73a53406f85c8e5b64b49293c350d3e443156 | JavaScript | parnelle89/TommyLrnsNode | /06-Make-It-Modular/mymodule.js | UTF-8 | 780 | 2.9375 | 3 | [] | no_license | function dirFilter(directory, fileType, callBack) {
var fs = require('fs');
var path = require('path');
fs.readdir(directory, filter);
function filter(err, files) {
if (err) {
return callBack(err);
}
var retArray = [];
files.forEach(function(file) {
if (path.extname(file) === '.' + fileType) {
... | true |
e7020b598543f47a1387777b843e422eca19219d | JavaScript | TomNix/Advanced-JS | /Callback Functions/Callback_example.js | UTF-8 | 1,415 | 4.8125 | 5 | [] | no_license | //This is an example given to show one way to create a function that
//Takes two numbers and a string and either adds or multiplies them.
var calculate = function(num1, num2, calcType){
if (calcType == "add"){
return num1+num2;
}else if (calcType == "multiply"){
return num1*num2;
}
};
console.log("[Orig... | true |
d97a36c790e6b9d6d8e04c7e634a1ce810e64446 | JavaScript | ST-dev28/17-codewars-jest | /solved-codewars/thinkfulLogicDills-trafficLight.js | UTF-8 | 889 | 4.34375 | 4 | [] | no_license | /*
You're writing code to control your town's traffic lights.
You need a function to handle each change from green, to yellow,
to red, and then to green again.
Complete the function that takes a string as an argument
representing the current state of the light and returns a
string representing the state the light s... | true |
c5601e6c11cdc893ff263c2dc0cc85130f96173c | JavaScript | KSVarun/todos-status-airbnb-hackerrank | /src/App.js | UTF-8 | 2,954 | 3 | 3 | [] | no_license | import React, { useState } from 'react';
import './App.css';
function App() {
let [todos, setTodos] = useState([]);
let [todo, setTodo] = useState('');
let [todoStatus, setTodoStatus] = useState('');
let [selectedTab, setSelectedTab] = useState('All');
let [classNameAll, setClassNameAll] = useState('selected... | true |
57d1ce3920deaa222ba96a3cdf71faf60f61aa55 | JavaScript | Arpitmovers/algorithms | /segregateOddEven.js | UTF-8 | 189 | 2.8125 | 3 | [] | no_license | // given an aray of nos , segregate all even at start and odd at end
Soln:
-start from 0 , length-1
-if a[i] is even i++
-if a[j] is odd j--
-swap a[i],a[j] if a[i] is odd , a[j] is even
| true |
43a3b284307c2167bd4fc839f2b02250b58fd8ae | JavaScript | rickmurdock/collection-manager | /routes/addCarRoutes.js | UTF-8 | 453 | 2.546875 | 3 | [] | no_license | const express = require("express");
const addCarRouter = express.Router();
const Car = require("../models/Car");
addCarRouter.get("/", (req, res) => {
res.render('addCar');
});
addCarRouter.post("/", (req, res) => {
let carData = req.body;
let newCar = new Car(carData);
newCar
.save()
.then(savedCar ... | true |
6baff66bd9f210ef4fc6531a7a43f510b7b5496e | JavaScript | Anwesh43/MediaBox-html5 | /client/MediaBox.js | UTF-8 | 2,451 | 3.0625 | 3 | [] | no_license | class MediaBox {
static create(src,width,caption) {
const image = new Image()
image.src = src
image.onload = () => {
const w = image.width
const h = image.height
const canvas = document.createElement('canvas')
const context = canvas.getContext(... | true |
9ccc361ecbcdfce366dc544af613984191e7ad45 | JavaScript | avivkal/aviv-kalmanson-23-9-2020 | /src/Store/Reducers/modalReducer.js | UTF-8 | 564 | 2.671875 | 3 | [] | no_license | const initialState = {
modalTitle: '',
modalText: '',
show: false
}
const modalReducer = (state = initialState, action) => {
switch (action.type) {
case 'CLOSE_MODAL':
return {
...state,
show: false
}
case 'OPEN_MODAL':
... | true |
2187583d33b085b04219453a03ae1735e9144927 | JavaScript | mattsanpedro7/react-prep | /1-1-primer-es6/intro-es6.js | UTF-8 | 1,294 | 4.0625 | 4 | [] | no_license | const fakeTitles = [
'Pirate Of Reality',
'Guardians Of Hell',
'Witches With Vigor',
'Spies And Heroes',
'Robots And Kings',
];
const abbreviations = fakeTitles.map(
title => title.toLowerCase().slice(0, 4));
// equivalent using non-arrow functions
const abbreviationsEs5 = fakeTitles.map(function(title) {... | true |
aedf0f395b3cc4b7d7bb0d1f605f2e933646a1d8 | JavaScript | guilhermeferrari/reactNativeapp7 | /src/App.js | UTF-8 | 1,721 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import { AppRegistry, View } from 'react-native';
import { Topo, Resultado, Painel } from './components'
const Estilos = {
};
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
num1: '10',
... | true |
5530ed19a9d01648f7e09a3acfa2555409e2e82f | JavaScript | greendo/tiny-shooter | /src/main/resources/static/js/engine/gun.js | UTF-8 | 2,009 | 3 | 3 | [] | no_license | 'use strict';
class Gun {
constructor(spriteName, x, y, room, name) {
let preload = new createjs.LoadQueue();
preload.loadFile({id: name, src: spriteName});
let handleCompleteLoad = () => {
let result = preload.getResult(name);
this.sprite = new createjs.Bitmap(... | true |
157d892ba79ecf2aabdcdc9a43446c3ea1091a22 | JavaScript | ECS-S/Intrapartum-Fetal-Heart-Rate-Assessment | /main.js | UTF-8 | 4,834 | 2.6875 | 3 | [] | no_license | const input_file = document.getElementById("input_file");
var current_week = 1;
const previewContainer = document.getElementById("image_preview");
const previewImage = previewContainer.querySelector(".image_preview_image");
const canvas = document.getElementById('canvasOutput');
const label1 = document.getElementById('... | true |
a4c57a51672f43994085a848ac377a75aedaf81f | JavaScript | andykais/i3status | /src/building-block.js | UTF-8 | 2,570 | 2.65625 | 3 | [] | no_license | const createStore = {}
const validate = {
interval: interval => {
if (interval % 1 !== 0) {
throw new TypeError('interval must be an integer')
}
}
}
/*
* -== THE TWO TRUTHS OF BLOCKS ==-
* 1. Only render when status bar is being printed.
* 2. Update values in each blocks separate interval
*/
cl... | true |
e30d07cf6d12b8b367d4a1b91d010ba446a74480 | JavaScript | bryanh210/Algorithm_Data-Structure | /practice/lca.js | UTF-8 | 1,278 | 4 | 4 | [] | no_license | class treeNode{
constructor(value){
this.value = value;
this.left = null;
this.right = null;
}
}
const five = new treeNode(5);
const two = new treeNode(2);
const seven = new treeNode(7);
const four = new treeNode(4);
const eight = new treeNode(8);
const nine = new treeNode(9);
five.left = two;
five.r... | true |
6fb21cc9af2460d3d50b463e56124de49e55feb0 | JavaScript | KaiFu1984/DemoTape | /specificObjects1.0.js | UTF-8 | 27,833 | 2.796875 | 3 | [] | no_license | //********************************************************
//*****************SpecificBirdGameObjects****************
//********************************************************
//"A JavaScript object is a collection of named values"
"use strict"
function WorldOne(parameterObject)
//you need directions and Real... | true |
97bb1e44c1096c1088e7ba02648986a9fba6785d | JavaScript | DejaMeshae/DiceGame.github | /DejaDiceGame.js | UTF-8 | 1,457 | 3.703125 | 4 | [] | no_license | function gameStart() {
var inputName = prompt("What is your name?");
var firstCharacter = inputName.slice(0,1);
var upperCasefirstCharacter = firstCharacter.toUpperCase();
var restOfName = inputName.slice(1,inputName.length);
alert("Welcome " + upperCasefirstCharacter + ... | true |
c3c4a698d3f10dba4b6bf4a9779ebd2f70e594fe | JavaScript | pqok/taobao-shop-helper-1 | /Applications/Web_TaobaoShopHelper/Scripts/Common.js | UTF-8 | 568 | 3.25 | 3 | [] | no_license | function WriteCookie(name, value) {
document.cookie = name + "=" + value + ";";
}
function ReadCookie(name) {
var mycookie = document.cookie;
var start1 = mycookie.indexOf(name + "=");
if (start1 == -1)
return null;
else {
start = mycookie.indexOf("=", start1) + 1;
... | true |
247e49c5d65d9a6343d8257ce7b4036476c91e8a | JavaScript | GreenPioneer/Woofle | /server/user/user.model.js | UTF-8 | 1,399 | 2.59375 | 3 | [] | no_license | 'use strict';
const mongoose = require('mongoose');
const userSchema = mongoose.Schema({
email: {type: String, required: true, unique: true},
password: {type: String, required: true},
favorites: [String],
});
userSchema.statics = {
/**
* Get user with given email and password
*/
get (email, password)... | true |
5a882ac456bb6fb7e3a7370721897b6e0eae9beb | JavaScript | keito5656/zip-code-jp | /src/index.js | UTF-8 | 1,676 | 2.75 | 3 | [
"MIT"
] | permissive | import fs from 'fs';
import path from 'path';
import { Promise } from 'bluebird';
import { CacheManager, MemoryCacheAdapter, CacheAdapter } from './cache';
import { CacheableDictionaryLoader, DictionaryLoader } from './dictionary-loader';
export const cache = {
CacheManager: CacheManager,
CacheAdapter: CacheAdapte... | true |
1421ca22a73aeec1536c91c5776a6665d25da407 | JavaScript | shohanur021/nodejs-basic | /lesson-5/assert.js | UTF-8 | 873 | 3.515625 | 4 | [] | no_license | var assert = require('assert');
function add(a,b){
return a+b;
}
var expected_1 = add(7,3)
assert(expected_1 === 10, "this is not 10");
var expected_2 = add(6,9)
assert.ok(expected_2 === 15, "expected-2 is wrong");
var assert = require('assert');
var x = { a : { n: 0 } };
var y = { a : { n: 0 } };
var z = { a : ... | true |
8473a87d523276ddd175d1ffe2415afcf9161ddf | JavaScript | kowsalya9719/guvi | /javascript/prime_number/normal prime number.js | UTF-8 | 413 | 2.984375 | 3 | [] | no_license | const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
inp.on("line", (data) => {
var n=parseInt(data);
var count=0;
b=[];
for(i=2;i<n;i++)
{
var count=0;
for(j=1;j<=i;j++)
{
if(i%j===0)
{
count=count+1;
}
}
if(co... | true |
428fcafa4a8292d1cbc913e86a5bf51392daa4d9 | JavaScript | AlexandraHoude/AEC_Front_End | /Programmation1/chapitre2/js/Q14.js | UTF-8 | 775 | 4.1875 | 4 | [] | no_license | // Lire 3 nombres A, B et C différents. Trouver et afficher le plus petit et le plus grand.
var nbA = Number(prompt("entrez un premier nombre: "));
var nbB = Number(prompt("entrez un deuxième nombre: "));
var nbC = Number(prompt("entrez un troisième nombre: "));
var affichage;
if (nbA > nbB && nbA > nbC) {
affich... | true |
7d46fb81ce7540a86c2897502a114ead7bbaf30a | JavaScript | johnhbernal/pruebaPais | /public/js/script.js | UTF-8 | 2,787 | 2.90625 | 3 | [] | no_license | /**
*
* @author <a href="mailto:johnhawer8@gmail.com">John Hawer Bernal Gonzalez;
* @since 25/05/2017
* En esta función llamamos a un ajax para que nos realize una consulta a la funcion getRecurso
* que se encuentra dentro del controlador SearchController a partir del 3 caracter ingresado.
* Nos devuelve el nomb... | true |
7b2cba85761d53b7a2972a8cfc453da81125c7dc | JavaScript | aperkaz/eloquent-javascript | /src/4-HighOrderFunctions/1-Flatenning.js | UTF-8 | 203 | 2.75 | 3 | [
"MIT"
] | permissive | /* Flatten a array of arrays into a single array*/
const flatten = arrayOfArrays => (
arrayOfArrays.reduce((accumulator, current) => (
accumulator.concat(current)
))
);
export default flatten;
| true |
f15791f9ba357f8b83dabae8caa8cb0652c3b3d0 | JavaScript | MarwenKing15/Checkpoint_JS_DOM | /script.js | UTF-8 | 5,637 | 3.328125 | 3 | [] | no_license | /********************PLUS FUNCTIONS*****************/
function plus_function_item1(){
var price=document.getElementById("price_item1").innerHTML;
var p=Number(price);
var t=Number(document.getElementById("vat_item1").innerHTML);
var v=document.getElementById('valu1').value;
v++;
valu1.setAttribute('value',v);
var... | true |
c53ebef7e8f006c39c8c2854238d64ab58766646 | JavaScript | Cesc342/Cesc342.github.io | /Minijocs/llocDeMinijocs/quatreEnRatlle/scripts/style.js | UTF-8 | 282 | 2.6875 | 3 | [] | no_license | function mercar(x){
lloc = document.getElementById(x);
lloc.style.border = "3px intset black";
lloc.style.fontSize = "30px";
}
function desmarcar(x) {
lloc = document.getElementById(x);
lloc.style.border = "3px outset black";
lloc.style.fontSize = "25px";
}
| true |
dcdc3081c5a7ba54a7c96577ef967cb771023120 | JavaScript | vitaliidox/rickandmorty | /src/components/OwnCard.js | UTF-8 | 1,144 | 2.6875 | 3 | [] | no_license | import { useParams } from "react-router-dom";
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
function OwnCard() {
const [data, setData] = useState();
const { id } = useParams();
useEffect(() => {
fetch(`https://rickandmortyapi.com/api/character/${id}`)
.then((resp... | true |
0a179e415eb57dadeb98de4bf4211a6f00eb2506 | JavaScript | vsoundararajan/React-todo | /app/components/AddTodo.jsx | UTF-8 | 1,235 | 2.53125 | 3 | [] | no_license | /**
* Created by soundararajanvenkatasubramanian on 11/26/16.
*/
var React = require('react');
var {connect} = require('react-redux');
var actions = require('actions');
export var AddTodo = React.createClass({
getInitialState: function(){
return(
{}
)
},
handleSubmit: function(e)... | true |
6fddbaf4f04ca6161ef96bc67ac0dc41dbe1c3bd | JavaScript | huangbin-lang/vue-admin | /src/utils/app.js | UTF-8 | 686 | 2.546875 | 3 | [] | no_license | import cookie from "cookie_js";
const adminToken = 'admin-token';
const usernamekey ='username';
//通过cookie 获取 token
export function getToken() {
return cookie.get(adminToken)
}
/**
* 第一个参数是 key
* 第二个参数是 value
*/
//设置 cookie/token
export function setToken(token) {
return cookie.set(adminToken, token)
}
// 删除... | true |
c50001f3e31d4e70f585946107d69cc63e2399da | JavaScript | angkasa27/ReactDailyActivity | /src/XR1.js | UTF-8 | 881 | 2.65625 | 3 | [] | no_license | import React, { Component } from "react";
import "./App.css";
class XIR1 extends Component{
constructor(props){
super(props);
this.state = { state1: "Hai ", state2 : ""};
};
//update
salamkan = () => {
this.setState({ state1: "Bagaimana Kabarmu "});
};
... | true |
08bb3f919cb4642fa59338c4a605afad7e6026f6 | JavaScript | alcedo-ui/alcedo-ui | /scripts/generateComponentPropTypeJson.js | UTF-8 | 4,476 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
const _ = require('lodash'),
PropTypes = require('prop-types');
/**
* format propTypes according to react.PropTypes
* @param fieldPropType
* @returns {*}
*/
function formatPropTypes(fieldPropType) {
for (let key in PropTypes) {
if (fieldPropType.indexOf(key) > -1) {
retur... | true |
dcc9f0c1bb6a2ec682d90d8bb9f05b1a740fabcf | JavaScript | kmrzyglod/SmartHome.App | /src/Clients/WebApp/wwwroot/javascript/custom-functions.js | UTF-8 | 2,275 | 2.671875 | 3 | [] | no_license | function renderJSON(jsonStr, divId) {
setTimeout(() => {
const formatter = new JSONFormatter(jsonStr);
var container = document.getElementById(divId);
if (container.children.length > 0) {
container.replaceChild(formatter.render(), container.children);
... | true |
a26a8598d85217402780a997b2b07ec1961b0681 | JavaScript | annetrose/xparty | /client/js/data_pane.js | UTF-8 | 17,584 | 2.515625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | /*
# XParty - A Framework for Building Tools to Support Social Learning in Synchronous Environments
# Authors: Ben Bederson - www.cs.umd.edu/~bederson
# Alex Quinn -- www.alexquinn.org
# Anne Rose -- www.cs.umd.edu/hcil/members/arose
# Date: Originally created October 2012
# License: Apache License 2.... | true |
14d659d7358a679b7d30c1dd22976b38f4dff171 | JavaScript | cestmarcel/uoft-fitness | /server.js | UTF-8 | 1,875 | 2.515625 | 3 | [] | no_license | const mongoose = require('mongoose')
const express = require('express')
var path = require('path');
const PORT = process.env.PORT || 8080
const app = express()
mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost/workout",
{ useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true })
//... | true |
a6bf17dcb47c56959748d9000998d6658062a1d2 | JavaScript | Tanishq369/games.github.io | /Snake & Ladder/script.js | UTF-8 | 6,984 | 3.015625 | 3 | [] | no_license | c = 0;
p1Index = 0;
p2Index = 0;
p1unlock = false;
p2unlock = false;
player1 = "Player 1";
player2 = "Player 2";
window.onload = function(){
document.getElementById('dice').addEventListener('click', rollDice);
};
function rollDice(){
c++;
document.getElementById('dice').setAttribute('style',... | true |
2147419ecc143944b664c65c71138ee30854ad9f | JavaScript | espresso-apps/tellyprompt | /app/electron/js/fonts.js | UTF-8 | 738 | 2.5625 | 3 | [
"MIT"
] | permissive | /*---------------------------------------------------------------------------------------------
* Copyright (c) Tim Jenkins. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*-------------------------------------------------------------------------... | true |
5c82f6345c828af0a8c5e63fa4e0ee0dbe4ecce2 | JavaScript | rickboot/enhanced-contact-manager | /client/src/components/contacts/ContactForm.js | UTF-8 | 2,434 | 2.59375 | 3 | [] | no_license | import React, { useState, useContext } from 'react';
import ContactContext from '../../contexts/contact/ContactContext';
const ContactForm = () => {
const [firstName, setFirsName] = useState('');
const [lastName, setLastName] = useState('');
const [email, setEmail] = useState('');
const [phone, setPhone] = use... | true |
bc479ce5f00f1b05fefa6924092f909b4f4e2101 | JavaScript | brandoncoplen/VehicleRegistrationForm2 | /js/main.js | UTF-8 | 2,061 | 2.71875 | 3 | [] | no_license |
(function($) {
carModels = {'Volkswagen':["GTI", "Bug", "Tiguan"], 'Audi':["S Class", "A Class", "RS Class"]}
$('#make-selector').on('change', function(element) {
$('#model-selector').empty()
chosenMake = this.value;
for (makeIndex in carModels[chosenMake]) {
model = carModels[chosenMa... | true |
2d77b19f29489a83da9b4b85e6a3b226de1ce85c | JavaScript | francescomalatesta/react-todolist | /src/State/Reducers/todos.js | UTF-8 | 677 | 2.6875 | 3 | [] | no_license | const todos = (state = [], action) => {
switch(action.type) {
case 'ADD_TODO':
return [
...state,
{
title: action.payload.title,
is_done: 0
}
];
case 'TOGGLE_TODO':
return state.map((item, index) => {
if(action.payload.index === index) {
... | true |
fa8285bfd8905b9e8854b2aa31c1bcf1142119e0 | JavaScript | colinlmcdonald/algorithm-practice | /learn-generators.js | UTF-8 | 515 | 3.828125 | 4 | [] | no_license | 'use strict';
// function *range(from, to) {
// var x = from;
// while (x <= to) {
// yield x;
// x++
// }
// }
// for (var r of range(5, 10)) {
// console.log( r );
// }
function *factorial(n){
// your code here
for (var i = 1; i <= n; i++) {
var temp = [];
for (var k = i; k > 0; k-... | true |
972e0a45b0a3fc8c93129df090ecea9a63f832f2 | JavaScript | angelosity/B2T-Cohort4 | /daysofweek/script.js | UTF-8 | 451 | 3.46875 | 3 | [] | no_license | let day="";
switch (new Date().getDay()) {
case 0:
//document.getElementById("day").innerHTML= " Welcome today is sunday";
day= "sunday";
break;
case 1:
day="monday";
break;
case 2:
day= "tuesday";
break;
case 3:
day= "wednesday";
break;
case 4:
day= "thursday";
case 5:
day= "... | true |
e960e53760db963abad13b8fa93f76d42c91a64d | JavaScript | johnsabilla/insanityApp | /client/views/schedule/schedule.js | UTF-8 | 2,106 | 2.59375 | 3 | [
"MIT"
] | permissive |
Template.schedule.helpers({
schedules : function(){
var sched = schedules.find({}).fetch();
console.log('in helper: ', sched);
console.log('this helper', this);
return sched;
},
});
Template.schedule.events({
'click a' : function(event,template){
console.log('a tag ID ',event.target.id);
con... | true |
91e15da4a92a43e11c48a7826939018e9c0345c4 | JavaScript | lseyesl/js_Functional_prog | /c4.js | UTF-8 | 1,010 | 3.28125 | 3 | [] | no_license | var add = function(x){
reutrn function(y){
return x+y;
}
}
var increment =add(1);
var addTen = add(10);
increment(2);
addTen(2);
//////////////
var curry = require('lodash').curry;
var match = curry(function(what,str){
return str.match(what);
})
var replace = curry(function(what,replacement,str){
return str.re... | true |
05f6a5492238498039a51aef43e22eb15536b3eb | JavaScript | sejungkwak/drawing-app | /script.js | UTF-8 | 1,199 | 3.21875 | 3 | [] | no_license | const minusBtn = document.getElementById('minus');
const plusBtn = document.getElementById('plus');
const penSize = document.getElementById('width');
const color = document.getElementById('color');
const eraser = document.getElementById('eraser');
const canvas = document.getElementById('canvas');
const ctx = canvas.get... | true |
1d683c4de3339fc12da24ba2c993e80c34bc161c | JavaScript | shevernitskiy/sse | /js/sse.js | UTF-8 | 7,687 | 2.640625 | 3 | [] | no_license | /**
* Константа к месту расположения кода (sseServer.php и js/)
*/
var script = document.getElementById('ssescript');
const SSEURL = script.src.replace("js/sse.js","");
/**
* Функция динамической загрузки css
* @param {string} file
*/
function sseCSSLoad(file) {
var link = document.createElement("link");
... | true |
1393960439742bd23390ae53f4fa6c68dc6ef05f | JavaScript | lkopacz/egghead-blur-event | /src/js/nav.js | UTF-8 | 568 | 2.90625 | 3 | [] | no_license | const topMenuLinks = document.querySelectorAll(".menu__link");
topMenuLinks.forEach(link => {
if (link.nextElementSibling) {
link.addEventListener("focus", function() {
this.parentElement.classList.add("focus");
});
}
});
const subMenus = document.querySelectorAll(".submenu");
subMenus.forEach(subm... | true |
f2ce275bed51115e69a669eb6f867862fb68a454 | JavaScript | Lowtt/practice | /practice1/assets/js/home_img.js | UTF-8 | 934 | 2.953125 | 3 | [
"MIT"
] | permissive | var i = 0;
var imgArr = ['00.jpg','11.jpg','22.jpg'];
var homeImg = document.querySelector('#home_img');
var btn = document.querySelectorAll('button');
var init = setInterval(changeImg(),1000);
function changeImg(){
{
if(i==imgArr.length-1){
i=0;
}
homeIm... | true |
65a7c808ab7628884a921da6bb5b4141a0e2384c | JavaScript | nness13/Jinn_com | /src/components/common/Alert/alertReducer.js | UTF-8 | 1,068 | 2.796875 | 3 | [] | no_license | let initialState= {
messages: [
// {id:'0cfhh7hi', type: "info", text:'pushAlertAC', timeout: 10000}
],
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case PUSH_MESSAGE:
return {...state, messages: [...state.messages, {
id: actio... | true |
a967d89e4dc09957cb119f188364e02640e44a02 | JavaScript | coolinmc6/book_list | /src/containers/book-detail.js | UTF-8 | 1,105 | 2.859375 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
// L48 => when this was originally written, it was 'export default' and then class BookDetail...
// It was then rewritten by putting the export default at the bottom and using the connect()
// helper function
// L49 => now that we've conn... | true |
9952712e8c3309086368a99bd353a054bb9775a1 | JavaScript | ChristieRenaud/course-js-210 | /practice_problems/logic_and_flow_control/problem_20.js | UTF-8 | 1,384 | 4.53125 | 5 | [] | no_license | // input: a string, a numerical start index, and a numerical length.
// output: a string that is a substring of the original string.
// rules: If the starting index is negative, subtract from (or add the negative)
// value to the string length.
// If the length is longer than the available characters, just end
// the s... | true |
decc9816c1786356f95d18eb05d1ee8eec4589a0 | JavaScript | wziteng/doudizhu | /ddza/js/runtime/Num_Str.js | UTF-8 | 451 | 2.53125 | 3 | [] | no_license | import {Director} from "../Director.js";
export class Num_Str {
constructor(){
}
static Num_str(arr){
Director.sortCards(arr);
let index=[];
let key=[];
let data=[].concat(arr);
for (let i=0;i<arr.length;i++){
index.unshift(data[i]);
}
f... | true |
7ef1a6c64633a1814e8540ab411cd60357641829 | JavaScript | thortineoc/sms-frontend | /src/utilities/CallBackendPut.js | UTF-8 | 581 | 2.625 | 3 | [] | no_license | // ### USAGE EXAMPLE ###
// const axiosInstance = useAxios('http://52.142.201.18:24020/');
// const runBackend = useCallback((axiosInstance, url, data) => {
// if (!!initialized) {
// callBackendPut(axiosInstance, url, data)
// .then(response => doSomething(response))
// ... | true |
29eb75a5e860179fd0c8624c0bccd70e554bf057 | JavaScript | ephlexaudio/OfxEditorFlask | /static/js/EditorLayout/effectDrawingArea.js | UTF-8 | 3,142 | 2.515625 | 3 | [
"MIT"
] | permissive |
function showProcessId()
{
var evt = d3.event;
console.log(evt.currentTarget.getAttribute("id"));
}
function showConnectionId()
{
var evt = d3.event;
console.log(evt.currentTarget.getAttribute("id"));
}
function displayCoords(x,y,extra)
{
var xNode = document.getElementById("xpos");
var yNode = docum... | true |
2bf692c85f404822464b937cea89ed2cd8f8d6cf | JavaScript | MichaelOlmosTrujillo/mandelbrot_sect_fractal | /js/index.js | UTF-8 | 1,485 | 3.65625 | 4 | [] | no_license |
var myCanvas = document.createElement("canvas");
myCanvas.width = 1500;
myCanvas.height = 700;
document.body.appendChild(myCanvas);
var ctx = myCanvas.getContext('2d'); // I'm not sure if the variable ctx works as a global variable, this could create an error
ctx.translate(myCanvas.width/5, 0);... | true |
f794afe5116cbd8a6d57d748025e8849477acbdf | JavaScript | camschnackel/portfolio | /server/public/scripts/controllers/contact.controller.js | UTF-8 | 926 | 2.515625 | 3 | [] | no_license | myApp.controller('ContactController', function ($scope, ContactService) {
console.log('ContactController created');
$scope.currNav = 'contact';
var vm = this;
vm.contactForm = {
name: this.name,
email: this.email,
message: this.message
};
vm.modal = {};
vm... | true |
4e9b44a4f804ac809d00db183b049578e5ca4743 | JavaScript | JATAYLORNC/socialPETS | /controllers/authController.js | UTF-8 | 1,628 | 2.546875 | 3 | [] | no_license | const User = require("../db/models/User");
const passport = require("../passport");
// Defining methods for the authController
module.exports = {
getUser: (req, res) => {
console.log(`===== user!!======`);
if (req.user) {
return res.json({ user: req.user });
} else {
return res.json({ user: ... | true |
25595017e01754bc016c7917cb60dca8e8fdf995 | JavaScript | GatorEcho/marcusdavenport.io | /script.js | UTF-8 | 2,907 | 2.546875 | 3 | [] | no_license | $('document').ready(function () {
var wait;
var animate = true;
//scroll to page sections rather than jump
$('a').click(function () {
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 500);
return false;
});
//This section control... | true |
9523c60e7075b3d38e4c0498d2b8c3547e560baf | JavaScript | Visibleon12/Node-Server | /route.js | UTF-8 | 1,167 | 2.609375 | 3 | [] | no_license | const users=require('./data')
const routes=(req,res)=>{
const url=req.url;
const method=req.method;
if(url==='/'){
res.setHeader('Content-Type','text/html')
res.write('<html>')
res.write('<head><title>MY Server Page</title></head>')
res.write('<body><p>Hello To my server!</p>')
res.write('<fo... | true |
b82fede9ea17989b95cab15195ea9258cf2d8815 | JavaScript | ComputeCoin/cli | /index.js | UTF-8 | 604 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env node
'use strict';
const program = require('commander');
program
.version('0.0.1')
.command('command <req> [optional]')
.description('command description')
.option('-o, --option','we can still have add more options')
.action(function(req,optional){
console.log('.action() allows us to implem... | true |
dfbd710647224e90782bae77ceec346bb5530fc6 | JavaScript | SamSamskies/interview-practice | /findSum.js | UTF-8 | 651 | 3.71875 | 4 | [] | no_license | 'use strict';
const testCases = {
given: {
array: [9, 3, -2, 5, 23, 1, 0],
targetSum: 9
},
expected: [1, 3, 5]
};
function findSum(array, targetSum) {
if (array.length < 3) return [];
array.sort((a, b) => a - b);
for (let i=0; i < array.length - 2; i++) {
const num1 = array[i];
const num... | true |
8f690c1efef59fe2ffee05292ecb159f657ac6ce | JavaScript | JustinData/GA-WDI-Work | /w06/d02/Mihran/homework/geometry.js | UTF-8 | 1,069 | 4 | 4 | [] | no_license | //RECTANGLES//
function Rectangle(length, width) {
this.length = length;
this.width = width;
this.isSquare = function(){
return (this.length === this.width);
}
this.perimeter = function(){
return (2 * (this.length + this.width));
}
}
jim = new Rectangle(6,6)
john = new Rectangle(12,4)
//TRIANGLE... | true |
d020d8956c5fcf876f977bbee0e643397a0c4501 | JavaScript | Tanmay53/cohort_3 | /submissions/sm_102_amit/week_03/day_3/session_2/split_string.js | UTF-8 | 357 | 3.890625 | 4 | [] | no_license | // split string
function splitString(input, point) {
input = input.toLowerCase();
point = point.toLowerCase();
var array = [];
for (var i = 0; i < input.length; i++) {
if (input[i] == point) {
array.push(" ");
} else {
array.push(input[i]);
}
}
console.log(array.join(""));
}
splitS... | true |
172d41b80a8fa49120ebd9377a8e6512ea2590bc | JavaScript | usmanwadood/mywebsite | /script.js | UTF-8 | 1,469 | 3.09375 | 3 | [] | no_license | // /* When the user clicks on the button,
// toggle between hiding and showing the dropdown content */
// function dropDown() {
// document.getElementById("myDropdown").classList.toggle("show");
// }
// // Close the dropdown menu if the user clicks outside of it
// window.onclick = function(event) {... | true |
9af87a9e712029bd0179b44545bf099586c66938 | JavaScript | peterthompson/basket-checkout | /test/integration/Catalogue.spec.js | UTF-8 | 1,878 | 2.515625 | 3 | [] | no_license | import { assert } from 'chai'
import { mount } from 'enzyme'
import nock from 'nock'
import React from 'react'
import { Link } from 'react-router'
import { api } from '../../app/js/constants'
import configureStore from '../../app/js/configureStore'
import Catalogue from '../../app/js/components/Catalogue'
const timeou... | true |
14325c367412fcf4b877ad19d0e49db9b91cb6fa | JavaScript | bryanberger/abstract-copy-master | /app.js | UTF-8 | 3,380 | 2.625 | 3 | [] | no_license | require('dotenv').config()
const os = require('os')
const fs = require('fs-extra')
const git = require('nodegit')
const glob = require('glob')
const watch = require('node-watch')
// User Defined
const REPO_ID = process.env.REPO_ID
const FI... | true |
1fbf07059d91010843415e144d7e134ed41ea0aa | JavaScript | cupdir/idgen | /test/memoryModule.js | UTF-8 | 1,290 | 2.65625 | 3 | [
"MIT"
] | permissive | var events = require('events'),
util = require('util'),
io = require('socket.io').listen(8080),
map = {};
//定义一个内存类
function memory(){
this.http();
this.counter = [];
events.EventEmitter.call(this);//改变上下文指针
}
util.inherits(memory, events.EventEmitter); //继承EventEmitter
memory.prototype.http = function(){
var s... | true |
7090dfc9da36bac04d63ff0990403fde5225434c | JavaScript | LindquistErik/Wk1Practice | /Day1.js | UTF-8 | 263 | 3.046875 | 3 | [] | no_license | var my_number = "33"
console.log(my_number);
my_number /2
console.log(my_number/2)
var someones_number = "13"
console.log(someones_number)
var someones_number = "7"
console.log(someones_number)
my_number - someones_number
console.log(my_number - someones_number)
| true |
97f853eb3f498c2ff33d80fcdb4ed539b58b2158 | JavaScript | clairefan816/FeedMeReactJSUI | /src/components/Pickup/Pickup.js | UTF-8 | 2,378 | 2.640625 | 3 | [] | no_license | import React, {Component} from 'react';
import './Pickup.css'
import axios from 'axios';
class Pickup extends Component {
constructor(props) {
super(props);
this.state = {
orderStatus: 'Delivering',
orderId: '',
showError: false,
showUpdate: false,
... | true |
96336f0f8d7122afd2f0e8ee720b51f85bfa9a28 | JavaScript | rabhijit/ChilliPadi | /project_toolkit/anatomy.js | UTF-8 | 1,050 | 2.90625 | 3 | [] | no_license | import React, { Component } from "react";
import { View } from "react-native";
import { Container, Text } from "native-base";
/*
other import statements or
JS variables like const here - can be dummy datas to use for development
*/
export default class MyComponent extends Component {
constructor(props) {
... | true |
9e46b63c27fd87843fe7d410ce5304342b87e317 | JavaScript | pofman/JasminePoc | /src/Person.js | UTF-8 | 454 | 4.03125 | 4 | [] | no_license | var Person = function(firstName, birthDate) {
if(firstName == null || firstName == "") {
throw new Error("First name is required");
}
if(birthDate == null || !(birthDate instanceof Date)) {
throw new Error("Birth date is required");
}
this.firstName = firstName;
this.birthDate = birt... | true |