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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8386f715da4217a7a91a7790af9d9db5b335a9d8 | JavaScript | fahadjj2019/project-1 | /Project1Q2.js | UTF-8 | 283 | 3.640625 | 4 | [] | no_license | //convertToSeconds(1, 3) ➞ 3780
//convertToSeconds(2, 0) ➞ 7200
//convertToSeconds(0, 0) ➞ 0
let hour= 1;
let minutes= 4;
function convertToSeconds(H, M){
timeInSecond = (60*60*H) +(M*60) ;
console.log(timeInSecond);
}
console.log(convertToSeconds(hour,minutes));
| true |
e0668043ec1b1935cfaad22f1aa7e40e7eab1867 | JavaScript | kjcommon138/Non-Linear-Proposal | /while.js | UTF-8 | 1,282 | 2.515625 | 3 | [] | no_license | function preload() {
}
function setup() {
setupVid(1600, 1000, ['while.mp4']);
back.mousePressed(mindmap);
}
function mindmap() {
window.location.replace('anotherMind.html');
}
function draw() {
drawVid();
if (md >= 370 && md <= 380 && !inputSet) {
greeting = createElement('h2', saying);
greeti... | true |
64289ce137d86c3c96d64be9e7c07995516b4903 | JavaScript | jasontcrabtree/underscore | /src/pages/index.js | UTF-8 | 1,592 | 2.578125 | 3 | [] | no_license | import { useState } from 'react';
import { blockList, elementList, modifierList } from '../data/properties';
import ClassListBox from '../components/ClassListBox';
export default function Home(props) {
console.log(props);
const [selectedBlock, setSelectedBlock] = useState(blockList[1]);
const [selectedElement,... | true |
00fec2b4f544c26c8e7669b8a8b70bee3ba7c604 | JavaScript | Srile/components | /image-texture.js | UTF-8 | 1,338 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import {Component, Property} from '@wonderlandengine/api';
import {setFirstMaterialTexture} from './utils/utils.js';
/**
* Downloads an image from URL and applies it as `diffuseTexture` or `flatTexture`
* to an attached mesh component.
*
* Materials from the following shaders are supported:
* - "Phong Opaque Tex... | true |
bd773dcdfed9e5a8badfc765252e79d478663a1a | JavaScript | tomjwilliamson/tomjwilliamson-site | /js/broadShoulderLayout.js | UTF-8 | 741 | 2.8125 | 3 | [] | no_license | function windowResize() {
//detects browser width
var browserWidth = $(document).width();
var newClass, container = $('.contentArea');
//sets the column count in relation to the screen size
if( browserWidth <= 480 ){
columnCount = 1;
newClass = 'oneColumnsInPage';
}
else if( browserWidth <= 768 ){
... | true |
fdaed99c00ae9dae1fa6838b182c03037789bd4a | JavaScript | ojread/wego | /collections/turns.js | UTF-8 | 1,796 | 2.796875 | 3 | [] | no_license | // Turns store the game state and player actions.
App.collections.turns = new Mongo.Collection('turns');
var schema = new SimpleSchema({
gameId: {
type: String
},
turnNumber: {
type: Number
},
state: {
type: Object,
blackbox: true
},
createdAt: App.schemaHel... | true |
ada30f87a2fbc4a94121d9cc7eca5ae5a70eb0e9 | JavaScript | naorbakal/domino-NodeJS | /src/components/room.js | UTF-8 | 1,536 | 2.65625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import SignUp from './signUp.js';
import { type } from 'os';
function Room(props){
let roomStatus;
let players = props.data.players.map(player => {return <h3 key={player}>{player} </h3>});
let observers = props.data.observers.map(observer => {re... | true |
f99a8aeda2e73c24b13e514e8869a27c3fceabc8 | JavaScript | jacklowe/algo-ds | /data-structures/classes/classesBasics.js | UTF-8 | 1,122 | 4.03125 | 4 | [] | no_license | class Student {
constructor(firstName, lastName, year) {
this.firstName = firstName;
this.lastName = lastName;
this.year = year;
this.absences = 0;
this.scores = [];
}
fullName() {
return `Your full name is ${this.firstName} ${this.lastName}`;
}
static enrollStudents() {
return "... | true |
8067b97bfdda30f62bdcd88b6574182a107d3aa9 | JavaScript | ArneDev1/Bot | /commands/staffrole.js | UTF-8 | 1,532 | 2.703125 | 3 | [] | no_license | const discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
// -staffrole <new role>
let noPermission = new discord.RichEmbed()
.setColor("#cf3232")
.setDescription(`Je hebt onvoldoende permissies om dit command uit te voeren.`)
.setTimestamp()
... | true |
285549864dfd832136841abb435db634a7284f58 | JavaScript | heavyskyl/js-ka | /forCodeReview/AVdovenko/Lesson 3/js_3.js | UTF-8 | 1,740 | 3.828125 | 4 | [] | no_license | "use strict"
var i;
function returnType(typeOfParameter){
switch(Object.prototype.toString.call(typeOfParameter)){
case "[object String]":
return "String";
break;
case "[object Array]":
return "Array";
break;
case "[object Number]":
... | true |
648146a1b9c6113a11cbe1819b1b9637eab9b0c0 | JavaScript | RECRUITY/re-web | /src/redux/reducers/managerReducer.js | UTF-8 | 761 | 2.53125 | 3 | [] | no_license | /* Internal dependencies */
import AT from '../../constants/ActionTypes';
import Manager from '../../models/Manager';
const initState = {
fetching: false,
hasError: false,
manager: new Manager(),
};
export default (state = initState, action) => {
switch (action.type) {
case AT.REQUEST_GET_ME:
return... | true |
e167469da0b08a6e813b8a9d5809c253e70ccd88 | JavaScript | himanshu-rawat/JavaScript | /JavaScript Notes/domConcepts.js | UTF-8 | 5,649 | 3.65625 | 4 | [] | no_license | // Creating Element from scratch in DOM.
// Creating Element in DOM
const h2 = document.createElement('h2');
h2.innerText = 'I love my country!';
h2.classList.add('myClass');
let section = document.querySelector('section');
section = section.appendChild(h2);
// console.log(h2);
// console.dir(h2);
let myIMG = docu... | true |
f742232ebc4f6d704d268749d282b531f0f427dd | JavaScript | UnpolishedCreations/KingoftheHill-Source | /KingoftheHill/Assets/DisplayWinScreen.js | UTF-8 | 1,592 | 2.859375 | 3 | [] | no_license | #pragma strict
// Displays scores.
function OnGUI () {
// Score Summary
GUI.Label (Rect(Screen.width/3, 80, 100, 20), "Summary");
// Player 1 Score
if(ControlKingArea.winP1)
GUI.Label (Rect(Screen.width/4, 105, 100, 20), "Player 1 : Winner");
else
GUI.Label (Rect(Screen.width/4, 105, 100, 20),... | true |
2fc7579cd5f5ee04f06fb460a6241e05be4b8b55 | JavaScript | Taibdse/wordListReactApp | /src/components/modelAddUpdate.component.js | UTF-8 | 2,785 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import TagsInput from 'react-tagsinput'
import 'react-tagsinput/react-tagsinput.css';
class Model extends Component {
constructor(props){
super(props)
this.state = {
currentWord: {},
}
}
componentDidMount = () => {
this... | true |
49147bbd1db43768c5a800c6422648f3e644ed5f | JavaScript | avijain10/Quarantine_website | /mycaptain_website/index.js | UTF-8 | 317 | 2.625 | 3 | [] | no_license | var menu= document.getElementById('menu')
var nav = document.getElementById('nav')
var bcircle = document.getElementById('bcircle')
menu.addEventListener('click', function(e){
nav.classList.toggle('hide-mobile')
})
bcircle.addEventListener('click', function(e){
nav.classList.add('hide-mobile')
}) | true |
66461bace4ab6aeb19df69495495173a64c01c3b | JavaScript | shidhincr/redux-modifiers | /test/objects.spec.js | UTF-8 | 1,162 | 2.6875 | 3 | [] | no_license | import expect from 'expect'
import { object, target } from '../src'
import { createAction } from 'redux-actions'
let action = createAction('TEST');
describe('Test object modifiers', ()=>{
it('Should update the object', ()=>{
let state = { foo: '' }
let update = action({bar: 'baz'});
let result = object.... | true |
86f40f9fa91f25dba2f454821589a1e2b964cb39 | JavaScript | login-dhcp/ShinyColors_Sort | /assets/utils.js | UTF-8 | 6,060 | 2.515625 | 3 | [] | no_license | ////////////////////////
// collapsible select buttons
function selectAll() {
changeAllCheckboxTo(true);
}
function selectNone() {
changeAllCheckboxTo(false);
}
function changeAllCheckboxTo(value) {
var checkboxs = document.querySelectorAll(`input[data-checkbox-id]`);
for (let i = 0; i <... | true |
3ba18a7fee6d2c2be7f0e7706d81699b40aa8467 | JavaScript | miniloko/a-musical-machine | /src/js/soundmachine.js | UTF-8 | 1,942 | 3.015625 | 3 | [] | no_license | /**
* Duct tapes the parts together into a
* sounding machine.
*/
class SoundMachine {
constructor() {
var AudioContext = window.AudioContext || window.webkitAudioContext || false;
if (!AudioContext) return;
// Polyphony
this.maxVoices = 6;
this.currentVoiceIx = 0;
this.voices = [];
this.audioContex... | true |
6d0df7b3d6b6d29fb0b668d440e735100b861b5a | JavaScript | lasantha57/js-algorithms | /algorithms/is-prime.js | UTF-8 | 2,495 | 4.65625 | 5 | [] | no_license | /**
* Question: How would you verify a prime number?
* Answer: a prime number is only divisible by itself and 1. So, i will run a while loop and increase by 1
*/
function isPrime(n) {
var divisor = 2;
while (n > divisor) {
if (n % divisor === 0) {
return false;
} else {
... | true |
5bbe1c0b14d24fa01eea6f740a987d09cfc0d03b | JavaScript | huangchucai/vue-app | /src/common/js/jsonp.js | UTF-8 | 634 | 2.65625 | 3 | [] | no_license | import originJson from 'jsonp'
// url 地址
// data 传递的参数 对象 只有一层
// option jsonp需要的参数
export default function jsonp(url, data, option) {
url = url + (~url.indexOf('?') ? '' : '?') + formatData(data)
return new Promise((resolve, reject) => {
originJson(url, option, (err, data) => {
if (!err) {
resol... | true |
30f16790bfe71b6460be7473da3c56cfc2bf6d12 | JavaScript | NemesisMKII/TP-Site-Web | /contact.js | UTF-8 | 2,950 | 3.109375 | 3 | [] | no_license | // a l'ext de onready
function captcha_new(){
var chiffre1 = Math.floor(Math.random() * 10); // retourne un chiffre entre 0 et 9
var chiffre2 = Math.floor(Math.random() * 10); // retourne un chiffre entre 0 et 9
var total = chiffre1+chiffre2; // je calcul combien font chiffre1 + chiffre2
$("#dy... | true |
7a4bf600011290e41b3ae304577852ae53946a18 | JavaScript | luvgadhvi/Poke-Guide | /src/screen/SearchScreen.js | UTF-8 | 2,695 | 2.609375 | 3 | [] | no_license | import React, { useState, useMemo } from "react";
import { StyleSheet, View, TextInput, FlatList, Text } from "react-native";
import SearchApi from "../api/searchPoke";
import PokeStats from '../components/pokeStats';
import Spinner from 'react-native-loading-spinner-overlay';
//This Screen Will Load all the pokemon ma... | true |
31f7fe4410bc4eb8a38773e3984059cce636cab9 | JavaScript | ivank710/Leetcode | /160.intersection-of-two-linked-lists.js | UTF-8 | 949 | 3.640625 | 4 | [] | no_license | /*
* @lc app=leetcode id=160 lang=javascript
*
* [160] Intersection of Two Linked Lists
*/
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} headA
* @param {ListNode} headB
* @return {ListNode}
*/
const getLeng... | true |
061c06028084b0b51d52dcf6de4b2dd0661e63cf | JavaScript | cmatson93/cs-algorithims | /questions.js | UTF-8 | 425 | 3.765625 | 4 | [] | no_license | //How would you make this work?
//add(2,5); --> 7
//add(2)(5); --> 7
var answer = "i'm a lasagna hog".split("").reverse().join("");
// console.log(answer);
// var foo = {n:1};
// var bar = foo;
// foo.x = foo = {n:2};
// console.log(foo);
console.log('one');
setTimeout(function () {
console.log('... | true |
1b23db14d25c3e04f34219673efdaa077ba586f4 | JavaScript | OmriKaduri/React-tictac | /src/components/Board.js | UTF-8 | 1,003 | 3 | 3 | [] | no_license | import React, { Component } from 'react';
import './Board.css';
import Square from './Square';
class Board extends Component {
createRow(rowNum,squares){
let sizeLength = Math.sqrt(squares.length);
let row = new Array(sizeLength).fill();
for(let element in row){
let squareIndex = parseInt(element)... | true |
bb26f57ec7c75235ec7e691c90d74c37b47c1134 | JavaScript | pfebri32/DumbWays-Batch21-Kloter3 | /1.js | UTF-8 | 897 | 3.09375 | 3 | [] | no_license | function checkKalimat (params) {
let splited = params.split(" ");
let result = splited.map(str => str.substring(0, 1));
return result;
}
const defaultParams = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1... | true |
7930e00566ea5646129112edc5f1f5de34a32350 | JavaScript | bmotevalli/heart_disease_ml | /src/containers/analysis/analysis.js | UTF-8 | 4,412 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import InputComp from "../../components/Input/InputComp"
import { connect } from "react-redux";
import * as ApiPre from "../../api/predictHeartDisease";
class Analysis extends Component {
state = {
heartDisease: null
}
onPredict = () => {
const a... | true |
c2a3960bf0a888fa397f66af2e9470faf8be489e | JavaScript | brunurupucis/pameginam | /questionsAndAnswers/javascriptBasicDataStructureQuestions.js | UTF-8 | 12,146 | 4.40625 | 4 | [] | no_license | export var javascriptBasicDataStructureQuestionArr = [
`0.We have defined a variable called yourArray. Complete the statement by assigning an array of at least 5 elements in length to the yourArray variable. Your array should contain at least one string, one number, and one boolean.<br>
let yourArray; // change thi... | true |
0374e101955acffa42b0e7befede773506da7bc1 | JavaScript | tvollmer/backbone-example2 | /src/main/webapp/spec/collection/DirectorySpec.js | UTF-8 | 797 | 2.515625 | 3 | [] | no_license | define(function(require){
'use strict';
var Directory = require("collection/Directory");
var Contact = require("model/Contact");
describe("Directory", function(){
beforeEach(function(){
var self = this;
self.directory = new Directory();
});
describe("... | true |
559a768b64fc71fab3071bff2b340bbaffbee07c | JavaScript | revanthkumarofficial/JAVASCRIPT_RESOURCES_COLLECTION | /JS BOOTCAMP COLT STEELE/ADVANCED JS BY COLT STEELE/Ep15 JS IN BROWSER AND DOM MANIPULATION/GET ELEMENT BY ID/app.js | UTF-8 | 159 | 2.5625 | 3 | [] | no_license | // To select the element with id of bear-photo:
document.getElementById('bear-photo')
//To select the element with id of main:
document.getElementById('main') | true |
6ec0faa918ccd99bbe605a750a7a6b80e3b1048c | JavaScript | compute-io/outer | /lib/index.js | UTF-8 | 1,578 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict';
// MODULES //
var isArrayLike = require( 'validate.io-array-like' ),
isTypedArrayLike = require( 'validate.io-typed-array-like' ),
ctors = require( 'compute-array-constructors' ),
matrix = require( 'dstructs-matrix' ).raw;
// FUNCTIONS //
var outer1 = require( './typedarray.js' ),
outer2 = requir... | true |
9d304f3c558a89fcccf997005f41d98a8f496715 | JavaScript | emilyrush/UFO_homework | /static/js/app.js | UTF-8 | 2,265 | 3.3125 | 3 | [] | no_license | // from data.js
var tableData = data;
var tbody = d3.select("tbody");
// --------------------------------- Dat App --------------------------------
// Select the submit button
var submit = d3.select("#filter-btn");
// Show all sighting data
data.forEach((sightingsList) => {
var row = tbody.append("tr");
Obj... | true |
125cfa450d66c1af4382ea2b33db7e931906b2da | JavaScript | nat081018/ITA28.09 | /Nataly/src/redux/movies/moviesReducer.js | UTF-8 | 1,890 | 2.546875 | 3 | [] | no_license | import {moviesTypes} from "./movies.types"
const INITIAL_STATE = {
moviesDefault: [],
isFatching: false,
errorMesage: "",
}
const moviesReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case moviesTypes.FETCH_REQUESTED: return {
...state,
isFatchi... | true |
cd05b4f4d77b739bcd01d9b405e33cd13f1466ae | JavaScript | momingse/solongcanada.github.io | /js/main.js | UTF-8 | 1,257 | 3.265625 | 3 | [] | no_license | (function () {
const second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
x = setInterval(function () {
countDown = 1630659600000 + 2100000;
let now = new Date().getTime(),
distance = now - countDown;
const status = document.ge... | true |
e36fea399825144e5c3615e43cf000a384857085 | JavaScript | hannahhch/symphony-sounds | /main/brass.js | UTF-8 | 785 | 2.609375 | 3 | [] | no_license | let fhSound = document.querySelector("#frenchClick");
fhSound.addEventListener('click', playfh);
function playfh() {
let snd = new Audio("audio/frenchhorn.mp3");
snd.play();
};
let trumpetSound = document.querySelector("#trumpetClick");
trumpetSound.addEventListener('click', playTrumpet);
function playTrumpet(... | true |
53c79bb98db38657afab585304f7942e8637604a | JavaScript | DannyRoberts95/creative-coding | /05_Grids/02_/js/sketch.js | UTF-8 | 2,583 | 2.828125 | 3 | [] | no_license | "use strict";
let tileNumX = 36;
let tileNumY = 18;
let tileWidth = 80;
let gutterX = 0;
let gutterY = 0;
let sw = 4;
let rSeed = 1;
let spacing = 0;
function setup() {
// A4 - 3508 x 2480
// A3 - 4961 x 3605
// A2 - 7016 x 4961
createCanvas(3508, 2480);
//SQUARE
// createCanvas(windowHeight, windowHeigh... | true |
8cf18698f53156b86b82b844954c97146db3a61b | JavaScript | moduware/np-public-sw-firmware-msp430g2553-modules | /developer resources/nexpaq.lcd/tile/nexpaq.devmod/js/scripts.js | UTF-8 | 1,702 | 2.765625 | 3 | [] | no_license | window.nexpaqAPI.emulateMode = false;
window.nexpaqAPI.setCurrentModule('DevMod');
// Page completely loaded
document.addEventListener("DOMContentLoaded", function (e) {
// Actions when back button clicked. The back button will be added automatically by the native
window.nexpaqAPI.global.addEventListener('onBackBut... | true |
ade34752c2f61b9acea83cb684ccf8653d088a10 | JavaScript | Mxx1029/be-db-advanced-productboi | /frontend/src/App.jsx | UTF-8 | 3,980 | 3.40625 | 3 | [] | no_license | import { useState, useEffect } from 'react';
export default function App() {
const [ name, setName ] = useState(""); // "" keeps the placeholder visible on reload
const [ price, setPrice ] = useState(0); // null keeps the placeholder visible on reload, instead of 0
// const defaultProducts = [
// ... | true |
e8c808729ce38aa1b19b039f09a8b3d0d2422d9c | JavaScript | danielcpan/GeneralCodingProblems | /JavaScript/Sum.js | UTF-8 | 312 | 3.375 | 3 | [] | no_license | const sum = (x, y) => (y !== undefined) ? x + y : (y) => x + y
console.log(sum(2,3)); // Outputs 5
console.log(sum(2)(3)); // Outputs 5
const car = () => {
let speed = 0;
return () => {
console.log(speed)
}
}
const createBase = base => num => base + num
const duplicate = arr => [...arr, ...arr] | true |
d9cccc8adfef5bf343656b9f17b51e829f0afcd0 | JavaScript | NightSpark75/react-product-catalog | /src/server/controllers/routerResponse.js | UTF-8 | 2,888 | 2.53125 | 3 | [
"MIT"
] | permissive | const eVars = require('../config/eVars.js')
const cannedMessage = {
200: '200 OK',
201: '201 Created',
202: '202 Accepted',
204: '204 No Content',
400: '400 Bad Request',
401: '401 Unauthorized',
403: '403 Forbidden',
404: '404 Not Found',
405: '405 Method Not Allowed',
500: '500 Internal Server Er... | true |
77eb43caf720424586748db9204d84fb724ae652 | JavaScript | weppleafso/leetcode | /answer/679.js | UTF-8 | 232 | 2.578125 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {boolean}
*/
var judgePoint24 = function(nums) {
};
console.log(judgePoint24([4, 1, 8, 7]));
//拆分为 [[1,2],[3,4]] [[[1,2],3],4] [[1,[2,3]],4] [1,[[2,3],4]] [1,[2,[3,4]]]
[
] | true |
4663f41f906d686d505a66ef144d1999753f637f | JavaScript | hamzahalilovic/data-processing-app | /backend/providers/fitbit.js | UTF-8 | 1,397 | 2.5625 | 3 | [] | no_license | // initialize the express application
const express = require("express");
const app = express();
// initialize the Fitbit API client
const FitbitApiClient = require("fitbit-node");
const client = new FitbitApiClient({
clientId: "22C7X3",
clientSecret: "9207b71383e00251b74d5dabb5ead0e5",
apiVersion: "1.2", // 1.2... | true |
ce9ce97861d39cf8e92c64f32f21019e731f6f20 | JavaScript | MangoYogurt-zhanxiaotong/Util | /dataStructure/stack.js | UTF-8 | 632 | 4.25 | 4 | [] | no_license | /**
* 栈:先进后出
*/
class Stack {
constructor() {
this.arr = [];
}
// 入栈
push(element) {
return this.arr.push(element);
}
// 出栈
pop() {
return this.arr.pop();
}
// 栈顶元素
top() {
return this.arr[this.size() - 1];
}
// 总数
size() {
re... | true |
5be7b9af709be17e5f2255d6b9a2345c559592cc | JavaScript | jack801087/bhauto | /app/datatypes/SocialNode.class.js | UTF-8 | 5,446 | 2.75 | 3 | [
"MIT"
] | permissive |
class SocialNode {
constructor(){
this.collection = [];
}
addSocialMediaDataToDB(dbObject){
this.collection.forEach((v,i)=>{
dbObject.setInstagramTags(v.name,v.instagram_tags);
dbObject.setFacebookTags(v.name,v.facebook_tags);
dbObject.setHashtags(v.na... | true |
d324dfa584bb41342285c6a3e8721f00f2e906b7 | JavaScript | Angel2217/P6 | /Panel.js | UTF-8 | 2,815 | 2.84375 | 3 | [] | no_license | export class Panel {
constructor(id, div, player) {
this.id = id;
this.div = div;
this.player = player;
this._createPanel();
}
_createPanel() {
let panel = $('<div>')
.appendTo(this.div)
.attr('id', this.id)
.addClass('panel')
.append('<div class="panel-... | true |
2e17d465f2840f6b1b6e1df0c23ae459d41e3bd5 | JavaScript | robhawkes/geolocation-twitter-mongodb | /level.percentile.js | UTF-8 | 1,163 | 2.984375 | 3 | [] | no_license | if(!maxLevel || !minLevel) {
print("You didn't define the arguments");
throw new Exception();
}
function getPercentilesFor(collection, increment, sortSpecifier, valueExtractor) {
var getPercentile = function(percentile) {
var count = collection.count();
var skip = Math.min(count - 1, Math.f... | true |
0b9e86845d357c0b464bbdd58876d8bb202ece77 | JavaScript | Aidil-Shahril/swe101-beat-that | /script.js | UTF-8 | 3,127 | 3.953125 | 4 | [] | no_license | var myOutputValue;
var playerTurn = 'player1';
var player1Final = 0;
var player2Final = 0;
var player1DiceRoll = [];
var player2DiceRoll = [];
var rollDice = function () {
// produces a decimal between 0 and 3
var randomDecimal = Math.random() * 6;
// take off the decimal
var randomInteger = Math.floor(random... | true |
baef1c4a3a4533cadc65e12801a91bfb4f86b820 | JavaScript | IsaacSante/web_in | /exercise4/script.js | UTF-8 | 1,059 | 3.34375 | 3 | [] | no_license | var i = 0;
function change() {
var doc = document.getElementById("venncircbtm");
var color = ["darkgrey", "lightgrey"];
doc.style.backgroundColor = color[i];
i = (i + 1) % color.length;
}
setInterval(change, 1000);
function checkTime(x) {
if (x < 10) {
x = "0" + x;
}
return x;
}
function startTime(... | true |
673d89e6db1dd6fb2c380a3b21fb420d3c037159 | JavaScript | gmanjurdg/React-login | /App.js | UTF-8 | 1,362 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react'
import './App.css';
import UserList from './Component/Demo/UserList';
class Login extends Component {
constructor(props) {
super();
this.state = {
"Username": "hruday@gmail.com",
"Password": "hruday123"
};
this.Login = this.Login.bind(this);
th... | true |
e55a4e58eca0351167f160bdc756458897e65b2b | JavaScript | sajanbasnet75/express_api | /src/services/user.service.js | UTF-8 | 844 | 2.59375 | 3 | [] | no_license | const User = require("../models/user");
const bcrypt = require("bcryptjs");
const getAllUsers = () => {
return User.fetchAll();
};
const getUserById = async (id) => {
try {
const user = await new User({ id }).fetch();
return user;
} catch (err) {
return err;
}
};
const getUserByEmail = async (ema... | true |
d0576e51404ce39c9841ecbef422b3c5b3c48bb2 | JavaScript | tshelton5000/javascriptLibraryApril2019 | /1-jsFundamentals/classFiles/tempCodeRunnerFile.js | UTF-8 | 169 | 3.25 | 3 | [] | no_license | function func1(input){ //'input' refers to 'func2' from line 100
return input(7);
}
function func2(num){
return num + ':i am a number';
}
console.log(func1(func2)); | true |
a1188a969cad77f97690c01b4a3f5bd690328d09 | JavaScript | roitraining/pwa-training-labs | /apis-lab/solution/assets/js/custom.js | UTF-8 | 1,062 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive |
try {
let x = localStorage.getItem('position');
if(x) {
x = JSON.parse(x);
alert('Your previous position was: latitude ' + x.latitude + ' longitude ' + x.longitude);
}
}
catch(e) {
console.log(e);
}
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function (pos) {
... | true |
8e1a26791e292beaa075bf73563d2c7f8169afd8 | JavaScript | mutatis/wings-joystick-house | /js/Alvo.js | UTF-8 | 4,986 | 2.90625 | 3 | [] | no_license | function Alvos(file, tamanho_w, tamanho_h)
{//abre
this.img = new Image();
this.img.src = file;
this.visible = true;
this.posicao_x = Math.floor((Math.random()*(800-tamanho_w)+1));
this.posicao_y = Math.floor((Math.random()*(600-tamanho_h)+1));
this.tempo_visto = 100;
this.tempo... | true |
cd9ddf4b35428e1e439de77247e4b50e4b6434fa | JavaScript | liamkande/Weather-App-with-ReactJS-Redux | /src/Containers/weather_list.js | UTF-8 | 2,345 | 2.921875 | 3 | [] | no_license | import _ from 'lodash'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import Chart from '../Components/chart'
import MapWithAMarker from '../Components/google_map'
class WeatherList extends Component {
renderWeather(cityData) {
const name = cityData.city.name
//This is the con... | true |
d30cb134f355be4b9c1702a6fffb245f25bd2516 | JavaScript | zetadevelopment/streamme | /models/content/content.js | UTF-8 | 2,623 | 2.6875 | 3 | [] | no_license | class Content {
static findForUser(userID) {
const me = this;
const mongodb = require('mongodb').MongoClient;
const promise = new Promise((resolve, reject) => {
const processEnv = require('process').env;
mongodb.connect(processEnv.MONGODB_URL, { useNewUrlParser: true }, function(err, client) ... | true |
c07102bc184c8b478b5aae24869c3df15bb8b456 | JavaScript | Janet0110/Prototyp1.0 | /chatApp/client/components/Widgets/ModalDialog/ModalDialog.jsx | UTF-8 | 1,992 | 2.828125 | 3 | [] | no_license | /*erstellt ein Dialogfenster*/
DialogModal = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired
},
/*Zustand für das Anzeigen des Fensters*/
getInitialState: function(){
return{
dialogVisible: false,
active: false
}
},
/*Nach ... | true |
61578560d5ac79c1e180a1366488390ac7cae224 | JavaScript | ghSunural/SppLab | /pages/mapCreator/scripts/js-models/Lib/MathLib.js | UTF-8 | 2,581 | 3 | 3 | [] | no_license | //векторное произведе
//
/*
export function calcVectorProductVtoV(vector_a, vector_b) {
return (vector_a[0] * vector_b[1] - vector_b[0] * vector_a[1]);
}
*/
import * as T from "./TypeChecking.js";
export let calcVectorProductVtoV = (vector_a, vector_b) => {
vector_a = T.checking4vector2d(vector_a);
vecto... | true |
4b7c192d34ee79b314f3ba8c6c6395d950d44b21 | JavaScript | captainpainway/coconutty | /src/alphnum.js | UTF-8 | 11,492 | 2.921875 | 3 | [] | no_license | /*
* alphnum.js
* Construct 3D numbers and letters (just what is needed).
*/
const color = '#ee7600';
const zero = (parent, xPos) => {
const zero = cEle('a-entity', {
position: xPos + ' 0 0',
class: 'number'
})(parent);
cEle('a-box', {
width: '3',
height: '1',
depth: '1',
color: color,... | true |
f6d49b0148c03d11ab7f662dd1a8b03998a485b3 | JavaScript | lwf98/JavaWeb | /public/js/share-img.js | UTF-8 | 3,722 | 2.765625 | 3 | [
"MIT"
] | permissive | $(function () {
/* $.ajax({
type:"post",
url:"/share/img-goods",
/!* data:{
src:$this.firstElementChild.getAttribute("src")
},*!/
dataType:'json',
success:function (result) {
var array = $("img");
for(let i = 0;i<array.length;i++)... | true |
aaf29a64127ed2a3006020acf95857700f81ee7d | JavaScript | gdbots/pbj-js | /src/SchemaQName.js | UTF-8 | 2,619 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | import InvalidSchemaQName from './exceptions/InvalidSchemaQName.js';
/**
* We store all SchemaQName instances to accomplish a loose flyweight strategy.
* Loose because we're not strictly enforcing it, but internally in this
* library we only use the factory from* methods to create qnames.
*
* @type {Map}
*/
cons... | true |
30087bb992702b7dcce84c3b43073c44f8241e25 | JavaScript | ui-puzzles/ui-cli | /src/bin/index.ts | UTF-8 | 1,781 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env node
import { Command } from 'commander';
import fs from 'fs';
import { mkdir, readdir, copyFile, rename } from 'fs/promises';
import path from 'path';
import {
warning,
errorLog,
successLog,
convertFirstLetterUpper,
isAvailableVersion,
} from '../utils';
const program = new Command();
const... | true |
005623ac0f6dec9f36958d5e6a8c6df2e39db5f9 | JavaScript | ErenyYousri/final-project | /routes/booking.js | UTF-8 | 1,805 | 2.515625 | 3 | [] | no_license |
const express=require('express')
const BookingModel = require('../models/booking')
auth= require('../middleware/authorization')
const router = new express.Router()
router.post('/booking/add',auth, async(req,res)=>{
bookingData = new BookingModel({
...req.body,
custom: req.user._id
})
conso... | true |
4ed209d70a2b531fd11af89a8c580d1b2ecdb434 | JavaScript | futuresocks/bcktlstr | /client/src/models/countries_data.js | UTF-8 | 758 | 2.84375 | 3 | [] | no_license | const PubSub = require('../helpers/pub_sub.js');
const Request = require('../helpers/request.js');
const Countries = function(){
this.data = [];
this.request = new Request("https://restcountries.eu/rest/v2/all");
}
Countries.prototype.bindEvents = function () {
this.getData();
PubSub.subscribe('CountrySelect:... | true |
0f4fc27b3fc16bd7ec0d40fc6ed7b2b839670ad9 | JavaScript | tka-andrew/JavascriptTutorialTemplate | /JS_cjsExample.cjs | UTF-8 | 592 | 3.09375 | 3 | [] | no_license | /*
Description: This should be used to compare with JS_mjsExample.mjs to observe the difference between CJS and MJS
*/
// import { forEach } from "lodash-es"; // lodash-es is exported as ES module, so we can't import it in cjs file
const { forEach } = require('lodash')
// test example
friendList = [
{
... | true |
a30bfe8dff403e6657a3db0037f58f8b40e405f6 | JavaScript | alyssonmota/web-moderno-com-javascript | /fundamentos/funcao1.js | UTF-8 | 491 | 4.46875 | 4 | [] | no_license | // Funcao sem retorno
function imprimirSoma(a, b) {
console.log(a + b)
}
imprimirSoma(2, 3)
// O segundo parâmetro é undefined, então o resultado é NaN
imprimirSoma(2)
// Somente os dois primeiros parametros são pegos, o resto é ignorado
imprimirSoma(2, 10, 4, 5, 6, 7, 8)
// Como os paramtros são undefined, o r... | true |
a0911546e4f3fcee6b1ca3baf2942a7712cb84ac | JavaScript | Ryan-E-Mark/node-db2-project | /api/cars/cars-middleware.js | UTF-8 | 1,659 | 2.625 | 3 | [] | no_license | const Cars = require('./cars-model');
const vinValidator = require('vin-validator');
async function checkCarId(req, res, next) {
try {
const potentialCar = await Cars.getById(req.params.id);
if (!potentialCar) {
next({ status: 404, message: `car with id ${req.params.id} is not found` })
} else {
... | true |
6eb4f4e337438bbb5f1038bd0ee138bd0af31911 | JavaScript | Louiswkj/laravel-element | /resources/assets/js/common/once.js | UTF-8 | 328 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* init something only once
* @param {function} init () => {*}
*/
export default function (init) {
let inited = false
let initResult = null
return function (...args) {
if (!inited) {
inited = true
initResult = init.apply(this, args)
}
return initResult
... | true |
b649eadfd0ff605d0c164fe1a300abfdde923bd0 | JavaScript | WilliamMena/js-basics-online-shopping-lab-v-000 | /index.js | UTF-8 | 2,220 | 3.515625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var cart = []
function getCart() {
return cart
}
function setCart(c) {
cart = c
}
function addToCart(item) {
// write your code here
// cart[item] = Math.floor(Math.random() * 10)
cart.push( { [item]:(Math.floor(Math.random() * 10)) } );
console.log(item + " has been added to your cart.")
return cart
}
func... | true |
1fce5a9b6defcae7fedd4c9ae9d86caa896b35d3 | JavaScript | lup3z/cursoNodeDH | /appNotas.js | UTF-8 | 895 | 3.359375 | 3 | [] | no_license | const fs = require('fs');
let opciones = process.argv.slice(2)
if (opciones.length > 0) {
if (opciones.includes('listar')) {
leerDatos()
} else {
console.log('No entiendo que quieres hacer');
}
} else {
console.log('Atencion : Tienes que pasar una accion');
}
function leerDatos() {
... | true |
38a160d1bffc2a21dc5bfbcf4913f65094d1a85c | JavaScript | brandi-jones/React-Redux-App | /react-redux-rick-and-morty/src/components/CharactersForm.js | UTF-8 | 1,329 | 2.8125 | 3 | [] | no_license | import React from "react";
import {connect} from "react-redux";
import {getData} from "../actions/index.js";
import {Button} from "reactstrap"
const CharactersForm = (props) => {
const handleGetData = event => {
event.preventDefault();
props.getData(); //call the getData function imported from act... | true |
dd0f845be489ffbfd6faa848868409ca0c73f848 | JavaScript | Clemenciagidu/BackEnd_Portal_PlataformasProgramacion | /backEndPortal/public/js/main.js | UTF-8 | 3,194 | 2.96875 | 3 | [
"MIT"
] | permissive | var secciones = [];
//var rutas = [" ",index","acercade","servicios","portafolio","contacto"];
var rutas = ["/","/acercade","/servicios","/stats","/portafolio","/contacto"];
var bajo_logeo = ["seccion_2","seccion_5"];
var usuario_logeado = true;
//Get the button:
//mybutton = document.getElementById("myBtn");
window.o... | true |
59b97f7c42c7fd375be970d7599a42fb2dcbcfd4 | JavaScript | Pavoninushka/javascript-for-kids-by-nick-morgan | /Programming_Challenges/Chapter6_Conditionals_And_Loops.js | UTF-8 | 1,219 | 4.28125 | 4 | [] | no_license | let name = "Svetlana";
if (name === "Galina") {
// console.log("Hello me");
} else if (name === "Svetlana") {
console.log("Hello Svetlana");
} else if (name === "Yuriy") {
console.log("Hello Yuriy");
} else {
console.log("Hello stranger");
}
for (let i = 3; i <= 3000; i *= 3) {
console.log(i);
}
l... | true |
f634e544942febefb38323acc1a1f04c431300b6 | JavaScript | sami93/React-book | /src/store/selectors/calculBooksOnCart.js | UTF-8 | 246 | 2.515625 | 3 | [] | no_license | const calculBooksOnCart = (state) => {
const bookOnCart = []
if(state && state.length)
state.forEach(book => {
if (book.cart)
bookOnCart.push(book)
})
return bookOnCart;
};
export default calculBooksOnCart;
| true |
43299243007e5489b213de128023993afbc960ea | JavaScript | laurie2020/coding_17_javascript | /DOM/dom_recuperation_elements_part2_exercice4/main.js | UTF-8 | 395 | 2.765625 | 3 | [] | no_license | // 1.
console.log(document.getElementsByClassName('redPurple'));
// 2.
console.log(document.querySelectorAll('.redPurple'));
// 3.
console.log(document.querySelectorAll('h1.redPurple'));
// 4.
console.log(document.querySelectorAll('li, p, span'));
// 5.
console.log(document.querySelectorAll('li.important, p'));
//... | true |
f0cd944506b271483dafb17d01ad460440971825 | JavaScript | Micspr/migrations-classroom-example | /db/seeds/01_courses.js | UTF-8 | 1,179 | 2.71875 | 3 | [] | no_license | const tableName = 'courses'
exports.seed = knex => {
return knex(tableName).insert([ //insert the data that we want to use
{ id: 1, name: 'Web Development Immersive', price: 21000 },
{ id: 2, name: 'Data Science Immersive', price: 16000 },
{ id: 3, name: 'Front End Web Development', price: 3000... | true |
8b1e7a8169f41d15ae632b23a6a242e1b601ac31 | JavaScript | vishalknishad/hello-chrome-extension | /js/popup.js | UTF-8 | 2,106 | 2.625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$('#wait').hide();
$("#sendsms").click(function(){
$('#status').text('');
$('#wait').show();
var phone = $('#phone').val();
var message = $('#message').val();
if(!validate_phone(phone)){
$('#status').text('Please enter a valid phone... | true |
c28e9f47d4dfb4ddf3126d17c5a40859bcaecc15 | JavaScript | CharlesCreativeContent/CodeWars | /7th Kyu/repeater.js | UTF-8 | 152 | 3.015625 | 3 | [] | no_license | !ans
const repeater = (string, n) => {
return string.repeat(n);
}
//OR//
function repeater(string, n){return new Array(n).fill(string,0).join('')}
| true |
f5a00b0f1fd11216f91956bac1e52c2d54a33164 | JavaScript | zgomodelgames/ideaProjects | /javascript1/script/third.js | UTF-8 | 420 | 3.078125 | 3 | [] | no_license | /**
* Created by Özgür on 2.03.2017.
*/
var myObj = {
"myProp": "Hello"
};
var myObj2 ;
myObj2 = myObj;
myObj2 = {
"myProp": "Hello",
"myProp2" :null
};
//eşitlik çekini memory lokasyonuna göre yapıyor
console.log(myObj == myObj2);
console.log(myObj2);
var myArray = ["a", "b","c"];
console.log(my... | true |
79705c6f99dffe2624efeefa856edf3fb5d2fe29 | JavaScript | andreseula/tuto-git | /js/index.js | UTF-8 | 259 | 3.3125 | 3 | [] | no_license | /*function decir(palabra) {
console.log(palabra);
}
function ejecutar(algunaFuncion, valor) {
algunaFuncion(valor);
}
ejecutar(decir, "Hola");
for (var i=0; i<4; i++){
console.log( i * 1);
}
*/
setTimeout(function () {
console.log('alalala');
}, 15); | true |
2148ba8042a2a58529d298cffb5601e8fedc43d9 | JavaScript | DeanSpooner/ukana | /src/components/SearchedWord.js | UTF-8 | 2,655 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import { kanaArray } from "../data/Kana";
import { toRomaji } from "kana-romaji";
import KanjiMiniCard from "./KanjiMiniCard";
import GetSearchedWord from "../requests/GetSearchedWord";
const SearchedWord = ({ searchedWord }) ... | true |
c4d9ba0c0fd6babf32b304296fd7d39701e78e88 | JavaScript | tarikmanoar/vsCode-Extensions | /Bootstrap 4 Autocomplete/build/update.js | UTF-8 | 1,782 | 2.96875 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
// file paths
var fname_css = "uikit/dist/css/uikit.css";
var fname_js = "uikit/dist/js/uikit.js";
var outfile = "completions.py";
if (!fs.existsSync(fname_css) || !fs.existsSync(fname_js)) {
console.log("Make sure to build UIkit before running this task");
return;
}
// returns the ar... | true |
f5a3042857e0db0b33caa3e043665e5db560988c | JavaScript | Sunsette/angular-custom-filters | /src/custom-angular-filters.js | UTF-8 | 1,263 | 2.875 | 3 | [] | no_license | angular.module('customFilters', []).filter('reverse', function () {
return function (input) {
var i, output = '';
if (angular.isString(input)) {
for (i = 0; i < input.length; i++) {
output = input.charAt(i) + output;
}
return output;
} else {
return input;
}
};
}).filter('titlecase', functio... | true |
513c245b52ee1f348dadb1f64dc9b029119d41d2 | JavaScript | Jiahua2333/TTP-FromEdit-FolderToggle | /src/Components/display.js | UTF-8 | 2,269 | 2.875 | 3 | [] | no_license | import React, { Component } from "react";
class Display extends Component {
constructor(props) {
super(props);
this.state = {
FirstName: '',
LastName: '',
isEdit: false,
preFirstName: '',
perLastName: '',
};
}
handleEditClick = () =>... | true |
549a06e4cd4c44453a5dc51eacc0610003942567 | JavaScript | merelu/Study_react-redux | /src/exercise.js | UTF-8 | 2,010 | 3.671875 | 4 | [] | no_license | import { createStore } from "redux";
// 리덕스에서 관리 할 상태 정의
const initialState = {
counter: 0,
text: "",
list: [],
};
// 액션 타입정의
// 액션 타입은 주로 대문자로 작성한다.
const INCREASE = "INCREASE";
const DECREASE = "DECREASE";
const CHANGE_TEXT = "CHANGE_TEXT";
const ADD_TO_LIST = "ADD_TO_LIST";
//액션 생성함수 정의
//액션 생성함수는 주로 camelC... | true |
9d83e8235a7f06646c769c5f8d3d83df417a7008 | JavaScript | mhdshebeeb/rekhamaam | /lib/data.js | UTF-8 | 8,509 | 2.890625 | 3 | [] | no_license | const data = [
{
img: "sabreen.jpeg",
text: `MAY GOD FILL YOUR LIFE WITH HAPPINESS THAN EVER.
❤️HAPPY BIRTHDAY REKHA MAM ❤️ `,
name: "Sabreen Rafeek",
},
{
img: "basil.jpg",
text: `Wishing you a wonderful birthday , Rekha ma'am.
May the sunshine of your wisdom, kindness and knowledge... | true |
3e141db5fc3570e6f2c382e8aadd8dfcb264d87d | JavaScript | hwanschoi/Innsys_server | /innsys_expert/public/js/input_img_upload.js | UTF-8 | 2,420 | 2.65625 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var fileTarget = $('.filebox .upload-hidden');
fileTarget.on('change', function () {
if (window.FileReader) {
// 파일명 추출
var filename = $(this)[0].files[0].name;
} else {
// Old IE 파일명 추출
var filename = $(this).val()... | true |
b84583fe41c094c0de1b50cce34fe21c18b4e82b | JavaScript | noszczykmichal/noszczykmichal.github.io | /zadania-domowe/1-pobierz-dane-programisty/js/main.js | UTF-8 | 873 | 2.65625 | 3 | [] | no_license | "use strict";
$(function(){
let btn=$("<button>").attr("id", "btn").text("Pobierz dane");
$("body").prepend(btn);
let container=$("<div>").attr("id","container");
$("#btn").after(container);
$("#btn").click(function(){
$.getJSON("https://akademia108.pl/kurs-front-end/ajax/1-pobierz-dane-p... | true |
41ca3d0c32448049100f7f0eb376e4a17006f977 | JavaScript | DeepakSharma1402/SearchPosition | /ClientApp/src/App.js | UTF-8 | 2,909 | 2.984375 | 3 | [] | no_license | import React, { Component } from 'react';
export default class App extends Component {
static displayName = App.name;
constructor(props) {
super(props);
this.state = {
url: '',
keyword: '',
searchPositions: [],
loading: true,
viewFo... | true |
8ee204a3d2e2d8e045e60e99116a5a43e55b5c2a | JavaScript | sousou03/data-visualization-salespage | /htdocs/src/js/src/_MyLibs/View/UI/map/Googlemap.es6 | UTF-8 | 1,690 | 2.734375 | 3 | [] | no_license | //--------------------------------------------------
//
// GoogleMap
//
//--------------------------------------------------
export default class GoogleMap {
constructor(latlng, address, $object, opt) {
this.latlng = {};
this.latlng.lat = latlng.lat || 35.6701962;
this.latlng.lng = latlng.lng || 139.... | true |
f7ac9438ba0601d4d12d10a8b3729bf7cf7d7bf9 | JavaScript | ih-suarez/fsw-140 | /week6/sql/client/src/App.js | UTF-8 | 892 | 2.53125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import axios from 'axios';
import { map } from 'lodash';
import './app.css';
export default function App() {
const [data, setData] = useState();
useEffect(() => {
axios.get('/getVehicles')
.then(res => setData(res.data))
.catc... | true |
78c8790aa74cbb509f79def1c7174a029c5c767f | JavaScript | hanyrostom/anchorman2 | /helpers/news.js | UTF-8 | 673 | 2.546875 | 3 | [] | no_license | const request = require('request')
let config
try {
config = require('../config.js').TOKEN
} catch(err) {
// GITHUB_TOKEN might have a different name
// depending on your configuration
config = process.env.TOKEN
}
let getArticlesByTopic = (topic, callback) => {
//console.log('getarticlesbytopicfunc', topic);... | true |
1f571a861d08ea152f713d0a8b9bc4f5bef296d0 | JavaScript | WangJiaoJo/JSCode | /Lecture11/Lab9/data/notes.js | UTF-8 | 1,112 | 2.875 | 3 | [] | no_license | const fs = require('fs');
let exportedMethod = {
getAllNotes: () => {
var notes = JSON.parse(fs.readFileSync("./private/notes.json"));
return Promise.resolve(notes);
},
getNote: (id) => {
if (id == undefined) return Promise.reject("No id provided");
var notes = JSO... | true |
4c814a834ada04caea6f847880aa21aa10d25fbf | JavaScript | LilyChenlin/leetcode | /39.组合总和/40.组合总和-ii.js | UTF-8 | 914 | 3.109375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=40 lang=javascript
*
* [40] 组合总和 II
*/
// @lc code=start
/**
* @param {number[]} candidates
* @param {number} target
* @return {number[][]}
*/
var combinationSum2 = function(candidates, target) {
let res = [], solution = [];
candidates.sort((a, b) => a - b)
let backTrack... | true |
2a8e386f778559160ca37365934bc3e22da1a0f8 | JavaScript | tisidro/code | /Week3a/labenemieslist.js | UTF-8 | 759 | 4.125 | 4 | [] | no_license | //Change hello.js so that it says "Go away!" if the user's name is any one of a number of evil names For instance, Voldemort, Palpatine, Lex Luthor...
//Bonus Challenge: don't let enemies sneak in even if they spell their names with capital letters, like VolDeMortconsole.log("What is your name?");
function handleInput... | true |
17fee828ecea2115052652e9ade2c2fa039639e0 | JavaScript | DillGromble/senior-enrichment | /server/api/campuses.js | UTF-8 | 1,064 | 2.515625 | 3 | [] | no_license | const campuses = require('express').Router();
const db = require('../../db/models');
const Campuses = db.Campuses;
campuses.get('/', (req, res, next) => {
Campuses.findAll()
.then( campusesList => res.json(campusesList))
.catch(next);
});
campuses.post('/', (req, res, next) => {
const { name, image } = req.... | true |
afdd7f478a6a9e26321707ff52eef5baffda4ae1 | JavaScript | pradeepkr0/TS_Complete_Template | /04_ES6_Template_Strings/04_app.js | UTF-8 | 866 | 4.125 | 4 | [] | no_license | /*
---------------------------------------------------------------------------------
2. Template Strings
---------------------------------------------------------------------------------
Instead of using String Concatenation Operator for joining two or more
String Literals Template Strings are best alternative. In t... | true |
4af656e7b3952f083efd526f7892285265fd6e48 | JavaScript | heyman333/fastcampus-react-2019 | /5th/redux-start/src/reducers/todos.js | UTF-8 | 596 | 2.859375 | 3 | [] | no_license | import { ADD_TODO, COMPLETE_TODO } from "../actions";
export default function todos(previousState, action) {
if (previousState === undefined) {
return [];
}
if (action.type === ADD_TODO) {
return [...previousState, { text: action.text, completed: false }];
}
if (action.type === COMPLETE_TODO) {
c... | true |
fcc4f9e3c9ab0528ff4d07dda2371481d97a8f59 | JavaScript | timetoady/timetoady.github.io | /myTests/test.js | UTF-8 | 2,197 | 3.9375 | 4 | [
"MIT"
] | permissive | let testArea = document.querySelector("#testArea")
let connectionTest = document.createElement("p")
connectionTest.textContent = "Is this thing working?"
testArea.appendChild(connectionTest)
const testObj = {
name: 'Landon',
age: 33,
eyeColor: 'blue',
father: true,
children: [
{
... | true |
0d8a3af333c6977472686aab0898fa2e421ba4d2 | JavaScript | Dletta/twittertest | /view/index.js | UTF-8 | 1,806 | 2.875 | 3 | [] | no_license | var {ipcRenderer} = require('electron')
const util = require('util')
var Tweets = function () {
this.tweets = []
this.time = []
this.place = []
this.word = []
this.text = []
this.process = function(data) {
/* Split text into words
*/
data.words = data.text.split(" ")
/*Enter Data, link wi... | true |
c4ddbf04ebde3e2b15a174e661e7b250b5baf6e2 | JavaScript | scaccoman/recipe-search | /src/containers/search_bar.js | UTF-8 | 1,751 | 2.578125 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { fetchRecipes } from "../actions/index";
import _ from "lodash";
class SearchBar extends Component {
constructor(props){
super(props);
this.state = {term: ""... | true |