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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8482ef31b5ab3e41d71f674cc440b3c008e71266 | JavaScript | wangxiaojingit/node | /16http/client.js | UTF-8 | 275 | 2.609375 | 3 | [] | no_license | let http=require("http");
let config={
host:"localhost",
port:3000,
method:'get',
headers:{
"a":1
}
}
let client=http.request(config,(res)=>{
res.on("data",(data)=>{
console.log(data.toString());
})
})
client.end(); //发送请求
| true |
1a2cfa9b61dd73d4d4b65e31a2c589a381ca51a0 | JavaScript | liyfsz/base_exercise | /DEMO01/js/helpers.js | UTF-8 | 1,100 | 2.84375 | 3 | [] | no_license | $(function(){
/**
* 是否相等
*/
Handlebars.registerHelper('eq', function (a, b) {
return a == b;
});
/*
* 金额格式化
*/
Handlebars.registerHelper('formatMoney', function (s) {
n = 2;
if(s==0){
return s.toFixed(n);
}else if(!s){
retur... | true |
699a7360d4bd8163be872dbd15d9855943992c20 | JavaScript | RagnarEinestam/TestWebsite | /scripts.js | UTF-8 | 2,930 | 2.734375 | 3 | [] | no_license | try {
var style = localStorage.getItem("index");
document.getElementById(style).selected = true;
document.getElementById("header").style.backgroundColor = localStorage.getItem("header-color");
document.getElementById("header").style.color = localStorage.getItem("header-font-color"); document.getElementB... | true |
b4b425a7e052d1eed778752b8f700b234168f21a | JavaScript | hqi78/hqi78.github.io | /1.js | UTF-8 | 236 | 2.9375 | 3 | [] | no_license | function poll() {
var ans = prompt("What's Your favorite flavor of ice cream?");
document.getElementById("yourresponse").innerHTML = "Your response: <br/>" + ans;
document.getElementById("pastresponses").innerHTML += (ans + ", ");
}
| true |
efc4897789b2ab6e4c55785766edd3a6392ac75b | JavaScript | airme1019/js | /src/290WordPattern.js | UTF-8 | 606 | 3.125 | 3 | [] | no_license | /*
https://leetcode.com/problems/word-pattern/
*/
var wordPattern = function(pattern, str) {
let words = str.split(' ');
if (words.length !== pattern.length) return false;
const mapped = new Set();
const hash = {};
for (let i = 0; i < pattern.length; i++) {
const currPattern = pattern[i];... | true |
06102c2f79c9192235bcb5be667ba363f66a438c | JavaScript | jackyli97/data-strucs-and-algos | /general/min_window_substring.js | UTF-8 | 2,703 | 3.9375 | 4 | [] | no_license | /**
* @param {string} s
* @param {string} t
* @return {string}
*/
var minWindow = function (s, t) {
if (s.length === t.length && t === s) return s;
if (s.length < t.length || t.length === 0) return "";
let tOcc = findOcc(t);
let sOcc = {};
for (let i in t) {
sOcc[t[i]] = 0;
}
let L = 0;
let... | true |
0f177da7ff6023563b8ebc0946d6db71bd989217 | JavaScript | Edmundo-Ribeiro/Inside-The-Matrix | /Symbol.js | UTF-8 | 674 | 3.28125 | 3 | [] | no_license |
class Symbol{
constructor(x,y){
this.x = x;
this.y = y;
this.sym = Symbol.getRandSymbol();
this.rate = Math.floor(Math.random()*MAXCHANGE + 3);
}
static getRandSymbol(){
return Math.random() > 0.2 ? String.fromCharCode(0x30A0 + Math.floor(Math.random()*95)) : Ma... | true |
4429e1ae47b88ccb506aaf5e0ebabb6abf8897fa | JavaScript | eydiss/Verkefni-9 | /scripts.js | UTF-8 | 2,941 | 3.203125 | 3 | [] | no_license | const API_URL = 'https://apis.is/company?name=';
/**
* Leit að fyrirtækjum á Íslandi gegnum apis.is
*/
const program = (() => {
let companies;
const results = document.querySelector('.results');
// fengið úr fyrirlestri 10
function el(name, ...children) {
const element = document.createElement(name);
... | true |
68183a22bd82bd29c21addb6bbcf574c233a36f2 | JavaScript | adrientremblay/Old-Site-HTML | /untitled folder/scenes/mainMenu.js | UTF-8 | 930 | 2.5625 | 3 | [] | no_license | // var skyisblue;
var mainMenu = new Phaser.Class({
Extends: Phaser.Scene,
initialize: function Preload(){
Phaser.Scene.call(this, {key: "mainMenu"});
},
preload: function(){
},
create: function(){
console.log("Main Menu Loaded!");
this.add.text(16,16, mainMenuText, {fontSize : "20px", fill : "... | true |
508782a65015f5384e0b0f9fec732711bff35cde | JavaScript | marysitz/edu | /eloquent-javascript/02-program-structure-01-looping-a-triangle.js | UTF-8 | 306 | 4.8125 | 5 | [] | no_license | // Looping a triangle
// Write a loop that makes seven calls to console.log to output the following triangle:
// #
// ##
// ###
// ####
// #####
// ######
// #######
function triangle(num) {
var myTriangle = "";
for (var x = 1; x <= num; x++) {
console.log(myTriangle += "#");
}
}
triangle(7); | true |
c63bdb3d386786d6d575b52b7b18245218355d91 | JavaScript | ortophius/game | /lib/Ticker.js | UTF-8 | 1,279 | 2.828125 | 3 | [] | no_license | const {performance} = require('perf_hooks');
const EventEmitter = require('events');
/**
* Server side Time ticker.
* Used to update things in time.
* @extends {EventEmitter}
* @property {number} fps The current game FPS.
*/
class Ticker extends EventEmitter {
/**
* Create an instance of Ticker.
* Should ... | true |
8b45d113dadc86bfcd10d7f1a7ebc61c64c0b091 | JavaScript | codacy-badger/std-classifier | /test/dissemination.js | UTF-8 | 8,480 | 2.59375 | 3 | [] | no_license | import test from 'ava';
import { Classification } from '../dist/classifier';
test('Dissemination controls default to blank', t => {
const classification = new Classification();
classification.setClassificationLevel(4);
t.is(classification.toString(), 'TOP SECRET');
});
test('Dissemination controls enables RSEN'... | true |
76d4bfe15954ad1c22f1050b8a12206a5f73db9e | JavaScript | mstanka/da-web-2021 | /20210510-React-3/zkracovaci-jednohubky/index.js | UTF-8 | 616 | 3.71875 | 4 | [] | no_license | // const isEmail = (str) => {
// return str.includes('@');
// };
const isEmail = (str) => str.includes('@');
// const roll = () => {
// return Math.floor(Math.random() * 6) + 1;
// };
const roll = () => Math.floor(Math.random() * 6) + 1;
// const getNumber = (id) => {
// return Number(document.querySelector(`... | true |
f6dd8cda9941b4207e5f39e11989d8a3021731a0 | JavaScript | jiangtt18/KiwiCo | /lib/kiwi.js | UTF-8 | 3,722 | 2.859375 | 3 | [] | no_license | import {comments} from './util.js';
let convenient = document.getElementById('convenient');
let lists = document.getElementsByTagName('LI');
let ul = document.getElementsByTagName('UL');
document.addEventListener('DOMContentLoaded', function(){
selectDefault();
});
for(let i=0;i<lists.length;i++){
onMouse(lists... | true |
07b8b1d4d792f9b6c4407f36166a051e9d7fc46c | JavaScript | ridwanzal/phising_detector | /phising_detector_public/assets/legitimate/L00076/WEBPAGE/whatsapp.js | UTF-8 | 2,702 | 2.578125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | var checkJQ = 0;
function checkJquery() {
if (window.jQuery) {
jqueryLoaded();
}
if(checkJQ == 0) {
checkJQ = window.setInterval(checkJquery, 50);
}
}
checkJquery();
function jqueryLoaded() {
clearInterval(checkJQ);
$(document).keyup(function(e) {
if (e.keyCode == 27) {
$('#lng_open').slideUp(... | true |
b2f9f32a0e8c5b33388c79dc86cc54558f6714bb | JavaScript | spyrosgames/PyramidsValleyCode | /Scripts/SlaveAttackMoveController.js | UTF-8 | 1,602 | 2.78125 | 3 | [] | no_license | #pragma strict
// Public member data
public var motor : MovementMotor;
public var weaponBehaviours : MonoBehaviour[];
public var fireFrequency : float = 2;
// Private memeber data
private var ai : AI;
private var character : Transform;
private var firing : boolean = false;
private var lastFireTime : float = -1;
pr... | true |
be229b85866178f47490ec110b69edeb384668d9 | JavaScript | Duncan-7/pairing-app-frontend | /src/containers/Matches/Matches.js | UTF-8 | 2,053 | 2.625 | 3 | [] | no_license | import { Component } from 'react';
import Button from '../../components/UI/Button/Button';
import Spinner from '../../components/UI/Spinner/Spinner';
import Aux from '../../hoc/Aux/Aux';
import Match from './Match/Match';
import axios from '../../axios-instance';
import moment from 'moment';
class Matches extends Com... | true |
a55414a1905c8d0ee69bd85bcfe18e672f2c6948 | JavaScript | thevoidf/opus | /commands/player.js | UTF-8 | 2,374 | 2.640625 | 3 | [] | no_license | const ytdl = require('ytdl-core');
const queue = new Map();
const player = module.exports = exports = {};
player.play = async ({ message, command, args }) => {
const { channel: textChannel, member: { voiceChannel } } = message;
const serverQueue = queue.get(message.guild.id);
if (!voiceChannel)
return message.... | true |
6f938da6d7c02b3564e30f20527e1072392aa99a | JavaScript | ymf1994/portrayal-system | /src/common/utils/tagRelationUtil.js | UTF-8 | 1,214 | 2.59375 | 3 | [] | no_license | const relateTypeMap = {
0: "与",
1: "或",
2: "非"
};
// 获取标签选择文本
export function getAllConditionText(arr = [], relateType = 0) {
let allConditionTexts = [];
arr.forEach(tag => {
let conditionTexts = [];
tag.condition.forEach(t => {
let currentTagTexts = [];
//填入标签名称
currentTagTexts.push... | true |
e867987079ff8bbc64581cbb3054a0a8d23f9fde | JavaScript | tomkren/TFGP | /www/js/treeView.js | UTF-8 | 6,689 | 2.59375 | 3 | [
"MIT"
] | permissive | // == TREE VIEW component ========
function mkTreeView($el, config) {
// -- default config --
config = _.assign({
treantContainerName: 'treeView-treant',
height: 400
}, config || {});
// -- listeners -------
var clickNodeListeners = [];
// -- components ------
var nodeInfo... | true |
998807ae93593c62d72d4252bbf27c89e90ed760 | JavaScript | ebasic/codility-practice | /6.max_product_of_three.js | UTF-8 | 179 | 2.90625 | 3 | [] | no_license | console.log(solution([-2, -1, 1, 3, 60]))
function solution(A) {
A.sort(function(a,b) { return b-a })
return Math.max(A[0]*A[1]*A[2], A[0]*A[A.length-1]*A[A.length-2])
}
| true |
dbd782616b7e13406026c602ca018e1822be38e0 | JavaScript | catherin3/my-pagination | /src/Component/Pokedex.js | UTF-8 | 2,614 | 2.65625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Typography, Link, CircularProgress, Button} from "@material-ui/core";
import { toFirstCharUppercase } from "../Constants";
import axios from "axios";
const Pokemon = (props) => {
const { match, history } = props;
const { params } = match;
const {... | true |
6f19106d3ec31f150c6d8ed3c1bfa8e04bef248d | JavaScript | eksepsjon/hyssing | /src/services/transforms/Replace.js | UTF-8 | 1,511 | 2.625 | 3 | [] | no_license | export default class Replace {
info() {
return {
"prefix": "replace",
"arguments": "<Regex> <optional Replacement>",
"applicable": ["text"],
"text": "Replace all characters matching regex with replacement."
}
}
validate(dataBox, inputArr) {
... | true |
36a5608b53c442c37c2c88e165ca0ea33b77d922 | JavaScript | cheungyanho/eecs-448-lab8 | /lab08/ex4/ex4.js | UTF-8 | 2,448 | 3.265625 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", () => {
const button = document.querySelector("#button")
button.addEventListener("click", () => {
colour();
document.querySelector("#input1").value = "";
document.querySelector("#input2").value = "";
document.querySelector("#input3").valu... | true |
9c1f9ed1fc24e4bf325d9a315fd9ecbb4f5ca7aa | JavaScript | liminhu/TSHuaWuQueSSH | /TSHuaWuQueSSH/WebRoot/demo_js/tools.js | UTF-8 | 4,680 | 2.640625 | 3 | [] | no_license | var tools = {
check_cookie:function(){
if(window.navigator.cookieEnabled)
return true;
else{
alert("浏览器配置错误,Cookie不可用!");
return false;
}
}
,set_cookie:function(name,value){
var Days = 30; //此 cookie 将被保存 30 天
var exp = new Date(); //new Date("December 31, 9998");
exp.setTi... | true |
46aa9bee8c237018fe1f1f1a62b8ac8b3cb664ed | JavaScript | IhaszBalint/beugro_feladat | /scripts/controllers/main.js | UTF-8 | 1,241 | 2.53125 | 3 | [] | no_license | angular.module("userEditorApp")
.controller('mainCtrl', function($scope, dataService){
dataService.getUsers( function(response){
console.log(response.data);
$scope.users = response.data;
});
//szerkesztő modal betöltése a választott userrel / új üres userrel
$scope.editUser = function(user, index) {
... | true |
6f472da5af5ef38088f392aa5a8a50807709ecfb | JavaScript | NikhilVerma/finna-be-octo-robot | /dist/js/views/FlightResult.js | UTF-8 | 4,403 | 2.546875 | 3 | [
"MIT"
] | permissive | define("views/FlightResult", function () {
var create = O.DOM.create;
var FlightResultView = Backbone.View.extend({
className: 'flight-result',
events: {
'click button': 'doBooking_'
},
doBooking_: function () {
window.alert('That\'s all folks');
... | true |
27750756f44224ee54b5541e748be91396dbc0cb | JavaScript | Dimas170920/JS_Courses | /Week1/3/index.js | UTF-8 | 563 | 3.078125 | 3 | [] | no_license | /**
* @param {Number} hours
* @param {Number} minutes
* @param {Number} interval
* @returns {String}
*/
module.exports = function (hours, minutes, interval) {
var s="";
minutes=minutes+interval;
if((minutes/60)>=1){
hours=hours+Math.floor(minutes/60);
if((hours/24)>=1){
hours=hou... | true |
5f22681fb928d2788e0efbc4c5bbbb19f3b97fed | JavaScript | ParrotStone/JS-Problem-Solving | /Viral Advertising/main.js | UTF-8 | 497 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
// Problem Description at -> https://www.hackerrank.com/challenges/strange-advertising/problem
function viralAdvertising(n) {
let cumulative = 0;
let shared = 5;
for (let i = 1; i <= n; i++) {
let liked = Math.floor(shared / 2);
cumulative += liked;
shared = liked * ... | true |
50c1149113e94640d66337363b55d80b6d9d4db6 | JavaScript | differentsyntax/ClassicConway | /conway.js | UTF-8 | 5,625 | 3.625 | 4 | [] | no_license | // Mridul Awasthi
// CS 375-001
// Homework 3
// Note: Every white cell is dead. Every non-white cell is alive.
// Note: Have also done the extra credit part.
var interv = 0;
function startInterval() {
clearInterval(interv);
interv = setInterval(stepBoard, 100);
}
function stopInterval() {
clearInterval(interv... | true |
cf23222916ea8e6bbbed778876e375004e64e20c | JavaScript | PascalPflaum/uberObjects | /test/valuesTest.js | UTF-8 | 626 | 2.703125 | 3 | [
"MIT"
] | permissive | if (typeof exports !== 'undefined') {
var chai = require('chai');
var sinonChai = require("sinon-chai");
var sinon = require('sinon');
chai.use(sinonChai);
chai.config.includeStack = true;
var uber = require('../')();
}
var expect = chai.expect;
describe('Object.values', function() {
it('empty object, empty... | true |
179f01f90c2424aec4b59fd6041cab46868c1986 | JavaScript | jennift/FreeCodeCamp | /pairwise.js | UTF-8 | 1,373 | 3.640625 | 4 | [] | no_license | function pairwise(arr, arg) {
var finalContainer = [];
var clone = arr.slice(); //duplicate arr
for (var i=0; i < arr.length; i++) {
var currentItem = clone[i];
var tempContainer = [];
for (var j=i+1; j<clone.length; j++) { //the next item of i
if (parseFloat(currentItem) + par... | true |
a0138339d5b42d2bc8b7cb90f4969d42b08c1f92 | JavaScript | mhnvelu/nodejs-advanced | /nodejs-internals/multitasks.js | UTF-8 | 1,156 | 3.140625 | 3 | [
"MIT"
] | permissive | const https = require("https");
const crypto = require("crypto");
const fs = require("fs");
const start = Date.now();
function doRequest() {
https
.request("https://www.google.com", (res) => {
res.on("data", () => {});
res.on("end", () => {
console.log("https req : ", Date.now() - start);
... | true |
1234d2e37fbe1b0d1c6c4684d498bdde2491504b | JavaScript | ikenticus/blogcode | /js/tasks/recursion-basic.js | UTF-8 | 1,002 | 3.515625 | 4 | [] | no_license | 'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
inputString += inputStdin;
});
process.stdin.on('end', _ => {
inputString = inputString.replace(/\s*$/, '')
.split(... | true |
89566fd92ecf30a2831420f841d43f34bfd23006 | JavaScript | wikimedia/analytics-dashiki | /test/lib/state-manager.js | UTF-8 | 2,635 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
define(function (require) {
var ko = require('knockout'),
stateManagerFactory = require('stateManager'),
URI = require('mocks.URI');
describe('State Manager URL parsing functions', function () {
beforeEach(function () {
});
afterEach(function () {
... | true |
8eb317fff323478354f5fd5d6300d366d2cdb575 | JavaScript | shubh24i/userChat-theme | /src/component/UserList/UserList.jsx | UTF-8 | 987 | 2.53125 | 3 | [] | no_license | import React from "react";
//import React, { useState, useEffect } from "react";
import UserListItem from "./UserListItem/UserListItem";
import userList from "./../../data/userChat.json";
import styles from "./UserList.module.css";
const UserList = () => {
/*
//Api Call
const [data, setData] = useState();
u... | true |
8368bc4ba354ac030afa4a41747a11970394685f | JavaScript | iliaspapas/CateringService | /CateringService/src/main/webapp/resources/scripts/functions.js | UTF-8 | 3,136 | 3.109375 | 3 | [] | no_license | function checkPassword() {
var pass = document.getElementById("disbook_password").value;
var confirm = document.getElementById("disbook_passwordConfirm").value;
if (pass != confirm)
window.alert("Passwords do not match.");
}
function checkInput() {
function che... | true |
a5a60a2eb61caca12440dd2ed96d6ecac248dc73 | JavaScript | genomizer/genomizer-web | /app/js/models/sysadmin/GenomeReleaseFile.js | UTF-8 | 2,311 | 2.6875 | 3 | [] | no_license | /**
* A model class for representing a genome release file.
*/
define([], function() {
var GenomeReleaseFile = Backbone.Model.extend({
defaults : {
"fileName" : "Not defined",
"species" : "Not defined",
"genomeVersion" : "Not defined",
"folderPath" : "Not defined",
"files" : "Not defined"
},
ini... | true |
0b687e6901817cd3367b0d1b38d82448ea4593ef | JavaScript | JankMajesty/imdb-clone-react-node | /client/src/pages/Login/Login.js | UTF-8 | 2,028 | 2.53125 | 3 | [] | no_license | import React, { useState } from "react";
import { useHistory } from "react-router-dom";
import { Link } from "react-router-dom";
import "./Login.css";
export default function Login({ setIsAuthenticated }) {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [error, ... | true |
e989bca6f48b88cd759cc389740a83aed39318f1 | JavaScript | embob/cat-age-calculator | /test/test.js | UTF-8 | 4,415 | 3.40625 | 3 | [] | no_license | const { strictEqual } = require("assert");
const {
getCatAgeObject,
getCatAgeString
} = require("../src/index");
describe("Cat age calculator", () => {
describe("getCatAgeObject", () => {
it("should return { years: 0, months: 1 } when passed in 1", () => {
const catAge = getCatAgeObject(1);
stric... | true |
33c4a174094e663ea155eeef9af356a480394c9b | JavaScript | saradacp/javascript-code-snippets | /fibonacci.js | UTF-8 | 91 | 3.34375 | 3 | [] | no_license | var fibonacci = function (n) {
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
}; | true |
02f926c1e033ff074c716fdd2c93bde8c5c0f4c2 | JavaScript | MohammedTurk/Simple-Ecommerce | /src/Component/Context.js | UTF-8 | 5,525 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import { storeProducts, detailProduct, sweetsProducts } from "../data";
const ProvideContext = React.createContext();
export default ProvideContext;
class ProductProvider extends Component {
state = {
storeProducts: storeProducts,
detailProduct: detailProduct,
swe... | true |
6bbb2f343a185a21ece53e094c75db53f3a7eddc | JavaScript | ladydragonforever/KidsCart | /routes/api/admin.js | UTF-8 | 45,393 | 2.5625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const Meal = require('../../models/Meal');
const Child = require('../../models/Child');
const passport = require('passport');
router.get("/seed", async (req, res)=>{
const password_digest = "$2a$10$jjDnk0HSq... | true |
81a7f9773ba12e6b545fcab13cc7513cf2216893 | JavaScript | SOPT-27th-Server-5team/Gyunny | /1st-seminar/variable.js | UTF-8 | 500 | 3.890625 | 4 | [] | no_license | // var 재선언, 재할당 가능 + 초기화 안해도 됨
var variableVar = "123";
var variableVar = "321";
console.log(`variableVar: ${variableVar}`);
// let 재할당 가능, 재선언 안됨
let variableLet = "123";
variableLet = "321";
console.log(`variableLet: ${variableLet}`);
// const 재선언, 재할당 불가능
const variableConst = "123";
//const variableConst = ... | true |
c42e3b581481c0ca27ae415a2026a8b0634e45f9 | JavaScript | clintonn/forking-paths | /src/actions/index.js | UTF-8 | 1,711 | 2.609375 | 3 | [] | no_license | import axios from 'axios'
axios.defaults.baseURL = "http://localhost:3000/api/v1"
axios.defaults.headers.common['AUTHORIZATION'] = sessionStorage.getItem('jwt')
export const createUser = (user) => { // call on Rails API to hit the Create action
const response = axios.post('/signup', user) // user is object with f... | true |
362b17d9debcca6911c1d83845c9a31b59304c96 | JavaScript | biezhenyu/anyDoor | /src/app.js | UTF-8 | 1,251 | 2.609375 | 3 | [
"MIT"
] | permissive |
const http = require('http');
// 美化输出内容
const chalk = require('chalk');
const config = require('./config/defaultConfig');
const fs = require('fs');
const path = require('path');
http.createServer((req, res) => {
res.statusCode = 200;
// 拼接路径
const filePath = path.join(config.root, req.url);
fs.stat(filePa... | true |
4e62fb5e64d6e1e88fcb2beaf3fb6c8e364fdcc2 | JavaScript | liuwenzhuang/babel-plugins | /src/convertVar.js | UTF-8 | 2,013 | 2.609375 | 3 | [] | no_license | module.exports = function ({ types: t }) {
const nestVariableDeclarationVisitor = {
VariableDeclaration: function (path) {
const { node } = path;
if (!node) return;
if (node.kind !== 'var') return;
const declarations = node.declarations;
const siblings = path.container;
console... | true |
f8d7584a12d37a0374542fd456107e2c00565324 | JavaScript | ImMandl/tema_2 | /oppgavesett_7/oppgave_3/index.js | UTF-8 | 661 | 3.109375 | 3 | [] | no_license | const box = document.querySelector("#box");
let xpos = 500;
let speed = 1;
let boxIsOn = true;
let roter = 45;
function moveBox() {
xpos += speed;
box.style.left = xpos + "px";
}
function EndreBox() {
if (xpos > 600) {
box.style.backgroundColor = "coral";
} if (xpos > 700) {
box.style... | true |
4e1adafdd5a13e8d170c56907d5e326093ef65ef | JavaScript | mvaganov/rankedvote | /views/common.js | UTF-8 | 672 | 2.90625 | 3 | [] | no_license | var ByID = function(eid) { return document.getElementById(eid); }
var LOADING_ELEMENT = null;
function showLoadingElement(on_off) {
if(!document.body){ return setTimeout(function(){showLoadingElement(on_off);},1); }
if(on_off) {
if(LOADING_ELEMENT) {
LOADING_ELEMENT.style.visibility = undefined;
} else {
LO... | true |
bb646c42c577d08d0acdfcd5311239fa71849e1e | JavaScript | marcus0226/front-end-react-project | /src/CharacterCard.js | UTF-8 | 1,238 | 3 | 3 | [] | no_license | import React from "react";
function CharacterCard({ Character, onDeleteCharacter, onUpdateCharacter }) {
const { id, name, image, likes, title } = Character;
function handleDeleteClick() {
fetch(`https://twtk-characters.herokuapp.com/characters/${id}`, {
method: "DELETE",
})
.then((r) => r.jso... | true |
f452b6bf8126f303f32bdbbecb87d85c177a7791 | JavaScript | ryanfarzad/random-sqaures | /js/index.js | UTF-8 | 875 | 2.90625 | 3 | [
"MIT"
] | permissive | var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var x = 1;
var y = 1;
var setProto = function() {
this.vx = 1;
this.vy = 1;
this.pause = false;
this.Pause = function() {
if (this.pause){
this.pause = false;
requestAnimationFrame(draw);
} else{
... | true |
b9553a55e538726750a9e2bee576a4b79a5ab927 | JavaScript | dimonarhipon/react | /src/components/Dialogs/Dialogs.js | UTF-8 | 2,170 | 2.578125 | 3 | [] | no_license | import React from "react";
import classes from "./Dialogs.module.css";
import DialogItem from "./DialogItem/DialogItem.js";
import Message from "./Message/Message.js";
let Dialogs = props => {
let onMessage = () => {
props.addMessage();
};
let onEditMessage = event => {
let body = event.target.value;
... | true |
f3615e673edc329155b76460c5de5cdacba8a312 | JavaScript | charlieporth1/dinosaur.compare | /app.js | UTF-8 | 5,000 | 2.78125 | 3 | [] | no_license | function onClick() {
createData();
removeFormFromDom()
}
function removeFormFromDom() {
document.getElementById("dino-compare").hidden = true;
document.getElementById("retry-btn").hidden = false;
document.getElementById("grid").hidden = false;
}
function onRetry() {
document.getElementById("di... | true |
6216ed45f0fecb0512a8c202a569733272d92cbf | JavaScript | prashantpawar/DrawingTool | /test/createRectangle.spec.js | UTF-8 | 1,710 | 2.53125 | 3 | [] | no_license | "use strict";
var deepFreeze = require('deep-freeze');
var proxyquire = require('proxyquire');
var chai = require("chai");
var sinon = require("sinon");
var sinonChai = require("sinon-chai");
var expect = chai.expect;
chai.use(sinonChai);
var createRectangle;
var rectangleCommand = 'R 3 4 1 2'.split(' ');
var outOfB... | true |
54cfe0bb145a5dc76f56a3096ba6edfb9611e7f5 | JavaScript | MarcFly/30-Days-JS | /Day09_HigherOrderFunctions/exercises.js | UTF-8 | 8,826 | 3.890625 | 4 | [
"MIT"
] | permissive | const countries_short = ['Finland', 'Sweden', 'Denmark', 'Norway', 'IceLand']
const names = ['Asabeneh', 'Mathias', 'Elias', 'Brook']
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const products = [
{ product: 'banana', price: 3 },
{ product: 'mango', price: 6 },
{ product: 'potato', price: ' ' },
{ product: ... | true |
61c9e85cd74a086c9365f5e8b27c1ed3c8f912ea | JavaScript | lackaff/wordlist-generator | /src/generate_wordlist.js | UTF-8 | 3,044 | 2.75 | 3 | [] | no_license | 'use strict';
var optimist = require('optimist');
var path = require('path');
var fs = require('fs');
var Promise = require('bluebird');
var getCorpusFromWikipedia = require('./lib/get_corpus_wikipedia');
var tokenise = require('./lib/tokenise');
var buildXML = require('./lib/build_xml');
var languagesCode = require(... | true |
048608694aa1ccf5ae169aaf4bb2f6d681f8b183 | JavaScript | tridmwpg/nodewpg | /js/index32.js | UTF-8 | 191 | 3.203125 | 3 | [] | no_license | let height = 10;
let base = 4;
let perimeter = 2 * (height + base);
let area = height * base;
console.log(`perimeter is ${perimeter}, area is ${area}, height is ${height}, base is ${base}`); | true |
9108600d1978298c420577b4d311e53bbab14f11 | JavaScript | jsdelivrbot/Sefaria-Rashi-Bot | /slack_bot.js | UTF-8 | 13,533 | 2.734375 | 3 | [] | no_license | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______ ______ ______ __ __ __ ______
/\ == \ /\ __ \ /\__ _\ /\ \/ / /\ \ /\__ _\
\ \ __< \ \ \/\ \ \/_/\ \/ \ \ _"-. \ \ \ \/_/\ \/
\ \_____\ \ \_____\ \ \_\ \ \_\ \_\ \ \_\ \ \_\
\/____... | true |
96ca89d0840c0818eea19e4973a5356e1769bda9 | JavaScript | chaihongjun/learning_typescript | /dist/基础/05.对象的类型-接口/03.任意属性.js | UTF-8 | 740 | 2.9375 | 3 | [] | no_license | "use strict";
/*
* @Author: ChaiHongJun
* @Date: 2019-12-12 14:59:39
* @LastEditTime: 2019-12-14 10:37:16
* @LastEditors: ChaiHongJun
* @Description: 头部文件注释
*/
/*
接口里面的任意属性使用
[属性名:string / number ]:any / number / string / boolean 等等
定义
1. 任意属性索引签名必须是 string 或 number 类型 ( An index signature parameter type must be... | true |
60e3c0c2a62711f91d6b8e8044ebe6a6ecf13445 | JavaScript | LucasOlivel/fatec_ipi_noite_react_native_primeiro_projeto | /App.js | UTF-8 | 1,658 | 3.390625 | 3 | [] | no_license | import React, { useState } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function App() {
//userState devolve um vetor
const[texto, setTexto] = useState('Texto Inicial!');
const[contador, setContador] = useState(0);
var sorteados = [];
var valorMaximo = 60;
... | true |
3c403d6044dbda804dac4c7b7bd19f5f36de117c | JavaScript | raphael1807/techdegree-project-5 | /oldcode/formatter.js | UTF-8 | 1,092 | 3.375 | 3 | [] | no_license | function formatTelephone(text) {
const regex = /^\D*(\d{3})\D*(\d{3})\D*(\d{4})\D*$/;
return text.replace(regex, '($1) $2-$3');
}
users[1].cell
function formatDate(text) {
const regex = /^\d{4}\-\d{1,2}\-\d{1,2}$/;
return text.replace(regex, '$2/$3/$1');
}
for (let i = 0; i < users.length; i++) {... | true |
9d71f0c7d9f5e702b6cf2e3ce84216cb8816b422 | JavaScript | Wildprogrammingape/To-Do-List-Application | /app.js | UTF-8 | 2,187 | 3.59375 | 4 | [] | no_license | // Define selectors of elements by class name
const todoAddButton = document.querySelector(".todo-addButton");
const todoInput = document.querySelector(".todo-input");
const todoList = document.querySelector(".todo-list");
// Add event and event handler
todoAddButton.addEventListener("click", addTodo); // when click... | true |
511ede24b3c721078fcccfda198d663d08b3a2d1 | JavaScript | tarynsauer/reactnd-project-myreads-starter | /src/SearchForm.js | UTF-8 | 2,066 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import PropTypes from 'prop-types'
import SearchResults from './SearchResults'
import * as BooksAPI from './BooksAPI'
class SearchForm extends Component {
state = {
errorMessage: '',
query: '',
searchResults: [],
}
hand... | true |
34dc4215c5179c2f20b3ac16e0bc49b867ffde72 | JavaScript | madhuvemula/underscore | /js partices/allkeys/index.js | UTF-8 | 438 | 2.640625 | 3 | [] | no_license | 'use strict';
(function() {
const a = document.querySelector('#obj');
const b = document.querySelector('#N-js');
const c = document.querySelector('#_ujs');
const name = {name: "Moses", Larry: "Louis", Curly: "Jerome"};
a.innerText = JSON.stringify(name);
const obj =_.allKeys(name);
c... | true |
fcf6cb8fb08b2361e84dde027c160ee4c4cfc493 | JavaScript | deedeedextor/JavaScript | /JSAdvancedLabAndExercise/Syntacs, Statements, Functions/syntaxExer1.js | UTF-8 | 5,927 | 3.859375 | 4 | [
"MIT"
] | permissive | function Fruit(fruit, weight, price){
let weightInKg = weight / 1000;
let sum = weightInKg * price;
return `I need $${sum.toFixed(2)} to buy ${weightInKg.toFixed(2)}
kilograms ${fruit}.`
}
console.log(Fruit('orange', 2500, 1.80));
function GreatestCommonDivisor(x, y){
while(y){
let temp ... | true |
3c139f7e1ca6110d9f4eed2cfb0eff645991c808 | JavaScript | SallyB1988/constructor-word-guess | /Word.js | UTF-8 | 1,196 | 3.859375 | 4 | [] | no_license | var Letter = require('./Letter.js');
function Word(str) {
this.solved = false;
this.word = [];
for (let i=0; i<str.length; i++) {
this.word.push(new Letter(str[i]));
}
// Creates a string representing the word. If letters have been guessed, they
// are displayed, otherwise they are represented by an ... | true |
1708279db34dfd4c6b59845f935558ca1ad20ee7 | JavaScript | Lyumih/lyumih.github.io | /hobby/upgrade-skills/upgrade-skills.js | UTF-8 | 1,685 | 3.53125 | 4 | [
"MIT"
] | permissive | let damage = 0;
let skill_damage = 5;
let level = 1;
let exp = 0;
let exp_max = 5;
let exp_step = 5;
let enemy_level = 1;
let enemy_health = 10;
let enemy_health_max = 10;
function battle() {
calculate_damage();
use_skill();
hit_enemy();
calculate_damage();
print_skill();
... | true |
7940c6956857cb589908cd8fae2498a8334c3544 | JavaScript | GabrielMS97/teste-CaminhoMinimo | /js/CenaFase1.js | UTF-8 | 6,380 | 2.765625 | 3 | [] | no_license | import Cena from "./Cena.js";
import Mapa from "./Mapa.js";
import Sprite from "./Sprite.js";
import modeloMapaFase1 from "../maps/mapa1.js";
export default class CenaFase1 extends Cena{
quandoColidir(a, b){
if(a.tags.has("pc") && b.tags.has("coin")){
if(!this.aRemover.includes(b)){
... | true |
633f30b8e3584a30b348a623029fd100d88211cb | JavaScript | MakoGS/lab-canvas-race-car | /starter_code/js/script.js | UTF-8 | 267 | 2.71875 | 3 | [] | no_license | /* eslint-disable no-undef */
const $canvas = document.querySelector('canvas');
const game = new Game($canvas);
const height = $canvas.height;
window.onload = function() {
document.getElementById("start-button").onclick = function() {
game.startGame();
};
}; | true |
d896ee0c8f3e90153087a5f9ea304b0fe589d67f | JavaScript | paralin/aard-browser | /src/app/components/game/game.service.js | UTF-8 | 1,923 | 2.640625 | 3 | [] | no_license | /*global PIXI*/
import { Entities } from './entities/index';
import { States } from './states/index';
import { Components } from './components/index';
export class Game {
constructor (preloader, $log) {
'ngInject';
this.preloader = preloader;
this.log = $log;
this.requiresMapUpdate = true;
}
i... | true |
c7686cfc12ee207fa77999c99c46f329ab439078 | JavaScript | peanut-cream/letao | /public/phone/js/search.js | UTF-8 | 1,530 | 2.609375 | 3 | [] | no_license | /**
* Created by 伍 on 2018/1/16.
*/
$(function(){
//根据数据渲染
function render(){
var arr=JSON.parse(localStorage.getItem("le_history"))||[];
$(".le-history").html(template("temp",{list:arr}))
}
render();
//在localStorage中添加数据
$(".btn-search").click(function(){
var arr=JSON.parse(localStorage.getI... | true |
3ff066f7337cc22540fd3b333bbcb5a86a16d389 | JavaScript | morphatic/feathers-auth0-authorize-hook | /lib/authorize.js | UTF-8 | 5,966 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* Checks the `Authorization` header for a JWT and verifies
* that it is legitimate and valid before allowing the
* request to proceed.
*/
const errors = require('@feathersjs/errors')
const jwt = require('jsonwebtoken')
const rp = require('request-promise')
module.exports = ({
// These two parameters allow u... | true |
ae36168c7dbe1295eccf2d1048fadfa889600c46 | JavaScript | LevonNahapetyan/Assignment-3 | /Task1.js | UTF-8 | 423 | 4.46875 | 4 | [] | no_license | /* If the number is prime, the output is True, if not then False */
function checkIfPrime(num) {
if(num === 1){
return false;
} else if (num === 2){
return true;
} else {
for(let divisor = 2; divisor <= Math.sqrt(num); divisor++) {
if(num % divisor === 0) {
... | true |
a5d754e1aa13a2e5094b7946350e8da0757202b5 | JavaScript | JohanPhom/web_foi | /javascript/login.js | UTF-8 | 1,366 | 2.640625 | 3 | [] | no_license | $(document).ready(function () {
var cookie = document.cookie;
var start = cookie.indexOf("Joox_username");
if(start != -1){
cookie = cookie.substr(start+14, cookie.length);
var end = cookie.indexOf(";");
if(end == -1){
cookie = cookie.substr(0, cookie.length);
... | true |
5d320c9cc7f7530aa2df8c125d16397a48b8f175 | JavaScript | conspop/seb-yahtzee | /main.js | UTF-8 | 23,984 | 3.40625 | 3 | [] | no_license | // CONSTANTS
//-----------
//class defining properties of a fresh card
class Card {
constructor () {
this.ones = null;
this.twos = null;
this.threes = null;
this.fours = null;
this.fives = null;
this.sixes = null;
this.bonus = null;
this.top = null;
this.smallStraight = null;
... | true |
966b2eabee19093feb2c38ba53ff60301fb09210 | JavaScript | indrijunanda/RuangAdmin | /vendor/select2/tests/options/translation-tests.js | UTF-8 | 6,156 | 2.53125 | 3 | [
"MIT"
] | permissive | var $ = require('jquery');
var Options = require('select2/options');
var Defaults = require('select2/defaults');
module('Options - Translations', {
beforeEach: function () {
Defaults.reset();
},
afterEach: function () {
Defaults.reset();
}
});
test('partial dictonaries are reset when default reset', f... | true |
b6e35fc65daa2eea9b93b885f223143e0709f9ad | JavaScript | 95Rawan/week7-test | /src/database/queries/addUser.js | UTF-8 | 397 | 2.765625 | 3 | [] | no_license | // Write a query to add the user and their password to the database
const dbconnection = require('../db_connection')
const addUser = (email, password, cb) => {
dbconnection.query(`Insert into users (email, password) values ($1,$2)`, [email, password], (error, result) => {
if (error) {
return cb(error)
... | true |
117074f6e2b514fd4366be096e18fdd6c13c3b28 | JavaScript | VitaliiKalinbet/js_materials | /unit tests/01_intro/intro.test.js | UTF-8 | 940 | 3 | 3 | [
"MIT"
] | permissive | const { sum, nativeNull } = require("./intro");
describe("Sum function:", () => {
test("should return sum of two values", () => {
expect(sum(1, 3)).toBe(4);
expect(sum(1, 3)).toEqual(4);
});
test("should return value correctly comparing to other values", () => {
expect(sum(2, 3)).toBeGreaterThan(4);... | true |
6482936bfa9636b4aa334f20297dbe263019ccb0 | JavaScript | davidntwakeup/Event-code | /events/even.js | UTF-8 | 12,242 | 3.171875 | 3 | [] | no_license | // function button(){
// alert("this is an alert")
// }
// var moringaStudent = {
// firstName: "Charlie",
// lastName: "Obina",
// level: 1,
// track: ["Prep","JavaScript","Python", "Django"],
// enrollmentStatus: true
// };
// console.log(moringaStudent);
// <-----Business Logic------>
c... | true |
d05d283c706b76f2d61028c5c86236f46bf0f12f | JavaScript | Kat2bk/Sprint-Challenge-React-Wars | /starwars/src/App.js | UTF-8 | 761 | 2.78125 | 3 | [] | no_license | import React from 'react';
import './App.css';
import CharacterContainer from "./components/CharacterContainer";
import styled from 'styled-components'
const Font = styled.div`
text-align: center;
color: blue;
font-size: 20px;
text-shadow: 5px 2px #FFF;
`
const App = () => {
// Try to think through what state you'l... | true |
1fe06d8f1d4248bcf8f95ee92338a1c49d784c5a | JavaScript | yevhene/present-react-hooks | /demo/data/index.js | UTF-8 | 1,946 | 2.78125 | 3 | [] | no_license | const data = {
groups: [{
name: '1КН-16'
}, {
name: '2КН-16'
}],
students: [{
name: 'Абрамов Денис',
group: '1КН-16',
photo: 'students/photos/01.jpg'
}, {
name: 'Альперт Софія',
group: '2КН-16',
photo: 'students/photos/02.jpg'
}, {
name: 'Валім Хосе',
group: '1КН-16'... | true |
a7feea23332c8ed25006a3ce28b7386d29817d12 | JavaScript | ravishan/webrtcRouter | /example/todo/handler/messageHandler.js | UTF-8 | 900 | 2.515625 | 3 | [] | no_license | import {getVisibleTodos} from '../reducers';
export const messageHandler = (getState,action) => (sendMessage,getId) => (msg) => {
console.log(msg," inside Message");
let data ;
if(msg){
data = JSON.parse(msg.data);
}
if(!data) return; // bailout
let state = getState();
switch(data.action){
case 'NEED_TODO... | true |
5799c53d7aa5b51fa096c0e3bab90e664335ca12 | JavaScript | maciejtreder/asynchronous-javascript | /rxjs/promiseDiff.js | UTF-8 | 421 | 3.125 | 3 | [
"MIT"
] | permissive | import {Observable} from 'rxjs';
const myPromise = new Promise(resolve => {
console.log('Inside promise');
setTimeout(() => resolve('Promise resolves'), 1000);
});
const myObservable = Observable.create(subject => {
console.log('Inside observable');
setTimeout(() => {subject.next('Observable emits')... | true |
66ab1225d5d845eb95b58e8e61e5034c376369a5 | JavaScript | mavi2011/FILTER-WEB-APP---1 | /p5.js | UTF-8 | 821 | 2.515625 | 3 | [] | no_license | faceX=0;
faceY=0;
function preload(){
mustache_on_face=loadImage('https://i.postimg.cc/zBSNZQcy/unnamed.png');
}
function setup(){
canvas=createCanvas(300, 300);
canvas.center();
video=createCapture(VIDEO);
video.size(300, 300);
video.hide();
poseNet=ml5. poseNet(video. modelLoaded);
poseNet.on... | true |
fa208d7df663891e6c62e2671b70c9e05dcfeade | JavaScript | UNLOQIO/unloq-node-client | /lib/pair/public.js | UTF-8 | 2,355 | 2.78125 | 3 | [
"MIT"
] | permissive | var forge = require('node-forge'),
btoa = require('btoa'),
atob = require('atob'),
pki = forge.pki;
/*
* This is a public key wrapper over node-forge.publicKey that knows
* how to handle encoding, creation and other such things.
* */
var public = function PairPublicKey(keyData) {
this.__key = (typeof keyData ==... | true |
c9aae84c532c43a193cedae2d81abd457d57a984 | JavaScript | wj0075/selfpro_dida | /webpack-learns/emp/src/router.js | UTF-8 | 1,035 | 2.796875 | 3 | [] | no_license | import foo from './views/foo';
import bar from './views/bar';
const routes = {
'/foo': foo,
'/bar': bar
};
// Router 类 用来控制页面根据当前URL切换
class Router {
start() {
// 点击浏览器后退/前进按钮时会触发window.onpopstate事件,我们在这时切换到相应页面
window.addEventListener('popstate', () => {
this.load(location.pa... | true |
b61b94dc24a7baac09c815c72a38fda4cd7cb67e | JavaScript | KavvaP17/Tetris | /src/figureInGameLocation.js | UTF-8 | 901 | 2.671875 | 3 | [] | no_license | import {GAME_FIELD_WIDTH, GAME_FIELD_HEIGHT} from './constants.js';
import moveFigureFromRightBorder from './moveFigureFromRightBorder.js';
export default function figureInGameLocation(arrayLocation, figureLocation, cursorCoordinates){
let key = true;
moveFigureFromRightBorder(figureLocation, cursorCoordinates);
fi... | true |
b65787aaf44d9658628eacda578a3225545db354 | JavaScript | dreamoflu/node_blog | /blog-1/src/router/blog.js | UTF-8 | 3,497 | 2.703125 | 3 | [] | no_license | const { getList, getDetail, newBlog, updateBlog, delBlog } = require('../controller/blog')
const { SucessModel, ErrorModel} = require('../model/resModel')
// 统一的登录验证函数
const loginCheck = (req) => {
if(! req.session.username ) {
return Promise.resolve(
new ErrorModel('尚未登录')
)
}
}
... | true |
c7edf7a20591f9a24bac9a489bf88654f3d30a98 | JavaScript | AlexanderDLe/GRSI | /client/src/reducers/testimonialsReducer.js | UTF-8 | 930 | 2.515625 | 3 | [] | no_license | import {
GET_TESTIMONIALS,
ADD_TESTIMONIAL,
ERR_TESTIMONIAL,
DEL_TESTIMONIAL,
LOADING_TESTIMONIALS
} from '../actions/types';
const initialState = {
testimonials: [],
success: false
};
export default function(state = initialState, action) {
switch (action.type) {
case LOADING_TESTIMONIALS:
r... | true |
ca56aced462545542eed39448205388e1dd8bb3e | JavaScript | mouthzipper/contacts_manager | /server.js | UTF-8 | 2,781 | 2.546875 | 3 | [] | no_license | //configuration
var express = require('express'),
app = express(),
path = require('path');
var mongoose = require('mongoose');
mongoose.connection.once('open', function () {
console.log('MongoDB connection opened.');
});
mongoose.connection.on('error', console.error.bind(console, 'MongoDB connection error: '));
m... | true |
79f5ba03955f0cca2de5b9402579f39a7e09a348 | JavaScript | jonathanbouren/JS_101 | /ITP_JS/functions/multiply.js | UTF-8 | 213 | 2.796875 | 3 | [] | no_license | let rlSync = require('readline-sync');
let firstNum = (rlSync.question('Please enter the first number'));
let secondNum = (rlSync.question('Please enter the second number'));
console.log(firstNum * secondNum);
| true |
bfee69b11fa1f6c4d92bff358a21168ff3395f14 | JavaScript | robertschneiderman/tracking_app | /frontend/new_task/components/task_area.jsx | UTF-8 | 3,148 | 2.5625 | 3 | [] | no_license | import React from 'react';
import * as actions from '../actions';
import {connect} from 'react-redux';
import TaskOption from './task_option';
class TaskArea extends React.Component {
constructor(props) {
super(props);
this.selectColor = this.selectColor.bind(this);
}
updateName(evt) {... | true |
a30b40fb47498c00235744305ce07fb9369670ee | JavaScript | retrocausal/cs-fundamentals | /naive-algorithms.js | UTF-8 | 5,016 | 3.078125 | 3 | [] | no_license | //Represent a network as a matrix
const network = [
[ 0, 0, 0, 1, 1 ],
[ 0, 0, 1, 1, 0 ],
[ 0, 1, 0, 1, 0 ],
[ 1, 1, 1, 0, 1 ],
[ 1, 0, 0, 1, 0 ]
];
let networkPrime;
//AD,AE,BC,BD,CD,DE,EB,EC - number of edges
//Initially the minimum vertices monitored is 5/network hub span
let min = network.length;
//gather... | true |
fa131a6d6236d17462c04fcfa25da871b6844074 | JavaScript | wcsteve/app_academy_schoolwork | /w6d5/Widgets/frontend/clock.jsx | UTF-8 | 828 | 2.890625 | 3 | [] | no_license | import React from 'react';
class Clock extends React.Component {
constructor(props) {
super(props);
let newDate = new Date();
this.tick = this.tick.bind(this);
this.state = {date: newDate};
}
componentDidMount() {
setInterval(this.tick, 1000);
}
tick() {
let newDate = new Date()... | true |
0b8d182420b54d576e9536a5968002c4a63a8d02 | JavaScript | redfieldstefan/mixandstones-v1 | /routes/api.js | UTF-8 | 4,036 | 2.96875 | 3 | [] | no_license | 'use strict';
var Cocktail = require('../models/cocktailModel'),
Ingredient = require('../models/ingredientModel'),
urlify,
prepForDb;
/**
* Helper function: formats cocktail names for URL routing
*
* e.g., 'Whiskey, neat' -> 'whiskey-neat'
*
* @param {String} cocktailName The name to be formatted
* @re... | true |
0e252020ed35276e732b400e27ff9719e1850bb2 | JavaScript | viktorstrate/ubersicht-widgets | /calendar/calendar.jsx | UTF-8 | 3,207 | 2.703125 | 3 | [] | no_license | const sundayFirstCalendar = 'cal -h && date "+%-m %-d %y"'
const mondayFirstCalendar = `cal -h | awk \'{ print " "$0; getline; print "Mo Tu We Th Fr Sa Su"; \
getline; if (substr($0,1,2) == " 1") print " 1 "; \
do { prevline=$0; if (getline == 0) exit; print " " \
substr(prevline,4,17) " " substr($0... | true |
bc6c0554eb7881fcfae05597fc234fa5e8ff9acb | JavaScript | reiosantos/population-management-api | /app/models/models.factory.js | UTF-8 | 509 | 2.796875 | 3 | [] | no_license | import models from '../../database/models';
const { User, Location } = models;
class ModelFactory {
/**
* Creates a modal of Type `name`
* Returns the modal matching the name or null
*
* @param name
* @returns Sequelize.Sequelize.Model.
*/
static getModel = (name) => {
if (!name) return null;
const ... | true |
b0d7f5b91e0f43cd2a127557e68930a5f05e4862 | JavaScript | vietd0x/C4EJS105-DoXuanViet | /Session5_html&css/checkPoint/index.js | UTF-8 | 3,116 | 3.234375 | 3 | [] | no_license | console.log("1.1 creat a random num from 0 to 1")
console.log(Math.random().toFixed(2));
console.log("________1.2_______");
let arr = [2, 5, 6, 9, 10];
console.log(arr[Math.floor(Math.random() * 5)]);
console.log("________1.3 -> 1.7_______");
let quizzes = [
{
question:'1+1 = ',
choice1: "1",
... | true |
64ff592fed4cae64d92d0b29a020acd45a893092 | JavaScript | ironman9967/Evolver | /Tests/Classes/Base/BaseClassTests.js | UTF-8 | 1,492 | 2.59375 | 3 | [] | no_license |
exports.BaseClassTests = {
setUp: function (callback) {
this._ = require('lodash');
this.BaseClass = require('../../../Classes/Base/BaseClass');
this.baseClass = new this.BaseClass();
callback();
},
tearDown: function (callback) {
this._ = undefined;
this.BaseClass = undefined;
callback();
},
provid... | true |
7e6cd10f2cf1175c7c5304401c3c5ba24017c97d | JavaScript | tcoopman/domain-driven-refactoring-handson | /js/src/QuizzyController.js | UTF-8 | 7,744 | 3.0625 | 3 | [] | no_license | const uuid4 = require("uuid/v4");
class Quiz
{
constructor(name, questions) {
this.name = name;
this.questions = questions;
}
}
class ArgumentException {
constructor(message) {
this.Message = message;
}
}
class QuizzyController
{
constructor()
{
... | true |