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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
025807a25671fd68ab477da96e0a78897129ee68 | JavaScript | mzhr123/redux | /src/App.js | UTF-8 | 1,437 | 2.9375 | 3 | [] | no_license |
import './App.css';
import {useSelector,useDispatch} from "react-redux";
import {increment,decrement} from './state/action/action'
import Timer from "./components/Timer"
function App() {
const firstState=useSelector((state)=>state.changeTheNumber);
const dispatch=useDispatch();
return (
<div className="App"... | true |
e34b79660c83a1525b9cdace5a51531f9c06cade | JavaScript | JL-Code/MailList-Vue | /src/plugin/dialog.js | UTF-8 | 1,937 | 2.515625 | 3 | [] | no_license | const DialogPlugin = {};
DialogPlugin.install = function(Vue) {
// 创建中间组件
function _create(component, options = {}) {
return new Promise((resolve, reject) => {
let defaults = {
el: undefined,
// Dialog 自身是否插入至 body 元素上。嵌套的 Dialog 必须指定该属性并赋值为 true
appendToBody: true,
// 关闭时销... | true |
1a04ccb446120cec00e0dce8f691cb949aa9fa83 | JavaScript | antonio-lopez/cpsc-349-project-two | /covid-tracker/src/components/CountryPicker/CountryPicker.jsx | UTF-8 | 1,282 | 2.703125 | 3 | [] | no_license | //DISPLAYS A FORM CONTROL TO CHOOSE A COUNTRY
import React, { useState, useEffect } from 'react';
import { NativeSelect, FormControl } from '@material-ui/core';
import styles from './CountryPicker.module.css';
import { fetchCountryForBar } from '../../api';
const CountryPicker = ({handleCountryChange}) => {
... | true |
1788b042e5c1ca703e72b905ac0e4125bea2fffc | JavaScript | ptlm500/discord-snake | /test/game/world/world.test.js | UTF-8 | 646 | 2.890625 | 3 | [] | no_license | /* eslint-env jest */
const { World } = require('../../../lib/game/world');
describe('World', () => {
it('generates a world of the correct size', () => {
const width = 10;
const height = 10;
const world = new World(width, height);
expect(world.height).toBe(height);
expect(world.width).toBe(widt... | true |
1a502aecd6085ed06a495452e233f2c0eff99d00 | JavaScript | jock-dalby/refactorFeathersJS | /client/components/ComposeMessage.js | UTF-8 | 690 | 2.59375 | 3 | [
"MIT"
] | permissive | var React = require('react');
const ComposeMessage = React.createClass({
getInitialState() {
return { text: '' };
},
handleSubmit: function (e) {
e.preventDefault();
this.props.sendMessage(this.state)
this.setState({ text: '' })
},
updateText(ev) {
this.setState({ text: ev.target.value ... | true |
7ac67e4f676c06b2b357e1ba90e8c22657ab4c71 | JavaScript | stonebuddha/JStype | /src/test/base/loops_a006.js | UTF-8 | 102 | 2.859375 | 3 | [] | no_license |
obj = {foo: 1, bar: 2};
fields = "";
for (x in obj) {
print(x)
fields += x;
};
print(fields)
| true |
07bef716dba21fafe402b2f0c886816695102530 | JavaScript | hammadahmad120/MDMS-Front-End | /src/services/authServices.js | UTF-8 | 1,117 | 2.640625 | 3 | [
"MIT"
] | permissive | import Axios, { AuthAxios } from "./axiosConfig";
export function userLogin({ username, password }) {
const rqstBody = {
username: username,
password: password,
};
return Axios.post("/auth/login", rqstBody, {
headers: { "Content-Type": "application/json" },
});
}
export function setUserToLocalStor... | true |
92a69ccbac9a4ef89e170ad491e357a81c0e1f58 | JavaScript | THammond9/CharacterSpy | /limited-input-countdown.js | UTF-8 | 1,037 | 3.078125 | 3 | [
"MIT"
] | permissive | function initCountdownWatcher(elementToWatchAsString, elementToUpdateAsString, maximum) {
let localElementToUpdateAsString = elementToUpdateAsString;
let localMaximum = maximum;
enableCharacterCountdown(elementToWatchAsString);
function enableCharacterCountdown(elementToWatchAsString) {
$... | true |
f4abd0b3d355876bbdacb5f2d6454b1ae39da4be | JavaScript | AmishRanpariya/social-media-dashboard | /main.js | UTF-8 | 736 | 2.859375 | 3 | [] | no_license | let theme_btn = document.querySelector("#theme-type");
let user_theme = localStorage.getItem("SOCIAL_DASHBOARD_THEME");
console.log(user_theme);
if (user_theme == null) {
// document.documentElement.classList.add("is_dark");
localStorage.setItem("SOCIAL_DASHBOARD_THEME", "dark");
} else if (user_theme == "light") ... | true |
4b96ddb061e70a63ee6e005841fec34e058b00de | JavaScript | VictorPubh/Tesguerreiros | /js/index.js | UTF-8 | 2,895 | 3.796875 | 4 | [] | no_license | // Criação de Variáveis Globais
var items = []
var limit = 10
// Os códigos abaixos são para melhorar a experiência na hora do Teste da aplicação
alert(`Abra o Console.`)
console.log('%c Shalom! ','color:hsl(240, 100%, 90%);background-color:hsl(240, 100%, 50%);');
console.log(`%c A páginação desta página é feita atr... | true |
31817e59aa0e8e00507a2c700fcb92714e820d10 | JavaScript | erhsh/shiny-meme | /src/javascripts/base.js | UTF-8 | 2,125 | 2.703125 | 3 | [] | no_license | (function() {
var Constant = {
backgroundColor: [
"rgb(168, 203, 213)",
"rgb(238, 126, 114)",
"rgb(228, 190, 108)",
"rgb(156, 145, 191)"
]
};
function startMove(instance) {
var deltaY = shiny.Event.getWheelDelta(event);
conso... | true |
6d2d2465958a58ac65c6679e26542bc7e431b13b | JavaScript | ParentJA/neopantry-v0 | /www/app/src/recipes/services/search_type_service.js | UTF-8 | 711 | 2.515625 | 3 | [] | no_license | (function (window, angular, undefined) {
function searchTypeService(SearchType) {
var selectedSearchType = SearchType.RECIPE_NAME;
this.changeSearchType = function changeSearchType(searchType) {
selectedSearchType = searchType;
};
this.getSearchType = function getSearchType() {
return s... | true |
07b582c6e9a2e17c7c1f90456b967391c7a6d157 | JavaScript | Benjmhart/haskql | /public/src/Halogen/Router.js | UTF-8 | 613 | 2.609375 | 3 | [] | no_license | 'use strict';
exports.getCurrentRoute = function() {
return decodeURI(location.pathname + location.search);
};
exports.onNavigate = function(f) {
return function() {
var pushState = history.pushState;
history.pushState = function(state, title, url) {
pushState.apply(history, [state, title, url]);
... | true |
d3b9b0a534f9a97a08d715a7158019c0ce0c2254 | JavaScript | JoeFoster-cn/weather-app | /index.js | UTF-8 | 2,230 | 2.5625 | 3 | [] | no_license | const express = require('express');
const hbs = require('express-handlebars');
const path = require('path');
const bodyParser = require('body-parser');
require('dotenv').config();
const indexRouter = require('./routes/indexRouter');
const weatherRouter = require('./routes/weatherRouter');
const errRouter = require('./... | true |
60f8d5259497b369618e3b993dd8c59693f161d6 | JavaScript | 13DeAnda/javascriptExercises | /translator/translator.js | UTF-8 | 3,787 | 2.90625 | 3 | [] | no_license | var AMLTranslator = (function () {
var module = {};
function addNewTags(finalText, tagPosition, tags, endTagLength, startAdded){
var textToChange = finalText.slice(tagPosition.start + startAdded, tagPosition.end);
var newTextWithTags = tags.tag + textToChange.slice(tagPosition.startTagIndex, textToChange.l... | true |
d00d580a4d95058629f91bc65a1e051b299df98e | JavaScript | Billett-development/Rock-paper-scissors | /Scripts.js | UTF-8 | 1,694 | 4.0625 | 4 | [] | no_license |
function computerPlay(Comp_output) {
var comp_choice = Math.floor(Math.random() * 3);
if(comp_choice == 0) {
return Comp_output = "rock"
} else if (comp_choice == 1) {
return Comp_output = "scissors"
} else {
return Comp_output = "paper"
}
}
const playerSelect... | true |
93431833d65f579a3a663882e3ea4c78d7eee3bb | JavaScript | Khaidde/Labyrinth | /client/game/world/FPSController.js | UTF-8 | 5,586 | 2.734375 | 3 | [] | no_license | var Utils = require("../common/Utils");
//Adaptation of https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/PointerLockControls.js
class FPSController {
constructor(camera, domElement) {
this.camera = camera;
this.speed = 1;
this.turnSpeed = 0.001;
this.moveForward = false;
this.moveBackw... | true |
7ddabcb55ca5f5dcd5d69b45010c0569b3140982 | JavaScript | petert360/FullStackAPI-first-exam | /task-03/jsonHandler.js | UTF-8 | 2,141 | 2.953125 | 3 | [] | no_license | /**
* 1. A fájlok kezeléséhez az fs modul promise alapú verzióját használd.
*/
const fsp = require('fs').promises;
/**
* 2. Állítsd be az azonos mappában található .json fájl elérési útját a path
* modul join metódusának segítségével.
*/
// path modul betöltése a join metódus használatához
const { join } = req... | true |
bb907a0cf9d91e7d0f48b3d368af95685d0021ba | JavaScript | ngio/jguery_not_yet | /25_Killer_JavaScript_One-Liners.js | UTF-8 | 5,227 | 4.0625 | 4 | [] | no_license | [25 Killer JavaScript One-Liners That’ll Make You Look Like a Pro](https://javascript.plainenglish.io/25-killer-javascript-one-liners-thatll-make-you-look-like-a-pro-d43f08529404)
A list of one-liners you should know to up your knowledge of JavaScript... | true |
5d40b03f63874bc27929354f412e66d6136fdb15 | JavaScript | jgch88/headFirstDesignPatterns | /10 - State Pattern/state/WinnerStateV3.js | UTF-8 | 1,085 | 2.8125 | 3 | [] | no_license | const WinnerState = require('./WinnerState.js');
const StateV3 = require('./StateV3.js');
// decision: once "transitions" are touched
// copy paste everything from V1 all the way to
// current version and 'start afresh' with new
// root State
class WinnerStateV3 extends StateV3 {
constructor(gumballMachine) {
s... | true |
727e6bf795c6d6f8928c9f33efdb5844de290bcd | JavaScript | Joy-Shin/COMP397 | /Scripts/core/index.js | UTF-8 | 345 | 3.421875 | 3 | [] | no_license | // IIFE -- Immediately Invoked FUnction Expression
// Encapsulate variables inside the function; not global variables
(function(){
function Init() {
console.log("Game Started")
}
function Start() {
}
function Update() {
}
functino Main() {
}
window.onload = Init; // no brackets here. Init() is event handler... | true |
698f6b9a1bc38384be41bc6f99a3031b659a52ca | JavaScript | clarelisbeth/js101 | /themes/lessons/app/scripts/app.js | UTF-8 | 2,090 | 3.78125 | 4 | [] | no_license | /*
Feedback
Use strict mode
DONE
Confusing indenting after the for loop
DONE - I think
Implement the passFocus method. We can look at this together if necessary. Can be done in multiple ways. Bonus points for a solution that uses partial application.
Consider being able to highlight any wrong lette... | true |
5c96e30c7fad7924db0be02e74ff6759500a93a8 | JavaScript | Rpascar1/TossACoinToYourWitcher | /public/gameClone.js | UTF-8 | 16,846 | 3.015625 | 3 | [
"MIT"
] | permissive | class Game {
constructor() {
this.scores = [0, 0]
this.roundScore = 0
this.activePlayer = 0
this.gamePlaying = true
this.winningScore = 100
this.name = false
this.players = []
//============Calculation Variables==============================
this.cardDraws = 0 // all card draws ... | true |
c8790a49391b9c148e4aa8a867a7622e1646c953 | JavaScript | lukix/genemo | /src/elitism.js | UTF-8 | 876 | 2.703125 | 3 | [
"MIT"
] | permissive | const { checkProps, types } = require('./utils/typeChecking');
const compareAsc = (a, b) => a.fitness - b.fitness;
const compareDesc = (a, b) => b.fitness - a.fitness;
const propTypes = {
keepFactor: { type: types.NUMBER, isRequired: true },
minimizeFitness: { type: types.BOOLEAN, isRequired: true },
};
const el... | true |
9c142d1bcbacf20b211656ca16dc89474445922e | JavaScript | cristina-Q/cristina-popescu-js | /M01S03/ex04/app.js | UTF-8 | 1,137 | 4.3125 | 4 | [] | no_license | var myArray = [1, 2, 3, 4, 5, 6];
console.log(myArray[0]);
// Afiseaza numarul de pe pozitia 5 a arrayului.
console.log(myArray[5]);
// Afiseaza numarul 3 din array.
console.log(myArray[2]);
// Afiseaza lungimea arrayului.
console.log(myArray.length);
// Afiseaza suma numerelor de pe pozitia 0 si 4.
console.log(my... | true |
58cf9280c161b9149356d97f9ef3bcb0f655f529 | JavaScript | RobertRodes/JS210 | /Practice_problems/minilang.js | UTF-8 | 1,825 | 3.515625 | 4 | [] | no_license | function popIt(stack) {
if (stack.length === 0) {
throw 'Error 8080: attempted to POP from empty stack.';
} else {
return stack.pop();
}
}
function tokenError(cmd) {
throw `Error 8088: token '${cmd}' not found in instruction set.`;
}
function minilang(punchCard) {
let register = 0;
const stack = [... | true |
70a3a0c90e456467c4fb764f65ef390492506f06 | JavaScript | caseykwok/Cs-Fundamentals | /data-structures/stack.js | UTF-8 | 766 | 4.875 | 5 | [
"MIT"
] | permissive | // Create the Stack Class
class Stack {
constructor() {
this.items = [];
}
// Adds an element to the end of the stack
// Time Complexity: O(1)
push(element) {
this.items.push(element);
}
// Removes and returns the last element from the stack
// Time Complexity: O(1)
pop() {
this.items.pop();
}
// ... | true |
8d0380ef232dd84bc3e0697a47cec100d29d2d38 | JavaScript | HerrChick/SEI42-Group-Project-3 | /controllers/dishes.js | UTF-8 | 3,346 | 2.8125 | 3 | [] | no_license | const Dish = require('../models/Dish')
function indexRoute(req, res, next) {
// get all the dishes from the database: MONGOOSE
Dish.find(req.query)
.then(dishes => res.json(dishes)) // send them as JSON: EXPRESS
.catch(next)
}
function createRoute(req, res, next) {
// Add the current user to the req.bod... | true |
646a9ea4b6a0b9ae3a8f8394375c7ac6c766c72b | JavaScript | GuidoRocco/Network-houses-Milan | /scripts/transfer_house.js | UTF-8 | 759 | 2.5625 | 3 | [] | no_license |
/**
* Script File for House Transfer transaction
@param {org.acme.model.Transfer_House} transf - Istance of house transfer
@transaction
*/
function transfer_house(transf)
{
var cs = transf.house_to_transfer.id_property;
var index = transf.selling_agency.owned_houses.indexOf(cs);
if(index != -1)
{ ... | true |
b59a581a33eb67fe99d55eef67afe04237064e21 | JavaScript | k-wasilewski/frontend | /src/components/visualization/InListVisualization.js | UTF-8 | 3,878 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react';
import '../../css/App.css';
import {connect} from "react-redux";
import {setItems} from "../../redux/actions";
export class InListVisualization extends Component {
constructor(props) {
super(props);
this.state = {
size: 0,
color: ''
... | true |
52cf8d3b87a4ac38b64d1efc66e735e96e33d37f | JavaScript | alexnix/angular101 | /app.js | UTF-8 | 957 | 2.5625 | 3 | [] | no_license | var app = angular.module("app", []);
app.controller("MainCtrl", ['$scope', function($scope){
$scope.tasks = [
{name: 'Beer', completed: false},
{name: 'Pizza', completed: true},
];
$scope.check = function(task) {
task.completed = true;
};
var removedTask = null;
$scope.remove = function(task... | true |
4ba744dd624aa3ab6492680357fbe30c8d2a2491 | JavaScript | hhayk/leetcode | /1007. Minimum Domino Rotations For Equal Row.js | UTF-8 | 1,697 | 4.1875 | 4 | [] | no_license | /*
In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
We may rotate the i-th domino, so that A[i] and B[i] swap values.
Return the minimum number of rotations so that all the values in A are th... | true |
23ff15b2073915a23ae021471d60ff1607eb4ad1 | JavaScript | c01nd01r/b_add | /lib/main.js | UTF-8 | 3,331 | 2.75 | 3 | [
"MIT"
] | permissive | var bemNaming = require('bem-naming');
var wrfile = require('create-file');
var jsonf = require('jsonfile');
var args = process.argv.slice(2);
var config = readConfig();
var naming = bemNaming({
elem: config.elem,
mod: config.mod
});
//Создание файлов по настройкам расширений
function createFiles(path, type)... | true |
a27b2586f692e0f5ca38da66520dbe17d28729d9 | JavaScript | rosertuneu/hci-workshop-aframe | /04Animation/scripts/main.js | UTF-8 | 1,104 | 3.6875 | 4 | [] | no_license |
// changing individual properties with code and using setInterval
var rotationSpeed = 0.01;
var upDownSpeed = 0.05;
var myOtherBox = document.getElementById('myOtherBox');
var ground = document.getElementById('ground');
function spin(){
myOtherBox.object3D.rotation.x -= rotationSpeed * 0.25;
myOtherBox.objec... | true |
c13ec90822713ddb299b21c975c5ea3d9cd5b40e | JavaScript | charlesroberts442/MidnightSunGiants | /javascript/sportAPI.js | UTF-8 | 3,488 | 3 | 3 | [] | no_license |
//API for the stats page
console.log("api.js is working");
var queryURL;
var seasonStatisticsUrl;
var rankingUrl;
var city=[];
var idnum={};
var cityId;
var userCity;
var roster=[];
function loadCityID() {
// Full schedule for all NBA teams. The API uses and id # for each team. this ID is needed to access data fo... | true |
eb1475949c56049c6f76c30a5b9436c9350eba95 | JavaScript | mikeqle/mern-hoisting | /problem_4.js | UTF-8 | 409 | 4.4375 | 4 | [] | no_license | // Original code:
var food = 'chicken';
console.log(food);
eat();
function eat(){
food = 'half-chicken';
console.log(food);
var food = 'gone';
}
// Predict hoisting
// function eat(){
// var food;
// food = 'half-chicken';
// console.log(food);
// food = 'gone';
// }
// var food;
// food = ... | true |
73c33a4cf53a7d053d68eff065560bd9bf84a9e9 | JavaScript | apma-io/apphammer | /src/ah.syncstore.js | UTF-8 | 10,046 | 2.53125 | 3 | [
"MIT"
] | permissive | /******************************************************************************
Copyright (c) 2016 IQumulus LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | true |
858a8e28c0de87ee578ae21c02f337709d8df30e | JavaScript | jspruance/ff-poc | /featureflag/wm-feature-flag-client/src/index.js | UTF-8 | 2,532 | 2.53125 | 3 | [] | no_license | /**
* @module wm-feature-flag-client
*/
/**
* Copyright (c) Warner Media. All rights reserved.
*/
'use strict'
const crypto = require('crypto')
const { v4 } = require('uuid')
const winston = require('winston');
const logger = winston.createLogger({
transports: [ new winston.transports.Console()]
})
... | true |
bb2e11b8636c82574b5c5d13f3fd2d808869c3fc | JavaScript | GrozaTeam/Rumypet | /node_server/server/functions/profile.js | UTF-8 | 375 | 2.515625 | 3 | [] | no_license | var user = require('../models/user');
exports.getProfile = email =>
new Promise(function(resolve,reject){
user.find({ email: email }, { name: 1, email: 1, phone:1, created_at: 1, _id: 0 })
.then(function(users){
resolve(users[0]);
})
.catch(function(err){
console.log('err:', err);
reject({ status: ... | true |
77d1ec4a6d343037d8c4c0db2646e781bf42700f | JavaScript | alissonrsantos/Blastoff | /atividade6.js | UTF-8 | 485 | 4.3125 | 4 | [] | no_license | //6- Uma partida de futebol iniciou na hora A e terminou na hora B. Faça um algoritmo que calcule o tempo que durou a partida.
const horaA = 10;
const horaB = 12.03;
let duracaoPartida;
if(horaA < horaB) {
duracaoPartida = horaB - horaA;
} else {
duracaoPartida = horaA - horaB;
}
if(duracaoPartida < 1) {
... | true |
a23394d07bd91a3d3827d11f4bdc31f90f956d29 | JavaScript | aralova/week6 | /script3.js | UTF-8 | 1,844 | 2.59375 | 3 | [] | no_license | let cars = [{brand:'Toyota',model:'Camry','year':1999,'price':20000,image_url:"https://media.ed.edmunds-media.com/toyota/camry/2016/ot/2016_toyota_camry_LIFE1_ot_902163_1280.jpg"},{brand:'BMW',model:'X6',year:2014,price:25000,image_url:"https://media.ed.edmunds-media.com/bmw/x6/2016/oem/2016_bmw_x6_4dr-suv_xdrive50i_fq... | true |
5eab9035579c2259f659fc725ef4e3d67dedfdcf | JavaScript | Aninok92/goit-react-hw-05-movies | /src/services/movies-api.js | UTF-8 | 839 | 2.703125 | 3 | [] | no_license | // https://api.themoviedb.org/3/trending/all/day?api_key=f78ff4f3a233cef30c068f16bf21ca7c
import axios from "axios";
axios.defaults.baseURL = "https://api.themoviedb.org";
const API_KEY = "f78ff4f3a233cef30c068f16bf21ca7c";
export const fetchMovies = async () => {
const response = await axios.get(`/3/trending/all/... | true |
be8b2d41ff5a8fe9513a7d3b13cf460ce2fdd14c | JavaScript | adihd/newapp | /scripts/set_admin.js | UTF-8 | 813 | 2.625 | 3 | [] | no_license | // const cur_game_code = document.querySelector('#game_code');
// const set_admin = document.querySelector('#setadmin');
// set_admin.addEventListener('submit', (e) => {
// // alert("dfsdffsd");
// e.preventDefault();
// alret("setadmin")
// }
function setAdmin()
{
const setupID = (user) => {
if (user)... | true |
47a016213fb6fddcb5771999f41fc478eab0e452 | JavaScript | MatiaCasu/js-mail-dadi | /mail/js/script.js | UTF-8 | 537 | 3.359375 | 3 | [] | no_license | //utente Email
var emailUtente = prompt("Inserisci la tua email");
// /utente Email
// lista Email
var lista = ["email1", "email2", "email3", "email4", "email5", "email6"];
// /lista Email
// Controllo email
for(var i = 0; i < lista.length; i++ ){
if(emailUtente === lista[i]){
alert("sei in lista!");
... | true |
be012d28562116ed12f950cc6f9fbe9d7b829dda | JavaScript | mannanjain2k8/Crumpled-Balls-2 | /c-25 project(crumpled Balls 2)/MatterJSBoilerPlate-master/sketch.js | UTF-8 | 719 | 2.765625 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var Dustbin1;
function preload()
{
}
function setup() {
createCanvas(800, 700);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
Dustbin1 = new Dustbin(610,510,18... | true |
e8e3e8431b239e8051de322571d701e9331ea1a6 | JavaScript | zjhou/tBot | /lib/core/third-api/google_cse.js | UTF-8 | 683 | 2.84375 | 3 | [] | no_license | const axios = require('axios');
/**
* google custom search engine.
* @param {string} kwd - search key words
*/
module.exports = function (kwd) {
const reqUrl = `https://www.googleapis.com/customsearch/v1` +
`?key=${process.env.GOOGLE_CSE_KEY}` +
`&cx=${process.env.GOOGLE_CSE_CX}&q=${encodeURI(kwd)}`;
... | true |
80cee4119ed9e31152455dd7f34662bda5f4149c | JavaScript | Benkaera/NodeJsR | /appv1.js | UTF-8 | 3,819 | 3.09375 | 3 | [] | no_license |
const http = require("http");
const os = require("os");
const greeting = require("./greeting");
//module s userom
const User = require("./user.js");
let eugene = new User("Eugene", 32);
eugene.sayHi();
//morning evening
const welcome = require("./welcome");
welcome.getMorningMessage();
welcome.getEveningMessage();
c... | true |
b09cd548006c359413c647b4535356e3599f6463 | JavaScript | kawsarBinSiraj/bootancy-carousel | /dist/js/script.js | UTF-8 | 2,730 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* @Script js for (Template/Project Name)
*
* @project - Project Name
* @author -
* @created_by -
* @created_at -
* @modified_by -
*/
/**
* ========================================================
* this function execute when window properly loaded
* =========================... | true |
0c552c6a587799dc2f7dc98b51841a06616edf5b | JavaScript | notsonoobie/task-manager-api | /src/index.js | UTF-8 | 193 | 2.578125 | 3 | [
"MIT"
] | permissive | const app = require('./app'); // Application
const port = process.env.PORT; // Port on which the app will run
app.listen(port,()=>{
console.log(`Server is running on port ${port}`);
}); | true |
2d7b57b37e98d4e7e3adca88a38c5bac4d5df5dd | JavaScript | NikolaJam/CodeAcademyLottery | /Api documentation/nodeJs/service/PrizeService.js | UTF-8 | 1,252 | 3.03125 | 3 | [] | no_license | 'use strict';
/**
* Add a new prize
*
* body Prize Prize object that needs to be added
* no response value expected for this operation
**/
exports.addPrize = function(body) {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Delete a Prize
*
* id Long
* no response value expect... | true |
4d6959c4dbc83ee3b86004cb14e4aa3007b34906 | JavaScript | dexterch91/basics-beat-that | /script.js | UTF-8 | 3,796 | 4.1875 | 4 | [] | no_license | var gameState = "Init"; //Game States
var pTotal = []; //Array storage for totals
var noPlayers = 5; //Placeholder for constant
var roll1 = 0; //Generic roll number 1st
var roll2 = 0; //Generic roll number 2nd
var pCount = 1; //Player counter for while loop
var main = function (input) {
var myOutputValue = diceGame(... | true |
d16aea1e908d391bfdf750d8381ea084da6201e1 | JavaScript | FarihaSiddiqui/Project-2 | /static/js/plots.js | UTF-8 | 10,695 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | // // Use D3 fetch to read the JSON file
// // The data from the JSON file is arbitrarily named importedData as the argument
d3.json("http://127.0.0.1:5000/api/v1.0/date").then((importedData) => {
var data = importedData;
console.log(data)
// Hydroelectric = Hydraulic turbine + Tidal power turbine
// Solar = Sola... | true |
b275a3118c9603cb31ebf4f399976f2a6e6c4a51 | JavaScript | bidanjun/redayBak | /src/examples/reday-router/index.js | UTF-8 | 1,584 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import React from 'react'
import { store,HashRouter,makeRouter } from '../../reday';
const HomePage = ()=>(<h2> Home Page </h2>)
const BlogPage = ({id})=>(<h2> Blog Page {id} </h2>)
const OtherHomePage = ()=>(<h2>Other Home Page </h2>)
const OtherBlogPage = ({id})=>(<h2>Other Blog Page {id} </h2>)
let rou... | true |
267c7ba3c686a446feeaa66fbbf2bef239e67390 | JavaScript | mikefieldmay/bowling-challenge | /spec/FeatureSpec.js | UTF-8 | 490 | 2.765625 | 3 | [
"MIT"
] | permissive | describe("A game of bowling", function(){
var roll
var frame
var scorecard
var game
beforeEach(function(){
roll = new Roll();
frame = new Frame(roll);
scorecard = new Scorecard();
game = new Game(frame, scorecard)
});
describe("scorecard", function(){
it('stores the scores on a score... | true |
8c662c18fc0a8c02c9cef4223e4a62d9dba66ab3 | JavaScript | jfairbank/perchance | /src/core/just.js | UTF-8 | 1,513 | 3.078125 | 3 | [
"MIT"
] | permissive | import isObject from 'lodash/isObject';
import isFunction from 'lodash/isFunction';
import invariant from '../util/invariant';
import Nothing from './nothing';
import ifValue from '../util/ifValue';
import alias from '../util/alias';
import { ERR_NEED_OBJECT, ERR_NEED_MAP, ERR_NEED_FUNCTION } from './errorTypes';
clas... | true |
9bfe46ca24ef7fe0af31563c6675a61334f2df35 | JavaScript | josephJaoNasser/React-Projects | /react-video-platform/client/src/components/comments/TextLinePlaceholder.js | UTF-8 | 595 | 2.75 | 3 | [] | no_license | const TextLinePlaceholder = ({
width = "100%",
height = 20,
lines = 1,
color = "rgba(0,0,0,0.15)"
}) => {
let placeholderLines = [];
for(let i = 0; i < lines; i++){
placeholderLines.push(
<div style={{
height: height,
width: width,
backgroundColor: color,
bor... | true |
098fd883a626a0ae375735ad913dcebf49cffdb5 | JavaScript | Limelight-Management-Group/promises-exercises | /promise-it-wont-hurt-solutions/src/06-shortcuts.js | UTF-8 | 310 | 2.78125 | 3 | [
"MIT"
] | permissive | var promise = new Promise(function (resolve, reject) {
// Your solution here
resolve('PROMISE VALUE');
})
promise.then((successMessage) => {
console.log(successMessage);
}).catch((failureMessage) => {
console.log('I DID NOT FIRE');
})
console.log('MAIN PROGRAM'); | true |
02bf2813f8eff8dcc2530e42e97937370f0c3245 | JavaScript | MattSmithASU/Andyscomet | /cometd/trunk/andes1/src/main/webapp/release/dojo/dojox/form/Rating.js | UTF-8 | 2,261 | 2.59375 | 3 | [
"BSD-3-Clause",
"AFL-2.1"
] | permissive | /*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if (!dojo._hasResource["dojox.form.Rating"]) {
dojo._hasResource["dojox.form.Rating"] = true;
dojo.provide("dojox.form.R... | true |
ce422a287fa8dd30156701fa7340a9b34967ff77 | JavaScript | patmik2012/JS | /4_2 FileBrowser.js | UTF-8 | 3,158 | 2.546875 | 3 | [] | no_license | const http = require('http');
const url = require('url');
const fs = require('fs');
const port = '3456';
const path = require('path');
const mimeTypes = {
'jpg': 'image/jpeg',
'gif': 'image/gif',
'svg': 'image/svg+xml',
'txt': 'text/plain'
};
function processRequest(request, response) {
co... | true |
16f73cf9f034306f3c75ac0fbc68f1505167d3cb | JavaScript | fernandofragoso/people-register-vanillajs | /e2e/tests.js | UTF-8 | 4,039 | 2.5625 | 3 | [] | no_license | casper.test.begin('Page loads correclty', 3, function suite(test) {
casper.options.clientScripts.push("node_modules/babel-polyfill/dist/polyfill.js");
casper.on('remote.message', function(message) {
this.log('console.log: ' + message, 'warning');
});
casper.start("http://localhost:8080", function() {... | true |
3f58f8b3600805d072e4674b0162ab6923d92e34 | JavaScript | kresho/isopod | /tests-utility.js | UTF-8 | 4,216 | 2.796875 | 3 | [
"MIT"
] | permissive | 'use strict';
// TODO: move this into its own standalone module (and test it)
const farse = require('farse');
const expect = require('chai').expect;
function isRef (thing) {
return typeof thing === 'symbol' || typeof thing === 'function' || typeof thing === 'object' && thing !== null;
}
const globallyAccessible ... | true |
6b39acccf6f4fcbaa42d0368866f3569c25b71aa | JavaScript | pgupta1795/Bricks-Ball_GAME | /src/paddle.js | UTF-8 | 1,106 | 3.53125 | 4 | [] | no_license | export class Paddle {
constructor(game) {
this.canvasWidth = game.canvasWidth;
this.canvasHeight = game.canvasHeight;
this.width = 150;
this.height = 25;
//create object of position so we fill x and y axis both
this.position = {
x: this.canvasWidth / 2 - this.width / 2,
y: this.ca... | true |
7185dfc1f90dff1dc3be6bf5b4292666866bade2 | JavaScript | ahamed/webpack-gallery | /src/components/component.js | UTF-8 | 665 | 2.6875 | 3 | [] | no_license | class Component {
// Base component class
constructor() {
this.domElements = [];
}
static registerElement(name, element) {
if (this.getElement(name) == false) {
return false;
} else {
this.constructor.domElements.push({
name: name,
... | true |
231ebc346325ec0aee8cbb5cffe2ff6dddeeddd7 | JavaScript | anahigo/Trybe_Exercise_Back-End_MySQL_MongoDB_NodeJs | /24_02/Exercise_09.js | UTF-8 | 338 | 2.921875 | 3 | [] | no_license | // # Exercício 9:
// Adicione o campo character com o valor Marv ao array de cast em que o campo actor seja igual a Daniel Stern no filme Home Alone.
// Dica :Para isso, leia aqui sobre o operador $ .
db.movies.updateOne(
{ "title": "Home Alone", "cast.actor": "Daniel Stern" },
{ $push: { "cast.$.character": "Mar... | true |
ba20d348a58eb477e1db99ab7bf903607c1221bf | JavaScript | twnbay78/Very-Simple-Tax-Estimator | /js/test2.js | UTF-8 | 4,182 | 3.734375 | 4 | [] | no_license | // Tax estimation - avoids all prototype and inheritance misuses of javascript - solely for learning syntax
// Written by Leo Scarano
// Data structures for tax bracket and tax schedule data
function TaxBracket (cutoff, percentage, base){
this.cutoff = cutoff; // how much money to be in this bracket
this.percentage... | true |
f36284fd647aa1128f93695fb931c8920e56d75b | JavaScript | terenceyak/js101 | /small_problems/easy1/tip_calculator.js | UTF-8 | 349 | 3.296875 | 3 | [] | no_license | const readline = require('readline-sync');
const bill = readline.question('What is the bill? ');
const tipRate = readline.question('What is the tip percentage? ');
const tip = Number(bill) * Number(tipRate) / 100;
const total = Number(bill) + tip;
console.log(`The tip is $ ${tip.toFixed(2)}`);
console.log(`The total... | true |
8d8723df1c53fd29645cde21efd90611d8f7a4aa | JavaScript | elliottabirch/Sorting-Algorithms | /bubbleSort.js | UTF-8 | 537 | 3.203125 | 3 | [] | no_license | const bubbleSort = function (array) {
var testSorted = function (array) {
const wasSorted = array.reduce((isSorted, value, index) => {
if (array[index + 1] !== undefined) {
if (array[index] > array[index + 1]) {
const old = array[index];
array[index] = array[index + 1];
... | true |
5ca13f3e452adddff50b297cfe2f530e98526453 | JavaScript | KEMAL-YILDIRIM/Course | /Course/Content/FetchContent.js | UTF-8 | 1,129 | 2.6875 | 3 | [
"MIT"
] | permissive | var ExternalURL = 'www.dummysite.com';
// This address must not contain any leading 'http://'
var ContentLocationInDOM = '#someNode > .childNode';
// If you're trying to get sub-content from the page, specify the 'CSS style' jQuery syntax here, otherwise set this to 'null'
$(document).ready(loadContent);
function loa... | true |
d5d6604d07c01c9ec2ef3ff5ff7cd0b0342ac611 | JavaScript | sera890212/maps | /pp.js | UTF-8 | 526 | 2.578125 | 3 | [] | no_license | <link rel="stylesheet" href="https://npmcdn.com/leaflet@0.7.7/dist/leaflet.css" />
<script src="https://npmcdn.com/leaflet@0.7.7/dist/leaflet.js"></script>
<script type="text/javascript">
// 建立 Leaflet 地圖
var map = L.map('mapid');
// 設定經緯度座標
map.setView(new L.LatLng(22.992, 120.239), 12);
// 設定... | true |
5a7fc94f768d7bdd68770c7fc26621277e2c9b08 | JavaScript | bcomnes/RemotePerformer | /src/public/js/app.js | UTF-8 | 5,818 | 2.53125 | 3 | [] | no_license | /* globals location, WebSocket, $, AudioContext, XMLHttpRequest */
window.jQuery = window.$ = require('jquery')
/* Global Declarations */
var fs = require('fs')
var insertCss = require('insert-css')
var bootstrap = require('bootstrap/dist/js/bootstrap') // eslint-disable-line
var bsStyle = fs.readFileSync('./node_mod... | true |
c353ef80e3e723bc20a3107fce45f46fce93cf68 | JavaScript | Apptelier-Repos/ei-web-app | /src/utils/objectFromFormData.js | UTF-8 | 176 | 2.765625 | 3 | [] | no_license | function objectFromFormData(fd) {
const object = {};
for (let key of fd.keys()) {
object[key] = fd.get(key);
}
return object;
}
export default objectFromFormData;
| true |
9f3bc9ef53f03c6510b4665dd7b8552373aa3697 | JavaScript | rnrn99/practice_TDD | /test/unit/product.test.js | UTF-8 | 7,422 | 2.515625 | 3 | [] | no_license | const httpMocks = require("node-mocks-http");
const productController = require("../../controller/product");
const productModel = require("../../model/Product");
const newProduct = require("../data/newProduct.json");
const allProduct = require("../data/allProduct.json");
productModel.create = jest.fn();
productModel.f... | true |
78d19a92b0fa738bb6af18e9abc226c05969ab1f | JavaScript | jatarak/Kelvin-Weather-Project | /app.js | UTF-8 | 512 | 4.4375 | 4 | [] | no_license | //This is the temperature in Kelvin
const kelvin = 0;
//This is how to convert Kelvin into Celsuis
const celsius = kelvin - 273;
//This is how to convert Celsius into Fahrenheit
let fahrenheit = celsius * (9/5) + 32;
//Rounding down the decimal number from converting to Fahrenheit
fahrenheit = Math.floor(fahrenheit);
c... | true |
256a9ecdbc43d988d3a9299702d85a1b9bd1246e | JavaScript | JanPokorny/tabletop-engine | /index.js | UTF-8 | 14,779 | 2.625 | 3 | [
"MIT"
] | permissive | const _ = require("lodash");
/**
* Defines different types of fields and their operations (internal use)
*/
const fieldTypes = {
array: {
create: fieldDefinition => {
// FROM: https://stackoverflow.com/a/12588826/6099426
return (function getRecursively(dimensions) {
... | true |
73ef4f05c96415356e13503274831a0ec5376373 | JavaScript | dj-fiorex/DrawerJs | /src/toolbars/instances/ToolOptionsToolbar.js | UTF-8 | 665 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* Toolbar with tool options
*
* @param {DrawerJs.Drawer} drawerInstance
* @param {Object} [options]
* @extends DrawerToolbar
* @constructor
*/
var ToolOptionsToolbar = function (drawerInstance, options) {
// css class for toolbar
options.toolbarClass = 'tool-options-toolbar';
// call DrawerToolbar c-to... | true |
6270b551da651268b4a788cd9fee17dcd9adcb25 | JavaScript | cemeskinazi/webprint | /Print the cursor/main.js | UTF-8 | 1,942 | 2.765625 | 3 | [] | no_license | $(window).click(function(){
window.print();
});
$(document).on('mousemove', function(e){
$('.cursor').css({
left: e.pageX,
top: e.pageY
});
});
/*$(window).mouseup(function() {
$(".feed").html(" ");
})
.mousedown(function() {
$( ".feed" ).html( "Clicking" );
$(".interface").... | true |
bb445dbcbf55ed2499c4b91b2461cb43074519d1 | JavaScript | a-pompom/wg | /kintone_report/js/kintoneRecordUtil.js | UTF-8 | 4,601 | 3.484375 | 3 | [] | no_license | /**
* JavaScriptのオブジェクトをkintone用のJSON形式へ変換する
* @param {[String]} fieldList kintoneのフィールドコードのリスト
* @param {Object} targetObj kintone用のJSONへ変換するオブジェクト キーはフィールドコードと対応
* @param {[[String]]} tableCol=[] テーブル形式のフィールドの項目リスト
* @returns {Object} kintoneのレコード形式のJSONオブジェクト
*/
export function convertKintoneRecordObject... | true |
472df4722373ba7cb25c94a1b78220530f4c4eaa | JavaScript | lleellee0/dyn-miner-monitor-client | /app.js | UTF-8 | 2,615 | 2.53125 | 3 | [] | no_license | "use strict";
let fs = require('fs');
let conf = JSON.parse(fs.readFileSync('configuration.conf', 'utf8'));
console.log(conf);
let exec = require('child_process').exec;
let request = require('request');
let headers = {
'User-Agent': 'Super Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlen... | true |
ad18af9a996e0e5ea3c91595907fa04f09461371 | JavaScript | stevezhere/MusicServer | /app/assets/javascripts/components/musics/music_form.jsx | UTF-8 | 1,470 | 2.8125 | 3 | [] | no_license | class MusicForm extends React.Component {
constructor() {
super();
this.state = { toggle: false };
this.handleToggle = this.handleToggle.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleToggle() {
this.setState({ toggle: !this.state.toggle })
}
handleSubmit(e) {
e.preventDefault(... | true |
a63972b31b52b3322634e2bc029348721ccacda4 | JavaScript | AndrewsGyamfi/algorithms-refresher | /joinString.js | UTF-8 | 281 | 3.171875 | 3 | [] | no_license | const joinString = (list, character) => {
const recursiveJoin = (index, resultSoFar) => {
resultSoFar += list[index];
return index === list.length - 1
? resultSoFar
: recursiveJoin(index + 1, resultSoFar + character);
};
return recursiveJoin(0, '');
};
| true |
8ee87ba84733135c6b7eb468d944420195ea6d98 | JavaScript | chenl93/test | /1-js/1-异步/promise/test-all.js | UTF-8 | 980 | 3.890625 | 4 | [] | no_license | function test() {
var p = new Promise(function (resolve, reject) {
//做一些异步操作
setTimeout(function () {
console.log("执行完成");
resolve("hahaha");
}, 2000);
})
return p;
}
function test2() {
var p = new Promise(function (resolve, reject) {
//做一些异步操作
setTimeout(function () {
con... | true |
6e0d7554293bdda26b344411a129ae3a4acb3a35 | JavaScript | vishnumanjunath/zcl2020 | /ZCL/js/helpers_ui.js | UTF-8 | 1,815 | 2.578125 | 3 | [] | no_license | /****** Other
Utilities
********/
UNDER_DEVELOPMENT = false
//
// document.getElementsByClassName('t006__uptitle t-uptitle t-uptitle_md')[1].addEventListener(
// 'click', function(event) {
//
// window.location.assign("table/index.html");
// if (UNDER_DEVELOPMENT) {
// ... | true |
aeca25ca792d905504c54433e4ca323f979f36aa | JavaScript | s0kil/mint-runtime | /source/Compare.js | UTF-8 | 364 | 2.6875 | 3 | [] | no_license | import { Equals } from "./Symbols";
export const compare = (a, b) => {
if (a != null && a != undefined && a[Equals]) {
return a[Equals](b);
} else {
if (b != null && b != undefined && b[Equals]) {
return b[Equals](a);
} else {
console.warn(`Could not compare "${a}" with "${b}" comparing wit... | true |
5da230c97efe6493b60139d8434b1482e060f404 | JavaScript | sazonovOleg/repos | /testovoe_propellerAds/js/js.js | UTF-8 | 2,610 | 2.9375 | 3 | [] | no_license | document.querySelector('#play').onclick = playOn;
document.querySelector('#pause').onclick = pauseOn;
document.querySelector('#soundOn').onclick = soundOn;
document.querySelector('#soundOff').onclick = soundOff;
document.querySelector('#fullScreen').onclick = fullScreenOn;
const video = document.querySelector('#videoP... | true |
411444aec8733017d2b87aa10a5e736acd34f9f3 | JavaScript | flowmemo/leetcode-in-js | /solution/151.js | UTF-8 | 796 | 4.3125 | 4 | [
"WTFPL"
] | permissive | /*
151. Reverse Words in a String
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1) space.
click to show clarification.
Clarification:
What constitutes a word?
A sequenc... | true |
c9226de5259053db5f79840ae6e8aec19372348f | JavaScript | gradebook/utils | /packages/config/__tests__/config.spec.js | UTF-8 | 3,021 | 2.59375 | 3 | [] | no_license | // @ts-check
import process from 'process';
import {expect} from 'chai';
import {getConfig, coerceKeyToBoolean} from '../lib/config.js';
import {VirtualFileSystem} from './vfs.js';
const originalEnv = {
GB_CONFIG_ROOT: process.env.GB_CONFIG_ROOT,
NODE_ENV: process.env.NODE_ENV,
};
/**
* @param {keyof typeof origin... | true |
69152f8cf52cf73682b47a2d6a46370727232155 | JavaScript | Roeoeri/fullstack2019 | /viikko6/redux-anecdotes/src/components/AnecdoteList.js | UTF-8 | 1,242 | 2.515625 | 3 | [] | no_license | import React from 'react'
import { connect } from 'react-redux'
import {
addVote
} from '../reducers/anecdoteReducer'
import {
setVotedMessage,
setMessageNull
} from '../reducers/notificationReducer'
const AnecdoteList = (props) => {
const vote = (id,content) => {
props.addVote(id)
props.setVot... | true |
7212c3287008b821ae9276cbc408653f2089a6bf | JavaScript | lalapolalaanewb/testProj_redux | /methods/dashboard.js | UTF-8 | 2,397 | 2.765625 | 3 | [] | no_license | /** Dependencies */
// Model - User
const {
User
} = require('../models')
// Controllers
const {
// Redis Promises
getDefaultAllData, resetDefaultAllData
} = require('../controllers')
/** Methods */
// @desc Portfolio V4 Dashboard (Get All Counts)
// @route POST /api/v1/dashboard
// @access Private (Requir... | true |
59259bb799ce065d2395a6029e27a071c8d9ce1d | JavaScript | chalidade/doc_ext | /trial/part-1/Ext-lite.js | UTF-8 | 551 | 2.765625 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function(event) {
launch();
});
function addRowHandlers(table, fn) {
var table = document.getElementById(table);
var rows = table.getElementsByTagName("tr");
for (var i = 1; i < rows.length; i++) {
var row = table.rows[i];
var cols = row.getElementsByTag... | true |
07167a219489ddaec309c83ed6bfa21cef951cf4 | JavaScript | CoderPaulR/Recipe | /recipe/js/script.js | UTF-8 | 1,045 | 2.546875 | 3 | [] | no_license | $(document).ready(function() {
$('.ingredient ul li').click(function(){
var q = $(this).index()+1;
$('.picture img:nth-child('+q+')').toggleClass("shade");
$(this).toggleClass("lineout");
});
$('.ingredient ul li').hover(function(){
var i = $(this).index()+1;
$('.picture img:nth-child('+i+')').togg... | true |
72730d992d5dfb835bb8fd0c201c0c2311510370 | JavaScript | iliandj/Telerik-Academy | /08. JavaScript - Part 2/02. Document Object Model/Homework/03. Set body background color from color input/scripts/script.js | UTF-8 | 724 | 3.109375 | 3 | [] | no_license | /*globals console, document:true */
function OnClickGetColorButton() {
setBodyColorsFromInput("input[type=color]");
}
function setBodyColorsFromInput(selector) {
var colorInput = document.querySelector(selector);
var color = colorInput.value;
var bodyStyle = document.body.style;
bodyStyle.backgro... | true |
5886f17374678142bb50c40999fdc0f6841839f1 | JavaScript | kaluogh/DesignModelForJavascript | /normal/5_decorator.js | UTF-8 | 1,035 | 3.46875 | 3 | [] | no_license | //装饰器设计模式
//装饰一个模型,本质不会变,让他更丰富
//和建造者的区别,建造者是一起合作创造一个完成的模型,装饰是去丰富一个已有的模型
//和class继承区别 不依赖于特定类型,很多类型都可以进行装饰
//@Decorator 还不能用
class TestModule{
constructor(name){
this.name = name
}
getName(){
return this.name
}
}
function DecoratorNickname(module){
module.prototype.nickname = 'def... | true |
2adcd5f6cf155bc5f61bd9ff731893031016b7d9 | JavaScript | elambova/MovieApp | /src/Components/Form.js | UTF-8 | 1,188 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
import PropTypes from "prop-types";
export default class Form extends Component {
constructor(props) {
super(props);
this.state = {
data: "",
};
}
static propTypes = {
handleSubmit: PropTypes.func.isRequired,
};
onSubmit = (e) => {
e.prev... | true |
b8b38fb213199544f35eac735fec0cd62986673a | JavaScript | svargas-dev/lab-react-training | /starter-code/src/components/LikeButton/index.jsx | UTF-8 | 1,305 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
class LikeButton extends Component {
constructor() {
super();
this.colors = ['purple','blue','green','yellow','orange','red'];
this.state = {
btnStyle: {
padding: '1em',
backgroundColor: 'purple',
border: '0.25em solid purple',
... | true |
f3b3d665a5d84d3186ab7bf4ea2957d353ab900d | JavaScript | ctapvk/d3 | /gist/4/graf.js | UTF-8 | 9,269 | 2.546875 | 3 | [] | no_license | svg = d3.select("svg");
widthSvg = +svg.attr("width");
heightSvg = +svg.attr("height");
width = +svg.attr("width") - +(prop.paddingLeft);
height = +svg.attr("height") - +(prop.paddingBottom);
asisX = svg.append("g")
.attr("class", "asisX")
.attr("transform", "translate("+[ widthSvg- width, height ]+")")
... | true |
10c9802aaea71ac3e31ee026727f49387fd96f78 | JavaScript | ManasisV/leaf | /utilities/aspen.js | UTF-8 | 2,250 | 3 | 3 | [
"MIT"
] | permissive | const inquirer = require("../config/cities")
const Conf = require("conf")
const config = new Conf()
const ora = require('ora')
const getWeather = require('../utilities/weather')
const colors = require("colors")
module.exports = async (args) => {
const cities = config.get('cities')
const spinner = ora().start()
... | true |
fcef7dd14f491ae5e60f57aa14548d203a4329fb | JavaScript | benben1026/frontend | /js/home.js | UTF-8 | 7,931 | 2.859375 | 3 | [] | no_license | var timeId;
function init(){
startShift();
}
function startShift(){
timeId =setInterval("shiftLeft(0)",5000);
}
function moveLeft(left, classname){
if(left==-960){
$(classname).animate({left:"-1920px"},500, function(){
$(classname).hide();
$('#left').removeAttr("disabled");
$('#right').removeAttr("di... | true |
4bda5557b4f7f784cf56457e0a144582d448e38f | JavaScript | AnastasiyaKrasnova/GrapeProjectMpp | /server/routes/categorys.js | UTF-8 | 1,386 | 2.515625 | 3 | [] | no_license | const router=require('express').Router();
const Category=require('../controllers/categorys');
router.post('/add', async (req,res)=>{
const saved=await Category.add(req.body);
if (saved)
res.status(200).send(saved);
else
res.status(400).send('json data is incorrect');
});
router.ge... | true |
7ec419d8676d5537d50446c444a468070304efdc | JavaScript | rafalmeidas/desafio2-IGTI | /src/services/apiService.js | UTF-8 | 925 | 2.53125 | 3 | [] | no_license | import { get } from './HttpService';
const BACK_END_URL = 'http://localhost:3001/';
export async function apiGetAllCandidates() {
const allCandidates = await get(`${BACK_END_URL}candidates`);
return allCandidates;
}
export async function apiGetAllCities() {
const allCities = await get(`${BACK_END_URL}cities`);... | true |
7ee914c636e0ea8b6392fe3991a280ade08633f1 | JavaScript | Turnonio/turnonio.github.io | /js/github.js | UTF-8 | 2,095 | 2.671875 | 3 | [] | no_license | window.turnonio = (function () {
const org = 'Turnonio';
const repo = 'bookmarks';
function fetchPage(token) {
const request = new Request(
`https://api.github.com/repos/${org}/${repo}/contents/src/overview.html`,
{
method: 'GET',
credentials... | true |