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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e3b976d2dd01ba35410222e16dd1cb256ddacae8 | JavaScript | bsonntag/cesium-sessions-2020-part-3 | /code-examples/data-flow/final/app.js | UTF-8 | 1,488 | 3.078125 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react';
function AddTodoForm(props) {
const { onNewTodo } = props;
return (
<form
onSubmit={(event) => {
event.preventDefault();
const newTodo = event.target.elements.todo.value;
onNewTodo(newTodo);
event.target.reset();
}}
>
... | true |
e545584bc815625e22c2afea9dca83e8da03aad7 | JavaScript | luchimartinez/JavaScript | /ejerciciosDeBusqueda/ejercicio3.js | UTF-8 | 685 | 4.34375 | 4 | [] | no_license | 'use strict'
//Mostrar todos los numeros que hay entre dos que nos da el usuario
var num1;
var num2;
num1= parseInt(prompt("Introduzca un numero mayor a 0", 1));
while (isNaN(num1)){ //PREGUNTA SI NO ES UN NUMERO
num1 = parseInt(prompt("Por favor introduzca un numero mayor a 0"))
}
n... | true |
6216305434bab153304c4d85f1500e8fb21e0fb1 | JavaScript | jemappellenora/cuny-ttp-algo-summer2021-night | /possibleInterviewQ/binarySearch.js | UTF-8 | 744 | 4.5 | 4 | [] | no_license | /*
Given an array of integers nums, sorted in ascending order, and an integer target,
write a function to search target in nums. If target exists, then return its index. Otherwise return -1
using binary search to search number achieving an O(logn) complexity
nums = [-1,0,3,5,9,12]
target = 9
*/
v... | true |
8815a21c50c3ce9e0ad665d863f1e8fe67ea4d24 | JavaScript | bruceeewong/generator-bue-cms | /generators/app/templates/src/utils/bimap.js | UTF-8 | 771 | 3.25 | 3 | [] | no_license | /**
* 键值双向映射Map
* 1. 继承ES6 Map所有特性
* 2. getKey(value) 能根据value找到key
* 3. 能将键值转为el-option所需格式的数组
*/
export default class BiMap extends Map {
/**
* 能根据value找到key
* @param value
* @returns {K}
*/
getKey(value) {
const entries = this.entries()
// eslint-disable-next-line no-restricted-syntax
... | true |
5f694c5567515867303f39fce0673a1433055b30 | JavaScript | tanfly/Practice---Javascript | /camelcase.js | UTF-8 | 547 | 3.453125 | 3 | [] | no_license | function camelCase(str) {
let regex = /[_\s]/g
let spaces = str.replace(regex, ' ')
let lower = spaces.toLowerCase()
let string = lower.split(" ").join(' ')
return string.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
if (+match === 0) return "";
return index === ... | true |
c4e625185a7fc1849988d0e7d00ee303bf06783e | JavaScript | studio73pty/flagclub | /controllers/productos.js | UTF-8 | 5,217 | 2.65625 | 3 | [] | no_license | const ErrorResponse = require('../utils/errorResponse');
const asyncHandler = require('../middleware/async');
const db = require('../config/db');
const path = require('path');
// @Descripcion Buscar todos los productos
// @Ruta y Metodo GET api/v1/productos
// @Acceso Publica
exports.buscarProductos= as... | true |
77a005b75b6b76407bdfdf5d605c5146236f48e4 | JavaScript | codefellows/seattle-code-javascript-401d42 | /class-07/demo/auth-server/app.js | UTF-8 | 1,213 | 2.59375 | 3 | [] | no_license | 'use strict';
// 3rd Party Resources
const express = require('express');
const { Sequelize, DataTypes } = require('sequelize');
const UserSchema = require('./usersSchema.js');
const basicAuth = require('./basic-auth-middleware.js');
const bearerAuth = require('./bearer-auth-middleware.js');
const DATABASE_URL = proces... | true |
fd8e3f6ce4feb66efe2884500e8f9569ef542b57 | JavaScript | VivekBcloud/Devsnest-THA | /Frontend/day-20/src/App.jsx | UTF-8 | 1,577 | 2.984375 | 3 | [] | no_license | import { useState, useEffect } from "react";
import "./style.css";
const App = () => {
const Card = ({ food, cal, index, setFood, allFood }) => {
const foodColor = cal <= 40 ? "green" : cal <= 60 ? "yellow" : "red";
return (
<div className="card">
<h1 style={{ color: foodColor }}>{food}</h1>
... | true |
2b2327eecc11124bdd930726d7b7856da7972dc1 | JavaScript | dzewelina/Northcoders-challenges | /parseHexInt/spec/parseHexInt.spec.js | UTF-8 | 745 | 2.890625 | 3 | [] | no_license | const { expect } = require('chai');
const { parseHexInt } = require('../parseHexInt');
describe('parseHexInt', function () {
it('returns decimal number for single char hexadecimal number', () => {
expect(parseHexInt('9')).to.equal(9);
expect(parseHexInt('A')).to.equal(10);
expect(parseHexInt('F')).to.equ... | true |
4b1fc7c05a8fb4483b66afa28b279d1cadef306e | JavaScript | IamManchanda/vanilla-reactivity-system | /src/proxy.js | UTF-8 | 1,738 | 3.390625 | 3 | [] | no_license | /* Reactivity System in Vanilla JavaScript */
let data = {
price: 0,
quantity: 0,
};
let target, total, salePrice;
class Dep {
constructor() {
this.subscribers = [];
}
depend() {
if (target && !this.subscribers.includes(target)) {
this.subscribers.push(target);
}
}
notify() {
thi... | true |
75eaa9abe49b156af720da401233d839be1be1c5 | JavaScript | vuhson30799/ToyStore | /web/src/main/webapp/resource/theme/themes/js/main.js | UTF-8 | 2,092 | 3.15625 | 3 | [
"MIT"
] | permissive | function priceRange() {
var price1 = document.getElementsByName("price1")[0].value.trim();
var price2 = document.getElementsByName("price2")[0].value.trim();
document.getElementsByName("price1")[0].value = price1;
document.getElementsByName("price2")[0].value = price2;
var pattern = /^\d*$/;
if ... | true |
779f052a236befc79c683963f33eff3e534b09e9 | JavaScript | djaracz/mongodb-mocha-node | /test/updatePerson.test.js | UTF-8 | 1,088 | 2.71875 | 3 | [] | no_license | const assert = require('assert');
const Person = require('../model/person');
describe('#updatePerson()', function () {
let person;
// mocha hook
// create default records to test deleting
beforeEach(function (done) {
person = new Person({
name: 'Joe',
age: 5
}... | true |
c75056dcf8fc8617a0a35dac200434a478fc8dd7 | JavaScript | davidosorno/Coin-Toss | /file.js | UTF-8 | 519 | 3.046875 | 3 | [] | no_license | var nroImg = 0;
var arrimg = [];
function beginChange()
{
nroImg = 5; //This is the number of images to upload in array.
for(i = 0; i < nroImg; i++)
arrimg.push("./img" + (i+1) + ".gif");
ChangeImg();
setInterval(ChangeImg, 2000);
}
function ChangeImg()
{
do{
v... | true |
1ed5c42d6945ba0204fef8fb9acb2cc9417be93d | JavaScript | alpacinocj/WechatMiniAppTest | /utils/wxcache.js | UTF-8 | 2,145 | 3.09375 | 3 | [] | no_license | /*
本地缓存 新增过期机制
wxcache.has(key);
wxcache.get(key);
wxcache.set(key, value, expireSeconds);
wxcache.remove(key);
wxcache.clear();
*/
var wxcache = {
expire_suffix: '_expires',
getExpireKey: function(key) {
return key.toString() + this.expire_suffix;
},
// 是否有某个KEY的缓存
has: function(key)... | true |
1c91a7d260a244c1d425ad6aab6b0e831a15a54f | JavaScript | bytecominformatica/scripts | /src/parseCSV.js | UTF-8 | 796 | 2.78125 | 3 | [] | no_license | import fs from "fs";
import readline from "readline";
async function parseCSV(filepath, divider = ",") {
const fileStream = fs.createReadStream(filepath);
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity,
});
// Note: we use the crlfDelay option to recognize all instances o... | true |
237050b08cfd54755a53e2fc18738e67fe110aff | JavaScript | Vinicius-Naoke/Trybe_exercicises | /bloco-4/exercises-block-4/salario.js | UTF-8 | 966 | 3.34375 | 3 | [] | no_license | let salarioBruto = 3000;
let inss;
let ir;
if (salarioBruto <= 1556.94 && salarioBruto != 0) {
inss = (salarioBruto - (salarioBruto * 0.08));
} else if (salarioBruto >= 1556.95 && salarioBruto <= 2594.92) {
inss = (salarioBruto - (salarioBruto * 0.09));
} else if (salarioBruto >= 2594.93 && salarioBruto <= 51... | true |
916ead15d99078625063f21d325085fbc7ca16f2 | JavaScript | HDodek/calorie-counter-app | /server.js | UTF-8 | 827 | 2.578125 | 3 | [] | no_license | "use strict" ;
var express = require("express");
var bodyParser = require("body-parser");
var items = require("./meal.js");
var app = express();
app.use(express.static("public"));
app.use(bodyParser.json());
app.get('/meals', function (req, res) {
items.getItems(function (result) {
res.status(200).json(result);
... | true |
f697308d6a84350eebdeee299ab8bd7c6ab59717 | JavaScript | marfarma/validate.js | /spec/validators/presence-spec.js | UTF-8 | 1,064 | 2.671875 | 3 | [
"MIT"
] | permissive | describe('validator.presence', function() {
var presence = validate.validators.presence;
it("doesn't allow empty values", function() {
expect(presence('', {})).toBeDefined();
expect(presence(' ', {})).toBeDefined();
expect(presence(null, {})).toBeDefined();
expect(presence(undefined, {})).toBeDefi... | true |
bc3a795b26bbc5cf035c15874ea914f658ddf4ae | JavaScript | snake7799/rs-school-frontend-course | /custom-jquery/custom-jquery.js | UTF-8 | 5,040 | 2.890625 | 3 | [] | no_license | window.$ = cjq;
function $(selector) {
this.elements = document.querySelectorAll(selector);
this.selector = selector;
};
function cjq(selector) {
if (typeof selector === 'string')
return new $(selector);
else if (selector === undefined)
throw new Error('Selector is not defined');
else
throw ne... | true |
e0a4b0bd7fdae4247b1e59d153c826fb4c5c58ba | JavaScript | monai/brass | /lib/emitter.js | UTF-8 | 521 | 2.5625 | 3 | [
"ISC"
] | permissive | 'use strict';
var EventEmitter = require('events').EventEmitter;
var emitter;
var LEVELS = {
silly: 'silly',
debug: 'debug',
verbose: 'verbose',
info: 'info',
warn: 'warn',
error: 'error'
};
emitter = module.exports = new EventEmitter();
emitter.log = log;
emitter.LEVELS = LEVELS;
Object.key... | true |
d5b7f38b5c75e72a9e8d79c09190cbe26566cea9 | JavaScript | GustavoRizzo/EstudoTypeScript | /interface/main.js | UTF-8 | 300 | 2.65625 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
var Dog_1 = require("./Dog");
var Bird_1 = require("./Bird");
console.log("Run main.ts");
var cachorro = new Dog_1.Dog();
var passaro = new Bird_1.Bird();
console.log("O cachorro voa? " + cachorro.tryFly());
console.log("O passaro voa? " + passaro.tryFly());
| true |
ea98f9e1531833cfffa66cb0966c221deb0a91a8 | JavaScript | Gwinilts/libEdgyHipster | /libEdgyHipster.js | UTF-8 | 1,155 | 3.71875 | 4 | [] | no_license | function checkIfTrue(x) {
return (x == true && x != false && x == !false && x != !true && !(x == false) && !(x != true));
}
function checkIfFalse(x) {
return !(checkIfTrue(x) == true && checkIfTrue(x) != false && checkIfTrue(x) == !false && checkIfTrue(x) != !true && !(checkIfTrue(x) == false) && !(checkIfTrue... | true |
a481e86e9f3021b6430004384569cb5c564e37b9 | JavaScript | karinabond1/js_task4 | /once.js | UTF-8 | 278 | 3.140625 | 3 | [] | no_license | var once = function(callback){
var runned = false;
return function(){
if(runned){
return ;
}
runned = true;
return callback();
}
};
var once1 = once(function(){console.log('true')});
once1();
once1();
once1();
| true |
ff823ad3ad397d1091c8d5824716f1eeefbffe06 | JavaScript | martin-alem/mchat-frontend | /src/view/ChatBox/ChatBox.js | UTF-8 | 2,695 | 2.671875 | 3 | [] | no_license | import React, { PureComponent } from 'react';
import "./ChatBox.css";
class ChatBox extends PureComponent {
constructor(props) {
super(props)
this.state = {
query: ""
}
this.handleChange = this.handleChange.bind(this);
this.handleOpenOptions = this.handleOpenOp... | true |
2f720cd961eed183eae621d01810979141340e0e | JavaScript | Code-Institute-Submissions/RNazarian1-clay_architects_AugResub | /assets/js/whoarewe.js | UTF-8 | 633 | 2.640625 | 3 | [] | no_license | console.log("Hello");
let map;
function initMap() {
map = new google.maps.Map(document.getElementById("gmap"), {
center: { lat: 53.99775, lng: 2.4966},
zoom: 5,
});
var lables="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var locations=[
{ lat: 53.2194, lng: 6.5665 },
{ lat: 54.7761, lng:-1.5733 },
];
var mark... | true |
f45794dfbb1857f8a3b9fc61f381daad287ec89f | JavaScript | dima-bu/dima-bu.github.io | /parkingapi/app/view-elems/helpers/Timer.jsx | UTF-8 | 858 | 2.546875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
var Timer = React.createClass({
getInitialState: function() {
var time = this.props.time;
return { secondsElapsed: time };
},
tick: function() {
if (this.state.secondsElapsed === 0) {
clearInterval(this.interva... | true |
6c2aa687090f62b26da750b99b61a001a5160100 | JavaScript | traynham/heartybot | /core/discord/hasRole.js | UTF-8 | 563 | 3.21875 | 3 | [] | no_license | /**
* Checks if the message member includes a desired role. Only works in text channels.
*
* -----
* @module hasRole
* @author Jesse Traynham
* @category Core
* @subcategory Discord
*/
/**
* @param {object} message A discord message object.
* @param {string} desired_role Desired role name
* @function
* @na... | true |
2e26917faab0ad58b73781e8f2009241d79fef65 | JavaScript | jinruiyang/mobooks-mp | /pages/contact/contact.js | UTF-8 | 1,270 | 2.578125 | 3 | [] | no_license | // pages/contact/contact.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
book: {}
},
onLoad: function (options) {
// //find the restaurant id you want to load
// const id = options.id
// //get that restaurant with the id from globaldata
// const data = getApp().globalData.re... | true |
f8faf9eb17f0780eabbc2a433840f94a035df5b1 | JavaScript | adebiyial/playground | /React/nav-bar-dropdown/src/index.js | UTF-8 | 3,474 | 2.578125 | 3 | [] | no_license | import React, {useLayoutEffect, useRef, useState} from "react";
import ReactDOM from "react-dom";
import {items} from "./data";
import Icons from "./Icons";
function NavDropdownItems({items}) {
return items.map((item, index) => (
<a href="/" className="nav-item" key={index}>
{item.title}
</a>
));
}
... | true |
f01171cf94d2e98fe90e2563acd1664cc7a058ce | JavaScript | potor10/Nozomi-v2 | /client/src/components/star_level/star_level.js | UTF-8 | 871 | 2.59375 | 3 | [] | no_license | import styles from './star_level.module.css'
const StarLevel = ({ rarity, max_rarity, size=2 }) => {
let star_array = []
let style = styles.star_icon_extra_small
switch(size) {
case 0:
style = styles.star_icon_extra_small
break
case 1:
style = styles.star_icon_small
break
cas... | true |
49db255a0c1c8d490731d857f1933d86325588ed | JavaScript | dottorer/prosper.community | /src/assets/js/app.js | UTF-8 | 1,096 | 2.671875 | 3 | [] | no_license | $(document).foundation();
(function($){
'use strict';
// For mobile, hide menu on open
function toggleMobileNav(windowWidth, breakpoint) {
if (windowWidth < breakpoint) {
$('.nav').hide();
} else {
$('.nav').show();
}
}
(function mobileNavHandler() {
var windowWidth = $(window)... | true |
46b893be149f5a5621d47b2554ac271b0fb6b278 | JavaScript | dtransporte/dtransporte | /js/FancyGrid/src/js/core/types/Number.js | UTF-8 | 507 | 2.9375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | permissive | /**
* @class Fancy.Number
* @singleton
*/
Fancy.Number = {
/**
* @param {Number} value
* @return {Boolean}
*/
isFloat: function(value){
return Number(value) === value && value % 1 !== 0;
},
/**
* @param {Number} value
* @return {Number}
*/
getPrecision: function(value){
return (va... | true |
78350c788a14d0e2b6702a36d6a91645839a3018 | JavaScript | AlessandreMendez/rock-paper-scissors | /script.js | UTF-8 | 2,666 | 3.71875 | 4 | [] | no_license | function computerPlay() {
const computerChoices = ["rock", "paper", "scissors"];
let computerChoice = computerChoices[Math.floor(Math.random() * 3)];
return computerChoice;
}
function playRound(playerSelection) {
let computerSelection = computerPlay();
if(computerSelection === playerSelection) {
... | true |
1367bd751c2b83aa654259a7e05103c44baa5d30 | JavaScript | baquerrj/eid-project-2 | /code/server.js | UTF-8 | 2,379 | 2.671875 | 3 | [] | no_license | const { fork } = require('child_process')
var mysql = require('mysql');
const cfg = require("./config")
const db_connection = mysql.createConnection({
host: cfg.db_config.host,
user: cfg.db_config.user,
password:cfg.db_config.password,
});
db_connection.connect(function(err) {
if (err) ... | true |
cbabe522b8ca877e442ac9e0955a69e57bafe165 | JavaScript | vulcan9/gitTest1 | /node_backbone/app/assets/js/backbone/base/baseView.js | UTF-8 | 2,169 | 2.734375 | 3 | [
"MIT"
] | permissive | // This is the base view for our app. All our views should inherit (by extending)
// from this baseView.
// __Example:__
//
// var view = myApp.View.extend({});
(function(myApp, window) {
var state = myApp.state;
// set _calix.View_ to our baseView
myApp.View = Backbone.View.extend({
... | true |
6a3333b7ce248825379c1c68b3decae42ca6c16f | JavaScript | one45/one45-js-sdk | /one45-js-sdk/src/rest.js | UTF-8 | 4,066 | 2.734375 | 3 | [] | no_license | 'use strict';
import core from './core';
import auth from './auth';
const methods = {
GET: 'GET', POST: 'POST', PUT: 'PUT', PATCH: 'PATCH', DELETE: 'DELETE',
OPTIONS: 'OPTIONS', LINK: 'LINK', HEAD: 'HEAD'
};
const withPayload = [ methods.POST, methods.PUT, methods.PATCH, methods.DELETE ];
// TODO: add custom he... | true |
eba9e3db2b00402cdc621efa3cfa11525112c527 | JavaScript | TomasJerrySebo/Techdegree-FJS-Project-6-Content-Scraper | /csvWriter.js | UTF-8 | 991 | 3.234375 | 3 | [] | no_license | const createCsvWriter = require('csv-writer').createObjectCsvWriter;
// using the required csv writer npm ext to write to the specified csv file in the data folder. First setting the file headers by creating their values in proper format , and then populating the csv file with the received data and writting the succes... | true |
d49aa5f051422437a2103a6f7f74ab7eb76a2dc6 | JavaScript | grahamcn/rx-node-testing-examples | /examples/time-range/time-range.test.js | UTF-8 | 1,149 | 2.96875 | 3 | [] | no_license | // https://stackoverflow.com/questions/42732988/how-do-i-test-a-function-that-returns-an-observable-using-timed-intervals-in-rxj
const Rx = require('rxjs')
const chai = require('chai')
function timeRange(start, end, interval = 1000, scheduler = Rx.Scheduler.async) {
return Rx.Observable.interval(interval, scheduler... | true |
670a9fc651187310b2721dcebef5412b775f7183 | JavaScript | marabesi/google-docs-sorter | /src/content.js | UTF-8 | 443 | 2.75 | 3 | [] | no_license | 'use strict';
const id = setTimeout(ready, 2000);
function ready() {
clearTimeout(id);
const list = document.querySelectorAll('.docs-homescreen-list-item-cell.docs-homescreen-list-item-time');
for (let i = 0; i < list.length; i++) {
let favorite = document.createElement('i');
favorite.cl... | true |
9a9c6819503b2039f61bc0fbc294fccadde8c467 | JavaScript | nerissaqian/rita_02 | /sketch.js | UTF-8 | 11,161 | 2.953125 | 3 | [] | no_license | // FOR INTRO
var planets = [];
var stars = [];
var slide = 0;
// FOR SLIDE 1:
var bootesX = [10, 11, 13, 16, 18, 17, 14, 11];
var bootesY = [14, 16, 18, 19, 18, 16, 17, 16];
var ursaX = [27, 25, 26, 28, 27, 28, 29, 29];
var ursaY = [13, 14, 15, 14, 13, 12, 11, 10];
var cassX = [31, 33, 34, 36, 36];
var cassY = [6, 6... | true |
de2843f2d502b6f6e25b4b7daf7779d11d141c80 | JavaScript | ernanijlemos/omnistack10 | /web/src/App.js | UTF-8 | 1,633 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import api from './services/api';
import './global.css';
import './App.css';
import './Sidebar.css';
import './Main.css';
import DevForm from './components/DevForm';
import DevItem from './components/DevItem';
function App() {
const [devs, setDevs] = useState([])... | true |
83b5438ac2ac81fbb103d84c3e2b5fe1c913e35b | JavaScript | SherifGhoz/PushBots | /store/index.js | UTF-8 | 1,048 | 2.53125 | 3 | [] | no_license | export const state = () => ({
apps: [],
loading: false,
total: null,
error: null
})
export const actions = {
loadApps({ state, commit }) {
if (!state.total || state.total > state.apps.length) {
commit('SET_LOADING_STATE', true)
this.$axios
.get('https://pushbots-fend-challenge.herokua... | true |
84e3b55a44238aa21b92f3f9037d7451581e99d5 | JavaScript | Jaden-Reklaw/react-review-app | /src/components/App/App.js | UTF-8 | 1,048 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
//Import Components
import Header from '../Header/Header';
import DragonList from '../DragonList/DragronList'
class App extends Component {
//Setup up state to the app component to pass to the children
state = {
dragonList: [
{
name:'... | true |
2bbdc4c35f8edbd62817679bf24714c48c69f010 | JavaScript | BenyaminPCh18/patitasNegras-octo-sniffle | /js/botones.js | UTF-8 | 2,284 | 3.28125 | 3 | [] | no_license | var boton=document.getElementsByClassName('botoncito');
var ventana=document.getElementsByClassName('ventana');
ventana[0].addEventListener('click',tamañoVentana);
ventana[1].addEventListener('click',tamañoVentana2);
var botonFocus=document.getElementsByClassName('botonFocus');
var textoFocus=document.getElementById('t... | true |
a1a08681c755e3a6b499cf3313395e755b8dc73d | JavaScript | johnvlim/zo_v1_web | /docs/common/utilities/login/loginService.js | UTF-8 | 3,564 | 2.53125 | 3 | [] | no_license | angular
.module('starter')
.factory(
'loginService',
loginService
);
loginService.$inject = [
'API_BASE_URL',
'KEYS',
'USER_ROLES',
'$http',
'$localStorage',
'$q'
... | true |
b76a20a3cc81ea18cad13666208142917e9b1f56 | JavaScript | Darah98/todo | /src/components/todo/todo-connected.js | UTF-8 | 3,562 | 2.546875 | 3 | [] | no_license | import React, { useEffect, useState, useContext } from 'react';
import TodoForm from './form.js';
import TodoList from './list.js';
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import { SettingsContext } from '../../context/settings.js';
import { LoginContext } from '../../contex... | true |
ecd48aa66d4405efc8205b76d16b3d4a90f0f435 | JavaScript | miryalakavya/holiday_calendar_upgrad | /Holiday-Calender/src/Calender.js | UTF-8 | 4,715 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import Dates from './Dates';
import "./Calender.css";
import $ from 'jquery';
import Modals from './Modals';
export default class Calender extends Component {
constructor() {
super();
this.upcoming = [];
this.passed = [];
this.today = [];
... | true |
2fc01e6f6848f0bef6e0b579e57ff99baf956b89 | JavaScript | 17-sss/CodeSquad_FreeSchool | /02/mission1.js | UTF-8 | 2,296 | 4.1875 | 4 | [] | no_license | // # 코드스쿼드 FreeSchool - 자바스크립트 함수 :: Mission
const { log } = console;
// 1. 반지름을 입력받아 원의 넓이를 계산하는 함수를 만든다.
/*
1) 원 둘레, 면적 공식
- 원주(원의 둘레) 구하는 공식 = 2*π(파이)*r(반지름)
- 원면적 구하는 공식 = π(파이)*r(반지름)^2
참고: https://kangs523.tistory.com/7
2) 소수점 자리수 올림, 버림, 반올림, 절삭
참고: https://thingsthis.t... | true |
6d0484158ced4e45576da88f78c6861e66147358 | JavaScript | simdd/blog | /diy/function/函数扩展.js | UTF-8 | 157 | 2.828125 | 3 | [] | no_license | let log = console.log
console.log = function() {
// dosomething
log('pre log...')
log.apply(this, arguments)
log('end log...')
}
console.log('hi')
| true |
f8b03201c851506eda98a17317a6c2c87ce4627e | JavaScript | ICC3103-202110/proyecto-02-swinburn-gaedechens | /app.js | UTF-8 | 1,791 | 2.6875 | 3 | [] | no_license | const { updateadd, updatedelete, updaterefresh } = require("./update");
const { view } = require("./view");
const { model } = require("./model");
const prompt = require("prompt-sync")({ sigint: true });
const { inputchoices, inputaddcity, selectCity } = require("./view");
const { printTable } = require("console-table-p... | true |
a460099cba6aa4ef42a82762892efdcd659feb29 | JavaScript | crcaguilerapo/job-front | /js/vuejs/components/form.js | UTF-8 | 5,336 | 2.5625 | 3 | [] | no_license | const Form = {
data() {
return {
gender: "",
ethnicity: "",
is_studying: "",
level_id: "",
faculty_id: "",
graduation: "",
is_employed: "",
salary: 0,
contract_type: "",
is_work_related... | true |
95d66847f1772f3217a275876804f43f5aa8ebdc | JavaScript | UncleAnson/js_crack | /中国裁决文书网/js_demo.js | UTF-8 | 2,250 | 3.40625 | 3 | [] | no_license |
var CryptoJS = require("crypto-js");
// 增加了iv参数
function encrypt (message, key, iv) {
var keyHex = CryptoJS.enc.Utf8.parse(key);
var encrypted = CryptoJS.TripleDES.encrypt(message, keyHex, {
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
iv: CryptoJS.enc.Utf8.parse("20200511")
... | true |
e9861a1c098ce4a9ff7d43be1afd46a38f6ecd31 | JavaScript | chownchen/hiui | /components/date-picker/hooks/useTimePeriodData.js | UTF-8 | 492 | 2.609375 | 3 | [
"MIT"
] | permissive | const useTimeperiodData = (timeInterval) => {
const segment = (24 * 60) / timeInterval
let pre = 0
let next = 0
const periodData = []
const func = (val) => (val < 10 ? '0' + val : val)
for (let i = 0; i < segment; i++) {
next += timeInterval
const time =
func(parseInt(pre / 60)) + ':' + func(p... | true |
ce8e748bfbf5f96affe51bed48a72477ef82e8d5 | JavaScript | QiquWong/jpad | /JPADSandBox_v2/javascript/dexjs/latest/charts/d3/PieChart.js | UTF-8 | 3,214 | 2.65625 | 3 | [] | no_license | dex.charts.d3.PieChart = function (userConfig) {
var chart = new dex.component(userConfig,
{
'parent' : "#PieChart",
'id' : "PieChart",
'class' : "PieChart",
'csv' : {
'header' : ["X", "Y"],
'data' : [[0, 0], [1, 1], [2, 4], [3, 9], [4, 16]]
... | true |
b43d8b375691a7acd5e4c348902a932789434cc1 | JavaScript | ninjanahin/1337Code | /April Coding Challenge/[Day 7] - Counting Elements.js | UTF-8 | 1,543 | 4.28125 | 4 | [] | no_license | /**
* @param {number[]} arr
* @return {number}
*/
/*
---------------------------------
Problem Description:
Given an integer array arr, count element x such that x + 1 is also in arr.
If there're duplicates in arr, count them seperately.
e.g. Input: arr = [1,2,3] --> Output: 2
1 and 2 are counted because 2... | true |
036afcaccbb0d71afddb73bed29b85b2833d0723 | JavaScript | fsfaxi/mcl-landing | /scripts/menu.js | UTF-8 | 1,242 | 2.796875 | 3 | [] | no_license |
(function(){
var menu_onload = function(){
var expand_menu = function(i){
console.log("expanding menu : "+i);
if(menu_expand[i].className.indexOf('exp')!==-1)
{
menu_expand[i].className = menu_expand[... | true |
6bfe7325fa36e5c9f023f890cd9b0a6fee48b7f6 | JavaScript | mathiaskonye/js1-ma2 | /mathias-konye-js1-ma2.js | UTF-8 | 2,032 | 3.90625 | 4 | [] | no_license | // Question 1
const myFunctionExpression = function () {
console.log("mathiaskonye");
};
// Question 2
function btn() {
console.log("I was clicked");
}
document.addEventListener("click", btn)
// Question 3
function firstName (event) {
console.log(event);
}
document.addEventList... | true |
27e77b990167d084299a9576c0c2fd2b01813943 | JavaScript | ninhdeptrai/child | /lib/js/screen-m2_1.js | UTF-8 | 5,532 | 2.609375 | 3 | [] | no_license | var communicate = {
data: [
[
{
name: "1 Hello kid",
text_en: "Hello kid",
text_vn: "chào con",
time: 0,
image: "",
},
],
[
{
name: "2 hello teacher - chào cô giáo",
time: 0,
text_en: "Hello teacher",
text_vn: "chào ... | true |
ec23db6a7180dc8e88260f84bef0b818da7786dc | JavaScript | drywallio/drywall-web | /source/js/modules/References.js | UTF-8 | 4,354 | 2.5625 | 3 | [] | no_license | define([
'jquery', 'underscore', 'backbone',
'constants'
],
function (
$, _, Backbone,
constants
) {
var Models = {};
var Collections = {};
var Views = {};
var throttleAnimation = function (func) {
function done() {
if (ctx) {
func.apply(ctx, args);
ctx = undefined;
ar... | true |
6f73bb8f206dacf94bacb0c9fd16e13c91299953 | JavaScript | Hasnen-110/tic-tac-toe | /application/src/service/spinner.js | UTF-8 | 1,586 | 2.875 | 3 | [] | no_license | class Spinner {
constructor(){
this.listeners = new Map();
this.SPINNER = {
LOADING_START : "LOADING STARTED", // for starting loading
LOADING_STOP : "LOADING STOPPED", // for stoping loading
};
}
registerEvent(eventN... | true |
f70a56646083ae2bc75183d3168ad2ab01dcebba | JavaScript | 007krm/Day-Scheduler | /script.js | UTF-8 | 1,616 | 3.640625 | 4 | [] | no_license | // DOM SELECTORS
const currentDay = document.getElementById("currentDay");
const timeBlockContainer = document.getElementById("timeBlockContainer");
const descriptions = document.querySelectorAll(".description");
const descriptionsArray = Array.prototype.slice.call(descriptions); // descriptions to array
const hours = ... | true |
ad4ebb4f59c418bb7bff7c76721447ee19228036 | JavaScript | paarth14/Learnings-DSA | /Arrays/Arrays Q5.js | UTF-8 | 857 | 4.875 | 5 | [] | no_license | //Count Unique Numbers Problem
//Problem Statement - We have to find the unique numbers from array and store them in a new array & have a count of that array.
//Input :- [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8]
//Approach to Solve :-
// 1) Array must be sorted.
// 2) Initially i=0 & j=1 (index).
// 3) If arr[i]!=... | true |
5ef1868e677492dfd201ce7365e170e929827651 | JavaScript | chris-wdi-assignments/wayfarer | /controllers/postController.js | UTF-8 | 1,787 | 2.65625 | 3 | [] | no_license | var db = require('../models');
function getAllPosts(req, res){//GET all posts
db.City.findById(req.params.cityId, function(err, city) {
if (err) res.json(err);
res.json(city.posts);
});
}
function newPost(req, res){ //POST a new post
db.City.findById(req.params.cityId, function(err, city){
const doc... | true |
527d7a10f934ab5edbb21b44a8aa7270ea3df3ac | JavaScript | enrikiko/Java-Script | /bootcampNotes2018/week4/Joining_the_crew/js.js | UTF-8 | 458 | 3.140625 | 3 | [
"MIT"
] | permissive | /*
* Programming Quiz: Joining the Crew (6-6)
*/
var captain = "Mal";
var second = "Zoe";
var pilot = "Wash";
var companion = "Inara";
var mercenary = "Jayne";
var mechanic = "Kaylee";
var crew = [captain, second, pilot, companion, mercenary,
mechanic];
var doctor = "Simon";
var sister = "River";
var she... | true |
aaa86a46df84ef97f5dbb32aeb210ac00d501a8c | JavaScript | tonym/rad8 | /backbone/assets/app/plugins/core/app.prototype.js | UTF-8 | 7,499 | 2.59375 | 3 | [] | no_license | /**
* @file app.prototype.js
*/
define([
'underscore',
'backbone'
], function(
_,
Backbone,
moment
) {
'use strict';
var Prototype = {
activeCollection : false,
/**
* Many methods throughout the app can accept an options
* object as an argument, but it's optional. This method
... | true |
820fe0f05c2981e82091b0cfa3e82a4884153966 | JavaScript | hal313/promiseifyish | /test/ClassDefinitions.js | UTF-8 | 649 | 3.40625 | 3 | [
"MIT"
] | permissive | /**
* A sample class with functions, used for testing.
*/
export class SuperClass {
/**
* Sample function for testing.
*
* @returns {String} a string
*/
functionOne() {
return 'functionOne';
}
/**
* Sample function for testing.
*
* @returns {String} a strin... | true |
d251f1064258f69d654c4a50585ca216ffb06676 | JavaScript | TanmayJain17/TJSWebDev | /Webinar-Project/sequelize-shopping-app/routes/api/user.js | UTF-8 | 801 | 2.671875 | 3 | [] | no_license | const route = require('express').Router()
const {User} = require('../../dbs/model')
findAllUser = async (req, res, next)=>{
try{
const userData = await User.findAll({})
console.log('got user data')
res.status(200).send(userData)
}
catch(err){
console.log('error in getting da... | true |
aed3503b23e7c52bb32a4d3cee5203406d89645c | JavaScript | AlbertT96/goit-js-hw-7 | /js/01-gallery.js | UTF-8 | 1,553 | 2.78125 | 3 | [] | no_license | import { galleryItems } from './gallery-items.js';
// Change code below this line
import { createGallery } from './gallery-create.js';
//console.log(galleryItems);
const qs = (selector) => document.querySelector(selector);
const gallery = qs(".gallery");
const setImg = (img, e) => (e.target.src = img);
const keyClos... | true |
baca35ddcb34f8449483fe87f98586e12b77c857 | JavaScript | lauraqb/flight-seeker-server | /src/transformations/transformations.js | UTF-8 | 2,589 | 2.84375 | 3 | [] | no_license | function timeConvert(min) {
var num = min;
var hours = (num / 60);
var rhours = Math.floor(hours);
var minutes = (hours - rhours) * 60;
var rminutes = Math.round(minutes);
return rhours + "h " + rminutes;
}
function getLegs(legs) {
let newLegs = [];
for(var k in legs) {
var le... | true |
cf016d8d9af4e453804f5a605fda3767757c6771 | JavaScript | jasperalani/electron-tasklist | /src/controllers/view.js | UTF-8 | 2,908 | 2.578125 | 3 | [
"MIT",
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | const url = require('url')
const { getDB, validateTask, FILE_PATH } = require('../controllers/utils')
const { QueryBuilder, Condition } = require(
'@jasperalani/mysql-query-builder/js/query-builder')
window.addEventListener('DOMContentLoaded', () => {
const afterLoad = document.querySelector('.after-load')
cons... | true |
69eb9dab8a9f2dcebd7aa01acb1b283444ce1794 | JavaScript | boocami/TomaHora | /test3/js/valinicio.js | UTF-8 | 1,096 | 2.671875 | 3 | [] | no_license | function validaLoginObligatorio()
{
var rutLogin = document.getElementById("txt1").value;
var claveLogin = document.getElementById("txt2").value;
var expresionRegularRutLogin = /^[0-9]+[-|‐]{1}[0-9kK]{1}$/;
if (rutLogin.length == 0 || rutLogin == null || rutLogin ==""){
alert... | true |
8fabdbf58fc6688e14e592a3e78ee67a7ffc6f21 | JavaScript | alny/sms-tasks | /src/components/views/Auth.js | UTF-8 | 2,322 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
class Auth extends Component {
constructor(){
super()
this.state = {
credentials: {
username: '',
phone: '',
email: '',
password: ''
}
}
}
updateLogin(event){
console.log('updateLogin: ' + event.target.id + ' =... | true |
22c082ee5fe2a4cc76b5e20e3040f8ebeafa7955 | JavaScript | rahman-a/ahm-proshop | /client/src/store/productStore/update.js | UTF-8 | 1,617 | 2.5625 | 3 | [] | no_license | import {
UPDATE_PRODUCT_REQUEST,
UPDATE_PRODUCT_SUCCESS,
UPDATE_PRODUCT_FAIL,
}
from '../actionTypes'
import { useReducer, createContext, useContext } from 'react'
const updateProductState = createContext()
const updateProductAction = createContext()
const productReducer = (state, action) => {
swit... | true |
c472c09a07472f53dadd739980f728596851ffc7 | JavaScript | hayleyyounghubby/info474Midterm | /midterm.js | UTF-8 | 11,975 | 2.78125 | 3 | [] | no_license | 'use strict';
(function () {
let data = "no data";
let svgContainer = ""; // keep SVG reference in global scope
let circles = "";
let div = "";
let selected = "All";
let selected1 = "All";
let coordsX = [];
let coordsY = [];
let sp_def_data = [];
let total_data = [];
let co... | true |
a4c897679848688d85413869c000947c0a50edd7 | JavaScript | crystal/practice | /test/buyTickets.test.js | UTF-8 | 1,414 | 2.9375 | 3 | [] | no_license | import assert from 'assert';
import buyTickets from '../src/buyTickets';
describe('buyTickets', function() {
it('should return an array of objects w/ remaining funds', function() {
const people = [
{
name: 'sally',
funds: 50.00
},
{
name: 'cindy',
funds: 150.00
... | true |
c8448422599da2654a7693187efe69ce9adf3570 | JavaScript | yuanstudygroup/preparator3000 | /problems/arrays/prompts/reverse_array_in_place.js | UTF-8 | 363 | 3.390625 | 3 | [] | no_license | 'use strict';
// reverse and return an array in place (space complexity of O(1))
const reverseArrayInPlace = array => {
// your code here
var bucket=0;
for(var i=0; i<array.length/2; i++){
bucket = array[i];
array[i] = array[array.length-1-i];
array[array.length-1-i] = bucket;
}
return array;
};
... | true |
fa6836bc5004e5933c576272c833265c112a7f48 | JavaScript | adlouniahmad-dev/idreader | /public/js/pages/getMembersBuildingPage.js | UTF-8 | 1,931 | 2.796875 | 3 | [] | no_license | function getMembers(buildingId, page) {
let url = '/api/membersBuilding/' + buildingId + '/' + page;
$.ajax({
url: url,
type: 'get',
dataType: 'json',
success: function (data) {
renderMembersRecords(data.users);
renderPaginationMembers(data.maxPages);
... | true |
1892450951cf34f2d68976727a3d44a133a776e7 | JavaScript | alirezaed/JSLearning0005 | /app4-3.js | UTF-8 | 2,252 | 4.1875 | 4 | [] | no_license | //Destructuring
//*array
//*object
// const person ={
// name:"ali",
// age:12,
// lastname:"rezaei"
// }
// const name = person.name;
// const lastname = person.lastname;
// const { name : firstName,lastname } = person;
// person.name = "jafar";
// console.log(firstName,lastname);
// const arr = ["App... | true |
78a47f8dc07e4500d2fc3b731e93e3dacc43bba9 | JavaScript | yamadapc/node-inspectweb | /lib/index.js | UTF-8 | 2,346 | 2.625 | 3 | [
"MIT"
] | permissive | var Promise = require('bluebird');
var express = require('express');
var objectHash = require('object-hash');
var openBrowser = require('open');
var path = require('path');
exports = module.exports = inspectweb;
var instanceP = null;
var values = {};
var meta = {};
function start(options, cb) {
if(typeof options =... | true |
e673f4f9d36cd957652d3fef941ed4cdd774fe03 | JavaScript | ortizjs/algorithms_ | /LeetcodeQuestions/leetcode_challenges/February_challange/number_of_one_bits.js | UTF-8 | 307 | 3.421875 | 3 | [] | no_license | /**
* @param {number} n - a positive integer
* @return {number}
*/
var hammingWeight = function (n) {
let binStr = n.toString(2).split("1").length - 1
return binStr
// let counter = 0;
// for (let char of binStr) {
// if (char === "1") counter++
// }
// return counter;
}; | true |
2a7fd770c6c1dcb45327a910d83b5b283b636e97 | JavaScript | mammar86/ui-exercise | /src/components/SearchResults.jsx | UTF-8 | 2,740 | 2.75 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
export function SearchResults() {
const params = useParams();
const [searchedRestaurants, setSearchedRestaurants] = useState([]);
const [sortStatus, setSortStatus] = useState("");
const searchCity = params.s... | true |
9a754686752fbca9d9e16a5e205bb008b8388326 | JavaScript | ArafatSabbir/ES6-React-Redux | /ES6/forLoop.js | UTF-8 | 321 | 3.765625 | 4 | [] | no_license | // var i;
// var sum = 0;
// for (i = 0; i < 10; i++) {
// sum += i;
// //console.log(i);
// }
// var arr = [1, 2, 3, 4, 5];
// for (let i of arr) {
// console.log(i);
// }
var studentObj = { name: "John", age: 25, city: "New York" };
for (let key in studentObj) {
console.log(key + " : " + studentObj[key]);
}... | true |
b7846cb920a7e298e51825eb4e55d4748d18dd42 | JavaScript | buraksekili/sqlient | /server/server.js | UTF-8 | 1,551 | 2.609375 | 3 | [
"MIT"
] | permissive | const express = require("express");
const { establishConnection, execQuery } = require("./db");
const app = express();
app.use(express.json());
// Returns all tables available on database
app.post("/tables", (req, res) => {
let { host, user, password, database, query } = req.body.data;
if (!query) {
query = `... | true |
59b74b853b4905014be5dfed92d7d7e443d09ae0 | JavaScript | alnvny/wishlistApp | /public/javascript/app.wishlist.controller.js | UTF-8 | 2,047 | 2.703125 | 3 | [] | no_license | (function() {
function wishlistController(getApiDataService) {
var vm = this;
vm.noItemInWishlist = false;
vm.wishlistItems = [];
vm.apiFailure = false;
vm.errorMsg = '';
Array.prototype.contains = function(element) {
return this.indexOf(element) > -1;
... | true |
e039f938ef1d3791883a91b0c50bd30a9808f06b | JavaScript | jmerlemeier-401-advanced-javascript/basic-react-app | /src/components/FlavorForm/FlavorForm.js | UTF-8 | 1,259 | 2.90625 | 3 | [] | no_license | import React from 'react';
class FlavorForm extends React.Component {
constructor(props){
super(props)
this.state = {value: 'chocolate'}
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(e) {
this.setState({value: e.target.val... | true |
eeb762dcea7bb0a711b4187ec027d545ccd2d3dc | JavaScript | MeaghanCampbell/just-tech-news | /public/javascript/login.js | UTF-8 | 2,129 | 3.53125 | 4 | [] | no_license | // add script tag for this front end javascript to login page, only one we want to load this
// async keyword is added to functions to tell them to return a promise rather than directly returning the value
// promise represents the eventual completion or failure of an asynchronous operation and it's value
async functi... | true |
75d390ba9aca4967f3c8fbbcea8c8fb959661289 | JavaScript | gaorock/company-maijie-ofiicial-website | /js/header.m.js | UTF-8 | 1,318 | 2.640625 | 3 | [] | no_license | const navButton = document.querySelector('.nav-button');
const closeNavButton = document.querySelector('#close');
const navMenu = document.querySelector('.dropdown');
const cover = document.querySelector('.dropdown .cover');
const multi = document.querySelectorAll('.multi');
const button = document.querySelectorAll('.m... | true |
33abec877629d431698ac0001537de22d8a254af | JavaScript | adobe/leonardo | /packages/ui/src/js/createTable.js | UTF-8 | 1,824 | 2.578125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
Copyright 2022 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | true |
a5565d39c23512659c943baf827c6133ee68aa9b | JavaScript | fantasticsoul/c2-feature-list | /src/App3-setup.js | UTF-8 | 6,270 | 2.734375 | 3 | [] | no_license | /**
* Copy this file concent other APP*.js file content to App.js!
* standard js project see: https://codesandbox.io/s/concent-guide-xvcej
* standard ts project see: https://codesandbox.io/s/concent-guide-ts-zrxd5
* ------------------------------------------------------------------------
* this demo show how class... | true |
b6fbca397ac02049eba2048c499e287cae85d1e9 | JavaScript | riderjensen/arcanite-back | /middleware/auth.js | UTF-8 | 868 | 2.5625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
module.exports = (req, res, next) => {
const authHeader = req.get('Authorization');
if (!authHeader) {
req.isAuth = false;
return res.status(400).json({ error: true, message: 'Missing Auth Header' })
}
jwt.verify(authHeader, process.env.jwtsecret, function(err, decodedToken... | true |
ae3e47a554901c94719ec8bdbb3cefbdf2ecc18e | JavaScript | WhiteboardLiveCoding/WebUI | /static/js/upload.js | UTF-8 | 4,048 | 2.90625 | 3 | [
"MIT"
] | permissive | $("#file-form").submit(function (event) {
var blob = document.getElementById('file-input').files[0];
var fd = new FormData();
fd.append("file", blob);
var data_url = $("#upload-output").attr('src');
submit_image(fd, data_url);
event.preventDefault();
});
function submit_image(fd, data_url) {
var e = docu... | true |
bdf23772a629e90562e8f099dc628552e46b01e8 | JavaScript | semibran/whiteboard | /docs/index.js | UTF-8 | 7,303 | 2.890625 | 3 | [
"MIT"
] | permissive | var Whiteboard = (function () {
var whiteboards = [];
function createWhiteboard(canvas) {
var whiteboard = {
canvas: canvas,
context: canvas.getContext("2d"),
parent: canvas.parentNode,
parentRect: null,
canvasRect: null,
brushColor: "black",
brushSize: 1,
... | true |
952829c6e083c4ebd7254853c7b59def25f85178 | JavaScript | manuela-garcia/cooking-calculator | /js/scripts.js | UTF-8 | 561 | 4.125 | 4 | [] | no_license | var liters = function (gallons) {
return gallons / 0.26417;
}
// var gallons = parseInt(prompt("Enter the number of gallons:"));
//
// alert(liters(gallons));
var kilograms = function (pounds) {
return pounds / 2.2046;
}
// var pounds = parseInt(prompt("Enter the number of pounds:"));
//
// alert(kilograms(pound... | true |
ea80e8422abf963e55802427211a833ddc90b613 | JavaScript | uttues/Leetcode | /剑指Offer/18_删除链表的节点.js | UTF-8 | 401 | 3.234375 | 3 | [] | no_license | // tip: 添加一个虚拟头节点,便于处理删除头节点的问题
var deleteNode = function (head, val) {
if (!head) return null
let vHead = new ListNode(-1)
vHead.next = head
let cur = head, pre = vHead
while (cur) {
if (cur.val === val) {
pre.next = cur.next
return cur === head ? pre.next : head
}
cur = cur.next
... | true |
dd80b88b4e6e529d6bf135ac86adf2ae22351490 | JavaScript | onedayh/yunpi | /utils/util.js | UTF-8 | 5,847 | 2.546875 | 3 | [] | no_license | /*
* 小程序API
*/
// wx.showToast()
const showToast = (title, icon = 'none', duration = 1000, mask = true) => {
wx.showToast({
title: title,
icon: icon,
duration: duration,
mask: mask
})
};
// wx.showLoading()
const showLoading = (title = '加载中...', mask = true) => {
wx.showLoad... | true |
81af8d4f4d15331c0d76db966db5c54f465af036 | JavaScript | cmgriffing/presentation-angular-elements-in-angularjs | /example/react-app/src/App.js | UTF-8 | 1,326 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Sheep from './Sheep';
import MyComponents from './Components';
const { Wolf } = MyComponents;
class App extends Component {
state = {
sheepImage: './sheep.jpg',
wolfImage: './sheep.jpg'
}
revealed = fal... | true |
67762e54ba0e6668062c2efc9ab26f4e72774d09 | JavaScript | saumitraphadke/Plane-game | /sketch.js | UTF-8 | 2,532 | 3.296875 | 3 | [] | no_license | var mountain1, mountain1Img, mountain2;
var mountain2Img, mountain3, mountain3Img;
var mountain4, mountain4Img, p, pImg;
var gameState = "play";
function preload(){
mountain1Img=loadImage("mountain1.png");
mountain2Img=loadImage("mountain2.png");
mountain3Img=loadImage("mountain3.png");
mountain4Img=loadImage(... | true |
51db33a309444501906e7beeb547b500ed4a814f | JavaScript | Schrock04/Profile_DongBin | /script/common.js | UTF-8 | 8,339 | 3.359375 | 3 | [] | no_license | /* HEADER */
window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
window.onload = function () { scrollFunction() };
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
var header = document.getElementById('header');
if (document.documentElement.scrollTop > 70) {
if (!header.clas... | true |
ced1805663a7415050fa7eab42cbccbfdfed76ed | JavaScript | bby/guff-app | /www/javascripts/application.js | UTF-8 | 10,836 | 2.546875 | 3 | [] | no_license | function Guff() {
}
Guff.prototype = {
loc: null,
watchId: null,
maxchars: 141,
db: null,
init: function() {
//bind interactions - ******this should probably be moved till after we are happy with accuracy******
this.postMessage();
this.refreshLocation();
this.co... | true |
18b2eb8e9fb0f22cc07d17cdb7c7439ec0cc9255 | JavaScript | bousoutennshi/amazon | /tool/search/js/common.js | UTF-8 | 641 | 2.671875 | 3 | [] | no_license | function itemDelete(asin){
var ret = confirm('削除しますか?');
if( ret == true ){
$.ajax({
type: "POST",
url: "./delete.php",
data: {
"asin": asin
},
success: function(data){
if( data.status === 'OK' ){
... | true |