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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ba1e4c7b00d47a56806368a9278a851517a96381 | JavaScript | khongor8832/Finance | /74 Event bubbling буюу эвент дамжуулах.js | UTF-8 | 684 | 2.578125 | 3 | [] | no_license | var a = document.getElementById('a');
var b = document.getElementById('c');
var c = document.getElementById('b');
var d = document.getElementById('d');
// a.addEventListener("click", function(event){
// console.log('A дарагдлаа');
// });
// b.addEventListener("click", function(event){
// console.log('b дарагдл... | true |
da3296266306a63f8d7c655370187f14ed077881 | JavaScript | git2358/mode7 | /src/util/mode7/drawObject.js | UTF-8 | 2,465 | 3.203125 | 3 | [] | no_license | /* @flow */
type Mode7Config = {
horizon: number;
spaceZ: number;
scaleX: number;
scaleY: number;
objScaleX: number;
objScaleY: number;
fallbackColor: [number, number, number, number]
};
type Rectangle = {
x: number;
y: number;
w: number;
h: number;
};
/**
* Based off of:
* http://helixsoft.n... | true |
e310966ffddd4cc6773d55a478321d8e13c713e1 | JavaScript | Geek-in-Training/lil-playground | /js/sound.js | UTF-8 | 1,225 | 2.828125 | 3 | [] | no_license | var sound = function () {
var exports = {};
var context;
var buffers = [];
if (typeof AudioContext !== "undefined") {
context = new AudioContext();
}
else if (typeof webkitAudioContext !== "undefined") {
context = new webkitAudioContext();
}
else {
try {
var tagPlay = document.createElement("audio");
... | true |
41cd12d00e1871140f77a87a0bab80bc2e679ee0 | JavaScript | wangpengfeido/MyLearn0 | /LearnES6/010let和const命令/010let命令/010基本用法/index02.js | UTF-8 | 399 | 3.265625 | 3 | [] | no_license | /**
* Created by w1036_000 on 2016/11/29.
*/
for(let i=0;i<10;i++){}
console.log(i);
//////////////////////////////////////
// 这样的原因时let声明在块级作用域内有效
var a=[];
for(var i=0;i<10;i++){
a[i]=function () {
console.log(i);
}
}
a[6](); // 10
////
var b=[];
for(let j=0;j<10;j++){
b[j]=function () {
... | true |
cf24b989be584f30fa1aee48fdb4d24a18ae57fb | JavaScript | saricaahmet/kan | /src/providers/donationProvider/DonationsProvider.js | UTF-8 | 1,364 | 2.671875 | 3 | [] | no_license | import React from 'react';
import donationsJson from "../../assets/json/donations";
export const DonationsContext = React.createContext();
export default class DonationsProvider extends React.Component {
constructor(props) {
super(props);
this.state = {
donations: []
};
}
... | true |
45ae05acb15f96eff4005b17b6df1e6e48104715 | JavaScript | THarrison-Arup/NC-News-API | /controllers/articles.js | UTF-8 | 1,668 | 2.640625 | 3 | [] | no_license | const {
fetchArticles,
fetchArticleById,
updateArticle,
removeArticle,
fetchCommentsByArticleId,
addComment
} = require("../models/articles");
exports.sendArticles = (req, res, next) => {
fetchArticles(req.query)
.then(articles => {
if (!articles)
return Promise.reject({ status: 404, ms... | true |
1acdb7d94e113b1779bab0248c6c84fb224ef32a | JavaScript | umairasif90/Js-Assognment-1-67 | /chapter43-48/app.js | UTF-8 | 545 | 3.0625 | 3 | [] | no_license | //1
// function onClick(){
// alert("hello");
// }
//2
// function Onclick(){
// alert("thanks for purchasing")
// }
//3
// function dele(j){
// var i = j.parentNode.parentNode.rowIndex;
// document.getElementById("table").deleteRow(i);
// }
//4
// function changeImage(id,src){
// var image = doc... | true |
83d09a1a9a2cd909513b0e6fc465b1960d90f2b0 | JavaScript | lillheaton/js-dom-game | /scripts/game.js | UTF-8 | 1,621 | 2.71875 | 3 | [] | no_license | define([
'jquery',
'underscore',
'events',
'classy',
'time'
], function(
$,
_,
Events,
Classy,
GameTime
){
var Game = Classy.extend({
// raf: window.requestAnimationFrame ||
// window.webkitRequestAnimationFrame ||
// window.mozRequestAnimationFrame ||
// window.msRequestAnimationFrame,
_ga... | true |
7e149f7e49c0ae15f7b76def2086864e20934d04 | JavaScript | janousek77/lab-28-29-todo | /lab-chris/src/component/note-item/index.js | UTF-8 | 598 | 2.640625 | 3 | [] | no_license | import React from 'react';
class NoteItem extends React.Component{
constructor(props){
super(props);
this.handleDelete = this.handleDelete.bind(this);
console.log(this.props.app.state.notes);
console.log(this.props.note.id);
}
handleDelete() {
this.props.app.setState(state => ({
notes:... | true |
42610114b4418dafd7199ea7be0409295be0bf26 | JavaScript | kkrisst/rock-paper-scissors | /src/pages/player-page/player-page.component.jsx | UTF-8 | 4,859 | 3.203125 | 3 | [] | no_license | import React, { Component } from 'react';
import Header from '../../components/header/header.component.jsx';
import PlayerChoices from '../../components/player-choices/player-choices.component.jsx';
import './player-page.styles.scss';
class PlayerPage extends Component {
constructor(props){
super(props);
... | true |
dd7204fe94b87638754f55b78beabbe5a496e90b | JavaScript | PasiP/fullstackopen2019 | /osa2/puhelinluettelo/src/index.js | UTF-8 | 3,871 | 2.796875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import personService from './services/persons'
import Filter from './components/Filter'
import Numbers from './components/Numbers'
const App = () => {
const [ persons, setPersons] = useState([])
const [ newName... | true |
336b552fe44e6b923f82cef2057d99d9ec0f8553 | JavaScript | Georgiyukr/myFirstReactApp | /reactApp/components/InputLine.js | UTF-8 | 993 | 2.859375 | 3 | [] | no_license |
import React, { Component } from 'react';
import '../style.css';
class InputLine extends Component {
constructor(props) {
super(props);
this.state = { typedText : '' }
}
handleTyping(event) {
this.setState({typedText: event.target.value})
}
handleSubmit(event) {
e... | true |
26c83f5e83052df27a609952d6f07a54072b7929 | JavaScript | bmarc94/React | /test/src/pages/ThreeCardMonteGame/ThreeCardMonteGame.js | UTF-8 | 2,146 | 2.53125 | 3 | [] | no_license | import React from "react";
import { string, func } from "prop-types";
import { Link } from "react-router-dom";
import ThreeCardMonte from "./components/ThreeCardMonte";
import XMLHttpRequestPromise from "../../utils/XMLHttpRequestPromise";
import "./threeCardMonteGame.css";
export default class ThreeCardMonteGame e... | true |
432cb81d75e3b7a2e8bcd92794580a7488ba8f37 | JavaScript | dudapawel/Weather | /API/src/lib/API/WeatherAPIServer.js | UTF-8 | 6,144 | 2.859375 | 3 | [] | no_license | // Name: WeatherAPIServer.js
// Author: Pawel Duda
// Description: class which adds functions to HTTPServer.js
// there are all functions to response requests to API
const fs = require('fs');
import {Jwt} from './Jwt.js';
import {UserList} from './UserList';
import {getWeather} from '../weatherServerReq... | true |
f8b737643e2f50e4feeb931adc997b55d2b2b0d2 | JavaScript | acm-w-nitk/acm-w-nitk.github.io | /js/members.js | UTF-8 | 2,424 | 2.921875 | 3 | [
"MIT"
] | permissive | const members1 = [
{
id: 1,
name: "Supritha Harishankar",
desc: "Chairperson",
photo: "images/Supritha.png",
facebook: "https://www.facebook.com/acmwnitk/",
linkedin: "https://www.linkedin.com/in/suprithahs/"
},
{
id: 2,
name: "Subham Chakraborty",
desc: "Vice-Chair",
photo... | true |
5c5cad30bacf4dfb1422107f7504fd0e25066854 | JavaScript | VladyslavHimself/thallium | /src/components/SearchBar/SearchBar.jsx | UTF-8 | 948 | 2.59375 | 3 | [] | no_license | import classes from './SearchBar.module.scss';
import {useState} from "react";
import locale from "../../common/locales/en-US.js";
export const SearchBar = ({ dataList, setFilteredList }) => {
const [searchInputValue, setSearchInputValue] = useState('');
const onChangeInputHandler = (inputValue) => {
setSear... | true |
14bf369d653fa1ad1e0640cdd201679939c479e8 | JavaScript | cmgus/rocketapp-bot | /db/data/dataDePrueba.js | UTF-8 | 812 | 2.578125 | 3 | [] | no_license | const db = require("..");
//Datos de ejemplo para el chatbot auditor - Poblado de tablas cuestionarios y preguntas
let cuestionarios = ["Cuestionario de Prueba"];
let preguntas = ["Pregunta de prueba"];
cuestionarios.forEach((cuestionario) => {
db.query(
`insert into cuestionarios(nombre) values('${cuestionar... | true |
b5d3c602eb4ae98e2124abf05dbea28c8ae6e74e | JavaScript | CHAIBHANGALE/nodejstut | /samplenode/Mongotodoapi/server/server.js | UTF-8 | 3,251 | 2.65625 | 3 | [] | no_license | const {mongoose}=require('./db/mongoose');
const {Todo}=require('./models/todo');
const {User} =require('./models/user');
const express=require('express');
const bodyParser=require('body-parser');
const {ObjectID} =require('mongodb');
const _ =require('lodash');
const {authenticate}=require('./middleware/authenticate')... | true |
5115959ac9620f4f37262ed5eabfe8e3e9b73ea5 | JavaScript | IsaRodz/Client-GraphQL-Test | /main.js | UTF-8 | 1,394 | 3.0625 | 3 | [] | no_license | const continentSelect = document.getElementById('continentSelect')
const countriesList = document.getElementById('countriesList')
queryFetch(`
query {
continents {
name
code
}
}`)
.then(result => {
result.data.continents.forEach(continent => {... | true |
27cc619ea3c700335f94e31525c322105306e77c | JavaScript | ilyaminovich/module_3 | /app/rickAndMorty.js | UTF-8 | 2,641 | 3.015625 | 3 | [] | no_license | const axios = require('axios');
const fs = require('fs');
chalk = require("chalk");
function downloadRickAndMortyApi() {
let arrayJson = [];
let numberOfPages;
axios({
method: 'get',
url: `https://rickandmortyapi.com/api/character/?page=1`,
responseType: 'json'
}).then(respons... | true |
7d8e1e2825dd031f8e53e6fd830e4eac3288127b | JavaScript | minhee0327/Algorithm | /JavaScript/programmers/javaScript_lv1_연습문제/lv1_콜라츠 추측.js | UTF-8 | 219 | 3.125 | 3 | [] | no_license | function solution(n) {
var cnt = 0;
while (n !== 1) {
if (cnt >= 500) {
return -1;
}
if (n % 2) {
n = n * 3 + 1;
} else {
n = Number(n / 2);
}
cnt += 1;
}
return cnt;
}
| true |
24fda36877ba6e66585956c71ec381df0e3eea66 | JavaScript | nooldey/simple-webpack-demo | /src/index.js | UTF-8 | 351 | 2.578125 | 3 | [] | no_license | import * as xMath from './libs/math';
function component() {
let element = document.createElement('div');
element.innerHTML = [
'Hello',
'webpack',
'with',
'pwa',
'3 cubed is equal to ' + xMath.cube(3),
'5 cubed is equal to ' + xMath.cube(5),
].join('\n\n');
return element;
}
document.... | true |
7c2cf964ef1cfe480ec6d547db2972b3875f93f1 | JavaScript | ztalbot2000/PIXI_UI_IWM | /test/originalSrc/progress.js | UTF-8 | 9,785 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import Theme from './theme.js'
/**
* Class that represents a PixiJS Progress.
*
* @example
* // Create the progress
* const progress = new Progress({
* app: app
* })
*
* // Add the progress to a DisplayObject
* app.scene.addChild(progress)
*
* @class
* @extends PIXI.Container
* @see {@link http://pi... | true |
4d228055e0f435a23eb48deb8a11712818367d1b | JavaScript | DoreySarabia/node-practicas | /archivos_os/os.js | UTF-8 | 507 | 2.59375 | 3 | [] | no_license | const os = require('os');
//Potencia del ordenador
//console.log('CPU info', os.cpus());
// Para conocer la IP
//console.log("IP address", os.networkInterfaces().en0.map(i => i.address));
//Memoria disponible
// console.log("Memory free in bites", os.freemem());
//Para saber el tipo de sistema operativo
// consol... | true |
ceedf9f32ac114d2c9260725041e811f86a20cf4 | JavaScript | rayjencode/vanillaJs_backgroundSlider | /script.js | UTF-8 | 1,984 | 2.75 | 3 | [] | no_license | const images = [
{
value: 1,
src: `https://img3.goodfon.com/wallpaper/nbig/7/74/marya-face-london-beautiful.jpg`,
text: 'Heading One',
},
{
value: 2,
src: `https://www.wallpaperup.com/uploads/wallpapers/2013/01/29/31927/9b8840218bb5064b3175880ebdc405c0-700.jpg`,
... | true |
ce05341ddb4cc89cea1fb77964dbc6bf31c44ca6 | JavaScript | kperwel/react-workshops | /src/solutions/task-4.jsx | UTF-8 | 1,796 | 3.03125 | 3 | [] | no_license | import React, { useState, memo, useCallback } from "react";
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if (new Date().getTime() - start > milliseconds) {
break;
}
}
}
// Optimize following component
const Player = memo(({ name }) => {
consol... | true |
60494f00b8247c7b9a56e29adf578b87b441f12e | JavaScript | gcraventoslg/comIT | /Browser/ex40/script40.js | UTF-8 | 697 | 3.6875 | 4 | [] | no_license | let color = "";
let counter = 1;
const selectColor = () => {
switch (counter) {
case 1:
color = "red";
break;
case 2:
color = "blue";
break;
case 3:
color = "green";
break;
case 4:
color = "gray";
break;
default:
color = "white";
break;
... | true |
7d5bcdd3c862ebb6dfcf2b1f2ce380f4d35b113e | JavaScript | KameliaDimitrova/Javascript-Core-Softuni- | /1. JS Fundamentals/3. Functions and Logic Flow/04_Cooking-Numbers/solution.js | UTF-8 | 793 | 3.203125 | 3 | [] | no_license | function solve() {
let buttons=Array.from(document.getElementsByTagName('button'));
buttons.forEach(btn=>{
btn.addEventListener('click',event=>
{
let button=event.target.textContent;
let inputNumber=Number(document.getElementsByTagName('input')[0].value);
let outputNumber=Number(document.getElementById(... | true |
f3ba26065c98f13e0e4265adb53fc15eb270096f | JavaScript | sal-kiti/sal-kiti-front | /src/mixins/ResultImport.js | UTF-8 | 24,079 | 2.609375 | 3 | [
"MIT"
] | permissive | import { HTTP } from "@/api/BaseApi";
import * as XLSX from "xlsx";
import errorParser from "@/utils/ErrorParser";
export default {
methods: {
/**
* Clean variables between results
*/
cleanVariables() {
this.result = {
athlete: null,
category: null,
competition: this.c... | true |
aae6f4d38787570ba4782b366dc3d65b24dc2141 | JavaScript | Navi-firm/HRMS | /assets/js/libs/username_check.js | UTF-8 | 367 | 2.65625 | 3 | [] | no_license | //Check if username exists
$('#username').keyup(function(){
var username = $(this).val();
$('#username_results').text('Validating....');
if(username != ''){
$.post('processes/username-check.php', {username: username}, function(data){
$('#user_results').text('');
});
}else{
... | true |
56d85f75e6c7d786d07f8f18095687ecacbf18e9 | JavaScript | Maxwin-z/xsmth-newsmth | /newsmth/jsParser/boardlist.js | UTF-8 | 1,530 | 2.515625 | 3 | [] | no_license | var data = {
__type: 'SMBoardList',
items: [
/*
{
__type: 'SMBoardListItem',
isDir: false,
title: '',
url: '',
board: {
__type: 'SMBoard',
name: '',
cnName: ''
}
}
*/
]
};
function $parse(html) {
var rsp = {code: 0, data: data, message: ''};
var matches = html.match(/<ul clas... | true |
5b8b7be98fc5fc4e9715a9d5f908def932d374a9 | JavaScript | brigand/class-bind | /test/bindAll.js | UTF-8 | 602 | 2.59375 | 3 | [] | no_license | import test from 'tape';
import bindAll from '../src/bindAll';
test('bind', (t) => {
t.test('binds', (t) => {
class C {
constructor(){ this.x = 1; this.y = 2 }
foo(){ return this.x }
bar(){ return this.y }
}
// sanity
t.test('sanity', (t) => {
const {foo, bar} = new C();
... | true |
e6e6b2f4253965e26f73d67f99ed10390a1c2a81 | JavaScript | asen-krasimirov/JavaScript-Advanced-Course | /06. Advanced Functions/06. 01. Lab/problem-six.js | UTF-8 | 568 | 3.515625 | 4 | [] | no_license |
function listProcessor(commands) {
let collection = [];
const executeCommands = {
add(str) { collection.push(str); },
remove(str) { collection = collection.filter(elem => elem != str); },
print() { console.log(collection.join()); }
};
for (let data of commands) {
let ... | true |
6e756af79e1bdb6756f1ef7f6b97aaf41b4d894e | JavaScript | MarcoFerreiraofc/Senai_Sprint4_JS | /EXERCÍCIOS/Exercise_FirstContact/arquivo.js | UTF-8 | 1,856 | 4 | 4 | [] | no_license | // TESTE 1:
console.log("10" / 2);
console.log("10" + 2);
console.log(0.1 + 0.7);
console.log(10 + 2);
console.log("10" + "2");
// TESTE 2:
var nome = 'lucas' // string
var nome = "lucas" // string
var idade = 17 // int
const nota = 0 // int
let nome = "lucas" // string || o let tem suas especificidades || var = tem... | true |
70d6f98c2a6a94b077b8d227e56e2952dc052e08 | JavaScript | PerHapsAtGit/mas | /src/client/modules/game.spec.js | UTF-8 | 3,902 | 2.78125 | 3 | [] | no_license | import game from './game';
import { ROOM_TYPES } from '../../common/room';
describe('game', () => {
game.log = (msg) => msg;
game.rl.question = () => {};
describe('showStats()', () => {
it('should return stats correctly', () => {
const expected = `X: ${game.x}, Y:${game.y}, HP: ${game.... | true |
fd3751135971aa52b344b3b028ec00d7a1288c8c | JavaScript | janemaguire/WDI-homework | /janemaguire/w04d02/quotes/data/quotes.js | UTF-8 | 437 | 2.671875 | 3 | [] | no_license | let quotes = [
{ id: 0, text: "Ain't no such thing as a weak woman.", name: "Beyonce Knowles" },
{ id: 1, text: "Age is just a number. It’s totally irrelevant unless, of course, you happen to be a bottle of wine.", name: "Joan Collins"},
{ id: 2, text: "If you don't love yourself, how in the hell you gonna love somebo... | true |
02acc1e6d9df87a9d4fbadca1ab4e87130945209 | JavaScript | mashthekeys/node-mysql2 | /lib/parsers/text_parser.js | UTF-8 | 6,319 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict';
const genFunc = require('generate-function');
const helpers = require('../helpers');
const Types = require('../constants/types.js');
const CastField = require('./cast_field');
const PacketParser = require('./packet_parser');
const parserCache = require('./parser_cache.js');
/**
* Generates code to
* •... | true |
aa7fbf2859279c611cf97b02d1776413d5660ebd | JavaScript | curtisbateson/chatty-server | /server.js | UTF-8 | 2,160 | 3.046875 | 3 | [] | no_license | // server.js
const express = require('express');
const SocketServer = require('ws').Server;
const uuid = require('uuid/v4');
// Possible colours for each user (assigned randomly)
const colors = ['#639', '#ff6347', '#DE1E7E', '#F00'];
// Set the port to 3001
const PORT = 3001;
// Create a new express server
const se... | true |
c93d528185e532498cf0a12c609ef8460ac54460 | JavaScript | matsushita-y/store-js | /tests/js/classes/tests.js | UTF-8 | 1,797 | 3.421875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | (function () {
var Test = function (creator, name) {
this.creator = creator;
this.name = name;
this.succeeded = false;
this.failed = false;
this.element = document.createElement("div");
this.element.innerHTML = this.name + '... <b class="orange">WAITING</b>';... | true |
366b0c3150ff2f27eb622f84bd33a73c44eecfe5 | JavaScript | malenabensadon/Prog1Musica | /js/index.js | UTF-8 | 4,841 | 3.234375 | 3 | [] | no_license | window.addEventListener('load', function() {//controlar que todo el html esté cargado en el navegador
//Formulario
//Capturamos el formulario
let formulario = document.querySelector('form');
let buscador = document.querySelector('[name="search"]'); //capturamos el campo que queremos chequear
//creamo... | true |
a2d7cbd6101cc0056397e356f17e5af21684deeb | JavaScript | Chukklez/webshop | /handler.js | UTF-8 | 1,433 | 3.328125 | 3 | [] | no_license | //Created an add function that gets id from product and adds it to cart
function add(req, res){
const productId = req.params.id;
const product = db.get('products')
.find({id: productId})
.value();
const cart = db.get('cart')
.find({id: productId})
.value();
const result = {
Succ... | true |
5893b207cd70372c8be5aaedc14c919adb453cf1 | JavaScript | oshry/soundcloud | /soundcloudAPI.js | UTF-8 | 2,117 | 2.703125 | 3 | [] | no_license | "use strict"
var http = require('http');
var winston = require('winston');
var Storage = require('./storage.js');
var myLogger = require('./mylogger.js');
const client_id = 'pCNN85KHlpoe5K6ZlysWZBEgLJRcftOd';
const soundclod_api_url= 'http://api.soundcloud.com/tracks/';
//My secretKey
const mysecretKey = 12345678;
// ... | true |
b7b5c839e6e80ebd87ab85a7aabc2113d6812a9f | JavaScript | AntJanus/Labs | /JQUERY/slider/jquery.slide2.js | UTF-8 | 3,982 | 3 | 3 | [] | no_license | (function($){
// this is the debug version
/*
* @page index Awesome Slide
* @tag home
* ### Awesome Slider
*
* Awesome slider creates a slider that has several moving parts (an image and a caption) both of which are separately animated
* @param (String) container
*/
$.fn.awesomeSlide = function(){
var co... | true |
f43404838fa0892fcb2f6630497177beb4f9c695 | JavaScript | AnnKemp/Javascript | /maths_02/oef3/math3.js | UTF-8 | 415 | 3.234375 | 3 | [] | no_license | (function() {
document.getElementById("run").addEventListener("click", function(){
function rekenen() {
for(x=1; x <= 21; x++){
var node = document.createElement("li");
var textnode = document.createTextNode(Math.pow(x,2));
node.appendChild(textnode);
do... | true |
fcfe4110a89205c7ce15b409eb9cc2857c6a5f30 | JavaScript | aswinkumar863/hackerrank-regex-solutions | /Regex/07_Applications/Easy/27_detect-html-tags.js | UTF-8 | 206 | 2.84375 | 3 | [] | no_license | function processData(input) {
let matches = input.matchAll(/<(\w*)\b.*?>/g)
let results = Array.from(matches).map(match => match[1])
console.log(Array.from(new Set(results)).sort().join(';'))
}
| true |
77a38d5c1d3c447b5e44af54c6799200971f54a9 | JavaScript | devilkun/catch-admin-vue | /src/components/Catch/Table/type.js | UTF-8 | 654 | 3.234375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | const toString = Object.prototype.toString
export function isFunction(obj) {
return typeof (obj) === 'function'
}
export function isObject(obj) {
return obj === Object(obj)
}
export function isArray(obj) {
return toString.call(obj) === '[object Array]'
}
export function isDate(obj) {
return toString.call(ob... | true |
194deba68e29e5d2dfdb25fc9892ae123637df61 | JavaScript | CheezItMan/typescript-syntax | /functions.js | UTF-8 | 355 | 3.484375 | 3 | [] | no_license | var add = function (num1, num2) {
return num1 + num2;
};
var subtract = function (num1, num2) {
return num1 - num2;
};
var divide = function (num1, num2) {
return num1 / num2;
};
var multiply = function (a, b) {
return a * b;
};
console.log(add(5, 6));
console.log(subtract(5, 6));
console.log(divide(55,... | true |
d9828f8ca9fc9522ffd4d5bc89a6644e7bcb7b98 | JavaScript | wjjunior/Javascript-CodeChallenges | /WORD-COUNTER/app.js | UTF-8 | 170 | 3.328125 | 3 | [] | no_license | let str = "The quick brown fox jump over the lazy dog"
const wordCounter = (str) => {
let arr = str.split(" ")
return arr.length
}
console.log(wordCounter(str)) | true |
47e64d890ae627f5b73fe2314d6cc195a2d5c5fe | JavaScript | lindapaiste/react-aw32zq | /objects/InstagramApi.js | UTF-8 | 1,618 | 2.546875 | 3 | [] | no_license | import React from 'react';
import FetchContainer from '../containers/FetchContainer';
//----------------------------------AUTHENTICATED API--------------------------------//
class IGFollowingList extends React.Component {
constructor() {
super();
this.state = {
apiLoaded: false,
... | true |
4ef923edde9337a2e8e560f5396b6061abba5076 | JavaScript | pusheax33/Restaurant-TP-UNAJ | /Frontend/src/screens/todayComandas.js | UTF-8 | 1,389 | 2.734375 | 3 | [] | no_license | import { getComanda } from "../actions/comandaActions.js";
import {getFormasEntrega} from "../actions/formaEntregaActions.js"
import { LoadComandas } from './comandas.js'
let mercaderiasDiv = document.getElementById("mercaderia-list")
window.onload = async() => {
LoadComandas()
var today = new Date();
... | true |
f13fa55fdc295589a900e240d413b483e60bd3ae | JavaScript | antoniolocandro/DatosAbiertos | /test/accountTests.js | UTF-8 | 1,766 | 2.53125 | 3 | [] | no_license | "use strict";
var accountModule = require("../modules/accounts.js");
var should = require('chai').should();
var database = require("../modules/database.js");
var q = require("q");
describe('Accounts', function() {
var account1 = {
email : "byron@acklenavenue.com"
};
var account2 = {
email : "mario@acklenavenu... | true |
78a17b1258838aba6e71c2370671d1a14d4394a9 | JavaScript | svahtml/html-css-fall-2017 | /week11/gallery/src/App.js | UTF-8 | 1,341 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import Gallery from './components/Gallery';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.width = 1000;
this.state = {
photos: [],
photos2: []
};
}
componentWillMount() {
fetch('https://jsonplaceho... | true |
357e2f17a449b4fae00b017c2063132f688b2edd | JavaScript | harsimran1993/WPS | /assets/JS/main.js | UTF-8 | 353 | 2.890625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
var pos=0;
var style = document.getElementById('home').style;
document.onclick = function() {
pos++;
style.backgroundPositionX = - spriteparseX(pos) + 'px';
style.backgroundPositionY = - spriteparseY(pos) + 'px';
};
function spriteparseX(pos){
return ((pos%64)*32);
}
function spriteparseY(pos){
ret... | true |
b9081f8902eb136db2d7e5a8b079bf166403c71d | JavaScript | stevenKirill/flamingo-riddles | /routes/user.routes.js | UTF-8 | 2,738 | 2.65625 | 3 | [] | no_license | const {Router} = require('express');
const User = require('../models/User');
const jwt = require('jsonwebtoken');
const updateUser = require('../middleware/user.update.data.middleware');
const router = Router();
const countryList = require('../other_data/countries');
// post на получение данных о пользователе
router.g... | true |
6eb93353da79580a7da423260ea6c6812bffffe7 | JavaScript | learnwithmanoj/coding-inteview-problems | /2. Sliding Window/Problem 2.js | UTF-8 | 825 | 4.59375 | 5 | [
"MIT"
] | permissive | /* Given an array of positive numbers and a positive number ‘k’, find the maximum sum of any contiguous subarray of size ‘k’. */
/*
Time Complexity: O(n)
Space Complexity: O(1)
*/
function max_sub_array_of_size_k(k, arr) {
let currentMaximumSum = 0;
let windowStart = 0;
let sum = 0.0;
for(let w... | true |
e16ee3154a67b933073b16b9aef5b793ad302a04 | JavaScript | stardev24/MMS | /userDetailsService.js | UTF-8 | 644 | 2.546875 | 3 | [] | no_license | var userDetailsUtil = require("./utils/userDetailsUtils");
var Q = require('q');
var User = require('./user');
var makePromise = require("make-promise");
/*This will provider details of user based on provider and uid*/
exports.getUserDetailsByUid = function(req,res){
var uid = req.params.uid;
var provider ... | true |
607fe8f7c9d873eb384f4424541835dbc2a060d7 | JavaScript | lugy-bupt/algorithm | /leet/0045-jump-game-II/jump-game-II.js | UTF-8 | 493 | 3.09375 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number}
*/
var jump = function(nums) {
let step = 0
let left = 0
let right = 0
if (nums.length == 1) return 0
while(left <= right){
step++
let oldRight = right
for (let i = left; i <= oldRight; i++){
let newRight = i + n... | true |
4ba6f56b40da76eddf0aba66735694cd1387f3ed | JavaScript | Sediqa-Fahimi/AAClasswork | /W9D3/jquery_tic_tac_toe/src/ttt-view.js | UTF-8 | 2,062 | 3.125 | 3 | [] | no_license | const Game = require("../tic_tac_toe_node_solution/game");
const moveError = require("./../tic_tac_toe_node_solution/moveError");
class View {
constructor(game, $el) {
this.game = game;
this.setupBoard();
this.bindEvents();
}
bindEvents() {
$('li').on('click', (e) => {
let pos = $(e.targe... | true |
d0bc8eeb632cc5f69b391aeffc5f6c7dcb0ee88c | JavaScript | laurakblitz/jsNotes | /3-controlFlowandErrorHandling/01-if.js | UTF-8 | 1,660 | 3.96875 | 4 | [] | no_license | let isOn = false;
// if (<some expression>) {<do something>}
//if (isOn == true) {
// console.log('The light is on!');
//};
if (isOn) {
console.log("The light is on!")
};
if (isOn == false){
console.log("The light is off");
};
let weather = 75;
// if (weather < 70) {
// console.log('Wear a jacket');
/... | true |
88768220ffdd593e63614b1786f68837791f18a6 | JavaScript | zachfunderburk/Week-1-Training-Code | /JSDEMO/Arrays.js | UTF-8 | 1,610 | 4.34375 | 4 | [] | no_license | //The Array is created within the square braces
var cars = ['Subaru', 'Volvo', 'BMW'];
//The Array variable call will need the Index number of
//the data that should be shown
console.log(cars);
//to get the whole array, a For loop can be used
//When the function loops, the different values will be shown
for(i=0;i<car... | true |
bc29b2b659e1e5e4eb1b599a3dc938bb7a8d78f5 | JavaScript | norech/minko | /examples/speed-test/index.js | UTF-8 | 2,351 | 2.890625 | 3 | [
"MIT"
] | permissive | (async () => {
console.log("First component rendering is always longer than subsequents renderings due to components caching.");
console.log("In most cases, the rendering will be cached.");
console.log(); // separator
console.time("Requiring Minko");
var { Minko } = require("../../bui... | true |
d01660e971a03a7b3cc9127898d0facfd6bc8eb9 | JavaScript | susancolour/js-green-book-3 | /chapter-6/s-6.2.1.3/test/index.js | UTF-8 | 2,156 | 2.765625 | 3 | [] | no_license | var expect = require('chai').expect;
var fancy = require('fancy-test').fancy;
var chapter = require('chapter').resolved;
describe(`[${chapter.toUpperCase()}] Check points`, ()=> {
let global_console_log = console.log.bind(console);
let load = filename => require('fs').readFileSync(require.resolve(filename)).toStri... | true |
deef0e9750dba64b849c627a319b4f9591152c33 | JavaScript | GalvezGM/cse341 | /prove01-routes.js | UTF-8 | 1,723 | 2.71875 | 3 | [] | no_license | const fs = require("fs");
const handler = (req, res) => {
const url = req.url;
const method = req.method;
if (url === "/") {
res.write("<html>");
res.write("<head><title>Prove01</title></head>");
res.write("<body>");
res.write("<h1>Account Creation</h1>");
res.write("<h3>Enter Username:</h3>... | true |
5073f143d1dd03306ae9ab8ad0d715797dfd79d0 | JavaScript | MedinaGitHub/ExampleRedux | /src/__tests__/components/ProductList.js | UTF-8 | 1,824 | 2.921875 | 3 | [] | no_license | //1) probar el componente representacional de forma aislada
import React from 'react';
//import { shallow } from 'enzyme';
import { render , mount } from 'enzyme';
import configureStore from 'redux-mock-store';
import ConnectedProductList from '../../components/ProductList';
const mockStore = configureStore();
//pr... | true |
44439dd846e4313c7dabdec32ed57301fed166f3 | JavaScript | NikolajGrunoski/DesktopHome | /NodeJs/domasna_4/v1.js | UTF-8 | 1,371 | 2.609375 | 3 | [] | no_license | var http = require('http');
var getAllStudents = () => {
console.log("Got all students");
};
var getStudent = () => {
console.log("Got student with id number: ");
};
var storeStudent = () => {
console.log("Posted student");
};
var updateStudent = () => {
console.log("Updated student with id number: "... | true |
a5d53a659c8613d8d63fd95d4f44beb0a0aaed61 | JavaScript | 201701072syahidi/modul04 | /script5.js | UTF-8 | 691 | 3.21875 | 3 | [] | no_license | var heightjohn = 170;
var heightpren = 195;
var heightita = 165;
var agejohn = 36;
var agepren = 25;
var ageita = 25;
function hitungskor(tinggibadan,umur)
{
var winner = tinggibadan + 5 * umur;
return winner;
}
var nilaijohn=hitungskor(heightjohn,agejohn);
var nilaipren=hitungskor(heightpren,agepren);
var nila... | true |
147537a9e50d3f93766f26d5ba97de242bbb2cd7 | JavaScript | JasoonX/EPAM_FinalTask | /js/shopping-bag.js | UTF-8 | 5,975 | 2.828125 | 3 | [] | no_license | "use strict";
const orderNow = document.querySelector(".order__container .button--accent");
const basketText = document.querySelector(".basket p");
const table = document.querySelector("table");
generateProductBag();
recalculatePrice();
updateBasket();
orderNow.addEventListener("click", order);
table.addEventListener... | true |
511a8a3f5f611e048f9611179b65cbeb1782c117 | JavaScript | shwilliam/vue-scrollin | /test/test.js | UTF-8 | 1,636 | 3.0625 | 3 | [
"MIT"
] | permissive | const assert = require('assert')
const { getRandomLetter, replace } = require('../src/lib')
describe('getRandomLetter', function () {
it('should return a string', function () {
assert.strictEqual(typeof getRandomLetter('asd'), 'string')
assert.strictEqual(typeof getRandomLetter('234'), 'string')
assert.s... | true |
88a218c8028d9a603784e42a34539475e623d183 | JavaScript | sabyasachibiswal/validator | /index.js | UTF-8 | 15,567 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* Created by sabyasachi on 07/07/18.
*/
/**
* Created by sabyasachi on 14/09/17.
*/
var sprintf = require("sprintf-js").sprintf, vsprintf = require("sprintf-js").vsprintf;
/**
* TO - DO
* 1. SAME : same as another field name , or same as given variable
* 2. Exists IN DB
*
*
*/
/**
* CONSTANTS
* D... | true |
b88f06a4a39aa5990238dd712db575b501f0c31f | JavaScript | millennial-web/node-mongo-scraper-api-vue | /express_api_demo/test/character_test.js | UTF-8 | 4,926 | 2.53125 | 3 | [] | no_license | //During the test the env variable is set to test
process.env.NODE_ENV = 'test';
const mongoose = require("mongoose");
const {Character} = require('../models/character_model');
//Require the dev-dependencies
let server = require('../index');
let chai = require('chai');
let chaiHttp = require('chai-http');
let should =... | true |
4e18fd410f90dab0c6a9e6503b56297699cc1d73 | JavaScript | amontano/places | /public/javascripts/thl-tabs.js | UTF-8 | 2,905 | 2.90625 | 3 | [] | no_license | /*
ThlTabs is an abstraction of jQuery UI tabs that allows "codes" (identifiers) to be attached to tabs.
Tabs can then more easily be added, updated, and managed, regardless of their index, which is what
is usually used as the identifier for jQuery UI tabs.
*/
var ThlTabs = {
// The id of the DOM element which holds... | true |
27068ec5049272f844629153b7ddd70304826c76 | JavaScript | SSG-Backend/eight-task | /michaeliyke/static/js/script.js | UTF-8 | 2,127 | 2.609375 | 3 | [] | no_license | !(function() {
function select(selector) {
return document.querySelector(selector);
}
Dropzone.options.myAwesomeDropzone = { // The camelized version of the ID of the form element
// The configuration we've talked about above
autoProcessQueue: false,
uploadMultiple: false,
parallelUploads:... | true |
7b02c78b7c11d90d6592780b2ed02ae9393b7838 | JavaScript | h5p/h5p-editor-branching-scenario | /src/scripts/helpers/DOM.js | UTF-8 | 435 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* Recursive function that figures out if 'target' is a decendant of 'element'.
*
* @param {Element} element
* @param {Element} target
*/
const isDecendantOf = (element, target) => {
if (target === element) {
return true; // Found
}
if (target.parentElement) {
// Check further up the tree
retu... | true |
479e0094a49fbbdcb595bddf92909fd6d71848e4 | JavaScript | acuasi/ground-control-station | /app/Views/Widgets/SignalStrength.js | UTF-8 | 1,288 | 2.515625 | 3 | [
"MIT"
] | permissive | // Widget to display the radio signal strength
define(['require', 'backbone', 'Templates'], function(require, Backbone, template) {
var SignalStrengthWidget = Backbone.View.extend({
el: '#signalStrengthWidget',
className: 'widget',
initialize: function() {
_.bindAll(this);
this.model.on(... | true |
f131196c9a9a964572ccf8cb456cd31dac2b4ce5 | JavaScript | juergenstodolka/code-snippets | /NodeJs/Streams/unicorn_server_streams.js | UTF-8 | 943 | 2.65625 | 3 | [] | no_license | 'use strict';
const https = require('https');
const http = require('http');
const server = http.createServer(requestHandler);
const source = 'https://libuv.org/images/libuv-bg.png';
function requestHandler (clientRequest, clientResponse) {
https.request(source, handleImgResponse).end();
function handleImgRes... | true |
57253f19b9461833c132728d6429e5745228e6d5 | JavaScript | learn-with-ridhomain/js-programming-ridtest | /jsfoundation/__tests__/9.js | UTF-8 | 837 | 2.953125 | 3 | [] | no_license | const expect = require('chai').expect;
let solution = require('../9').solution;
describe('are the type are correct', () => {
it('should return true if the first argument type is string and the 2nd is number', () => {
const result = solution('blabla', 2);
expect(result).to.equal(true);
});
it('should retu... | true |
c2e739dc332bf08db596b3a9b3f7d274f8043049 | JavaScript | AlpixTM/alpix.eu | /js/script.js | UTF-8 | 1,691 | 3.40625 | 3 | [] | no_license | $(document).ready(function () {
run();
});
function Sleep(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
async function run() {
let colId = 1;
const bar = $(".bar");
const resume = $("#resume");
let i = 1001;
while(true) {
while(resume.prop('ch... | true |
5a294821d7af80051bde0afcbecd43027aa2d254 | JavaScript | xxxlrlovegd/biao-class | /practive/other-EverydayStudy/Promise练习/仿源码/promise-test6.js | UTF-8 | 4,251 | 3.09375 | 3 | [] | no_license | class MyPromise6 {
constructor(executor) {
this.PromiseState = "pending";
this.PromsieResult = null;
this.callbacks = [];
let resolve = (data) => {
if (this.PromiseState !== "pending") return;
this.PromiseState = "fulfilled";
this.PromsieResult = d... | true |
29063a4b0555e97e33ec30c0c7a7ad2d1ad1708e | JavaScript | petershi0208/silver-computing-machine | /Yqwan/WebRoot/gameRegist/js/regist.js | UTF-8 | 4,403 | 2.671875 | 3 | [] | no_license | var apiUrl = window.location.href;//"http://www.199y.com";
var length = apiUrl.substring(0, apiUrl.indexOf('.', 1)).length;
apiUrl = "http://www"+apiUrl.substring(length,parseInt(length)+parseInt(10));
//获得ajax对象
function getXhr(){
var xhr = null;
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();
}else{
... | true |
5f14d35b899c014bf647983486eadbbe4c1757d2 | JavaScript | Hollyw00d/modularized-mongoose-dashboard | /server/controllers/showanimals.js | UTF-8 | 3,061 | 2.96875 | 3 | [] | no_license | // Require mongoose
var mongoose = require("mongoose");
// Load models by name
var Animal = mongoose.model("Animal");
var AddAnimal = mongoose.model("AddAnimal");
var UpdateAnimal = mongoose.model("UpdateAnimal");
// Create a controller object to use for export
var showanimalsController = {};
// Call the "show" meth... | true |
69dd504468db811d83bdcd9df15eeff259f32439 | JavaScript | LoganBarnett/blog | /software-engineering-starter-web-03-end.js | UTF-8 | 757 | 2.609375 | 3 | [] | no_license | const express = require('express')
const fs = require('fs')
const app = express()
app.get('/', (req, res) => {
if(req.accepts('text/html')) {
res.set('Content-Type', 'text/html')
res.send('\
<html>\
<body>\
Welcome to the official site for <em>justified</em>\
<strong>cat hatred<... | true |
c08a5c6b7e17c1decd67058a2247586e01ee245d | JavaScript | jpb-sf/construction | /FLASKApp/static/js/portfolio.js | UTF-8 | 5,583 | 3.359375 | 3 | [] | no_license |
let init = (function() {
// Directs scroll to 'projects' section
function goProjects()
{
if (window.location == "https://www.jasonbergland.com/projects")
{
let projectsY = document.getElementById('projects').offsetTop; // returns the distance of the outer border of the current element relative to the inne... | true |
1d0e9a570c43750e224dde69372a294435c55701 | JavaScript | Alley23/react_resources | /react-collection-list/src/reducers/todo.js | UTF-8 | 1,374 | 2.828125 | 3 | [] | no_license | import { GET_LIST_ITEM, ADD_ITEM, REMOVE_ITEM, CHANGE_DONE, EDIT_END} from '../actions/todo'
// 1---已做 2---未做
let initstate = [
{
"id": 1,
"done": true,
"text": "今天去吃什么?",
},
{
"id": 2,
"done": false,
"text": "今天去吃什么?",
},
{
"id": 3,
... | true |
52277f763142c03ee96201b431df3ddbcc18e39c | JavaScript | green-fox-academy/ykkupakkin | /oriW6-10/week-09/day-01/promise/program.js | UTF-8 | 1,120 | 3.921875 | 4 | [] | no_license | "use strict";
// -- Exercise 1
// setTimeout(
// function print() {
// console.log('TIMED OUT!')}
// ,300);
// -- Exercise 2
// let promise = new Promise(function(resolve, reject) {
// setTimeout(() => resolve("FULFILLED!"), 300);
// });
// promise.then((result) => console.log(result));
//promise.then(... | true |
1dcfa9f4cff87fb3d34a317b771aaf1fc56fc304 | JavaScript | breadface/assert.macro | /assert.macro.js | UTF-8 | 1,321 | 2.71875 | 3 | [] | no_license | const t = require("babel-types");
const { createMacro } = require("babel-plugin-macros");
function checkAssertArguments(file, node) {
let args = node.arguments;
if (args.length !== 2) {
throw file.buildCodeFrameError(
node,
"The `assert` function takes exactly two arguments!"
);
}
if (!t.i... | true |
b06f85693f8d1684a74e2d62d7d6391e64075d00 | JavaScript | 18Saubhagya/Online-Cricket-Council | /statsT2.js | UTF-8 | 3,355 | 2.5625 | 3 | [] | no_license | var publicSpreadsheetUrl2 = 'https://docs.google.com/spreadsheets/d/1buRjjt9BYfNx2-_X6cuu5DQQhOcFNzPk0I4r_Al1CCY/edit?usp=sharing';
function init() {
Tabletop.init( { key: publicSpreadsheetUrl2,
callback: showInfo2,
simpleSheet: false} )
}
var a1=[];
var b1=[];
... | true |
3bbe4a8e610e2a3c99a07b1d7e6fa8895644fcbf | JavaScript | Alex-parabol/BudgetManager | /src/App.js | UTF-8 | 2,193 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import Question from './components/question'
import Form from './components/Form'
import ExpensesList from './components/expensesList'
import BudgetControl from './components/BudgetControl'
function App() {
const [budget, setBudget ] = useState(0)
const [ remaining... | true |
6efcc07ee9bdde49ee4d63e9337b257dcc30cab9 | JavaScript | sullivane/CP4-notes | /Schedule.js | UTF-8 | 1,312 | 2.671875 | 3 | [] | no_license | /* JavaScript Schedule */
function searcher() {
var jamm = document.getElementById('schedulejam').value;
switch (jamm) {
case 'music':
var jams = document.getElementsByClassName("m");
break;
case 'math':
var jams = document.getElementsByClassName("ma");
break;
case 'sc... | true |
ac9cd0290bc838930cda648782b17a5160b6b4aa | JavaScript | Poojashiroya2199/Generate-JSX-from-JSON---Code-Generation-JSX | /src/index.js | UTF-8 | 1,336 | 2.625 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App";
function convertProp(prop) {
if (prop.indexOf("-") !== -1) {
let res = prop
.split("-")
.map((w) => w.charAt(0).toUpperCase() + w.substr(1))
.join("");
res = res.charAt(0).toLowerCase() + res.su... | true |
582246a8eacb96ff05c66d7aa01417c673d55d01 | JavaScript | henarivanaa/h8-p0-w4 | /week-4/exercise-3.js | UTF-8 | 634 | 3.640625 | 4 | [] | no_license | function cariMedian(arr) {
var hasil = 0
if (arr.length%2 === 0) {
for (let i = arr.length/2; i < (arr.length/2)+2; i++) {
hasil += arr[i-1]/2
}
} else if (arr.length%2 !== 0) {
hasil += arr[(arr.length-1)/2]
}
return hasil
}
// TEST CASES
console.log(car... | true |
d5c2cfc9e39eea8c2f77c80f537861a5d8bdd97f | JavaScript | Master-S2I-Corti/project-master | /public/js/reset-password-bar.js | UTF-8 | 5,504 | 3.015625 | 3 | [
"MIT"
] | permissive | var newpassword = document.getElementById('password');
var passwordmeter = document.getElementById('reset-password-strength-meter');
var newpasswordconfirm = document.getElementById('password_confirmation');
var passwordconfirmmeter = document.getElementById('reset-passwordconfirmation-strength-meter');
newpassword.... | true |
e3f776aff018a4aa9f1aba0be2ed92f9e5170614 | JavaScript | IonicaBizauKitchen/nodeconf2013 | /pkg/domains/pow-server/pow.js | UTF-8 | 2,542 | 2.8125 | 3 | [] | no_license | "use strict";
var domain = require("domain");
var createServer = require("http").createServer;
var cluster = require("cluster");
var cpus = require("os").cpus().length;
var Hash = require("crypto").Hash;
var catenator = require("concat-stream");
/*
* Sets the crashiness factor -- 2 out ... | true |
03896c1e34c15136e4fc5bffa541aaafb530a2a3 | JavaScript | fabienberdah/ExpenseTrackerReact | /src/context/GlobalState.js | UTF-8 | 1,569 | 2.96875 | 3 | [] | no_license | import React, { createContext, useReducer } from "react";
import AppReducer from "./AppReducer";
const initialState = {
transactions: [],
};
//Create context... This will hold our global State for our transactions. If we were dealing with a larger application that needs to keep track of various states for various co... | true |
e872ab6960377da15ea962543614916eea37b1da | JavaScript | ZhouSaisai/HostelWorld | /HostelWorld/src/main/webapp/js/hotelOrder.js | UTF-8 | 2,283 | 2.6875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
$('.reg-input:input').bind('input propertychange', function () {
getTime();
});
$('#plan-room-type').bind('change', function () {
getTime();
});
});
function order(){
var plan = $("#plan-room-type option:selected").val();
var num = $("#order-num"... | true |
68d63181046c94f04ace58653d4d789952467869 | JavaScript | bartwr/JSLite | /src/ClassFactory.js | UTF-8 | 3,342 | 2.96875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | ;(function(global){
"use strict";
/**
* Alias for Object.prototype.hasOwnProperty.
*/
var hasOwn = Object.prototype.hasOwnProperty;
/**
* Flat object extend.
*
* @param {object} target The object that will be extended.
* @param {object} object The first object that extends the target... | true |
bcf4b70665076a76e2e344c466d5330864258696 | JavaScript | noah-wisch/1-5-17-Callbacks | /Notes/app.js | UTF-8 | 806 | 3.296875 | 3 | [] | no_license |
function sayIt(thing) {
console.log('I say: ' + thing);
}
function beWise(phrase, say) {
say('A wise person once said ' + phrase);
//sayIt('a wise person once said A penny saved is a penny earned')
}
beWise('A penny saved is still a friggin penny.', sayIt);
/**
* Q1: What are the types of beWise param... | true |
8ffffdaf50e6e9b8f6fd5e1ad163ab61b24acf91 | JavaScript | neekyo/lab-mongoose-movies | /starter-code/routes/celebrities.js | UTF-8 | 1,823 | 2.703125 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const Celebrity = require("../models/Celebrity.js");
router.get("/", (req, res, next) => {
Celebrity.find()
.then(celebrities => {
console.log(celebrities);
res.render("celebrities/index.hbs", { celebrities });
})
.catch(err... | true |
4bbc03d23972faaed2d434f9468da977ecf056b1 | JavaScript | ztray1/expensify-app | /src/tests/reducers/filters.test.js | UTF-8 | 1,456 | 2.625 | 3 | [] | no_license | import filtersReducer from "../../reducers/filters";
import moment from "moment";
test("should setup default filter values",()=>{
const state=filtersReducer(undefined,{type:"@@INIT"})
expect(state).toEqual({
text:"",
sortBy:"date",
startDate:moment().startOf("month"),
endDate:mo... | true |
6e9d96615b5aee2ea88fb01222bf3b07496aa908 | JavaScript | SenpaiTV/Senpai_Framework | /js/time.js | UTF-8 | 691 | 3.21875 | 3 | [
"MIT"
] | permissive | /**
* Created by marcs on 14-1-2016.
*/
var x;
var y;
var css;
var counter;
var image;
function onAnimationTime(){
do{
x = Math.floor(Math.random() * POSITIONS.length);
}while(x == y);
y = x;
css = POSITIONS[x];
image.className = css.naam;
}
function onAnimationLoop(){
onAnimation... | true |
788a527d7669986ca81750736fcb4b398379dafe | JavaScript | pescamillam/reactnd-project-readable-starter | /frontend/src/components/Order.js | UTF-8 | 1,569 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { setSortTypeAction } from '../actions';
import { TITLE_AZ, TITLE_ZA, SCORE_0N, SCORE_N0} from "../utils/sortFunctions";
class Order extends Component {
sort = (sortType) => {
return this.props.sortAction(sortType);
};
... | true |