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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
765f48a2cad6f364c1e2a35ab6ae4b6d8fb6d880 | JavaScript | garyliggins/javascript-practice | /script.js | UTF-8 | 1,256 | 3.6875 | 4 | [] | no_license | //grabs the button from the dom, and puts in a reusable variable
// const button = document.querySelector('button');
// button.addEventListener('click', () => {
// console.log('clicked')
// })
// const items = document.querySelectorAll('li')
// title = document.querySelector('h1')
// console.log(title)
// items.f... | true |
c49aa173a42be6bed01bc1763e75e9ca64049ec6 | JavaScript | Diego00000/formulario | /js/formulario.js | UTF-8 | 1,800 | 3.28125 | 3 | [] | no_license | function validar() {
var nombre, clave,telefono,email, fechaNacimiento,expresionNombre, expresionCorreo, expresionPass, dia, mes, anio, opciones;
nombre = document.getElementById("Usuario").value;
clave = document.getElementById("pass").value;
telefono = document.getElementById("telefono").value;
f... | true |
7f9bb790c9a32776db7d033242e16610fa369a42 | JavaScript | vuejsprojects/good-bits | /ES6_export.js | UTF-8 | 448 | 2.578125 | 3 | [] | no_license | /*
For import export to work wee need:
- if running node version 10.18.x,
* use the experimaental flag --experimental-modules
* use the extension mjs instead of js
- if running node version 13.x.y
* either se the extension mjs instead of js
* or add "type": "module" to pack... | true |
0bb3f4452106bcaf79ac3cc96646ab5416b8cfaf | JavaScript | llamacoder/wd-ajax-hero | /js/app.js | UTF-8 | 4,730 | 2.703125 | 3 | [] | no_license | (function() {
'use strict';
var movies = [];
const renderMovies = function() {
$('#listings').empty();
for (const movie of movies) {
const $col = $('<div>').addClass('col s6');
const $card = $('<div>').addClass('card hoverable');
const $content = $('<div>').addClass('card-content cent... | true |
fadd7bf020f647cddfb0a5b2453d9c52ce01433a | JavaScript | WhetstoneAM/button-demo | /assets/javascript/script.js | UTF-8 | 722 | 3.140625 | 3 | [] | no_license | const firstDiv = document.getElementById('firstDiv');
const secondDiv = document.getElementById('secondDiv');
const firstBtn = document.getElementById('firstBtn');
const secondBtn = document.getElementById('secondBtn');
firstBtn.addEventListener('click', () => {
if ( firstDiv.classList.contains("square")){
... | true |
fc06bda2118ae2dd4ebd323ae9df9417f7d4e918 | JavaScript | moueza/ambiant-light-events-javascript | /js.js | UTF-8 | 2,020 | 2.71875 | 3 | [] | no_license |
var mySound2;
document.getElementById("toPrint").innerHTML = "toPrint";
document.getElementById("versionn").innerHTML = "version=14";
console.log('lbl12 AV');
if ('ondevicelight' in window) {
document.getElementById("statuss"
).innerHTML = "lightSensor OK";
var vall = DeviceLightEvent.valueOf();
... | true |
b8561b212baa9e3a277b4ff7b3faea2d201e5d30 | JavaScript | siragabari/Calculator | /script.js | UTF-8 | 2,528 | 3.59375 | 4 | [] | no_license | "use script";
window.addEventListener("DOMContentLoaded", calculate);
let results;
function calculate() {
console.log("calculate");
// Handle the click on Calculate button
const calculate = document.getElementById("calculate");
calculate.addEventListener("click", function() {
// Read the num... | true |
106c90e8cb8d9921b237c26df8598d29947439e9 | JavaScript | davidcurras/domotic-app | /server/reducers/process.js | UTF-8 | 642 | 2.609375 | 3 | [
"MIT"
] | permissive | var state = require('../state')();
module.exports = function(action) {
var defaultState = {
busy: false,
error: null
};
var processState = Object.assign(defaultState, state.process);
switch(action.type) {
case 'SETTING_STATE':
case 'GETTING_STATE':
processState.busy = true;
break;
... | true |
e1ed6021fd5312b15612a2c4345108ea62524d6c | JavaScript | shrey-chaudhary/byju-challenge-reactjs | /src/components/SearchForm.jsx | UTF-8 | 1,871 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import './SearchForm.css';
import { FaSearch } from 'react-icons/fa';
import PropTypes from "prop-types";
class SearchForm extends Component {
constructor(props) {
super(props);
this.state = {
skill: '',
location: '',
ex... | true |
35093944354514d456ffe8f2c2149f3039cb0631 | JavaScript | karthikmekala/febby | /lib/core/helpers.js | UTF-8 | 3,647 | 2.84375 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const path = require('path');
/**
* @ignore
* Get summery of http method
* @param { string } method - http method.
* @param { string } model -model name.
* @return { string } - method summery of an http method
*/
module.exports.getSummery = (method, model) => {
let summery;
swi... | true |
45e43a450954d538ea84dd3ec931c35a6a097e04 | JavaScript | womcauliff/Friend-Finder | /app/public/assets/js/main.js | UTF-8 | 1,315 | 2.9375 | 3 | [] | no_license | $("#submit").on('click', function () {
var formData = {
name: $("#name").val(),
image: $("#image").val(),
scores: [
$('input[name=q1]:checked').val(),
$('input[name=q2]:checked').val(),
$('input[name=q3]:checked').val(),
$('input[name=q4]:checked').val(),
$('input[name=q5]:checked').val(),
$('... | true |
4b521c727c2967218e5f5d2ac50067583dea5f7b | JavaScript | jannakha/fez-frontend | /src/modules/ViewRecord/components/partials/Thumbnail.test.js | UTF-8 | 2,617 | 2.53125 | 3 | [] | no_license | import {Thumbnail} from "./Thumbnail";
function setup(testProps, isShallow = true){
const props = {
mediaUrl: '/test/mediaUrl',
previewMediaUrl: '/test/preview/mediaUrl',
thumbnailMediaUrl: '/test/thumbnail/mediaUrl',
thumbnailFileName: 'thumbnail.jpg',
mimeType: 'image/jpeg... | true |
152b131a23b84e51cd0358da793184da26dc3ca1 | JavaScript | Kakusan/2017Apps | /18_hw2/job27.js | UTF-8 | 703 | 3.296875 | 3 | [] | no_license | var operation = require('./operation27');
var jobArray = [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}, {x: 0, y: 0}];
for(var i = 0; i < jobArray.length; i++) {
(function(x, y) {
var job = 'job' + '(' + x + ', ' + y + ')';
console.log(job);
var result = "";
Promise.all([
operation.add(x, y),
operation.s... | true |
4a6fa0c3d4ae36bd1410bd090938192c5b273077 | JavaScript | kiranbandi/synvisio | /src/utils/getPlotDimensions.js | UTF-8 | 3,133 | 2.703125 | 3 | [
"MIT"
] | permissive | export default (plotType = 'dashboard') => {
const width = 0.975 * window.innerWidth,
height = 0.90 * window.innerHeight;
let configuration;
// If the width is less than 95% of 540 pixels = 513 pixels , bootstrap gird small screen is 540
// Then each plot takes the maximum available width and... | true |
af368b864b98e1d6243938d18bf098630dcb99a3 | JavaScript | kokoye2007/Tipitaka-Pali-Projector | /tipitaka_projector_data/pali/8227a.js | UTF-8 | 737,532 | 2.53125 | 3 | [] | no_license | var P_HTM = [];
P_HTM[1]='*Namo tassa bhagavato arahato sammāsambuddhassa*';
P_HTM[2]='*Mahāvaṃsapāḷi*';
P_HTM[3]='*Pathamapariccheda*';
P_HTM[4]='*Mahiyaṅgaṇāgamanaṃ*';
P_HTM[6]='*Namassitvāna ** sambuddhaṃ, susuddhaṃ suddhavaṃsajaṃ;*';
P_HTM[7]='*Mahāvaṃsaṃ pavakkhāmi, nānānūnādhikārikaṃ.*';
P_HTM[9]='*Porāṇehi kat... | true |
c702ac9ccf7f17925bd3a4d9a9d5b9af5c72c085 | JavaScript | zongronghuang/cookie_login_page | /app.js | UTF-8 | 1,439 | 2.8125 | 3 | [] | no_license | // 導入套件、外部 JS 及基本設定
const express = require('express')
const exphbs = require('express-handlebars')
const app = express()
const bodyParser = require('body-parser')
const cookieParser = require('cookie-parser')
const checkLogin = require('./check_login')
const port = 3000
app.engine('handlebars', exphbs({ defaultLayout... | true |
5dd575ce0d3c6711545aa572f183098cbaefe525 | JavaScript | portermichael/ztest | /treemod.js | UTF-8 | 489 | 3.375 | 3 | [] | no_license | Modified binary search tree of ins. Three nodes, left less than parent, middle equal to parent, right greater than parent.
Delete one node per delete method call.
deleting last value sets root to null.
deleting value not in tree does nothing. not even throw an exception.
class TreeMod {
constructor (value) {
t... | true |
74adeb28572d0a15093972eb216922416aaf4167 | JavaScript | stevengreens10/NodeJS-Simple-WebServer | /public/js/users.js | UTF-8 | 988 | 2.578125 | 3 | [] | no_license | $(document).ready(function(){
$('form').on('submit', function(){
var username = $('#username').val()
var password = $('#password').val()
$.ajax({
type: 'POST',
url: '/users',
data: {
username: username,
password: password
... | true |
f093e71b00f9aa5b6da808b9376bb2a08e2e0966 | JavaScript | evb-gh/cat-clicker | /js/app.js | UTF-8 | 3,163 | 3.078125 | 3 | [] | no_license | 'use strict';
/* ======= Model ======= */
let model = {
currentCat: null,
cats: [
{
clickCount: 0,
name: "Smoky",
imgSrc: "img/alexander-possingham-209285-unsplash.jpg",
imgAlt: "Photo by Alexander Possingham on Unsplash"
},
{
clickCount: 0,
name: "Mumo",
imgSrc... | true |
f19f46817934f6ceef75747074ecd33314a25110 | JavaScript | Diogo-Queiroz/bsb-kart | /src/component/password-methods/pass-change.js | UTF-8 | 1,989 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
import { auth } from '../../firebase'
const byProperKey = (propertyName, value) => () => ({
[propertyName]: value
})
const INITIAL_STATE = {
passOne: '', passTwo: '', error: null
}
class PasswordChangeForm extends Component {
constructor (props) {
super (props)
... | true |
e450b3baffdcb71e8119a26211c9c8344f94e2cb | JavaScript | nss-day-cohort-24/group-project-uix-cock-a-doodle-doo-the-paint-bandits | /js/savemeetup.js | UTF-8 | 287 | 2.65625 | 3 | [] | no_license | "use strict";
var $ = require('jquery');
function makeMeetupList(meetupList){
let $meetupDisplay =
$(`<div class="savedMeetupDiv">
<ul class ="meetupList"></ul>
</div>`);
$(".savedMeetupDiv").html($meetupDisplay);
for (let meetup in meetupList) {
}
}
| true |
9b0ccb929b510419807823dc0ba240fb7574dbf5 | JavaScript | kod2nd/cookbook | /src/utils/percentToRating.js | UTF-8 | 200 | 2.734375 | 3 | [] | no_license | const percentToRating = (percentage, ratingSteps) => {
const divisor = 100 / ratingSteps
const rating = percentage / divisor;
return rating.toFixed(1);
};
export default percentToRating | true |
fbaba4d72682bee829fe8d84be62e02cb80a9e9b | JavaScript | rodrijuarez/mostly-adequate-guide-to-fp-snippets | /flocks.js | UTF-8 | 1,075 | 4.15625 | 4 | [] | no_license | const add = (x, y) => x + y;
const multiply = (x, y) => x * y;
const flockA = 4,
flockB = 2,
flockC = 0;
const result = multiply(flockB, add(flockA, flockA));
console.log(result);
/* Example of Object Oriented
var conjoin = function(flock_x, flock_y) { return flock_x + flock_y; };
var breed = function... | true |
17cc09a9827e5b2ec8b714aec3465dfef8b4ac82 | JavaScript | kgryte/create-a-server | /examples/next.js | UTF-8 | 961 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
// MODULES //
var cluster = require( 'cluster' );
// NEXT //
/**
* FUNCTION: next( error, server )
* Callback invoked once a server is ready to receive HTTP requests.
*
* @param {Error|Null} error - error object
* @param {Server} server - server instance
* @returns {Void}
*/
function next( error, ser... | true |
29bd274f2f1e86ee255d3d4148bfbf99aaa026ee | JavaScript | sohaibfurqan92/js-miniprojects | /js/es6-sets/app.js | UTF-8 | 1,263 | 4.53125 | 5 | [] | no_license | //Sets - unique values of any type/primitive or reference
//create set
const set1 = new Set();
//add val - num,str,obj,bool
set1.add(100);
set1.add('A string');
set1.add({a:1,b:2});
set1.add(true);
console.log(set1);
const value1 =set1.values().next().value;
console.log(value1);
const values =set1.values();
console.... | true |
41ef4f91ad8dc0b6e53976034425502a21e0ff32 | JavaScript | alilefta/travel-planner-app | /src/client/js/__tests__/tripsDataHandle.test.js | UTF-8 | 2,243 | 3.078125 | 3 | [] | no_license | import {updateUI, modal, getTripsList, checkweather, checkNotes, modalForNotes, checkDates, lengthOfTrip} from './../dataHandle';
describe("DOM modal notifications", () => {
it("Check if modal is running", () => {
expect(modal("Hello World")).toBe("Hello World");
})
})
describe("Get trips list from L... | true |
f38b79587777439c039d940da5a12aa1e482154a | JavaScript | bobolee1239/PaintingApp | /src/main.js | UTF-8 | 652 | 2.625 | 3 | [] | no_license | import Component from './component';
import Canvas from './canvas.js';
import ResetButton from './resetButton.js';
import './main.css';
export default class Main extends Component {
constructor(root) {
super(root);
this.canvas = new Canvas(document.querySelector('#myCanvas'));
this.resetB... | true |
343345c3bd177a92ffeb6dd6ed4616457e020a37 | JavaScript | irenapopova/code_challenges | /exercism-javascript/rna-transcription/rna-transcription.js | UTF-8 | 471 | 3.015625 | 3 | [] | no_license | var DnaTranscriber = function() {};
DnaTranscriber.prototype.toRna = function(dna) {
/* Tranlates dna to RNA */
var dnaToRna = makeHash("GCTA".split(''), "CGAU".split(''));
return dna.split('').map(function(e) { return dnaToRna[e] } ).join('');
}
function makeHash(keys, values) {
/* Makes a hash table from key an... | true |
420fd60e8b943fd00f4385e8194ff14544703b62 | JavaScript | SiyiWangCoco/wooduanUserCenter | /components/js/userData.js | UTF-8 | 2,790 | 2.6875 | 3 | [] | no_license | let token = window.localStorage.token;
//接口用户信息
function getInfo(info){
$.ajax({
type:'GET',
url:' http://192.168.0.18:8015/web/index/getUserBasicInfo',
dataType:"json",
headers:{
'Content-Type':'application/x-www-form-urlencoded',
'token' : token
},
success:function(res) {
... | true |
1fb52910ac57af394c5c3d25655611a7790eac64 | JavaScript | livelikeabel/inventory-stock-page2 | /src/App.js | UTF-8 | 1,767 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Menu from './components/Menu';
class App extends Component {
// Render: componentWillMount() -> render() -> componentDidMount()
// Update componentWillReceiveProps() -> shouldComponentUpdate() -> componentWillUpdate() -> render() -> componentDidU... | true |
36f957f06100346102659a93cde6ac1adb617d54 | JavaScript | Durga944/array_logical_question | /occr.js | UTF-8 | 588 | 3.21875 | 3 | [] | no_license | var array = ["a", "n", "t", "a", "a", "t", "n", "n", "a", "x", "u", "g", "a", "x", "a"];
var i = 0;
var b = []
while(i<array.length) {
var j = 0;
var a = []
var c = 0;
while(j<array.length) {
if(array[i] == array[j]) {
c = c + 1
}
j++
}
a.push(array[i])
a... | true |
3d90c9b44abc7f36dce134799ef9535dcfd0448a | JavaScript | maximzmei/basic-js | /src/recursive-depth.js | UTF-8 | 305 | 2.8125 | 3 | [
"MIT"
] | permissive | const CustomError = require("../extensions/custom-error");
module.exports = class DepthCalculator {
calculateDepth(arr) {
let depth = 0;
arr.forEach(el => {
if (Array.isArray(el)) {
depth = Math.max(this.calculateDepth(el), depth);
}
});
return 1 + depth;
}
}; | true |
4c0663b9d43e3723c5dab63aca5b352e145ab4ac | JavaScript | salupsjr/CursoJS032021 | /ExemplosJS/orientacao_a_objeto.js | UTF-8 | 734 | 4.15625 | 4 | [] | no_license | /*function Pessoa(nome) {
this.nome = nome
}
const p = new Pessoa('Junior')
console.log(p);
function Animal(qtdPatas) {
this.qtdPatas = qtdPatas
}
function Cachorro(morde) {
Animal.call(this, 4)
this.morde = morde
}
const pug = new Cachorro(false);
console.log(pug);*/
/*CLASSES*/
class Animal... | true |
f65945d2ba7631aae6a86aabdbc655c5e6c009ef | JavaScript | talisonfc/tecnologias | /NodeJS/app.js | UTF-8 | 747 | 3.3125 | 3 | [] | no_license | // Criando um WebServer
// Importando o package HTTP
const http = require('http');
// Definido as configurações do servidor
const hostname = '127.0.0.1';
const port = 3000;
// Função de entrada e saída do servidor
function io(req,res){
console.log(req)
res.statusCode = 200;
res.setHeader('Content-Type', 'text/pla... | true |
9f5739f315ad28b6354b5d9e6d8e7f8a18933553 | JavaScript | SIMITClub/js2018 | /SimpleArray.js | UTF-8 | 721 | 4.125 | 4 | [] | no_license | // SIMPLE ARRAY
var students = ["thoman ", "roger" , "amber" ]; // this here is an ARRAY
document.write ( students.length); // this prints out the the total number of arrays
var students = ["thoman ", "roger" , "amber" ];
document.write ( students[0] + "<br>");
document.write ( students [1] + " <br>");
d... | true |
99c6390723b3aedb54c3a156c4968076fa143eb0 | JavaScript | anshul456ch/jQuery-learning | /eg1.js | UTF-8 | 886 | 2.96875 | 3 | [] | no_license | const express=require('express'); //object ka reference express mai aa gya
const app=express();//object bnaya
const port=3000;//bind at port to 3000
app.use(express.static("learn")); //isse hamne configure kra ki jb bhi static request aaye toh contents learn folder mai se server krre
//server ko ye configure kra ... | true |
2439dd8bcc56eba331de509127ba3a012d5ae713 | JavaScript | lys8325/Sanpomichi | /sanpomichi/src/main/resources/templates/js/index.js | UTF-8 | 1,407 | 2.578125 | 3 | [] | no_license | $(document).ready(function(){
$('#showTable').dataTable( { "autoWidth": false ,
searching: false,
lengthChange: false,
ordering : false,
info:false
} );
});
$('#plus_login').on('click',function(){
getView('map')
})
function toLogin(){
getView('login');
}
function toLoad_map(route_id){
getView('load_map... | true |
ccba8ba8658cbe5818058a5d787baac432e09297 | JavaScript | Mongit/MasteringJSDesignPatters | /bridge/whatsAdapter.js | UTF-8 | 312 | 2.71875 | 3 | [] | no_license | var WhatsAdapter = (function () {
function WhatsAdapter (whats) {
this.whats = whats;
}
WhatsAdapter.prototype.enviar = function (txt) {
this.whats.enviarTexto(txt);
};
return WhatsAdapter;
})();
module.exports = function (whats) {
return new WhatsAdapter(whats);
}; | true |
35a5ad027113f9fbe046af1e7a39ada8f6612e01 | JavaScript | mindball/ExpressJS | /MongoDb/Mongoose/modules/models/Cat.js | UTF-8 | 577 | 2.765625 | 3 | [
"MIT"
] | permissive | const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
const ObjectId = mongoose.ObjectId;
let catSchema = new mongoose.Schema({
name: { type: String, required: true },
age: { type: Number, default: 0},
owner: {type: ObjectId}
});
catSchema.path('age').validate(value => {
return val... | true |
bba32e4cff276e74bed66f3404ea13dc003fffcc | JavaScript | juanfe190/ChatReactJS | /stores/_MainStoreUtils.js | UTF-8 | 990 | 2.75 | 3 | [] | no_license | export default class MainStoreUtils {
/**
* Devuelve el usuario que cumpla el criterio
*
* @param String username
* @param array de usuarios({username: name, newMessages: 0, active: true})
*/
static findUser(username, arrayUsers){
return arrayUsers.find(function(objUser){
return objUser.username === usernam... | true |
de0c511a47aa644cfde7cae5e4194f23f39656a2 | JavaScript | Sayan-Roy-729/ecommerce-flipkart-clone | /backend/middlewares/isAuth.js | UTF-8 | 1,331 | 2.640625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
// ! Check authorization token has or not
exports.requireSignin = (req, res, next) => {
// Extract Authorization Header
const authHeader = req.headers.authorization;
// If not set Authorization header, throw error
if (!authHeader) {
const error = new Error('Not authenti... | true |
12312e658cfd7f8d85257f9fa0270ce3542070a0 | JavaScript | renanmiler/SnakeGame | /js/snake.js | UTF-8 | 1,692 | 3.296875 | 3 | [] | no_license | import { getDirecaoTeclado } from './input.js';
//variáveis
export const SNAKE_SPEED = 15;
const snake = [ {x: 16, y: 16},
{x: 17, y: 16}];
let novoSegmento = 0;
let direcao;
export function atualizar (){
direcao = getDirecaoTeclado();
for (let i = snake.length - 2; i >= 0; i--){
... | true |
eaae5c40e0c6f89414b638bcce873633e6f2c7d9 | JavaScript | orzMaster/bjpxjkqc | /config/index.js | UTF-8 | 506 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
var nodeEnv = (function() {
var env = process.env.NODE_ENV;
if (!env) {
env = process.env.NODE_ENV = 'development';
} else if (!(env === 'development' || env === 'production')) {
console.log('Error: NODE_ENV must be "development" or "production"');
process.exit(1);
... | true |
6afc3bbb5a923afb0aef8c78fc9db4fbe0958439 | JavaScript | BaoTran91/nodejs | /hello.js | UTF-8 | 7,169 | 3.0625 | 3 | [] | no_license | /*
var fs = require("fs");
//var data = fs.readFileSync('nodejs_note.txt');
//console.log(data.toString());
fs.readFile('nodejs_note.txt', function (err, data) {
if (err) return console.error(err);
console.log(data.toString());
});
console.log("Program Ended");
*/
//------------------------------------------... | true |
639ddc0f3bdcf55ec08b62cbd72b0e82931a29b8 | JavaScript | pravash27/Microservices | /blog/client/src/CommentCreate.js | UTF-8 | 879 | 2.671875 | 3 | [] | no_license | import axios from 'axios';
import React, { useState } from 'react';
const CommentCreate = ({postId}) => {
const [comment,setComment] = useState('');
const submitHandler = (e) => {
e.preventDefault();
axios.post(`http://posts.com/posts/${postId}/comments`,{
comment
})
... | true |
3e7267bdb9de08d8c08494efc25f8a0975f0baa8 | JavaScript | newprogrammer1991/Sharp | /src/reducers/recipient.js | UTF-8 | 558 | 2.5625 | 3 | [] | no_license | import {SEARCH, SUCCESS, FAIL} from '.././constants'
const defaultState = {
searchedUsers: [],
isLoading: false,
error: '',
}
export default (state = defaultState, action) => {
const {payload, type, error} = action;
switch (type) {
case SEARCH:
return {...state, isLoading: true}... | true |
4edcd410ccd32b0386b54c2f5554c3ad8e2064fc | JavaScript | yojio/backbone | /client/js/app1.js | UTF-8 | 8,226 | 2.71875 | 3 | [] | no_license | define(
[ 'backbone'],
function(Backbone) {
return
console.log(Backbone === window.Backbone);
(function() {
console.log("Hello Backbone!");
}());
var obj = new Backbone.Model();
obj.set({
name : "Murata"
});
obj.set({
age : 20
});
console.log("obj:" + JSON.stringify... | true |
138f816ec9006618ffd31ba77e50c0b2b977a6ad | JavaScript | 13oamador/hola-mundo | /js/17-ejercicio6.js | UTF-8 | 380 | 4.03125 | 4 | [] | no_license | 'use strict'
/*
Indicar si un numero es par o impar
1. Ventana prompt
2. Si no es valido que vuelva a pedir el numero
*/
var numero = parseInt(prompt('Introduzca un numero', 0));
while(isNaN(numero)){
numero = parseInt(prompt('Introduzca un numero', 0));
}
if(numero%2 == 0){
alert("El numero " + numero + " es pa... | true |
53a64335545518e70d7d1bebe9e77ca25f2d91f6 | JavaScript | LinuXperia/RedditClone-New | /assets/scripts/voting.js | UTF-8 | 1,074 | 3.125 | 3 | [
"MIT"
] | permissive | 'use strict';
const voteButton = document.querySelectorAll('.upVote, .downVote');
voteButton.forEach((button) => {
button.addEventListener('click', vote);
});
function vote(event) {
const postId = event.target.dataset.post_id;
const voteDir = event.target.dataset.vote_dir;
const votes = event.target.paren... | true |
98312c524da2520e41609b6356659d5e92e910dc | JavaScript | Cristian-BFMV/LearningJavaScript | /AsynchronusJS/Fetch/app.js | UTF-8 | 2,256 | 3.453125 | 3 | [] | no_license | document.getElementById("button1").addEventListener("click", () => {
/**Para crear una petición GET mediante el Feth API, se hace a través del método fetch, el cual recibe
* como parametro la dirección a la cual hacer la petición. Este métdo devuelve una promesa la cual es manejada
* por el métdo .then(), dentr... | true |
baa7a0505719978ac5e3bca8a5762245b5b14549 | JavaScript | natanaelagb/perguntaRespostaNodejs | /index.js | UTF-8 | 2,704 | 2.59375 | 3 | [] | no_license | const express = require("express");
const app = express();
const bodyParser = require("body-parser");
const connection = require("./models/database");
const Pergunta = require("./models/Pergunta");
const Resposta = require("./models/Resposta");
// Minhas Variáveis
var data = new Date();
var horario = ... | true |
5d4abf4981b189bc4e4f8c4a5f1100455091cac5 | JavaScript | TheGiftsProject/TGPFramework | /utils/observer.js | UTF-8 | 2,507 | 2.625 | 3 | [] | no_license | ObjectRepository.Require('TGP.Utils.Observer', function() {
TGP.Namespace('Utils');
TGP.Utils.Observer = function(delayed) {
this.delayed = delayed;
this.handlers = [];
};
TGP.Utils.Observer.prototype.AddListener = function(listener, caller) {
for (var i = 0; i < this.handlers... | true |
07800554ea3636dd67a0a025aee81af2941e425e | JavaScript | vuquangthinh/nest-web | /src/components/TagSelection/index.js | UTF-8 | 750 | 2.53125 | 3 | [
"MIT"
] | permissive |
import React from 'react';
import { Select } from 'antd';
import toString from 'lodash/toString';
// eslint-disable-next-line react/prefer-stateless-function
export default class TagSelection extends React.Component {
static defaultProps = {
allowItem: () => true
};
render() {
const { value, onChange, ... | true |
5339a68dcf441d6280904a5d0feb4922507fd2cb | JavaScript | DanCouper/fcc-reason | /lib/es6/src/react/calculator.js | UTF-8 | 4,911 | 2.546875 | 3 | [] | no_license | // Generated by BUCKLESCRIPT VERSION 1.7.1, PLEASE EDIT WITH CARE
'use strict';
import * as Block from "bs-platform/lib/es6/block.js";
import * as Caml_builtin_exceptions from "bs-platform/lib/es6/caml_builtin_exceptions.js";
function mapDigitToString(param) {
switch (param) {
case 0 :
... | true |
80653b9c7b6529f47ba1f394ca3685d0afa7fe4d | JavaScript | crascot/expoforum | /js/script.js | UTF-8 | 788 | 2.53125 | 3 | [] | no_license | let search = document.querySelector('.search');
let language = document.querySelector('.language');
let pop = document.querySelector('.pop__up');
let email = document.querySelector('.email__button');
document.querySelector('.iconSearch').onclick = function () {
search.classList.add('onclick');
lang... | true |
72bb30ebdd702cb0895e3e9e572c19ba5c3c72d7 | JavaScript | CLowbrow/sea-legs | /tokens.js | UTF-8 | 1,295 | 3.09375 | 3 | [
"MIT"
] | permissive | //these are special tokens that are also null-tokens
var nullTokens = {
openBrace: '{',
closeBrace: '}',
atStart: '@',
semicolon: ';',
idPrefix: '#',
classPrefix: '.',
pseudoclassPrefix: ':',
comma: ',',
child: '>',
openBracket: '[',
closeBracket: ']',
descendant: ' ',
sibling: '+',
quote: '... | true |
7cfb6b830d05422a56cd657678b805c4152e0d66 | JavaScript | sunrise8vn/GitProject | /2684-convert-between-feet-and-meter/script.js | UTF-8 | 242 | 3.59375 | 4 | [] | no_license |
document.write(footToMeter(2));
document.write("<br/>");
document.write(meterToFoot(25));
function footToMeter(foot) {
var meter = 0.305 * foot;
return meter;
}
function meterToFoot(meter) {
var foot = 3.279 * meter;
return foot;
}
| true |
e11362151aafe0c1f187ae6dab52c80ea4414c6f | JavaScript | VsairamEmani/prostack | /javascript/pattern.js | UTF-8 | 128 | 2.703125 | 3 | [] | no_license |
var no=10;
for(var m=0;m<=no;m++)
{
for(var n=0;n<=m;n++)
{
console.log(n);
}
console.log(" "class);
}
| true |
7fb7b5f5b57bb12affcb5b6e0630873015a54159 | JavaScript | mkulinski/overnight_public | /client/components/hello.js | UTF-8 | 1,777 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import { browserHistory } from 'react-router';
import style from '../styles/helloStyles';
import { initSocket } from '../socket';
let socket;
export default class Login extends Component {
constructor() {
super();
const geocoder = new google.maps.Geocoder();
thi... | true |
5840234807880f1aee5fbf25dfe8aa89bab5e3f8 | JavaScript | DokyTeam/Doky | /src/layout/landing_page/register_page/components/menu4.js | UTF-8 | 6,100 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import { LoginController } from '../../../../controllers/login_controller';
import { UserController } from '../../../../controllers/user_controller'
class Menu4 extends Component {
constructor(props) {
super(props);
// We will use the LoginController for re... | true |
b23962ee44344033489fa8f90ba1e4dea891ca2a | JavaScript | diegoareval/express-file-upload | /src/controller/file.controller.js | UTF-8 | 1,393 | 2.671875 | 3 | [] | no_license | const uploadFile = require("../middleware/upload");
const fs = require("fs");
const parse = require("csv-parser");
const { removeEmpty, validateAll } = require("../../helpers");
const upload = async (req, res) => {
try {
await uploadFile(req, res);
if (req.file == undefined) {
return res.status(400).s... | true |
df9c7336d4b988c4c1e9b461a5c41cdf840eb7d1 | JavaScript | lacker/ollie | /workshop/03-spin-motor-spin.js | UTF-8 | 291 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
let five = require('johnny-five');
let board = new five.Board();
board.on('ready', () => {
let motor = new five.Motor(9);
function loop() {
motor.start(200);
board.wait(2000, () => {
motor.stop();
board.wait(1000, loop);
});
}
loop();
});
| true |
129a910297eca8a6ff1c2b1ee0751ba8cd9865f6 | JavaScript | asnelzin/gist | /index.js | UTF-8 | 920 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const got = require('got');
module.exports = function (str, opts) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
opts = opts || {};
return str + ' & ' + (opts.postfix || 'rainbows');
};
function postGist(username, password, file) {
got.post('https://api.github.com... | true |
84357870d2b1f6c7684cdddbe65ea9716e30ecb1 | JavaScript | Ge-lx/bunch | /bunch_dev/tt.js | UTF-8 | 12,465 | 2.578125 | 3 | [] | no_license | const { define, resolve, Observable, ComputedObservable, debug } = bunch({ debug: true});
define('documentReady', function () {
return new Promise((pResolve, pReject) => {
document.addEventListener("DOMContentLoaded", pResolve);
});
});
define('debounce', function () {
return (delay, callee) => {
... | true |
23f411cb416383c8928569f876935be1fa583cfa | JavaScript | Gilinho05/javascript | /challenges/js/yourAgeInDays.js | UTF-8 | 872 | 3.953125 | 4 | [] | no_license |
var myBirthYear = 1989;
var atualYear = new Date().getFullYear();
console.log(atualYear);
var age = atualYear-myBirthYear;
console.log(age);
var myAge = 365*age;
console.log('my age in days: ', myAge);
function fAgeInDays() {
var ageInDays = prompt('how old are you?');
console.log('age in days function re... | true |
5e032196f17542643a84e0e5df1493bd1c0ee137 | JavaScript | aantivero/learningJavascript | /chap01/main.js | UTF-8 | 768 | 2.875 | 3 | [] | no_license |
/**
* Created by alex on 19/03/2016.
*/
$(document).ready(function(){
'use strict';
console.log('main.js loaded');
paper.install(window);//instala la libreria a nivel global
paper.setup(document.getElementById('mainCanvas'));//atacha paper al canvas
//manipulando ingreso de usuario
var tool ... | true |
4cee3118b6004a0b1f9b69659c3e133a30a3a039 | JavaScript | joestrong/music-maker | /js/Messager.js | UTF-8 | 444 | 2.875 | 3 | [] | no_license | export default class Messager
{
constructor()
{
this.messageEl = document.getElementById('message-area');
this.messageHead = this.messageEl.querySelector('h1');
this.messageSub = this.messageEl.querySelector('h2');
}
showMessage(message, submessage)
{
this.messageHe... | true |
6a840e25e437e767d787245d8d9f7aa3a6109f51 | JavaScript | gitkatsi/3do | /scripts/translation.js | UTF-8 | 1,014 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | // Description:
// Translates every message that is not in English language to English
//
// Dependencies:
// none
//
// Configuration:
// LIST_OF_ENV_VARS_TO_SET
//
// Commands:
// No command needed. I will translate for you all the non english sentences.
//
// Notes:
//
//
// Author:
// Katsikiotis Georgio... | true |
9ddd5c4155c7ae0f183a45312b291b94a23138cb | JavaScript | StoneT2000/Polytomizator | /src/scripts/imagefilter.js | UTF-8 | 8,823 | 2.609375 | 3 | [
"MIT"
] | permissive | var edgePoints = [];
var colorThreshold = 40;
//Hash table storing detected edge points
var edgePointsHashTable;
//3x3 and 5x5 Operators used in filtering
var operator3={
smooth:{arr:[1,1,1,
1,1,1,
1,1,1],type:"blur"},
edge:{arr:[0,1,0,
1,-4,1,
0,1,0],type:'filter'},
edgeLR:{arr... | true |
66c33f9fb3d09aa42f2441ee4bc2c53a5654c863 | JavaScript | Aadichohan/Sunday-Class | /20-6-2021/app.js | UTF-8 | 584 | 4.15625 | 4 | [
"MIT"
] | permissive | // function myFunc(x, y) {
// // x, y are parameters
// return x * y;
// }
// myFunc(5, 8); // 5, 8 are arguments
// var myName = "Ishaq"; // Global Variable
// function anotherFunc() {
// var myName = "Mohammad Ishaq"; // Local Variable
// myName = "Mohammad Ishaq Bhojani";
// console.log("Local Var", myNa... | true |
ced0f2c4ce83a7c92ebbce3b91d9b5261f2da152 | JavaScript | BilyanaBorislavova/JS-Core | /JS Advanced/Unit Testing with Mocha - Lab/02. Playing Cards.js | UTF-8 | 583 | 3.6875 | 4 | [] | no_license | function makeCard(face, suit) {
const validFaces = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'];
const validSuits = ['S', 'H', 'D', 'C'];
if(!validFaces.includes(face) || !validSuits.includes(suit)){
throw new Error("Error")
} else {
if(suit === 'S'){
return face + '\u2... | true |
38d75e779b9203e05fa8eed68744682be1050ac8 | JavaScript | mowencong/article | /artical/utils/util.js | UTF-8 | 2,869 | 3.015625 | 3 | [] | no_license | // const formatTime = date => {
// const year = date.getFullYear()
// const month = date.getMonth() + 1
// const day = date.getDate()
// const hour = date.getHours()
// const minute = date.getMinutes()
// const second = date.getSeconds()
// return [year, month, day].map(formatNumber).join('/') + ' ' + [h... | true |
6f50f67ec69094bc21d6e1a59ca76fdacb5b8361 | JavaScript | keithallan01/js-group-project-beer | /client/src/views/beer_view.js | UTF-8 | 3,096 | 3.078125 | 3 | [] | no_license | const PubSub = require('../helpers/pub_sub.js');
const BeerView = function(container, beer) {
this.container = container;
this.beer = beer;
};
BeerView.prototype.render = function() {
const drankBeerContainer = document.createElement('section');
drankBeerContainer.className = 'beer';
const beerName = thi... | true |
c902eece1d63529cd74e0ac75a1592636a730f78 | JavaScript | tvolkirch/object-value-extractor | /object-extractor.js | UTF-8 | 6,080 | 3.609375 | 4 | [] | no_license | /*
* Object Values Extractor
*
* This module is meant to convert any JavaScript object to a single string.
* The string can be copied and pasted to a text editor to make it easy to
* search the JavaScript object. The text editor search functionality can be
* used.
*
* Even objects with a circular structure can... | true |
96997f0095e251e6c64358c2fbed48b34792fa14 | JavaScript | tropys/js-warrior-run | /Player.js | UTF-8 | 3,189 | 3.515625 | 4 | [] | no_license |
// run all Senses each turn
// remember all turns
// scoring heuristic?
const BACKWARD = 'backward';
const FORWARD = 'forward';
const LEFT = 'left';
const RIGHT = 'right'
const directions = [FORWARD, BACKWARD, LEFT, RIGHT];
const initialHealth = 20;
const wallInDirection = (walls, dirToCheck) => walls.some(([dir, s... | true |
c3d622d94eb906e152e9381e617c9071666f852c | JavaScript | Punyugi2012/Contact-List | /back/routes/person.js | UTF-8 | 2,536 | 2.796875 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var persons = require('../database/persons.js');
router.get('/', (req, res) => {
if(req.query.firstName) {
var personBuffer = [];
persons.forEach(function(person) {
if(person.firstName === req.query.firstName) {
... | true |
fee6f8ccbd8c049cccef89e6e36d936d25555292 | JavaScript | DanielIshi/UnityVolleyball | /Allgemeines.js | UTF-8 | 179 | 2.578125 | 3 | [] | no_license | /*
function Farbe (R, G, B) {
this.R = R;
this.G = G;
this.B = B;
this.hex = "#";
}
Farbe.prototype.gibFarbe = function()
{
return "hihihihi";
}
*/ | true |
01feb0f55e2c70b49fe8279ce3c09452f79eb1ac | JavaScript | ibc/mimemessage.js | /lib/grammar.js | UTF-8 | 2,337 | 2.6875 | 3 | [
"MIT"
] | permissive | var
/**
* Exported object.
*/
grammar = module.exports = {},
/**
* Constants.
*/
REGEXP_CONTENT_TYPE = /^([^\t \/]+)\/([^\t ;]+)(.*)$/,
REGEXP_CONTENT_TRANSFER_ENCODING = /^([a-zA-Z0-9\-_]+)$/,
REGEXP_PARAM = /^[ \t]*([^\t =]+)[ \t]*=[ \t]*([^"\t =]+|"([^"]*)")[ \t]*$/;
grammar.headerRules = {
'Conten... | true |
86952558d2678b02de37b47cf314e36c40795ec1 | JavaScript | shunkie/node-code | /modules/fs/fs.readFile(path[,options],callback).js | UTF-8 | 1,361 | 3.3125 | 3 | [] | no_license | //path <string> | <Buffer> | <URL> | <integer> 文件名或文件描述符。
//options <Object> | <string>
// encoding <string> | <null> 默认为null。
// flay <string> 默认为 'r'。
//callback <Function>
// err <Error>
// data <string> | <Buffer>
//异步地读取一个文件的全部内容。例子:
const fs = require('fs');
fs.readFile('/etc/passwd', (err, data) => {
if... | true |
129ade8f230e63dcaf4ae9d7e6a5befe8a63a3fe | JavaScript | takoda1/CS-Grad-Tracking | /controllers/util.js | UTF-8 | 7,305 | 3.046875 | 3 | [] | no_license | var schema = require('../models/schema.js');
var _ = {}
var regexSlashes = /\/*\//ig;
// Removes variables not defined in models and other undefined/null variables
/*
@param input document or object reprenting a document
@param model schema.{model} (the model reprenting the document)
@returns the document with undef... | true |
f413371660df7f3e1b274c67c6e5b9ec7f83911a | JavaScript | suminc7/epiq | /src/scripts/utils/StringUtils.js | UTF-8 | 1,610 | 3.015625 | 3 | [] | no_license |
export default class StringUtils {
constructor(){
}
/**
* 여러개의 줄바꿈을 한개로 변환한다.
* @param text
* @returns string
*/
static replaceNewline(text){
return text.replace(/\n\s*\n/g, '\n');
}
/**
* 줄바꿈을 스페이스로 변환한다.
* @param text
* @returns string
*/
... | true |
bde0fd84da5ba3d063ae27bdfd896e4bf03f4a30 | JavaScript | alejandro-jalf/Libreria-Valor-Dolar | /test/test.js | UTF-8 | 887 | 2.546875 | 3 | [
"MIT"
] | permissive |
const assert = require("chai").assert;
const libMoneda = require("../lib/index")
describe ('libMoneda',function() {
describe('toDolar', function() {
it('Retorno numero',function(){
assert.typeOf(libMoneda.toDolar("jsjsj"),"number");
});
it('Retorno USD ',function(){
... | true |
38361c2f241f4ac467af451ad02ededd776f1bcd | JavaScript | eviltrout/ember-extension | /ember_debug/adapters/basic.js | UTF-8 | 1,159 | 2.546875 | 3 | [
"MIT"
] | permissive | var BasicAdapter = Ember.Object.extend({
debug: function() {
console.debug.apply(console, arguments);
},
log: function() {
console.log.apply(console, arguments);
},
/**
Used to send messages to EmberExtension
@param {Object} type the message to the send
*/
sendMessage: function(options) {... | true |
c158bc95a6ccc2ef3919bfd3b72b9e9e84aea15d | JavaScript | shekhar700/Training-Feb-2021 | /Modules/NodeJS/Day13/Tarun Moradiya/Assignment/hospital/models/user.js | UTF-8 | 1,399 | 2.703125 | 3 | [] | no_license | // import modules
const Joi = require('joi');
const mongoose = require('mongoose');
const config = require('config');
const jwt = require('jsonwebtoken');
//create schema
const userSchema = new mongoose.Schema({
name: {
type: String,
required: true
},
email: {
type: String,
... | true |
ecfdaf836931a2af7baf32cc41a71af19215239f | JavaScript | SHIZC13/SHIZC13.github.io | /js/mergeSort.js | UTF-8 | 5,898 | 3.25 | 3 | [] | no_license | var cvs = document.getElementById('cvs');
var ctx = cvs.getContext('2d');
var range = document.getElementById('range');
//监控滑竿的变化
range.oninput = function(){
change();
}
function change(){
var speed = range.value;
return speed;
}
var cmpl_num = 0;//比较次数变量
var move_num = 0;/... | true |
303b770b3c186f5a12811afae153a7dca7c73328 | JavaScript | JustinDavisA/webapi-iii-challenge | /users/users-router.js | UTF-8 | 2,322 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | const express = require('express');
const Users = require('../helpers/userDb')
const router = express.Router();
router.get('/', async (req, res) => {
try {
const users = await Users.get()
res.status(200).json(users)
} catch {
res.status(500).json({
message: 'Error retriev... | true |
4ca00e58c612fd6f5106cccbd5a188e7b080b122 | JavaScript | LENZAKON/you-server | /src/js/school.js | UTF-8 | 4,209 | 2.640625 | 3 | [] | no_license | /**
* Created by Lenovo on 2017/6/9.
*/
function SchoolDetial() {
}
SchoolDetial.prototype = {
schoolMore:function () {
var moreIcon = document.getElementsByClassName("more-icon")[0];
moreIcon.addEventListener("click",function (e) {
var target = e.target;
$(target.parentN... | true |
d703a4574e2e0a91ad8e403a92caf6babd43c155 | JavaScript | argho1990/Javascript-Tuts | /exercise1.js | UTF-8 | 5,238 | 4.625 | 5 | [] | no_license | // The web browser is the runtime that you can use for javascript as a Development Environment.
// Choose Firefox because Firefox has certain tools that is very handy writing these scripts and
// having them execute
// Intro:
// console.log(arg);
// console: console is a global object thats available to you and log... | true |
14d955703a282b5d5b8501604a8eeae1404d1d22 | JavaScript | camerondodd/My8BitSelf | /public/index.js | UTF-8 | 6,639 | 3.03125 | 3 | [] | no_license | const statsURL='/profile/stats';
// Gets user info
function getStats(callback){
settings={
method:'GET',
dataType:'json',
url:statsURL,
success:callback
};
$.ajax(settings);
console.log('getStats ran');
}
//Makes info useable for rest of file
function displayStats(data){
console.log(data)... | true |
e1d43442501fd3bba6b62811c3cecb99b87097f3 | JavaScript | dicardopegb/vis_example | /src/BarPlot.jsx | UTF-8 | 2,649 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react'
import * as d3 from 'd3'
const defXScale = ({ data, x, width, padding }) => (
d3.scaleTime()
.domain([d3.min(data, function(d) {return d[x]; }), d3.max(data, function(d) {return d[x]; })])
.range([padding, width - padding * 2])
);
const defYScale = ({ data, y, height, pad... | true |
dbd5653b778895a5cf1b08360051243a2998d2e1 | JavaScript | mbyrd27/parlourgame | /scripts/game/StartGameButton.js | UTF-8 | 491 | 2.78125 | 3 | [] | no_license | const contentTarget = document.querySelector('.gameBoard')
const eventHub = document.querySelector('#container')
export const StartGameButton = () => {
contentTarget.innerHTML = `<button type="button" class="btn-submit" id="startGame">Start Game</button>`
}
eventHub.addEventListener('click', clickEvent => {
i... | true |
e75b4628f54da6d19a5463c50c954975786750eb | JavaScript | bripkens/tagbook | /chrome-extension/options/options.js | UTF-8 | 1,355 | 2.625 | 3 | [
"MIT"
] | permissive | var storageKeyUrl = "tagbook-url";
var storageKeyUsername = "tagbook-username";
var storageKeyPassword = "tagbook-password";
function OptionsCtrl($scope) {
$scope.url = localStorage.getItem(storageKeyUrl) || "";
$scope.username = localStorage.getItem(storageKeyUsername) || "";
$scope.password = localStorage.getI... | true |
2a6d9d2b643cdc72905942a559f9dbd9b1803a74 | JavaScript | birnei033/capstone | /assets/cs_exercise.js | UTF-8 | 6,638 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
$(document).ready(function () {
function start_exam(){
var time_in_minutes = $('.card.exercise #time').text();
if (time_in_minutes != 0) {
// var time_in_minutes = 1;
var current_time = Date.parse(new Date());
var deadline = new Date(c... | true |
6f8b832ef2fe0c82926fbc37e8c3c37eb67c8f54 | JavaScript | karolinaCodes/Spinner | /spinner2.js | UTF-8 | 337 | 3.28125 | 3 | [] | no_license | //spinner 1 refactored
const symbolArray = ["|", "/", "-", "\\"];
let timer = 100;
// 1500 makes the spinner rotate 360 twice
while (timer < 1500) {
//loop through symbol array
for (let j = 0; j < symbolArray.length; j++) {
setTimeout(() => {
process.stdout.write(`\r${symbolArray[j]} `);
}, (timer... | true |
1e78c37919cd8c269f7869f85842911dff341a81 | JavaScript | canvax/canvax | /src/event/dispatcher.js | UTF-8 | 4,427 | 2.625 | 3 | [] | no_license | /**
* Canvax
*
* @author 释剑 (李涛, litao.lt@alibaba-inc.com)
*
* 事件派发类
*/
import Manager from "./manager";
import Event from "./event";
import _ from "../utils/underscore";
export default class Dispatcher extends Manager
{
constructor()
{
super();
}
on(type, listener)
{
this._... | true |
4a87eb2f980ac368679bcafe44def82add0975ce | JavaScript | aalsher/CodingProgression | /Javascript/forafewbillion.js | UTF-8 | 116 | 2.625 | 3 | [] | no_license | function forafewbillion(num){
mult = 0;
for(var i=0; i <31; i++){
mult = 0.01 * num;
}
console.log(mult);
}
| true |
6421e11e4effbaa6ac4c16431c21936c22aa7c5c | JavaScript | mogon-flow/C | /ch11/js/timeout.js | UTF-8 | 179 | 2.828125 | 3 | [] | no_license | console.log('a');
window.setTimeout(function () {
console.log('b');
}, 500);
console.log('c');
window.setTimeout(function () {
console.log('d');
}, 500);
console.log('e'); | true |
e0595aa3c03ece39640d647ddc4878999ccff9d9 | JavaScript | enthusiastick/star_wars_facts | /app/javascript/react/containers/MediaIndex.js | UTF-8 | 696 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react'
class MediaIndex extends Component {
constructor(props) {
super(props)
this.state = {
media: []
}
}
componentWillMount() {
fetch('/api/v1/media.json', {
credentials: 'same-origin',
method: 'GET',
headers: { 'Content-Type': 'applica... | true |
a3086ecb68b370435b92addeeb08343b6a225959 | JavaScript | IamADude/ItsComingSoon | /src/languages/en-US/FUN/translation.js | UTF-8 | 1,274 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | // This contains language files for the commands
const languageData = {
FACT_TITLE: 'Random Feitje:',
FLIP_CHOICE: (choice) => `${['Kop', 'Munt'][choice]}`,
MEME_TITLE: 'Van',
MEME_FOOTER: 'Medemogelijk gemaakt door',
MISSING_POKEMON: 'Die pokemon bestaat niet.',
RANDOM_RESPONSE: (number) => `Willekeurig nummer: ... | true |
4b5ca7470cf38b886c04694ad6e260527a7c562a | JavaScript | ThingsChange/studyTestAndrew | /someTimes/toPrimitive.js | UTF-8 | 1,156 | 3.421875 | 3 | [] | no_license | /**
*
* @author 晴云
* @create 2020-09-18 20:36
* @note 干什么的呢?
**/
class A {
constructor(count){
this.count=count
}
valueOf(){
return 2
}
toString(){
return 'hello toString'
}
[Symbol.toPrimitive](hint){
if(hint==='number'){
return 10
}
else ... | true |