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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ef62956f8619d6c12243850449ae4ffba9e6d1d9 | JavaScript | LionelENSFELDER/freecodecamp | /javascript-algorithms-data-structure/cashRegister.js | UTF-8 | 3,394 | 3.0625 | 3 | [
"MIT"
] | permissive | function checkCashRegister(price, cash, cid) {
const currencies = [
{name:"ONE HUNDRED", value:100},
{name:"TWENTY", value:20},
{name:"TEN", value:10},
{name:"FIVE", value:5},
{name:"ONE", value:1},
{name:"QUARTER", value:0.25},
{name:"DIME", value:0.10},
{name:"NICKEL", value:0.05},
... | true |
aaab504c93c7093c71c5615c81ba205462c92487 | JavaScript | google-code/caderneta-web | /Caderneta/web/Relatorio/js/criarTabela.js | UTF-8 | 366 | 3.453125 | 3 | [] | no_license |
function criarTabela(){
// Captura a referência da tabela com id “minhaTabela”
var table = document.getElementById("minhaTabela");
for(var i = 0; i < 3; i++)
{
var newRow = table.insertRow(i);
for(var j = 0; j < 34; j++)
{
newCell = newRow.insertCell(j);
newCell.innerHTML = "Linha "+ numOf... | true |
916653f354c56185c5f9abc954e8bfed8f8c7ddf | JavaScript | desweemerl/fw.js | /src/ui/form/IntegerField.js | UTF-8 | 7,684 | 2.890625 | 3 | [
"MIT"
] | permissive | /**
* @module fw/ui/form/IntegerField
* @license MIT License
* @author Ludovic Desweemer
*/
'use strict';
var DataSource = require('../../source/DataSource');
var EditableFormElement = require('./EditableFormElement');
var fw = require('../../Core');
var FwInteger = require('../../type/Integer');
var KeyboardMana... | true |
c24f1fae4adb8fcedc6d38535a485fac6ca42835 | JavaScript | AlexStotch/phaser-webpack-boilerplate | /src/scenes/BaseScene.js | UTF-8 | 996 | 2.625 | 3 | [] | no_license | import Phaser from "phaser";
const PIPES_TO_RENDER = 4;
class BaseScene extends Phaser.Scene{
constructor(key, config) {
super(key);
this.config = config;
this.sceneCenter = [config.width / 2, config.height / 2];
this.baseStyle = {fontSize: '32px', fill: '#FFF'};
}
create() {
this.add.image(0, 0, '... | true |
d8be76b4635ab6f22636e27a5393f9a26c4a5429 | JavaScript | tmhao2005/arrow | /specs/1.x.x/scripts/array/math/abs.spec.js | UTF-8 | 1,822 | 3.125 | 3 | [
"MIT"
] | permissive | import {
absRange,
abs
} from "../../../../../src/1.x.x/scripts/array/math/abs"
describe("Absolute values for specific range of elements", () => {
it("should return positive values for positive values", () => {
expect(absRange([1, 2, 3], 0, 1)).toStrictEqual([1, 2, 3]);
});
it("should retur... | true |
8483ac19ea158bbb6d993b279f0874f4bb2d055e | JavaScript | oyvindbusk/vue-front | /src/store/modules/userStatus.js | UTF-8 | 646 | 2.53125 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
const state = {
logStatus: false
};
const getters = {
logStatus: (state) => state.logStatus
};
const actions = {
initStore: ({ commit }) => {
axios.get('https://172.16.0.3:5001/chklogin', { withCredentials: true }).then((response) => {
console.log(response.data);
// if response ... | true |
94636111c032b5d3dbab9c594edb8471cd898d24 | JavaScript | mattocks/Mapping-Tool | /cartagen/src/interface/zoombar_works.js | UTF-8 | 2,463 | 2.78125 | 3 | [] | no_license | var topSpace = 48; // how far from top zoombar should be
var leftSpace = 20; // how far left zoombar should be
var step = 6; // how many pixels the slider moves between distinct levels
var topBound = topSpace + 22;
var bottomBound = topBound + 270;
var pos = topBound;
var mouseDown = false;
var item = null;
function zo... | true |
28725092803a767e90a480b1ff2b8e0801463491 | JavaScript | CaliZam/footify | /footify/footify-app/logic/toogle-follow-player.spec.js | UTF-8 | 3,018 | 2.75 | 3 | [] | no_license | describe.only("toogleFollowPlayer", () => {
let name, surname, email, password, confirmPassword, playerId, _token, _playerId;
const ids = ["MS10", "CR7", "SR4", "TH14", "FL7", "JR10", "TS1", "JA8", "SE4"];
before(done => {
name = names.random();
surname = surnames.random()
email = `${name.toLowerCas... | true |
4e58117668adca81e9fa44a4eef76e78c7c925b5 | JavaScript | fleurhim/Javascript_exo | /script_5.js | UTF-8 | 1,979 | 3.1875 | 3 | [] | no_license | const books = [
{ title: 'Gatsby le magnifique', id: 133712, rented: 39 },
{ title: 'A la recherche du temps,perdu', id: 237634, rented: 28 },
{ title: 'Orgueil & Préjugés', id: 873495, rented: 67 },
{ title: 'Les frères Karamazov', id: 450911, rented: 55 },
{ title: 'Dans les forêts de Sibérie', id: 8376365,... | true |
e11dd43d21951cc3f03550af6e6fb2e87f0610ca | JavaScript | ruig1992/vue-crm-example | /src/filters/str-case.filter.js | UTF-8 | 195 | 2.890625 | 3 | [] | no_license | export default function (value, type = 'upper') {
if (!value) {
return null;
}
if (type.toLowerCase() === 'lower') {
return value.toLowerCase();
}
return value.toUpperCase();
}
| true |
c344c8047f8bdf184062682629c36d62a17aeb2a | JavaScript | JKnoroz/filmoteka | /src/js/components/api.js | UTF-8 | 4,404 | 3.109375 | 3 | [] | no_license | // функции для работы с API
const KEY = '94f703750c3e0771d8c2babc592efc94';
const URL = `https://api.themoviedb.org/3/`;
// добавляет в локальное хранилище массив всех возможных жанров который будет использоваться для формирования списка жанров фильма
async function getAllGenres() {
if (localStorage.getItem('genres... | true |
b0321fb2eb15e70eb9a7243a3f10202a86853b28 | JavaScript | prukeremanuel/CarMarketManagement | /target/classes/static/js/search.js | UTF-8 | 447 | 2.703125 | 3 | [
"MIT"
] | permissive | function autoEnable() {
var dropdownlist = document.getElementById("manufacturer");
var selectedValue = dropdownlist.options[dropdownlist.selectedIndex].value;
if (selectedValue == "All") {
disable()
} else {
enable();
}
}
function disable() {
// document.getElementById('type').value = "All";
... | true |
75e770af22afe99eca62b5669244b6e44b7a73a3 | JavaScript | suurii/PreProject | /bundle.js | UTF-8 | 3,651 | 2.53125 | 3 | [] | no_license |
function distance(A, B) {
return sqrt((A.x - B.x) ** 2 + (A.y - B.y) ** 2);
}
function average2point(A, B) {
return {
x: (A.x + B.x) / 2,
y: (A.y + B.y) / 2
};
}
function modelLoaded() {
console.log('Model Loaded!');
}
// Listen to new 'pose' events
let loaded = false
let res = []
let ... | true |
e94ab8c41b8ca87203b317804c2a2d961406edf6 | JavaScript | NewkerteethcanRepair/FrontTest | /react/my-app/src/components/10-hook/Customhook.js | UTF-8 | 834 | 2.578125 | 3 | [] | no_license | import React from 'react'
import {useReducer} from "react"
// export default function Hook() {
// return (
// <div>
// </div>
// )
// }
const reducer=(state,action)=>{
switch(action.type)
{
case 'increment': return ~~state+1
case 'decrement': return state-1;
... | true |
62098dbe9c876036119e07ceff21ed6517cd2ad6 | JavaScript | ghubDV/CodeConnected | /l2019en/src/PageContent/VanillaJS/chatbody.js | UTF-8 | 518 | 2.84375 | 3 | [] | no_license | //add multiple event listeners
function addListenerMulti(el, s, fn) {
s.split(' ').forEach(e => el.addEventListener(e, fn, false));
}
function chatResizer()
{
if(document.getElementById('chatBody') !== null)
{
var chatBody = document.getElementById('chatBody');
chatBody.style.height = w... | true |
12cc51fed049baa0260eb7f0babd4a691d976524 | JavaScript | faizalazman/RandomQuote | /src/App.js | UTF-8 | 1,288 | 2.765625 | 3 | [] | no_license | import React from "react";
import Quotes from "./components/quotes";
import axios from "axios";
import "./styles.css";
class App extends React.Component {
state = { quotes: [] };
getQuote = async () => {
if (window.localStorage.length === 1) {
const response = await axios.get("https://type.fit/api/quote... | true |
a5e7c2462adf25670b501bf3e19bddc86b5077cd | JavaScript | lynh510/UniversitySystem | /src/main/resources/static/javascript/list_idea.js | UTF-8 | 10,082 | 2.609375 | 3 | [] | no_license | function editIdea(id) {
$('.ideaInfo' + id).hide();
$('.editIdeaInfo' + id).show();
$('#edit_idea_form' + id).css({
'display' : 'block'
});
}
function onThumbUp(idea_id, like) {
document.getElementById("like" + idea_id).value = like;
document.getElementById("idea_id" + idea_id).value = idea_id;
$
.ajax({
... | true |
00471b53ac6ddf8416139186fb26604b68752dfa | JavaScript | pjr4lph/t10d | /index.js | UTF-8 | 2,744 | 3.125 | 3 | [] | no_license | 'use strict'
module.exports = downloadPackages;
const cheerio = require('cheerio');
const request = require('request');
const download = require('download-tarball');
const getNpmTarballUrl = require('get-npm-tarball-url');
const exec = require('child_process').exec;
// array where package information will be held as... | true |
da55ffdd58bcc049853c3dcd594bde3ad0a7ad91 | JavaScript | risduljis/praxis-academy | /novice/01-01/kasus/kasus-1/looping-a-triangel.js | UTF-8 | 77 | 2.78125 | 3 | [] | no_license | let aris = '';
for (a=1; a<=7; a += 1)
{
aris +='#';
console.log(aris);
} | true |
a9d14268005fdb7e36d598502fd6b688fdb350e0 | JavaScript | dlfktt6g/PuckBunnies | /betterSort.js | UTF-8 | 428 | 3.6875 | 4 | [] | no_license | console.log("before");
console.log([84758689,1,5,2,4,3]);
console.log("after");
console.log(sort([84758689,1,5,2,4,3]));
function sort (arr){
var holder = 0;
var end = 0;
for(var i=0; i<=arr.length-1; i++){
for(var j=arr.length-1; j>=end; j--){
if(arr[j]<arr[j-1]){
holder=arr[j-1];
arr[... | true |
b9fa34fbe2360537b1cde2bdb53050792aee7bf4 | JavaScript | be-hacking-hyf/javascript-3 | /fetching-data/debug-these.js | UTF-8 | 2,784 | 3.234375 | 3 | [
"CC-BY-4.0"
] | permissive | // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Basic_concepts
// great site for practicing working with the JSON format: https://jsoneditoronline.org/
const debugThese = [];
function debugMe1() {
const requestURL = "https://hackyourfuture.be/practice-api/food/dry/granes.json";
fetch(requestURL)
... | true |
c3d9bb63fcb5eb0df3063d5e7e21fb42c39786a4 | JavaScript | TeamPopset/TeamPopset.github.io | /noticias/noticias.js | UTF-8 | 1,500 | 2.796875 | 3 | [] | no_license | function cargaNoticia(noticia) {
var idNoticia = document.getElementById("Noticia");
idNoticia.style.visibility = "hidden";
idNoticia.innerHTML = "";
var attrYear = noticia.getAttribute("data-year");
var attrMonth = noticia.getAttribute("data-month");
var attrTitle = noticia.getAttribute("titl... | true |
448082f7baa3cb7437226a96630df989fc4f92af | JavaScript | thiscouldbebetter/MazeTraversalGame | /Source/Direction.js | UTF-8 | 743 | 2.9375 | 3 | [] | no_license |
class Direction
{
constructor(name, offset)
{
this.name = name;
this.offset = offset;
}
static Instances()
{
if (Direction._instances == null)
{
Direction._instances = new Direction_Instances();
}
return Direction._instances;
}
}
class Direction_Instances
{
constructor()
{
this.East = new Di... | true |
3a205b4bd2c6f8860cd51de74fb146de9097aa63 | JavaScript | javaHashbrown/HackerRank-Practice | /DataStructure/Get Node Value.js | UTF-8 | 434 | 3.734375 | 4 | [] | no_license | // Complete the getNode function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode next;
* }
*
*/
function getNode(head, positionFromTail) {
if(!head) return null;
let curIndex = 0;
let cur = head;
let res = head;
while(cur){
cur = cur.next;
... | true |
39d09550df7075db92374cca86614e6700517353 | JavaScript | beaumont/Music-Spaces | /public/javascripts/clipboard.js | UTF-8 | 689 | 2.625 | 3 | [] | no_license | function copyClip(text) {
var flashId = 'flashId-HKxmj5';
/* Replace this with your clipboard.swf location */
var clipboardSWF = 'http://appengine.bravo9.com/copy-into-clipboard/clipboard.swf';
if(!document.getElementById(flashId)) {
var div = document.createElement('div');
div.id = f... | true |
4b2d5ea655a9e82f257960cfa91efe3f828b6079 | JavaScript | clubedaentrega/validate-fields | /Type.js | UTF-8 | 3,405 | 3.171875 | 3 | [
"MIT"
] | permissive | 'use strict'
/**
* @class
* @param {string} jsonType
* @param {checkCallback} checkFn
* @param {toJSONCallback|string} [toJSON]
* @param {toJSONSchemaCallback} [toJSONSchema]
*/
function Type(jsonType, checkFn, toJSON, toJSONSchema) {
let types = ['number', 'string', 'boolean', 'object', 'array', '*', 'raw']
... | true |
bda3e37dc1a0c84b7dcdc08d4075ac553e8fce41 | JavaScript | marypershay/js-unit-testing | /lib/fileDataManager.js | UTF-8 | 1,431 | 2.59375 | 3 | [] | no_license | 'use strict';
const path = require('path'),
XLSX = require('xlsx'),
yaml = require('js-yaml'),
csv = require('node-csv').createParser(),
fs = require('fs'),
properties = require('properties');
class fileDataManager{
byExtension (fileName) {
const loadFile = {
'.json': this... | true |
e062e12679f9773d164d5654fb6b2e7ac4a9a153 | JavaScript | yuchen-xiong/nodejs-advanced | /index21.js | UTF-8 | 1,430 | 3.09375 | 3 | [] | no_license | //Chapter 3 HTTP Streaming - Handling range requests
// Safari requires
const { createServer } = require('http');
const { stat, createReadStream } = require('fs');
const { promisify } = require('util');
const fileName = './powder-day.mp4';
const fileInfo = promisify(stat); //stat function has callback, convert it t... | true |
86f32bdb8c06da747a4d0c3e51007e9e7d882216 | JavaScript | experiencei/Monster-rolodex | /src/App.js | UTF-8 | 1,004 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react'
import "./App.css";
import Cardlist from "./components/Cardlist/cardlist";
import Search from './components/search/search';
class App extends Component {
constructor() {
super();
this.state = {
valu : [],
search : ''
}
}
componentDidMount(){
... | true |
57fd2167755fce562b8390b09082b145e743c6c6 | JavaScript | BibleJS/bible-romanian | /example/index.js | UTF-8 | 972 | 2.921875 | 3 | [
"MIT"
] | permissive | // Dependencies
const bible = require("..");
// Get verse
bible.getVerse("Matei 1:1", function (err, data) {
console.log(err || data);
// [ { bookname: 'Matei',
// chapter: '1',
// verse: '1',
// text:
// 'Cartea neamului lui Isus Hristos, fiul lui David, fiul lui Avraam.' } ]
... | true |
e64485c536377c4c2649db76b22fd759e43aa697 | JavaScript | wuliqun/leetcode_by_js | /31-40/40.js | UTF-8 | 739 | 3.390625 | 3 | [] | no_license | /**
* 40. 组合总和
* 找出数组元素可以组成target的所有组合,数组元素不可重复使用
*/
/**
* @param {number[]} candidates
* @param {number} target
* @return {number[][]}
*/
let combinationSum2 = function(candidates, target) {
candidates.sort((a,b)=>a-b);
let res = [];
backtrace(candidates,0,target,[],res);
return res;
};
function b... | true |
f53dbd45751202f0e5b902e268de4025c97047b3 | JavaScript | xonatis-academy/wf3-cda1126-desktop | /code/5.instanciation.js | UTF-8 | 592 | 3.90625 | 4 | [] | no_license | function Person() { // initialisateur ou un *constructeur*
this.firstname = 'Annie';
this.lastname = 'Versaire';
this.age = 34;
// return this; // implicite
}
// PREMIERE METHODE : Utiliser la fonction sur une création de nouvel objet
let obj1 = new Person(); // instanciation
// 1. Création d'un nouve... | true |
2d5f7d77ab2559e4a1450b0a51489d24518ad290 | JavaScript | joemanley201/northrop_grumman_hackathon | /app/static/js/reco_display.js | UTF-8 | 7,374 | 2.890625 | 3 | [
"MIT"
] | permissive | var courses = [];
function zipper(metrics, currentScores, targetScores) {
var response = [];
response.push(["Metric", "Current", "Target"])
for (var idx = 0, lengthh = metrics.length; idx < lengthh; idx++) {
response.push([metrics[idx], currentScores[idx], targetScores[idx]])
}
return response;
}
functi... | true |
7e929ee657618011ddbb6f6df59bbed6fd027dc9 | JavaScript | gabrielkunkel/algorithm-challenges | /lib/devCodeCamp/14_ptCheck.js | UTF-8 | 535 | 3.90625 | 4 | [] | no_license | /**
* @name ptCheck
* @description Write a JavaScript program to check if a
* given string contains equal number of p's and t's present.
*
* @param {string} str
* @returns {boolean} true if p's and t's are equal
*/
function ptCheck(str) {
let pCounter = 0,
tCounter = 0;
str.split('').forEac... | true |
0250bb9400fd162cb1c144c441c3cea62ce01016 | JavaScript | jhonatasanches/logica | /Lista/While/wativ5.js | UTF-8 | 304 | 3.25 | 3 | [] | no_license | var bs, pt, result
var rs = require('readline-sync')
var bs = rs.questionInt('Insira aqui a base da potencia: ')
var pt = rs.questionInt('Insira aqui a potencia: ')
result = 1
while (pt >= 1){
result = result * bs
console.log(bs,pt)
pt--
}
console.log ('O resultado é ' +result)
| true |
7af054990d147d591bbb15be7f043d5d524bed1e | JavaScript | auziak/zeromq-test-task | /client.js | UTF-8 | 1,256 | 2.640625 | 3 | [] | no_license | const zmq = require('zeromq');
const subscriber = zmq.socket('sub');
const publisher = zmq.socket('pub');
const inquirer = require('inquirer');
const uuid = require('uuid');
subscriber.connect('tcp://127.0.0.1:3001');
publisher.connect('tcp://127.0.0.1:3002');
console.log(
'Subscriber connected to port 3001\nPublish... | true |
e4b9309d82615ea42a3450a0b43563668402adaa | JavaScript | chunfu/learnyournode-practice | /timeserver.js | UTF-8 | 621 | 2.828125 | 3 | [] | no_license | var net = require('net');
var port = process.argv[2];
Date.prototype.yyyymmdd = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
var hh = this.getHours().toString();
var minute = this.getMinutes().toStr... | true |
df86c66bfbe3abd27e4bb964ea4e2879cdff7eb4 | JavaScript | SarahMalash/301-entrance-exam | /q3.js | UTF-8 | 1,278 | 3.421875 | 3 | [
"MIT"
] | permissive | `use strict`
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
document.getElementById('currentDate').innerHTML = date;
var objArr = [];
function toDoList (todayAction, theDate){
this.todayAction = todayAction;
this.theDate = theDate;
objArr.push(thi... | true |
556974951ac403efefd86f8540e33842e005eb90 | JavaScript | yevgeniyvaleyev/sandbox | /graph/restricted_colours_experiment/experiment.js | UTF-8 | 1,215 | 3.234375 | 3 | [] | no_license | (function () {
var canvas = document.getElementsByTagName('canvas')[0],
context = canvas.getContext('2d');
document.body.style.background = 'black';
canvas.width = canvas.style.width = 1000;
canvas.height = canvas.style.height = 500;
/**
* Generates blue and yellow mix
*/
con... | true |
6fdd4c2769e130e9b868559b32d5c7384545e452 | JavaScript | specialblend/hertz | /src/lib/concat-float32-array.js | UTF-8 | 468 | 2.828125 | 3 | [] | no_license | export const concatFloat32Array = (first, second) => {
const result = new Float32Array(first.length + second.length);
result.set(first);
result.set(second, first.length);
return result;
};
export const concatFloat32Arrays = ([head, ...rest]) => {
if (rest.length < 1) {
return head;
}
... | true |
331592c0d130ea540192707d43abb4792c00cf05 | JavaScript | okochamoses/predsell-react | /src/services/api.js | UTF-8 | 2,582 | 2.671875 | 3 | [] | no_license | import axios from "axios";
// const baseURL = "http://localhost:3000/api/v1";
const baseURL = "https://secure-thicket-83876.herokuapp.com/api/v1";
const post = async (url, body, recursive = true) => {
const keys = Object.keys(body);
keys.forEach((key) => {
const val = body[key];
if (val === undefined || v... | true |
5bf3de09c10b50e80100b6d520ed891049092c6a | JavaScript | malleshkumargr/Assignments | /quotify/js/list-all-saved-quotes.js | UTF-8 | 5,053 | 3.03125 | 3 | [] | no_license | const quoteslistHandle = document.getElementById('quoteslist');
const quotesArr = localStorage.getItem('quotes') ? JSON.parse(localStorage.getItem('quotes')) : [];
let quoteIndexNum = 0;
function liMaker(quote,quoteAuthor) {
const liTag = document.createElement('li');
liTag.style.border = "1px solid black";
... | true |
76ba1353e939f8bae305791da34ec72e895d1dc0 | JavaScript | klfzlyt/parse_compiler | /src/Lexical/type.js | UTF-8 | 541 | 2.984375 | 3 | [] | no_license | import Word from './word.js';
import Tag from './tag.js';
export default class Type extends Word {
constructor(value, length) {
super(value, Tag.BASIC);
this.value = value;
this.length = length;
}
static int = new Type('int', 1);
static bool = new Type('bool', 1);
static float = new Type('float', 8);
static... | true |
0d049a1ecc38e271bcbd30470477a499c57a7a2d | JavaScript | Sjouke91/Codaisseur-coders-app | /src/store/feed/actions.js | UTF-8 | 682 | 2.5625 | 3 | [] | no_license | import axios from "axios";
import { API_URL } from "../../config";
export function startLoading() {
return {
type: "START_LOADING",
};
}
export function postsFetched(morePosts) {
return {
type: "POST_FETCHED",
payload: morePosts,
};
}
export async function fetchNext5Posts(dispatch, getState) {
... | true |
70d8bacca9f39a4130df092da8cc40a6de05668d | JavaScript | hechenting/shanghai--letao | /public/back/js/user.js | UTF-8 | 1,641 | 2.53125 | 3 | [] | no_license | /**
* Created by lenovo on 2018/6/26.
*/
$(function(){
var currentPage = 1;
var pageSize = 5;
var currentId;
var isDelete;
//进入页面就渲染一次
render();
//渲染当前页的函数
function render() {
$.ajax({
type:'get',
url:'/user/queryUser',
data:{
page:currentPage,
pageSize:pageSize
... | true |
619476d66622044621704f84dd8c5cdd69baa203 | JavaScript | sethvincent/string-exists | /index.js | UTF-8 | 359 | 3.171875 | 3 | [
"MIT"
] | permissive | module.exports = function stringExists(words, text){
var text = text;
var words = typeof words === 'string' ? [words] : words;
var matches = [];
for (i=0; i<words.length; i++){
if (text.toLowerCase().indexOf(words[i].toLowerCase()) != -1){
matches.push(words[i]);
}
}
if (matches.length > 0)... | true |
7c9bb6b5b5dcbe8d9cd99186b86ba4b85d5ace68 | JavaScript | mugas/snippets | /Navbar/app.js | UTF-8 | 441 | 2.578125 | 3 | [] | no_license | const menu = document.querySelector('.hide-menu');
const navbar = document.querySelector('.navbar-hidden');
const containerFour = document.querySelector('.container__four');
/* containerFour.forEach(eachElement => {
console.log(eachElement);
}); */
menu.addEventListener('click', () => {
// menu.classList.toggle('... | true |
837ab1dbb25a1b978b41ea9e4bcefb766ae06101 | JavaScript | CmouseG/jsNative | /js/jsNative.js | UTF-8 | 2,821 | 2.984375 | 3 | [] | no_license | /**
*@description wrap native methods and offer the method to let native call js.
**/
(function() {
function Events(type,target){
this.type = type;
this.target = target;
}
function NativeBridge(){
this.methods = {};
this.events = {
before:[],
after:[],
error:[]
};
}
NativeBridge.BEFORE = "befor... | true |
2ffc037705f17bdce9746089b7cca6a669b5c142 | JavaScript | khadorkin/dshop | /shop/src/utils/useAbout.js | UTF-8 | 726 | 2.5625 | 3 | [
"MIT"
] | permissive | import { useState, useEffect } from 'react'
import useConfig from 'utils/useConfig'
function useAbout() {
const { config } = useConfig()
const [loading, setLoading] = useState(config.about ? true : false)
const [about, setAbout] = useState()
useEffect(() => {
if (config.about) {
setLoading(true)
... | true |
bcb1ce384df406617fbcec80b1da23bd1e88c798 | JavaScript | billbaincodes/JS-Practice-Problems | /problems/15_ip_converter/problem.js | UTF-8 | 568 | 3.328125 | 3 | [] | no_license |
const problemA = (ip) => {
// Your code here
let bigBin = ip.split('.').map(num => Number(num).toString(2)).map(bin => {
for (let i = 0; bin.length < 8; i++){ bin = `0${bin}` }
return bin
}).join('')
return parseInt(bigBin, 2)
}
const problemB = (num) => {
let fourBins = []
let bigBin = num.toStri... | true |
db8d6342197dda16980402a8bd08977aa7af6ddf | JavaScript | k-gn/Javascript-Study | /JSBasic/array.js | UTF-8 | 463 | 4.1875 | 4 | [] | no_license | let students = ['철수', '영희', '영수'];
console.log(students[0]);
console.log(students.length);
students.push('맹구')
console.log(students);
students.pop();
console.log(students);
students.unshift('지혜'); // 배열 앞에 추가
console.log(students);
students.shift(); // 배열 앞에 제거
console.log(students);
for (let i=0; i<students.length; ... | true |
c3a30df4536a4c532671906007deb2f2c57b9f35 | JavaScript | fossabot/captain-spike | /src/app.js | UTF-8 | 859 | 2.546875 | 3 | [
"MIT"
] | permissive | import { existsSync } from 'fs';
import SpikeFinderService from './service/spike-finder-service';
import GitAdapter from './adapter/git-adapter';
import CliAdapter from './adapter/cli-adapter';
export default async function main() {
const repository = getRepositoryOrThrowError();
const gitAdapter = new GitAdapte... | true |
61317cee7906faca7a916c1e357d95c57be36e50 | JavaScript | MaybeRex/InterviewQs | /questions/containerWithWater.js | UTF-8 | 1,363 | 3.78125 | 4 | [
"MIT"
] | permissive | const merge = (left, right) => {
const ans = [];
while (left.length && right.length) {
if (left[0].value < right[0].value) {
ans.push(right.shift());
continue;
}
ans.push(left.shift());
}
ans.push(...left);
ans.push(...right);
return ans;
};
const reverseSort = (list) => {
if (l... | true |
aadd2e76e5fe4dd96fe47228f62580c328c8a7e6 | JavaScript | rafaellemontoya/administracion-core | /src/assets/js/counters.js | UTF-8 | 8,931 | 2.625 | 3 | [
"MIT"
] | permissive |
// -------------------------------------------------------------
// Counter One (Chart)
// -------------------------------------------------------------
(function () {
$('.chart_one').easyPieChart({
//your configuration goes here
easing: 'easeOut',
d... | true |
edcf54fb6c94230c93649552667b0f3a13aff660 | JavaScript | wawrzynmc/SimpleProjects | /1_FormValidation/index.js | UTF-8 | 4,293 | 3.25 | 3 | [] | no_license | // varaibles
const validationCard = document.querySelector('.validation-card');
const messageCard = document.querySelector('.message-card');
const form = document.querySelector('.form');
const inputs = form.querySelectorAll('input');
const submitBtn = form.querySelector('.form__btn-submit');
const showFormBtn = documen... | true |
31e5521978b4e34cc45b707fde7a908f6f3ce174 | JavaScript | shawn-yang-1979/learning-js | /9-use-strict/app.js | UTF-8 | 534 | 3.046875 | 3 | [] | no_license | // Reference: https://www.youtube.com/watch?v=luq6aflInTQ&list=PLTo9PCskHpbHjtO9Dq4gC0DXhoqgCQFSN&index=10
"use strict";// global scope
// gv1 = 1; not allowed in strict mode
var f1 = function () {
"use strict";// function scope
// fv1 = 1; not allowed in strict mode
}
f1();
// var f2 = function (i1, ... | true |
38d524cc41e6860de366e507d7b8bf81e745f7f3 | JavaScript | Leo-Farias/Ceub-DBot | /Ceub-DBot/src/controllers/dificuldade.controller.js | UTF-8 | 764 | 2.921875 | 3 | [
"MIT"
] | permissive | const dificuldades = [
{ name: 'easy_1', min: 1, max: 15 },
{ name: 'easy_2', min: 10, max: 25 },
{ name: 'easy_3', min: 15, max: 35 },
{ name: 'medium_1', min: 20, max: 45 },
{ name: 'medium_2', min: 30, max: 65 },
{ name: 'medium_3', min: 40, max: 70 },
{ name: 'hard_1', min: 50, max: 85 ... | true |
6fefda52da5eb30ea679ff05eeaa00b16c166f54 | JavaScript | Code-Institute-Submissions/Jokes-Quotes | /assets/javascript/quote.js | UTF-8 | 2,525 | 4.0625 | 4 | [] | no_license |
/* The code below creates the dropdown quote-type selector on the homepage, fetches the data from the api and returns a random quote from the relevant tag which displays in the browser.
The data from this quote api identifies the quote types by tags rather than by category.
The exact steps are as follows:
1. T... | true |
c9c4b77081495aed75ecbc135bae92601418cf73 | JavaScript | daoos/ShadowEditor | /src/menu/AssetMenu.js | UTF-8 | 4,277 | 2.546875 | 3 | [
"MIT"
] | permissive | import UI from '../ui/UI';
function AssetMenu(editor) {
var NUMBER_PRECISION = 6;
function parseNumber(key, value) {
return typeof value === 'number' ? parseFloat(value.toFixed(NUMBER_PRECISION)) : value;
}
//
var container = new UI.Panel();
container.setClass('menu');
var ti... | true |
0872ea20f5f56ec2b61e0adf6b7d8cafc02a5883 | JavaScript | cre8labs/creature-threejs | /js/init.js | UTF-8 | 1,716 | 2.765625 | 3 | [] | no_license | $(init);
function init() {
$.getJSON('assets/phoenix/character_data.json', function(data) {
render(data, new THREE.ImageUtils.loadTexture('assets/phoenix/character_img.png'));
});
function render(data, texture) {
var creatureRenderer,
scene = new THREE.Scene(),
camera = new THREE.Perspective... | true |
caa8cd3f0be2f17a5edad6629468feba5b71c11a | JavaScript | rbrionesdev/lifecycle_hooks | /src/Data.js | UTF-8 | 1,027 | 2.984375 | 3 | [] | no_license | import React from "react";
class Data extends React.Component {
state = { data: [], loading: true };
//1. use fetch library (inplace of axios)
//2. use .then .catch syntax (in place of async await)
componentDidMount() {
// axios.get("https://reqres.in/api/users?page=2").then(res =>{}).catch(err=>)
// o... | true |
9b59dfd9cbc944963a63b8d3c44eec1c86008c09 | JavaScript | LinkChenzy/ES6-demo | /source/arrow-function.js | UTF-8 | 1,374 | 4.21875 | 4 | [] | no_license | {
// ES6 箭头函数
let evens = [1, 2, 3, 4, 5];
let odds = evens.map(v => v + 1)
let pairs = evens.map(v => ({
even: v,
odd: v + 1
}))
let nums = evens.map((v, i) => v + i)
console.table([evens, odds, pairs, nums]);
}
{
// ES5
var evens = [1, 2, 3, 4, 5];
var odds = evens.map(function(v) {
r... | true |
bd9d01f7ec35c0ff1d170fc3e69e33b324fb4ee1 | JavaScript | Nastya-Lopatina/goit-react-hw-08-phonebook | /src/components/ContactForm/ СontactForm.js | UTF-8 | 2,205 | 2.609375 | 3 | [] | no_license | import { useState } from 'react';
import { useDispatch,useSelector } from 'react-redux';
import { addContacts } from '../../redux/Contacts/contact-operations';
import {getContacts} from '../../redux/Contacts/contact-selectors';
import Button from '@material-ui/core/Button';
import style from './ContactForm.module.css'
... | true |
8e13b0b021a8fa59af72dd887737804370ba018d | JavaScript | OtakuNekoP/aomaru-bot-pub | /src/_CommandBus.gs | UTF-8 | 597 | 2.875 | 3 | [
"MIT"
] | permissive | function CommandBus() {
this.commands = [];
}
CommandBus.prototype.on = function (regexp, callback) {
this.commands.push({'regexp': regexp, 'callback': callback});
}
CommandBus.prototype.condition = function (bot) {
return bot.update.message.text.charAt(0) === '/';
}
CommandBus.prototype.handle = function (bot... | true |
dda195d4db0c047c60806811fa1ac74e827684b6 | JavaScript | sapandri/proyek_akhir1 | /API/app/models/user.model.js | UTF-8 | 3,460 | 2.734375 | 3 | [] | no_license | //app/models/user.models.js
const sql = require("./db.js");
const User = function (user) {
this.username = user.username;
this.password = user.password;
this.name = user.name;
};
//Mengambil semua data user
User.getAll = result => {
sql.query("SELECT id, username, name, created_at FROM users", (err, res) => {
... | true |
acdaf59036143dd2e2cccd34fe77a11c2fd77525 | JavaScript | sarajlija00/full-gallery | /javascript/user.mjs | UTF-8 | 1,694 | 2.859375 | 3 | [] | no_license | import {hidenInput} from './weather.mjs';
const userDiv = document.getElementById('user');
const userResult = document.getElementById('result')
const errorDiv = document.getElementById('error');
//funkcija koja salje reguest i vraca response
const user = () => new Promise ((resolve, reject) => {
let url = 'https... | true |
f9732e314de8c67efd991fd4c096dde7dcdf042c | JavaScript | josephhyatt/red_line | /src/components/StudentDeals.js | UTF-8 | 3,517 | 2.796875 | 3 | [] | no_license | import React from "react";
import "./StudentDeals.css";
import Card from "react-bootstrap/Card";
import fire from "./Fire";
import CardColumns from "react-bootstrap/CardColumns";
import CarInfo from "./CarInfo";
import { makeStyles } from "@material-ui/core/styles";
//This is for material-ui
const useStyles = makeStyl... | true |
e0b7a94a7827a577815915d6707869fbcac34b3c | JavaScript | clc-252/yougou | /utils/request.js | UTF-8 | 1,714 | 3.03125 | 3 | [] | no_license | /**
* 封装一个异步请求的工具库
* 基于wx.request来实现axios的部分功能
*
* 1.调用返回一个promise
* 例如:
* axios({
* 相关配置
* }).then(res=>{}).catch(err=>{})
*
* 2.配置基准路径
* axios.defaults.baseURL=''
*
* 3.错误拦截
* axios.onError=()=>{}
*/
/**
* 主函数
*
* @params
* 参数 | 类型 | 默认值
* config | Object | {}
*/
const request =(conf... | true |
5db91a72721eb61d8f39491752465ddaff14439b | JavaScript | durad/extension_livereloader | /livereload/timer.js | UTF-8 | 769 | 3 | 3 | [
"MIT"
] | permissive |
var __bind = function(fn, me){
return function() {
return fn.apply(me, arguments);
};
};
function Timer(func) {
var self = this;
self.func = func;
self.running = false;
self.id = null;
self._handler = function() {
self.running = false;
self.id = null;
return self.func();... | true |
a3b40db8f3329072ffbd5ab64ff9c7a9baa62e83 | JavaScript | collab-uniba/scriba | /server/app/models/event.js | UTF-8 | 1,231 | 2.546875 | 3 | [
"MIT"
] | permissive | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Session = require('./session');
// set up a mongoose model
var EventSchema = new Schema({
title: {
type: String,
unique: false,
required: true
},
startDate: {
type: Date,
unique: false,
req... | true |
6ec11b3b960f93b898b3db444a19708f845cc17f | JavaScript | DanieleLee/BoardApp | /BoardExample/utils/utils.js | UTF-8 | 522 | 2.84375 | 3 | [] | no_license | exports.indexOf=function(arr,obj){
var index=-1;
var keys=Object.keys(obj);
var result=arr.filter(function(doc,idx){
var matched=0;
for(var i=keys.length-1;i>=0;i--){
if(doc[keys[i]]===obj[keys[i]]){
matched++;
... | true |
407756326298588dc7af7c42ff26d03f97d4ab2b | JavaScript | fuerinal/lab-express-chuck-norris | /starter-code/app.js | UTF-8 | 821 | 2.609375 | 3 | [] | no_license | /*jshint esversion:6*/
const express = require('express');
const app = express();
const Chuck = require('chucknorris-io');
const client = new Chuck();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/random', (req, res) => {
client.getRandomJoke()
.then((resp) => {
cons... | true |
6b14381b0882f2aee6dea172b38e9240f92856d7 | JavaScript | Alais29/react-book-browser | /src/context/BooksListContext.js | UTF-8 | 2,040 | 2.75 | 3 | [] | no_license | import React, { createContext, useState } from "react";
import { booksSearch } from "./../constants/index";
export const BooksListContext = createContext();
const BooksListContextProvider = ({ children }) => {
// States
const [doneFetchBooks, setdoneFetchBooks] = useState(false);
const [books, setBooks] = useSt... | true |
f5af899ea98a58d4bbb1015f3a978d85b7038bc5 | JavaScript | andrewoetegenn/advent-of-code-2020 | /Day 4/part-two.js | UTF-8 | 1,473 | 3.234375 | 3 | [] | no_license | const fs = require('fs');
const data = fs.readFileSync('./Day 4/input.txt', 'utf8');
const passports = data.split('\r\n\r\n');
const requiredFields = [
{ name: 'byr', isValid: (value) => value >= 1920 && value <= 2002 },
{ name: 'iyr', isValid: (value) => value >= 2010 && value <= 2020 },
{ name: 'eyr', i... | true |
a14df7d6cacab490514be2982618f942f0ef266a | JavaScript | Stranded-Helix/WeatherDashboard | /assets/script.js | UTF-8 | 6,552 | 3.15625 | 3 | [] | no_license | var apiKey = "12fbdc900826981bfac0d2ded9e6d205";
var baseCurrentAPIstring = "https://api.openweathermap.org/data/2.5/weather";
var uvAPIstring = "https://api.openweathermap.org/data/2.5/uvi";
var baseFiveDayAPIString = "https://api.openweathermap.org/data/2.5/onecall";
var currentWeatherEl = $(".current-weather... | true |
d32abc266ae9e3166ae3f7954ad530293aea0354 | JavaScript | tomMoulard/PersonalSite | /Main/animals/istria-1/js/Slickform.js | UTF-8 | 5,609 | 2.75 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | $(document).ready(function(){
/*
* AJAX Section
* This function will handle the contact process through AJAX
*/
$('#slickform').submit(
function slickcontactparse() {
// EMAIL VALIDATION FUNCTION
var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w... | true |
07a3e33bb78da139545e6c943f5d0d1211c422b6 | JavaScript | Ron-Reyes/node-course-2-todo-api | /server/tests/server.test.js | UTF-8 | 7,118 | 2.96875 | 3 | [] | no_license | const _ = require ('lodash');
const expect = require ('expect');
const request = require('supertest');
const {ObjectID} = require('mongodb');
const {app} = require('./../server') // ../server is backing up 1 directory to access the server.js
const {Todo} = require('./../models/todo');
// dummy todo data
const to... | true |
d92b6345ff7dcee7e20cd3ee7c28d64b8b81364b | JavaScript | jugend/test | /test-concepts/test-chained-middlewares.js | UTF-8 | 1,990 | 3.03125 | 3 | [] | no_license | function testSyncMiddlewares() {
console.log('>> Test Sync Middlewares');
var middlewares = [
function() {
console.log('a')
},
function() {
console.log('b')
},
function() {
console.log('c')
}
];
var createMiddleware = ... | true |
e9daddbff291b41a9d165e7240f62ef960fbc0ba | JavaScript | hirogwa/teine | /teine/static/js/utils.js | UTF-8 | 1,926 | 2.75 | 3 | [
"MIT"
] | permissive | var formatTwoDigits = function(n) {
return n < 10 ? '0{}'.replace('{}', n) : n;
};
var formatDate = function(date) {
return 'yyyy-MM-dd'
.replace('yyyy', date.getFullYear())
.replace('MM', formatTwoDigits(date.getMonth() + 1))
.replace('dd', formatTwoDigits(date.getDate()));
};
var for... | true |
fa06fc238a1f78f66eb83437babc074ce5a5b063 | JavaScript | wuhongyang/g3 | /admin/template/js/global.js | UTF-8 | 14,030 | 2.71875 | 3 | [] | no_license | function $(id){
if(id != ''){
return document.getElementById(id);
}
}
function $$(name){
if(name != ''){
return document.getElementsByName(name);
}
}
//把json字串转成json对象
function str2obj(str){
var obj;
try{
obj = eval('('+ str +')');
}catch(e){
obj = {};
}
return obj;
}
/**
* 加载四级科目联动菜单
* @param inte... | true |
ef6681ba54f46a3a4ecd6be1ad7ad2db0b9659de | JavaScript | FerreiraRaphael/EmpresasApp | /lib/helpers.js | UTF-8 | 3,784 | 2.984375 | 3 | [] | no_license | /**
* @module lib/helpers
* @file Export Helpers functions that can be reused.
*/
const jwt = require('jsonwebtoken');
/**
* Transform a Error object in JSON
* @function errorToJSON
* @param {Error | string} error A error object or a string
* @return {{message: string, stack: string} | string} Error transform... | true |
8106622544b4575b623978fd759cf21a2c566b94 | JavaScript | tor114/coders | /modul 4/POZ_FER_S_18_ES6_REACT-master/1_Zadania/Dzien_2/5_export_import/js/task0a.js | UTF-8 | 490 | 2.953125 | 3 | [] | no_license | // npm init -y
// npm i date-fns
// npm install webpack webpack-cli --save-dev
// const { formatDistanceToNow } = require('date-fns');
import { formatDistanceToNow } from 'date-fns';
console.log(formatDistanceToNow(new Date(2019, 4, 5)));
const old = {
a: 1,
b: 2
};
// const oldCopy = old; <-- only indicator
//... | true |
9ccb3e729854a51148f627dfc998dec40b707f62 | JavaScript | epetri/mandatory-uxdesign2 | /JavaScript/lektion/Övningar/lätt/first/script.js | UTF-8 | 370 | 4.625 | 5 | [] | no_license | /*Write a function first that takes an array as argument.
The function should return the first value in the array.
When you're done, write another function last that returns the last value in the array.*/
function first(array){
return array[0];
}
console.log(first([4, 9, 3]));
function last(array){
return array[a... | true |
00a839abb2c7ba2eb5a44c059ee9f5ce9b74f3d9 | JavaScript | autovis/mojave | /common/indicators/MinMax.js | UTF-8 | 1,570 | 2.71875 | 3 | [] | no_license | 'use strict';
// https://github.com/keegancsmith/Sliding-Window-Minimum
define(['lodash', 'lib/deque'], function(_, Deque) {
return {
description: `Get both min and max values over last <period> bars`,
param_names: ['period'],
input: 'num',
output: [['min', 'num'], ['max', 'num']... | true |
1039211969d32303fb6837dbbfd66fb9c8cfbc08 | JavaScript | skoll1/node-learn | /modules/http/daili.js | UTF-8 | 1,898 | 2.640625 | 3 | [] | no_license | // 代理服务器
// 1:提高访问速度:通常代理服务器都会设置一个较大的缓冲区,当有外界的信息通过时,同时也将其保存到缓冲区中,当其他的用户在访问的时候,则由缓冲区直接取出信息,然后传给用户
// 2:控制对内部资源的访问:大学FTP,可以直接使用教育网内地址免费下载各类资源。
// 3:过滤内容,限制对特定计算机的访问,将一种语言的数据翻译成另一种语言,或者防御代理服务器两边的攻击性访问。
// 4:隐藏真实IP,上网者可以通过代理服务器隐藏自己的ip,面授攻击。
// 5:访问外国网站
// 6:突破内容过滤机制的现值,访问被过滤网站。
var http = require('http');
var net = requir... | true |
7f9a1401d61bc66a6c613ad7320142bba47ab7fb | JavaScript | tmshv/2g-test | /src/utils/date.js | UTF-8 | 198 | 2.9375 | 3 | [] | no_license | /**
* Get instance of Date or null.
* @param date
* @returns {*}
*/
export function parseDate(date) {
const d = new Date(date);
const ts = d.getTime();
return isNaN(ts) ? null : d;
} | true |
a9868ec89ef5a789735fe80ccee1797e80b03785 | JavaScript | AdelFattakhova/study-netcracker | /learn-js/25tasks/accumulator.js | UTF-8 | 1,089 | 4.71875 | 5 | [] | no_license | //https://learn.javascript.ru/task/accumulator
// Напишите функцию-конструктор Accumulator(startingValue).
//
// Объект, который она создаёт, должен уметь следующее:
//
// Хранить «текущее значение» в свойстве value. Начальное значение устанавливается в аргументе конструктора startingValue.
// Метод read() использует p... | true |
a8e201b10ced57031f85a8deaa2022c210124e1d | JavaScript | mark182182/django-bug-tracker-frontend | /src/reducers/bugs.js | UTF-8 | 362 | 2.5625 | 3 | [] | no_license | import { ADD_BUG } from '../constants/action-type';
const initialState = {
bugs: []
};
const bugReducer = (state = initialState, action) => {
switch (action.type) {
case ADD_BUG:
return Object.assign({}, state, {
bugs: state.bugs.concat(action.payload)
});
default:
break;
}
r... | true |
df193ee07bcf8bd304c94825e85255de5199e5ab | JavaScript | Fagundesbf/ServidorNode | /Server/src/validators/fluent-validator.js | UTF-8 | 1,114 | 2.703125 | 3 | [] | no_license | 'use strict';
let errors = [] ;
function ValidationContract(){
errors = [];
}
ValidationContract.prototype.isRequired =(value, message) =>{
if (!value || value.length <=0)
errors.push({message: message});
}
ValidationContract.prototype.hasMinLen =(value, min, message) =>{
if (!value || valu... | true |
a5cf68f5a21b4bf424c9a4c3c5312736730bc0ca | JavaScript | austintheriot/algorithms-and-data-structures | /src/Algorithms/General Algorithms/whoWonTicTacToe/whoWonTicTacToe.solution.js | UTF-8 | 1,438 | 4.3125 | 4 | [] | no_license | /*
Implement an algorithm to determine who, if anyone, has won a game of Tic Tac Toe.
Return 'x', 'o', 'draw', or 'unfinished' if no winner is found and the board is incomplete.
*/
const checkCells = (gameArray, rowI, colI, rowInc, colInc) => {
const el = gameArray[rowI][colI];
if (
gameArray[rowI + rowInc]... | true |
5e141e90126cc96909bfb42e6101eb0fe34a8ed3 | JavaScript | Huaaaaaa/blog | /WebContent/static/js/app/common/mouse.js | UTF-8 | 2,137 | 3.078125 | 3 | [] | no_license | /**
* Created by huayingcao on 2016/7/14.
* 鼠标事件
*/
/*onclick()事件:单击按钮时复制文本*/
function copyText() {
var pValue = document.getElementById("p1").innerHTML;
alert(pValue);
document.getElementById("in").value = pValue;
}
/*ondbclick()事件:双击按钮时清空复制的文本*/
function clearText() {
alert("清空文本");... | true |
87203ee084f8f0bda573e915690d0ddf93090ad8 | JavaScript | JordanBourne/HikeDecider | /src/controllers/timeController.js | UTF-8 | 1,703 | 3.046875 | 3 | [] | no_license | const timezoneService = require('../services/timezoneService.js');
const sunsetService = require('../services/sunsetService.js');
const calculateSecondsFromTimestamp = function(timestamp) {
// format must be hh:mm:ss
const hourMinSecond = timestamp.split(':');
return hourMinSecond[0] * 3600 + hourMinSecond[1] *... | true |
94c1b8556f34d5b5faef373cb4dbeda44f2aaca9 | JavaScript | mcdirocco/swe-project | /backend/routes/events.js | UTF-8 | 2,403 | 2.609375 | 3 | [] | no_license | import express from "express";
import Event from '../models/events.js';
import User from '../models/users.js';
import verifyToken from "./auth.js";
const event = express.Router();
// --- Return List of Current events ---
event.get('/', async (req, res) => {
try {
const events = await Event.find();
... | true |
1f22073661c1f903cc1aeaf38244801eb0bbd6e6 | JavaScript | syedrakesh/JavaScript | /01-Fundamentals-Part-1/console.js | UTF-8 | 104 | 2.984375 | 3 | [] | no_license | let js = "amazing";
if (js==='amazing') alert('JavaScript is Fun!');
console.log(12 + 12 + 12 + 12 - 2); | true |
32990ede8ce8fb116d2309ec067bc2623fab9f28 | JavaScript | liangchaofei/fe_blog | /js/29/1.js | UTF-8 | 401 | 3.125 | 3 | [] | no_license | /*
* @Author: your name
* @Date: 2020-02-22 16:22:51
* @LastEditTime : 2020-02-22 16:27:26
* @LastEditors : Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /fe_blog/js/29/1.js
*/
let arr = [1,2,3,4]
let list = [];
arr.forEach(item =>{
list.push(item+1)
})
let aaa = arr.map(item =... | true |
ba042be7a51eed1808a6f91e8452ef5f642588aa | JavaScript | zhoudaqing/aggr-server | /src/storage/influx.js | UTF-8 | 11,944 | 2.53125 | 3 | [] | no_license | const Influx = require('influx')
const { getHms, sleep } = require('../helper')
require('../typedef')
class InfluxStorage {
constructor(options) {
this.name = this.constructor.name
this.format = 'point'
this.lastBar = {}
this.lastClose = {}
this.options = options
}
async connect() {
if... | true |
58b120bd2f4076e9200e3b47ea8f970c641502a1 | JavaScript | VictorIJnr/distbu | /graphql-server/resolvers/types/File.js | UTF-8 | 2,003 | 2.703125 | 3 | [] | no_license | const { s3, myDigiSpace } = require("../../s3");
/**
* Shuffles array in place.
* @param {Array} myArray items An array containing the items.
*/
function shuffle(myArray) {
for (let i = myArray.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[myArray[i], myArray[j]] = [m... | true |
cd3ad94592a56254a0f86b7876a44323861bdd67 | JavaScript | Smiyu-web/miyusetoyama-portfolio | /js/app.js | UTF-8 | 2,996 | 2.5625 | 3 | [] | no_license |
$(document).ready(function() {
$(document).delegate('.open', 'click', function(event){
$(this).addClass('oppenned');
event.stopPropagation();
})
$(document).delegate('body', 'click', function(event) {
$('.open').removeClass('oppenned');
})
$(document).delegate('.cls', 'click', function(event){
... | true |
2cd220cb3a66c3580d0769fcbf9af6ca568a57e4 | JavaScript | liuzhenyang14/liuzhenyang14.github.io | /liuzhenyang14/hw3/简易DOM选择器/dom.js | UTF-8 | 508 | 3.125 | 3 | [] | no_license | function my_section() {
if (typeof arguments[0] == "string"){
if (arguments[0][0] == '#') {
var para = arguments[0].slice(1);
this.element = document.getElementById(para);
}
else if (arguments[0][0] == '.') {
var para = arguments[0].slice(1);
this.element = document.getElementsByClassName(para... | true |
14f032184854b7aa6fd1ae2f1e9330c640cb5a31 | JavaScript | VG90sp/bjs-homeworks | /3.2-array-proto-hocs/task.js | UTF-8 | 1,050 | 3.59375 | 4 | [] | no_license | function sleep(milliseconds)
{
let e = new Date().getTime() + milliseconds;
while (new Date().getTime() <= e) {}
}
function sum(...args) {
// Замедление на половину секунды.
sleep(100); // Можно использовать другое значение замедления.
return args.reduce((sum, arg) => {
return sum += +arg;
},... | true |