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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ef301c7213fa6d947ceb587d0b86854651f68b1e | JavaScript | jdbean-educational/js-advanced-first-class-functions-practice-lab-nyc-web-031218 | /index.js | UTF-8 | 816 | 3.828125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution in this file!
const logDriverNames = function(array) {
array.forEach(function(element)
console.log(element.name)
)
}
const logDriversByHometown = function(array, hometown) {
array.forEach(function(element) {
if (element.hometown === hometown) {
console.log(element.name);
}... | true |
085b7028daeb103f3618ec8ed25241fe5dbb1156 | JavaScript | WDI-Woodstock-Schroeder/MarvelTapIt | /app/assets/javascripts/nemesisClick.js | UTF-8 | 1,420 | 2.765625 | 3 | [] | no_license | var app = app || {};
app.nemesisClick = function nemesisClickHandler(){
$(".nemesis-thumb").on('click', function(){
// remove any page elements with class 'nemesis'
$('.nemesis').remove()
var char = $(this).data("character");
var filename = $(this).data("filename");
var nemesis = {};
$.aj... | true |
0a146a3c4bdf1956f182b910524b6294303f5bf8 | JavaScript | Blendan/blendan.github.io | /spielerreien/soundboard3D/js/soundboard3d.js | UTF-8 | 423 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(
function()
{
makeBtn();
}
);
function makeBtn()
{
for (var i = 0; i < 16; i++)
{
btnSide = "";
for (var j = 1; j < 5; j++)
{
btnSide += "<div class='boardBtnSide' style='transform: rotateX(45deg) rotateZ("+90*j+"deg) translateZ(-6vw);'></div>"
}
$(".soundbo... | true |
86123d5fe304eb2d7b4a75af491688ebbfa54ce7 | JavaScript | reacticoon/reacticoon | /src/action/createApiCallAction.js | UTF-8 | 2,724 | 2.625 | 3 | [] | no_license | import isFunction from 'lodash/isFunction'
import createAction from './createAction'
import createApiEnumAction from '../api/utils/createApiEnumAction'
import { getParamNames, defineFunctionName } from 'reacticoon/utils'
import { isDebugLogLevel } from 'reacticoon/environment'
import { API_CALL, TYPES, REQUEST, DATA, ... | true |
e383a00ed92724fbc51aae5f461e657f5f37a50d | JavaScript | juanpa-sudo/rest-server | /server/controller/ProductoController.js | UTF-8 | 2,406 | 2.578125 | 3 | [] | no_license | const Producto = require("../models/Producto");
function listProduct(req, res) {
let inicio = req.query.inicio || 0;
let final = req.query.final || 5;
inicio = Number(inicio);
final = Number(final);
Producto.find({ disponible: true }, (err, productoBD) => {
if (err) return res.status(400).json({ ok: fa... | true |
eebc845d523439aeb481c43a61ae57c7aa9871ee | JavaScript | everyside/cheddar | /blessed.js | UTF-8 | 959 | 2.59375 | 3 | [] | no_license | window.addEventListener('message', function(event) {
var command = event.data.command;
switch(command) {
case 'saveAs':
saveAs(event.data.code);
}
});
function errorHandler(){
console.log(arguments);
}
function saveAs(code){
console.log("saving", code);
// event.source.postM... | true |
c63d4d07320127a4eb6ee9a6ed0f15cd8b05fee1 | JavaScript | Oleksandr-Shapovaliuk/goit-js-hw-07 | /js/task-06.js | UTF-8 | 803 | 3.4375 | 3 | [] | no_license | const inputRef = document.querySelector('#validation-input');
inputRef.addEventListener('blur', onInputBlur);
function onInputBlur(event) {
const validLength = Number(event.currentTarget.dataset.length);
const inputValueLength = event.currentTarget.value.length;
const isContainsValid = event.currentTarget.class... | true |
a66adcac06300c6dbd472fdb10514c8682723a80 | JavaScript | SteRMo95/logicGatesFullStack | /logicGates/src/grader.js | UTF-8 | 796 | 2.953125 | 3 | [] | no_license | /* So here's how this is going to go. This is going to take in three things.
- The student submission (using both the final results, as well as the number of each gate that is used.)
- The teacher desired results
- The teacher specifications (the number of gates of each type that are expected. )
-- These specifications... | true |
28d134e3dc12f67928bcb45d67cd34650623baa3 | JavaScript | SamsonEmelyanov/message-avgRaiting | /controllers/message.js | UTF-8 | 1,880 | 2.546875 | 3 | [] | no_license | const HttpStatus = require('http-status-codes');
const { messageValidate } = require('../validators/message');
module.exports = ({ router, actions, models }) => {
const routes = router();
const message = actions.message(models);
routes.get('/', async (req, res) => {
const messages = await message... | true |
3dd084afd275341f588347eede291be28e7c6355 | JavaScript | compose-ui/toolbox | /test/time.test.js | UTF-8 | 1,281 | 2.796875 | 3 | [] | no_license | var time = require('../').time
var DateTime = require( 'luxon' ).DateTime
test( 'parses a time', () => {
expect( time.parse('1993-10-12 05:34:21') ).toBeTruthy()
expect( time.parse('1993-10-12 05:34:21').day ).toBe( 12 )
expect( time.parse('2018-04-25T22:15:21.796Z').day ).toBe( 25 )
expect( time.parse('152469... | true |
66fe2152331a34d14f60b74399727754235f7a30 | JavaScript | zhangwinning/hashConsistent-redis | /lib/hash/find.js | UTF-8 | 626 | 3.5625 | 4 | [] | no_license |
/**
* 在一个排好序的数组中到右边离他最近的数值。
* 切到不能再切,满足要求的最后一个元素,就是想要的元素
* 二分查找一个应用
* @param {*} list
* @param {*} left
* @param {*} right
* @param {*} value
*/
let index = 0
function find(list, left, right, value) {
if (left <= right) {
const mid = parseInt((left + right) / 2);
if (value <= list[mid])... | true |
63cfc9585e7d129f7dd2e0b7a4168897940fc017 | JavaScript | YHaoNan/gameoflife | /game.js | UTF-8 | 3,046 | 3.046875 | 3 | [] | no_license | /**
* This file provide a 2d array for game.
*/
/**
* @param {*} len game board width and height
* @param {*} callback The function will be called when the game board change.
*/
function initGame(len,callback){
// Game object
var game = {
speed: 80,
boardEdgeLength: len,
... | true |
10f0beb8e67e0936bb91aa4395eb92bbc7d9ac44 | JavaScript | wimdetr/Aalstprojecten2-groep4DOTNET | /src/Aalstprojecten2-groep4DOTNET/wwwroot/js/tooltip.js | UTF-8 | 5,603 | 2.59375 | 3 | [
"MIT"
] | permissive | $(document)
.ready(function () {
var temp = window.location.href.split("/");
var pagina = temp[temp.length - 1];
var tijd = 1000;
if ($("#animatiesAanUit").text().trim() === "Animaties aanzetten") {
tijd = 0;
}
var huidige = 0;
var volgordeWaarden ... | true |
cbe1264304b22c720b2c6719cdb89b717895b511 | JavaScript | tiagoamp/codekata | /javascript/hackerrank/equality-in-a-array.js | UTF-8 | 2,016 | 3.53125 | 4 | [] | no_license | // https://www.hackerrank.com/challenges/equality-in-a-array/problem
'use strict';
function equalizeArray_solution3(arr) {
let mostFreqNr = arr[0];
const amount = arr.reduce((obj,n) => {
obj[n] = obj[n] ? obj[n]+1 : 1;
if (obj[mostFreqNr] < obj[n])
mostFreqNr = n;
return ob... | true |
33fc324a4fa7c001de224740b0a2b7146cd40084 | JavaScript | bestkwanwa/whatimlearningnow | /自定义组件/dialog.js | UTF-8 | 5,068 | 2.9375 | 3 | [] | no_license | export default class Dialog extends EventTarget {
constructor(options) {
super();
// 默认配置
let defalultOptions = {
width: "30%",
height: "250px",
title: "测试标题",
content: "测试内容",
dragable: true, //是否可拖拽
maskable: true, //是... | true |
f59fc2fc555197d7c011042ee7ec226f5d9e9ac6 | JavaScript | jbpzen/openwork | /src/scripts/app.js | UTF-8 | 1,263 | 2.546875 | 3 | [
"MIT"
] | permissive | import View from './view';
import Child from './components/child';
import Subsubchild from './components/subSubChild';
const toString = array => {
return array.map(item => {
return `Ability : ${item.ability.name} / Slots : ${item.slot}`;
}).toString();
};
const root = new View({
template: `
<div class="containe... | true |
2223f5391f022a68f3fd9fc29e1e8e2352c24075 | JavaScript | dorinzrihen/appleseeds | /react/7-2/src/YellowBox.js | UTF-8 | 613 | 2.765625 | 3 | [] | no_license | import React from 'react';
import './App.css';
class YellowBox extends React.Component {
state = {
myBox: 'box'
};
handleClick = () => {
// Use updater function when new state is derived from old
if(this.state.myBox){
this.setState({myBox:null});
}
... | true |
c4831236fcf3f94881337df699a3c2718de43423 | JavaScript | dgrushetskiy/PanelScroller | /public/js/content.js | UTF-8 | 662 | 2.984375 | 3 | [] | no_license | var ContentStack = function(arr){
this._storage = [];
this.getInProgress = false;
};
ContentStack.prototype.getContent = function(cb){
if(this.length() < 60 && !this.getInProgress){
this.getInProgress = true;
$.get('/items',function(data){
this._storage = this._storage.concat(JSON.parse(data).busin... | true |
983e2487c34be3eb832ac6d924b52c21199c1196 | JavaScript | CrissZollo/Block3 | /RgbChoice/code.js | UTF-8 | 3,462 | 3.46875 | 3 | [] | no_license | let redText = document.querySelector('.red');
let greenText = document.querySelector('.green');
let blueText = document.querySelector('.blue');
const redPlus = document.querySelector('.redPlus');
const redPlusTen = document.querySelector('.redPlus10');
const redMinus = document.querySelector('.redMinus');
const redMin... | true |
f40b7cb51b7df062a52089c6b9d5bfa98f743a75 | JavaScript | Mistergix/deficode | /Ressources/p3/test.js | UTF-8 | 933 | 3.140625 | 3 | [] | permissive | let h1 = document.querySelector("h1");
h1.setAttribute("id", "titre");
console.log(h1.classList);
h1.classList.remove("ne-sert-a-rien");
h1.classList.add("green");
h1.classList.add("italic");
console.log(h1.classList);
let pasdetruites = document.querySelectorAll(".pasdetruite");
for (let index = 0; index < pasdetr... | true |
ed58439956149b5432ac091200f29b671cada3f6 | JavaScript | joelmzramos/lab-mongoose-recipes | /index.js | UTF-8 | 2,157 | 2.921875 | 3 | [] | no_license | const mongoose = require('mongoose');
const Recipe = require('./models/Recipe'); // Import of the model Recipe from './models/Recipe'
const data = require('./data.js'); // Import of the data from './data.js'
// Connection to the database "recipeApp"
mongoose.connect('mongodb://localhost/recipeApp', { useNewUrlParser:... | true |
bf7961676f9f879df6c88c3ee8d2afd542744f37 | JavaScript | YordanaIvanova/Passwort-Reset | /01.PassReset.js | UTF-8 | 1,202 | 3.484375 | 3 | [] | no_license | function solve(input) {
let pass = input.shift()
for(const line of input) {
const tokens = line.split(' ')
const cmd = String(tokens[0])
if(cmd === 'TakeOdd') {
let raw = ''
for(let i = 0; i < pass.length; i++) {
if(i % 2 !== 0) {
... | true |
9a4a766f11f55f2e2c9258595ccea0db27432ddd | JavaScript | tedyage/ES_tutorial | /09 Iterator & for...of/03_usage_of_iterator.js | UTF-8 | 2,149 | 4.25 | 4 | [] | no_license | /*
iterator接口的运用场合
*/
{
//1.解构赋值
//不只是数据结构和对象结构可以做到解构赋值,
//实际上拥有iterator接口的数据接口都可以做到解构赋值
let set = new Set().add('a').add('b').add('c');
let [x,y,z] = set;
console.log("x is "+x); //a
console.log("y is "+y); //b
console.log("z is "+z); //c
let[x1,...args] = set;
co... | true |
d4fd15dfe287fceb82ab6c965f90047701a8bc82 | JavaScript | MarketingAjay/ajay.fun | /mod_tools/kai/board_generator/src/index.js | UTF-8 | 2,614 | 3.0625 | 3 | [] | no_license | //import "./styles.css";
const data = [
{ row: 1, playerName: "DJ", numHits: 1, playerType: "player" },
{ row: 1, playerName: "Kathy", numHits: 0, playerType: "player" },
{ row: 1, playerName: "Kai", numHits: 2, playerType: "player" },
{ row: 1, playerName: "Krystal", numHits: 2, playerType: "player" },
{ ro... | true |
db1db74d772ec049cec516500150a5bb60acc16c | JavaScript | mintyfloss/tumblr | /js/mintyfied_old.js | UTF-8 | 5,424 | 2.546875 | 3 | [] | no_license | $(function(){
$('.posts').imagesLoaded(function(){
$(this).isotope({
itemSelector:'.post',
masonry:{
columnWidth:270
}
},
function() { console.log('done') });
});
function showModal(postUrl, postNotesUrl, scrollToNotes) {
// Makes request for post
$('.modalPost').load(postUrl + ' article', f... | true |
76f8fb2d38da6aa1e0fb093f2b6f2539e32a8425 | JavaScript | dbacy/justJS | /Exercises.js | UTF-8 | 770 | 2.921875 | 3 | [] | no_license | let father = "Dad"
let mother = 'Mom'
let sister = 'Sis'
let brother1 = 'Big bro'
let brother2 = 'Lil bro'
let child1 = 'Son'
let child2 = 'Daughter'
let rainbow_color1 = 'purple'
let rainbow_color2 = 'blue'
let rainbow_color3 = 'green'
let rainbow_color4 = 'orange'
let rainbow_color5 = 'yellow'
let favTvShow = "ESPN"
... | true |
841eaca2ce8267552534166fb17cec5fcf906b29 | JavaScript | zomeelee/glsl-transition | /examples/3/qvideo.js | UTF-8 | 955 | 2.515625 | 3 | [
"MIT"
] | permissive | var Q = require("q");
var Qajax = require("qajax");
// Video loading with promise.
// using an ajax request as a workaround to help some browsers...
function Qvideo (url, options) {
return Qajax(url, { responseType: "blob" }).then(function (xhr) {
if (typeof options !== "object") options={};
if (!options.e... | true |
878427ae1f45614446badc230dfc8b2e0c70f2a7 | JavaScript | velociRABBITTT/scratch | /client/components/App.js | UTF-8 | 4,159 | 2.78125 | 3 | [] | no_license | import React, { Component } from "react";
import Login from './Login.jsx';
import CreateUser from './CreateUser.jsx';
import NavBar from './NavBar.js';
import FeedContainer from './../containers/FeedContainer.jsx';
class App extends Component {
constructor() {
super();
this.state = {
userLoggedIn: fals... | true |
030b267616160a66eaeb9eb453566617d2885ce4 | JavaScript | Sunvenir/-Learning-resource-sharing-platform | /frontend/src/socket.js | UTF-8 | 1,863 | 2.609375 | 3 | [] | no_license | // function SocketObj(){
// this.socket = null;
// this.openSocket = function(uid,onMessge) {
// if(typeof(WebSocket) == "undefined") {
// console.log("您的浏览器不支持WebSocket");
// }else{
// console.log("您的浏览器支持WebSocket");
// var socketUrl="ws://139.9.216.155:8888/so... | true |
2542306bed3b101e0d99c1dd36e6d65293cd18ee | JavaScript | JosephAustin/derpi-ruby | /app/assets/javascripts/gallery.js | UTF-8 | 562 | 3.09375 | 3 | [] | no_license | // Checkmark every box if any are unchecked. If all are checked, this will uncheck all of them
function check_all() {
var checked = $("input:checkbox:checked").length == $("input:checkbox").length;
var chks = document.querySelectorAll("input[type='checkbox']");
for (var i = 0; i < chks.length; i++) {
chks[i].chec... | true |
2bd350d42f931622a07043db9137af7cb2f5819b | JavaScript | KostyaKlepach/HW-7 | /js/main.js | UTF-8 | 1,138 | 3.15625 | 3 | [] | no_license | let button = document.querySelectorAll('button');
let keyA = new Audio("audio/1.mp3");
let keyS = new Audio("audio/2.mp3");
let keyD = new Audio("audio/3.mp3");
let keyF = new Audio("audio/4.mp3");
let keyG = new Audio("audio/5.mp3");
let keyH = new Audio("audio/6.mp3");
let keyJ = new Audio("audio/7.mp3");
let keyK = ... | true |
7250c86c33b9a22ac650479f5605557671d7d23e | JavaScript | jbust97/Disbabel | /grimm.js | UTF-8 | 613 | 2.671875 | 3 | [] | no_license | //https://dictionary.yandex.net/api/v1/dicservice.json/getLangs?key=APIkey
//const fetch = require("node-fetch");
//get_translation('de','en','wrong_key').then(data => console.log(data));
//The line below only serves to quick test the add-on
//document.body.style.border = "5px solid red";
function getSelectedText() {... | true |
202fae17a9ce6f6900f580c0aa2a17d397d2e64c | JavaScript | Sepiac/Superluminal | /DEFAULT_CAMPAIGN/ship.js | UTF-8 | 1,144 | 2.953125 | 3 | [] | no_license | 'use strict';
var ship = {};
ship.name = 'Ship';
ship.location = {};
ship.activated = true;
ship.energy = 0;
ship.food = 10;
ship.health = 100;
ship.oxygen = 10;
ship.requiredEnergy = 0;
ship.systems = {};
ship.callBacks = [];
ship.status = function() {
console.log('=========================================');
... | true |
d8ee47c37a2a143f1e99500adf4bedfcbc3d3d83 | JavaScript | apicanary/apicanary | /dummy/test2.apicanary.js | UTF-8 | 2,408 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* @canary_test_id dummy2
* @canary_test_name Dummy Test 2
*/
const request = require('request')
const axios = require('axios')
// exports.handler = function (event, context, callback) {
// request.get({
// url: 'http://ip-api.com/json',
// method: 'get',
// json: true
// }, func... | true |
a6fe26fbfa1c42f93d1a3ae5ae214a9bd4ec0a3d | JavaScript | Xiaolong96/webpack-practice | /src/tapable/AsyncParallelHook.js | UTF-8 | 1,102 | 2.828125 | 3 | [
"ISC"
] | permissive | const { AsyncParallelHook, AsyncParallelBailHook } = require("tapable");
class Work {
constructor() {
this.hook = {
step: new AsyncParallelHook(["name"]), // 异步并行
};
}
register() {
// 注册事件的方式有3种,tap、tapAsync、tapPromise
this.hook.step.tapAsync("A", (name, cb) => {
setTimeout(() => {
... | true |
04d5963149f2894209c0bc45a2af73b270c5c6b1 | JavaScript | BereniceFang/FE_studyBlog | /bi/js/chart-area-line.js | UTF-8 | 2,730 | 2.515625 | 3 | [] | no_license | var data, url, category
var lineOption = {
tooltip : {
trigger: 'axis'
},
color: ['#fecb85','#fdffc4'],
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : false,... | true |
20f144fb819a6fb766d1df5b89ae185de17f873f | JavaScript | Hydrophobefireman/dps-exam | /static/components/Report/screenshot.js | UTF-8 | 8,729 | 2.96875 | 3 | [] | no_license | /** @type {ArrayConstructor['from']} */
const ArrayFrom =
Array.from ||
((iterable) => {
return [].slice.call(iterable);
});
const identity = (x) => x;
const $unescape = window.unescape || identity;
/** @param {CanvasRenderingContext2D} ctx */
function isTainted(ctx) {
try {
return !ctx.getImageDat... | true |
860721375b6d09c6b74570fd5e2122049443be98 | JavaScript | Benkovskiy/Automation | /JavaScript course/ifelse.js | UTF-8 | 512 | 3.953125 | 4 | [] | no_license | //Variables block
let age = 20;
/***************** First condition ********************/
if (age > 20){
console.log ('Congrats! You are aligible to get a driving license');
}
/**************** Second condition ********************/
else if (age == 20){
console.log ('Congrats! You just get aligible to get d... | true |
0f8e7b64b41d07a4ea439f207967f13543a29de2 | JavaScript | mateusasferreira/js-exercises | /exercicio2.js | UTF-8 | 903 | 4.21875 | 4 | [] | no_license | // Teste 2
// Dado um array de strings não vazio, remove os dados duplicados em sequência.
// public String[] removeDuplicates(String[] values)
// Exemplo entrada
// removeDuplicates(new String[]{"g", "g", "y", "c", "c", "c", "q", "c", "y", "y"})
// Exemplo saída
// ["g", "y", "c", "q", "c", "y"]
function removeDupli... | true |
e98709f93a78ec404b1cf24a628b313b184ac468 | JavaScript | drawwithcode/02-animated-texture-Filippo-Tortelli | /sketch.js | UTF-8 | 1,039 | 3.359375 | 3 | [] | no_license | function preload(){
}
function setup() {
createCanvas(windowWidth,windowHeight);
background(0);
angleMode(DEGREES);
}
function draw() {
let squareSize = width/24;
for (let x = 0; x < width; x += squareSize) {
for (let y = 0; y < height; y += squareSize) {
let randomColor = noise((1.5*frameCount... | true |
a1d04abe18c49fd5c9d91260fb2abd22ba9d9a7d | JavaScript | nowzoo/nog-old | /src/atomic/get_tags.js | UTF-8 | 869 | 2.765625 | 3 | [
"MIT"
] | permissive | 'use strict';
var _ = require('lodash');
var S = require('string');
module.exports = function(content){
var tags;
var clean = [];
var exists = [];
var normalized;
if (!_.has(content.meta, 'tags')){
tags = [];
} else {
if (_.isString(content.meta.tags)){
tags = cont... | true |
e70be5700e338cafa1804aae300bc84b9ecd25db | JavaScript | blocery/blocery | /react-frontend/src/hooks/useScroll.js | UTF-8 | 1,254 | 2.75 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
const useScroll = (props) => {
const [scrollPos, setScrollPos] = useState({x: 0,y: 0})
const [scrollDir, setScrollDir] = useState("up"); //현재 스크롤이 어디를 향하는지 up or down
useEffect(() => {
const threshold = 0;
let lastScrollY = window.pageYOffs... | true |
a2a157fcc071056c1e65697292c53c3dcff6bc05 | JavaScript | baseman/evt-api | /resource-manager/src/lib/resourceManager.js | UTF-8 | 1,664 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | function tryGet(fxName, options) {
var fx = options[fxName];
if(!fx){
throw new Error(fxName + ' has not been defined');
}
return fx;
}
var __cleanUps = [];
var __manager = {
createResource: function(options){
var _fPromiseInitResource = tryGet('promiseInitResource', options);
... | true |
ec21fd8449992c9be754dcafb36a66b945bf9267 | JavaScript | bespoyasov/utils | /dom/getElementOffset.js | UTF-8 | 363 | 2.921875 | 3 | [] | no_license | /**
* Returns offset of given node
* @param {DOMNode} node
* @returns {Object} {top, left}
*/
const getElementOffset = node => {
if (!node || 'undefined' === typeof window) return
const rect = node.getBoundingClientRect()
return {
top: rect.top + window.pageYOffset,
left: rect.left + window.pageXOf... | true |
ba738b6a9ee699e9d099b25a603f2ae764d7ea45 | JavaScript | LucasVillarim/HTML-CSS-JavaScript | /Aula-04/assets/js/04-script.js | UTF-8 | 2,857 | 3.203125 | 3 | [] | no_license | const baseURL = "https://api.chucknorris.io/jokes/";
const searchURL = 'https://api.chucknorris.io/jokes/search?query=';
const body = document.querySelector('#app');
function card(joke) {
const cardTemplate =
`
<div class="card col-md-3 col-lg-3 m-3" style="width: 18rem;">
<div class="card-body">
<di... | true |
02ae376282d5d5adc291fb8a3c821f9fde9d0957 | JavaScript | tarpaha/rest-api-simple | /server/api/controllers/messages.js | UTF-8 | 1,006 | 2.546875 | 3 | [] | no_license | 'use strict';
const logger = require('../../libs/logger');
const messageModel = require('../models/messages');
module.exports.getAll = function(req, res) {
messageModel.find(function(err, messages) {
if(err) {
logger.error('Message.list() error: ' + err.message);
res.statusCode = 5... | true |
36c61540992a5d79091ffb4217a7d575bcd09803 | JavaScript | npmcomponent/maxhoffmann-bindings | /test/tests.js | UTF-8 | 1,931 | 3.15625 | 3 | [
"MIT"
] | permissive | describe('bindings', function () {
var bindings = require('bindings');
var assert = require('assert');
var testdom = document.getElementById('testdom');
var testHTML = testdom.innerHTML;
afterEach(function () {
testdom.innerHTML = testHTML;
});
it('should return an object with two bindings', function () {
... | true |
259d0a4d7fbaafb6a6151fa79ce95aa4936e30bd | JavaScript | zhnedyalkow/study-dsa | /Linear Data structures/implementation-queue.js | UTF-8 | 1,115 | 4.15625 | 4 | [] | no_license | class Queue {
constructor() {
this.head = null;
this.tail = null;
this.count = 0;
}
enqueue(...values) {
if (values.length > 1) {
values.forEach(this.enqueue);
return this;
}
let node = {
value: values[0],
next... | true |
d317e49275a52061585fcde4451b9bb3dfa3ae5f | JavaScript | ck0904/Utils | /js/EventBus.js | UTF-8 | 1,229 | 3.28125 | 3 | [] | no_license | //EventBus构造函数
function EventBus() {
this.listeners = {}
}
//判断是否为函数
function isFunction(fn) {
return fn && Object.prototype.toString.call(fn) == '[object Function]'
}
//判断是否为字符串
function isString(str) {
return str && (typeof str == 'string' && Object.prototype.toString.call(str) == '[object String]')
}
function ... | true |
c5b6daaa431f032d87a50b073b09654a26b62d3c | JavaScript | kareemaly/stock-prices-analysis | /index.js | UTF-8 | 3,984 | 2.8125 | 3 | [
"MIT"
] | permissive | const moment = require('moment');
const util = require('util');
const ApiService = require('./src/libs/ApiService');
const retryPromiseIf = require('./src/libs/retryPromiseIf');
const QuandlApiService = require('./src/quandl/QuandlApiService');
const { ApiResponseError, ClientRequestError } = require('./src/libs/errors... | true |
0f1ad5a6f715d4d6893c29b56b82762f266554f4 | JavaScript | jonmadison/good-news-today | /server/routes/api/users.js | UTF-8 | 1,588 | 2.609375 | 3 | [
"MIT"
] | permissive | const express = require("express");
const router = express.Router();
const Users = require("../../model/Users");
//Define All APIs for Users here
//@route test
router.get("/test", (req, res) => res.send("User route testing"));
//@route to get all users
router.get("/", (req, res) => {
Users.find()
.then(user =>... | true |
f464ba4a6b4ee31279b609a75036a06954c2ca1d | JavaScript | Ru7w1k/freshersbatch-jul17 | /Assignments/ES6_TypeScript/hello_app/components/destructuring_assignment.js | UTF-8 | 419 | 2.84375 | 3 | [] | no_license | export function testDestructuringAssignment() {
let arr = [123, 245, 563, 456];
let [,,val,] = arr;
console.log('3rd : ', val);
let organization = {
name : "sample Organization",
address : {
street: "J. M. Road",
city: "Pune",
state: "Maharashtra",
... | true |
630d52a0874ead6c38b9a9e67077286efb9926de | JavaScript | abhirajkulaar/GuviZen | /tvapp/src/index.js | UTF-8 | 3,823 | 2.78125 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TV_1 = require("./TV");
//Set Up Links for Channels
var videolinks = [{ link: "./videos/Movie.mp4", name: "HBO" }, { link: "./videos/Sports.mp4", name: "Start Sports" }, { link: "./videos/Music.mp4", name: "VH1" }, { link: "./videos/Ne... | true |
1076f90eb533912c414811800b70890137673091 | JavaScript | yusidabcs/sirius | /src/core/modules/principal/views/edit/js/main.js | UTF-8 | 17,289 | 2.625 | 3 | [] | no_license | $(document).ready(function()
{
var xhr = null;
var edit_brand = false;
var brand = null;
var principal = {
brands: [],
};
var principal_id = $('#principal_id').val();
$('#go_back').click(function(e){
e.preventDefault();
swal.fire({
title: 'Leave form?',
... | true |
44266050b6c532a97f0cd26be2399cbbdda0bf53 | JavaScript | Prathamesh412/Whatson | /vendor/assets/javascripts/progress_bar.js | UTF-8 | 3,138 | 2.75 | 3 | [] | no_license | /*
*
* JQuery Progress bar Plugin
* ==========================
*
* Author : Ameen Ahmed <ameen.ahmed@sourcebits.com>
*
* Dependencies: JQuery
*
* Files: progress_bar.js
*/
(function($) {
"use strict";
$.fn.progress = function(options) {
var self = this;
console.log(options);
// Initializations
... | true |
1aa146cf1d65fef6c1d6edfaeab1567233aa38e4 | JavaScript | jgx13245/vue-ssr-sbsbsb | /app/util/index.js | UTF-8 | 1,432 | 2.546875 | 3 | [
"MIT"
] | permissive | const crypto = require('crypto')
const http = require('http')
const path = require('path')
/**
* 当前环境
* @type {string}
*/
exports.env = process.env.NODE_ENV || 'development'
/**
* 是否为开发环境
* @type {boolean}
*/
exports.isDevelopment = exports.env === 'development'
/**
* server 根目录
*/
exports.serverRoot = path.... | true |
f36761979e48c7b4d372ad025ff91b3b119c02c6 | JavaScript | koushikkolli/assign_mentors | /script.js | UTF-8 | 16,905 | 2.84375 | 3 | [] | no_license | let mentorDetails = []
let assignedStudentDetails = []
let unAssignedStudentDetails = []
let url = "http://localhost:3000"
function getAssignedStudents() {
fetch(url + `/get_assigned_students`)
.then((resp) => {
return resp.json()
})
.then((response) => {
assignedStudentDet... | true |
499ca5f834c5d4f70bde45c670f43bdbdd8f3ad5 | JavaScript | alejoortizd/TORRE | /public/js/scripts.js | UTF-8 | 1,716 | 2.859375 | 3 | [] | no_license | const form = document.querySelector("#check");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const data = document.querySelector("#validate").value;
const answer = await fetch(e.target.action, {
method: e.target.method,
headers: {
Accept: "application/json",
"Content-Type... | true |
5f794f317757e6366ac440e6ad1d9be6742aea43 | JavaScript | emarps/emarps.github.com | /des157-wi20/studio4/script.js | UTF-8 | 2,860 | 2.78125 | 3 | [] | no_license | console.log('reading js');
'use strict';
var pantone = document.querySelector('#pantone');
var waterbottle = document.querySelector('#waterbottle');
var vaseline = document.querySelector('#vaseline');
var pantoneoverlay = document.querySelector('#pantoneoverlay');
var pantoneclose = document.querySelector('#pantonecl... | true |
fdc503b152f6836770046f2d8f17b9c80159d20e | JavaScript | stark275/distsys.ts | /dist/node/NodeManager.js | UTF-8 | 4,252 | 2.609375 | 3 | [] | no_license | "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
})... | true |
4708588f48f1f04dbb2c4832628771e0d6ec30fe | JavaScript | Not-a-whale/Beauty | /assets/js/product-page.js | UTF-8 | 1,605 | 2.671875 | 3 | [] | no_license | $(document).ready(function () {
thisProductId = +localStorage.getItem("productId");
$.ajax({
url: "assets/json/items.json",
type: "GET",
dataType: "json",
success: function (result) {
currentItem = result.find((item) => item.id === thisProductId);
$("#productHeading").text(currentItem.na... | true |
c709f2c94e3a4143bba61a87fdf7bb3d183c5bd9 | JavaScript | andreadau/js-oggetti-studenti | /js/app.js | UTF-8 | 2,280 | 4.40625 | 4 | [] | no_license | /*
Istruzioni:
Creare un oggetto che descriva uno studente con le seguenti proprietà: nome, cognome e età. Stampare a schermo attraverso il for in tutte le proprietà.
Creare un array di oggetti di studenti. Ciclare su tutti gli studenti e stampare per ognuno nome e cognome
Dare la possibilità all’utente attraverso 3 pr... | true |
930cf722afcea0bdfd9d4b92d613d4a4242f0f2d | JavaScript | v1taly/petrus | /src/modules/oAuth/config/getSearchParams.js | UTF-8 | 1,334 | 3.203125 | 3 | [
"MIT"
] | permissive | const fromSnakeToCamelCase = (src = '') => {
const chunks = src.split('_');
const part1 = chunks.slice(0, 1);
const part2 = chunks.slice(1).reduce((result, chunk) => {
if (!chunk.length) {
return result;
}
return result + chunk[0].toUpperCase() + chunk.slice(1);
}, '... | true |
67ae3c30a91e1a0d3530dec25494200f50f324fb | JavaScript | glenn-a810/GlennStudy | /goormCode.js | UTF-8 | 2,202 | 4.0625 | 4 | [] | no_license | let a = 1
a = 3
console.log(a) // 2
let cars = [car,car2,car3,car4]
const test = 1 // string number func object
const test2 = 'hello javascript'
const test3 = function(){
console.log('test3');
}
/* 좌롸네 */
let car = {
name : "sonata",
ph : "500ph",
start : function () {
console.log("engine is starting");
},
stop... | true |
426573e458f2df238797574941f5399898b97743 | JavaScript | christophwille/demosatconferences | /AdcWien/AzureMobileServices/AqiLocalTest/test.js | UTF-8 | 1,551 | 2.515625 | 3 | [] | no_license | var req = require('request');
var csv = require('csv');
var ozoneDataUrl = 'http://luft.umweltbundesamt.at/pub/ozonbericht/aktuell.json';
var pm10DataUrl = 'http://open-data.noe.gv.at/BD4/FeinstaubPM10.csv';
// scheduledRetrievalOfOzoneData();
getPm10Data();
function scheduledRetrievalOfOzoneData() {
req( {uri:... | true |
be2c3a3fff5671bbb9a5e5e2f7a409321ff1eb2e | JavaScript | car-tetris/web-app | /src/utils/state/actionHelpers.js | UTF-8 | 410 | 2.96875 | 3 | [] | no_license | /**
* Get an typical action object.
* Source {@link https://github.com/yelouafi/redux-saga/blob/master/examples/real-world/actions/index.js#L26 github.com}
*
* @param {string} type - action type (constants)
* @param {object} [obj={}] - e.g. response of a request
* @returns {object} Returns an object like: {type: ... | true |
5743f1c53176991cab2fe4256ccbc7e4794c5a74 | JavaScript | sabrinachowzbl/cyphers | /script.js | UTF-8 | 2,233 | 3.25 | 3 | [] | no_license | let morse = {
a: '.-',
b: '-...',
c: '-.-.',
d: '-..',
e: '.',
f: '..-.',
g: '--.',
h: '....',
i: '..',
j: '.---',
k: '-.-',
l: '.-..',
m: '--',
n: '-.',
o: '---',
p: '.--.',
q: '--.-',
r: '.-.',
s: '...',
t: '-',
u: '..-',
v: '...-',
w: '.--',
v: '...-',
x: '-..-',
y... | true |
7084ada183a0bb96f6683f6492425f9f3ea18d6a | JavaScript | mcarey1590/AdventOfCode2016 | /Day 13/day13.2.js | UTF-8 | 1,942 | 3.140625 | 3 | [] | no_license | var maxSteps = 50;
var favNumber = 1350;
var maxX = 0, maxY = 0;
var mostVisited = 0;
var pathMap = {};
function isOpenSpace(x, y){
var num = (x*x + 3*x + 2*x*y + y + y*y) + favNumber;
var binary = (num >>> 0).toString(2);
var ones = binary.replace(/0/g, '').length;
return ones % 2 === 0;
}
function ... | true |
99d6832a7823d1c5a084da64b568d80c00b2014d | JavaScript | dybe-hs2016/exercises-tbu | /Hauser/10_d3Einfuehrung/17_BarChartSVG.js | UTF-8 | 3,763 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | //Size of the space occupied by the diagram
var totalWidth = 1000;
var totalHeight = 500;
//Margins for axis
var axisMargin = {top: 2, left: 30, bottom: 20, right: 0};
//Margin around the graph
var graphMargin = {top: 10, left: 10, bottom: 10, right: 40};
//Margin around bars
var barMargin = {top: 5, left: 3, ... | true |
eab8a6934f27a656c8b56b405ac03a1a2bc5144e | JavaScript | robertkirsz/magic-counter-bitbucket | /src/store/modules/errors.js | UTF-8 | 2,342 | 2.515625 | 3 | [] | no_license | import moment from 'moment'
import _isNumber from 'lodash/isNumber'
import _first from 'lodash/first'
import _last from 'lodash/last'
import _includes from 'lodash/includes'
import _startsWith from 'lodash/startsWith'
import _reject from 'lodash/reject'
import * as types from '@/store/mutation-types'
/* EXAMPLE
error ... | true |
7343855b9f76a4864a2a75c2e781ce1a9f94c358 | JavaScript | rolandtellez/TriviaGame | /assets/javascript/app.js | UTF-8 | 9,039 | 3.1875 | 3 | [] | no_license | var startButton = $("<button>").text("Start");
$("#gameplay-area").append(startButton);
var correctAnswers = 0;
var wrongAnswers = 0;
var timeLeft = 30;
var intervalID;
function newGame() {
correctAnswers = 0;
wrongAnswers = 0;
timeLeft = 30;
$("#gameplay-area").empty();
// timer
$("<div id... | true |
69d52171de059903fbf29f8f76f867227939dcb9 | JavaScript | latilt/web_front_end | /Algorithm/LinkedList/LinkedList(sentinel).js | UTF-8 | 954 | 4 | 4 | [] | no_license | function Node() {
this.item = null;
this.next = null;
}
function List() {
this.head = new Node();
this.length = 0;
}
List.prototype.addFirst = function(value) {
var newNode = new Node();
newNode.item = value;
newNode.next = this.head.next;
this.head.next = newNode;
this.length++;
}
List.prototype.... | true |
f45c8b73674fab05d75b1c20b2fbab4faf60a4cd | JavaScript | BarefootSummer/myJD | /讲义/20151124/js/banner.js | UTF-8 | 14,680 | 2.59375 | 3 | [] | no_license | var dataAry = ["img/banner1.jpg", "img/banner2.jpg", "img/banner3.jpg", "img/banner4.jpg"];
/*封装我们常用的DOM库*/
var listToArray = function (likeAry) {
var ary = [];
try {
ary = Array.prototype.slice.call(likeAry, 0);
} catch (e) {
for (var i = 0; i < likeAry.length; i++) {
ary[ary.l... | true |
c911f01c9eaf02ada7aa06af3e639cf88d8ebd9f | JavaScript | IgorKurkov/weather-app | /app/js/storage.js | UTF-8 | 1,959 | 2.78125 | 3 | [] | no_license | import { selectors } from './inc/_selectors.js'
import * as render from './render.js'
//view cities in recent and in favorite blocks
//build button - add to favorites
//button clear recent
//button clear favorites
const getCitiesFromStorage = (storageName) => {
let cities = {};
if(localStorage.getItem(storag... | true |
aee8bb753c3342edabeee1507cb24d1d8a53d2a1 | JavaScript | mitji/lab-react-ironcontacts | /starter-code/src/App.js | UTF-8 | 2,157 | 3 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import contacts from './contacts.json';
import ContactsList from './components/ContactsList';
const fiveContacts = contacts.slice(0,5);
class App extends Component {
state = {
contactsList: fiveContacts
}
// ITERATION 2
addRandom = () => {
... | true |
8fa71b84c3429d880a8904aa478d417279dbc140 | JavaScript | sergivaldofilho/IGTI | /Bootcamp Front-end/Fundamentos/JavaScript Moderno/Manipulacao Arrays/js/spreadRestDestructuring.js | UTF-8 | 1,175 | 3.953125 | 4 | [] | no_license | window.addEventListener('load', () => {
doSpread();
doRest();
doDestructuring();
});
// Spread - Espalha elementos de vetores
function doSpread() {
const marriedMan = people.results.filter(
(person) => person.name.title === 'Mr'
);
const marriedWoman = people.results.filter(
(person) => person.name... | true |
a576b852447d8e41fda8eb6115bc2b3326966c13 | JavaScript | prestonedwards3/bamazon | /bamazonSupervisor.js | UTF-8 | 1,284 | 3.125 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var Table = require('cli-table');
var connection = mysql.createConnection({
host: "localhost",
// Your port; if not 3306
port: 8889,
// Your username
user: "root",
// Your password
password: "root",
database: "bamazon"
});
// insta... | true |
11535b86f900ae7d6b15e082de78192c7e9507f0 | JavaScript | so-like/https | /01_middleware/app.js | UTF-8 | 524 | 2.734375 | 3 | [] | no_license | const express = require("express");
const app = express();
app.get("/all",(req,res)=>{
// res.send(`console.log("哈哈哈")`);
// console.log(req.query.callback);
// 返回一个调用
// console.log(req.query.callback);//这里就能拿到前端准备好的函数
// 这样就不会写死而是一个动态的框号里的返回给前台会被当做js代码处理
res.send(`${req.query.callback}({'nam... | true |
c6cd4599a2f2135817f5969c027ae11ee240002c | JavaScript | travis4all/Bluemold | /spec/acceptance_spec.js | UTF-8 | 3,354 | 2.90625 | 3 | [
"MIT"
] | permissive | // https://github.com/jquery/jquery-tmpl/blob/master/tests/core.js
var Bluemold = require(__dirname+"/../lib/bluemold");
var fs = require('fs');
describe('a simple template', function(){
it("should render", function(){
expect(Bluemold("hello {{each [1,2,3]}}world {{/each}}")).toEqual("hello world world world ")
... | true |
cf98911393593885a8736d32558079b198670bd9 | JavaScript | 4esnog/infrafirst | /src/helpers.js | UTF-8 | 380 | 2.8125 | 3 | [
"Unlicense"
] | permissive | 'use strict';
const helpers = {
getRandomHex () {
const min = 0;
const max = 255;
return Math.floor(Math.random() * (max - min + 1) + min);
},
generateColor () {
let color = [];
for (let i = 0; i < 3; i++) {
color.push(helpers.getRandomHex());
}... | true |
28bf8677c4dd3b90482acd417145774cfecb3a88 | JavaScript | stencila/engine | /src/CellStates.js | UTF-8 | 1,509 | 2.765625 | 3 | [] | no_license | // not yet analysed
const UNKNOWN = Symbol('UNKNOWN')
// analysed
const ANALYSED = Symbol('ANALYSED')
// syntax or graph errors
const BROKEN = Symbol('BROKEN')
// runtime or validation errors
const FAILED = Symbol('FAILED')
// one of the inputs is broken, failed, or blocked
const BLOCKED = Symbol('BLOCKED')
// all inpu... | true |
6184d7f053fd84963c6d76e01a9f8324092506af | JavaScript | pizzi9523/js-hamburger | /assets/js/main.js | UTF-8 | 439 | 3.109375 | 3 | [] | no_license | const hamburgerElement = document.querySelector("a>i");
const menuElement = document.querySelector(".hamburger-menu");
const closeElement = document.querySelector(".close");
//console.log(menuElement);
//console.log(hamburgerElement);
hamburgerElement.addEventListener("click", function () {
menuElement.classList.a... | true |
c04a782e0c62b77bf1eaa5040dee79722b9a1690 | JavaScript | piyush4299/user-management | /js/models/UserHandler.js | UTF-8 | 3,367 | 2.875 | 3 | [
"MIT"
] | permissive | export default class UserHandler{
static addNewUser = (userObject) => {
let storedUserObjects = localStorage.getItem("userList");
let userObjects;
if(storedUserObjects){
userObjects = JSON.parse(storedUserObjects);
userObjects.push(window.btoa(JSON.stringify(userObje... | true |
d82a0055886a0199412407870272acab501c8373 | JavaScript | JaycobDuffel/lotide | /test/middle.test.js | UTF-8 | 660 | 2.71875 | 3 | [] | no_license | const assert = require('chai').assert;
const middle = require('../middle')
describe('#middle', () => {
it('should return an empty array when given an empty array', () => {
const actual = middle([1, 2]);
const expected = [];
assert.deepStrictEqual(actual, expected);
});
it('should return 2 when given ... | true |
f4497bba1a53ffc3a882576719b431175e0eac2d | JavaScript | D0019208/Aphix-Software-Coding-Challange | /public/plugins/js/modules/add_video_cards.js | UTF-8 | 283 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* Add the video card views to the DOM
*
* @param array - videos
*
* @return void
*/
async function add_video_cards(videos) {
$('#video_container').html('');
videos.forEach((video) => {
$('#video_container').append(video);
});
}
export {add_video_cards} | true |
8130c33cc019d81e78aff93030ee424422452419 | JavaScript | tebracb/Restaurant-review-site-II | /restaurant-review/src/components/NewRestaurantForm.js | UTF-8 | 4,224 | 2.703125 | 3 | [] | no_license | import React from "react"
import "./NewRestaurantForm.css"
class NewRestaurantForm extends React.Component {
constructor(props) {
super(props)
this.state = {
name: "",
formatted_address: "",
touched: {
name: false
}
}
... | true |
72b57e208329d08ebb66326863a38dad71858ad3 | JavaScript | jpsimonroy/react-formdsl | /lib/statemachine/models/validators.js | UTF-8 | 3,838 | 2.796875 | 3 | [] | no_license | var _ = require('underscore');
var s = require("underscore.string");
var moment = require('moment');
var Required = function(message) {
return function(value) {
if (!value || s(String(value)).trim().value() === '') {
return message || 'This field is required';
}
};
};
var EmailOrContact = function() ... | true |
535cf79d579b8b202a57b642b3f9cb3e3dcc8d4b | JavaScript | Al-bat-ros/JavaScript-Tasks | /tasks_cycle_18.js | UTF-8 | 3,628 | 4.375 | 4 | [
"MIT"
] | permissive | // tasks 1 Выведите с помощью цикла столбец чисел от 1 до 100
/*
for (var i = 1; i <= 100; i++){
document.write(i + '<br>');
}
*/
// tasks 2 Выведите с помощью цикла столбец чисел от 100 до 1
/*
for (var i = 100; i > 0; i--){
document.write(i + '<br>');
}
*/
// tasks 3 Выведите с помощью цикла столбец четных чисел... | true |
26394bb147cf4549328bfbe86dd22709542adad0 | JavaScript | viane/templates | /bootstrap v4 no jQuery/js/main.js | UTF-8 | 1,330 | 2.875 | 3 | [] | no_license | window.onload = () => {
// fetch get
const fetchUrl = 'https://api.github.com/users/xiaotian/repos';
fetch(fetchUrl, {method: 'get'}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(data);
});
// fetch post
// const params = '';
// fetch(fetchUrl, {
// ... | true |
d47cb91fbeedbef46a6c67d953267480bcec8159 | JavaScript | emillind/adventofcode | /2022/solutions/02.js | UTF-8 | 1,749 | 3.09375 | 3 | [] | no_license | const fs = require('fs')
const log = require('./log.js')
const DAY = '02'
const parseInput = (file) => {
const inputString = fs.readFileSync(`../inputs/${DAY}/${file}`).toString()
return inputString.split('\n').map((val) => {
const choices = val.split(' ')
return { opponent: choices[0], response: choices[... | true |
3e14e99a71f64c9ebd12b2b3e71f91a033fee45b | JavaScript | iswarmondal/Js_calculator | /javascript.js | UTF-8 | 911 | 3.375 | 3 | [] | no_license | function calculate() {
// collecting the values
var totalAmmount = document.getElementById("totalAmmount").value;
var selection = document.getElementById("selection").value;
var numberOfPeople = document.getElementById("numberOfPeople").value;
//validate inputs
if (numberOfPeople === "... | true |
e03f3cb7abe4ab75a929c83c51d97450ad431fbf | JavaScript | revanza-git/cluster-sim | /resources/js/components/Grid/index.js | UTF-8 | 2,966 | 2.890625 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import ReactDOM from "react-dom";
import "./index.scss";
class Example extends Component {
constructor(props) {
super(props);
this.state = {
data: [
[1, 1, 0],
[1, 0, 1],
[1, 0, 1]
]
... | true |
91198acdda3bdd056b3f243ba0f9dfe161bb9255 | JavaScript | nathanieldcooke/airbnb-lite | /frontend/src/store/stayedAtHistory.js | UTF-8 | 936 | 2.59375 | 3 | [] | no_license | import { csrfFetch } from './csrf'
const GET_STAYED_AT_HISTORY = 'stayedAtHistory/getStayedAtHistory'
/////////////////// ACTION CREATORS ////////////////////
const getStayedAtHistory = (spotsStayedAt) => {
return {
type: GET_STAYED_AT_HISTORY,
payload: spotsStayedAt
}
}
//////////////// THU... | true |
c58e8103891aed0e84dd7812f27b4a55e6247b3e | JavaScript | karenm09/Pursuit-Core-Web-Server-Intro-Lab | /function.js | UTF-8 | 757 | 2.9375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded" , () => {
// debugger
axios.get(`http://localhost:3000/celeb`).then(res => {
res.data.forEach(element => {
let card = document.createElement("div")
let image = document.createElement("img")
let content = document.createElement("sect... | true |
0862b2e7718018c61790d8d89c416a794172e21e | JavaScript | leplay/emoji-sheet | /generate-config.js | UTF-8 | 2,917 | 2.671875 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | #!/usr/bin/env node
/*
Generate emoji.json
*/
const fs = require('fs')
const axios = require('axios')
const _ = require('lodash')
const dict = require('./dict')
const customDict = require('./custom-dict')
const { formatShortName, parseSkinTone } = require('./utils')
let emojiCount = 0
const source = process.argv[2]... | true |
b4df9c57a730bfc9ff9d359fbbc6817226a5cc26 | JavaScript | kknape/bamazonCLI | /bamazonCustomer.js | UTF-8 | 5,155 | 3.234375 | 3 | [] | no_license | //bamazon js file
var mysql = require("mysql");
var inquirer = require("inquirer");
var Table = require("cli-table2");
// create the connection information for the sql database
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "kadonna",
database: "bamazon"
})... | true |
6b4ccd5bb92cf9e83778dce6ac31a9ef2cb0c97b | JavaScript | OskarWastensson/fiamedknuff | /scripts/dice.js | ISO-8859-1 | 903 | 3.125 | 3 | [] | no_license | onload = function(){
var dice = document.getElementById('dice');
var diceDrawArea = document.getElementById('diceValue');
var diceRoll = 2;
dice.style.cursor = 'pointer';
dice.onclick = function() {
if(getGameState()){
updateDice();
returnDiceValue();
}else{
updateMessage('You canno... | true |
eb58981c17b8c6b78cdf2736765198e7efdca771 | JavaScript | iprashant2402/image-browser-webapp | /src/components/header.js | UTF-8 | 1,804 | 2.609375 | 3 | [] | no_license | import React, { useState } from "react";
import { connect } from "react-redux";
import TabOne from "../views/tabOne";
import TabTwo from "../views/tabTwo";
import "../css/header.css";
import { BrowserRouter as Router, Switch, Route, Link, Redirect } from "react-router-dom";
const Header = (props) => {
//State used t... | true |
09e6af352d0dcf72ad7291ddc74cf4806b1bf856 | JavaScript | RicardoM1randa/Portafolio_PW0219_00107418 | /laboratorios/Laboratorio5/ejercicio6.js | UTF-8 | 372 | 3.34375 | 3 | [] | no_license | function ordenarAscendente(array = [1,8,6,2,4,5]){
let a,b;
for(j=0; j < array.length -1 < j++){
for(i=0; i < array.length -1; i++){
if(array[i] > array[i+1]){
a = array[i];
b = array[i];
array[i] = b;
array[i+1] = a;
... | true |
fd2279191f4919fbad3abb690479df004cf97951 | JavaScript | 296249221/Microprofessional-Courses | /23被问到网络协议就懵逼?用node教你使用各大网络协议/code/tcpclient.js | UTF-8 | 257 | 2.546875 | 3 | [] | no_license | var net = require('net');
var client = net.Socket();
client.connect(3300, '127.0.0.1', function () {
setInterval(function () {
client.write('攻击boss');
}, 1000)
});
client.on('data', function (data) {
console.log(data.toString());
}) | true |