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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e461216aded6591f036ae6fe791a7f8c89ce91d6 | JavaScript | RossCasey/SecureDrop | /src/client/components/PasswordEntry.js | UTF-8 | 964 | 2.6875 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
class PasswordEntry extends Component {
constructor(props) {
super(props);
this.submitPassword = this.submitPassword.bind(this);
this.onPasswordChange = this.onPasswordChange.bind(this);
this.state = {password:''};
}
onPasswordChang... | true |
fb663284c25cae8a9a2e72ee33dcd08e4d938b43 | JavaScript | bradmallett/intermediate-js | /diffArray.js | UTF-8 | 438 | 3.171875 | 3 | [] | no_license | function diffArray(arr1, arr2) {
var newArr = [];
const compare = (first, second) => {
for (let i = 0; i < first.length; i++) {
if(!second.includes(first[i])){
newArr.push(first[i]);
}
}
}
compare(arr1, arr2);
compare(arr2, arr1);
console.log(newArr);
return newArr
}
diffAr... | true |
aa3277ba9fa58406dc558a9b2e26a3a9ed406ab9 | JavaScript | home-things/rpi-bin-1 | /megapolisfm-itunes-tracks-uris/index.js | UTF-8 | 1,305 | 2.703125 | 3 | [] | no_license | /*
open http://podbay.fm/show/1070520307 # megapolisfm
urls = Array.from(document.querySelectorAll('.span8 table .btn')).map(e=>e.href)
for url in urls.slice(0, 6)
open url
mp3 = document.querySelector('.pull-right .btn').href
yield mp3
*/
const thrw = require('throw');
const fetch = require('isomorphic-fetch');... | true |
c598ed65edf0783e32eaa0e8cb18dbde1d6e3e71 | JavaScript | abhishekbh/threatwiki_node | /actions/location_actions.js | UTF-8 | 1,903 | 2.71875 | 3 | [] | no_license | var express = require("express");
function load_locationActions(app){
// retrieve all
app.get('/api/location', function (req, res){
return LocationModel.find(function (err, locations) {
if (!err) {
return res.send(locations);
} else {
return console.log(err);
}
});
});
... | true |
d2a36bca24ffd2031adc83fe4e61388baed43262 | JavaScript | kevinqiyefa/nba-highlights | /src/components/Teams.js | UTF-8 | 1,687 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
const URL_TEAMS = 'http://localhost:3004/teams';
function Teams() {
const [keyword, setKeyword] = useState('');
const [teams, setTeams] = useState([... | true |
9ec383ac65aea5db709bccabd7e1e2863631db4d | JavaScript | ALshas/learn | /code/前端进阶/callback/03_01并发.js | UTF-8 | 602 | 2.90625 | 3 | [] | no_license | /*
* @Author: liusha
* @LastModifiedBy: liusha
* @LastEditTime: 2020-12-29 17:00:22
* @Date: 2020-12-29 16:32:17
*/
// 异步的 node中的异步方法 都可以通过回调来获取到最终的结果
const { time } = require('console');
let fs = require('fs'); //fileSystem
let obj = {}
const after = (times, callback)=>()=>{
--times == 0 && callback()
}
let... | true |
3ba1844502e43279dcb5fb8a83822a545a728f6d | JavaScript | dkimlim/gitpages-test | /pages.js | UTF-8 | 1,958 | 3.328125 | 3 | [] | no_license | let pageNumber = 0;
const pages = [
{ copy: "building things in React, Node, Javascript, HTML, CSS", background: "red", circle: "blue" },
{ copy: "currently updating her portfolio", background: "blue", circle: "orange" },
{ copy: "probably hungry and eating ramen", background: "black", circle: "red" },
{ cop... | true |
08d85d3eb009eee0489afc41f24627d7b4c5f633 | JavaScript | haystack/eyebrowse-chrome-ext | /js/listeners.js | UTF-8 | 4,930 | 2.5625 | 3 | [
"MIT"
] | permissive | "use strict";
// Interesting events:
// When an active tab is selected
// When a new page is navigated to (must filter for bad urls)
// When a new window is opened/selected (same as tab event)
// When a tab or window is destroyed
// API info: http://developer.chrome.com/extensions/tabs.html
///////////////Event liste... | true |
26c7f12540eabd9fe8c16497e90baa390b6a8e64 | JavaScript | Th3Fire/simple-blockchain-node-js | /index.js | UTF-8 | 1,440 | 3.046875 | 3 | [
"MIT"
] | permissive | import inquirer from 'inquirer'
import CryptoBlockchain from './src/crypto-blockchain.js'
let simpleBlockchain = new CryptoBlockchain()
console.info('simpleBlockchain is started...')
const questions = [
{
type: 'input',
name: 'sender',
message: 'Sender name:',
default: () => 'Anonymous',
},
{
... | true |
515c7cb045a3485d810bce5d9d82150296309fa8 | JavaScript | flavio-foa-dev/Curso-Trybe | /4.1 Introdução a Javascript/exercises/4_1/script.js | UTF-8 | 4,067 | 4.25 | 4 | [] | no_license | //Exercício 1
let x = 10;
let y = 15;
console.log('Soma: ' + (x + y));
console.log('Subtração: ' + (x - y));
console.log('Multiplicação: ' + (x * y));
console.log('Divisão: ' + (x / y));
console.log('Módulo: ' + (x % y));
//Exercício 2
let x = 20;
let y = 25;
if (x > y) {
console.log ("x é maior que y");
} els... | true |
b96db2ae31d14d38b5373010c35fa153e340127e | JavaScript | Dorthu/es6-crpg | /src/game/dialog_choice.js | UTF-8 | 1,301 | 2.640625 | 3 | [] | no_license | import DialogBox from './dialog'
class DialogChoice extends DialogBox {
constructor(prompt, left_img=null, right_img=null) {
super(prompt['msg'], left_img, right_img);
this.prompt = prompt;
this.selected = 0;
this.croot = document.createElement("div");
this.croot.className=... | true |
410d9fe106c4a1a0e0592409788110f0444bf5eb | JavaScript | jpull/javascript-intro-to-functions-lab-bootcamp-prep-000 | /index.js | UTF-8 | 502 | 3.453125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function shout(string) {
return string.toUpperCase()
}
function whisper(string2) {
return string2.toLowerCase()
}
function logShout(string3) {
console.log(string3.toUpperCase())
}
function logWhisper(string4) {
console.log(string4.toLowerCase())
}
function sayHiToGrandma(string5) {
if (string5.toLowerCase() =... | true |
2c81a2c853157ffe258afcd49656853f7acce0f0 | JavaScript | OllieBuilds/eloquent_javascript | /10-modules/notes.js | UTF-8 | 3,175 | 4.0625 | 4 | [] | no_license | 'use strict';
// This pollutes the global namespace
// let names = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
// "Friday", "Saturday"];
// function dayName(number) {
// return names[number];
// }
//
// console.log(dayName(1));
// Returns Monday
// This creates a module interface preven... | true |
4c34d2b05554a770eb2e2a599223fcf29575a25c | JavaScript | viz-cupid/viz-cupid.github.io | /js/timeareavis.js | UTF-8 | 4,137 | 3.140625 | 3 | [
"MIT"
] | permissive | /*
* TimeAreaVis - Object constructor function
* @param _parentElement -- the HTML element in which to draw the visualization
* @param _data -- the actual data
*/
TimeAreaVis = function(_parentElement, _data, _eventHandler) {
this.parentElement = _parentElement;
this.data = _data
.filter(functi... | true |
7cffa6cb4c17206358a795b32283d8b8a25320d1 | JavaScript | bunnydeviloper/codingpractice | /a-ADVANCE/longestCommonSub.js | UTF-8 | 2,722 | 4.40625 | 4 | [] | no_license | // longest common substring
function makeGrid (string1, string2) {
let grid = [];
for (let i = 0; i < string1.length; i++) {
grid[i] = []; // set up inner array
for (let j = 0; j < string2.length; j++) {
// grid[i][j] = string2.charAt(j);
grid[i][j] = 0;
}
}
return grid;
}
// makeGrid(... | true |
1c35b37083be589ef1919f60060f1ab6bfa49199 | JavaScript | Ivan456/bubble-speach | /Pointer.js | UTF-8 | 1,411 | 2.78125 | 3 | [] | no_license | class Pointer {
constructor(canvas, pointerOptions) {
this.canvas = canvas;
this.hasControls = false;
this.x = pointerOptions.x;
this.y = pointerOptions.y;
this.radius = pointerOptions.radius;
this.color = pointerOptions.color;
this.pointer = {};
this... | true |
22b89b1be5483972393243ad2e784d4e25c7d75a | JavaScript | Muneko1483/Node.js | /nodejs/03Promesas/callback.js | UTF-8 | 786 | 3 | 3 | [] | no_license | 'use strict'
let
fs = require('fs'),
file = './assets/nombres.txt',
newFile = './assets/nombres-callback.txt'
fs.access('./assets/nombres.txt',fs.F_OK, function(err){
if(err){
console.log("El archivo no existe")
}
else{
console.log("El archivo existe")
fs.readFile(fil... | true |
3664362a14a7b931df1d842ac63e3b1618bbca07 | JavaScript | ncalibey/Launch_School | /exercises/JS_fundamentals/arrays/arrays_103.js | UTF-8 | 414 | 3.78125 | 4 | [] | no_license | // arrays_103.js - Array Concat Part 1
function concat(array1, secondArgument) {
var newArray = [];
var i;
for (i = 0; i < array1.length; i++) {
newArray.push(array1[i]);
}
if (Array.isArray(secondArgument)) {
for (i = 0; i < secondArgument.length; i ++) {
newArray.push(secondArgume... | true |
bbecc85b9ceba1b3ba3215b8d3dd94038c117cc4 | JavaScript | JonHimself/react-drills | /app-8/src/App.js | UTF-8 | 612 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
import "./App.css";
function App() {
const [apiData, setApiData] = useState({});
useEffect(() => {
const api = async () => {
const getData = await axios.get(
"https://api.coingecko.com/api/v3/coins/bitcoin/tickers"
... | true |
b015e6effae7328906678fd754fee174650b0073 | JavaScript | CACDanielMillward/PathTracing | /public_html/camerastuff.js | UTF-8 | 1,540 | 3.375 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//coordinates of top left corner of window
const TopLeftPixelX = -50; //-50
const TopLeftPixelY = 25; //50
const TopLeftPixelZ = 40;
... | true |
7adb0e4747e779cb47232ab5c65a625536a84d6c | JavaScript | Awais-cb/react-starter | /src/components/partials/Ninjas.js | UTF-8 | 1,701 | 2.625 | 3 | [] | no_license | import React from 'react';
import { Table, Button } from 'react-bootstrap';
// Importing component's custom css this css can affect other components too so write it carefully for this specific component
import '../../local/css/Ninjas.css';
// [UI/State less component]
// Another type of destructuring with default param... | true |
a948bccfd15a22e6062c765d6f7150a0bd8aebfd | JavaScript | ValeriaGirlus/Project-books-ValeriaGirlus | /script/script.js | UTF-8 | 15,385 | 2.9375 | 3 | [] | no_license |
// javascript - para passar de um livro para outro ao clicar no botão like ou dislike ou repeat //
/*
function Like(button) {
var book = button.parentElement.parentElement.parentElement.parentElement;
console.log(book.classList);
book.classList.remove("active");
var nextbook = book.nextElementSibling;
conso... | true |
6236b5087f3463cbfb4da26c09925b6b8318908e | JavaScript | gds15/testeJS | /calcpromises.js | UTF-8 | 1,462 | 3.734375 | 4 | [] | no_license | window.onload = () => {
let frm = document.getElementById('form1');
frm.addEventListener('submit', (evt) => {
evt.preventDefault();
pegarValores()
.then(transformarValores)
.then(calcularResultado)
.then(mostrarSaida)
.then((resultado) => {
console.log(resultado);
});
})
}
function pegarValor1... | true |
ec165994d6c48aa1c727cd227ff8f5913702cb44 | JavaScript | xxxDrez/general_software_training_final | /assets/js/events.js | UTF-8 | 757 | 2.796875 | 3 | [] | no_license | document.addEventListener('keyup', function(event){
if(event.key == 'Enter'){
if(document.getElementsByClassName('body__title')[0].innerHTML == 'Sign Up'){
onRegistration();
} else if(document.getElementsByClassName('body__title')[0].innerHTML == 'Sign In'){
onAuthorization()... | true |
e9406c21a4ad968151062e1336a40c36a54e0ced | JavaScript | Markete9000/Proyecto-DAW-Git | /PDAW/View/JS/perfil.js | UTF-8 | 1,805 | 2.65625 | 3 | [] | no_license | $(document).ready(function(){
var cont = 0;
$('.pedidos').click(function(){
window.location.href = $('a', this).attr("href");
});
$('.incidencias').click(function(){
window.location.href = $('a', this).attr("href");
});
$('.cerrar').click(function(){
window.locati... | true |
260fe93fbbb6a5088b6324da821da978360a4745 | JavaScript | prakrutijoshi/Training-Aug-21 | /JS/Node js/day3/display.js | UTF-8 | 413 | 2.84375 | 3 | [] | no_license | var result = require('./Rectangle.js');
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
readline.question(`Enter length of the Rectangle: `,l =>
readline.question('Enter breath of the Rectangle: ',b =>
{
console.log("Area : "+result.Area... | true |
2f19a8fca1ce8fe294faf059b9d9378b9a7c6ab9 | JavaScript | dheeraj1429/React-Hooks-learning | /src/component/hooks_learn/useState/useState.component.js | UTF-8 | 1,078 | 3.25 | 3 | [] | no_license | // import React from "react";
import React, { useState } from "react";
1;
const UseStateHook = () => {
const counter = 0;
const [timer, setTimer] = useState(counter);
const changeHandler = () => {
setTimer(counter + 5);
};
return (
<>
<button onClick={changeHandler}>click here</button>
... | true |
65040f3e5221d0c35feab5d50ed0b955b0c734b4 | JavaScript | Graydyn/expcomm-samples | /node.js | UTF-8 | 1,956 | 2.609375 | 3 | [] | no_license |
//npm install axios
//copy in your API_KEY
//node node.js
const axios = require('axios');
const BASE_URL = "http://localhost:3000";
const API_KEY = "";
async function authenticateApi(){
try {
const url = BASE_URL + '/public/authenticateApi';
const headers = {'Authorization': API_KEY... | true |
e52702fd723b6c3435353b4c22922e8a7c7756b0 | JavaScript | ianmunrobot/advent-of-code-2018 | /2/inventory-management-part-one.js | UTF-8 | 832 | 3.296875 | 3 | [] | no_license | const { readFile } = require('fs');
readFile('input.txt', 'utf-8', (err, dataBuffer) => {
if (err) throw err;
const checkSums = { 2: 0, 3: 0 };
dataBuffer
.toString()
.split('\n')
.forEach(currentWord => {
const wordHash = {};
let addTwo = false;
let addThree = false;
curren... | true |
809704e6986a0235f64e0df5e9f3bfc88d2fbd75 | JavaScript | milolaun/gates | /draw.js | UTF-8 | 1,977 | 2.8125 | 3 | [] | no_license | var count=0
function draw(dt){
ctx.clearRect(0, 0, canvas.width, canvas.height);
drawGrid();
count +=1
ctx.beginPath();
ctx.font = '12pt Calibri';
ctx.textAlign = 'left';
ctx.textBaseline = 'top'
ctx.fillStyle = '#000000'
ctx.fillText(count, 5, 5);
for (var i=0; i<draggables.length; i++){
draggables[i]... | true |
f6a1435937424b05fb22df12d642998f0dd7d5d2 | JavaScript | Jsifontez/markdown-previewer | /pages/index.js | UTF-8 | 2,413 | 2.921875 | 3 | [] | no_license | import { useState } from 'react'
import Head from 'next/head'
import Image from 'next/image'
import Layout from '../components/Layout'
import Editor from '../components/Editor'
import Previewer from '../components/Previewer'
export default function Home() {
const [markdown, setMarkdown] = useState(`# Welcome to my R... | true |
d7bfbeac45723343dff3671ad74202d0be1659b0 | JavaScript | SameerAli2808/mySedcLectures | /03- JavaScript & jQuery Development Basic/Session03/jsS03Exe02.js | UTF-8 | 778 | 4.125 | 4 | [
"MIT"
] | permissive | function celsiusToFahrenhite(cValue){
let tempFahrenhite = (cValue * (9/5)) + 32;
return tempFahrenhite;
}
function FahrenhiteToCelsius(fValue){
let tempCelsius = (fValue - 32) * 5/9;
return tempCelsius;
}
let personChoice = prompt("Enter f for Fahrenhite or c for Celsius")
if (personChoice === "f") {... | true |
05b896f5aaf7ec20354e822a26ff56ca36ad13b7 | JavaScript | jesusantguerrero/book-trading | /server/utils/encrypter.js | UTF-8 | 353 | 2.5625 | 3 | [] | no_license | const bcrypt = require('bcrypt')
const saltRounds = 10
module.exports = class encrypter {
static hash (password) {
bcrypt.hash(password, saltRounds, (err, hash) => {
if (err) {
return false
}
return hash
})
}
static verify (hash, paraphrase) {
return bcrypt.co... | true |
13ea480964a7bf9514326bba0627bc03d1de7d58 | JavaScript | supervoron1/epam | /js_basics/task_3/task3.js | UTF-8 | 715 | 3.5 | 4 | [] | no_license | 'use strict';
function Cart(name = null, owner = null) {
this.name = name;
this.owner = owner;
}
Cart.prototype.items = [];
Cart.prototype.show = function () {
this.items.forEach(item => {
console.log(item)
})
};
Cart.prototype.add = function (item) {
this.items.push(item)
};
Cart.prototype.delete = f... | true |
5dfc000431050160e2d6e7612dd638f6d8c6d822 | JavaScript | Appe123123/Mywork | /JS/VANILLA/index.js | UTF-8 | 518 | 3.984375 | 4 | [] | no_license | //JS의 선언은 let , const, (var)이 있음
//JS에서는 const를 주로 사용하는것을 권장 !
const title = document.querySelector("#title");
//title.style.color = "blue";
//title.innerHTML = "HI!";
const CLICKED_CLASS = "clicked";
function handleClick() {
const hasClass = title.classList.contains(CLICKED_CLASS)
if(!hasClass) {
... | true |
4eb7e12254057ce248b4ddc5001203e4562b0de4 | JavaScript | tanu456/Donate-MERN | /frontend/src/components/Signup.js | UTF-8 | 8,674 | 2.609375 | 3 | [] | no_license | /* eslint-disable no-useless-escape */
/* eslint-disable default-case */
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { useState } from "react";
import { NavLink } from "react-router-dom";
function Signup() {
const [item, setItem] = useState({
fName: "",
lName: "",
uName: "",
email: ""... | true |
2846b19f5769945cbe900dc2a9e53bef40f92e72 | JavaScript | Kenzie-Academy-Brasil-Developers/entrega-labirinto-sprint-5-MPorto1994 | /code.js | UTF-8 | 4,157 | 3.34375 | 3 | [] | no_license | let main = document.querySelector("main")
// let someP = document.createElement("p")
const mapArray = [
"WWWWWWWWWWWWWWWWWWWWW",
"W W W W W W",
"W W W WWW WWWWW W W W",
"W W W W W W W",
"W WWWWWWW W WWW W W W",
"W W W W W",
"W WWW WWWWW WWWWW W W",
"W W W... | true |
967b3147f99f761e6224a261283ca82052ef4266 | JavaScript | AudreyPouchoulin/SERSE | /SERSE_ECN/WebContent/scripts/Soumission.js | UTF-8 | 2,703 | 2.625 | 3 | [] | no_license | /**
* Project: SERSE_ECN
* Creation date: 04 mar. 2014
* Author: Audrey
* Récupération des arguments du formulaire, envoie de ces données au serveur
*/
/**
* Dépôt d'un rapport sur le serveur
* @param argumentsJson données JSON à envoyer au serveur pour déposer un rapport
*/
function soumettre(ar... | true |
c06bb2b6ce00099ba6afa75d4bd51e1475307f3a | JavaScript | mikechin37/Quell | /quell-client/src/helpers/normalizeForLokiCache.js | UTF-8 | 5,944 | 2.84375 | 3 | [
"MIT"
] | permissive | //importing lokiJS to be used as client cache storage to replace sessionStorage
const loki = require("lokijs");
let lokidb = new loki("client-cache");
let lokiClientCache = lokidb.addCollection("loki-client-cache", {
indices: ["id"],
});
/**
normalizeForCache traverses server response data and creates objects out ... | true |
ab95c8dd10a77b0a473f144cb842c443a9f1d3ea | JavaScript | NahidUddin/terakya | /bot.js | UTF-8 | 2,276 | 2.6875 | 3 | [] | no_license | const Discord = require('discord.js');
const bot = new Discord.Client();
const prefix = "!";
bot.on("message", async message => {
if(message.author.bot) return;
if(message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift()... | true |
e9a1ea9441a79df79db93798150111486f997c8a | JavaScript | sgarner23/JS-Basics | /js-basics/gitInfo.js | UTF-8 | 3,962 | 3.46875 | 3 | [] | no_license | /*
For this section of the assessment you will be putting together a cheat sheet for common git commands.
You'll provide the command as well as what it does.
*/
//////////////////PROBLEM 1////////////////////
/*
Create a variable called 'gitDefinition'.
It should be a string containing your best def... | true |
69cf96356ad65eec0db61cbc2b158c5832a8d976 | JavaScript | hamxajaved/seedlify | /src/Authentication_pages/Register.js | UTF-8 | 2,918 | 2.53125 | 3 | [] | no_license | // @flow
import React, { useState } from "react";
import axios from "axios";
import { useHistory } from "react-router-dom";
function Register() {
let history = useHistory();
const [state, setState] = useState({
name: "",
email: "",
address: "Lahore",
password: "",
password_confirmaton: "",
})... | true |
09e906350796bfb6b7c85660c93a03ffd734b26f | JavaScript | TurboTractopelle/photonagenda | /src/store/reducer/reducer.js | UTF-8 | 2,363 | 2.875 | 3 | [] | no_license | import * as actionTypes from "../actions/actionTypes";
// @ts-ignore
import { preparse, parse as dateParser, format } from "date-and-time";
const initialState = {
loading: false,
cat: "",
error: "",
dataCache: [],
data: []
};
const reducer = (state = initialState, action) => {
switch (action.type) {
c... | true |
2f9f5c5bafc4016f6bf84bfccc10823e117989c7 | JavaScript | jessicadavey/LS_JS210 | /small_problems/list_processing/exercise_10.js | UTF-8 | 1,481 | 3.5 | 4 | [] | no_license | function transactionsFor(inventoryItem, transactions) {
return transactions.filter(({ id }) => id === inventoryItem);
}
/*
1. get all the transactions for the item
2. reduce to the quantity available
3. return whether or not the quantity is greater than zero
get quantity
1. if movement === 'in', add quantity
2. el... | true |
10fb7050a31126d9ea9b6cda62151c29c63cc160 | JavaScript | eva-chu/portfolio | /js/index.js | UTF-8 | 6,875 | 3.296875 | 3 | [] | no_license | // values to keep track of the number of letters typed, which quote to use. etc. Don't change these values.
var i = 0,
a = 0,
isBackspacing = false,
isParagraph = false;
// Typerwrite text content. Use a pipe to indicate the start of the second line "|".
var textArray = [
" Hey, this is| Eva Chu!... | true |
b57ab24ad4b787c3b1b578ca593bf56fa1a0adad | JavaScript | CalebPenning/capstone-client | /src/components/FollowButton/FollowButton.js | UTF-8 | 1,588 | 2.84375 | 3 | [] | no_license | import { useState, useEffect } from "react"
import CinemaApi from "../../Api"
const FollowButton = ({ userID, currentUser }) => {
const [following, setFollowing] = useState([])
const [hasUpdated, setHasUpdated] = useState(false)
console.log(`Here is the current user ${currentUser}`)
useEffect(() => {
... | true |
ca5816736712ffb8580b54f10756688beace4bc7 | JavaScript | dongyeewu/CH17-JSmap | /1701_WebView/src/main/assets/24/js/beny_showshark.js | UTF-8 | 2,095 | 2.84375 | 3 | [] | no_license | $(function(){
// bing 監聽事件
$('#showshark_gonextp').bind('click',showshark_gonextp);//#gonextp btn next的ID
$('#showshark_gobackp').bind('click',showshark_gobackp);//#gobackp btn back的ID
});
var showshark_index=0;
var showshark_productname,showshark_productimg,showshark_gotolink;//紀錄文字敘述,圖片路徑,超連結路徑
var showshark_prod... | true |
205ac504fe1b33e937aca048909fecbcc9628417 | JavaScript | spanke46/spanke46.github.io | /slide.js | UTF-8 | 767 | 3.046875 | 3 | [] | no_license |
const prev = document.getElementById('btn-prev'),
next = document.getElementById('btn-next'),
slides = document.querySelectorAll('.slide'),
dots = document.querySelectorAll('.dot');
let index = 0;
const activeSlide = n => {
console.log(n);
for(slide of slides) {
slide.classList.remove('active... | true |
b46b6005cfa5d04201bc8fc62ed34d8ad97b25a1 | JavaScript | zhangrunhao/nodeStudyNote | /nodejs-tutorial/code/03-http.js | UTF-8 | 1,019 | 3.046875 | 3 | [] | no_license | // 引入核心模块
var http = require('http')
// 1. 创建服务器
var server = http.createServer()
// 2. 设置请求函数
// request 请求事件 是所有请求的入口
// 也就是说任何请求进来都会触发该事件, 然后执行回调处理函数
// 第二参数, 回调函数,
// request: 请求对象, 用来接收获取客户端请求的一些数据信息, 例如当前请求的路径
// response: 相应对象, 用来给本次请求发送相应数据
server.on('request', function(req, res) {
... | true |
cbd2bd028aad286a2c938d018a65b65d6ad93e55 | JavaScript | infoshareacademy/jfdd10-gibki-team-app | /public/data/transformPlayers.js | UTF-8 | 208 | 2.71875 | 3 | [] | no_license | var players = require('./players.json');
const newPlayers = players.reduce((result, { id, ...player }) => {
result[id] = player;
return result
}, {})
console.log(JSON.stringify(newPlayers, null, 2)) | true |
e78459902f90214d721028419818647fe33801c8 | JavaScript | PyChina/weekly | /_themes/pelican-bootstrap3/static/js/github.js | UTF-8 | 1,445 | 2.609375 | 3 | [
"WTFPL"
] | permissive | var github = (function(){
function escapeHtml(str) {
return $('<div/>').text(str).html();
}
function render(target, repos){
var i = 0, fragment = '', t = $(target)[0];
for(i = 0; i < repos.length; i++) {
fragment += '<li class="list-group-item"><a href="'+repos[i].html_url+'">'+repos[i].name+'<... | true |
880b8f4674987676b51a793c1f732ebd53e98968 | JavaScript | OBarois/sentinel-dashboard | /src/worldwind/products/WKTParser.js | UTF-8 | 1,976 | 2.921875 | 3 | [] | no_license | import WorldWind from 'webworldwind-esa';
const {
Location
} = WorldWind;
export function parseWKT(text) {
const i = text.indexOf('(');
const type = text.slice(0, i).trim();
const geometry = text.slice(i + 1, -1).trim();
if (type.toLowerCase() === 'polygon') {
return parsePolygon(geometry... | true |
a318395eb02c9e05f4ad85258dcf373444d497e5 | JavaScript | cfoust/quat | /js/app/src/nodes/RectRadius.js | UTF-8 | 3,371 | 2.6875 | 3 | [
"MIT"
] | permissive | var quat = quat || {};
/*
Layer that controls a DrawNode for the purpose of drawing rectangles with
borders of a certain radius.
*/
quat.RectRadius = cc.Layer.extend({
/**
* @param {Number} width sets the width of the rectangle.
* @param {Number} height sets the height of the rectangle.
* @param... | true |
b6d3dcdfd837044e4ee1943bb10e2c0eec36b882 | JavaScript | ughunoup/snake-ai | /test/Snake/BodyPart.spec.js | UTF-8 | 3,287 | 2.953125 | 3 | [] | no_license | var expect = require("chai").expect;
var directions = require('../../app/Game/Directions');
var BodyPart = require('../../app/Snake/BodyPart');
describe('BodyPart', function () {
beforeEach(function () {
head = new BodyPart({
x: 0,
y: 0
});
bodyPart1 = head.recrea... | true |
6f7a6d7eae35d59d99cfb3443d7591f6ac0c00d1 | JavaScript | sadie-r-oneill/assignments | /exercises/module-5/movies/client/src/components/AddMovieForm.js | UTF-8 | 1,047 | 2.90625 | 3 | [] | no_license | import React, {useState} from 'react'
export default function AddMovieForm(){
const initInputs = { title:"", genre:""}
const [inputs, setInputs] = useState(initInputs)
console.log(inputs)
function handleChange(e){
e.preventDefault()
const {name, value} = e.target
setInputs(prev... | true |
acfb0b5211d04144fb8b8bd2ca1c650aad5221d4 | JavaScript | NYUAD-IM/Workshops | /2017_02_05_WritingSounds/reference.js | UTF-8 | 2,553 | 2.65625 | 3 | [] | no_license | var mySample;
function init(){
mySample = new Tone.Player("./samples/albloom.mp4").toMaster();
console.log('sample loaded!');
}
function playSample(){
mySample.start();
}
function changePlaybackRate(rate){
mySample.playbackRate = rate;
}
function changePlaybackStart(start){
mySample.loopStart = start;
}
... | true |
740f1a4e90eb1b6a404ceb6a92cf24287bbe3547 | JavaScript | GabrielxBarcellos/mop | /static/scripts.js | UTF-8 | 2,070 | 2.609375 | 3 | [] | no_license |
function valida_form(classe_ignora){
$('.erro').removeClass('erro')
$.each($('[name]'), function (indexInArray, valueOfElement) {
console.log($(valueOfElement).hasClass(classe_ignora))
if (!$(valueOfElement).hasClass(classe_ignora)){
if ($(valueOfElement).val()==""){
... | true |
d7f6d0d21c88b983f73859ea5276d72c77615fd7 | JavaScript | jbuccola/jsd3-homework | /Johnny-jbuccola/homework_11/app.js | UTF-8 | 1,564 | 2.625 | 3 | [] | no_license | //homework: sort photo result by rating, return 28 photos instead of the default 20, display user information
$(function() {
// DOM is now ready
_500px.init({
sdk_key: 'c095a1ed8923d151066ec81a6569a9dd1195e5c5'
});
$('#login').click(function() {
_500px.login();
});
_500px.on('authorization_obtained... | true |
ed40b004d02df8822882f6c749b3c54ed43071e1 | JavaScript | Rewind-teche/C37NC | /sketch.js | UTF-8 | 824 | 2.890625 | 3 | [] | no_license | //Create variables here
var canvas;
var rocFly, roc, astro;
var sp
var back1, back2, back3, back4;
var gameState
var player
var form
function preload()
{
//load images here
rocFly = loadImage("images/roc.png")
roc = loadImage("images/rocky.png")
astro = loadImage("images/astroid.png")
back1 = loadImage("imag... | true |
11372ae3e7a31c45b17d2abca693e34d30a314cf | JavaScript | so-sasha/listograd-website | /js/main.js | UTF-8 | 186 | 2.515625 | 3 | [] | no_license | document.getElementById('header__nav__burger-btn').onclick = e => {
e.target.classList.toggle('is-open');
document.querySelector('.header__nav__menu').classList.toggle('is-open');
}
| true |
b0906c8540852852786588cd85e252a7e0034c7a | JavaScript | nguy2819/Morse-Code-fun | /src/App.js | UTF-8 | 3,611 | 3.234375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
//Dictionary named alphaToMorse
const alphaToMorse = {
'a':".-",
'b':"-...",
'c':"-.-.",
'd':"-..",
'e':".",
'f':"..-.",
'g':"--.",
'h':"....",
'i':"..",
'j':".---",
'k':"-.-",
'l':".-..",
'm':"--",
'... | true |
b3486caf910cc485f9049df85ff367fdf7aa83db | JavaScript | BeauRussell/gameoflife | /src/App.jsx | UTF-8 | 2,583 | 3.1875 | 3 | [] | no_license | import React from 'react';
import Board from './Board';
import Controller from './Controller';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
board: [],
rows: 50,
cols: 50,
cycles: 0
};
this.createBoard = this.createBoard.bind(this);
}
... | true |
db4624a53f3088fbbc8938c18e71b5a4cb19dfa7 | JavaScript | Alexandre-Petrachini/Simplificatec | /www/Menu_Etec/js/inserir.js | UTF-8 | 737 | 2.890625 | 3 | [
"MIT"
] | permissive | function ChamadaJSON(c, l, a, ln, data)
{
// conecta ao servidor
var xmlhttp = new XMLHttpRequest();
/* colocar na url os valores que quer passar para o servidor.
seu arquivo PHP deverá capturar os dados usando $_GET[];
*/var url = "http://menuetec.esy.es/insert.php?cafe=" + c + "&lanche=" + l+ "&almo... | true |
627228394aeb3a2bba3657b76f44488e85bed207 | JavaScript | gianmarco-todesco/bologna-lab-2021 | /examples/leg_1.js | UTF-8 | 4,100 | 2.71875 | 3 | [
"MIT"
] | permissive | MYLIB.initialize('renderCanvas', populateScene);
// uso una classe per raccogliere tutti i componenti di una singola gamba
// e i metodi per animarla
class Leg {
// questo metodo viene chiamato quando "istanzio" la classe, creando un oggetto
constructor(name, scene) {
// spessore gamba
const ... | true |
4bafa47ede8a2bb00a7690fed7f75976591518f9 | JavaScript | BlameDeng/music | /src/js/admin/upload.js | UTF-8 | 3,527 | 2.546875 | 3 | [] | no_license | {
let view = {
el: '.upload',
template: `<div id="dragArea" class="dragArea">请选择文件或将文件拖拽到此区域进行上传</div>
<div id="uploadBtn" class="uploadBtn">选择文件</div>`,
render(data) {
$(this.el).html(this.template);
},
active() {
$(this.el).addClass('active')... | true |
75040a5e22af42490a76dcfbba4cfb5772e88e79 | JavaScript | JoelVenable/coding-challenges | /codewars/07-nth-term.js | UTF-8 | 347 | 4.0625 | 4 | [] | no_license | // return the sum of the following series up to the nth term...
// 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16...
function seriesSum(n) {
var sum = 0;
for (let i = 0; i < n; i++) {
sum += 1 / ((i * 3) + 1);
}
console.log(sum);
}
seriesSum(1);
seriesSum(2);
seriesSum(3);
seriesSum(4);
serie... | true |
13f2a0d8c2bcc655b6e2c07c217b3d8738f85b33 | JavaScript | vuongvinhvien/MaxApi | /Max.Api/wwwroot/js/site.js | UTF-8 | 460 | 2.765625 | 3 | [] | no_license | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
function getName() {
let name = "vien"
const fullname = "vuongvinhvien"
let nameao =... | true |
bd1a028ad0e03665ce71bd455261758925d310d3 | JavaScript | aniket-viramgama/weather-website | /public/JS/xyz.js | UTF-8 | 1,578 | 3.328125 | 3 | [] | no_license | // console.log('We are in client side JavaScript');
// fetch('http://localhost:3000/weather?address=junagadh').then(function(response){
// response.json().then(function(data){
// if(data.error){
// console.log(data.error);
// }
// else{
// console.log(data.Location)... | true |
e5ac9a43f3e38b807ab1572725b7c950ba1c816d | JavaScript | AllenBae/leadgenbot | /server/store/question/questionFlow.js | UTF-8 | 2,629 | 2.671875 | 3 | [] | no_license | import logger from 'common/logger';
const DEFAULT_QUESTION_FLOW_KEY = 'default';
export default class QuestionFlow {
constructor(datahandler) {
this.datastore = datahandler.datastore;
this.key = null;
this.questions = [];
}
load(key = DEFAULT_QUESTION_FLOW_KEY) {
this.key = key;
return new ... | true |
3e6aa112a396fc99201cea73bd65e520a9c03aae | JavaScript | vd89/therRecursion | /allOtherAlgo/leapYear.js | UTF-8 | 347 | 4.0625 | 4 | [] | no_license | // Write a program to Check Whether the given year is a leap year or not
const readlineSync = require('readline-sync');
let year = readlineSync.question("Provide the year that you want to check for the leap year : ")
const leapYear = (n) => {
return n %4 ===0 ? `${n} is Leap ` : `Year is not Leap year ${n}`
}
c... | true |
47ec5e75fb4f9b370b38f39e82bc62dec59779e4 | JavaScript | Kevin-Xi/dududu | /utils.js | UTF-8 | 1,056 | 3.09375 | 3 | [
"MIT"
] | permissive | 'use strict';
function randomString(n) {
let result = '';
let alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
let i = 0;
while (i < n) {
let index = Math.floor(Math.random() * alphabet.length);
result += alphabet[index];
i++;
}
return result;
}
func... | true |
2fbfb2d811f71fb559c86be119400c883b4f4285 | JavaScript | benoitkoenig/rump | /image_annotation/src/client/components/main/index.jsx | UTF-8 | 1,911 | 2.640625 | 3 | [] | no_license | import React from 'react';
import './index.css';
class Main extends React.Component {
constructor (props) {
super(props);
this.state = {
unnatotatedImages: null,
above: false,
below: false,
behind: false,
inFront: false,
}
}
async componentDidMount () {
const reque... | true |
f326d3e7f4b71bd168f1015f6b36c3a3eb6bc0a1 | JavaScript | AntonioFry/comic-tracker | /src/Reducers/comicsReducer.js | UTF-8 | 614 | 2.734375 | 3 | [] | no_license | export const comicsReducer = (state = {}, action) => {
switch (action.type) {
case "SET_WEEKLY_COMICS":
return {
...state,
'Weekly Comics': action.comics
};
case "SET_CHARACTER_COMICS":
return {
...state,
'Current Charcater Comics': action.comics
... | true |
ae388acd3e86a6b847cc1911de5a500e9645f8d8 | JavaScript | ofergoli/rapid-ofer | /dev/js/service/api.js | UTF-8 | 1,099 | 2.515625 | 3 | [] | no_license | export const handler = {
updateLocalStorageState: (isUserLoggedIn) => {
const user = handler.getParsedUser();
user['loggedin'] = isUserLoggedIn;
window.localStorage.setItem('user', JSON.stringify(user));
},
updateImageLocation: ({x, y}) => {
const user = handler.getParsedUser();
user.x = x;
... | true |
9e8fdfe087d249a6b174f899fff902314020f9e7 | JavaScript | yuktagoel/Simon-Game | /game.js | UTF-8 | 2,262 | 3.296875 | 3 | [] | no_license | let gameSeq = [];
let userInputs = [];
let gameSeqNo = 0;
let level = 1;
function reset() {
gameSeq = [];
userInputs = [];
gameSeqNo = 0;
level = 0;
}
// Sound
function selectSoundToPlay(option) {
let soundPath;
switch(option){
case 0:
soundPath = 'sounds/0.mp3';
break;
case 1:
s... | true |
822e45b36894df1b6790742b252554331de0f8b9 | JavaScript | venkatakaturi94/DSA | /Problem_Solving_Patterns/sliding_window_pattern/silidingwindow.js | UTF-8 | 308 | 3.109375 | 3 | [] | no_license | /*
SLIDING WINDOW
This pattern involves creating a window which can either be an array or number from one position to another
Depending on a certain condition, the window either increases or closes (and a new window is created)
Very useful for keeping track of a subset of data in an array/string etc.
*/
| true |
48973b9933c9c1f18a70bf39d6fe5a8f7d0e86ea | JavaScript | ebenezerofori/allrecipes | /test/index.html.test.js | UTF-8 | 3,995 | 2.515625 | 3 | [] | no_license | const chai = require('chai');
const jsdom = require('jsdom');
const fs = require('fs');
describe('Test Suite For Existence of Pages', () => {
//test
it('Index Page should have h1 (header) that says Delicious Recipes.', (done) => {
//Arrange - выставление начальных условий
const index = fs.readFileSync('.... | true |
0df11d8cf1d1a8905d6a19006ad063e25875650e | JavaScript | aladin002dz/ReactJS-CRUD-Basic | /src -6-ProductsTable/ProductForm.js | UTF-8 | 1,908 | 2.734375 | 3 | [
"MIT"
] | permissive | import React from 'react';
const RESET_VALUES = {id: '', category: '', price: '', stocked: false, name: ''};
class ProductForm extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.handleSave = this.handleSave.bind(this);
this.state = {
... | true |
f59f7daf900743d9e04bb46cafb5725e873afec8 | JavaScript | fernando-estrad/assignments | /exercises/module0/functionExercise/app.js | UTF-8 | 957 | 4.46875 | 4 | [] | no_license | //Sum of two numbers
function sum(num1, num2){
return num1 + num2
}
//console.log(sum(55,6))
//Lagest of three numbers
function largestNum(num1, num2, num3){
if (num1 > num2 && num1 > num3){
return num1
} else if (num2 >> num1 && num2 > num3){
return num2
} else {
return num3
... | true |
b49fde5f42cf460fbd2e5a515506115481d19f34 | JavaScript | asirko/ludiQuizz | /backend/namespaces/player.js | UTF-8 | 1,805 | 2.796875 | 3 | [] | no_license | module.exports = function (socket) {
console.log('connection on team namespace');
socket.localData = {};
socket.on('addPlayer', (playerName, response) => {
console.log('request for new player : ', playerName);
const otherNames = getAllPlayerSocket()
.filter(socketTeam => socketTeam.id !== socket.i... | true |
687caf5ea71214271f02869200150389fb424c1d | JavaScript | Ardiantirta/learn-nodejs | /notes-app/app.js | UTF-8 | 1,480 | 2.546875 | 3 | [] | no_license | const validator = require('validator')
const chalk = require('chalk')
const yargs = require('yargs')
const noteUtils = require('./notes')
// const msg = getNotes()
// console.log(msg)
// console.log(`${chalk.green('success')} ${chalk.red('to')} ${chalk.yellow('print')} ${chalk.magenta('Hello')} ${chalk.blueBright('W... | true |
fa70510c32d2625eaf70e5745e0675746ce01563 | JavaScript | KateMore/broken-down_e-shop | /js/script.js | UTF-8 | 4,422 | 2.59375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var chosen_product = {
color: "",
size: "",
price: 0,
quantity: 0
};
var timeout = null;
var chosen_products = [];
var products = [
{
color: '#000000',
price: '39',
color_name: 'Black',
available_... | true |
d141821d863cbc58f88dae828da4b7d65516b611 | JavaScript | skotmerfie/spaceexplorers | /models/space.js | UTF-8 | 3,396 | 2.890625 | 3 | [] | no_license | var vector = require('./vector');
var common = require('./common');
var ship = require('./ship');
var token = require('./token');
function Space() {
this.maxWidth = common.SPACE_WIDTH;
this.maxHeight = common.SPACE_HEIGHT;
this.shipMaxSpeed = 10;
this.shipSize = 26;
this.stars = [];
this.ships = [];
... | true |
1ed5fe6c0666d466fbe5d3924cf9e7c7d7bfcefc | JavaScript | alextorq/card_game | /src/assets/scripts/Controller/StatisticController.js | UTF-8 | 2,009 | 2.734375 | 3 | [] | no_license | import axios from 'axios';
import api from '../api';
import uuid from 'uuid';
class StatisticController {
constructor(view, router, model) {
this.list = [];
this.view = view;
this.router = router;
this.model = model ? model : null;
this.saveUser();
}
/**
* Load ... | true |
43cfa93e2f8c4aa0338b61e6b119e0903386f398 | JavaScript | afran012/DelilahResto | /DelilahResto/controllers/products.controller.js | UTF-8 | 2,383 | 2.734375 | 3 | [] | no_license | const sequelize = require('../db_connection_data')
const createProduct = async (req, res) => {
const { productName, productPrice } = req.body;
let arrayInsertProduct = [`${productName}`, `${productPrice}`];
try {
const result = await sequelize.query(
"INSERT INTO Products( productName , productPrice ... | true |
7721325531bbaa75e413348b764b3888c8efac77 | JavaScript | emilioBrizuela/Panel-administration | /js/User.js | UTF-8 | 1,255 | 2.515625 | 3 | [] | no_license | function login() {
if (this.checkform()) {
var parametros = '&controlador=User&metodo=loginUser';
parametros += '&' + $('#formLogin').serialize();
$.ajax({
url: 'C_Ajax.php',
type: 'post',
data: parametros,
success: function() {
... | true |
2aa2052c481712e10e5d6d2a16e158ce21b98442 | JavaScript | ajpenalosa/New-York-Times-Article-Search | /logic.js | UTF-8 | 1,072 | 2.609375 | 3 | [] | no_license | function searchArticles() {
event.preventDefault();
var userinput = $("#searchterm").val();
var url = "https://api.nytimes.com/svc/search/v2/articlesearch.json";
url += '?' + $.param({
'api-key': "2d3d38f14f5248d787f0beae9073ce46",
'q': userinput
});
console.log(url);
$.ajax({
url: url,... | true |
168568240caf279d22fa7be924ac45c70c4f7426 | JavaScript | askkaz/BirthdayEmail | /birthdayEmails/static/birthdayEmails/toggle_patient.js | UTF-8 | 1,293 | 2.609375 | 3 | [] | no_license | $(".active-table").click(function() {
// Unhide email text
$("#emailBody").parent().removeClass("hidden");
$("#emailSubject").parent().removeClass("hidden");
//Move all the existing patient info over to the form
$("#patientEmailAddress").val($(this).children(".patient-email-address").text());
$... | true |
15547f66bc911d6d24e59f89056ac63632754642 | JavaScript | kahsay-1229/CTA-Ridership-Visualization | /flask_app/static/js/app.js | UTF-8 | 4,205 | 3.375 | 3 | [] | no_license | function buildMetadata(station) {
// @TODO: Complete the following function that builds the metadata panel
// Use `d3.json` to fetch the metadata for a sample
var url = `/metadata/${station}`;
// Use d3 to select the panel with id of `#sample-metadata`
d3.json(url, function(error, station) {
i... | true |
9332b38b2294022693d790d240573eeb259c1879 | JavaScript | DeepZatakiya/CFOchatbot | /data/api/graphApi.js | UTF-8 | 3,207 | 2.53125 | 3 | [] | no_license | var request = require('request')
async function spendByHeadImage(data) {
return new Promise((resolve, reject) => {
try {
var options = {
'method': 'POST',
'url': 'https://visualsmicroservice.azurewebsites.net/custom_barh',
'headers': {
... | true |
c8a461b0623d2e786cffa689621bd92b7afece43 | JavaScript | curt-mitch/2013-08-subclass-dance-party | /src/dancer.js | UTF-8 | 461 | 3.015625 | 3 | [] | no_license | var Dancer = function(top, left, timeBetweenSteps){
this.timeBetweenSteps = timeBetweenSteps;
this.top = top;
this.left = left;
this.step();
this.setPosition(top, left);
};
Dancer.prototype = {
step: function(){
var that = this;
setTimeout(function(){ that.step(); }, that.timeBetweenSteps);
},
... | true |
be3b9e2f9651c4510bcee2de6c00790421adb814 | JavaScript | akoubensky/technology | /Web07/javascript/group.js | UTF-8 | 419 | 3.09375 | 3 | [] | no_license | window.addEventListener('load', initBody, false);
var index = 0;
function initBody() {
document.getElementsByTagName('h1')[0]
.addEventListener('click', setStyles, false);
}
function setStyles() {
var emElements = document.getElementsByTagName('em');
var color = ['white', 'yellow'][index = 1-index];
for... | true |
79dfc2a316b707b6ec60a04a619476a7e1319a6c | JavaScript | kyleroden/quote_machine | /quoter.js | UTF-8 | 1,442 | 2.78125 | 3 | [] | no_license | quotes = [
"Always do what you are afraid to do.",
"The fruit of silence is tranquility.",
"The carpenter's door is loose.",
"Avoid things that will require an apology.",
"An ant on the move does more than a dozing ox.",
"One who is too insistent on his own views, finds few to agree with him.",
"The great... | true |
cc2975b8b140ea200bf343a245bae845db706ad9 | JavaScript | Mikwen/EDITF1 | /models/lecture.js | UTF-8 | 1,322 | 2.90625 | 3 | [] | no_license | var mongoose = require('mongoose');
//Lecture schema
var LectureSchema = mongoose.Schema({
/* lectureId: {
type: String,
index:true
},*/
course: {
type: String
},
roomNr: {
type: String
},
startTime: {
type: Date
},
endTime: {
type: Date
}
});
//Variable that ... | true |
57501ac0c75df0388450bad671a22430e0316034 | JavaScript | dhruva-12/visideals | /src_bckp/components/Profile/UserData.js | UTF-8 | 2,407 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react'
import './UserData.css'
import ChangePassword from './ChangePassword'
import jwt_decode from 'jwt-decode'
export default class UserData extends Component {
constructor(props){
super(props)
this.state = {
name: '',
email: '',
... | true |
36fd768fd2cd55b19e4415e674990c57b3cceb0f | JavaScript | Farahobaidat/exercise | /script.js | UTF-8 | 667 | 2.765625 | 3 | [] | no_license | button.onclick=function (){
fetch(`https://fakerestapi.azurewebsites.net/api/v1/Authors`).then (response => response.json()).
then(result => {for(let i=0;i<10;i++){
authors.insertAdjacentHTML("beforeend", `<div class="author">
<h3>
${result[i].firstName},${result[i].lastName}
</h3>
<h4>
${re... | true |
0e5e3196014ad7d69a1e8c947e350fd05a13a1e0 | JavaScript | billymfl/emailer | /modules/services/MailGun.js | UTF-8 | 2,189 | 2.890625 | 3 | [
"MIT"
] | permissive | /*
* @module MailGun
*/
const Emailer = require('./Emailer');
const qs = require('qs');
// reference to us
let instance;
// the response from the api signifying success
const success = {
message: 'Queued. Thank you.',
};
/** Class representing the MailGun API using Emailer interface. */
class MailGun extends Email... | true |
cfe2298f48cd08a0d5153f4cdb0df193d537b297 | JavaScript | qamatters/TypeScriptElementory | /parent.js | UTF-8 | 1,346 | 2.59375 | 3 | [] | no_license | var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] =... | true |
fb3a242832acd7fe12a35c9aa586f981424fc020 | JavaScript | smatveev/AstroJS | /game.js | UTF-8 | 3,658 | 3.015625 | 3 | [] | no_license | var canvas = document.getElementById('game');
var context = canvas.getContext('2d');
let timer = 0;
var aster = [];
// aster.push({
// sprite: "",
// x: 0,
// y: 300,
// dx: 10,
// dy: 12
// });
var fires = [];
var booms = [];
var enemies = ["Portraits2_27.png", "Portraits2_20.p... | true |
43016572ebf6cfc104edf617a0cead95fcd3aa18 | JavaScript | swetha311/Node.js-project | /src/setschoolintent.js | UTF-8 | 770 | 2.6875 | 3 | [] | no_license | var constants = require('./constants');
function set_school_name (app) {
var school_name = app.getArgument('school-name');
const resp = "Okay. School set to " + school_name;
var resp_txt_speech = '<speak>' + resp + '</speak>';
const resp_txt = re... | true |