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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2f5b7d18638debb8c925a294215b2dcd7ee604a6 | JavaScript | fanfank/aap | /frontend/src/libs/basic.jsx | UTF-8 | 7,669 | 2.796875 | 3 | [
"MIT"
] | permissive | /**
* @author reetsee.com
* @date 20160616
*/
export function statusOk(status, shouldAlert) {
shouldAlert = shouldAlert || true;
if (status === "success") {
return "";
}
let errorMessage = "http status error: [" + status + "]";
console.log(errorMessage);
if (shouldAlert) {
... | true |
a8cf2bab277eb8aeb228ae7f19e43ec4cc18bddb | JavaScript | RodionOtto/mesto | /src/components/UserInfo.js | UTF-8 | 711 | 2.828125 | 3 | [] | no_license | export default class UserInfo {
constructor(profileSelectors) {
this._profileName = document.querySelector(profileSelectors.profileName);
this._profileActivity = document.querySelector(profileSelectors.profileActivity);
this._profielAvatar = document.querySelector(profileSelectors.profileAvatar);
}... | true |
5277ebe712e25d12d138d8d3733e8dafe0891436 | JavaScript | Pablisnky/Picas_Fijas | /javascript/Funciones_Ajax.js | UTF-8 | 3,710 | 2.796875 | 3 | [] | no_license | var http_request = false;
var peticion= conexionAJAX();
function conexionAJAX(){
http_request = false;
if(window.XMLHttpRequest){ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType){
http_request.overrideMimeType('text/xml');
}
... | true |
7f1c5bef84cb88cf34e1741014a593203fed178c | JavaScript | gtorresrdz64/StudyProjects | /src/components/Weather/Weather.test.jsx | UTF-8 | 344 | 2.5625 | 3 | [] | no_license | import React from 'react'
import {render} from '@testing-library/react'
import Weather from './Weather'
test("Weather Render",async() =>{
//AAA: Arrenge, Act, Assert
const { findByRole } = render(<Weather temperature={10} state="rain"></Weather>)
const temp= await findByRole("heading")
expect(temp).to... | true |
62fc220cbfdae3de6f8c7ac163d9d04ff172bfdb | JavaScript | Avaddov/DevInstitute | /Week2/Day3 - Loops/Exercise/XP1.js | UTF-8 | 4,473 | 4.375 | 4 | [] | no_license | // // Exercise 1 : Your Favorite Colors
// // Create an array to hold your top colors.
// let colors = ["red", "black", "green"]; // colors
// // For each choice, console.log a string like: “My #1 choice is blue”
// // Bonus: Change it to console.log “My 1st choice”, “My 2nd choice”, “My 3rd choice”, picking the right ... | true |
6a2b0ba11540e4c68ca1be37b32f6e6f1be476e0 | JavaScript | impactbyte-gon/learn-async | /index.js | UTF-8 | 175 | 3.171875 | 3 | [] | no_license | function first() {
// Simulate a code delay
setTimeout(function() {
console.log('FIRST')
}, 1000)
}
function second() {
console.log('SECOND')
}
first()
second()
| true |
67612f1dc597e793ea00aee0d6a236242c5901f6 | JavaScript | joshuamsmith413/js-pokemon-search-practice-assignment-nyc-web-career-031119 | /src/index.js | UTF-8 | 1,351 | 3.5625 | 4 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
//YOUR CODE HERE
const pokeContainer = document.querySelector('#pokemon-container')
const pokeInput = document.getElementById('pokemon-search-input')
pokeContainer.innerHTML = ``
function renderPokemon(array){
array.forEach(function(pokemon){
pokeContainer... | true |
1ae3b86447452752f99e3126cb737155a3909086 | JavaScript | lcds90/css-grid-course | /src/pages/05Repeat/styles.js | UTF-8 | 1,086 | 2.53125 | 3 | [] | no_license | import styled from 'styled-components';
// SECTION 05 - Repeat
/*
A função repeat evita repetição e aceita valores multiplos.
*/
export const Container = styled.main`
background-color: ${({ theme: { colors } }) => colors.others.tertiary};
max-width:100%;
height:100%;
overflow:auto;
display:grid;
... | true |
224f6ad219c69ff6da9b80cf0e23bd7af47b5829 | JavaScript | M-A-Justice/algorithms | /twoSum/twoSum.js | UTF-8 | 1,038 | 4.46875 | 4 | [] | no_license | /*
Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,1... | true |
d6384683105d72a6f02e90535c405944d8d708eb | JavaScript | electrodragon/Dicee_Game_Project | /crazy.js | UTF-8 | 441 | 3.390625 | 3 | [] | no_license | var a = Math.floor((Math.random()*6)+1);
document.querySelector(".img1").setAttribute("src","images/dice"+a+".png");
var b = Math.floor((Math.random()*6)+1);
document.querySelector(".img2").setAttribute("src","images/dice"+b+".png");
if(a>b){
document.querySelector("h1").innerText = "Player 1 Wins";
}else if (a<b) {... | true |
5a3e7ddccf6726aedd6eefdf1a531ad90fd04525 | JavaScript | CS3216-WhereTo/where-to | /front_end/src/utils/AuthChecker.js | UTF-8 | 1,110 | 2.84375 | 3 | [] | no_license | import UserGateway from "../gateways/UserGateway";
const STORAGE_KEY = "jwtIdToken";
const gateway = new UserGateway();
const clearLocalToken = () => {
localStorage.removeItem(STORAGE_KEY);
};
export async function verifyTokenIfExists() {
if (!userTokenExists()) return false;
if (!navigator.onLine) {
retu... | true |
fcfe4b48968823bb135fe46a20b89d90c23bd3a3 | JavaScript | amandril/ct-countdown | /script.js | UTF-8 | 1,444 | 3.71875 | 4 | [] | no_license | var departDate = "2018-06-15";
// gets the remaining time until the date which is passed as a parameter
function getTimeRemaining(e) {
let t = Date.parse(e) - Date.parse(new Date());
// saves the dom element "ct-timer" to variable for re-use
const timer = document.getElementById("ct-timer");
// checks if we've pa... | true |
2f92dba5b7859b721729be7875130b94f338abdd | JavaScript | nilsjohnson/gif-it | /src/Explore.js | UTF-8 | 4,910 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import { getNew, search } from "./util/data";
import { Container, Grid, Typography } from '@material-ui/core';
import Header from "./Components/Header";
import MediaCard from "./Components/MediaCard";
import SearchBar from "./Components/SearchBar";
import MediaBox from "./Compo... | true |
4ca5f1f2b2fbe6d70676d053194b15a00369848d | JavaScript | Nurtau/guess-words | /src/Reducers/letterReducer.js | UTF-8 | 412 | 2.5625 | 3 | [] | no_license | const letterReducer = (letObj={isCorrect: true, letter:"start"}, action) => {
switch(action.type) {
case "SELECT_WORD":
return {isCorrect: true, letter:"start"};
case "BAN_LETTER":
return {
isCorrect: false,
letter: action.payload
};
case "CORRECT_LETTER":
return {
isCorrect: true,
le... | true |
915cfdd9ab4bab2b4d4de4b5cf9d5681081e9fa4 | JavaScript | podgorska/simple-notes-app | /src/App.js | UTF-8 | 2,111 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import Note from './Note/Note';
import { Row, Col } from 'react-flexbox-grid';
import './App.scss';
class App extends Component {
constructor(props){
super(props);
this.state = {
notes: [],
newNote: '',
}
}
addNote =... | true |
6cf9c7734cedcc19d5da8c6c831aa19a12fe4ef2 | JavaScript | lscan/ISS-location-app | /public/js/app.js | UTF-8 | 2,222 | 3.046875 | 3 | [] | no_license | const issForm = document.querySelector('form');
const messageOne = document.querySelector('#message-one');
const messageTwo = document.querySelector('#message-two');
const countryImg = document.querySelector('#country-img');
issForm.addEventListener('submit', (e) => {
e.preventDefault();
const setText = (... | true |
314a611831cea0775666669e6be77e435bc47379 | JavaScript | sotomaque/CSreview | /js/interviewQuestions/intersectionOfTwoSortedArrays.js | UTF-8 | 683 | 4.09375 | 4 | [] | no_license | // O(n) time-complexity
// O(n) space-complexity
const intersectionOfTwoSortedArrays = (a1, a2) => {
const aux = new Set();
let i = 0;
let j = 0;
// take advantage of fact arrays are sorted
// so if a1[i] < a2[j] we know incrementing j will not help us
// so we will want to increment i
// the opposite is... | true |
a0854d37fc42b3922c59cfbe37c5e20c225cbec0 | JavaScript | kacir/ParkInsp | /ParkInsp/web/js/viewpast.js | UTF-8 | 3,935 | 2.640625 | 3 | [] | no_license | function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
var parknum = getUrlVars()["parknum"];
$.ajax({
url: "api/parkname",
data : {parknum : parknum},
type: "POST",
... | true |
c88fb5841bc666316bef09a765087d6acef5788a | JavaScript | braxton98/Simple-to-do-list | /script.js | UTF-8 | 586 | 2.9375 | 3 | [] | no_license | "use strict";
let add = document.querySelector(".addtd");
let todocontainer = document.querySelector(".container");
let input = document.querySelector(".inputfield");
let x = add.addEventListener("click", function () {
let paragraph = document.createElement("p");
paragraph.innerText = input.value;
todocontainer.... | true |
6b3880e2aa49ec18ba83ace6b0991dd34368b9fc | JavaScript | xiehuangjun/webrtc | /web_server/web/Livehome/Livehome.js | UTF-8 | 2,184 | 2.796875 | 3 | [] | no_license | const inputs = document.querySelectorAll(".input");
function addcl(){
let parent = this.parentNode.parentNode;
parent.classList.add("focus");
}
function remcl(){
let parent = this.parentNode.parentNode;
if(this.value == ""){
parent.classList.remove("focus");
}
}
inputs.forEach(input => {
input.addEventList... | true |
98b6563dab73956733a1cc3784f5e62968975dec | JavaScript | MullinsLab/viroverse | /root/static/javascripts/util.js | UTF-8 | 17,013 | 2.546875 | 3 | [
"MIT"
] | permissive | function confirm_message (theText) {
//'message' id div is in global header
msg = document.getElementById('message');
msg.style.display = 'block';
msg.innerHTML = escapeHTML(theText);
viroverse.messageAnimate.animate();
}
function clear_confirm () {
document.getElementById('message').innerHTML =... | true |
445525628125d1fa15aba7838b302dbf054b927e | JavaScript | Bloom9900/uge40opgaver | /2. Tuesday/U40Tuesday-opg3.js | UTF-8 | 955 | 3.828125 | 4 | [] | no_license | var numbers = [1, 3, 5, 10, 11];
var result = numbers.map(function(num, index) {
if(index == numbers.length-1) {
return num;
} else {
num += numbers[index+1];
return num;
}
});
console.log("Opgave 3a) ", result);
var names = ["Hassan", "Jan", "Peter", "Boline", "Frederik"];
var ... | true |
05ca89410efe933c3cd29302731fd44851520b68 | JavaScript | Brkcan/JavaScriptNotes | /Object/src/com/example/array/Callback.js | UTF-8 | 371 | 3.4375 | 3 | [] | no_license | function writeln (n)
{
console.log(n)
}
function transform(a, b, cb)
{
let length = a.length
for(let i = 0; i < length; i++){
b[i] = cb(a[i])
for(let j = i; j < i + 1; j++){
writeln(b[i])
}
}
}
function main ()
{
let a = [1, 2, 3, 4]
let b = []
transform... | true |
f36ea478c2820ecd33b0ff8815376e2158f0f35d | JavaScript | dylanosaur/week0 | /truthy-falsy.js | UTF-8 | 552 | 3.703125 | 4 | [] | no_license | /**
* non boolean values can be evaluated as truthy and falsy
*
* 0, NaN, undefined, null, false, ''
*
* everything else going to give an error or evaluate to true
*/
result = '' || 'potato chip' //result is potato chip
result = '' && 'potato chip' //result is '' -- short circuiting
result = 'dog' || 'cat'... | true |
df9742a0072100d6645c43081d978e5efd1320ca | JavaScript | Wayne-Bai/AST-normalize | /data/marisai/rouwan/backstage/lib/restart.js | UTF-8 | 359 | 2.671875 | 3 | [] | no_license | var pid=process.argv[2];
var script=process.argv[3];
var killed=function(){
var execFile=require('child_process').execFile;
execFile(script);
process.exit();
};
var checkPid=function(){
var f=true;
try{
process.kill(pid,'SIGINT')
}catch(e){
f=false;
killed();
}
if(f){
setTimeout(checkPid,100);
}
};
... | true |
b62dc5f71e04b85d5ffd631cbc1453f456d0404d | JavaScript | sumikuart/kumik | /src/component/theTest/theTest.js | UTF-8 | 8,707 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import './theTest.css'
import Questions from './testComponents/questions';
import DisplayTest from './testComponents/testMaster';
import Result from './testComponents/result';
import Reset from './testComponents/reset';
import StartTest from './testComponents/preTest';
let q... | true |
c7cb20dba114c988c4f5ec7147fcbe73868ec222 | JavaScript | YunnanEUSoftware/eu-admin-vue | /src/libs/fileRequest.js | UTF-8 | 2,306 | 2.53125 | 3 | [
"MIT"
] | permissive | import { getToken } from '@/libs/util'
// 引入网络请求工具 axios
let axios = require('axios')
// 全局地址(部分地方需要单独使用根地址)
const BASEURL = process.env.VUE_APP_BASE_URL
// 网络请求的 base 地址
axios.defaults.baseURL = BASEURL
// 下载文件请求 fileType文件类型,默认xlsx, 0为xlsx, 1为xls
const getFile = (url, params, success, failure, fileType = 0) => {
... | true |
5d8055303ddb679b426581a47d2ea58dd57143a6 | JavaScript | widrelk/jsDocxToHtml | /src/index.js | UTF-8 | 30,400 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | let _ = require("underscore");
let docxReader = require("./docx/docx-reader");
let unzip = require("./unzip");
/**
* Converts given .docx file into identical html string. Styles applied inline to the html tags from the document's styles.xml
* Additional tuning for headers is required
* @param {*} input Path, Array... | true |
965f69dd65b9ba9296efa0c80aedfa19ecf42094 | JavaScript | nrw/styled-string-width | /index.js | UTF-8 | 918 | 2.84375 | 3 | [] | no_license |
module.exports = measureWidth
function measureWidth (str, current) {
if (!str) return 0
var span, width, currentStyle
span = document.createElement('span')
span.innerText = str
span.style = '' +
'position: absolute;' +
'top: -99999;' +
'left: -99999;' +
'width: auto;' +
'padding: 0;' ... | true |
52d117b97ca2f616d66dd5eecf7ca509e1807e20 | JavaScript | LMem001/js-jq-carousel | /main.js | UTF-8 | 3,279 | 3.3125 | 3 | [] | no_license | // link variables to html document's classes
var nextImageBtn = $(".slider-wrapper .fas.fa-angle-right");
var prevImageBtn = $(".slider-wrapper .fas.fa-angle-left");
var imageList = $(".images img");
var imgTotal = imageList.length;
var bulletNav = $(".slider-wrapper .nav");
// generate bullets
var i = 0;
while(i < im... | true |
382f20a400f2b991899340b042d7d922189ffcfb | JavaScript | jeanieherold/vanilla-js-form-validation | /js/scripts.js | UTF-8 | 2,742 | 3.0625 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
// code...
const form = document.querySelector('#sign-up-form');
const fname = document.querySelector('#fname');
const lname = document.querySelector('#lname');
const email = document.querySelector('#email');
const password = document.qu... | true |
9f5edd222be978f787d9fa42b934cad4d0ae785d | JavaScript | mofas/ds-algo-practice | /js/946.validateStackSequences.js | UTF-8 | 1,181 | 3.921875 | 4 | [] | no_license | /**
* @param {number[]} pushed
* @param {number[]} popped
* @return {boolean}
*/
// 56ms, beat 100%
var validateStackSequences = function(pushed, popped) {
let stack = [];
const m = pushed.length;
const n = popped.length;
let i = 0;
let j = 0;
while (j < n) {
const t = popped[j];
if (stack[stac... | true |
0d8ed449138197e313e1e174870327bdc7981ae7 | JavaScript | metahashorg/MetaWallet-interface | /metawallet-ui/public/js/lib/cookie.js | UTF-8 | 1,852 | 3.125 | 3 | [] | no_license | /**
* @typedef {Object} CookieOptions
* @property {string} path
* @property {expires} number
*/
/**
* @param {string} key
* @param {Object|string|number|null=} defaultVal
* @param {Function=} cast
* @return {Object|string|number|null}
*/
function getCookie (key, defaultVal, cast) {
let defaultValue = type... | true |
7149ebde44305b9f0343a2edc16870a5eed6c299 | JavaScript | ow-tech/PizzaHut | /cart.js | UTF-8 | 4,766 | 3.125 | 3 | [
"MIT"
] | permissive |
// busines logic
let removeCartItemBtn = document.getElementsByClassName('btn-danger')
for (let i = 0; i < removeCartItemBtn.length; i++){
let btn = removeCartItemBtn[i]
btn.addEventListener('click', removeCartItem )
}
let quantityInputs =document.getElementsByClassName('quantity')
for (let i ... | true |
8e9dcf4ceb87aa141252ad691e84a3878570e98a | JavaScript | adityanegara/dicoding_frontend_fundamental | /1.Ecmascript6/6. Class/static.js | UTF-8 | 1,004 | 3.421875 | 3 | [] | no_license | class Vehicle {
constructor(licensePlate, manufacture) {
this.licensePlate = licensePlate;
this.manufacture = manufacture;
this.engineActive = false;
}
}
class VehicleFactory {
static repair(vehicles) {
vehicles.forEach(vehicle => {
console.log(`Kendaraan ${... | true |
21dbd48e7066e88f31d9d0925eaa00d7824c3d93 | JavaScript | interchained-games/enjinstarter-tge-contracts | /scripts/migrations/11_deploy_launchpad_whitelist.js | UTF-8 | 2,944 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | // We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hr... | true |
0b3aa77f0c6878e83f7875b6af25b6673f576e7d | JavaScript | mhaf4krr/NodeJSPro | /middleware/auth.js | UTF-8 | 1,366 | 2.703125 | 3 | [] | no_license | /* Auth middleware for privileged routes like updating , deleting or posting new products , checking is done as
* Check if token exists in header
* Check if token exists , try its decrytion which if successfull will run try block and if fails goes to exception block
* if token is valid check if current user has admin ... | true |
7f6594c2f01caf8dd232bb25cf466088038f8a31 | JavaScript | dzunigamendez/react-labs | /webpack-demo/src/demo/login.js | UTF-8 | 2,005 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react';
function FieldSet(props) {
return (
<fieldset>
<legend>{props.legend}</legend>
{props.children}
</fieldset>
);
}
function Field(props) {
let label;
if (props.id && props.label) {
label = <label htmlFor={props.id}>{props.label}</label>;
}
re... | true |
a33b8b0d67e99788d4b9a1ac234e285a2e36ff9f | JavaScript | kapilnavgurukul/javascript_logical | /logic.js | UTF-8 | 611 | 3.640625 | 4 | [] | no_license | // var z=require("readline-sync")
// var input=z.question("give input")
// // console.log(input)
// var m=[4,2,85,74,56,21,78,965,32,1,4];
// var l=["a","b","c","d","e","f","g","h","i","j","k"]
// function dictonary(a,b){
// c={}
// for (i=0; i<a.length; i++){
// c[b[i]]=a[i]
// console.log(c)
// }
... | true |
f77aa48e4ae07f185a54a3245973758584643e24 | JavaScript | Megan-TA/web-perf-analysis | /monitoring/errCatch.js | UTF-8 | 1,436 | 2.609375 | 3 | [
"MIT"
] | permissive | function formatError (error) {
// 火狐/safis / chrome 对error信息处理不一致
let column = error.column || error.columnNumber
let line = error.line || error.lineNumber
let errorType = error.name
let message = error.message
let stack = error.stack
let matchUrl = stack.match(/(http|https)?:\/\/[^\n]+/)
let urlFirs... | true |
b31dc7b23fffa68adc5215d3d84be180cf6c6b57 | JavaScript | april/observatory-webextension-examples | /april/background.js | UTF-8 | 3,586 | 2.625 | 3 | [] | no_license | const OBSERVATORY_API = 'https://http-observatory.security.mozilla.org/api/v1';
const OBSERVATORY_SITE = 'https://observatory.mozilla.org';
// all the Observatory scores
const scores = {};
// sleep for any number of milliseconds
const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, mi... | true |
f836a6cd4ea6e5dfad0707710bda370748abb13b | JavaScript | JasonHorine/jasonhorine.github.io | /js/smooth_scroll.js | UTF-8 | 1,234 | 2.609375 | 3 | [] | no_license | // scrolling is hidden until other on-page links can be added
// from bootstrap docs
// Add scrollspy to <body>
$(document).ready(function(){
$('body').scrollspy({target: ".navbar", offset: 100});
// Add smooth scrolling to all links inside a navbar
$("#myNavbar a").on('click', function(event){
// Make su... | true |
0702419d2962f51ab231773611620af7f7964919 | JavaScript | oohajadya/custom-calendar- | /src/utils.js | UTF-8 | 1,351 | 3.3125 | 3 | [] | no_license | export const hoursPerDay = ["1 AM", "2 AM", "3 AM", "4 AM", "5 AM", "6 AM", "7 AM", "8 AM", "9 AM", "10 AM", "11 AM", "12 PM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM", "6 PM", "7 PM", "8 PM", "9 PM", "10 PM", "11 PM"]
export const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "De... | true |
f35a636343be473a1ec8a6b606d2cbbf1b4868f5 | JavaScript | Yangtaitai/LC | /Relative Ranks.js | UTF-8 | 1,391 | 3.515625 | 4 | [] | no_license | // Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".
// Example 1:
// Input: [5, 4, 3, 2, 1]
// Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"]
// Explanation: The first t... | true |
4511b95c56162603c7d3f31e0dfcb34cb6bf6eb1 | JavaScript | vixplows/weekend_router | /client/src/entry.js | UTF-8 | 6,150 | 2.59375 | 3 | [] | no_license | var AutoCompleteDirectionsHandler = require('./autoCompleteDirectionsHandler.js');
var makeRequest = require('./request.js')
var PopulateRoutesList = require('./populateRoutesList.js');
var requestComplete = function () {
if(this.status !== 200) return;
var routesString = this.responseText;
var routes = JSON.par... | true |
21595003af8e267d1fa53d3e8a66ece0ced36cf5 | JavaScript | polsieira/turing-cafe-ui | /src/apiCalls.js | UTF-8 | 640 | 2.515625 | 3 | [] | no_license |
export const getReservations = (url) => {
return fetch(url)
.then(res => res.json())
}
export const postReservation = (url, newReservation) => {
const options = {
method: 'POST',
body: JSON.stringify(newReservation),
headers: {
'Content-Type': 'application/json'
}
};
return fetch(ur... | true |
f13157a46392ff89d774a8d8ac163e3bc354216d | JavaScript | raylu/sucrase | /website/src/Constants.js | UTF-8 | 1,083 | 2.5625 | 3 | [
"MIT"
] | permissive | export const INITIAL_CODE = `\
// Try typing or pasting some code into the left editor!
import React, { Component } from "react";
type Reducer<T, U> = (u: U, t: T) => U;
function reduce<T, U>(arr: Array<T>, reducer: Reducer<T, U>, base: U): U {
let acc = base;
for (const value of arr) {
acc = reducer(acc, val... | true |
b559f2329918de2f05a5ba154ebb94fbb03df5ef | JavaScript | SurajSS007/SyookTask | /jsalgo/q3.js | UTF-8 | 2,254 | 3.96875 | 4 | [] | no_license | // 3. John and Mary want to travel between a few towns A, B, C ... Mary has on a sheet of paper a list
// of distances between these towns.
// ls = [50, 55, 57, 58, 60]. John is
// tired of driving and he says to Mary that he doesn't want to drive more than t = 174 miles and he will visit
// only 3 towns.
//... | true |
12355d1a865e9685cb8635d13d48c97bd4cff365 | JavaScript | bronk3/KariBronsonDotCom | /assets/js/main.js | UTF-8 | 172 | 2.796875 | 3 | [] | no_license | ['resize', 'load'].forEach(type => {
window.addEventListener(type, ()=> {
let vh = window.innerHeight;
document.body.style.height = `${vh}px`;
});
}); | true |
610f514cdb489a30f6f75d202a499d364f81a947 | JavaScript | fredrickneo20/frontendmentor-pricing-component-with-toggle | /9 - Pricing component with toggle/assets/script.js | UTF-8 | 619 | 3.5625 | 4 | [] | no_license | let circle = document.getElementById('circle-1');
let price = document.getElementsByClassName('price');
const newPrice = [19.99, 24.99, 39.99];
const regPrice = [199.99, 249.99, 399.99];
const movePeriod = () => {
circle.classList.toggle('circle-2');
if(price[0].textContent === '$199.99'){
for(... | true |
9f96f653edf8913d88d56635b5b2579e8459f5ae | JavaScript | MNINiro/JavaScript | /Part-21-Nested For Loop/main.js | UTF-8 | 508 | 3.984375 | 4 | [] | no_license | //Ex-1
for(i=0; i<5; i++)
{
document.write("<strong> Outer loop </strong>")
document.write(i);
document.write("<br>");
for(j=0; j<3; j++)
{
document.write("Inner loop")
document.write(j);
document.write("<br>");
}
}
/*
//Ex-2; Alternate presentation
for(i=... | true |
d6b08fe5b352e1cf9540ab8473c1f26fb86d79f3 | JavaScript | YuraSidorets/login-extension | /source/options.js | UTF-8 | 2,609 | 2.6875 | 3 | [] | no_license | // Don't forget to import this wherever you use it
// import browser from 'webextension-polyfill';
var browser = require("webextension-polyfill");
function login(data) {
const executing = browser.tabs.executeScript({
code: `(${ inContent })(${ JSON.stringify(data) })`
});
executing.then(() => browser.runtime.la... | true |
4164e18b5c16a049dcdf9321819d8084f3149fd7 | JavaScript | kchapelier/ludumdare31 | /src/game/components/playerInput.js | UTF-8 | 1,303 | 2.65625 | 3 | [
"MIT"
] | permissive | var input = require('../input');
module.exports = {
focused : false,
normalSpeed : 290,
focusedSpeed : 170,
lastShot : 0,
shotFrequency : 66,
shooting : false,
update : function(element, dt) {
var directionIntent = element.directionIntent;
if(input.currentInput.UP) {
... | true |
43955f29810e4095524f26852da4c613d474b9de | JavaScript | DawidBal/Audios | /src/modules/auth.js | UTF-8 | 1,877 | 2.734375 | 3 | [] | no_license | import userData from './userData';
const CLIENT_ID = 'ed39e72a37664a05a5784f53ba95d6a9';
const REDIRECT_URI = 'http://127.0.0.1:5500/dist/';
const ENDPOINT = 'https://accounts.spotify.com/authorize';
const stateKey = 'spotify_auth_state';
/**
* Obtains parameters from the hash of the URL
* @return Object
*/
funct... | true |
7a0c6c889ca8423dcffde0a87990fefd34f18422 | JavaScript | ShivamChhetri/A_Star | /aStar.js | UTF-8 | 4,975 | 3.234375 | 3 | [] | no_license | const cols=25;
const rows=25;
const wall=0.3;
const diagonal=true;
const ini={
x:0,
y:0
};
const fnl={
x:cols-1,
y:rows-1
};
const canvas= document.querySelector('canvas');
let c= canvas.getContext('2d');
// let W= window.innerWidth;
let H= window.innerHeight-50;
let W=H;
canvas.width=H;
canvas.heigh... | true |
a6c43277da74d74847be848a7ee981942a81c925 | JavaScript | ttshangxiang/three-study | /lesson4/main.js | UTF-8 | 5,014 | 3.03125 | 3 | [] | no_license | const renderer = new THREE.WebGLRenderer()
renderer.setSize(window.innerWidth, window.innerHeight)
document.body.appendChild(renderer.domElement)
const camera = new THREE.PerspectiveCamera(
45, window.innerWidth / window.innerHeight, 1, 1000
)
// 初始摄像机位置
camera.position.set(0, 10, 0)
// lookAt的向量
const vector = new... | true |
070e5c47f6b32f13581772537b6d7c02da5c7565 | JavaScript | Ulteric-js/LXBot | /commands/info.js | UTF-8 | 8,404 | 2.796875 | 3 | [] | no_license | const Discord = require('discord.js')
const memory = require("memory")
function msToTime(s) {
function pad(n, z) {
z = z || 2;
return ('00' + n).slice(-z);
}
var ms = s % 1000;
s = (s - ms) / 1000;
var secs = s % 60;
s = (s - secs) / 60;
var mins = s % 60;
var hrs = (s - mins... | true |
039e6a33b0574b7948e9f3d4adc059cb4c48a2b0 | JavaScript | DaphneRui/react | /react-login/src/Feature/Vcode2/Vcode2.js | UTF-8 | 1,828 | 2.9375 | 3 | [] | no_license | import React, { useState,useEffect,useRef } from 'react';
import './vcode2.css';
export default function Vcode2 () {
const [ code, setCode ] = useState('');
const inputRef = useRef();
useEffect(()=>{
inputRef.current.focus();
},[]);
function handleDel (e){
if( e.keyCode === 8 ){
d... | true |
fae4f523bd97258097f17fea965d86d390c67ca4 | JavaScript | WhiteLie1/code_back | /frontEnd/2019react_test3/history/6.comment.js | UTF-8 | 920 | 3.046875 | 3 | [] | no_license | import React from 'react';
import ReactDOM,{render} from 'react-dom';
/* let Message = ({msg,id}) =>{
return <h1>{msg}</h1>
}
render(
<Message msg="Hello" id="5" style={{color:'red'}} hobby={['a','b','c']}><Message/>,window.app
); */
/**
*组件的两种定义方式以及他们之间的区别
* 1.组件定义的第一种方法是函数,参数是属性... | true |
17dc763d304945ad81a26e1f8beaa8c8a6e4d95a | JavaScript | angryjenkins/coding-classwork | /day16_Feb29/day16.01_animals/solutions/-.js | UTF-8 | 595 | 2.890625 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title> ex 1</title>
<style>
ul{
list-style-type: none;
}
</style>
<body>
<ul></ul>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script>
var animals = ['turkey', 'chicken','tuna','cow'];
for(i=0;i<animals.length; i++){
console.log(animals[i]);
$('ul').append("<li... | true |
d6c54087eb9b99e77a1ae0c425d64f58fcbf84a6 | JavaScript | IliaIliev94/SoftUni-Work | /JS-Applications/Test/Tests/calculator-multiply.test.js | UTF-8 | 307 | 2.65625 | 3 | [] | no_license | const expect = require('chai').expect;
const calculator = require('../calculator');
describe('Calc Multiply', function () {
it('Should return positive number when multiplying two positive numbers', () => {
let result = calculator.multiply(2, 5);
expect(result).to.equal(10);
});
}); | true |
60f44dac4f58e890d1aa8cea18d47886c9d3be7b | JavaScript | CedricSama/Js | /javascript-next/ClassObject/ClassObj.js | UTF-8 | 2,762 | 3.609375 | 4 | [] | no_license | /**
* Created by stagiaire on 21/08/2017.
*/
//ES5
//DECLARATION ET CONSTRUCTEUR CLASS
function NOMDELACLASS() {
}
NOMDELACLASS.prototype.nomDeLaPropriete = "valeur";
NOMDELACLASS.prototype.methode = function () {
this.nom = "NOMDELACLASS";
}
var Test = new NOMDELACLASS();
console.log(Test, typeof Test);
funct... | true |
97449868e73afda9b9f17b39d2dd14df53e44dd6 | JavaScript | wu241617/JS | /Event/10_其他常见事件/4_窗口事件/throttle.js | UTF-8 | 927 | 3.75 | 4 | [] | no_license | //节流throttle代码:
function throttle(fn,delay) {
let canRun = true; // 通过闭包保存一个标记;当前没有延迟调用函数未执行
return function () {
// 在函数开头判断标记是否为true,不为true(当前有延迟调用函数未执行)则return
if (!canRun) return;
// 立即设置为false
canRun = false;
// 将外部传入的函数的执行放在setTimeout中
setTimeout(() => {
... | true |
e8045e0c15ca8272bf5d014dad6cd34580fee96f | JavaScript | gagarin880120/js-assignments | /task/13-more-tasks.js | UTF-8 | 4,146 | 4.09375 | 4 | [
"MIT"
] | permissive | /**
* Takes two strings including only letters from a to z.
* Returns a new sorted string containing distinct letters.
*
* @param {string} value1
* @param {string} value2
* @return {string}
*
* @example
* 'azy', 'bk' => 'abkyz'
* 'zxxlal','laxk' => 'aklxz'
* 'abcdefghijklmnop', 'lmnopqrstuvwxyz' =... | true |
9b32e74886822c9d8e2319955547a3a48366c0ce | JavaScript | xevenheaven/anyone-can-automate | /viewTestItBuilder.js | UTF-8 | 1,170 | 2.828125 | 3 | [] | no_license | //var input = `
//{
// "actions": [
// {
// "class": ".addButton",
// "action": "click"
// },
// {
// "class": ".header",
// "expected": {
// "compare": "text",
// "value": "My Header"
// }
// }, {
// "class": ".closeButton",
// "action": "click"
// },
// {
// "class": ".closeButton",
// ... | true |
7160818de039d78133decb2d8fa595e71cb517ab | JavaScript | MattWongCode4U/NewVi-Project | /Version 3.0.1/JavaScript/ObservationPanel.js | UTF-8 | 1,602 | 3.15625 | 3 | [] | no_license | /**
* draw the observation panel and add its action listener
* @param {slideNumber} the number of slide
* @param {boxOne} information for the answer display
* @param {lifePoint} life point remained
* @param {score} player's current score
*/
function drawObservationPanel(slideNumber, a... | true |
6595d3859469ecb4060473c647b8299a4d895afd | JavaScript | rkgallaway/ta-work | /401n12/Connor/401-code-challenges/stack_and_queue/queue.js | UTF-8 | 656 | 3.046875 | 3 | [
"MIT"
] | permissive | 'use-strict';
const node = require('./node.js');
class Queue{
constructor(){
this.front=null;
this.rear=null;
}
enque(value){
let newNode = node.createNode(value);
if (!this.front){
this.front = newNode;
this.rear = newNode;
}else{
... | true |
c24499af8ac3d0b313b2dc9472d6e54f2c0f35b2 | JavaScript | madhatpoet/tax-brackets | /js/brackets.js | UTF-8 | 3,145 | 3.28125 | 3 | [] | no_license | //Set default values
var starting_income = 40000;
var min_income = 0;
var max_income = 10**12 //1 Trillion Dollars
var max_slider_value = 750000
var breaks = [0,9525,38700,82500,157500,200000,500000];
var rates = [10,12,22,24,32,35,37];
//Initial Setup
updateRatesTable();
setUpRates();
$("#income").val(starting_income... | true |
574a8f1c9cfb9c84bd579a0bab1e6702f4af5afa | JavaScript | Aryangupta789/JS_Drill3_Objects | /values.js | UTF-8 | 263 | 3.046875 | 3 | [] | no_license | // Return all of the values of the object's own properties.
// Ignore functions
// http://underscorejs.org/#values
function values(obj) {
const arr=[];
for (key in obj){
arr.push(obj[key])
}
return arr
}
module.exports=values | true |
41cc3b81ff03f20eb8dc0e0fa2152bd17b214ebf | JavaScript | Nedmon/StringDataExtraction | /stringExtraction.js | UTF-8 | 5,064 | 3.703125 | 4 | [] | no_license | // Global Varibles
let alphaString = `abcdefghijklmnopqrstuvwxyz`;
let alphaUpper = `abcdefghijklmnopqrstuvwxyz`.toUpperCase();
let alphaArray = alphaString.split(``);
let alphaArrayUpper = alphaUpper.split(``);
alphaArray.unshift(undefined) // array, indexes of which corrospond to letters in the alphabet
alphaArra... | true |
66f91b2bec6035c889db846b69d1d9370b562476 | JavaScript | Fmakgoka/mymatchar | /model/database.js | UTF-8 | 483 | 2.765625 | 3 | [] | no_license | //node.js use this module to manipulate the mySQL database
var mysql = require('mysql');
//connect to the database
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "000000"
});
con.connect(function(err){
if(err) throw err;
console.log("connect!");
//create a database named "mynode... | true |
0789dd0b3b90a04524d42394006b190467fd4a4c | JavaScript | Drarig29/Hyblab2021 | /proximite-a/src/api/adresstocoordinates.js | UTF-8 | 1,115 | 3.015625 | 3 | [
"MIT"
] | permissive | 'use strict'
const request = require('./request');
let addresstocoordinates = async function(adresse){
let adresse2 = adresse.replace(/\s/g, '+');
const url = `http://api-adresse.data.gouv.fr/search/?q=${adresse2}`;
let response =await request.request(url);
let data = await response.json();
let co... | true |
98a5a53d5072de810df2bad96812bb976b25e93d | JavaScript | abhishek-koluguri/projects | /Internet_Computing/IC_examples_of_concepts/071415/7_reading_a_file/sample.js | UTF-8 | 332 | 2.703125 | 3 | [] | no_license | var fs = require('fs');
var displayFileContent = function(error, data) {
if(error) {
console.log("oops, sorry");
console.log(error);
} else {
console.log("Read the file!");
console.log(data);
}
}
fs.readFile('/etc/hosts', 'utf8', displayFileContent);
fs.readFile('/etc/hots', 'utf8', displayF... | true |
de7ae597585d0c33fd365ed1c5ffefe1451f9998 | JavaScript | ShamanthaReddy12/Insurance-Demo- | /Main.js | UTF-8 | 496 | 2.71875 | 3 | [] | no_license |
var accordions= document.getElementsByClassName("accordion");
for( var i=0; i < accordions.length; i++)
{
accordions[i].onclick = function() {
this.classList.toggle('is-open');
var content=this.nextElementSibling;
if(content.style.maxHeight)
{
... | true |
8ac6c9396833e47aa6ca3bcdfdc7dd1abd4aa9bb | JavaScript | ybenbrai/matcha | /client/src/policies/auth.js | UTF-8 | 1,929 | 2.578125 | 3 | [] | no_license | import decode from 'jwt-decode'
import axios from 'axios'
import { getUser } from '@/utils/utils'
const AUTH_TOKEN_KEY = 'secret'
const LOCATION = "location"
export function logoutUser() {
deleteLocation()
clearAuthToken()
}
export function setLocation(flag) {
localStorage.setItem(LOCATION, flag)
}
ex... | true |
eb0385ce27341f53a162369448e12e46a31625b6 | JavaScript | hanlutu/cakecase | /js/register.js | UTF-8 | 5,487 | 3.046875 | 3 | [] | no_license | // var registerBtn = document.getElementById("registerBtn");
// var usernameInput = document.getElementById("username");
// var username_span = document.getElementById("username_span");
// var promptText = document.getElementById("prompt-text");
// var userpwdInput1 = document.getElementById("userpwd1");
// var ... | true |
62820e973c4618b904827927a11f02d227c8c866 | JavaScript | chinomnsoawazie/hogwarts-dumbo-web-091619 | /src/components/App.js | UTF-8 | 1,543 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react';
import '../App.css';
import Nav from './Nav'
import hogs from '../porkers_data';
import HogList from './HogList'
import FilterComponent from './FilterComponent'
class App extends Component {
constructor(props) {
super(props)
this.state = {
filtered: false,
... | true |
c8716a65066e4ecc2fe8ff86fb0d72ae896b3465 | JavaScript | christ-off/feed2twitter | /src/domain/get-author-twitter-handle.js | UTF-8 | 960 | 2.71875 | 3 | [] | no_license | "use strict";
const aws = require("../providers/aws");
/**
* Return the twitter handle from DynamoDB
* @param authorname
* @return string
*/
exports.getAuthorTwitterHandle = async authorname => {
var params = {
KeyConditionExpression: "Author = :v1",
ExpressionAttributeValues: {
":v1": { S: author... | true |
577c897a7b3c680b57078cf2c6c3605d88372b25 | JavaScript | KrissAnime/Matcha | /public/js/profiles.js | UTF-8 | 849 | 2.71875 | 3 | [] | no_license | var socket = io.connect('http://localhost:3000/');
// Get the image and insert it inside the modal - use its "alt" text as a caption
var modalImg = document.getElementById("modal_image");
var modal = document.getElementById('myModal');
var new_notifcations = document.getElementById('new_notifications');
function blow... | true |
8e76dfa53b4ddddfda3faaf00bf97e0ff4bdc612 | JavaScript | jlebron143/JSproblems | /diceGameDraft.js | UTF-8 | 703 | 2.9375 | 3 | [] | no_license | //The objective of the "Dice 100" game is to come as close to a score of 100 as possible, without passing 100.
//In this game , 6 dice are 'rolled' by the player and 6 dice are 'rolled' by the Player 2 (simulated by the Btn click).
// Add up both rolls.
// player needs to navigate to game
//player needs to know w... | true |
93d0d0cf2d5b4e57da25d814eebaeb1c1d626951 | JavaScript | CodingMeUp/redux-chat | /test/server/reducer_spec.js | UTF-8 | 1,391 | 2.59375 | 3 | [] | no_license | import {expect} from "chai";
import {v1} from "uuid";
import {fromJS,Map,List} from "immutable";
import coreReducer from '../../src/server/reducer';
import {addRoom,removeRoom} from '../../src/server/actionCreator.js';
describe("server端reducer",()=>{
//类似array = [1,2,3,4,5]; array.reduce
it('可以当做一个reducer', ... | true |
4a7400518294d0c61fd7c49dcf964f5196efe3d4 | JavaScript | krsmayg/Arian-Project | /public/js/promisesEx.js | UTF-8 | 491 | 3.171875 | 3 | [] | no_license | /* eslint-disable */
const getIDs = new Promise((resolve, reject) => {
setTimeout(()=> {
const recipeId = [434,545,655,767];
resolve(recipeId);
},1500)
});
const getRecipe = recID =>{
return new Promise((resolve,reject) => {
setTimeout((id) => {
const recipe = {title: 'Tomato booom', pub... | true |
8ccb7368819d591d41ad3f7a447000adc7cbe849 | JavaScript | ysumit99/Chess | /scripts/board.js | UTF-8 | 3,634 | 3.34375 | 3 | [] | no_license | /* Reset Board */
let resetBoard = () => {
/* White Pieces */
//Pawns
for (let rank = 0; rank < 8; rank++)
board[1][rank] = "WP";
//Rooks
board[0][0] = "WR";
board[0][7] = "WR";
//Knights
board[0][1] = "WN";
board[0][6] = "WN";
//Bishops
board[0][2] = "WB";
... | true |
55d160d61565ad7285b3b2f94c98675fda932295 | JavaScript | userlifex/beginner-js-ravn | /async/rules.js | UTF-8 | 361 | 3.171875 | 3 | [] | no_license | function printHello() {
console.log('hello world');
}
function stopForN(sec = 1) {
const today = new Date();
let remain = today;
console.log('...')
for (;;) {
const current = new Date().getTime();
if (current - today > (1000 * sec)) break;
remain = current
}
console.log(today)
}
setTimeout(pr... | true |
ac37224de83f85c81629844b799b3d28769b8e52 | JavaScript | ranjingqiao/mgMusicGame | /miguwozuiniu/js/gongnengjs/gongnengout.js | UTF-8 | 2,430 | 2.875 | 3 | [] | no_license | /*$(function(){
var action = {
//{"idName":"show or hide"}
actionGo:function(obj){
var _this = this
$.each(obj,function(idName,action){
var elenments = $("#"+idName)
action == "show" ? _this.actionShow(elenments) : _this.actionHide(elenments)
})
},
//show动画
actionShow:function(obj){
... | true |
59c0fc7eae51f94e5d0ed21dac07e3e87a903b09 | JavaScript | minnuss/NotificationPopUp | /main.js | UTF-8 | 327 | 2.578125 | 3 | [] | no_license | const popUpBox = document.querySelector('.pop-up-box');
const close = document.querySelector('.close-box');
const deleteBtn = document.querySelector('.delete');
deleteBtn.addEventListener('click', () => {
popUpBox.classList.add('show');
})
close.addEventListener('click', () => {
popUpBox.classList.remove('sho... | true |
606e0a4d5638230cc7f51b01041411ce42d85c56 | JavaScript | Jekahome/Node_Example | /example/example/websocket/app.js | UTF-8 | 556 | 2.5625 | 3 | [] | no_license | import express from 'express';
const port = 3005;
// создаём Express-приложение
let app = express();
app.use(express.static('websocket/client'));// расшарить папку с index.html
// создаём маршрут для главной страницы
app.get('/page', function(req, res) {
res.sendFile('index.html');
});
// запускаем сервер на п... | true |
b76fa6885fd164c84823f2e66dcc7c4a11ab9de5 | JavaScript | taejin5314/interactive-coding | /drawing_tree/script.js | UTF-8 | 3,431 | 3.421875 | 3 | [] | no_license | function initializeCanvas(canvasName) {
const canvas = document.getElementById(canvasName);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
return canvas;
}
const grassCanvas = initializeCanvas('canvas1');
const grassCtx = grassCanvas.getContext('2d');
const treeCanvas = initializ... | true |
53669faceb73abd7ac617b6f92136503340b8a13 | JavaScript | ghadirs/crypto-website | /controllers/userController.js | UTF-8 | 8,524 | 2.5625 | 3 | [] | no_license | var User = require('../models/user');
var Article = require('../models/article');
var async = require('async');
const { body,validationResult } = require('express-validator');
const { find, populate } = require('../models/article');
const user = require('../models/user');
// Display list of all Users.
exports.user_l... | true |
d3e93c760ccd2a2b662b64e77a5aa5fe84e08e71 | JavaScript | phieupro99/demo | /src/main/webapp/javascript/cart.js | UTF-8 | 2,191 | 2.875 | 3 | [
"MIT"
] | permissive | getData();
function getData(){
$.ajax({
method: "GET",
url: "cart/get"
}).done(function( object ) {
var data= JSON.parse(object);
for(var i =0; i<data.length;i++){
var prodData = data[i];
var dataProductHtml = "<div class='item' >"+
"<div class='buttons'> <a href = 'cart/removeCart?product=... | true |
0a470a06669e7d0e47e8a4c1a9258c7661f28bb3 | JavaScript | jratana1/my-app2 | /src/test.js | UTF-8 | 678 | 2.9375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
function counter() {
const [counter, setCounter] = useState(0)
const addClick = () => {
setCounter(counter+1)
}
const minusClick = () => {
setCounter(counter-1)
}
const reset = () => {
setCounter(0)
}
useEffect(
() => {
let timer = setInter... | true |
5d86127f39db2a24d3988a519fad074a43ed8e5b | JavaScript | Alikhan247/Movie-front | /js/store.js | UTF-8 | 1,764 | 2.546875 | 3 | [] | no_license | $.ajax({
method: "GET",
url: 'http://localhost:8762/movie/list',
beforeSend: function(request) {
request.setRequestHeader("Authorization", localStorage.getItem("token"));
},
}).done(function(data){//anonymus function, async task
// data = JSON.parse(data.toString());
console.log(data)
showMovies(... | true |
c932b42f23aaa25470220c2e00ec2a31901b9b56 | JavaScript | sebastianseilund/latency-test | /client.js | UTF-8 | 2,451 | 2.859375 | 3 | [] | no_license | var http = require('http'),
async = require('async');
var servers = [
'ec2-23-22-37-17.compute-1.amazonaws.com',
'ec2-54-215-89-128.us-west-1.compute.amazonaws.com',
'ec2-54-216-71-82.eu-west-1.compute.amazonaws.com',
'ec2-54-250-0-81.ap-northeast-1.compute.amazonaws.com'
];
var requestCount = 100... | true |
63ac228f0c1d6fc09d03c3cb7c2bdbc3f15e05bf | JavaScript | WellingtonWDS/ProgramacaoParaAmbientesMoveis | /script.js | UTF-8 | 583 | 2.75 | 3 | [] | no_license | function loadMovies() {
var saida = '';
var movie = [];
$.getJSON("index.json", function(data) {
movie = data.movie;
for (i = 0; i < movie.length; i++) {
saida += movie[i].title;
/*
saida += '<div class="row">';
saida += '<div class="col-lg-4 it... | true |
cfe9069c04967b0dc7086dc611034b6f222126dd | JavaScript | panther-it/crm.produtch.nl | /classes/grid/data.js | UTF-8 | 3,146 | 2.6875 | 3 | [] | no_license | // Constructor
function GridData(params)
{
this.sortField = null;
this.sortOrder = 1;
this.parent = params.parent;
this.rows = [];
this.row = document.createElement("tr");
this.row.className = "data normal even ";
}
// Functions
with (GridData)
{
// Description: builds the grid data-r... | true |
07e4f07c6dc963bede4b87857bcd92b220cc8fe5 | JavaScript | Arkadipta199/Train-App | /train-app/src/components/home/home.js | UTF-8 | 9,638 | 2.640625 | 3 | [] | no_license | import React, { Component } from "react";
import {Link} from 'react-router-dom';
class Home extends Component {
constructor(props) {
super(props);
this.state = {
accessToken: '',
is_loading: true,
error : null,
train_routes : [],
source : ... | true |
cf107a7406d3e09a70dd9f4c9d5d0115cfd12b1e | JavaScript | Yogsther/xmas-fighter | /js/main.js | UTF-8 | 10,541 | 2.65625 | 3 | [] | no_license | /**
* main.js for XMAS-FIGHTERS
*/
var LOG_KEYS = false;
var HIDE_PLAYERS = false;
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
ctx.imageSmoothingEnabled = false;
const l = console.log;
var game;
var frames = 0;
var selectedStage = -1;
selectStage(true);
var keysDown = ne... | true |
542c6fce6db6b5f848ca422ba03a77c4eabdb50b | JavaScript | xaamin/react-training | /src/open-closed-principle/services/storage-engines/LocalStorageEngine.js | UTF-8 | 734 | 2.6875 | 3 | [] | no_license | // @flow
import { StorageEngineInterface } from './StorageEngineInterface'
class localStorageEngine implements StorageEngineInterface {
get(index: string) : mixed {
return localStorage.getItem(index)
}
all(): Object {
let all = {};
const keys = Object.keys(localStorage);
... | true |
3f3ed4a11a88a121c5c62d31194612ec8dfe1425 | JavaScript | CedomirBrisic/bit-pp | /functions3/Excercise05.js | UTF-8 | 335 | 3.515625 | 4 | [] | no_license | "use strict";
var array = [7, 9, 0, -2];
function lastElements(n) {
var resultArray = [];
var x = array.length - 1;
var counter = n - 1;
for (var i = 0; i < n; i++) {
resultArray[counter] = array[x];
x--;
counter--;
} return resultArray;
}
console.log(la... | true |
bc986a5941d6c73cbfb38574a4bebadfdd876d05 | JavaScript | openlabroma/modulex | /Modules.js | UTF-8 | 4,287 | 2.765625 | 3 | [] | no_license | function Modules(assets) {
var level = assets.getData('level.json');
function readArrays(mesh, materialIndex) {
var count = 0;
var vertices = [];
var normals = [];
var uvs = [];
function pushVertex(array, index) {
array.push(
mesh.vertices[index * 3],
mesh.vertices[index * 3 + 1],
mesh.vert... | true |