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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b7bbe46ad9dd8fec28f27036dad8a411f9013c57 | JavaScript | ewgalassi/bamazon | /bamazonCustomer.js | UTF-8 | 3,226 | 2.640625 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var table = require("console.table");
var chalk = require("chalk");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "root",
database: "bamazon_db"
});
var itemList = [];
var quantList... | true |
06bfc6a32f028dce10f9b12217b669d4efddc8c6 | JavaScript | ramonrovirosa/KnockemOutGame | /src/Hero.js | UTF-8 | 8,294 | 3.296875 | 3 | [] | no_license | //Hero Class, a subclass of Charecter, responsible for main charecter.
function Hero() {
//inherits from charecter
Hero.prototype = new Character();
//necessary to call events.
var me = this;
//Boolean: is the charecter facing right?
//Boolean: is the charecter attacking?
var facingRi... | true |
66c8fe7e6b09b2142fe70c948028f102f8d57428 | JavaScript | herokillv1/BT-tuan-5 | /Case-study/Code OOP/main.js | UTF-8 | 861 | 2.765625 | 3 | [] | no_license | let canvas = document.getElementById("myCanvas");
let ctx = canvas.getContext("2d");
let ball = new Ball((canvas.width/2), (canvas.height-30),5,-5, 15,3);
let paddle = new Paddle(15,200,(canvas.width-200)/2);
let monster = new Monster(5,6,150,30,32,30,70,0);
let show = new Show();
function playgame() {
ctx.clearR... | true |
1a189b1b95817928e9008541ded55a84fddbc046 | JavaScript | b7s9/ottd-react | /src/pages/global.js | UTF-8 | 3,632 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import Viewer from './viewer'
import Form from './form'
import localforage from 'localforage'
class Global extends Component {
constructor(props) {
super(props)
this.state = {
displayViewer: true,
displayForm: false,
niceData: [],
todoData: []
}
this.sto... | true |
00508efb78e85c1b080bdd80ae88a3f643da8e62 | JavaScript | fengluluf/nodejs | /05-timer/02-timer-02.js | UTF-8 | 206 | 2.75 | 3 | [] | no_license | #!/usr/bin/node
console.log("start...");
var count=0;
var timeID=setInterval(loop,500);
function loop(){
count++;
console.log("I will loop forever");
if(count==6){
clearInterval(timeID);
}
}
| true |
e78c4067a93f3701ee739813cf14af1e76910e6e | JavaScript | rochafialvin/bdg-mongodb | /api.js | UTF-8 | 4,831 | 2.9375 | 3 | [] | no_license | // API CONF
const express = require('express')
const app = express()
const port = 2099
app.use(express.json())
// MONGODB CONF
const mongodb = require('mongodb')
// Membuat koneksi ke mongodb
const MongoClient = mongodb.MongoClient
const URL = "mongodb://127.0.0.1:27017"
const databaseName = 'bdg-mongodb'
MongoClie... | true |
14849dbdb5948f9d3964ca33620b51be04d2e4f7 | JavaScript | GHorozov/OnlineStore | /js/service.js | UTF-8 | 1,974 | 2.53125 | 3 | [] | no_license | let service = (() => {
function getAllItems(){
let endPoint = 'items?query={}&sort={"_kmd.ect": -1}';
return remote.get('appdata', endPoint,'kinvey');
}
function createItem(title, description, pictureUrl, price) {
let endPoint = 'items';
let currentDate = new Date()
... | true |
ab29f18779159ab1761d49400baa96264a3ac79e | JavaScript | Oddert/pinapathy | /client/src/components/auth/register.js | UTF-8 | 3,345 | 2.5625 | 3 | [
"MIT"
] | permissive | import React from 'react';
class Register extends React.Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
password_check: '',
warning: false,
nameWarning: false
}
this.handleSubmit = this.handleSubmit.bind(this);
this.handleCha... | true |
758a0bdbfd67b3f73a7ff2620755eca6d733b101 | JavaScript | creatorChou/leetcodeAns | /page3/levelOrder.js | UTF-8 | 815 | 3.46875 | 3 | [] | no_license | /**
* 102. Binary Tree Level Order Traversal
* https://leetcode.com/problems/binary-tree-level-order-traversal/description/
*/
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @retu... | true |
b501749f1f08eada0f1c4933a26d75be3228fa1f | JavaScript | kaciej/V-school | /exercises/todo-list/src/containers/toDo-container.js | UTF-8 | 2,434 | 2.625 | 3 | [] | no_license | import React from "react";
import ToDoList from "../components/toDoList.js";
import autoBind from "react-autobind";
import InlineEdit from 'react-edit-inline';
class ToDoContainer extends React.Component {
constructor() {
super();
this.state = {
list: [],
inputValue: ""
... | true |
cbfde61a54e471b5b26a76d97c30d8c148e82e6c | JavaScript | rruimor/github-tool | /server/helpers/verifyToken.js | UTF-8 | 606 | 2.53125 | 3 | [
"MIT"
] | permissive | const jwt = require('jsonwebtoken');
function verifyToken(req, res, next) {
// Get App API Token
let token = req.headers['x-access-token']
// Return if no token found
if (!token) return res.status(401).send({ auth: false, message: 'No token provided.' });
// Decode API Token to get User ID
jwt.verify(tok... | true |
12f1ac9b427ee77fb22b868d41b81e9bb7c6bc5d | JavaScript | 6RiverSystems/webviz | /packages/webviz-core/src/components/ReactChartjs/zoomAndPanHelpers.test.js | UTF-8 | 1,177 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | // @flow
//
// Copyright (c) 2018-present, Cruise LLC
//
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
import { inBounds } from "./zoomAndPanHelpers";... | true |
161cbd45ef6ada44343e4011093bd32d7c1c44b9 | JavaScript | travisldunn/redditSearch | /src/main/RedditContainer.js | UTF-8 | 1,270 | 2.640625 | 3 | [] | no_license | import React, { Component } from "react";
import SearchBar from "../components/SearchBar";
import PostContainer from "../components/PostContainer";
import { toast } from "react-toastify";
class RedditContainer extends Component {
state = {
searchUrl: "https://www.reddit.com/r/funny.json?limit=25",
posts: []
... | true |
8c079ec8cdc9b34f6aca8d6b68e15a069a6ae3a7 | JavaScript | kumavis/uscis-waittimes | /index.js | UTF-8 | 3,495 | 2.703125 | 3 | [] | no_license | 'use strict'
const fs = require('fs')
const request = require('request').defaults({ jar: true })
const { JSDOM } = require('jsdom')
const pify = require('pify')
const asyncq = require('async-q')
const mkdirp = require('mkdirp')
const offices = require('./offices.json')
const month = (1000 * 60 * 60 * 24 * 30) // in ms... | true |
c823f28a81f4bf626f494dda9843027f107e5fd5 | JavaScript | SincerelyBrittany/pokemon-react-walkthrough-with-notes | /src/AllPokemonContainer.js | UTF-8 | 2,220 | 3.25 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import Pokemon from './Pokemon'
import {PokeBtn} from './Styles'
export default function AllPokemonContainer(props){
//useState gives us back two things.
//1. it gives us back a way to get the state, 2. it gives us a way to set the state
//Below pokemon is a ge... | true |
68db3c5659b4675dcd974dfea640e3c097ec7610 | JavaScript | ONeville/Gtion-notes | /server/samples/index.js | UTF-8 | 581 | 2.578125 | 3 | [] | no_license | const { ApiModel, check, displayMessage, getById } = require('./more-expo');
console.log('API Setting: ', ApiModel);
console.log('Check Method: ', check('It works'));
// getById(10)
// .then(t => console.log(displayMessage(t.message)))
// .catch(e => console.log(e.message));
async function ReadyAsync(... | true |
6f6206bea5c2cba7fd651cd33d29fe7889d3abd7 | JavaScript | selvananbu/liorderstatus | /src/lidynamicattributeedit/lidynamicreducers/lidynamicattributesreducer.js | UTF-8 | 713 | 2.625 | 3 | [] | no_license | const SET_ATTRIBUTE_LIST = 'SET_ATTRIBUTE_LIST'
const SET_FAV_INDEX = 'SET_FAV_UNIT_INDEX'
const setAttributeList = (list) => ({
type: SET_ATTRIBUTE_LIST,
attrList: list
})
const setFavUnitIndex = (attrType, favIndex) => ({
type: SET_FAV_INDEX,
attrType: attrType,
favUnitIdx: favIndex
})
const attributesReduce... | true |
960aea15cb730e5ad6f0c4544c089781dcaa6ca0 | JavaScript | MeganFranco/vschool-assignments | /exercises/archives/Enemy-Generator/enemyGenerator.js | UTF-8 | 3,233 | 3.921875 | 4 | [] | no_license | //http://coursework.vschool.io/enemy-generator/
var enemyType = ["Ancient Dragon", "Prowler", "Mighty Grunt"];
//var myEnemy = "";
//hitPoints = 0;
//var enemyArray [];
//defense = Number(hitPoints) * 3;
//function returnNumber() {
// mynumber = enemyType[Math.floor(Math.random() * 3 )];
// console.log(mynumbe... | true |
4c63d391d6d482cd0d94dcca044adbec6ceb4242 | JavaScript | AMcDuffie/Burger | /public/assets/js/burger.js | UTF-8 | 283 | 2.53125 | 3 | [] | no_license | $(document).ready(function() {
$('.submit').click(function(event) {
var dataId = event.target.getAttribute('data-id')
$.ajax({
method: 'PUT',
url: '/' + dataId
}).done(function() {
location.reload()
})
})
}) | true |
817429535ff15e56b072d4fe8f532286bc787c1e | JavaScript | xz333221/leetCode_test | /其他/有效的括号.js | UTF-8 | 1,484 | 3.90625 | 4 | [] | no_license | /**
* fileName:有效的括号
* time:2019-12-30
* todo:给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。
有效字符串需满足:
左括号必须用相同类型的右括号闭合。
左括号必须以正确的顺序闭合。
注意空字符串可被认为是有效字符串。
示例 1:
输入: "()"
输出: true
示例 2:
输入: "()[]{}"
输出: true
示例 3:
输入: "(]"
输出: false
示例 4:
输入: "([)]"
输出: false
示例 5:
输入: "{[]}"
输出: true
... | true |
eee6ad30e031fd606533cade184db394ee8d6bc4 | JavaScript | csula-students/cs-3220-spring-2018-adityanemade | /lab3/client/src/game.js | UTF-8 | 669 | 3.078125 | 3 | [] | no_license | // default interval as 1 second
const interval = 1000;
/**
* loop is main loop of the game, which will be executed once every second (
* based on the interval variable configuration)
*/
export function loop (store) {
// TODO: increment counter based on the generators in the state
// hint: read how many "generator... | true |
74f41905bfa3ba00a8e48b801f042cd031034372 | JavaScript | nwyll/Indecision | /src/playground/stateless-functional-components.js | UTF-8 | 540 | 3.40625 | 3 | [] | no_license | //stateless funtional components
//they are stateless, they are React components, created with a function
//they still allow for props to be passed down
const User = function() {
//just return the jsx
//this function is basically the equivalent of render
};
//same with an arrow function
const Member = (props) =>... | true |
35b5c6d0357d5695e392202277c7d2b254201938 | JavaScript | asbjornh/A-sharp | /lexer.js | UTF-8 | 2,655 | 2.734375 | 3 | [
"MIT"
] | permissive | const error = require("./util/error");
const keywords = [
"let",
"true",
"false",
"if",
"else",
"then",
"import",
"from",
"export"
];
/* prettier-ignore */
const operators = [
"=>",
"|>", ">>", "<|", "<<",
"::", "@",
"<=", ">=", "!=", "==", "||", "&&",
"<", ">", "=", "+", "-", "/", "%", "*"... | true |
e3ede672d61291f05a00c11f9b4833922c9171f6 | JavaScript | pimlu/jbogame | /shared/utils.js | UTF-8 | 4,051 | 2.625 | 3 | [] | no_license | (function() {
//silly differentiation based on what module system we're using
if(typeof define==='function') {
define([],impl);
} else if(typeof module==='object') {
module.exports=impl();
}
//our actual implementation
function impl(seedrandom,Noise) {
var LinkedList=(function() {
function... | true |
1d2dbf50e5cd3802a0de7b1c0142719b2365dfe3 | JavaScript | Jaum97/Javascript-Playground | /Practice/functionsent.js | UTF-8 | 440 | 2.734375 | 3 | [] | no_license | function *adder(total=0) {
let increment=1;
do {
switch (request = function.sent){
case undefined: break;
case "done": return total;
default: increment = Number(request);
}
yield total += increment;
} while (true)
}
let tally = adder();
tally.next(0.1); // ar... | true |
1f403b2bfad059f1ec34d9942ab147a99a655da5 | JavaScript | loschorts/swellv2 | /frontend/modules/current_forecast_state.js | UTF-8 | 2,390 | 2.5625 | 3 | [] | no_license | var SpotStore = require("../stores/spot_store");
var ForecastStore = require("../stores/forecast_store");
var WeatherStore = require("../stores/weather_store");
var CountyForecastStore = require("../stores/county_forecast_store");
var SpotActions = require("../actions/spot_actions");
var ForecastActions = require("../... | true |
99fc078457e8b97757f3ac903d4109e36204be76 | JavaScript | JohnZonneveld/hamlogbook-js | /src/map.js | UTF-8 | 5,801 | 3.4375 | 3 | [
"MIT"
] | permissive | const gMapsScript = "https://maps.googleapis.com/maps/api/js?callback=initMap&signed_in=true&key=AIzaSyBXq06q4pG6fATSosF-sSte5QK8WuanI1Q&language=en"
let remLatLon
let myLatLon
function loadMapScript() {
try {
if (google) {
google = {}
}
} catch (e) {}
mapSpace = document.getEle... | true |
15af78dbc64d0c99e4fdd0e2e8c06470082c8c1f | JavaScript | WorkshopLabs/perstep2 | /public/app.js | UTF-8 | 3,622 | 2.78125 | 3 | [] | no_license | /*
var data = [
{id: 1, author: "Pete Hunt", text: "I have some problems with this! help"},
{id: 2, author: "Andrea Soria", text: "No problem, this is just a bug with de API"},
{id: 3, author: "Pete Hunt", text: "I posted it in stackoverflow, and they say its a hack"}
];
var CommentBox = React.createClass({
handle... | true |
02a041a198eb42e4504ca00a249161d120f6b25c | JavaScript | AndriyPytsko/Galanix_task2.2 | /js/index.js | UTF-8 | 1,195 | 3 | 3 | [] | no_license | 'use strict';
let srcList = Array.from(document.querySelectorAll('[data-img]')).map(item => item.src);
let img = document.getElementById('modal-img');
let modal = document.getElementById('modal');
let close = document.getElementById('close');
let prev = document.getElementById('prev');
let next = document.getElementByI... | true |
2af5cc4180f2c08efc92747ee4e864253708333d | JavaScript | swathivadaje/91Social | /FrontEndAssignment/user-form/script.js | UTF-8 | 859 | 2.859375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", performFormAction);
function performFormAction(event) {
const userForm = document.getElementById('user-form');
if (userForm) {
userForm.addEventListener('submit', validateForm);
}
}
function validateForm(event) {
event.preventDefault();
event.s... | true |
8c6e45000224bda6a7e16d5cab24c193ebbcc16e | JavaScript | meaella/TG-Pre-Work | /Code-Academy-Exercises/Introduction-To-JavaScript/Functions/Parameters-and-Arguments.js | UTF-8 | 282 | 3.265625 | 3 | [] | no_license |
function sayThanks(name) {
console.log('Thank you for your purchase '+ name + '! We appreciate your business.');
}
sayThanks('Cole');
/* I learned that functions can take inputs and use the inputs to perform a task.
When declaring a function, we can specify its parameters */
| true |
e1a734dd78c55cf054adca42193788710fceb429 | JavaScript | Barry91/Waiting-is-Fun | /game/static/js/lib.js | UTF-8 | 1,720 | 2.875 | 3 | [] | no_license | ( function () {
var lastTime = 0;
var vendors = [ 'ms', 'moz', 'webkit', 'o' ];
for ( var x = 0; x < vendors.length && !self.requestAnimationFrame; ++ x ) {
self.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ];
self.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] ||... | true |
41ce79c2dac4a45d7d04ce3d866edcbbec9a7189 | JavaScript | vishnuraj212/vishnu_fullstack | /HTML/largest3.js | UTF-8 | 96 | 2.984375 | 3 | [] | no_license | var a=10;
var b=20;
var c=30;
if(a>b&&a>c)
{
console.log(a+"is bigger");
}
else
{
if()
} | true |
1e6a5f89ce187541a4342bb02f90755bebca9cb2 | JavaScript | JeffyMesquita/OrigamidCursos | /javaScript-para-iniciantes/boolean-e-condicionais/script-aula.js | UTF-8 | 1,117 | 3.703125 | 4 | [] | no_license | var possuiGraduacao = true;
var possuiDoutorado = true;
if(possuiGraduacao) {
console.log('É verdadeiro!');
var x = 10;
} else if(possuiDoutorado){
console.log('Possui Doutorado');
} else {
console.l1og('não possui nada');
}
var nome = '10kg' / 10;
if(nome) {
console.log(nome);
} else {
console.log... | true |
72c0d2d4e0bb4c255f0504c8a4e9fb1481581ffb | JavaScript | 00-00-00-11/dev-Pokemon_Bot | /commands/pokemon/pick.js | UTF-8 | 2,379 | 2.78125 | 3 | [] | no_license | const {Command} = require('discord.js-commando');
const {MessageEmbed} = require('discord.js');
const db = require('quick.db');
module.exports = class PickCommand extends Command{
constructor(client){
super(client, {
name: "pick",
group: "pokemon",
memberName: "pick",
... | true |
a53f4bdc1204cca8f28880e35fe69ad9467e5276 | JavaScript | lordsngrmkr/workbench | /twitter.js | UTF-8 | 2,645 | 3.09375 | 3 | [] | no_license | /* document ready loop:
- triggers anything inside once the HTML document
is done loading
*/
$(document).ready(function() {
// console.log is used to send text data to the console
console.log('doc ready!');
// a function called when a click event is registered on
// an element with the id of 'submit'
... | true |
09413ff91b7ede77ba97a42b394805de0ecaa79d | JavaScript | JustAnAlien69/PacmanGame | /sketch.js | UTF-8 | 2,807 | 2.765625 | 3 | [] | no_license | const FIELD = [
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"0,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,0",
"0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,3,0,0,0",
"0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0",
"0,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0",
"0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0",
"0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1... | true |
f507557fbcfad7bb670f2f46f8dc2f175dbdc0bd | JavaScript | austincline09/teamBuilder | /client/modules/team/reducers/teamSingleReducers.js | UTF-8 | 3,792 | 2.59375 | 3 | [] | no_license | /*****
SINGLE REDUCERS GO HERE
*****/
// import * as singleActions from '../actions/teamSingleActions';
import { singleActions } from '../actions';
function single(state = {
isFetching: false
, item: {}
, populated: false
, error: null
, status: null //creating, editing
}, action) {
switch(action.typ... | true |
d537b364182c1d967b28f0eb6540453ab9f553d1 | JavaScript | sebbdk/thelist | /js/main.js | UTF-8 | 995 | 2.640625 | 3 | [] | no_license | /*
* @Author: sebb
* @Date: 2014-04-04 20:44:35
* @Last Modified by: sebb
* @Last Modified time: 2014-04-07 03:07:15
*/
(function($) {
$(window).on('resize', onResize);
$(document).ready(function() {
onResize();
setTimeout(function() {
$('body').addClass('active');
}, 300);
loadGames();
});
fun... | true |
41c698c39a24d42e9c20293b483d232e77f31f14 | JavaScript | HaykGabrielyan62/Homeworks_JS | /Homeworks_Advanced/Homework_2_Adv/HW2_Exercise7_Adv.js | UTF-8 | 279 | 3.21875 | 3 | [] | no_license | function findOdds(arr) {
let newArr = []
for (let i = 0; i < arr.length; i++) {
if (arr[i] % 2 != 0) {
newArr.push(arr[i])
}
}
for (let j = 0; j < newArr.length; j++) {
newArr[j]*=3;
}
return newArr;
}
console.log(findOdds([5, 4, 78, 0, -3, 7]))
| true |
9fc039c0ac1505b615941a51dabd8c6a3f8fa597 | JavaScript | justindevpro/angcaster-client | /src/components/app/app.controller.js | UTF-8 | 916 | 2.921875 | 3 | [] | no_license |
class AppController{
constructor(weather, geolocation){
this.weather = weather;
this.location = 'Palo Alto, CA';
this.geolocation = geolocation;
}
$onInit(){
this.geolocation
.getPosition()
.then(coordinates => {
const {latitude, longitude} = coordin... | true |
ca5f0274c9d3ca579d0b590fddd71423341a50c2 | JavaScript | ftvision/ftvision.github.io | /themes/ft_personal/static/js/tab.js | UTF-8 | 1,670 | 2.796875 | 3 | [] | no_license | function MakeTabItem(id) {
let tab = document.createElement('button');
tab.classList.add("UnderlineNav-item");
tab.classList.add("text-mono");
tab.setAttribute('role', 'tab');
tab.innerHTML = id;
return tab;
}
function Activate(tab_group){
let tab_list = tab_group.querySelector(".tab-list");
let tab_co... | true |
837638a46a53cd51e30caa452ccaf58f4a7296c1 | JavaScript | C0unterPo1nt/LucyBot | /plugins/operate.js | UTF-8 | 1,181 | 2.75 | 3 | [
"MIT"
] | permissive | class Operate {
static get name() {
return 'operate';
}
constructor(bot, botOp) {
this.bot = bot;
this.botOp = botOp;
this._handleMessage = this._handleMessage.bind(this);
}
enable() {
this.bot.on('message', this._handleMessage);
}
disab... | true |
2fd8701e9204600ac5b7ad76f3f701e5260700e8 | JavaScript | hasrulhussin/js_first_january_is_sunday | /js_date_first_january_is_sunday_checker.js | UTF-8 | 358 | 3.828125 | 4 | [] | no_license |
var counter = 0;
for (var year = 2014; year <= 2050; year++){
var d = new Date(year, 0, 1); // 2014-2050 Jan 1
// 0 = Sunday, because JS date starts with Sunday
if( d.getDay() === 0 ){
document.write("1st January is being a Sunday "+year+"<br />");
counter++;
}
}
document.write("<br />" +"T... | true |
28669fa6a173e3e8a783b55c7e7737582261b5ed | JavaScript | Spatts/Web1 | /public_html/assign11.js | UTF-8 | 2,112 | 2.984375 | 3 | [] | no_license | var error3 = 0;
var error4 = 0;
var error5 = 0;
function phoneV() {
var phoneNumber = document.getElementById("phoneVald");
var posPhone = phoneNumber.value.search(/\d{3}-\d{3}-\d{4}$/);
if(posPhone != 0)
{
document.getElementById("checkPN").innerHTML = "Enter a valid number";
phoneNumber... | true |
e345f735554f1386234d36b3355a2f12631c48d7 | JavaScript | huochezaodian/canvas | /share/style.js | UTF-8 | 1,900 | 2.859375 | 3 | [] | no_license | 'use strict'
const canvas = document.getElementById('canvas');
const gd = canvas.getContext('2d');
//线性渐变
const lg = gd.createLinearGradient(400,100,600,300);
//lg.addColorStop(0-1,color);
lg.addColorStop(0.3,'red');
lg.addColorStop(0.5,'blue');
lg.addColorStop(0.8,'green');
gd.strokeStyle = lg;
gd.strokeRect(400,100,... | true |
a1b79386fc22f3f50ed825042770ba1d4fb9a772 | JavaScript | borntofrappe/Practice-Front-End-Web-Development | /CodePenChallenge Details/script.js | UTF-8 | 3,153 | 4 | 4 | [] | no_license | // target all answers in the HTML document
const answers = document.querySelectorAll(".container .question .answers .answer");
// target the h1 header in which to include the results of the quiz
const headerResult = document.querySelector(".result");
// listen for a click event on each answer, at which point re... | true |
a19663303dfed71555ae3dea961c2f16f3a915f2 | JavaScript | kshart/pikonet-server | /src/externalApi/ChannelBusAPI.js | UTF-8 | 1,787 | 2.828125 | 3 | [
"MIT"
] | permissive | /**
* API для работы с данными каналов.
* @author Артём Каширин <kshart@yandex.ru>
* @memberof api
*/
export default class ChannelBusAPI {
constructor ({ connection }) {
/**
* Уникальный ключ канала
* @type {String}
*/
this.connection = connection
this.registredChannels = new Map()
... | true |
3910e17c07e6a4e1ef867faef28bb7552811ebc6 | JavaScript | kazup0n/sapporo-cinemas.fun | /functions/js/crawlers/cinema_frontier.js | UTF-8 | 1,798 | 2.625 | 3 | [] | no_license |
const client = require('cheerio-httpcli')
const _ = require('lodash')
const logger = require('../logger')
const daysUntillNextFridayFromToday = require('../date').daysUntillNextFridayFromToday
const BASE_URL = 'http://www.cinemafrontier.net'
/**
* fetch
* @param {Date} date
*/
function fetch(date) {
const url ... | true |
960072ac6d5bd4606b7dec0d9b098704ff4e1a10 | JavaScript | Easy-workshop/theorie | /ajax/v1/chapitre_02/galerie.js | UTF-8 | 610 | 2.625 | 3 | [] | no_license | //----------------------------------
// dipositive
//----------------------------------
function charge_galerie(){
place_diapo()
}
//----------------------------------
// diapositive
//<div id="planche-contact">==>ok
//<div><img src="../images/Calenques/g1.jpg" width="259" height="194" alt="calenques"> </div>
//--... | true |
bc211cb4305ce994a52ced7fb36937a759e05e9b | JavaScript | twilkes149/missionApp | /server/src/routes/forgotPassword.js | UTF-8 | 2,858 | 2.65625 | 3 | [] | no_license | const express = require('express');
var router = express.Router();
var mailSender = require('@sendgrid/mail');
var Database = require('../middleware/database');
router.post('/forgotPassword', async (req, res, next) => {
console.log("forgotPassword");
let conn = res.locals.conn;
let email = (req.body.email) ? Da... | true |
fa15fcf82f22c301c61f49e5489a82d9630bcaa5 | JavaScript | wwwK/poly.gl | /src/webgl/clear.js | UTF-8 | 2,858 | 2.515625 | 3 | [
"MIT"
] | permissive | import { withParameters } from '../webgl-context/context-state';
import { assertWebGL2Context } from '../webgl-utils';
import assert from '../utils/assert';
// Should collapse during minification
const GL_DEPTH_BUFFER_BIT = 0x00000100;
const GL_STENCIL_BUFFER_BIT = 0x00000400;
const GL_COLOR_BUFFER_BIT = 0x00004000;
... | true |
950e62cc7f2fcd6b93ce6418d4665669d8773aa8 | JavaScript | gchapotot/backend_jobs_chapotot | /level4/Price.js | UTF-8 | 1,804 | 3.03125 | 3 | [] | no_license | // Planning de Garde Level 4
const data = require("./data.json");
//Price class
class Price {
constructor() {
//global pdg Fee
this.pdg_fee = 0;
//number of shift interim
this.interim_shifts = 0;
//output json
this.outputData = null;
t... | true |
a56becb6b3af47007055a728744c4b14834718b6 | JavaScript | codefellows-seattle-javascript-401d18/12-express-middleware | /lab-tim/route/route-toy.js | UTF-8 | 1,380 | 2.625 | 3 | [] | no_license | 'use strict';
const storage = require('../lib/storage');
const debug = require('debug')('http:route-toy');
module.exports = function(router) {
router.post('/api/toy', (req, res, next) => {
debug('/api/toy POST');
return storage.create(req.body)
.then(toy => res.status(201).json(toy))
.catch(err ... | true |
14155c7707597252be363c9f95fde867e82fbfdb | JavaScript | cphdat3sem2019spring/react-fetch-crud | /src/components/App.js | UTF-8 | 1,259 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import AddEditPerson from "./AddEditPerson";
import AllPersons from "./AllPersons";
class App extends Component {
constructor(props) {
super(props);
this.state = {
persons: [],
//Use this to pass down a new or existing (edit) person to AddEditPerson
... | true |
152a3e43d469e3799bc0d5145015c77423d2aa2d | JavaScript | kalisjoshua/crudites | /src/getFiles.js | UTF-8 | 641 | 2.6875 | 3 | [] | no_license | const nodeJS = ['fs', 'path']
.reduce((acc, lib) => { acc[lib] = require(lib); return acc }, {})
const isDir = (path) => nodeJS.fs.statSync(path).isDirectory()
const readDir = (path) => nodeJS.fs.readdirSync(path)
function getFilesRecursive (path) {
function reducer (acc, p) {
const route = nodeJS.path.resolv... | true |
5c272b24ef21efa86d761d329937425c11883258 | JavaScript | NouraKaddoura/Class-14-Septemeber-30 | /2_rock_paper_scissors/js/index.js | UTF-8 | 2,419 | 3.78125 | 4 | [] | no_license | //Together we are doing it in Vanilla Jabascript
//Your homework - due next wednesday will be to do it
//In Jquery
//The Logic will ne the same
//start off with scores
var humanScore = 0;
var computerScore = 0;
//.on(click) -> PURE JS: .onclick()
//grab the element, set an event listener
document.getElementById('roc... | true |
a19427890c422d828f6ec766f102e5db9d93f31c | JavaScript | pmnhatit/QLCC-API | /components/apartment/apartController.js | UTF-8 | 1,880 | 2.640625 | 3 | [] | no_license | const apartServices = require('./apartServices');
const {validateApartmentId, validateUserId} = require('../../services/validation/validationApartment');
//GET
module.exports.getAllApartment = async (req, res, next) =>{
try {
const apartments = await apartServices.getAllApartment();
res.status(200).... | true |
6b92da9721a09524315261f7051c9bd22a2d8ed9 | JavaScript | yk2001525/node | /level1/modules/readStaticFile.js | UTF-8 | 926 | 2.765625 | 3 | [] | no_license | var path = require('path')
var fs = require('fs')
var mime = require('mime')
var url = require('url')
function readStaticFile(res,filePathname){
//解析后对象的 ext 属性中保存着目标文件的后缀名
var ext = path.parse(filePathname).ext;
// 获取后缀对应的 MIME 类型
var mimeType = mime.getType(ext);
console.log(ext)
... | true |
861e732ad86b6300b084bf332a06e84588aeff66 | JavaScript | sajadtorkamani/javascript-katas | /src/dead-fish/solution.js | UTF-8 | 422 | 3.109375 | 3 | [] | no_license | /**
* @param {string} str
* @returns {Array<number>}
*/
const parse = str => {
let result = []
let val = 0
str.split('').forEach(cmd => {
switch (cmd) {
case 'i':
val += 1
break
case 'd':
val -= 1
break
case 's':
val = val * val
break
... | true |
cf5f1cf3683e2b7314a1f6b9bb79276e9efd942c | JavaScript | chak-kit/FL-11 | /FL11_HW7/homework/src/js/task2.js | UTF-8 | 2,058 | 3.59375 | 4 | [] | no_license | const initialMinPocketRange = 0;
const initialMaxPocketRange = 8;
const initialStartPrice = 100;
const attemptsCount = 3;
const winningRate = 2;
const rangeIncrease = 4;
const denominator = 0.5;
const zero = 0;
let playTheGameMessage = 'Do you want to play a game?';
while (confirm(playTheGameMessage)) {
let minP... | true |
52375b57705f976a40dcd1e2d547b265b9765a34 | JavaScript | suhaybabsi/math-chart | /app/js/main.js | UTF-8 | 6,577 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | function Rect(xmin, xmax, ymin, ymax) {
this.xmin = xmin;
this.xmax = xmax;
this.ymin = ymin;
this.ymax = ymax;
}
Rect.prototype.xrange = function() {
return this.xmax - this.xmin;
};
Rect.prototype.yrange = function() {
return this.ymax - this.ymin;
};
Rect.prototype.translateX = function(dx) {... | true |
c53af6072d8f1f9a7e61b2ab6fbed665bdc1f04c | JavaScript | avocadok/express | /server.js | UTF-8 | 683 | 2.78125 | 3 | [] | no_license | const moment = require ('moment');
const express = require ('express');
const app = express();
const bodyParser = require('body-parser')
const port = 3000;
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json())
const messageList = [];
app.post('/api/messages', (req, res) => {
res.send('ok');
... | true |
87e439461a27778901da24f6f2a12d0b59366ec4 | JavaScript | wafaankoush99/data-structures-and-algorithms | /Data-Structures/tree-intersection/tree-intersection.test.js | UTF-8 | 1,755 | 3.3125 | 3 | [
"MIT"
] | permissive | 'use strict';
const Node = require('../tree/tree').Node;
const BinaryTree = require('../tree/tree').BinaryTree;
const treeIntersection = require('./tree-intersection');
const { expect } = require('@jest/globals');
// first tree
let tree1 = new BinaryTree();
tree1.root = new Node(7000);
let one = new Node(3000);
... | true |
87e7eb69ca88f87201d92b656b2c4a6d58872253 | JavaScript | firejake308/reakt | /src/structure/bond.js | UTF-8 | 560 | 2.609375 | 3 | [] | no_license | module.exports = class Orbital {
constructor(atom1, atom2) {
this.atom1 = atom1;
this.atom2 = atom2;
// assign to atom 2 as well
if (atom2 && atom2 !== atom1)
atom2.assignEmptyOrbital(this);
}
get isEmpty() {
return !(this.atom1 || this.atom2);
}
... | true |
da2e7d4c55a4af411cf4cadefa65455029dc1010 | JavaScript | dlarner3194/spawn | /repo-service/api.js | UTF-8 | 1,243 | 2.5625 | 3 | [
"MIT"
] | permissive | const axios = require("axios");
const UriBuilder = require("./builders/uri-builder");
const baseUrl = process.env.GITHUB_BASE_URL;
const authToken = process.env.AUTH_TOKEN;
async function get(user) {
const uri = UriBuilder.build(baseUrl, user);
try {
const resp = await makeRequest(uri, "GET");
console.l... | true |
3ce34a09ab305ca138b71321abb830829ec557d5 | JavaScript | Herob527/benchmarking_js | /sendBenchmarkResultsToApiServer.js | UTF-8 | 1,522 | 2.65625 | 3 | [] | no_license | import axios from "axios";
export class sendBenchmarkResultsToApiServer {
#eventObjectTarget;
#dataToSend = {};
constructor(eventObject, mainLabel, significantValue) {
this.#eventObjectTarget = eventObject.currentTarget;
this.#dataToSend["subject"] = {
"name": mainLabel,
"value": significantValue
};
... | true |
1399dc4a4c80ee6f19e423b324f6c49c6c5ac306 | JavaScript | carolhashioka/Cesta_Final | /cesta_basica_frontend/src/pages/Commerce/commerce.js | UTF-8 | 3,361 | 2.96875 | 3 | [] | no_license | import React, { useState } from "react";
import api from "../../Services/api";
import Navigation from "../../components/Navigation/navigation";
import { Container } from "./styles";
export default function Commerce({ history }) {
//Criar o useState
const [name, setName] = useState("");
const [cnpj, setCnpj] = use... | true |
8f1d3b3a1dab4b0ed66144b8b3761c4ce64dec65 | JavaScript | Whwitpohe/redPlum | /src/TmxTest/Control/KVOControl/kvoControl.js | UTF-8 | 3,094 | 3.015625 | 3 | [] | no_license | /**
* Created by FanJiaHe on 2016/3/10.
*/
//通用代码
var observer = {
//订阅
addSubscriber: function(callback)
{
this.subscribers[this.subscribers.length] = callback;
},
//退订
removeSubscriber: function(callback)
{
for (var i = 0; i < this.subscribers.length; i++)
{
... | true |
baebce7fc2ccdea3b3ab12f504dea99f8902197f | JavaScript | ChrisDemey/Javacsript-parcoursBecode | /Drill/06-objects/01-generate-object/script.js | UTF-8 | 530 | 3.609375 | 4 | [] | no_license | // 06-objects/01-generate-object/script.js - 6.1: générer un object
let list = document.getElementById("run");
list.addEventListener("click", function () {
let myCharacter = {
lastName: "Demey",
firstName: "Christophe",
age: 29,
city: "Gilly",
country: "Belgique",
}
... | true |
a923a3407ba2bd64c95c73f3da3ab40324d312f1 | JavaScript | h-ashish/marchzen | /src/may7assign/UserProfile.js | UTF-8 | 1,053 | 2.53125 | 3 | [] | no_license | import axios from 'axios';
import {useEffect, useState} from 'react';
import jwt_decode from 'jwt-decode';
import {useHistory} from 'react-router-dom';
const UserProfile = () => {
let history = useHistory();
const [details, setDetails] = useState({});
const decoded = jwt_decode(localStorage.getItem('regtoke... | true |
1576c6f82f5dc8619267159f5b99972ac941142a | JavaScript | Baystef/JavaScript_challenges | /foldArray.js | UTF-8 | 492 | 3.9375 | 4 | [] | no_license | const findMiddle = (a, b, i) => {
if (a[i] !== b[i]) return findMiddle(a, b, i + 1);
return a[i];
}
function foldArray(array, runs) {
if (runs === 0) return array;
const length = array.length;
const folded = [];
for (let i = 0; i < Math.ceil(length / 2); i++) {
folded[i] = len... | true |
be82ef6c8824a698f5e9abbbb669032f0b92d54d | JavaScript | s0hv/COMP.SE.200-2020-assignment | /test/words.test.js | UTF-8 | 852 | 2.671875 | 3 | [
"MIT"
] | permissive | import words from '../src/words.js';
describe('words', () => {
it('Should split sentence into words', () => {
const expected = ['fred', 'barney', 'pebbles'];
expect(words('fred, barney, & pebbles')).to.deep.equal(expected);
expect(words('fred, barney pebbles')).to.deep.equal(expected);
... | true |
7e544dc0340789c79e3b994d5ca3dae3d11ccab6 | JavaScript | mofoghlu/20110923-demo-vmware-news-git | /cloud/endpoints/userAccessDetails.js | UTF-8 | 11,219 | 2.5625 | 3 | [] | no_license | /**
* NodeJS module: Encapsulates the logic for the User Access Details Endpoint.
*
* @author Roshan
*/
// Dependencies
var utils = require('../utils');
var async = require('../lib/async/async');
var entitlementUserService = require("../services/entitlementUser");
var log = require("../lib/log/log.js");
var User... | true |
b6690324080e97bced4ba52b32b6d13a6ae34f90 | JavaScript | alicekao/codeProblems | /tests/BSTfromArr.js | UTF-8 | 1,363 | 2.953125 | 3 | [] | no_license | const imports = require('../problems/BSTfromArr');
const Tree = imports.tree;
const BST = imports.BST;
const expect = require('chai').expect;
describe('BSTfromArr', () => {
it('Should return a bst', () => {
var tree = BST([0, 1, 3, 4, 5]);
expect(tree.constructor).to.eql(Tree);
expect(tree.val).to.equal(... | true |
404d07097358de0d9975d5be950ab2c52b4155c4 | JavaScript | CannyBangbang/Custom-HTML5-Video-Player | /scripts.js | UTF-8 | 2,645 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | const player = document.querySelector('.player');
const video = player.querySelector('.viewer');
const progress = player.querySelector('.progress');
const progressBar = player.querySelector('.progress__filled');
const playButton = player.querySelector('.toggle');
const skipButtons = player.querySelectorAll('[data-skip]... | true |
055b6b71282bd4b0275fbf2ee97e0cb035874040 | JavaScript | darkgraycat/lessons | /lessons/lesson23/src/index.js | UTF-8 | 12,237 | 3.609375 | 4 | [] | no_license | /*
I decide to keep all simple lessons in one js file
see https://darkgraycat.github.io/lessons/lessons/lesson23/index.html
*/
window.onload = e => {
const taskNames = `Age Detector; Keyboard Symbol; Same Numbers; Leap Year; Palindrome; Currency; Discount; Rect and Circle Problem; Quiz; Next Date;
Ariphmetic Pr... | true |
c15126f918869c5c0ecd6ada765bdc648a39ac50 | JavaScript | saurabh-lohiya/Netflix | /index.js | UTF-8 | 5,365 | 2.515625 | 3 | [] | no_license | // $('i:gt(1)').addClass('fa-3x ');
// $('.col1').mouseover(function(){
// $(this).css("color", "white");
// });
// $('.current').css("color", "white");
// $('.col1').mouseout(function() {
// $(this).css("color", "#707070");
// });
let col1 = $('.col1');
let col2 = $('.col2');
let col3 = $('.col3');
col1.click(... | true |
190b568ff65a1ce4fa11eb8d16c64545c76a10fb | JavaScript | torvarun/loblaws-messenger | /lib/actions/recipe.js | UTF-8 | 3,396 | 2.90625 | 3 | [
"MIT"
] | permissive | /* jshint esversion:6, node: true */
/*
* Loblaws Messenger - recipe.js
*
* Recipe search handler.
*/
const request = require('request'),
net_handler = require('../net_handler.js');
function requestRecipe(sender, query) {
console.log("[INFO] " + sender + ": Requested search for recipe with query: \'"... | true |
5b635727b49384d0c1e7a88513b8c0eddb0222c5 | JavaScript | justindelatorre/js_210 | /lesson_3/6_fizzbuzz.js | UTF-8 | 715 | 4.84375 | 5 | [] | no_license | // Write a function that iterates over the integers from 1 to 100, inclusive.
// For multiples of three, log "Fizz" to the console. For multiples of five,
// log "Buzz". For numbers which are multiples of both three and five, log
// "FizzBuzz". For all other numbers, log the number.
//
// TODO: 'Further Exploration'
f... | true |
e92b0620292de2ddee32190f67f9b0a51514fd4a | JavaScript | AaronKwong929/Algorithm | /string-459.js | UTF-8 | 533 | 3.75 | 4 | [] | no_license | /**
*
* 给定一个非空的字符串,判断它是否可以由它的一个子串重复多次构成。给定的字符串只含有小写英文字母,并且长度不超过10000。
*/
/**
* @param {string} s
* @return {boolean}
*/
var repeatedSubstringPattern = function (s) {
return (s + s).slice(1, -1).includes(s);
};
/**
* 重复字符串会满足以下条件
* s = `abab`, s+s = `abababab`
* 去掉头和尾 bababa,ab会出现至少一次
*
* s = `aba` s+s =... | true |
3421e272b57fac7754647a8e98261f3ec73eb7ed | JavaScript | jarrettmeyer/responsiblejs | /spec/04_extensibility_spec.js | UTF-8 | 965 | 3.546875 | 4 | [] | no_license | var Person = (function () {
function Person(name) {
this.name = name || "";
}
return Person;
})();
describe("Person", function () {
it("has a name attribute", function () {
var p = new Person("Alice");
expect(p.name).toEqual("Alice");
})
it("can add other attributes all willy-nilly",... | true |
c5593e7420c4e190373e423330caa951290c0641 | JavaScript | GuVictory/GuVictory.github.io | /pages/CodeFords/day_4/frontend/admin.js | UTF-8 | 8,043 | 2.890625 | 3 | [] | no_license | const mainUrl = 'https://www.guvictory.xyz/api/'
const app = document.getElementById('app');
if (!app) console.log('app not found');
navbarLinkClicked('student_questions')
app.addEventListener('click', (evt) => {
evt.preventDefault();
if (evt.target.getAttribute('section') == 'create_new') {
createN... | true |
580699a3d0958c33332691bdfc54c7e56aa5385c | JavaScript | forivall/gaia | /apps/system/test/marionette/lib/media_playback.js | UTF-8 | 3,046 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
function click(client, element) {
// Make sure the element is displayed first. This seems really unnecessary
// and is probably masking a bug in Marionette, since all the elements we're
// clicking on should be displayed thanks to waitForContainerShown.
if (!element.displayed()) {
this.client... | true |
efa30c02f28ad2bfb3bb987353b6dcdc20f0f620 | JavaScript | PredragBelos/BIT-WA | /React/BitPeople/src/services/mainSectionComponentFunctions.js | UTF-8 | 956 | 2.546875 | 3 | [] | no_license | /* Function for change visibility of loading animation*/
export const loadingAnimationVisibility = (arr) => {
if (arr.length !== 0) {
return "hide";
}
else {
return "visibility";
}
}
/* Function for change visibility of search bar*/
export const searchBarVisibility = (arr) => {
if... | true |
8d88420a69410af8b98c275c622443c475fee55c | JavaScript | aixiao254926/aixiao254926.github.io | /_posts/Nodejs/03/fs.js | UTF-8 | 490 | 2.84375 | 3 | [] | no_license | //导入fs模块
const fs = require('fs');
//同步和异步
// fs.rename('./text.txt','hello.txt',function(err){
// if(err)throw err;
// console.log('啦啦啦')
// })
// fs.mkdir('txt',function(err){
// if(err) throw err;
// console.log('添加成功')
// })
fs.rmdir('./txt',err=>{
if(err){
console.log(345)
}else{
... | true |
f8d5e36ba17bf6c6302c01be6d1ecc1ce9c3034a | JavaScript | askirmas/sandbox-js | /funs.js | UTF-8 | 1,120 | 3.09375 | 3 | [] | no_license | const g = v => () => v
, undef = () => undefined
, undefL = () => undef
, gs = (...args) => args.map(g)
, sumV = (a, b) => a + b
, sumF = (fa, fb) => () => fa() + fb()
, res = sumF(...gs(1, 2))
/*sumF(res, res)() !== 6)*/
function $lambda(fn, cache = new Map) {
return new Proxy(fn, {
apply(_t, _$this, [arg]) {
... | true |
1eb33e9073181b45eaf9fd620ca017fef515bd3f | JavaScript | tlebon/The-Path-Home | /js/game.js | UTF-8 | 15,656 | 3.015625 | 3 | [] | no_license | // Board with (hopefully) random variations of the following tiles:
// S - Sorcerer // max 10 per board
// V - river // only a limited number of rivers and must be adjacent to at least two others of the same kind //will have a bridge
// H - Bridge
// R - rock
// P - player // pl... | true |
032c3580b97f74fb3054a10947e510aba8df04fa | JavaScript | 3deers/thedome | /src/Star.js | UTF-8 | 1,864 | 2.921875 | 3 | [] | no_license | var SPREAD_FACTOR = 15
var INITIAL_DISTANCE = 500
export default class Star {
constructor(az, alt,dist , scene, geometry, material) {
dist = dist*SPREAD_FACTOR + INITIAL_DISTANCE
this._coord = { az, alt }
this._dist = dist
this._position = new THREE.Vector3()
this._geometry... | true |
494ad20dcf6532905e5f44e81be0feb51cd35bad | JavaScript | Cadu-Soares/Web-clock | /script.js | UTF-8 | 689 | 3.34375 | 3 | [] | no_license | function carregar() {
var msg = window.document.getElementById("msg");
var img = window.document.getElementById("image");
var data = new Date();
var h = data.getHours();
//var h = 16; // teste de funcionalidade
var m = data.getMinutes()
var s = data.getSeconds()
msg.innerHTML = `Agora são ${h}:$... | true |
2b3f5b04da89e2e6f5d6fb593b55718baa03f51a | JavaScript | TLadd/react-setup | /src/actions/cool.js | UTF-8 | 862 | 2.84375 | 3 | [] | no_license | // @flow
const coolAction = (val: string) => ({
type: 'COOL_ACTION',
cool: val,
})
const otherAction = (val: number, val2: string) => ({
type: 'OTHER_ACTION',
other: val,
val2,
})
export type CoolAction = $Call<typeof coolAction, string>
type RetOther = $Call<typeof otherAction, number, string>
type Actio... | true |
4056c8633ac4c51f28433cce80d70b28e186b159 | JavaScript | LinBoris/boirs-react | /test/http/httpTest.js | UTF-8 | 1,673 | 2.671875 | 3 | [] | no_license | import expect from 'expect';
import nock from 'nock';
import {getJSON, postJSON} from '../../src/http/http';
describe('getJSON', () => {
it('fetches json', () => {
// mock network call
let responseBody = {
accountNumber: '1234',
nameOnAccount: 'Noriko'
};
let getRequest = nock('http://loc... | true |
b388f456bcaaefaf834f04607f604b3c8521e165 | JavaScript | JannesMeyer/noc-examples | /example-1.05/main.js | UTF-8 | 1,552 | 2.671875 | 3 | [] | no_license | requirejs.config({
baseUrl: 'js',
paths: {
createjs: '../../js/vendor/easeljs-0.5.0.min',
_: '../../js/vendor/underscore.min',
vec2: '../../js/vec2',
random: '../../js/random'
},
shim: {
createjs: { exports: 'createjs' },
_: { exports: '_' }
}
});
/*
* Code
*/
va... | true |
21a0c94712371d8b89798c10d4e6a184d25f7017 | JavaScript | Dbz/App-Academy-Exercises | /Week 7/w7d1/skeleton/app/assets/javascripts/pokedex-1B.js | UTF-8 | 1,064 | 2.84375 | 3 | [] | no_license | Pokedex.RootView.prototype.renderPokemonDetail = function (pokemon) {
$div = $('<div class="detail">');
var $img = $('<img>');
$img.attr('src', pokemon.attributes.image_url);
$div.append($img);
var $text = $('<p>');
var details = "";
details += "Attack: " + pokemon.attributes.attack;
details += "<br... | true |
9d079fb4928750703e09609466423ad73783e06b | JavaScript | AnniHakanen/FullStackOpen | /FullStackOpen_Harjoituksia_ja_teoriaa/Osa2.js | UTF-8 | 1,706 | 3.34375 | 3 | [] | no_license | console.log('**** TAULUKOIDEN KÄSITTELYÄ ***')
console.log('FILTER')
var elaimet = [
{ nimi: 'Nella', laji: 'koira', ika: 2 },
{ nimi: 'Boo', laji: 'rotta', ika: 2 },
{ nimi: 'Hani', laji: 'rotta', ika: 2 },
{ nimi: 'Blini', laji: 'koira', ika: 2 },
{ nimi: 'Poni', laji: 'koira', ika: 2 },
{ n... | true |
b9e703f04aa583aad135dc3640d49e6fc4c4ad3a | JavaScript | AspIT-CV/AspIT.Gulpfile | /gulpfile.js | UTF-8 | 4,333 | 2.578125 | 3 | [] | no_license | /**
* GULP
*/
const gulp = require('gulp')
const rename = require('gulp-rename');
// var pump = require('pump');
// Image compression
const imagemin = require('gulp-imagemin');
// SASS transpiling
const sass = require('gulp-sass');
// CSS minify
const csso = require('gulp-csso');
// CSS autoprefixer
const autopre... | true |
30ef45f68b575c4160ebb7506723909033913e38 | JavaScript | YuQue-Case-Library/Redux-Case | /redux-case-todo/src/components/Form.js | UTF-8 | 746 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react'
import { addTodo } from '../actions'
import store from '../store'
import './index.css'
export default class Form extends Component {
constructor(props) {
super(props)
this.state = {
inputValue: ''
}
}
handleInputChange = e => {
this.setState({
... | true |
42b5a651a5638a20b15ff282119ac0aba2397fa4 | JavaScript | fiefioor/block-diagram | /web/js/index.js | UTF-8 | 8,585 | 2.59375 | 3 | [] | no_license | (function(){
"use strict"
var getElementPosition = function(el){
var sumLeft = 0;
var sumTop = 0;
if (el.offsetParent) {
do {
sumLeft += el.offsetLeft;
sumTop += el.offsetTop;
} while (el = el.offsetParent);
return { x: sumLeft, y: sumTop };
}
... | true |
00aa3ae1884876a5713f288748810eebe2969860 | JavaScript | J-Hoskin/what-todo | /src/containers/Input/Input.js | UTF-8 | 600 | 2.515625 | 3 | [] | no_license | import React, {Component} from 'react';
import './Input.css';
class Input extends Component {
handleKeyDown = (e) => {
if (e.key === 'Enter') {
this.props.addItem();
}
}
render(){
return (
<div className = "Input">
<input text="text" placehol... | true |
f2cfb7ec981abf36c8c428d2d5304c33c571d064 | JavaScript | paularinzee/simple-quiz-app | /src/Components/Quiz/QuizSummary.js | UTF-8 | 3,308 | 2.78125 | 3 | [] | no_license | import React, { Component, Fragment } from 'react';
import { Helmet } from "react-helmet";
import { Link } from "react-router-dom";
class QuizSummary extends Component {
constructor (props) {
super(props);
this.state = {
score: 0,
numberOfQuestions: 0,
numberOfA... | true |