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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
df49ed8567117d1ca543a2c65133480663937973 | JavaScript | twalker/wax | /wax.js | UTF-8 | 1,868 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* wax - worker and xhr
* An asynchronous web worker using xhr synchronously.
*
* Currently supported content types:
* json
* text
*
*/
var mimeMap = {
//form: 'application/x-www-form-urlencoded; charset=utf-8', // xhr default
//form: 'multipart/form-data; charset=utf-8'
json: 'application/json',
tex... | true |
811bd55c5c51a818c011d53763b6d74f2bbe4285 | JavaScript | hurtlethefrog/code-challenge | /17.js | UTF-8 | 223 | 2.75 | 3 | [] | no_license | const judgeVegetable = (vegetables, metric) => {
let num = 0
let winner = ''
for (let ele of vegetables) {
if (ele[metric] > num) {
num = ele[metric]
winner = ele.submitter
}
}
return winner
}
| true |
74c0c8685ef51243aa05e9fb79a2c2b5e1cc6423 | JavaScript | LoganYFinley/Rock_Paper_Scissors | /old-rock-paper-scissors.js | UTF-8 | 2,325 | 4.15625 | 4 | [] | no_license | // tic-tac-toe game to be played in browser console
// this file gets imported into to html file
// gets a random move for the computer player
function computerPlay() {
var arr = ["rock", "paper", "scissors"];
var el = arr[Math.floor(Math.random() * arr.length)]
return el
}
// assigns the computers move
/... | true |
b6036b2cbc6bf9dc454cdf809687246a13ab062a | JavaScript | murphym18/Grader | /testing/test-assignments.js | UTF-8 | 2,368 | 3.28125 | 3 | [
"MIT"
] | permissive | //var course = new Course(/*...*/)
//
///* Empty the categories collection */
//course.categories.reset();
//
///* Check that there are no category models in the categories collection */
//course.categories.models.length === 0;
//
///* Add a new category */
//course.categories.push({
// "name": "Exams",
// "path"... | true |
7b751e463f6b0a5a204b00e0ad0478f2f5f8bf70 | JavaScript | hectorhuertas/ideabox | /app/assets/javascripts/XRender.js.es6 | UTF-8 | 561 | 2.59375 | 3 | [] | no_license | var XRender = (function(){
var tags = function(tags){
var elements = tags.map(ElementFor.tag)
$('#tag-list').empty().append(elements)
}
var ideas = function(ideas){
var elements = ideas.map(ElementFor.idea)
$('#idea-box').empty().append(elements)
}
var idea = function(idea){
$('li[data-i... | true |
26781ef85099931990fda2e98f6d3d3e4e0abc82 | JavaScript | MatheusParanhos/30-seconds-of-code | /test/httpGet/httpGet.js | UTF-8 | 276 | 2.625 | 3 | [
"CC0-1.0"
] | permissive | const httpGet = (url, callback, err = console.error) => {
const request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = () => callback(request.responseText);
request.onerror = () => err(request);
request.send();
};
module.exports = httpGet;
| true |
7c12387fb8546a5fbf9dc9b0d73d9cd7daf782cc | JavaScript | jsculsp/js_games | /flappy_bird/game/base_animation.js | UTF-8 | 1,510 | 2.96875 | 3 | [] | no_license | /**
* Created by linmu on 2017/8/30.
*/
class BaseAnimation {
constructor(game, name, picNum) {
this.game = game
this.animationName = name
this.picNum = picNum
this.setup()
}
static new(...args) {
return new this(...args)
}
setup() {
this.animatio... | true |
e9aecd47fd24f348715e80c3d3814f871148c5b3 | JavaScript | tb-44/my_react_map | /client/utils/favAddressInLocalStorage.js | UTF-8 | 203 | 2.53125 | 3 | [] | no_license | export default function favAddressInLocalStorage() {
let favArr = [];
if(localStorage.favArr) {
favArr = JSON.parse(localStorage.favArr);
}
else {
favArr = [];
}
return favArr;
}
| true |
57d35de21c51cc5b3c2520226040ac7550965718 | JavaScript | ChristopherDurand/Exercises | /javascript/functional/myinterrogator.js | UTF-8 | 758 | 4.09375 | 4 | [
"MIT"
] | permissive | function myOwnEvery(array, func) {
for (let i = 0; i < array.length; i++) {
if (!func(array[i])) return false;
}
return true;
}
function myOwnSome(array, func) {
array.forEach(element => {
if (func(element)) return true;
});
return false;
}
let isAString = value => typeof value === 'string';
con... | true |
c581e717e5dc8a439ccb84f5d04197a6b64be490 | JavaScript | lyricat/call-for-health | /utils/crypto-utils.js | UTF-8 | 1,238 | 2.546875 | 3 | [] | no_license | const crypto = require('crypto')
const config = require('../config.json')
function generateKeys(passphrase) {
const { privateKey, publicKey } = crypto.generateKeyPairSync("rsa", {
modulusLength: 2048,
publicKeyEncoding: {
type: "pkcs1",
format: "pem"
},
privateKeyEncoding: {
type: "... | true |
5486f70785a8fdb4965aaf8d8ec18dc1852f7bf0 | JavaScript | vinay165/ReactHooks_Sample | /src/shared/hooks/common-hooks.js | UTF-8 | 2,096 | 2.984375 | 3 | [] | no_license | import {
useState,
useEffect,
useRef
} from 'react';
export const useDebounce = function (value, delay) {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(
() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, ... | true |
d9ab1dd0ab48acf01bc9d44c6a8ac8d10ffa6425 | JavaScript | aryatama/calculator-web | /src/App.js | UTF-8 | 2,964 | 3 | 3 | [] | no_license | import React, { useState } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import Navigation from "./components/Navigation";
import {
Container,
Row,
Col,
} from 'react-bootstrap';
import CalculatorDisplay from './components/CalculatorDisplay';
import CalculatorButton from './components/CalculatorBu... | true |
c54efcb3d80c6acf52adf8b4cda494e6b4f8d1a4 | JavaScript | sanctuarycomputer/alps | /lib/Screen.js | UTF-8 | 1,903 | 2.5625 | 3 | [] | no_license | "use strict";
const blessed = require('blessed');
module.exports = class Screen {
constructor(projects, Alps) {
this.Alps = Alps;
this.screen = blessed.screen({ smartCSR: true });
this.screen.key(['escape', 'q', 'C-c'], (ch, key) => {
this.Alps.killAll();
});
this.projectsBox = this.appendP... | true |
7aa74ee8d03c343a0b5f26e74c4346a45e45d8d3 | JavaScript | samelie/webgl-experiments | /moon-surface/src/camera-controls.js | UTF-8 | 2,263 | 2.75 | 3 | [] | no_license | import Detector from '@stinkdigital/Detector';
import Happens from 'happens';
const assign = require('assign-deep');
export default class CameraControls {
constructor(element, options) {
Happens(this);
this._rotationX = 0;
this._rotationY = 0;
this._offsetX = 0;
this._offsetY = 0;
this._width = window.... | true |
a3aaea7354f21b51f53c1ac0ddaa9f63bbbc6fa0 | JavaScript | pyuz/_____ | /script.js | UTF-8 | 1,284 | 3 | 3 | [] | no_license | 'use strict'
const fake = document.getElementById("fake");
const shittyCss = document.getElementById("shittyCss");
const secret = document.getElementById("secret");
const player = document.getElementById("player");
const episodes = document.querySelectorAll(".ep");
fake.addEventListener("click", () => {revealSecret(fak... | true |
ba856fa72775017435c63c720e79b39bb8094e95 | JavaScript | l3iodeez/Pagevault | /app/assets/javascripts/util/browser_compatibility.js | UTF-8 | 310 | 2.515625 | 3 | [] | no_license | (function(root) {
'use strict';
if (typeof Array.find === "undefined") {
Array.prototype.find = function (callback) {
var array = this.slice(0);
for (var i = 0; i < array.length; i++) {
if (callback(array[i])) {
return array[i];
}
}
};
}
}(this));
| true |
271a31d7643d38c265dff390a5af8342ae62d976 | JavaScript | earnubs/dials | /dials.js | UTF-8 | 1,306 | 3.109375 | 3 | [
"MIT"
] | permissive | var ctx = document.querySelector('canvas').getContext('2d'),
width = ctx.canvas.width,
height = ctx.canvas.height;
ctx.translate(width/2 + 0.5, height / 2 + 0.5);
ctx.fillRect(0,0,3,3);
var Dial = function(options) {
this.ctx = options.ctx;
this.width = options.width;
this.height = options.heigh... | true |
1296f328342acfd12a17985fd746205f37858951 | JavaScript | dashcord/dashcord | /lib/data.js | UTF-8 | 1,850 | 2.59375 | 3 | [
"MIT"
] | permissive | const {guildDb} = require('./database.js');
const Monad = require('./monad.js');
class Interface {
get(key) {
return Monad.maybe(null);
}
set(key, value) {
// NO-OP
}
commit() {
// NO-OP
}
isValid() {
return true;
}
destroy() {
// NO-OP
}
static get(bId, gId) {
... | true |
c6f61f63c5581560c7dcc6088c7f107e4ac025e0 | JavaScript | yufangangzi/nodepeixun | /path/drain.js | UTF-8 | 290 | 2.828125 | 3 | [] | no_license | var fs=require('fs');
var ws=fs.createWriteStream('./2.txt',{
highWaterMark:3//默认是16k
});
var index=0;
function w(){
var flag=true;
while(flag&&index<10){
flag=ws.write(''+index++)
}
}
w();
ws.on('drain',function(){
console.log('吃完了');
w()
});
| true |
9c1a5d659f4a893202e7800cfb6956ca5bfbf16e | JavaScript | Zenoleader/MOON-Bot | /MOON Github Version/Commands/ping.js | UTF-8 | 415 | 2.6875 | 3 | [] | no_license | const Discord = require('discord.js')
module.exports.run = async (bot, message, args) =>{
message.channel.send(`Pong!...`).then(msg =>{
msg.edit(`Pong! Latency is ${msg.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(bot.ping)}ms.`)
})
}
module.exports.help = {
... | true |
a29a4b564ef2377cd55c722d9f7aa3925e7a43ed | JavaScript | Temechon/block | /js/utils/Utils.js | UTF-8 | 3,382 | 3.328125 | 3 | [] | no_license | var Utils = {
/**
* Returns true if the block is on ground, false otherwise.
* If the block is moving, return true;
* The block is considered on ground if :
* <ul>
* <li>The block is standing and its position (x,z) is a tile</li>
* <li>The block is CROUCH_WIDTH and its positio... | true |
044cdd48bd869fff87940bc51c58619c20408c31 | JavaScript | dingqilong/white-list | /1/58checkbox.js | UTF-8 | 235 | 2.796875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause"
] | permissive |
$('.checkBoxClass').on('change',function(){
if($(this).is(':checked')){
$(this).next().addClass('checkBoxSelected');
}else{
$(this).next().removeClass('checkBoxSelected');
}
});
| true |
ad3b17c56064b0fa55fa7fbbaa344df691f96f5f | JavaScript | Sravyy/Ping-Pong | /js/script.js | UTF-8 | 592 | 3.0625 | 3 | [] | no_license | //Backend logic
function pingPong(userInput) {
for (var i = 1; i <= userInput; i++) {
if (i % 15 === 0) {
$('#list').append('<li>'+"Ping-Pong"+'</li>');
}
else if (i % 3 === 0) {
$('#list').append('<li>'+"Ping"+'</li>');
}
else if (i % 5 === 0) {
$('#list').append('<li>'+"Pong"+... | true |
b948b7275a8190c7392b107fcf1904d99d521592 | JavaScript | silvrwolfboy/pullp | /src/routes/Home/transformRepos.test.js | UTF-8 | 2,684 | 2.515625 | 3 | [
"MIT"
] | permissive | import transformRepos from './transformRepos';
import transformPullRequests from './transformPullRequests';
const testRepoPRs = [
{
pullpPullRequest: {
currentUserReviewRequested: false,
reviewedByCurrentUser: true,
newNotificationCount: 3,
},
},
{
pullpPullRequest: {
currentU... | true |
bb8a2ae8e76d3cf76bffbaf24def1225b85dae73 | JavaScript | KtKeaton/git_0701 | /js/0728/pwd_a2.js | UTF-8 | 1,138 | 3.875 | 4 | [] | no_license | const moreThanChars = (pw, n) => pw.lenth >= n //pw多於引數n
const containPassword = (pw) => pw.include("password") //pw內包括password
const containUppercase = (pw) => pw.toLowerCase() != pw //若pw轉為小寫後與原pw不同,代表有大寫
const containNumber = (pw) => pw.split('').some( (c) => !isNaN(c)) //分拆文字pw,檢查各字元c有無數字
const isValidPasswor... | true |
1790981c92c465469e032c1f632f57c5ee5cc537 | JavaScript | mhenr18/immy | /tests/Map/withKeySetToValue.js | UTF-8 | 2,093 | 2.8125 | 3 | [
"ISC"
] | permissive | var assert = require('assert');
var Immy = require('../../src/immy');
describe('Map', function () {
describe('#withKeySetToValue()', function () {
it('should return a new map with the key associated with the new value', function () {
var map = new Immy.Map(new Map([
['foo', 1],
... | true |
4bcb2615a3a0bc241ddeaa3e77d04892dd2327cc | JavaScript | IanSchwarzenberg/cpln692-week4 | /lab/lab2/js/part2-app-state.js | UTF-8 | 5,850 | 3.78125 | 4 | [] | no_license | /* =====================
Lab 2, part 2 - application state
Spatial applications aren't typically as simple as putting data on a map. In
addition, you'll usually need to change the stored data in response to user
input. This lab walks you through writing a set of functions that are capable
of building an inte... | true |
318bc441fad7c675bddfb0387e7dfc18e6b8e4d4 | JavaScript | cfritsch5/thevirtualbookshelf | /webapp_frontend/main/bookshelf/shelf/shelf_reducer.js | UTF-8 | 475 | 2.625 | 3 | [] | no_license | import {merge} from 'lodash';
const ShelfReducer = (state = {}, action) => {
let shelves = [[]];
switch (action.type) {
// case 'FILL_SHELF':
// return merge({}, action.books);
case 'RECEIVE_BOOKS':
Object.keys(action.books).map((id)=>{
shelves[0].push(id);
});
// console.lo... | true |
0dfaa3a46bb26e17c046507398f25bca9dc5fee4 | JavaScript | cvicentiu/Symbolic-and-statistical-learning | /SSL-Assignment-py/weps2007_data_1.1/training/web_pages/Karen_Peterson/raw/052/brcorrect.js | UTF-8 | 161 | 2.546875 | 3 | [] | no_license | var allPs = document.getElementsByTagName("p");
var trElm = document.getElementById("article");
trElm.innerHTML = trElm.innerHTML.replace (/br clear/gi, 'br'); | true |
eef8ad3cf95f03df8dbe873b2f2c021d36b38052 | JavaScript | wangwii/mypuppeteer | /features/step_definitions/todo.steps.js | UTF-8 | 639 | 3.15625 | 3 | [] | no_license | const Cucumber = require('cucumber');
const { Given, When, Then } = Cucumber;
Given("I have a todo {string}", function(todo) {
// this.setTodo(todo);
console.log('the todo: %s', todo);
return 'pending';
});
When("I write the todo in the input field", async function() {
// return await this.writeTodo();
retu... | true |
f25b74bb182d543575b3e483381635b5d2f8ecb9 | JavaScript | DaRaFF/jsTetrisGameJs | /js/Util/fps.js | UTF-8 | 740 | 2.765625 | 3 | [] | no_license | var gamejs = require('gamejs');
var screen = require('../Tetris/screen');
exports.FpsDisplay = function() {
// fps counter
var lastDurations = [];
var fpsFont = new gamejs.font.Font();
var fpsAvg = 60;
this.update = function(msDuration) {
// fps
lastDurations.push(msDuration);
... | true |
a8a59c6de64f971a1613114811232c4222ea46cd | JavaScript | vasanth-senthilkumar/test | /src/pages/createUsers.js | UTF-8 | 5,909 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import {connect} from 'react-redux';
import {addUser} from '../actions/createUsers';
class CreateUsers extends Component {
constructor() {
super();
this.state = {
newUser: {
name: '',
groups: []
}
}
... | true |
9cfaf741261d756f2947e94fdccba14124c981b2 | JavaScript | tang0614/socialAppFrontend | /src/store/helpers.js | UTF-8 | 1,324 | 2.546875 | 3 | [] | no_license | import jwtDecode from "jwt-decode";
import http from "./httpService";
export const setAuthorizationHeader = (token) => {
localStorage.setItem("IdToken", token);
localStorage.setItem(
"expirationDate",
new Date(new Date().getTime() + 1000000000)
);
http.setJwt(token);
};
export const removeAuthoriz... | true |
7d5c76d61d4bc3cfea7d34abb0c802a1e7515361 | JavaScript | PatrikValkovic/csfd-api | /test/parsers/filmTypes.js | UTF-8 | 1,065 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* Created by Patrik Valkovic
* 8/5/17.
*/
'use strict'
const fs = require('fs')
const assert = require('assert')
const chai = require('chai')
chai.use(require('chai-subset'))
const filmParser = require('../../lib/parsers').film
describe('Parsing of empty type for films', function () {
it('Type of Pirates ... | true |
e5a9283f940fc3c09de306dd9d41c00a0d93c22c | JavaScript | chashkaalex/AeternaGame | /js/render.js | UTF-8 | 5,025 | 2.9375 | 3 | [] | no_license |
const renderSelectedCounty = () => {
// clearing the table
selCountyTable.innerHTML = "";
if(gameState.selectedCounty) {
// Highlight selected county
countyElems.forEach((elem) => {
elem.classList.remove('selected');
})
const selectedCountyId = gameState.selectedCounty.id;
const selCountyEle... | true |
769e223b78dec9a965be5d160a01b2b0aafcfca2 | JavaScript | srinagp1ajrgroup/teamr | /controller/redisHandler.js | UTF-8 | 532 | 2.5625 | 3 | [] | no_license | function redisCli( redis){
this.set = function (name, value){
redis.set(name,JSON.stringify(value),function(err,doc){
console.log('err:'+err+'\n set:'+doc);
});
}
this.get = function (name, callback){
redis.get(name,function (err,data){
if(err || data == null){
console.log('err or no record found :: ... | true |
a5099ddec74211a91d06c0293aa73481a5e93e58 | JavaScript | xuanxia/react-zmage | /src/components/Portals/index.js | UTF-8 | 990 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* 客制的 Portal 组件
* 直接将子元素插入到 body 末端
**/
// React Libs
import React from 'react'
import ReactDOM from 'react-dom'
import {defProp, defType} from "../../config/default";
export default class Portals extends React.Component {
constructor(props) {
super(props);
this.target = props.target || do... | true |
7a97f2a8808e69bd5719f9d335a92b26a0e56427 | JavaScript | 869288142/leetcode | /array/珠玑妙算.js | UTF-8 | 1,126 | 3.984375 | 4 | [] | no_license | /**
* @param {string} solution
* @param {string} guess
* @return {number[]}
*/
var masterMind = function(solution = "RGYG", guess = "RYGG") {
let realGuess = 0;
let fakeGuess = 0
let solutionArr = [...solution]
let unMatchArr = []
for(let i = 0; i < guess.length; i++){
if(solutionArr[i]... | true |
09f2f24f69bb8a864964170485b8b04aa8af3119 | JavaScript | Lydster/instaClone | /src/components/commentSection/commentForm.js | UTF-8 | 669 | 2.578125 | 3 | [] | no_license | import React from 'react';
class CommentForm extends React.Component {
constructor(props) {
super(props);
this.state = {
comment: ''
};
}
handleChanges = e => {
this.setState({ [e.target.name]: e.target.value });
};
submitComment = e => {
this.setState({ comment: '' });
this.p... | true |
cf44993d604fa90dc4dfc369467120d8c4d82eb2 | JavaScript | ChristianCruzArango/mapas-Laravel | /public/js/map/mapclient.js | UTF-8 | 1,013 | 2.890625 | 3 | [] | no_license |
var latitud = document.getElementsByName("latitud[]");
var longitud = document.getElementsByName("longitud[]");
var data = [];
for (var i = 0; i <latitud.length; i++) {
var lat=latitud[i];
var long=longitud[i];
data.push({ id:i, cord:[] });
data[data.length-1].cord.push( {id: i, lat: lat.value, lon... | true |
3d22645129515c88e69dc1c34ac0955fc7e4d481 | JavaScript | yyrdl/react-tie | /lib/tree.js | UTF-8 | 3,239 | 2.53125 | 3 | [] | no_license | import { clone, chain, isEmptyObject, nullOrUndefined } from "./util";
import { updateView } from "./proxy";
import { getBinder } from "./tie_util";
const TIE_TREE = {};
const METHOD_TREE = {};
const REACT_ELEMENTS = {};
/**
* @param {String} dataName
* @param {String} eleId
* @return {Null}
* @api private
* **/... | true |
f76c7df4330fa48a65b670d62bd2afbf5adcbc7e | JavaScript | meeraramenon/Javascript-John-Hopkins-University-Assignment-Solution | /Lecture 40/js/script.js | UTF-8 | 1,937 | 4.03125 | 4 | [] | no_license | var company = new Object();
company.name = "meera";
company.age = new Object();
company.age.birth = "Jan";
company.age.number = 21;
//company.stock of company = 110; wont work
company["stock of company"] = 110
//console.log(company);*/
var company = {
name: "meera",
age : {
birth: "jan",
number: 2... | true |
fa59082d70e46c849654f5069e78281d49f61310 | JavaScript | moseskereya/A-nice-responsive-nav-bar | /main.js | UTF-8 | 1,484 | 3.25 | 3 | [
"MIT"
] | permissive | const naVBar = () =>{
const burger = document.querySelector('.burger');
const nav = document.querySelector('.links');
const navLinks = document.querySelectorAll('.links li');
//toggle nav
burger.addEventListener('click', () =>{
nav.classList.toggle('nav-active')
})
}
naVBar();
... | true |
ee7cb6074d68951a5ce050e0735168c781131384 | JavaScript | futureOfChen/hupuServer | /util/index.js | UTF-8 | 441 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
const writeFileJson = function (filePath, jsonObj, callback) {
fs.writeFile(filePath, JSON.stringify(jsonObj, null, '\t'), () => {
console.log('文件写入成功');
console.log('写入的文件路径是:', filePath);
if( !!callback && typeof callback === 'function' ){
callback();... | true |
4392128f81c484d25ab5da88bbe8373dce2408f5 | JavaScript | communitysnowobs/cso-webapp | /src/reducers/filters.js | UTF-8 | 2,646 | 2.65625 | 3 | [] | no_license | /**
* @fileOverview Defines filters reducer
* @author Jonah Joughin
*/
import ActionTypes from '../actions/actionTypes';
import { combineReducers } from 'redux'
import { featureCollection } from '../utils/geojson';
const initialState = [];
export const discreteFilterReducer = (state = initialState, action) => {
... | true |
5e711ab0c9d7304a02f3bc0b9273f68d543fcb6a | JavaScript | tanapop/Maze-Spinner | /lib/countdown_clock.js | UTF-8 | 1,213 | 2.59375 | 3 | [] | no_license | import { stopSpin } from './spin_motion.js';
import { resetGame } from './reset_game.js';
import { cancelFrame } from './levels/game.js';
export let clearTime;
class CountDown {
constructor() {
this.duration;
this.color = "white";
this.lose = false;
this.clearTime;
}
stop_tick() {
clearTime... | true |
588d237906fcbfcff7cc4b1ff5c41cbd993d4f49 | JavaScript | JSheleg/work-day-scheduler | /assets/js/script.js | UTF-8 | 2,420 | 3.125 | 3 | [] | no_license | //Get current data and set to top of page in jumbtron
var currentDay = document.getElementById('currentDay');
var date = moment(date).format("dddd MMMM Do, YYYY");
currentDay.innerText = date;
$(document).ready(function(){
console.log("ready");
// save input from each hour
$('.saveBtn').on('click', func... | true |
53dec2c8bb9d114433c328315459b1febb7ee5a0 | JavaScript | MrDuDe98/Back-End | /aula4/app.js | UTF-8 | 786 | 3.75 | 4 | [] | no_license | //Ficha4
//exercicio 2.
var obj = {
name: "Marco",
age: 19,
gender: "M"
};
var json = JSON.stringify(obj);
// a.
console.log(json);
// b.
var text = '{ "name":"Marco", "age":"19", "gender":"Masculino" }';
var str = JSON.parse(text);
console.log(str.name + ", " + str.age + ", " + str.... | true |
1e574a509de8c4cb4b02847a6812cd3e8a1f39a9 | JavaScript | Shwetha-Iyer/ReactTask5 | /src/productcreate.js | UTF-8 | 1,832 | 2.5625 | 3 | [] | no_license | import {useState} from "react";
import{useContext} from "react";
import ProductContext from "./productcontext";
export default function Productcreate() {
let [name,setname] = useState("");
let [color,setcolor] = useState("");
let [modal,setmodal] = useState("");
let [availability,setavail] = useState(""... | true |
827ff9620f3a7983c614ab7c3849022007887396 | JavaScript | 11gorizont11/tank-game | /src/index.js | UTF-8 | 1,594 | 3.125 | 3 | [] | no_license | import * as PIXI from 'pixi.js';
import {Tank} from './game';
const tankImageSrc = require('./assets/tank.png');
const ammoImageSrc = require('./assets/carrot.png');
const sceneSize = {
width: 20,
height: 20
}
// Creation app, adding view to dom
const app = new PIXI.Application(sceneSize.width * 40, sceneSize.h... | true |
b873baa2885f74ca8386243e3661fa046c07e5ee | JavaScript | medialab/personal-air-timeline | /scripts/process.js | UTF-8 | 2,243 | 2.84375 | 3 | [] | no_license | /**
* Processing script
* ==================
*
* Script reading the shape files and indexing the data.
*/
var csv = require('fast-csv'),
fs = require('fs'),
QuadTree = require('./quad-tree.js');
/**
* Constants.
*/
var DATA_PATH = './scripts/DATA/ADR_KMS2010_OSPM_UBM_2371624_strip_Mar2015_OSPM_UBM_THOB.... | true |
0d4405c423818fafc235f874280a77b733506deb | JavaScript | steedos/Meteor-CollectionFS | /packages/cfs-file/tests/file-tests.js | UTF-8 | 11,690 | 2.828125 | 3 | [
"MIT"
] | permissive | function bin2str(bufView) {
var length = bufView.length;
var result = '';
for (var i = 0; i<length; i+=65535) {
var addition = 65535;
if(i + 65535 > length) {
addition = length - i;
}
try {
// this fails on phantomjs due to old webkit bug; hence the try/catch
result += String.fro... | true |
ad9bc612ee551dc0a24593dd4779d88cb93e5dc3 | JavaScript | nathanvogel/shader-doodle | /src/sd-uniform.js | UTF-8 | 1,921 | 2.59375 | 3 | [
"MIT"
] | permissive | import SDBaseElement from './sd-base.js';
class SDUniformElement extends SDBaseElement {
disconnectedCallback() {}
get x() {
return parseFloat(this.getAttribute('x'));
}
set x(newx) {
if (newx != null) this.setAttribute('x', newx);
else this.removeAttribute('x');
}
get y() {
return parse... | true |
f3c0ea782af1c84eadad94ea6f60aa4ead3e2bf6 | JavaScript | revelted/Simple-Mern-HW | /express-review-refactored/routes/users.js | UTF-8 | 679 | 2.75 | 3 | [] | no_license | // That parenthesis is important and will haunt your dreams.
const router = require("express").Router();
const users = require("../init_data.json").data;
const {
getAllUsers,
getUserById,
addUser,
deleteUserById,
} = require("../controllers/users");
let id = users.length + 1;
/**
* Because we exported this m... | true |
e8fccc136c7f6aa2bf2e929420e3c3f27e6e5337 | JavaScript | RohitGanurkar/iNotebook | /backend/middleware/fetchuser.js | UTF-8 | 922 | 2.65625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
const JWT_SECRET = "rahulisgood$boy";
const fetchuser = (req,res, next) => {
// Get the user : from the jwt token , and get id to req object
const token = req.header('auth-token');
if(!token){
res.status(401).send({error:" plz authenticate using a valid token... | true |
68a688659ac745c6d49549d083b6c0a893ad0ba2 | JavaScript | chinguyen98/ch-coffee-seller | /public/js/admin-coffee-search.js | UTF-8 | 845 | 3.203125 | 3 | [
"MIT"
] | permissive | const coffeeNameField = document.querySelector('#coffee-name');
const coffeesContainer = document.querySelector('#coffees-container');
const coffeeNameList = Array.from(document.querySelectorAll('.coffee-name'));
function getCoffees(searchText) {
const html = coffeeNameList.filter(coffee => {
return coffee... | true |
cfc893b4de365e434e7520394b5ce1d3ff07dcdf | JavaScript | clopez2019156/programa_pedidos | /inventarios_php/js/ver_lista.js | UTF-8 | 4,939 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
$.ajax({
url: './bd/servidor.php',
type: 'GET',
data: {
quest: 'usuario'
},
success: function (idUsuario) {
$.ajax({
url: './bd/servidor.php',
type: 'GET',
data: {
... | true |
5bdcf12134d7c1ceb6abd1a636e34060d9ce86a1 | JavaScript | christian-schulze/oculo-coding-exercise | /src/utils/examinations.js | UTF-8 | 774 | 2.515625 | 3 | [] | no_license | export const groupByModality = examinations => {
const withDate = examinations.reduce((images, examination) => {
examination.images.forEach(image => {
images.push({
...image,
date: examination.date
});
});
return images;
}, []);
const byModality = withDate.reduce((modalit... | true |
3415bd4743400f2f41a5c0b87f79a32c4561fc04 | JavaScript | andreasp1988/MK_Rock_Paper_Scissor | /assets/js/main.js | UTF-8 | 1,579 | 3.53125 | 4 | [] | no_license | // Player One
let score = document.getElementById("score")
let scoreBoard = document.getElementById("comp");
let scoreBoard2 = document.getElementById("player1");
let counter = 1;
const pressX = () => {
let scorpion = Math.floor(Math.random() * 10);
let subZero = Math.floor(Math.random() * 10);
if (scor... | true |
aa819a996d1382e554174cb00ab44c12729e78bf | JavaScript | abuisman/play | /public/js/play.night.js | UTF-8 | 1,888 | 2.75 | 3 | [
"MIT"
] | permissive | jQuery(document).ready(function(){
function action(action, data, success){
var type = (data === undefined) ? 'get' : 'post';
success = (success === undefined) ? function(){} : success;
jQuery.ajax({
url: '/api/'+action,
type: type,
dataType: 'json',
data: (data === undefined) ? {} : data,
... | true |
3bed09b61ccd6e3425c09e703e75a3d9fe50abfc | JavaScript | AnaelleD/projet_recettes | /functions.js | UTF-8 | 2,596 | 3 | 3 | [] | no_license | function getRecipe1(){
var laRecette = document.getElementById("sel1").value;
var queryString = "?recette=" + laRecette;
window.location.href = "recette.html" + queryString;
}
function getRecipe2(){
var laRecette = document.getElementById("sel2").value;
var queryString = "?recette=" + laRecette;
window.location.h... | true |
73a71dda77eb8aa6f0699aa7655f07e2745d73b8 | JavaScript | GitOverHere/OpenSuite-Word | /11-20-2021 Web Server Backup/Websites/index.js | UTF-8 | 1,057 | 2.515625 | 3 | [] | no_license | var x= window.innerWidth;
var hamburger = document.createElement("img");
window.addEventListener("scroll",function(){
var ChangeHere= document.getElementById("about");
var links = document.getElementById("header").getElementsByTagName("a");
if(window.scrollY > ChangeHere.offsetHeight){
document.g... | true |
e0f953d6fc01b9322212fcd2e4d80ab7cefda117 | JavaScript | yanchr/m152 | /lb2/scripts/info.js | UTF-8 | 1,781 | 3.328125 | 3 | [] | no_license | jsonElement = JSON.parse(localStorage.getItem("jsonItem"));
console.log(jsonElement.title)
infoBody = document.getElementById("infoBody");
//title
titleH1 = document.createElement("h1");
if (jsonElement.title) titleH1.innerText = jsonElement.title;
infoBody.appendChild(titleH1);
//time
if (jsonElement.years) {
t... | true |
5dc910712521d20b8a5b440b5215f1fa9d3e1ca3 | JavaScript | SimplyAhmazing/SurfNotes | /src/note/note.js | UTF-8 | 722 | 2.78125 | 3 | [] | no_license | function Editor(input, preview) {
this.update = function () {
preview.html(markdown.toHTML(input.val()));
};
this.getData = function(){
var noteUUID = window.location.search.split('=')[1];
var data = {uuid: noteUUID, note: input.val()};
return data;
};
this.saveData = function(){
// pass t... | true |
69d79395b4c2c620d42e0676daa00799e17a3f05 | JavaScript | jfeo/mathyd-frontend | /src/services/BaseAPIService.js | UTF-8 | 1,531 | 2.6875 | 3 | [] | no_license |
export class APIResult {
constructor(status, statusText, msg, data) {
this.status = status;
this.statusText = statusText;
this.msg = msg;
this.data = data;
}
}
export class BaseAPIService {
get api_url() {
return "http://localhost:5000"
}
async get(uri) {
... | true |
be60065393820e285c17e62b742b8901910ae7b8 | JavaScript | ivp4797/courier | /format.js | UTF-8 | 808 | 3.15625 | 3 | [] | no_license | import { today, yesterday, isSameDay, casedMonthName } from "./datetime";
export function formatPhone(phone, countryCode = 7) {
return `+${countryCode} ${phone.substring(0, 5)} ${phone.substring(5)}`;
}
export function padNumberWithZeros(number, minLength) {
return String(number).padStart(minLength, "0");
}
export... | true |
d07042b1241c85d27ef9d430244b878e4f08d082 | JavaScript | raunakchopra/weatherLive | /src/App.js | UTF-8 | 2,274 | 2.828125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./App.css";
import { useForm } from "react-hook-form";
import Input from "./components/Input";
import Information from "./components/Information";
import axios from "axios";
function App() {
const [city, setCity] = useState("");
const [data, setData] = u... | true |
b88f23d26f144a2bfbee545c47ed5554d7f3ef3e | JavaScript | abhigun1234/mongoosedemoapi | /callback.js | UTF-8 | 711 | 3.015625 | 3 | [] | no_license | // console.log('user 1 made a rquest')
// console.log(' server waiting for 5 sec for db operation')
// console.log('data deliverd to the user 1')
// console.log('user 2 made a rquest')
// console.log(' server waiting for 5 sec for db operation')
// console.log('data deliverd to the user 2')
// console.log('user 3 made ... | true |
4f114ecf1316e8911b8fb81b8f284ebdcd5c4b26 | JavaScript | chalma42/alley | /js/mix/main.js | UTF-8 | 5,355 | 2.8125 | 3 | [] | no_license | jQuery(document).ready(function($){
/************************************
MitItUp filter settings
More details:
https://mixitup.kunkalabs.com/
or:
http://codepen.io/patrickkunka/
*************************************/
buttonFilter.init();
let link_id = document.location.href.split('#').pop();
switch... | true |
23b5a6b33daa2adcb08372fd926aec05dfe38e8b | JavaScript | duzliang/html-css-javascript | /javascript/es6/map.js | UTF-8 | 1,011 | 3.65625 | 4 | [] | no_license | /**
* 原始实现
*/
var map = Object.create(null);
map.count = 1;
if (map.count) {
console.log('map has count property');
}
/**
* ES6
*/
var map = new Map();
map.set('name', 'duzl');
map.set('age', 1);
map.get('name');
map.size;
map.delete('age');
map.has('age');
map.clear();
map.size;
/**
* 私有属性 es5
*/
v... | true |
ab8482d6e4a24a8b716ed562f0e399c03ee1a228 | JavaScript | KeryAti/keryati.github.io | /jQueryGallery_v2/js/gallery.js | UTF-8 | 1,979 | 2.921875 | 3 | [] | no_license | let dataFile = "./js/data.json";
let currentPhoto = 0;
let maxPhoto;
let nextPhoto;
let readData = (imagesData) => {
maxPhoto = imagesData.length - 1;
let photoLoad = (photoNumber) => {
$("#photo").fadeOut(200, function() {
$("#photo").attr("src", imagesData[photoNumber].photo);
})... | true |
faa8f19533728774187ae5202666edf24da35ad3 | JavaScript | gzzing/front | /fcc/basic/palindrome.js | UTF-8 | 787 | 3.765625 | 4 | [] | no_license | function pd(str) {
//思路:去掉字符串中的非字母,统一大小写
//正则匹配替换掉多余字符
str = str.replace(/\W/g, "").toLowerCase();
console.log(str);
var len = str.length;
for (var i = 0; i < len/2; i++) {
if (str[i] !== str[len - i -1 ]) return false;
}
return true;
}
function pd2(str) {
//思路反转字符串相等
/... | true |
1b54ed157a244e2ad8e3557b5d831292872c318c | JavaScript | khanhhuy288/Codewars-Javascript | /rowSumOddNumbers.js | UTF-8 | 442 | 4.125 | 4 | [] | no_license | // function rowSumOddNumbers(n) {
// var result = [];
// for (var i = 1; i <= 13; i += 2) {
// result.push(i);
// }
// return result;
// }
// console.log(rowSumOddNumbers(1)); // 1
// console.log(rowSumOddNumbers(2)); // 3 + 5 = 8
// console.log(rowSumOddNumbers(3)); // 7 + 9 + 11 = 27
// console.log(row... | true |
eeb514a8677e96901c33f1a11b609500b3d324f5 | JavaScript | kaodigua/vuex-persist-indexeddb | /src/index.js | UTF-8 | 3,453 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import merge from "deepmerge";
import * as shvl from "shvl";
import localforage from "localforage";
import cloneDeep from "lodash/cloneDeep";
import differenceWith from "lodash/differenceWith";
import isEqual from "lodash/isEqual";
/**
*
* @param {Object} options : {
* key?: string;
* paths?: string[];
* reducer?... | true |
1fb1fa99335f7426a2bea9c319a3d2d20daef5cc | JavaScript | RubenDuran/DojoAssignments | /Webfundamentals/Javascript/jQ/GOT/script.js | UTF-8 | 557 | 2.921875 | 3 | [] | no_license | $(document).ready(function() {
$('img').click(function() {
var house = $(this).attr('houseID');
var url = "https://www.anapioficeandfire.com/api/houses/"+ house;
$.get(url, function(res) {
var name = res.name;
var words = res.words;
var titles = res.title... | true |
0173d60a30bfb6d0fa1340dbfaec9d703890d709 | JavaScript | bmokriev/SU-JSAdvanced | /Objects-and-Composition/Excercises/6-storeCatalogue.js | UTF-8 | 789 | 3.078125 | 3 | [] | no_license | function storeCat(input) {
let catalogue = [];
for (const item of input) {
let [name, price] = item.split(' : ')
let entrie = {
name,
price
}
catalogue.push(entrie)
}
catalogueS = catalogue.sort((a, b) => a.name.localeCompare(b.name))
let fi... | true |
14cdae182ee4b0552730a6017b935b5bb39248f8 | JavaScript | gusajr/seguimientoParaPacientes | /vistas/scripts/login.js | UTF-8 | 2,103 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
Nombre: login.js
Objetivo/propósito: archivo de control del login del sistema. Valida el tipo de usuario que ingresa al sistema y carga la página correspondiente.
Creado por: GHAMASWARE
-Ing. Casillas Toledo Mauricio Enrique
-Ing. Gómez Segovia Álvaro
-I... | true |
07eba823893acbe1fc2e59990fc4c4817402623d | JavaScript | rjgcabrera/toy_problems | /Arrays-n-Strings/isUnique.js | UTF-8 | 216 | 3.265625 | 3 | [] | no_license | var isUnique = (str) => {
var charObj = {};
for (var i = 0; i < str.length; i++) {
if (charObj[str[i]]) {
return false;
}
charObj[str[i]] = true;
}
return true;
};
| true |
7676b1d78bd507ea531c4b1bdf63a9dfdba4ecaa | JavaScript | wesmith4/project-js-textalyze | /lib/readFileSync.js | UTF-8 | 656 | 2.859375 | 3 | [
"CC-BY-4.0"
] | permissive | const fs = require('fs');
function readFileSync(file) {
let text = fs.readFileSync(file, 'utf-8');
return text;
}
/*
function readFile(fileName, callback) {
fs.readFile(fileName, 'utf-8', function(err, data) {
if (err) {
throw err;
}
callback(data);
});
}
*/
/*
readFile('../sample_textFile... | true |
0f05e8f841e6726c160738752a9048c6d8060e8e | JavaScript | hello2calls/voipswitchWeb | /web/templ/js/propertys.js | UTF-8 | 352 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | var propertys = new Array;
var propertyAdd = {};
function Property(name,column,operation){
this.name = name;
this.column= column;
this.operation = operation;
}
function isPropertyAdd(property){
if(propertyAdd[property.name]==null || propertyAdd[property.name]==""){
propertyAdd[property.name]=property;
return fa... | true |
2203ead4bcf125815643728387b3c8e76b8e8714 | JavaScript | XolotlDev/Corleone-Online-Statue-Wars | /statue_cs.js | UTF-8 | 359 | 2.609375 | 3 | [] | no_license | function onServerLockStatue(){
var lockColor = [0.3,0.3,0.3,1];
this.color = lockColor;
}
function onServerUnlockStatue(){
var unlockColor = [1,1,1,1];
this.color = unlockColor;
}
function onServerRollStatue(pl, delay, color)
{
this.color = color;
this.settimeout(delay);
}
function onTim... | true |
4b90bdbc8eb3566c77b88c7a5fa253429cebc724 | JavaScript | stacydubleu/TTPFinalProject | /app.js | UTF-8 | 1,117 | 2.734375 | 3 | [] | no_license | //require an express instance application becomes an instance
//order matters
var express = require('express');
var exphbs = require('express-handlebars');
var app = express();
var mustaches = ['a.png', 'b.png', 'c.png', 'd.png', 'e.png', 'f.png', 'g.png', 'h.png', 'i.png', 'j.png', 'k.png', 'l.png', 'm.png', 'n.png... | true |
dba9340224ab711bff65c9e670107ca198472c27 | JavaScript | HasnawiH/h8-p0-w3 | /[Exercises2]-Tantangan-Array-1-Mengakses-Nilai-dalam-Array.js | UTF-8 | 199 | 3.5 | 4 | [] | no_license | var arr=['Hello World!']
function balikString(arr){
var output=''
for (var i = arr[0].length-1; i>=0; i--){
output += arr[0][i]
}
return output
}
console.log(balikString(arr)) | true |
bc41fc25088eaacfa0f35a3a35d9c78cb5f004f6 | JavaScript | cglane/ramda-extension | /packages/ramda-extension/src/notNaN.js | UTF-8 | 692 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import { o, not } from 'ramda';
/* eslint-disable max-len */
/**
* Return negation of native isNaN function.
*
* @func
* @category Logic
*
* @example
*
* R_.notNaN(0) // true
* R_.notNaN('') // true
* R_.notNaN([]) // true
* R_.notNaN(null) ... | true |
ecc31e11b6525003d5736894304cc1fd7d9a8f5f | JavaScript | AfterShip/company-intro | /lib/replaceURLs.js | UTF-8 | 997 | 2.8125 | 3 | [
"MIT"
] | permissive | const urlRegex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w\-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w!/]*))?)/g;
export default function createAnchors(message) {
return regexReplace(message, urlRegex, function (match) {
// Don't break <img src="http:... | true |
ca218e577ea8ce360ebc06e9b78c2e3305e31f7d | JavaScript | mildsummer/image-morphing | /build/js/easing.js | UTF-8 | 1,848 | 3.046875 | 3 | [] | no_license | "use strict";
var EasingFunctions = {
// no easing, no acceleration
linear: function linear(t) {
return t;
},
// accelerating from zero velocity
easeInQuad: function easeInQuad(t) {
return t * t;
},
// decelerating to zero velocity
easeOutQuad: function easeOutQuad(t) {
... | true |
6922dcc48fa429bf7f627485c6c393ea65933e7c | JavaScript | zaxtax/webppl | /src/header.js | UTF-8 | 45,485 | 2.59375 | 3 | [] | no_license | "use strict";
var assert = require('assert');
var _ = require('underscore');
var PriorityQueue = require('priorityqueuejs');
var util = require('./util.js');
// Top address for naming
var address = "";
// Top global store for mutation (eg conjugate models)
var globalStore = {};
///////////////////////////////////... | true |
8e48f879acade1968c9566cddbe3a52bb6c97b0e | JavaScript | GregJordanSr/JavaScript-Methods | /array_methods/map.js | UTF-8 | 968 | 4.28125 | 4 | [] | no_license | /* Syntax For .map for JS Arrays */
/* Takes 3 arguments,
currentValue which is the current element
index (optional),
array (optional) the arrap map was called on.
thisArg - value to use as this when using CB
MAP DOES NOT MUTATE THE ORIGINAL ARRAY*/
/* A Scenario Where You Need All The ID's into a new array. At l... | true |
122c6113b7f1d96469ee5db3bb0cc81441f924c2 | JavaScript | stevesan/UnityUtils | /Math2D.js | UTF-8 | 5,361 | 2.796875 | 3 | [
"CC-BY-4.0",
"CC-BY-3.0"
] | permissive | #pragma strict
import System.Collections.Generic;
static function Nearest( pts : Array, p:Vector2 ) : int
{
var minDist = Mathf.Infinity;
var minId = -1;
for( var i = 0; i < pts.length; i++ )
{
var dist = Vector2.Distance( pts[i], p );
if( dist < minDist )
{
minDist = dist;
minId = i;
}
}
return... | true |
021f5ba4c61fe301a16af68b012d3378e564d14b | JavaScript | jmwalker49/flashCards | /flashCards.js | UTF-8 | 1,227 | 4.1875 | 4 | [] | no_license | // constructor function which can take in a series of values and create objects
// with the properties contained inside
function BasicCard(front, back) {
this.front = front;
this.back = back;
}
var firstPresident = new BasicCard(
"Who was the 1st President of the United States?", "George Washington");
// Check ... | true |
3feb51004df6b76e925b224b20bc769330fbd461 | JavaScript | masotime/promises-presentation | /gen1.js | UTF-8 | 933 | 4.09375 | 4 | [
"MIT"
] | permissive | // what generators really do
'use strict';
function* simpleGenerator() {
console.log('simpleGenerator started');
yield 1;
yield 2;
yield 3;
return 'done';
}
// test is like an iterator
var test = simpleGenerator(), step;
/*
console.log('going to begin simpleGenerator().next()');
do {
step = test.next();
conso... | true |
260592af4b086eb190cd12544842c7b2785872ea | JavaScript | Ajrelerford/Fitness_Tracker | /src/components/routines.js | UTF-8 | 2,389 | 2.765625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { callApi } from "../api";
import "../bootstrap.min.css";
const Routines = (props) => {
const {token, user} = props
const [routines, setRoutines] = useState([]);
const [update, setUpdate] = useState('');
const getRoutines = async () => {
try {
... | true |
ff245ef2e614c182eea898d190b74241ae2f202b | JavaScript | NegativeKarma/bmi_challenge | /src/script.js | UTF-8 | 498 | 2.9375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$('#calculate').click(function() {
var w = parseFloat($('#weight').val());
var h = parseFloat($('#height').val());
var person = new Person({
weight: w,
height: h
});
if ($("#checkbox").is(":checked")) {
person.calculate_imperial_bmi();
} else {
... | true |
1b4f6ccfaca6b46dc8a289d076cd8f2793f98942 | JavaScript | howtoadhd/satis | /jekyll/assets/main.js | UTF-8 | 1,364 | 2.8125 | 3 | [] | no_license | function momentize(elements) {
elements.each(function () {
var element = $(this);
element.text(moment(element.attr('datetime')).fromNow());
});
}
$(function () {
var input = $('input#search');
var list = $('div#package-list');
var packages = list.find('h3');
var timeElements = $('time');
var inpu... | true |
24d7cf7bcfcd4454b2392a381ad600fd046e1455 | JavaScript | Zina07/konexio_javascript | /jour_2/firstReverse.js | UTF-8 | 291 | 3.46875 | 3 | [] | no_license | function firstReverse(str) {
var result = '';
for (var i = str.length; i >= 0; i--) {
result += str.charAt(i);
}
return result;
}
console.log(firstReverse('Hello World and Coders'));
console.log(firstReverse('konexio'));
console.log(firstReverse('I Love Code'));
| true |
65b6e99b4771e91b82e3bdce29c07c04916d6267 | JavaScript | zenyip/oshigame_frontend | /src/reducers/notificationReducer.js | UTF-8 | 1,231 | 2.875 | 3 | [] | no_license | const initialState = { content: null, colour: 'white' }
const notificationReducer = (state = initialState, action) => {
switch(action.type) {
case 'NOTIFY': {
const newMessage = { header: action.data.header, content: action.data.content, colour: action.data.colour, listing: action.data.listing }
return newMe... | true |
9abbf27ef6ff08f24ea310372409276facd7016a | JavaScript | pcuci/simplifying-js | /code/classes/prototypes/class.js | UTF-8 | 653 | 3.0625 | 3 | [] | no_license | /* eslint-disable func-names */
// START:class
class Coupon {
constructor(price, expiration) {
this.price = price;
this.expiration = expiration || 'Two Weeks';
}
getExpirationMessage() {
return `This offer expires in ${this.expiration}.`;
}
}
const saleCoupon = new Coupon(5, 'two months');
saleCou... | true |
463622aec0f6b4fc936bcafbaa62c1a2bfcbe9e9 | JavaScript | mikedeeno84/wonders | /server/io/index.js | UTF-8 | 406 | 2.625 | 3 | [] | no_license | 'use strict';
var socketio = require('socket.io');
var io = null;
module.exports = function (server) {
var numPlayers = 0;
if (io) return io;
io = socketio(server);
io.on('connection', function () {
numPlayers++;
if(numPlayers>0){
io.emit('join', {hi:'hi'});
}
console.log('soc... | true |
5a0125c128a92e803097b5647fb7275010656d16 | JavaScript | hmp36/Lectures | /Web_Fundamentals/week2/day4/script.js | UTF-8 | 844 | 3.3125 | 3 | [] | no_license | $(document).ready(function(){
// When our form is submitted, run this:
$("#findPokemon").submit( function(){
// Get the user's input:
var number = parseInt( $("#userInput").val() );
// Store our url, adding the user's input to the end.
var pokeURL = "https://pokeapi.co/api/v2/pokemon/"+number;
// Finally, ... | true |
2c59abfe346d87fffe3fa8bf7a2778669033ab0d | JavaScript | swathisavalge/jslearning | /src/roughFile.js | UTF-8 | 155 | 3.21875 | 3 | [] | no_license | const alphabet = ['A','B','C','D','E','F','G','H'];
const number = ['1','2','3','4','5','6','7','8'];
const [a,,b] = alphabet
console.log(a + " " + b);
| true |