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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eaa13c757e8f2f76b10f238a3422cc6a40c21ceb | JavaScript | Nadar123/progress-page | /assets/js/app.js | UTF-8 | 1,033 | 2.515625 | 3 | [] | no_license |
jQuery(window).on('load',function($){
initSlider();
initProgressBars();
});
/*progress bar*/
function initSlider(){
jQuery('.main-dashboard').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.dashboard-years',
});
jQuery('.dashboard-years').slick({
s... | true |
2a19a083aafacdad0396541836d9b47a0b56b1fc | JavaScript | DikshaYadav22/Building-a-Todo-List-App-Project-in-ReactJS | /src/App.js | UTF-8 | 2,219 | 2.671875 | 3 | [] | no_license | import React, {useState} from 'react';
import { Form, FormGroup,Input, Card, CardBody } from 'reactstrap';
import TodoList from './components/TodoList';
const App = () => {
const [todo, setTodos] = useState("");
const [items, setItems] = useState([]);
const onSubmit = (e) => {
e.preventDefault();
set... | true |
9be897482f0ef00c532bf8c94ec480ded0d632dd | JavaScript | wy2016xiao/vue-commentary | /src/core/vdom/create-element.js | UTF-8 | 7,047 | 2.671875 | 3 | [
"MIT"
] | permissive | /* @flow */
import config from '../config'
import VNode, { createEmptyVNode } from './vnode'
import { createComponent } from './create-component'
import { traverse } from '../observer/traverse'
import {
warn,
isDef,
isUndef,
isTrue,
isObject,
isPrimitive,
resolveAsset
} from '../util/index'
import {
... | true |
ad4e04f1553e02805c216e6bc061fecdbb4729a3 | JavaScript | nickshevr/js-hof-decorators | /spec/classCompose.spec.js | UTF-8 | 1,429 | 2.875 | 3 | [] | no_license | const {DummyFunction, WithCache, WithResultLogging} = require('src/classes');
const {factorial} = require('src/funcs');
const classCompose = (classes) => (...args) => {
const [head, ...tail] = classes;
if (!head) {
return args[0];
}
return classCompose(tail)(new head(...args));
};
const ... | true |
9c4393bdf72fcd82b8643d6411bf7969ff3f32c6 | JavaScript | jdgp77/Educacion-Interactiva-V4 | /educacion-interactiva/js/educacion-interactiva-v4.js | UTF-8 | 22,388 | 2.6875 | 3 | [] | no_license | var ei_animation_static = {
// Arreglo de todas las clases
arEiAnimation: new Array(),
// Numero de animaciones
numEiAnimation: 0,
};
function ei_animation(father)
{
this.father=father;
// Numero de la animación
this.numAnimacion=ei_animation_static.numEiAnimation;
// Guarda este objeto para ser u... | true |
eaa02188c0f8d4b203d2253a53f8b1aa753b0068 | JavaScript | JulCzar/SquareComber | /src/js/models/item.js | UTF-8 | 1,418 | 3.203125 | 3 | [] | no_license | import { sortValue } from '../utils/sortValue.js'
export default class Item {
/**
* @param {number} x x position of this item
* @param {number} y y position of this item
* @param {number} maxValue max value to be set for the item
* @param {number} initialValue value to initialize the item
*/
constru... | true |
96bfd0ea585d7850f0f7dc431e8ba45462f1f5a8 | JavaScript | achilles707/Project-3---Interactive-Form | /js/scriptTest.js | UTF-8 | 4,091 | 4.375 | 4 | [] | no_license | /*
when a change is detected in any element of the 'activities-box':
if the selected event is checked the total price is updated either 100 or 200
counter for checked activities is updated
if tuesday morning is selected, calls the blocking function on the other tuesday morning event
blockin... | true |
aa5fe873e6d5db0318c65a840771d6702cb14339 | JavaScript | kolomeyetsd/kolomeyetsd.github.io | /src/gameLogicHelpers.js | UTF-8 | 2,836 | 3.421875 | 3 | [] | no_license | //
const TURN_COLORS = ['black', 'white']
const FIRST_TURN_COLOR = TURN_COLORS[0]
const initialPositionsKeyIndex = {
'white-rook': [ 0, 7 ],
'white-knight': [ 1, 6 ],
'white-bishop': [ 2, 5 ],
'white-king': [ 3 ],
'white-queen': [ 4 ],
'white-pawn': [ 8, 9, 10, 11, 12, 13, 14, 15 ],
'black-rook': [ 56, ... | true |
1184f2b70ee0671872a2d3aa7e98f06b694e11b8 | JavaScript | mr-burton/DOM-II | /stretch-assignment/index.js | UTF-8 | 817 | 2.859375 | 3 | [] | no_license | // TweenMax.to(target, duration, {vars});
let runBtn = document.querySelector(".run");
runBtn.addEventListener('click', () => {
TweenMax.to(".block", 3, { marginLeft: 1000 });
});
let staggerBtn = document.querySelector(".stagger");
staggerBtn.addEventListener('click', () => {
TweenMax.staggerTo(".block",... | true |
af91ecd648dc9253a6be77a2541702a6e45406e8 | JavaScript | nxhuy-github/react-learn-redux2 | /learn-redux/src/reducers/userReducer.js | UTF-8 | 236 | 2.578125 | 3 | [] | no_license | export const userReducer = (state='', action) => {
switch (action.type) {
case "USER_ACTION":
return action.payload.user
case "API_SHOW_ERROR":
return action.payload.api_error
default:
return state
}
}
| true |
a9c06244cfa9ef5999e32c6c6aff23e4d6b47c2d | JavaScript | tmflsby/react-antd-admin | /src/utils/index.js | UTF-8 | 1,351 | 2.890625 | 3 | [] | no_license | /**
* 获取URL的参数
* */
export const queryString = () => {
let _queryString = {};
const _query = window.location.search.substr();
const _vars = _query.split('&');
_vars.forEach((v, i) => {
const _pair = v.split('=');
if (!_queryString.hasOwnProperty(_pair[0])) {
_queryString[_pair[0]] = decodeURICom... | true |
a6f3be208a454b9a1bd6ef15e8493632eeff1e8d | JavaScript | ktsulun/tutorials | /git query/unit_15/script.js | UTF-8 | 1,138 | 3.46875 | 3 | [] | no_license |
const button = document.getElementById("go");
const cities = document.getElementById("cities");
// let URL = `http://api.openweathermap.org/data/2.5/weather?q=${cities.value}&appid=70e1ed322b02acbc57d443dd91065f3e`;
button.addEventListener("click", onClick)
function onClick(){
// console.log(`http://api.openwea... | true |
3357bee8bc63df53c01296c15c599342b5d3a714 | JavaScript | weapon-xx/Algorithm-Test | /LeetCode/84.柱状图中最大的矩形.js | UTF-8 | 1,199 | 4.25 | 4 | [] | no_license | /**
* 难度:Hard
* 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。
* 求在该柱状图中,能够勾勒出来的矩形的最大面积。
* 示例:
* 输入: [2,1,5,6,2,3]
* 输出: 10
*/
/**
* @param {number[]} heights
* @return {number}
*/
function largestRectangleArea(heights) {
if (heights.length === 0) return 0;
let res = 0;
const len = heights.length;
... | true |
c81d1829c6c4ca9501d42de997a132104dfe4085 | JavaScript | jhenaoz/mocha-chai-as-promised-example | /test/test.js | UTF-8 | 471 | 2.796875 | 3 | [] | no_license | var chai = require('chai');
var expect = chai.expect;
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
describe("description", function () {
this.timeout(0);
it("chai as promise test", function () {
expect(true).equal(true);
return expect(returnPromise()).to.eventually.equal(200... | true |
788e53569503786ec00dc70b7c55962bfb15e1ee | JavaScript | chaitu605/Final-mern-client | /src/apis/findNewsById.js | UTF-8 | 296 | 2.546875 | 3 | [] | no_license | import axios from "axios";
let data = null;
export const findNewsById = async () => {
await axios
.get(`http://localhost:5000/api/news`)
.then((res) => {
console.log(res.data);
data = res.data;
})
.catch((err) => {
console.log(err);
});
return data;
};
| true |
f5d99e6e26c657d8029fc935587ea6e5cebc04bd | JavaScript | satyamdev29/javascript | /day6-s2-constructor-function/product.js | UTF-8 | 1,981 | 3.8125 | 4 | [] | no_license | //
// dummy data storage - DB
const products = []
// properties - id, name, price, category
// methods -
// instance methods - save()
// static methods - findById(), findByIdAndUpdate(), findByIdAndDelete(), findAll(), count()
function Product(data){
this.id = data.id
this.name = data.name
this.price = da... | true |
9158d16bb1a5aa19d5e4fe0e324398a79a663ac3 | JavaScript | danielcacatian/CART-263 | /projects/project2/prototype/js/Play.js | UTF-8 | 3,618 | 2.796875 | 3 | [] | no_license | class Play extends Phaser.Scene {
constructor(){
super({
key: `play`
});
}
create(){
// Boxxy & Conny
this.boxxy = this.physics.add.sprite(100, 400, `boxxy`);
this.conny = this.physics.add.sprite(200, 400, `conny`);
this.boxxy.setCollideWorldBounds(true);
this.conny.setCollide... | true |
b66fb43f379fef830b95c6e52427d48d208ddc05 | JavaScript | everlynyamamoto/NLW-Rocketseat | /scripts/create-point.js | UTF-8 | 922 | 3.484375 | 3 | [] | no_license | function populateUFs(){
const ufSelect = document
.querySelector("select[name=uf")
fetch("https://servicodados.ibge.gov.br/api/v1/localidades/estados").then( res => res.json() ).then(states => {
for( const state of states){
ufSelect.innerHTML += `<option value = ${state.id}>${state.nome}</opti... | true |
cac2b04759e1572031d71294fe365d454ba82fca | JavaScript | wburgo999/Project_Euler | /Problem_5/Problem_5.js | UTF-8 | 1,132 | 3.578125 | 4 | [] | no_license |
function smallestMultiple_1() {
var num = 21;
while (true) {
if (isDivisibleBy1To20(num)) return num;
num++;
}
}
function isDivisibleBy1To20(num) {
for (var i = 1; i <= 20; i++) {
if (num % i !== 0) return false;
}
return true;
}
function smallestMultiple_2(n) {
var lcmPrimeFactors = {};
... | true |
298b996ed3f6392ded96d6aa835410385b2f1eab | JavaScript | curtydudes/momentum-app | /app.js | UTF-8 | 2,597 | 3.671875 | 4 | [] | no_license | // Get current time and input to time section
const newTime = document.getElementById("time"); //dom; instead of typing the getElement every time
const getGreeting = document.querySelector('#greeting'); //dom
function getCurrentTime() {
let timeStamp = new Date();
let timeStampHr = timeStamp.getHours();
let timeSt... | true |
80e2c522e14e5ed297f079bd7f08e6dadba26b20 | JavaScript | lvdong-tech/eos-account-name | /js/app.js | UTF-8 | 2,425 | 2.703125 | 3 | [] | no_license | const cards = [
{ account: "zoooomzoooom", price: "10", tags: ['zoomzoom'], badge: 'NEW' },
{ account: "zoooomzoooom", price: "10", tags: ['zoomzoom'], badge: 'PREMIUM' },
{ account: "zzzzzzkkkkkk", price: "10", tags: ['张凯', '6个z 6个k'] },
{ account: "geeeeeeeeeek", price: "10" },
{ account: "geeeeee... | true |
206292aabb299240a24eddb0c661081fb2a3340a | JavaScript | tjanaszek/Calculator | /test/integration.test.js | UTF-8 | 1,665 | 3.625 | 4 | [] | no_license | const {Calculator} = require('../www/calculator')
test('Click the butttons: 2, x, 3, +, 8, =', ()=>{
document.body.innerHTML =
'<div class="calculator-screen" >'+
'<div class="previous-operand"></div>'+
'<div class="current-operand">0</div>'+
'</div>'+
'<button class="number" value="1">1<... | true |
c00df4a88a1e4c1e5616762b057f906d58ee5785 | JavaScript | akifev/javascript | /01-warmup/src/warmup.js | UTF-8 | 8,026 | 3.90625 | 4 | [] | no_license | 'use strict';
function isNumber(a) {
return typeof a === 'number';
}
function isString(a) {
return typeof a === 'string';
}
/**
* Складывает два целых числа
* @param {Number} a Первое целое
* @param {Number} b Второе целое
* @throws {TypeError} Когда в аргументы переданы не числа
* @returns {Number} Сумма а... | true |
6708461e0334e7aa36109f35bb4f6c770f2c8f7e | JavaScript | Aangi/COMP125-Lab2-Aangi | /Scripts/app.js | UTF-8 | 1,732 | 3.203125 | 3 | [
"MIT"
] | permissive |
(function(){
"use strict";
var paraElements = [];
paraElements[0] = document.getElementById("para1");
paraElements[1] = document.getElementById("para2");
paraElements[2] = document.getElementById("para3");
var paragraphs = [];
paragraphs[0] = "Our age is known as th... | true |
afba49a58739447a24a8a7f379947fe15db92c03 | JavaScript | imollov/swapp | /src/utils/compareStarship.js | UTF-8 | 1,188 | 2.53125 | 3 | [] | no_license | const compareMinMax = (curr, min, max) =>
curr > min ? (curr - min) / (max - min) : curr / max
const ratio = (curr, values) =>
compareMinMax(curr, Math.min(...values), Math.max(...values))
export default (starship, related) => {
const reduced = related.reduce(
(acc, { node: s }) => ({
cost: [...acc.co... | true |
b53ed5f9aa28551aa977d26179044ad3a092c277 | JavaScript | cabbage-cart/mmi-lambdas | /tasks/fetch.js | UTF-8 | 836 | 2.515625 | 3 | [] | no_license | const request = require('request').defaults({json:true})
module.exports = async (uri, method, headers, body) => {
const p = new Promise((resolve, reject) => {
try {
let options = {
"url": uri,
"method": method || 'GET'
}
if(headers){
... | true |
f63ad808438ab05abcd6d12fcd6c009bde2def69 | JavaScript | rjfox1992/breakable-toy-launch31 | /server/src/serializers/BookListSerializer.js | UTF-8 | 354 | 2.515625 | 3 | [] | no_license | class BookListSerializer {
static async getSummary(bookList) {
const allowedAttributes = ["id", "name", "userId", "imageUrl"];
let serializedBookList = {};
for (const attribute of allowedAttributes) {
serializedBookList[attribute] = bookList[attribute];
}
return serializedBookList;
}
}
e... | true |
dfe4efb48898b065dc76e2ba0647fc7e3f4e4463 | JavaScript | Togeri/Path-Finder-Algorithm-Visualizer | /bin/createEventsUI/generateWallFunctions.js | UTF-8 | 5,245 | 2.921875 | 3 | [] | no_license | //Change File Name to generateNavbarFunctions
import { mouseDownWallEvent, mouseMoveWallEvent, mouseUpWallEvent, clickAddWallEvent } from "../handleEventsUI/addWallEvents.js";
import { mouseDownRemoveWallEvent, mouseMoveRemoveWallEvent, mouseUpRemoveWallEvent, clickRemoveWallEvent } from "../handleEventsUI/removeWall... | true |
7f10064464540b5fc1ce21ba4a3229816517ea2b | JavaScript | nicolasmerinian/TDJS | /js/classes/Enemy.js | ISO-8859-2 | 3,194 | 2.859375 | 3 | [
"MIT"
] | permissive | function Enemy(battlefield, name, type, url, x, y, life, armor, speed, reward) {
this.id = battlefield.enemies.length;
this.name = name;
this.type = type;
this.image = new Image();
this.image.src = url;
this.life = life;
this.armor = armor;
this.speed = speed;
this.image.referenceDuSprite = this;
this.image.o... | true |
210ea389ab1ed7a8ac59baf441a3b6e20371588d | JavaScript | imvikrant/jumble-bumble | /src/reducers/reducer.js | UTF-8 | 2,017 | 3.109375 | 3 | [] | no_license | import { ADD_WORD, REMOVE_WORD, NEW_SENTENCE } from './../actions/actionTypes';
import sentenceList from '../sentenceList';
const isArrayEqual = (a1, a2) => {
if (a1.length !== a2.length) return false;
for (let i = 0; i < a1.length; i++) {
if (a1[i] !== a2[i]) {
return false;
}
}
return true;
};... | true |
603d4c1bf7ea4afb13094fb2fe03c9fd6d784869 | JavaScript | JhostinOsorio/hook-app | /src/components/08-useReducer/TodoAdd.js | UTF-8 | 930 | 2.515625 | 3 | [] | no_license | import React from 'react';
import useForm from '../../hooks/useForm';
const TodoAdd = ({ handleAddTodo }) => {
const [ { description }, setValues, resetValues ] = useForm({ description : '' })
const handleSubmit = (e) => {
e.preventDefault();
if (description.trim().length <= 1) return;
handleAddTodo(... | true |
30a6d35089f1ee3a703cfc5c932fdc7e913766f1 | JavaScript | rjthalman/rjthalman.github.io | /Assignments/Lesson-8/scripts/WindChill.js | UTF-8 | 505 | 3.140625 | 3 | [] | no_license | function WindChill(){
var HighTemp = get("tempHi").value;
var LowTemp = get("tempLo").value;
var AveTemp = (HighTemp + LowTemp)/2
var windChill = 35.74 + (0.6215 * AveTemp) - 35.75 * (Math.pow(0.16, WindSpeed)) + 0.4275 * AveTemp (Math.pow(0.16, WindSpeed))
get("output").innerHTML = windChill;
}
CSS--var ... | true |
b9e94a26b00a48188c6e029f53302d93fdd50c99 | JavaScript | aliyacodes/evie.selfbot | /commands/addtag.js | UTF-8 | 523 | 2.671875 | 3 | [
"MIT"
] | permissive | exports.run = function(bot, msg, args) {
let name = args[0];
let contents = args.slice(1).join(" ");
bot.db.get(`SELECT * FROM tags WHERE name = '${args[0]}'`).then(row => {
if(!row) {
bot.db.run(`INSERT INTO "tags" (name, contents) VALUES (?, ?)`, [name, contents]).then(()=>{
msg.ed... | true |
47e3f95251f68ddcfdc4a02fa2daf12d1de2a82e | JavaScript | CarlosMela/adventofcode2015 | /day15.js | UTF-8 | 2,169 | 3.4375 | 3 | [] | no_license | "use strict"
const R = require("ramda");
const names = ["Sprinkles","Butterscotch","Chocolate","Candy"];
const ingredients = {Sprinkles: {capacity: 2, durability: 0, flavor: -2, texture: 0, calories: 3},
Butterscotch: {capacity: 0, durability: 5, flavor: -3, texture :0, calories :3},
Chocolate: {capacity: 0, durability... | true |
b3c8d89d910d41fe2dfbdbc165129938e55cdc8e | JavaScript | bangef/randomofyourchoise.github.io | /script.js | UTF-8 | 2,795 | 3.5625 | 4 | [] | no_license | // buat aplikasi random atau giveaway;
// (-) masih belom ada 2 pilihan. contoh Bab - 1 adalah Andi
// membuat object dengan constructor
function Rndm(daftarPemain) {
this.daftarPemain = daftarPemain;
this.inpPemain = (namaPemain) => {
if (this.daftarPemain.length === 0 || this.daftarPemain[0] === unde... | true |
4c1d631407b045b91ce8cbc7a745c4ec359b97f9 | JavaScript | JCourt1/bot_creation_tool | /flask_app/src/patient/index.js | UTF-8 | 2,300 | 2.5625 | 3 | [] | no_license | // @flow
import "unfetch/polyfill";
import "babel-polyfill";
import classnames from "classnames";
import React from 'react';
import ReactDOM from 'react-dom';
import type { ChatMessage } from "./Chatroom";
import Chatroom from "./Chatroom";
import { noop, sleep, uuidv4 } from "./utils";
import ConnectedChatroom from ".... | true |
214baa86b6ea5bb286a453e95d53b04e6f7cdd09 | JavaScript | ibexes/Torn | /webapp/src/components/faction/activity/DayActivityTable.js | UTF-8 | 4,225 | 2.546875 | 3 | [] | no_license | import React, {useEffect, useState} from "react";
import './DayActivityTable.css';
import CachedIcon from '@material-ui/icons/Cached';
import DeleteForeverOutlinedIcon from '@material-ui/icons/DeleteForeverOutlined';
function Row(props) {
const {entryDate, activities} = props;
return (
<>
<... | true |
94fd09545e593912a8dea9fe52e54f30e63f9730 | JavaScript | Alex-Goin/bbmetalcreation | /plugins/getImgs.js | UTF-8 | 151 | 2.546875 | 3 | [] | no_license | export const getImgs = (r) => {
let banners = []
r.keys().forEach(key => {
banners = [...banners, r(key)]
})
return banners
} | true |
207e02787dba5e618b894b14f90937e6890c8abf | JavaScript | danlubbers/codewars-problems | /Kata-7/kyu7-count-all-the-sheep-on-farm-in-the-heights-of-new-zealand.js | UTF-8 | 2,056 | 4.0625 | 4 | [] | no_license | // https://www.codewars.com/kata/count-all-the-sheep-on-farm-in-the-heights-of-new-zealand/train/javascript
// Every week (Friday and Saturday night), the farmer and his son count amount of sheep returned to the yard of their farm.
// They count sheep on Friday night, the same goes for Saturday (suppose that sheep re... | true |
bbd85dd41e0e3c64e71f04d112ef51f5e868a626 | JavaScript | MatheusIshiyama/chat-app-backend | /src/services/sendMail.js | UTF-8 | 816 | 2.546875 | 3 | [
"MIT"
] | permissive | const nodeMailer = require("nodemailer");
const validateBody = require("./validateBody");
require("dotenv").config();
const transporter = nodeMailer.createTransport({
service: "gmail",
auth: {
user: process.env.EMAIL,
pass: process.env.PASSWORD,
},
});
const sendEmail = async (email, code,... | true |
d6cc89ed5e696517b6d2e7ff27c5cda2e60b847c | JavaScript | Teddy-FN/Fundamental-JS | /ConsoleObjectMethod-Part13/index.js | UTF-8 | 2,374 | 3.3125 | 3 | [] | no_license | const user = {
name: 'Teddy',
age: 22,
skills: [
'HTML', 'CSS', 'JavaScript', 'React'
]
}
console.table(user)
const countries = [
'England', 'Indonesia', 'Amerika Serikat', 'Japan', 'Singapore', 'Germany'
]
console.table(countries)
const users = [
{
name: 'Asabeneh',
... | true |
a5c105a7c943ae28bc278801d6a6ace028f489e8 | JavaScript | bmq928/Loc8r | /app_api/controllers/locationCtrl.js | UTF-8 | 3,599 | 2.515625 | 3 | [] | no_license | require("../models/location");
var Location = require("mongoose").model("location");
var sendJson = require("./_shareFunction").sendJson;
var getAuthor = require("./_shareFunction").getAuthor;
var newAverageStar = function (curAverage, length, rating) {
let result = (curAverage * (length - 1) + parseInt(rating)) /... | true |
ed0833d71e87c212e534ff7912a67e4352e72dad | JavaScript | YutHelloWorld/react-mobx-starter-kit | /src/store/zenStore.js | UTF-8 | 787 | 2.578125 | 3 | [
"MIT"
] | permissive | import { observable, action, useStrict } from 'mobx'
import axios from 'axios'
useStrict(true)
class ZenStore {
@observable fetching = false
@observable content = []
@observable availableId = 0
@observable text = ''
@action
fetchZen() {
this.fetching = true
axios.get('https://api.github.com/zen')... | true |
552cf5581af40eccb296f739a614147f28ac3b08 | JavaScript | Emil760/Programmania | /Programmania/wwwroot/js/elements/rewards.js | UTF-8 | 599 | 2.65625 | 3 | [] | no_license | function addTableRewards(reward, date) {
return '<tr>'
+ `<td>${reward.type}</td>`
+ `<td class='posXP'>${reward.expierence}</td>`
+ `<td>DESC!!!</td>`
+ `<td class='timeData'>${date.getUTCHours() + ':' + date.getMinutes() + ':' + date.getUTCSeconds()}</td>`
+ '</tr>'
}
fun... | true |
39ea05d0ecbd914c95a48924521154577354e430 | JavaScript | alcrawford/PWA1-GITRepo-Adrienne-Crawford | /Wk4/goal7_assign_obj_to_prototypes/js/main.js | UTF-8 | 740 | 3.453125 | 3 | [] | no_license | /**
* Created by Adrienne Crawford
* Class: PWA
* Goal: Goal7
*/
//constructor
//array (5 names min) @ random in output display
//For Loop
array(object1, object2,object3
//instance one person object
//instance two person object
//instance three person object
//instantiating
//ex var person = new Person(names[so... | true |
d58426ad42914e78d8fb59cdedfcaea5367d9d52 | JavaScript | vishalprajapati92/ListUserInfoWithHook | /src/reducers.js | UTF-8 | 200 | 2.671875 | 3 | [] | no_license | const initState = [];
export default function reducer(state = initState, action) {
switch(action.type) {
case "GET_DATA":
return state = action.data;
}
return state;
} | true |
f66749db7ea231b54e166c929a41bfd30818ce8d | JavaScript | paperscz/javascript-decorators | /src/validationHelpers.js | UTF-8 | 5,043 | 3.265625 | 3 | [] | no_license | /**
* Validation helpers for simple use cases
*
* @author Avraam Mavridis <avr.mav@gmail.com>
*
*/
import { descriptorIsFunc } from './helpers';
/**
* Tests if the prop is an Object
*
* @method isObject
*
* @param { any } prop
*
* @return { Boolean }
*/
export const _isObject = function (prop) {
retur... | true |
ccfc7ac3b286f353f5f066f4aa2e6fbd8658861c | JavaScript | okcoders/2019-winter-rsi | /class-04/middleware-redux.js | UTF-8 | 1,110 | 3.1875 | 3 | [] | no_license | const redux = require('redux')
function addTodo(name) {
return {
type: 'ADD_TODO',
payload: name
}
}
function markTodoComplete(name) {
return {
type: 'MARK_TODO_COMPLETE',
payload: name
}
}
function reducer(state = [], action) {
switch (action.type) {
case 'ADD_TODO':
return [...s... | true |
6433d91b98d775beef140540a4b6010b0c928b58 | JavaScript | tylerjrichards/RaidAlert | /server/routers/alert.router.js | UTF-8 | 1,944 | 2.625 | 3 | [] | no_license |
var express = require('express');
var router = express.Router();
var Alert = require('../models/alert.model.js');
// tool which allows the router to actually extract the data that it takes in
var bodyParser = require('body-parser');
router.use(bodyParser.json());
// opens up the 'package' of information in the url an... | true |
72cbc80f9515547a035df6943256331c1c6ccfe1 | JavaScript | DecentricCorp/hd-bitauth | /server.js | UTF-8 | 1,535 | 2.625 | 3 | [
"MIT"
] | permissive | const express = require('express');
var bodyParser = require('body-parser')
// Constants
const PORT = 8080;
// Fakes
var nonce = "nonce123"
var token = "token123"
// App
const app = express()
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use('/', express.static('./'))
// -> Rep... | true |
4919c8eb23ee7bf7ba1d46ebd6cdfbebf55edaea | JavaScript | lycifer3/paradise | /javascript/client/order.js | UTF-8 | 584 | 2.9375 | 3 | [] | no_license | $(document).ready(function(){
$('.orderInput').blur(function() {
var startCount = 1;
var productPrice = parseInt($(this).parents('tr').find('.productPrice').html());
var productCount = $(this).val();
var productSumm = parseInt(productPrice * productCount);
if($.isNu... | true |
e86e9b428a5d2f91f16e385dd30b5ff34b78fe1b | JavaScript | notepower2k1/FeatureList | /Rock Paper Scissor Game/game.js | UTF-8 | 2,765 | 3.65625 | 4 | [] | no_license | let [computer_score,player_score] = [0,0];
let result = document.getElementById('result');
let choices_object = {
'rock':{
'rock' : 'draw',
'paper': 'lose',
'scrissor': 'win'
},
'paper':{
'rock' : 'win',
'paper': 'draw',
'scrissor': 'lose'
... | true |
25188dc1d5034a10864a208d4733dcf0675d0826 | JavaScript | ldimensions/webpack-learn | /src/add-image.js | UTF-8 | 273 | 2.640625 | 3 | [] | no_license | import Image from './react.gif';
function addImage(){
const img = document.createElement('img');
img.alt = "image";
img.width = "100";
img.src = Image;
const body = document.querySelector('body');
body.appendChild(img);
}
export default addImage; | true |
b6c0471ab453990edbff9a5147d0540fb9add93d | JavaScript | isel-leic-pi/1718i-LI51D | /Aula 2017-09-18/objects.js | UTF-8 | 629 | 4.15625 | 4 | [] | no_license | // Java Script literal objects ==> JavaScript Object Notation (JSON)
let o = {
a: 5,
b: "SLB"
};
console.log(o.a);
console.log(o.b);
console.log(o.c);
o.c = 20;
console.log(o.c);
o.B = 30;
delete o.b;
console.log(o.b);
// Acesso a propriedades
console.log("Dot notation for property a " + o.a) // Dot nota... | true |
e6810840e1727703a76cb24e9460573afaa1564e | JavaScript | brockwei/canvas | /scripts/canvas-common.js | UTF-8 | 3,854 | 2.71875 | 3 | [] | no_license |
let canvasReal = document.getElementById('canvas-real');
let contextReal = canvasReal.getContext('2d');
let canvasDraft = document.getElementById('canvas-draft');
let contextDraft = canvasDraft.getContext('2d');
let currentFunction; //This variable will allow us to change paint function, ie change to draw line, ... | true |
f0f6ffbc65601eeceb29fcb3ca4482089fdbe57b | JavaScript | Serge2702/P-gina-de-Inteligencia-Artificial | /Maze3D/canvas.js | UTF-8 | 20,843 | 2.921875 | 3 | [] | no_license | var maze=new Object();
var solucion;
function preload_tiles(folder)
{
var image_list=
[
"/0.png",
"/1.png",
"/2.png",
"/3.png",
"/4.png",
"/5.png",
"/6.png",
"/7.png",
"/8.png",
"/9.png",
"/10.png",
"/11.png",... | true |
f3f3bb73ebf30b931034cd92388f825113899625 | JavaScript | JP-Dub/image-search | /searchEngine.js | UTF-8 | 707 | 2.78125 | 3 | [] | no_license | var fetch = require('node-fetch');
// function for the https request and data return
exports.engine = function(url, complete) {
fetch(url)
.then(function(res) {
var err = {status: res.staus, statusText: res.statusText};
if(res.status !== 200) return complete(err);
return res.json();
}).then... | true |
50caae4afb5980e118293050c6540def6430b9bb | JavaScript | ashitsathish/java-javascript-codingchallenges | /src/main/java/leetcode/easy/powerof2/PowerOf2.js | UTF-8 | 185 | 3.4375 | 3 | [] | no_license | /**
* @param {number} n
* @return {boolean}
*/
var isPowerOfTwo = function(n) {
let i =1;
while(i<n){
i*=2;
}
return i===n;
};
console.log(isPowerOfTwo(16)); | true |
4660ebb96e6705db2e671203c0020392947fd119 | JavaScript | steve-baldock-401-advanced-javascript/api-server | /lib/__tests__/server.test.js | UTF-8 | 1,415 | 2.625 | 3 | [
"MIT"
] | permissive | 'use strict';
require('@code-fellows/supergoose');
const { server } = require('../../lib/server.js');
const supertest = require('supertest');
const mockRequest = supertest(server);
describe('web server', () => {
it('should respond with a 500 on an error', () => {
return mockRequest
.get('/bad')
.t... | true |
b7e773a8162807ba553173d52b7256ade6540dd0 | JavaScript | dimontejulia/javascripting | /w1/stretch/reverse.js | UTF-8 | 291 | 3.3125 | 3 | [] | no_license | const reverse = function () {
const args = process.argv;
let input = args.slice(2, args.length);
for (let i = 0; i < input.length; i++) {
let temp = "";
for (let j = input[i].length - 1; j >= 0; j--) {
temp += input[i][j];
}
console.log(temp);
}
};
reverse();
| true |
175d8e0734430bfd18458ecca1a26625282a88db | JavaScript | txbluebee/journal | /build/js/app.js | UTF-8 | 3,627 | 2.75 | 3 | [] | no_license | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | true |
3de029882e3fc2b9b246f1cfaa7faf21275845b3 | JavaScript | nsandland/vexiq-robotc-blockly | /generators/robotc/vexiq.js | UTF-8 | 36,353 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | // TODO:
// Nice to have:
// Points and rotation
Blockly.RobotC['events_on_start'] = function(block) {
var code = Blockly.RobotC.statementToCode(block, 'DO');
code = Blockly.RobotC.prefixLines(code, Blockly.RobotC.INDENT);
var functionName = Blockly.RobotC.variableDB_.getDistinctName('on_' + Blockly.RobotC.sta... | true |
cc55175e57f904cc9158e201f45ad44f0f6e3658 | JavaScript | zjtisme/react-todo | /playground/spread.js | UTF-8 | 259 | 3.40625 | 3 | [] | no_license | // function add(a, b) {
// return a + b;
// }
//
// console.log(add(2, 2));
//
// var toAdd = [9, 5];
// console.log(add(...toAdd));
// var groupA=['Jen', 'Cory'];
// var groupB=['Vikram'];
//
// var final=[3, ...groupA, ...groupB];
// console.log(final);
| true |
c43986295bfbd327e949c9f63e249090ab1654d7 | JavaScript | brendanbowidas/tessel-camera-stream | /public/client.js | UTF-8 | 466 | 2.84375 | 3 | [] | no_license | window.onload = function() {
var context = document.querySelector('#output').getContext('2d')
var socket = io()
var frame = null
socket.on('image', data => {
frame = "data:image/jpeg;base64," + data
})
socket.emit('ready')
setInterval(function() {
if (frame) {
var image = new Image()
... | true |
f9d012e5eaa73a5093d9863d7b436e14c95d6f9e | JavaScript | Curry3O/headWeb | /漫谈大前端/js/原生JS/es6/Set和Map/Set数据结构/Set.js | UTF-8 | 4,130 | 4.09375 | 4 | [] | no_license | function Set(arr = []) {
let items = {};
this.size = 0;
// has方法
this.has = function (val) {
// 对象都有hasOwnProperty方法,判断是否拥有特定属性
return items.hasOwnProperty(val);
};
// add方法
this.add = function (val) {
// 如果没有存在items里面就可以直接写入
if (!this.has(val)) {
... | true |
a1ae60e59bc8d5dd19ff4394568457f45ee16871 | JavaScript | Nztzlie/phase_0_unit_3 | /week_8_and_9/3_JavaScript/grocery_list/my_solution.js | UTF-8 | 1,562 | 4.34375 | 4 | [] | no_license | // U3.W8-9:
// I worked on this challenge by myself.
// As a user, I want to create a generic list of items
// As a user, I want to add items form the list
// As a user, I want to delete items form the list
// As a user, I want to see where items are in the list
// As a user, I want to display items from list
// 2... | true |
dc528f967be8a4d4c038b53b86f02649fd1b5ccf | JavaScript | VKNikov/HomeworkTasks-SU | /Homework tasks/JavaScript/03. Javascript Loops, Arrays, Strings/05. charComparer.js | UTF-8 | 942 | 4.125 | 4 | [] | no_license | /**
* Created by VKNikov on 22.7.2014 г..
*/
//Problem 5. Compare Chars
//Write a JavaScript function compareChars(value) that compares two arrays of chars lexicographically (letter by letter).
// Write JS program charComparer.js that invokes your function with the sample input data below and prints the output at th... | true |
c9d4a5df9744ac0a6a41ea27b9ae74e45ee0b713 | JavaScript | chris-bk-song/promises-exercise | /index.js | UTF-8 | 1,759 | 3.25 | 3 | [] | no_license | var urls = [
'https://dog.ceo/api/breed/beagle/images/random',
'https://dog.ceo/api/breed/chow/images/random',
'https://dog.ceo/api/breed/akira/images/random',
'https://dog.ceo/api/breed/dingo/images/random',
'https://dog.ceo/api/breed/eskimo/images/random',
];
console.log('starting promise chain');
// This... | true |
a549f94f9b4b6029c8dedbe7b41521736978e524 | JavaScript | ambellinger/Friend_Finder | /app/routing/apiRoutes.js | UTF-8 | 1,310 | 2.96875 | 3 | [] | no_license | // Load Data
var friends = require("../data/friends");
//Array Sort
var arraySort = require('array-sort');
//Routing
module.exports = function (app) {
app.get("/api/friends", function (req, res) {
res.json(friends);
});
app.post("/api/friends", function (req, res) {
var usersAnswers = ... | true |
2d379e27c380853f893d7ac7896e9008f084ba7f | JavaScript | adriancmiranda/describe-type | /internal/typeOf.js | UTF-8 | 557 | 2.78125 | 3 | [
"MIT"
] | permissive | const infinity = require('../is/infinity.js');
const args = require('../is/args/args.js');
const stringOf = require('./stringOf.js');
const { NAN, ARGUMENTS, UNDEFINED, NULL, INFINITY } = require('./constants.js');
/**
*
* @function
* @memberof built-in
* @param {any} value
* @returns {String}
*/
module.exports ... | true |
c75131667b00dbd0aeab03b7a738de5a36757ca0 | JavaScript | jesseallison/NEXUS | /buildscript.js | UTF-8 | 2,742 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Run:
* node buildscript.js
* in the nexus directory to create a basic build of nexusUI.js
* with supplrementary element files combined into one file.
* I've included a minify function but it is not working at the moment
* so I commented out the function call.
*
* Code written with assist from http://blog... | true |
bdf4ba556ec88bde4d6a9d3e433056d04490e104 | JavaScript | pipu11qiao/algorithm | /leetcode/week-template/3.js | UTF-8 | 165 | 2.875 | 3 | [] | no_license |
function test() {
let fun = isOneBitCharacter;
let params = [
[1, 1, 1, 0]
];
const res = fun.apply(null, params)
console.log(`res`, res);
}
test() | true |
5838758b2b12b875b6443dd1d2bc8f31cfbbe85f | JavaScript | kalinichenko/unit-tests-sandbox | /src/flatten.js | UTF-8 | 358 | 2.609375 | 3 | [] | no_license | const assert = require('chai').assert;
const {array2tree} = require('./utils');
let prev;
const flatten = (root) => {
if (root == null)
return;
flatten(root.right);
flatten(root.left);
root.right = prev;
root.left = null;
prev = root;
}
const tree = array2tree([1,2,5,3,4,null,6])
flatten(tree)
cons... | true |
805306cf19c341e3b4a831dce190cab0c448a048 | JavaScript | notriapatel/thermostat | /jasmine-standalone-3.5.0/spec/ThermostatSpec.js | UTF-8 | 2,498 | 2.984375 | 3 | [
"MIT"
] | permissive | 'use strict';
describe('Thermostat', function() {
var thermostat;
beforeEach(function() {
thermostat = new Thermostat();
});
describe('when initializing', function() {
it('the starting temperature is 20 degrees', function() {
expect(thermostat.currentTemperature()).toEqual(20);
});
});
... | true |
940876bf4c7f89b242897b281a75d24562546a96 | JavaScript | SwenVanZanten/setup-swift | /lib/os.js | UTF-8 | 2,328 | 2.546875 | 3 | [
"MIT"
] | permissive | "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { t... | true |
3c0a8655efbbe3216fe404006b0235ebadff9dc0 | JavaScript | Rima-chan/MarieBeaujeu_7_21082021 | /backend/utils/jwt.utils.js | UTF-8 | 569 | 2.6875 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
require('dotenv').config();
exports.getUserToken = (authorization) => {
let userToken = {};
const token = authorization.split(' ')[1];
console.log(token);
if (token != null) {
try {
const decodedToken = jwt.verify(token, process.env.DB_TOKEN);
... | true |
5b90eb1faa213a541f42a31d4b8d62a04cd9b2f6 | JavaScript | open-build/eLearning | /static/js/app_tour/generate_tour_step.js | UTF-8 | 6,597 | 2.828125 | 3 | [
"MIT"
] | permissive |
class GenerateTourStep{
constructor(){
this.iframe_num = null;
this.dblclicked = false;
this.chosen_path = null;
this.chosen_element = null;
this.chosen_placement = null;
this.popover_content = `<div class="popover-content"style="z-index:999999999; text-align:cent... | true |
fbd40b92c06f54702d6d3ef0b5cf91b9c4411c93 | JavaScript | LucianoRamos06/curso_js | /exercicios-js/fundamentos/arrays.js | UTF-8 | 523 | 3.796875 | 4 | [] | no_license | /**
* como as estruturas de dados do java scripty são fracamente tipadas
* os arrays podem ter varios tipos da dados
*
* porém não deve-se criar vetores com tipos diferentes de dados
*/
const valores = [2.2, 4.3, 6.3, 9.2]
console.log(valores[0], valores[3])
console.log(valores[4])
valores[10] = 10.9
consol... | true |
1771db7d46181fd59dd261eec45af68b41fee1ac | JavaScript | oizma/nexe | /src/download.js | UTF-8 | 1,290 | 2.6875 | 3 | [
"MIT"
] | permissive | import download from 'download'
import { isDirectoryAsync } from './util'
function fetchNodeSourceAsync (cwd, url, step, options = {}) {
const setText = (p) => step.modify(`Downloading Node: ${p.toFixed()}%...`)
return download(url, cwd, Object.assign(options, { extract: true, strip: 1 }))
.on('response', res ... | true |
c8df8cc7b8425b2f57f116735d3ad1632da88580 | JavaScript | marriete/udacity-matching-game-project | /js/app.js | UTF-8 | 6,511 | 3.28125 | 3 | [] | no_license | // Elements from DOM
let board = document.getElementById('matching-game');
let refresh = document.getElementById('refresh');
let counter = document.getElementById('count');
let timer = document.getElementById('timer');
// Get the modal
let modal = document.getElementById('myModal');
modal.setAttribute('style', 'displa... | true |
9788ccc4e42e2d6d8197253a9fe9255a8f54d3e3 | JavaScript | Shriniwas-Nakka/Sheer-Exchange-POC | /middleware/middleware.js | UTF-8 | 1,298 | 2.5625 | 3 | [] | no_license | const bcrypt = require('bcrypt');
const jwt = require('jsonwebtoken');
const hashPassword = (password) => {
const saltRounds = bcrypt.genSaltSync(10);
var hashPassword = bcrypt.hashSync(password, saltRounds);
return hashPassword;
};
const accessToken = (payload) => {
try {
var token = jwt.sign(payload, 's... | true |
d4dbdbec252a45a780f06f4143e9649da772ec06 | JavaScript | Some-Courses/Curso_NodeJs | /02-fundamentos-js/arrow-functions.js | UTF-8 | 275 | 3.46875 | 3 | [] | no_license | // Funciones Tradicionales
function sumar(a,b=10){
return a+b;
}
console.log(sumar(5));
// Funciones de Flecha
// const sumar2 =(a,b)=>{
// return a+b
// };
const sumar2=(a,b)=>a+b;
console.log(sumar2(5,15));
const saludar=()=>"Saludar";
console.log(saludar()); | true |
f84e26d5b2fa78a7f8f6fec991ccdfc92234b556 | JavaScript | OCSWENG/WebDevStudies | /MathGameWebsite/js/main.js | UTF-8 | 4,381 | 3.390625 | 3 | [] | no_license | // utilities
function sleep(ms) {
var unixtime_ms = new Date().getTime();
while(new Date().getTime() < unixtime_ms + ms) {}
}
function changeDisplay ( Id, value) {
this.document.getElementById(Id).style.display=value;
}
function changeVisibilty ( Id, value){
this.document.getElementById(Id).style.visib... | true |
5d34c14580ea345527aff6a49440f1665f7ed549 | JavaScript | AizikAizik/Text-To-Speech-JS | /script.js | UTF-8 | 3,239 | 3.296875 | 3 | [] | no_license | const btn = document.querySelector(".s-btn");
const input_box = document.getElementById("say-input")
let voices = [];
window.speechSynthesis.onvoiceschanged = function() {
voices= window.speechSynthesis.getVoices();
};
const speech = new SpeechSynthesisUtterance();
console.log(voices);
console.log(speech);
bt... | true |
e810690ea446352c488b09135b908b2760c44807 | JavaScript | rafaelsmgomes/cpr_assessment_tool_env | /src/js/models/Checkbox.js | UTF-8 | 675 | 3.296875 | 3 | [] | no_license | export default class Checkbox {
constructor(textArr) {
this.val = 0;
this.textArr = textArr;
this.chosenArr = new Set();
this.pointVal = this.retrievePointVal()*100;
}
addAns(answers){
this.clearAnswers();
for(let answer of answers){
this.chosenArr.add(... | true |
9a36d1fc946072d777f38cf8917f2d5bf3ae6669 | JavaScript | linnovate/reindex-app | /src/containers/AuthPage/reducer.js | UTF-8 | 522 | 2.65625 | 3 | [
"MIT"
] | permissive | import { AUTH_SUCCESS } from './constants';
// The initial state of the App
const initialState = {
loggedIn: false,
};
function authReducer(state = initialState, action) {
switch (action.type) {
case AUTH_SUCCESS: {
let loggedIn = false;
if(action.user.token){
localStorage.setItem('token', ... | true |
dd149688ebae1d517cd1273026220f9dfb41b1c8 | JavaScript | rabGIT/assignment_royalty_free_music_player | /scripts.js | UTF-8 | 2,712 | 3.140625 | 3 | [] | no_license |
$(document).ready(function(){
$(".playing-status").click(clickPlayingStatus);
$(".list-group-item").click(clickSong);
$(".fa-step-forward").click(nextSong);
$(".fa-step-backward").click(previousSong);
// capture end of song playback and reset icons/play status
audio.onended = function(){
pauseSong()... | true |
b5d04e921f6551ed4e092d391421d67767701237 | JavaScript | efureev/mu | /dist/esm/date/elapsed.mjs | UTF-8 | 416 | 2.65625 | 3 | [
"MIT"
] | permissive | import now from './now.mjs';
/**
* Returns difference in milliseconds between dates
*
* @param {Date} dateA The first date.
* @param {Date} [dateB=new Date()] (optional) The second date.
* @return {Number} The difference in milliseconds
*
* @memberof µ.date
* @author efureev
*/
export function elapsed(dateA, d... | true |
a0fdb395b657ed3a3cb2e8d9ed0a9eb4461ef814 | JavaScript | Michal-Skiba/React-firebase-to-do | /src/store/actions.js | UTF-8 | 2,438 | 2.8125 | 3 | [] | no_license | import firebase from "firebase";
import './actions.css';
export const ADD_TASK_SUCCESS = 'ADD_TASK_SUCCESS';
export const ADD_TASK_STATUS = 'ADD_TASK_STATUS';
export const REMOVE_TASK = 'REMOVE_TASK';
export const CHANGE_PROGRESS = 'CHANGE_PROGRESS';
// DODAWANIE TAKSÓW
export const writeTask = (id, name, priority, ... | true |
d9219e31432e055f441bbddcd03f25fddc26e03e | JavaScript | ministryofjustice/wmt-worker | /app/services/probation-rules/app/points/calculate-points-for-tier.js | UTF-8 | 1,807 | 2.59375 | 3 | [
"MIT"
] | permissive | const TierCounts = require('../../app/points/domain/tier-counts')
const assertObjectType = require('../../app/points/domain/validation/assert-object-type')
const assertNumber = require('../../app/points/domain/validation/assert-number')
const calculateWeightedPoints = function (count, points, weighting) {
let weight... | true |
0ea334b6db215320c1ae5c9f9fd214bcc7aea771 | JavaScript | petertodorov/OliveAppRepo | /backend/controllers/jarsController.js | UTF-8 | 750 | 2.671875 | 3 | [] | no_license | let OliveJar = require('../oliveJarModel');
let createJar = async function (req, res) {
console.log(req.body);
let jar = new OliveJar(req.body);
try {
let jarCreated = await jar.save();
console.log(jarCreated);
res.status(200).json({ 'message': 'New jar has been created!!!' })
... | true |
580b3708d5c6f44abbe915de873f13f190c73d78 | JavaScript | ewertonpetillo/ControleZoonoses | /js/main.js | UTF-8 | 328 | 2.59375 | 3 | [
"MIT"
] | permissive | function confirmar(link){
if(confirm("Deseja salvar?")){
alert ("Registro salvo com sucesso!")
window.location.href = link;
}
else{
return false;
}
}
function confirmarvolta(link){
if(confirm("Deseja realmente voltar para a página inicial?")){
window.location.href = link;
}
else{
return false;
... | true |
6414ff77b436521c08c8ef0912b60a397dea29e7 | JavaScript | Esemesek/jph-server | /routes/participants.js | UTF-8 | 3,066 | 2.546875 | 3 | [] | no_license | (function () {
'use strict';
let express = require('express');
let uuid = require('uuid');
let router = express.Router();
let ParticipantValidator = require('validators/participantValidator');
let ParticipantService = require('services/participantService');
let logger = require('logger');
let NEW_PAR... | true |
f4b57187a747ae86024c3b940fe48a15deb00d7b | JavaScript | prithish-pritam/node_webrtc_broadcast_onetoone | /server.js | UTF-8 | 1,467 | 2.53125 | 3 | [
"MIT"
] | permissive | //requires
const express = require("express");
const app = express();
const http = require("http").Server(app);
const io = require("socket.io")(http);
const port = process.env.PORT || 3000;
//let broadcasters = {};
// express routing
app.use(express.static("onetoone"));
// signaling
io.on("connection"... | true |
74e9dd5b9cbcbed7dcf42f5f7cb63a31f0e969c1 | JavaScript | satomityann/react-music | /src/utils/reactUtil.js | UTF-8 | 3,850 | 2.625 | 3 | [] | no_license | import React from 'react'
import { Route } from 'react-router-dom'
/**
* 根据路由配置生成相应路由
* @param {array} routeConfig 路由配置
* @param {string} parentPath 父级路由
*/
export function routes(routeConfig, parentPath = '') {
if (!routeConfig || routeConfig.length === 0) {
return null
}
return (
rou... | true |
27d22cca48f0177dc7c91626b5f247e957375f99 | JavaScript | jamesspwalker/week_07_day_3_lab_countries | /src/views/display_view.js | UTF-8 | 1,776 | 3.15625 | 3 | [] | no_license | const PubSub = require('../helpers/pub_sub.js')
const DisplayView = function (element) {
this.element = element;
};
DisplayView.prototype.bindEvents = function (){
PubSub.subscribe('Countries:selected-country', (evt) => {
const countryObject = evt.detail
console.log(countryObject);
this.render(country... | true |
a3af705ab403b94c134f47987017e12421ed44e2 | JavaScript | sstadt/code-eval | /medium/counting-primes/challenge.js | UTF-8 | 683 | 3.75 | 4 | [] | no_license |
(function () {
"use strict";
/*
Given two integers N and M, count the number of prime numbers between N and M (both inclusive)
*/
var fs = [
'2,10',
'20,30'
];
fs.forEach(function (line) {
var params = line.split(',').map(parseFloat),
count = 0;
... | true |
62b39a8e993d84b120d8b1fd9cde6b5195189f47 | JavaScript | brunohgv/computer_graphics | /camera.js | UTF-8 | 3,313 | 3.015625 | 3 | [] | no_license | class Camera {
constructor({C, N, V, d, hx, hy}) {
this.C = C
this.N = N
this.V = V
this.d = d
this.hx = hx
this.hy = hy
}
ortogonalize(V, N) {
let p1 = V.map((value, index) => {
return value * N[index]
}).reduce((a, b... | true |
31a4ec91fb8072f55861795538579cb6efb2fbd6 | JavaScript | wiltonlazary/mcell | /web/index.js | UTF-8 | 1,718 | 2.578125 | 3 | [] | no_license | const debugMode = location.hostname == "localhost";
window["global"] = () => top;
var root = document.documentElement;
top.appLocation = window.location;
top.topWindow = window;
console.log(`debugMode: ${debugMode}`);
document.addEventListener("contextmenu", event => event.preventDefault());
if (debugMode) {
windo... | true |
a57b9327312317479eafd7bf89a039c633cacd83 | JavaScript | stebbih/frisbi-golf | /src/redux/actions/currentGameAction.js | UTF-8 | 931 | 3 | 3 | [] | no_license | import { START_NEW_GAME, UPDATE_SCORE } from '../constants/currentGameConstant';
/*
* Takes in the course length and a vector of player's names
* and makes a currentGame object and saves to redux store.
*/
export const startNewGame = (course, playerArr) => {
let ID = 0;
const playerNames = [];
const players =... | true |