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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e09ffde1fa80289a7965fef8749ddba80c8ccc7d | JavaScript | theredfoxfire/kid-holliday-app | /src/helpers/__tests__/formatObjectKeys-test.js | UTF-8 | 962 | 2.546875 | 3 | [] | no_license | import expect from 'expect';
import formatObjectKeys from '../formatObjectKeys';
const {describe, it} = global;
describe('formatObjectKeys test', () => {
it('Should format object keys correctly', () => {
let temp = {
desc: 'asd',
type_land: '1',
bah: 'string',
bih: 123,
};
let o... | true |
90191b1fe92c92aaec8f2dd0d70e9e961c3cdb04 | JavaScript | ReverseDev/redux-lite-example | /components/TodoForm.js | UTF-8 | 842 | 2.71875 | 3 | [] | no_license | import {addTodo} from '../actions/todos';
export function create({store}) {
let form = document.createElement('form');
let inputTextNewTodo = document.createElement('input');
let btnAddTodo = document.createElement('input');
inputTextNewTodo.classList.add('todo-text-new-js');
btnAddTodo.classL... | true |
274cbbff4ccb1bfdbe48e0afc2711f2f58f21abe | JavaScript | balgennady/JS_InSimpleWords | /data-structures/array-methods/task/task05.js | UTF-8 | 312 | 3.40625 | 3 | [] | no_license | //#region Сортировать в обратном порядке
// Как отсортировать массив чисел в обратном порядке?
//#endregion
var arr = [5, 2, 1, -10, 8];
function s(a, b) {
return (a > b) ? -1 : 1;
}
arr.sort(s);
console.log( arr ); // 8, 5, 2, 1, -10 | true |
bc1374b49bbfa23956b5357f17d26d49664f5017 | JavaScript | semenovem/extension-crome-smart_tabs | /src/background/js/browserApi/runtime/onMessage.js | UTF-8 | 3,576 | 2.921875 | 3 | [] | no_license | /**
* @type {object} обмен данными со вкладками
*
* addListener() пописаться
* removeListener() удалить обработчик
*
* из одного события делаем раздельную подписку на события на разных страницах
*
*/
app.browserApi.runtime.onMessage = {
// <debug>
$className: 'browserApi.runtime.onMessage',
/**
... | true |
5fd1b9ae64d4436513f923bf758e9d14a7b9b6c0 | JavaScript | Viet-Hoang-PHAN/monitoring_stage | /assets/js/store/store.js | UTF-8 | 9,055 | 2.546875 | 3 | [] | no_license | import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
import createPersistedState from 'vuex-persistedstate';
Vue.use(Vuex)
/**
*
*/
function initialState () {
return {
sites: [],
vms: [],
gateways: [],
terminals: [],
services: [],
errorsService... | true |
780c4d560e21a2d12eec06d415bd10dde3872e4c | JavaScript | thinkful-ei22/Chasen-bookmarks-app | /scripts/store.js | UTF-8 | 1,444 | 2.9375 | 3 | [] | no_license | 'use strict';
/*global store */
const store = (function () {
const bookmarks = [];
const adding = false;
const ratingfilter = 1;
const error = null;
function validateBookmark(bookmark){
if (bookmark.title.length<1){
this.error = 'Title is Required';
return undefined;
}
else if (bo... | true |
0f18c0145ad5809dd2abd4c96dd6e4b0cf5b3b45 | JavaScript | Marvelous-Adekunle/bubble-shooting-game | /app/math.js | UTF-8 | 1,166 | 2.703125 | 3 | [] | no_license | import { elements } from "./base";
import { bullet } from "./view/bullet";
const { gameContainer } = elements;
export function isCollide(ele1, ele2) {
const ele1Rect = ele1.getBoundingClientRect();
const ele2Rect = ele2.getBoundingClientRect();
return !(
ele1Rect.bottom < ele2Rect.top ||
ele1Rect.top > ... | true |
befd9ef2096e1f2982db63c3b42e38b1e9dff9ff | JavaScript | kevin-smrt/KANBAN-REACT | /app/router.js | UTF-8 | 2,265 | 2.828125 | 3 | [] | no_license | // Récupère la classe Router du module express
const { Router } = require("express");
// Récuperation des différents controllers
const listController = require("./controllers/listController");
const cardController = require("./controllers/cardController");
const tagController = require("./controllers/tagController");
... | true |
b37bd11d90a644806370cdfb3e6130138606eaef | JavaScript | brigil/README-generator | /index.js | UTF-8 | 2,685 | 3.25 | 3 | [
"MIT"
] | permissive | // setting my variables requiring my other files
const inquirer = require("inquirer");
const fs = require("fs");
const generateMd = require("./utils/generateMarkdown");
// passing the questions for the user
inquirer.prompt([
{
type:"input",
message:"What is your Github username?",
name:"Use... | true |
05ca7361893affb7fad5adec694261894e4c0fa7 | JavaScript | mynameismail/dpokedex | /src/store/dex.js | UTF-8 | 1,016 | 2.53125 | 3 | [] | no_license | export default {
namespaced: true,
state: {
pokemons: []
},
mutations: {
updatePokemons(state, payload) {
state.pokemons = payload
}
},
actions: {
async fetchPokemons(context) {
let pokemons = JSON.parse(localStorage.getItem('pokedex')) || []
context.commit('updatePokemons'... | true |
085c739ddceffab6d83cb0694c66076b6d15705a | JavaScript | adriannetubig/FlatPlanet2017-06-29 | /FlatPlanetWeb/Scripts/Angular/Controller/Counter.Controller.js | UTF-8 | 983 | 2.515625 | 3 | [] | no_license | (function () {
'use strict';
angular
.module('App')
.controller('CounterController', CounterController);
CounterController.$inject = ['CounterService'];
function CounterController(CounterService) {
var vm = this;
vm.NumberOfClicks = 0;
vm.Create = Create;
vm... | true |
0bbb13ed9a90a040cf2fb80d13af45c0efdcab08 | JavaScript | deyoung1028/javascrpit | /weatherapp.js | UTF-8 | 1,248 | 3.25 | 3 | [] | no_license | const cityName = document.getElementById("cityName")
const GET_WEATHER_URL = (`https://api.openweathermap.org/data/2.5/weather?q=${cityName.value}&appid=7854a55d120c660937735dcc91b9ec67&units=imperial`)
const getWeatherbtn = document.getElementById("getWeatherbtn")
const weatherInfoDiv = document.getElementById("wea... | true |
ed1b4f3c22a0b7c037de6da10a7604079e904b74 | JavaScript | tengxiaoyang/guest-book | /src/components/DigitalClock.js | UTF-8 | 923 | 2.71875 | 3 | [] | no_license | import React from 'react';
class DigitalClock extends React.Component {
constructor(props) {
super(props)
this.state = {
date: new Date()
}
// this.increaseLikes = this.increaseLikes.bind(this)
}
// increaseLikes() {
// console.log(1234)
// // alert(1234)
// console.log(this)
... | true |
bf71568bf0d1d49c101a21e848af9735cd12bf70 | JavaScript | fab29800/Exercices_JS_OpenClassrooms | /chapitre_3/js/comparaison.js | UTF-8 | 350 | 3.78125 | 4 | [] | no_license | var nombre1 = prompt("Veuillez saisir un premier nombre :");
var nombre2 = prompt("Veuillez saisir un second nombre :");
if (nombre1 > nombre2) {
alert(nombre1 + " est plus grand que " + nombre2);
} else if (nombre1 < nombre2) {
alert(nombre1 + "est plus petit que " + nombre2);
} else {
alert("les valeurs ... | true |
6432341dfa21af89e2f7caf76889a475dd08ef96 | JavaScript | Jacksay/in-the-box | /src/InTheBox.js | UTF-8 | 1,119 | 2.78125 | 3 | [] | no_license | var InTheBox = {
version: "0.0.1",
authors: ["Stéphane Bouvry"],
Color:{
/**
* Convert hexa color to rgba color
*/
hexaToRgba(hexa){
let r = hexa.substr(1,2),
g = hexa.substr(3,2),
b = hexa.substr(5,2),
a = hexa.substr(7,2),
rgba;
r = parseInt... | true |
6223860e9c0e0869196c7a8d7a9a4f9026a1d253 | JavaScript | kromoser/js-advanced-first-class-functions-practice-lab-v-000 | /index.js | UTF-8 | 993 | 3.296875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function logDriverNames(drivers) {
drivers.forEach(function(driver){
console.log(driver.name)
})
}
function logDriversByHometown(drivers, location) {
const matchedDrivers = drivers.filter(function (driver){
return driver.hometown === location;
})
matchedDrivers.forEach(function(driver){
console.l... | true |
14fa8f7915599ef5483d4f534a6da767d5707548 | JavaScript | hinnk/testMuilt | /es6/index2.js | UTF-8 | 2,242 | 4.03125 | 4 | [] | no_license | //默认参数
function add(a, b) {
var b = b || 1;
console.log(a + b);
}
add(1);
function add2(a, b = 1) {
console.log(a + b);
}
add2(2);
//解构赋值
// const obj = {
// a: 1,
// b: 2
// }
// const obj2={
// c:3,
// ...obj
// }
// console.log(obj2);
// const c = obj.a;
// const {a}=obj;
// console... | true |
4169d6403c7e442885ec9f1a8794ebe6f9ec3204 | JavaScript | MattKovtun/flappy-bird-tfjs | /src/Bird.js | UTF-8 | 955 | 2.640625 | 3 | [] | no_license | import config from "./config.js";
class Bird {
constructor() {
this.renderFrame = 0;
this.y = config.bird.startY;
this.x = config.bird.startX;
this.height = config.bird.height;
this.width = config.bird.width;
this.fallingSpeed = config.bird.fallingSpeed;
... | true |
fe1c95c75b5a082709d7d3454312c7df9eacebbb | JavaScript | seanmcquaid/Cracking-The-Coding-Interview | /chapter04/firstCommonAncestor.js | UTF-8 | 750 | 3.671875 | 4 | [] | no_license | class BinaryTree {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
this.parent = null;
}
isAncestor(node2) {
if (this === node2) {
return true;
} else {
let answer1 = false;
let answer2 = false;
if (this.left !== null) {
answer... | true |
7c68c85dea961fdbae4d182d66ed4b6519cca16c | JavaScript | Bshah11/Venture-Forth | /public/javascripts/tokenLayer.js | UTF-8 | 3,067 | 3 | 3 | [] | no_license | /*
let srcDict = {
"goblin" : 'images/unnamed.png'
}
let tokenLayer = new Konva.Layer({
name: 'tokenlayer',
});
*/
// Client side values
//var tokenType = document.getElementById('token-type-button');
// EventListners
var tokenButton = document.getElementById('create-token-button');
var tokenType = document... | true |
c97a182394c3569bef76a420551c0d50be24c6e1 | JavaScript | will42874/javascript-arithmetic-lab-bootcamp-prep-000 | /index.js | UTF-8 | 248 | 2.984375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var a = 10
var b = 5
function add(b) {
a += 15
}
function subtract(b) {
a -= 5
}
function multiplyBy(b) {
a *= 50
}
function divdeBy(b) {
a /= 2
}
function inc(n) {
a += n + 10
}
function dec(n) {
a -= n - 10
}
function makeInt(n) = 10
| true |
2e6aa96f46a411b9a7df6ded989155a5b4e61323 | JavaScript | Sunny-zz/1805 | /es6-demo/index.js | UTF-8 | 6,307 | 4.03125 | 4 | [] | no_license | // es6 语法
// let const
// let
// let 和 var 区别
// let 不能重复声明 不能声明提升 let声明的变量{}为一个作用域
// if (1) {
// let a = 10
// }
// console.log(a)
// const 用来声明常量的 不能被修改
// const pi = 3.1415926
// var a = []
// for (let i = 0; i < 10; i++) {
// a[i] = function() {
// console.log(i)
// }
// }
// a[2]()
// 变量的解构赋值
/... | true |
7ee77c61b915f72958cdf781e30ab8f963d10463 | JavaScript | sihuanian/algorithms_and_data_structures | /lindedList/single_linked_list_test.js | UTF-8 | 4,434 | 3.96875 | 4 | [] | no_license | /*
* @Author: sihuanian
* @since: 2019-08-22 19:55:35
* @lastTime: 2019-08-24 16:35:04
* @message: 单向链表的操作
*/
// 结点
class Node {
constructor(element) {
this.element = element
this.next = null
}
}
// 单向链表的实现
class LinkedList {
constructor() {
// 哨兵,单向链表的头结点 data为空的结点,以减少讨论链表是否为空的... | true |
aca8e599cc12532d654fb62b35fb777da91b2272 | JavaScript | YoneChen/web-experiment | /server/app.js | UTF-8 | 3,423 | 2.53125 | 3 | [] | no_license |
const WebSocket = require('ws');
const port = 8086;
const Game = require('./room');
const Player = require('./player')
const MSG_TYPES = {
playerData: 'PLAYER_DATA',
hostJoin: 'HOST_JOIN',
hostLeave: 'HOST_LEAVE',
playerJoin: 'PLAYER_JOIN',
playerLeave: 'PLAYER_LEAVE',
connected: 'CONNECTED',
... | true |
73983e412a16de3176ecfa08acc9dfb9744254ca | JavaScript | lennwgs/capstoneproject_apt | /static/js/map.js | UTF-8 | 11,875 | 2.828125 | 3 | [] | no_license | $(function(){
console.log("testing");
//apartment information
var apartmentName = [];
var apartmentAdd = [];
var bedNumber = [];
var bathNumber = [];
var rent = [];
var area = [];
var crimeRate = [];
var grocery = [];
var distanceToPurdue = [];
var busStops = [];
var userMaxRent = '';
//rada... | true |
2985da9806b780d4ba0d8223a122b6f24db7b08d | JavaScript | daitoudage/Zero | /Zero.Mvc.Manage/Scripts/base.js | GB18030 | 4,650 | 2.953125 | 3 | [] | no_license | function openParentTab(plugin, url) {
window.parent.openTab(plugin,url);
}
function openParentTabLinkButton(plugin, url, id) {
return "<a href=\"javascript:void(0)\" onclick=\"openParentTab('" + plugin + "-" + id + "', '" + url + "')\">" + plugin + "</a>";
}
//1.3.5汾ȡ
function submitForm1() {
//$.messag... | true |
ffbb27c22045d9fceed870efd1ae00a7d8615b05 | JavaScript | mattcbarker/Project_3-Arcade-Game | /js/app.js | UTF-8 | 9,548 | 3.5625 | 4 | [] | no_license |
var startLoc = [200,400]; //playerstart location
var rightLaneX = 400; //right wall X value
var leftLaneX = 0; //left wall X value
var bottomLaneY = 400; //bottom wall Y value
var topLaneY=60; //top wall Y value
var borderArray=[]; //array that holds all the border bools
var newEnemyY= 55; //new enemy Y location for ... | true |
11eabc1f8ccb448bd6be12145442956f97ff72b3 | JavaScript | Bli-dev/gidatabase | /src/components/SelectedEntity.js | UTF-8 | 3,650 | 2.515625 | 3 | [] | no_license | //REACT AND REDUX
import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
//API AND ACTION
import { entityItemIconURL, flowerOfLifeIconURL } from '../api';
import {fetchItemInfoAction} from '../actions/fetchItemInfoAction'
//STRING CONVERSION
import { stringToDisplay } from '../util';
//STYLE... | true |
cd0383276d791dbb5026022acea89045e35fc6e0 | JavaScript | ojocs/Silver-Knight-Game | /startScreen.js | UTF-8 | 3,704 | 3.03125 | 3 | [] | no_license | var startScreen = {
preload: preload,
create: create,
update: update
}
function preload() {
game.load.image('background', 'Assets/startScreen/Landscape.png');
game.load.image('logo', 'Assets/startScreen/Silver Knight Logo v2.png');
game.load.spritesheet('startButton', 'Assets/startScreen/Start ... | true |
34c882f43750d79d990a0afbe34897f37ddf5aee | JavaScript | chrisveness/geodesy | /vector3d.js | UTF-8 | 8,270 | 3.90625 | 4 | [
"MIT"
] | permissive | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Vector handling functions (c) Chris Veness 2011-2019 */
/* MIT Licence */
/* www.movable-ty... | true |
c57f466712915cebf07094603c49f087d0c98d7e | JavaScript | samikhalildev/COVID-19-Research-Engine | /client/src/components/utils/firstUpper.js | UTF-8 | 253 | 2.953125 | 3 | [] | no_license | const firstUpper = (value) => {
if (typeof value === 'string' && value.length > 0) {
let firstLetter = value.substring(0,1).toUpperCase();
return firstLetter + value.substring(1);
}
return value;
}
export default firstUpper; | true |
7e3c2ee78b5ffd902c154852c4925821d92097de | JavaScript | Nn110315/itGifted2020 | /ESP_Practice/변수.js | UTF-8 | 1,008 | 4 | 4 | [] | no_license | //#region 1 변수
// 1-1. var 변수(var 변수는 함수 스코프)
// 반복문이 끝난 후에도 변수 i가 살아있다.
for(var i=0; i<3; i++){
console.log(i);
}
console.log('i = ', i);
b = 5; // 선언없이 변수 사용 가능
var b = 6; // 변수를 나중에 선언해도 에러 발생 안 함.
var b = 7; // 변수를 재선언해도 에러 발생 안 함.
console.log(b);
//1-2. const, let 변수(블록 스코프)
//const c /... | true |
4708529c78ad89b3ed92fbe8a454ace29e62c7ef | JavaScript | mihretdejong/assignments | /projects/axiosTodo/redoapp.js | UTF-8 | 5,093 | 3.109375 | 3 | [] | no_license | const myTodoDiv = document.getElementById("myTodoDiv")
function getTodo(){
axios.get("https://api.vschool.io/mihretdejong/todo")
.then(response => {
const myTodos = response.data
// console.log(response.data)
appendTodos(myTodos)
})
.catch(error => console.log(error))
}
getTo... | true |
8a5764c5aeecac54689c0ebdeb97a89e860c7ea1 | JavaScript | rdlu/exercism-javascript | /resistor-color-duo/resistor-color-duo.js | UTF-8 | 268 | 2.625 | 3 | [] | no_license | export const colorCode = (name) => COLORS.indexOf(name);
export const decodedValue = (list) => {
return Number(`${colorCode(list[0])}${colorCode(list[1])}`)
};
export const COLORS = ["black","brown","red","orange","yellow","green","blue","violet","grey","white"];
| true |
f2b80ab8be224a5edf9a25b4ae422b38952854a7 | JavaScript | IamClown/swiper | /轮播图/js/index.js | UTF-8 | 3,364 | 2.875 | 3 | [] | no_license | //获取操作的元素
let outer = document.getElementById("outer"),
switer = document.getElementsByClassName("switer")[0],
oUl = document.getElementById("focus"),
oLis = document.getElementsByTagName("li"),
btnLeft = document.getElementById("left"),
btnRight = document.getElementById("right"),
switerTemp = ... | true |
ebc4c6a468d44524464a9b7c8b2bf3b77faa1593 | JavaScript | justha/glassdale | /scripts/facilities/FacilityHtml.js | UTF-8 | 687 | 2.796875 | 3 | [] | no_license | const eventHub = document.querySelector(".container")
const contentTarget = document.querySelector(".container__criminals")
export const facilityHtml = (facilityObj, criminals) => {
return `
<section class="facility__card">
<h3 class="facility__name">${facilityObj.facilityName}</h3>
... | true |
64cf0181afdd4eff6f1025c90e54de643c6cf61a | JavaScript | lixk/easyPushServer | /src/topic.js | UTF-8 | 1,477 | 3.078125 | 3 | [] | no_license | /**
* subscribe a topic
*/
WebSocket.prototype.subscribe = function(topic, callback){
var _this = this;
_this.topics = _this.topics || {};
_this.topics[topic] = callback;
_this.topicQueue = _this.topicQueue || []
_this.topicQueue.push({"topic": topic, "action": "subscribe"}); // put this topic to... | true |
1532234d0ea4d9eeb4253357cea3bc0ad9127b0f | JavaScript | Mrahmed380/Deku-Bot | /commands/prefixes.js | UTF-8 | 1,366 | 2.65625 | 3 | [] | no_license | const Discord = require("discord.js");
const config = require("../botconfig.json")
module.exports = {
name: "setprefix",
category: "Config",
run: async (bot, message, args) => {
if(args.length === 0){
return message.channel.send("Provide a prefix!")
}
//message.author.id != config.ownerID &&
if(message.author.... | true |
6f3ead87aed8a901140fded2d4a7b4a4e7de33e5 | JavaScript | OSU-CS290-Sp18/final-project-final-project-sl | /public/index.js | UTF-8 | 9,399 | 3.5 | 4 | [] | no_license | /*
* Write your client-side JS code in this file. Make sure to add your name and
* @oregonstate.edu email address below.
*
* Name: Savannah Loberger
* Email: loberges@oregonstate.edu
*/
/* Using the addhike function from assignment 5 */
function insertNewHike(hikeName, hikeImg, hikeText, hikeAuthor) {
var... | true |
436a64e31bd8d6b0301ddcdbc5ae4a796381633e | JavaScript | VoodooSV/leetcode-problems | /array/238.ProductOfArrayExceptSelf.js | UTF-8 | 1,681 | 4.09375 | 4 | [] | no_license | /*
https://leetcode.com/problems/product-of-array-except-self/
238. Product of Array Except Self
Medium
Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
Example:
Input: [1,2,3,4]
Output: [24,12,8,6]
Note... | true |
3f9be7a345b1e38a65cf7fbf11a8b007cdc3677e | JavaScript | bibixx/EasySettings | /src/js/actions/EasySettingsMovementManager.js | UTF-8 | 1,628 | 2.8125 | 3 | [
"MIT"
] | permissive | let zIndex = 0;
export default class EasySettingsMovementManager {
static getCurrentZIndex() {
return zIndex++;
}
constructor( panel, header ) {
this.panel = panel;
this.header = header;
this.visible = false;
this.startPos = {
x: 0,
y: 0,
};
this.startPosOfPanel = {
... | true |
35906b776ba01322d6546d3d3188d5f08d33bad5 | JavaScript | FBek90/algorithm-practice | /trap_rain_water.js | UTF-8 | 1,406 | 3.96875 | 4 | [] | no_license | /*
42. Trapping Rain Water
Hard
9526
145
Add to List
Share
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
Example 1:
Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
Explanation: The above elevation map (black ... | true |
af9306e2da1692bec5f35497cb994f28cd78c769 | JavaScript | BrunnoQ/projetosJsNodeJS | /nodejs/introducao-nodejs/src/config/custom-express.js | UTF-8 | 704 | 2.984375 | 3 | [] | no_license | /**
* Neste modulo vamos encapsular o modulo EXPRESS de modo que somente a partir deste
* arquivo o EXPRESS seja referenciado, evitando que trechos de codigo se repitam
* em demasia e aumentando a coesao dos modulos, ou seja, cada arquivo com uma
* responsabilidade!
* Funcionara como um controler de merda.
*/
//... | true |
5f2d4a43e5de5a11333105969063b7678d8ce44b | JavaScript | berinaptula/Real-Estate-Website | /src/filtering.js | UTF-8 | 5,088 | 3.203125 | 3 | [] | no_license | import adsArr from "./ads"
import moment from 'moment'
// The initial filters for the properties
var filters = {
type: 'all',
price: 0,
priceMax: 99999999,
adress: '',
published: null,
city: '',
postcode: '',
floorArea: 999999999,
plotArea: 999999999,
rooms: 99999999,
const... | true |
b1d75abf82601a547d3bb068be2cc422907945ec | JavaScript | dominicdaviescodes/day14 | /app.js | UTF-8 | 206 | 2.71875 | 3 | [] | no_license | // button
const toggle = document.getElementById('toggle');
// nav
const nav = document.getElementById('nav');
// listen for a click
toggle.addEventListener('click', () => nav.classList.toggle('active'));
| true |
29324f1c3d73e101f60320fc6a85b08c1d84d7fb | JavaScript | kesheng/ShoppingCartComponent | /ShoppingCart/utils/customHooks.js | UTF-8 | 889 | 2.59375 | 3 | [] | no_license | import { useState, useEffect, useRef } from 'react'
export const useComponentWillMount = (fn) => {
const firstLoad = useRef(true);
if (firstLoad.current) {
fn();
}
firstLoad.current = false;
};
export const useComponentWillUpdate = (fn) => {
const firstLoad = useRef(true);
... | true |
0cedc64560dc4f7908ac458393383add70eaf854 | JavaScript | andresin87/ramlAPIv1 | /lib/utils.js | UTF-8 | 547 | 2.8125 | 3 | [] | no_license | /** @module utils */
'use strict';
var traverse = require('traverse');
/**
* Helper function to pretty-print RAML documents
* @arg ramlObj object containing the RAML document
* @returns string version of the RAML object
*/
function prettyJsonRaml(ramlObj) {
return JSON.stringify(traverse(ramlObj).map(function (... | true |
f950b6bf4e44670d85340c55cb06e71e244838bd | JavaScript | scadick/Organ_Donation | /js/video.js | UTF-8 | 317 | 2.71875 | 3 | [] | no_license | (function() {
"use strict";
function playPause(btn, vid) {
var vid = document.getElementById(vid);
if(vid.paused){
vid.play();
btn.innerHTML = "PAUSE";
} else{
vid.play();
btn.innerHTML = "PLAY";
}
playPause.addEventListener('click', playpausebtn, false);
}
})();
| true |
8f04f9e66512b42ef29a7ffb7ae7be4f917c3dfb | JavaScript | kpodlaski/CordovaGamesDesign | /chapters/code_samples/chapter_cordova_with_dereks_code/js/StaticImage.js | UTF-8 | 701 | 3.390625 | 3 | [] | no_license | /* Author: Derek O Reilly, Dundalk Institute of Technology, Ireland. */
class StaticImage extends GameObject
{
/* Each gameObject MUST have a constructor() and a render() method. */
/* If the object animates, then it must also have an updateState() method. */
constructor(image, x, y, width, height)... | true |
fadd756fbc57f8f6c5905845d9c9f3915c52b48d | JavaScript | Tom-bai/bibao | /src/providers/date.js | UTF-8 | 1,668 | 3.25 | 3 | [] | no_license | /**
* 时间时间函数的拓展
*/
// 时间格式化 format=yyyy-MM-dd h:m:s
Date.prototype.format = function (format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours()<10?'0'+this.getHours() : this.getHours(),
"m+": this.getMinutes()<10?'0'+this.getMinutes() : this.getM... | true |
a95610cdbee37062477470e1bffb7af383048e6e | JavaScript | pacocontrerasdct/Animal_Shelter_Mongoose | /app/public/js/shelter.js | UTF-8 | 4,105 | 3 | 3 | [] | no_license | // Namespaces
var Animal = Animal || {};
var View = View || {};
$(document).ready(function() {
Animal.all();
View.initialise();
})
View = {
initialise: function() {
$('#animal-form').on('submit', function(e) {
e.preventDefault();
Animal.create($(this).serialize())
})
$('#animalTemplate-... | true |
42555df3ecae305a068d19ba31e0da1e0ae407f6 | JavaScript | grindos/js-interview-tasks | /prototype-inheritance/search-algorithm.js | UTF-8 | 1,232 | 3.8125 | 4 | [] | no_license | /*
1) Add __proto__ property to these objects to make the search next way:
pockets -> bed -> table -> head
Examples:
pockets.pen == 3
bed.glasses == 1
table.money == undefined
2) How to search for glasses faster: pockets.glasses or head.glasses?
let head = {
glasses... | true |
59b9078f9f6ec67b787a684ad9fbcd5e3d1a6dc8 | JavaScript | danfuzz/mimu | /triangle-wave-explorer/Piece.js | UTF-8 | 8,238 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2015-2023 the Mimu Authors (Dan Bornstein et alia).
// SPDX-License-Identifier: Apache-2.0
import { AudioGenerator } from '../lib/AudioGenerator.js';
import { PieceParams } from './PieceParams.js';
/**
* How many "subsamples" to produce per actual sample output. This is done
* in order to reduce aliasi... | true |
77bdb9d69ce56a988fa8570c8bc0dd5c3165f339 | JavaScript | piotrduperas/daftup-recruitment-tasks | /3.js | UTF-8 | 830 | 3.078125 | 3 | [] | no_license | (function(){
let data = ["Walmart",
"State Grid",
"Sinopec Group",
"China National Petroleum",
"Royal Dutch Shell",
"Toyota Motor",
"Volkswagen",
"BP",
"Exxon Mobil",
"Berkshire Hathaway"
]
let filterTable = function() {
let filterInput = document.querySelector(".filter__input");
if(filterInp... | true |
6c51defa090e50fe633b8f9d7bc2235d596cbc1b | JavaScript | lewiswhitehill/lewiswhitehill.github.io | /art.js | UTF-8 | 481 | 3.078125 | 3 | [] | no_license | let a;
let b;
let c;
let d;
let r,g,blue2;
function setup() {
createCanvas(400, 400);
background("white")
a = random(400)
b = random(400)
c = random(400)
d = random(400)
myColors = ["red", "blue", "yellow", "white"]
for(var i=0;i<20;i++){
a = random(400)
b = random(400)
c = random(400)
d = random... | true |
3111677cae090e1cfea275052633d81bd6d56d82 | JavaScript | jmtalarn/standalone-store | /src/vanilla-counter.js | UTF-8 | 928 | 3.015625 | 3 | [] | no_license |
export default class VanillaCounter {
constructor(elId, state, actions) {
this.element = document.getElementById(elId);
Object.assign(this.element.style, {
display: 'flex',
margin: '0 auto',
maxWidth: '50%',
alignItems: 'center',
justifyContent: 'space-around',
});
this.... | true |
dcae6c13c09c762623efa540c65e9f66fa99f4f8 | JavaScript | Awkes/Grave-Robbert | /src/hooks/useWindowResize.js | UTF-8 | 644 | 2.71875 | 3 | [
"0BSD"
] | permissive | import React, { useEffect } from 'react';
/*
Usage: useWindowResize(callback, dependencies);
dependencies is optional and if used it's accessable
as the first argument in the callback function.
*/
const useWindowResize = (callback, dependencies = null) => {
if (typeof callback !== 'function')
throw('use... | true |
94fd629f2ce145f7f6ea4a99502f6037fd7b4983 | JavaScript | marco-c/gecko-dev-comments-removed | /testing/web-platform/tests/webidl/ecmascript-binding/class-string-named-properties-object.window.js | UTF-8 | 714 | 2.953125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | "use strict";
const namedPropertiesObject = Object.getPrototypeOf(Window.prototype);
test(() => {
assert_own_property(namedPropertiesObject, Symbol.toStringTag);
const propDesc = Object.getOwnPropertyDescriptor(namedPropertiesObject, Symbol.toStringTag);
assert_equals(propDesc.value, "WindowProperties", "value... | true |
f3d182348e8f8cfd15c5555207c05f5ecf8017ca | JavaScript | macherel/PiMP | /www/main.js | UTF-8 | 2,375 | 2.953125 | 3 | [] | no_license | "use strict";
/**
* Dispatch browser Event with name "pimp:<name argument>".
* If args isn't undefined a CustomEvent with "args" argument for detail is used.
* @param name suffix event name. "pimp:<name argument>"
* @param args (optional) custom event detail if set
*/
function sendEvent(name, args) {
let event;
... | true |
0a479c9e5f2496cd6880d36242fd6e0c498c8a84 | JavaScript | CryHavok01/tv-shows-review-site | /client/src/components/EditShowForm.js | UTF-8 | 2,348 | 2.578125 | 3 | [] | no_license | import React, { useState } from "react"
import ErrorList from "./ErrorList"
import translateServerErrors from "../services/translateServerErrors"
const EditShowForm = ({ showId, userId, handleEditShow }) => {
const [editShow, setEditShow] = useState({
name: "",
description: "",
})
const [errors, setErro... | true |
35e8cf83b9f2f03da021f502c9cabab976bc1388 | JavaScript | Dro1de1/StyleChanges | /main.js | UTF-8 | 2,307 | 2.75 | 3 | [] | no_license | var changeHeader = (n) => {
document.getElementById("stylesheetNice").attributes.href.nodeValue = "stylesheets/headerV" + n + ".css";
/*
document.children[0].children[0].children[5].attributes.href.nodeValue = "stylesheets/headerV" + n + ".css";
*/
}
var changeColorTheme = (n) => {
/*
document.c... | true |
1c53a336b45c82d3180acb776ec1b85fb61a2c53 | JavaScript | rramphal/browser-customizations | /bookmarklets/dumpLinks.js | UTF-8 | 214 | 2.53125 | 3 | [] | no_license | javascript:(
function () {
/* Logs all links in the console. */
const links = Array.from(document.links).map(function (link) {
return link.href;
}).join('\n');
console.log(links);
}
)();
| true |
cd4cb3127107fc073f4754163b30a77fe22a165c | JavaScript | sivakusayan/visual-graham-scan | /src/algorithm/utils/getDistance.js | UTF-8 | 175 | 2.734375 | 3 | [] | no_license | const getDistance = (firstPoint, secondPoint) => Math.sqrt(
(((firstPoint.x - secondPoint.x) ** 2) + ((firstPoint.y - secondPoint.y) ** 2)),
);
export default getDistance;
| true |
712e606d0208abab2db53002d99ed430ce445b70 | JavaScript | giova2/forecast-page | /src/reducers/reducer_location.js | UTF-8 | 486 | 2.640625 | 3 | [] | no_license | import { SET_LOCATION } from "../actions/index";
export default function (
state = {
city: "Rosario",
cityAlt: null,
country: "Argentina",
countryCode: "ar",
},
action
) {
switch (action.type) {
case SET_LOCATION:
return {
...state,
city: action.payload.city,
ci... | true |
ff0aa0a4f676d7fde6074a65415350cf5d2be0bb | JavaScript | WilliamMD/live_code_01 | /2.js | UTF-8 | 1,099 | 3.65625 | 4 | [] | no_license | function stringToArray(str){
let result = [];
let temp = "";
for (let i = 0; i < str.length; i ++) {
if (str[i] !== " ") {
temp += str[i].toLowerCase();
} else {
result.push(temp);
temp = "";
} if (i === str.length - 1) {
result.push(te... | true |
eefe87a502adff3cc73716d1cfe4fd8cacf9e716 | JavaScript | bambookTeam/proyecto | /base/public/js/controlador_enviar_solicitud_libreria.js | UTF-8 | 8,580 | 2.90625 | 3 | [] | no_license | 'use strict';
let obtenerListaUsuarios = async (pcorreo) => {
usuarios = await obtenerUsuarios();
console.log(usuarios);
};
var usuarios = [];
usuarios = obtenerListaUsuarios();
const boton_registrar = document.querySelector('#btn_registrar');
const input_nombre_comercial = document.querySelector('#txt_nom... | true |
4eb37e1104aa70df2d5501be95574ce26307c210 | JavaScript | padliyulian/vanillaJS | /basic/jsCardio/index.js | UTF-8 | 248 | 3.421875 | 3 | [] | no_license | function evenOddSums(arr) {
let even = 0;
let odd = 0;
arr.map(val => {
if (val % 2 === 0) {
even += val;
} else {
odd += val;
}
});
return [even, odd];
}
console.log(evenOddSums([10, 20, 10, 11, 21, 11, 10]));
| true |
d8844eeb2a6593cf5534d9bdd155d6ebaac2ba83 | JavaScript | sinulingga23/MovieOverview | /src/script/client/api-movie.js | UTF-8 | 1,025 | 2.6875 | 3 | [] | no_license | class MovieSource {
static firstTime() {
return fetch(`https://api.themoviedb.org/3/trending/all/day?api_key=ef3b05661c062be2c9995a3772dff905`)
.then(response => {
return response.json();
})
.then(responseJson => {
if (responseJson.results) {
retur... | true |
d636e43d1f95260fdecf328797b905e2ffe0033c | JavaScript | jarhill0/pumpkinman | /src/static/recording.js | UTF-8 | 681 | 2.78125 | 3 | [
"MIT"
] | permissive | const startButton = document.getElementById('startRecordingButton');
const stopButton = document.getElementById('stopRecordingButton')
function startRecording() {
webSocket.send('{"record":"start"}')
startButton.disabled = true;
stopButton.disabled = false;
}
function stopRecording() {
webSocket.send(... | true |
2423a6be0b0302b3c6a782b606146f24a3619fd9 | JavaScript | ironunicorn/asteroids | /lib/ship.js | UTF-8 | 3,473 | 2.71875 | 3 | [] | no_license | !function () {
var Asteroids = window.Asteroids = window.Asteroids || {};
var Ship = Asteroids.Ship = function (options) {
Asteroids.MovingObject.call(this, options);
this.pos = [this.game.DIM_X / 2, this.game.DIM_Y / 2];
this.vel = [0, 0];
this.direction = - Math.PI / 2;
this.fire = true;
};... | true |
0cf7c4eacf984fa1b7da4eafa79e84aae471dd9c | JavaScript | ThomasKassa/Acme-Product-Offerings | /app.js | UTF-8 | 1,034 | 3.0625 | 3 | [] | no_license | const getData=()=>{
let products = fetch("https://acme-users-api-rev.herokuapp.com/api/products");
let companies = fetch("https://acme-users-api-rev.herokuapp.com/api/companies");
let offerings = fetch("https://acme-users-api-rev.herokuapp.com/api/offerings");
const allResponses = Promise.all([products,companies,offeri... | true |
f95bb5163d5fac3edbba076e86bf0a4867173e2a | JavaScript | Murphh/js-calc | /js/app.js | UTF-8 | 2,554 | 4.21875 | 4 | [] | no_license | window.onload= function(){
do {
var quit = false;
var toQuit = prompt("Would you like to use the calculator or quit(1)");
if(toQuit == "1"){
quit = true;
}else {
var val1, val2, operand;
console.log("----- NEW CALCULATION ------");
var menuOption = prompt("Would you like standa... | true |
3afa9c4c51f32360db64c9ec904bc7e5c397e90e | JavaScript | KhaiZhang/pre-pos | /practice/section-3/practice-3.js | UTF-8 | 740 | 2.9375 | 3 | [] | no_license | 'use strict';
function createUpdatedCollection(collectionA, objectB) {
var collectionC=[];
for(let i=0;i<collectionA.length;i++){
var index=true;
for(let j=0;j<collectionC.length;j++){
if(collectionA[i]==collectionC[j].key){
collectionC[j].count++;
index=false;
break;
}
... | true |
21796b4bae131d0696f22d8c9587aecd85a44c42 | JavaScript | GregHattJr/ZOIACheatsheet | /stuff.js | UTF-8 | 408 | 2.59375 | 3 | [] | no_license | function hideShow(cl) {
var a = document.getElementsByClassName(cl);
if(a[1].style.display != 'none'){
for (var i=0; i<a.length; i++)
a[i].style.display = 'none';
}else{
for (var i=0; i<a.length; i++)
a[i].style.display = 'inline-block';
}
}
document.onkeydown = function(evt) {
evt = evt || win... | true |
60eb60b684e60941747462fd01aaae776381cfbe | JavaScript | Juliannewood2413/Team-generator-hw | /lib/Employee.js | UTF-8 | 1,491 | 3.15625 | 3 | [] | no_license |
class Employee {
constructor(name, id, email) {
this.name = name;
this.id = id;
this.email = email;
}
getName(){
return this.name;
}
getId(){
return this.id;
}
getEmail(){
return this.email;
}
getRole(){
return "Employee";
... | true |
2072b2753260736d621a2b079ca6ca67b4334d87 | JavaScript | phamphanbang/RGT-webbase | /JS/HomeController.js | UTF-8 | 4,175 | 2.765625 | 3 | [] | no_license | var allData = [];
let renderAllProduct = () => {
fetch('http://localhost:3000/product')
.then(response => {
if(!response.ok){
throw Error('ERROR');
}
return response.json();
})
.then(data => {
console.log(data);
allData=data;
const html = data... | true |
46e0af6bec19d3fa2e69c6ec27a9adb70287f99a | JavaScript | maransowthri/redux-app | /redux-demo.js | UTF-8 | 763 | 2.953125 | 3 | [] | no_license | const redux = require("redux");
const INC_COUNTER = "INC_COUNTER";
const DEC_COUNTER = "DEC_COUNTER";
const initState = {
counter: 0,
};
const couterReducer = (state = initState, action) => {
switch (action.type) {
case INC_COUNTER:
return {
...state,
counter: state.counter + 1,
}... | true |
8796ad599a2e0d05548d34db857181c840435b4b | JavaScript | jsdelivrbot/ac-node-march-18 | /code/A-javascript/js-es5/scope/module_pattern/news/js/news.js | UTF-8 | 1,129 | 2.765625 | 3 | [
"MIT"
] | permissive |
var news = {}
//news.events = _.extend( {}, Backbone.Events );
news.view = function() {
function drawStory( o ) {
var panel = $("<section>", { class:"panel"}).appendTo(".news");
$("<img>", { src: "media/" + o.image}).appendTo(panel );
$("<h2>", { class:"headline", text:o.headline }).appendTo(panel );
... | true |
107cd993a40541aa0688ed293f03b89c81ddc64d | JavaScript | gbdb71/tumble-fish_js | /game.js | UTF-8 | 36,391 | 2.59375 | 3 | [] | no_license | // string replace util
String.prototype.replaceAt = function(index, char) {
return this.substr(0, index) + char + this.substr(index + char.length);
};
// find element by id/class/tag
var $ = function(a, b) {
a = a.match(/^(\W)?(.*)/);
return (b || document)["getElement"
+ (a[1] ? a[1] == "#" ? "ById" : "s... | true |
1ba91c01721f1c72e509233fb74c6f75070db845 | JavaScript | zwc/adventofcode2016 | /day04/task2.js | UTF-8 | 941 | 2.953125 | 3 | [] | no_license | const fs = require('fs');
const R = require('ramda');
const lines = fs.readFileSync('./input.txt').toString().split('\n');
const test = [
'aaaaa-bbb-z-y-x-123[abxyz]',
'a-b-c-d-e-f-g-h-987[abcde]',
'not-a-real-room-404[oarel]',
'totally-real-room-200[decoy]'
];
const getName = (str) => str.split('-').slice(0, -1)... | true |
f42fe9fc35d84b7a6a48f5e119adc54054b7ffe4 | JavaScript | Revadike/fnbr.js | /src/util/Meta.js | UTF-8 | 2,251 | 3.4375 | 3 | [
"MIT"
] | permissive | /**
* Represents a meta structure used for parties
* @private
*/
class Meta {
constructor() {
this.schema = {};
}
/**
* Sets a value
* @param {string} prop The property
* @param {*} val The value
* @param {boolean} isRaw Whether the value is raw or not
* @param {boolean} isObject Whether th... | true |
e42007073620ad15377cce9d7178b9e221675cf1 | JavaScript | yinweiwu/LhErpPub | /ZSERP/JinBian1/mscomm32/JScript.js | UTF-8 | 1,226 | 3.296875 | 3 | [] | no_license |
function OpenPort() {
if (MSComm1.PortOpen == false) {
MSComm1.PortOpen = true;
}
else {
window.alert("已经开始接收数据!");
}
}
function ClosePort() {
if (MSComm1.PortOpen == true) {
MSComm1.PortOpen = false;
}
else {
window.alert("串口已经关闭!");
}
}
function St... | true |
77dd19c5d897ec76509b3beded9164f80bfafe39 | JavaScript | kwalx/HTML-Codding | /Matvii_Kovtun/visualise_complexity/src/complexity.js | UTF-8 | 2,365 | 3.15625 | 3 | [] | no_license | //TODO: rename entry point
import MyNumber from "./Number";
import {getRandom} from "./utils";
import GoodAlgo from './GoodAlgo';
import {K, MARGINFROMSIDES, NUMBEROFNUMBERS} from './consts';
import BadAlgo from "./BadAlgo";
class Complexity {
// TODO: rename Complexity
// TODO: pass DOM node, instead of sel... | true |
ea456f6f03fbc5fb827256f1afff12983dfaf4cb | JavaScript | largobox/project_h | /2_algorithms/1_task.js | UTF-8 | 3,245 | 3.625 | 4 | [] | no_license | /*
1.
Про подход
- Задача легче всего мыслится в категорях ООП, оптимальнее ее именно в ООП делать
- В функциональном стиле тоже можно, но с состояниями не так удобно будет работать
- А вот в процедурном никогда не писал, немного почитал про него,
интересно фидбэк именно по нему получить,
поэтому попробовал ... | true |
ca88d28fbc248950f8446b574d5d500fa29858ea | JavaScript | zackbloom/img_to_gmaps | /static/map.js | UTF-8 | 1,571 | 3.046875 | 3 | [] | no_license | var mine_type_options = {
getTileUrl: function(coord, zoom){
var normal_coord = getNormalizedCoord(coord, zoom);
if (!normal_coord)
return null;
var bound = Math.pow(2, zoom);
return '/static/cart_imgs/' + zoom +
'/' + normal_coord.y +
'/' + norm... | true |
ef7192a6135e79f2aa7c49ce5c27e01823dbf9b0 | JavaScript | Spacefox123/What-s-the-weather-like-in... | /src/containers/App.js | UTF-8 | 1,168 | 2.78125 | 3 | [] | no_license | import React, {useEffect, useState } from 'react';
import Title from '../components/Title'
import Weatherdisplay from '../components/Weatherdisplay'
import Footer from '../components/Footer'
import 'tachyons'
import './App.css';
const App = () => {
const [input, setInput] = useState('')
const [weatherData, set... | true |
18ea63316cd90808d3aee26b9c93896e6b5cfe44 | JavaScript | jericvargas/BackgroundGenerator | /app.js | UTF-8 | 617 | 2.65625 | 3 | [] | no_license | let pageBG = document.querySelector('body');
let firstColor = document.querySelector('#first-color');
let secondColor = document.querySelector('#second-color');
let bgColorProperty = document.querySelector('.bg-color-text');
let colorInputs = document.querySelectorAll('input');
for (let inputs of colorInpu... | true |
5bc1aee921a9e3cc0dd4ca91df3b6de92b6397ea | JavaScript | KeelerBe/kanban | /router.js | UTF-8 | 2,244 | 2.53125 | 3 | [] | no_license | const express = require('express')
const fs = require('fs')
const path = require('path')
const router = express.Router()
const DATA_FILE = path.join(__dirname, 'tasks.json')
router.get('/tasks', (req, res) => {
fs.readFile(DATA_FILE, (err, data) => {
res.json(JSON.parse(data))
})
})
router.post('/tasks', (req, r... | true |
b602620875184a3e634e3ee42bfc99e2135009c0 | JavaScript | vigneshbalaram/MyJavascript | /trelloV2.js | UTF-8 | 666 | 3.265625 | 3 | [] | no_license | let myTodos ={
name : 'Vignesh',
day:'Monday',
meeting : 0,
meetDone :0 ,
addMeeting : function(meet){
this.meeting = this.meeting + meet
},
addSummary : function(){
return `Hi ${this.name} have ${this.meeting + this.meetDone} meetings for today`
},
meetingDone : fun... | true |
db56f21515b17e09951e9282ee9a9e95c591e08d | JavaScript | PowerCoders-Milan/js-objects-and-functions-zamanbhutta | /ex-6/exercise.js | UTF-8 | 467 | 4.15625 | 4 | [] | no_license | // write your JS here
// remember to always test in the browser
// to see if everything works correctly
function greaterNum(num1, num2) {
if(num1 > num2){
window.alert("The greater number of " + num1 + " and " + num2 + " is " + num1)
}else if(num2 < num1){
window.alert("The greater number of " ... | true |
8c1cfca2782581dd066592ebf7bf17fbb21d76fe | JavaScript | esraamalkawi/movie-list | /movielist/src/components/WatchedList.js | UTF-8 | 537 | 2.53125 | 3 | [] | no_license | import { useSelector } from "react-redux";
import TaskItem2 from "./MovieItem2";
import { useState } from "react";
const FinishedList = () => {
const [query, setQuery] = useState("");
const tasks = useSelector((state) => state.tasks);
const task = tasks
.filter((task) => task.name.toLowerCase().includes(quer... | true |
203703298befe8eab4094f049f59940072e925b8 | JavaScript | 2019-B-GR1-JS/js-chancusig-chancusig-jairo-david | /01 - Javascript/02-objetos.js | UTF-8 | 1,057 | 4.0625 | 4 | [] | no_license | // 02-objetos.js
// let const
// -> INMUTABLES (NO CAMBIA)
// no puede ser REASIGNADO
const arregloNumber = [1, 2, 3, 4];
// arregloNumber = ["a", "b", "c"];
// arregloNumber = [true, false, true, true];
// arregloNumber = [1, "a", true, false];
// arregloNumber = 1;
// val arregloKotlin:any = [1,true,"a"];
/*
function... | true |
4a92b89d08839a078c1383ffea58dbc5e2ea008b | JavaScript | zinxon/workshop2_lab | /lab3/lab3/api/controllers/PersonController.js | UTF-8 | 3,609 | 2.71875 | 3 | [] | no_license | /**
* PersonController
*
* @description :: Server-side logic for managing People
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
// create function
create: function (req, res) {
if (req.method == "POST") {
Person.create(req.body.Person).exec(funct... | true |
0a9ac3ccbe11bb247eb8b43955fe84eca62deb70 | JavaScript | educoder/Pikachu | /app.js | UTF-8 | 3,282 | 2.640625 | 3 | [] | no_license |
/*jshint node:true */
"use strict";
var express = require('express'),
http = require('http'),
path = require('path'),
fs = require('fs'),
_ = require('lodash');
var app = express();
var DATA_DIR = path.join(__dirname, 'public');
app.configure(function(){
app.set('port', process.env.PORT || 2596);
app.... | true |
ed13ffc442856157809086557273ca1b0b7ed177 | JavaScript | js-tasks-ru/nodejs-20200204_silksofthesoul | /4-module/2-task/server.js | UTF-8 | 3,535 | 2.546875 | 3 | [] | no_license | const url = require('url');
const http = require('http');
const path = require('path');
const fsp = require('fs').promises;
const {
createWriteStream,
unlinkSync,
} = require('fs');
const server = new http.Server();
const obj = {
MAX_BYTE: 1048576,
totalBytes: 0,
filepath: '',
};
obj.responses = (ctx) => ... | true |
e8ceedd3693c97707e26c03760a46ad37f5c44ec | JavaScript | xcqweb/pujiang | /src1/common/ww.js | UTF-8 | 4,469 | 2.515625 | 3 | [] | no_license | import CryptoJS from "crypto-js"
import Vue from 'vue'
;(function () {
function json2url(json){
json.t=Math.random();
var arr=[];
for(var name in json){
arr.push(name+'='+json[name]);
}
return arr.join('&');
};
//json
// type:'GET',
// url:this.apiData.url, API
// dataType:'j... | true |
f8db75aa16d9f042095290a4580aaaf6ca7c2933 | JavaScript | Arixka/Katas | /Algoritmos/InsertionSort.js | UTF-8 | 763 | 4.03125 | 4 | [] | no_license | // Ordenacion por insercion(swap=intercambio). recorre el array y va colocando cada elemento en su sitio correcto,
let arr = [11, 3, 44, 81, 3, 5, 1, 136, 22]
const insertionSort = arr => {
for (let i = 1; i < arr.length; i++) {
for (let j = i; j > 0 - 1; j--) {
if (arr[j-1] > arr[j ]) {
[arr[j-1], arr[j]]=... | true |
cb9c398cbe7c68fe4123167e27842f8a47438377 | JavaScript | Nimisha94/peddakam-nimisha-webdev | /assignment/services/website.service.server.js | UTF-8 | 3,545 | 2.640625 | 3 | [] | no_license | var app=require('../../express');
var websiteModel=require('../model/website/website.model.server');
var websites=
[
{ "_id": "123", "name": "Facebook", "developerId": "456", "description": "Lorem" },
{ "_id": "234", "name": "Tweeter", "developerId": "456", "description": "Lorem" },
... | true |
569c2d80a89436066701d8cef9093ecefcec93c4 | JavaScript | OpsLabJPL/neuralyzer | /reducers/serverReducer.js | UTF-8 | 1,385 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive |
const uuid = require('uuid/v4');
const { Server } = require('../actionTypes');
// This will become an instance of wss.
// We're going to be cheating here and kind-of mutating the items
// in the wss instance itself.
const defaultState = null;
function serverReducer(state = defaultState, action) {
switch (action.t... | true |
c3091f49fc5da84afa4baa76f61f4a840f6a8c70 | JavaScript | anas2479/bash-mirror | /src/js/command-output.js | UTF-8 | 408 | 2.953125 | 3 | [
"MIT"
] | permissive |
/**
* The output constructor.
*/
module.exports = class OutPut{
/**
* For HTML use Template Literals.
* @param {string} content
*/
constructor(el,content){
this.element = document.createElement('div')
this.element.setAttribute('class','command-output-container')
... | true |