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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e270cbc8465d313fc4a06e92d82ab6c1ba81b992 | JavaScript | iliandj/Image-gallery | /handlers/static-files.js | UTF-8 | 1,226 | 2.59375 | 3 | [] | no_license | let fs = require('fs')
let url = require('url')
let path = require('path')
let mimeTypes = require('./mime-types')
let rootDirectory = '/content/'
function getPathExtension (url) {
let filePath = '.' + url
let extName = String(path.extname(filePath)).toLowerCase()
return extName
}
function getContentType (url) ... | true |
d318e00dbb0a082c5bfcbd54caa15eb5432e4989 | JavaScript | JoeRoussy/scholarship-site | /src/scripts/component/graph-config/index.js | UTF-8 | 2,131 | 2.90625 | 3 | [] | no_license | import Chart from 'chart.js';
export default () => {
const userPlot = $('#userPlot');
if (userPlot.length) {
// Configure the data for the plot
const sourceData = JSON.parse(userPlot.attr('source-data'));
const {
userData,
memberData
} = sourceD... | true |
69a1599b58585b9280ba690c0f23fcdadd0d57de | JavaScript | smgomez92/GeneradorFormulariosNG | /Web4/webpages/src/main/js/com/fitbank/webpages/behaviors/DigitValidator.js | ISO-8859-1 | 6,404 | 2.671875 | 3 | [] | no_license | include("lib.prototype");
DigitValidator.cedulaEcuador = function(elemento) {
var message = "";
if (elemento.value.length == 0) {
Validar.ok(elemento, this.constructor.simpleClassName);
return true;
} else if (elemento.value.length == 10) {
var rut = elemento.value.substring(0, 9);... | true |
e98cefe0b89f540d6285f508fdc69b51190edcb4 | JavaScript | lijiayi01/frontEnd_system | /前端体系/前端工程化/tapable解析/src/self_SyncWaterfallHook.js | UTF-8 | 1,103 | 3.53125 | 4 | [] | no_license | class SyncWaterfallHook {
constructor(arg) {
this.arg = arg;
this.task = [];
}
tap(name, callback) {
this.task.push(callback);
}
call(...arg) {
if (arg.length < this.arg.length) {
console.warn('参数不足');
return false;
}
... | true |
aea195becfbef5657aa7b34d71c9f7a7429056b0 | JavaScript | kerrishotts/PhoneGap-Enterprise-Code-Bundle | /tasker-srv/obj-utils/index.js | UTF-8 | 10,194 | 2.9375 | 3 | [
"MIT"
] | permissive | /******************************************************************************
*
* Tasker Server (PhoneGap Enterprise Book)
* ----------------------------------------
*
* @author Kerri Shotts
* @version 0.1.0
* @license MIT
*
* Copyright (c) 2014 Packt Publishing
* Permission is hereby granted, free of charg... | true |
2f6be86a4f52c38e3975d89c8940fef43df6b01a | JavaScript | lwatzon/pi | /my_gpio_test.js | UTF-8 | 835 | 2.8125 | 3 | [] | no_license | var gpio = require("gpio");
var intervalId;
var gpioPin7;
gpioPin7 = gpio.export(4, {
ready: function () {
intervalTimer = setInterval(function () {
gpioPin7.set(1);
setTimeout(function () { gpioPin7.reset(); }, 500);
}, 1000);
}
});
setTimeout(function (... | true |
f8d205109ba18ec30029cdba18637830589d21ef | JavaScript | Yibarr/cinta-roja-devf | /b34/05-peticiones/request.js | UTF-8 | 4,059 | 3.4375 | 3 | [] | no_license | const request = require('request');
// const URL_BASE = 'https://pokeapi.co/api/v2'
// request.get('https://pokeapi.co/api/v2/pokemon/ditto/',(error,response,body)=>{
// const json = JSON.parse(body)
// console.log(json.name)
// });
// const pokeById = (id) => {
// const url = `${URL_BASE}/pokemon/${id}... | true |
d08438ec7748be548d3e5f1e46273ebcebbad317 | JavaScript | abztan/project-tomorrow-alpha | /Thrive/thrive.js | UTF-8 | 810 | 2.578125 | 3 | [] | no_license | <script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
... | true |
44c284c5609a8a9f0b1b7521fa463c4a0aca8235 | JavaScript | mattdanielmurphy/zhirzh.github.io | /20170730-correct-blur-with-de-gamma/demo/blur.js | UTF-8 | 3,230 | 3.21875 | 3 | [] | no_license | // @ts-check
/** @type CanvasRenderingContext2D */
const ctx = $canvas.getContext('2d')
const image = new Image()
let taskTimer
let iterations
let gamma
let radius
image.onload = render
$radiusInput.oninput = render
$gammaInput.oninput = render
$iterationsInput.oninput = render
$imageInput.onchange = e => {
ima... | true |
e189c28babea0f7033963f22a0a2f8107f5bd2cf | JavaScript | kchia/codertracks | /client/app/components/CountrySubBox.react.js | UTF-8 | 1,512 | 2.5625 | 3 | [] | no_license | var React = require('react');
var CountrySubBox = React.createClass({
numberWithCommas: function(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
},
render: function() {
var result = this.props.countrySpecificData;
return (
<div className="countrysubbox">
<h1><b>Coun... | true |
d19a4a1a8037555d3b5d1c4f03cf4119d79bc151 | JavaScript | tungnguyenls2008/exerciseModuleFinale | /js/exercise03.js | UTF-8 | 502 | 3.9375 | 4 | [] | no_license | function isFibonacci(num) {
console.log(num);
let fibonacciSequence = [0, 1];
for (let i = 0; i < 500; i++) {
fibonacciSequence.push(fibonacciSequence[i] + fibonacciSequence[i + 1]);
if (num === fibonacciSequence[i]) {
document.getElementById('display').innerHTML = num + " is a F... | true |
e9eeb15823973c1d49c2015e8d06ca226bda9c71 | JavaScript | greenfox-velox/attilakrupl | /Further Projects/contacts/client/client.js | UTF-8 | 4,847 | 3.21875 | 3 | [] | no_license | 'use strict';
const understoodButton = document.querySelector('#understood');
const graphButton = document.querySelector('#graphButton');
const addButton = document.querySelector('#addButton');
const okButton = document.querySelector('#okButton');
const cancelButton = document.querySelector('#cancelButton');
const path... | true |
670bae3e42f2af29740bdcc98d7dd6059baecb8d | JavaScript | Hoijof/Soil | /src/controllers/battleSystem.js | UTF-8 | 537 | 3.5 | 4 | [] | no_license | function BattleSystem() {
"use strict";
this.battles = [];
}
BattleSystem.prototype.createBattle = function (npc1, npc2) {
var battle = new Battle();
battle.npc1 = npc1;
battle.npc2 = npc2;
this.battles.push(battle);
return this.battles.length - 1;
};
BattleSystem.prototype.finishBattl... | true |
ec35ce19f595d78b1be56a93919c46e572dd94f4 | JavaScript | pcsteppan/pattern-by-any-other-name | /sketch.js | UTF-8 | 1,890 | 3.28125 | 3 | [] | no_license | const IMAGE_WIDTH = 140;
const IMAGE_HEIGHT = 140;
const IMAGE_WIDTH_PIXEL_SIZE = 10;
const IMAGE_HEIGHT_PIXEL_SIZE = 10;
let seed_input;
const COLORMAP = {
'1' : [0,1,0.5,20],
'0' : [0,0.1,0.9,0]
}
let pattern = [];
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSL, 360.0, 1.0, ... | true |
fede59081fb7a0c2750ef436d2c4e36b605d964f | JavaScript | CarlosGaubertQ/test-Node | /src/models/anime.js | UTF-8 | 631 | 2.609375 | 3 | [] | no_license | const mongoose = require('mongoose')
const bcrypt = require('bcrypt-nodejs');
const Anime = new mongoose.Schema(
{
nombre: String,
anioEmision: {type: Number},
encript: String
}
)
Anime.pre('save', function(next){
const anime = this
if(!anime.isModified('encript')){
re... | true |
154215454e070a5e7569c47074fe4d1df6ff682f | JavaScript | Sp198418/SEnotes | /Css/CalculatorProject/Pro-cal.js | UTF-8 | 2,557 | 3.984375 | 4 | [] | no_license | // targeting elements in HTML from JS
var allButtons = document.querySelectorAll('.button');
var screen = document.querySelector('.display');
console.log(screen.innerHTML)
function addAllEventListeners(arr){
// looping through array
for(var i = 0; i < arr.length; i++){
// if the value is equal to '=' or ... | true |
a9b408ed0be40279da86c390c911ade950762081 | JavaScript | VSolodkiy/JSexpert | /homework_13/HW_13_task_2/js/main.js | UTF-8 | 2,138 | 4.375 | 4 | [] | no_license | // Основное домашнее задание №2
// Начальные переменные
var btn = document.getElementById("play");
var player1 = document.getElementById("player1");
var player2 = document.getElementById("player2");
var gamerOne, gamerTwo;
var firstMsg = "Выиграл первый игрок ";
var secondMsg = "Выиграл второй игрок ";
const elemen... | true |
10fd7f4d306c64862ae38fb64b185d727ea41232 | JavaScript | LubomyrKashuba/HomeworkJS | /lesson12/text/js/index.js | UTF-8 | 668 | 2.890625 | 3 | [] | no_license | document.body.style.fontSize = "40px";
document.body.style.padding = "100px";
const ul = document.getElementsByTagName("ul");
const li = document.getElementsByTagName("li");
ul[0].style.listStyleType = "decimal";
li[0].addEventListener("click", () => {
li[0].style.color = "red";
});
li[1].addEventListener("click",... | true |
2698f3397ac1a6e11d61468508f87f5e88c1603c | JavaScript | benhulme/Sorted | /sorted/angular/standalone/calculators/savings.js | UTF-8 | 29,789 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | /*! savings.js */
console.debug = false;
var debug = false;
var SortedCalculator_Savings = SortedCalculator.extend({
init: function () {
'use strict';
if(debug) console.log('SortedCalculator_Savings.init');
this._super();
}, debug_mode: false, check_vars: function (teArray, flag) {
'use strict';
... | true |
c144e4f25b7c2d167b8dd9a6d902e54e08655326 | JavaScript | frfanizz/Concussr | /static/speech.js | UTF-8 | 4,196 | 2.78125 | 3 | [] | no_license | var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent
var numbers = [ 'one' , 'two' , 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'zero']... | true |
b42945c5b9d49b42fae508fe42ef0593d6ac2f6a | JavaScript | mumuWorld/Swift_SweetSugar | /Swift_SweetSugar/SafariTranslate/Resources/background.js | UTF-8 | 213 | 2.625 | 3 | [
"MIT"
] | permissive | browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log("Received request: ", request);
if (request.greeting === "hello")
sendResponse({ farewell: "goodbye" });
});
| true |
45dd76527bf6f3dc3c9b80069b96d9a260870508 | JavaScript | kousiclattala/JSButtonShuffle | /buttonContainer.js | UTF-8 | 938 | 3.4375 | 3 | [] | no_license | const btn1 = document.getElementById("btn1");
const btn2 = document.getElementById("btn2");
const btn3 = document.getElementById("btn3");
const btn4 = document.getElementById("btn4");
const btn5 = document.getElementById("btn5");
const btn6 = document.getElementById("btn6");
const btn7 = document.getElementById("btn7")... | true |
9e1ecae0f0b0bfb4a12f10685c2de309e20c9e24 | JavaScript | Arif-Hosen/js-interesting-concepts | /summary.js | UTF-8 | 201 | 3.09375 | 3 | [] | no_license | function triple(x, y, z) {
x.age = 3000;
}
const myObj = { name: 'ali', age: 67 }
const num1 = 20;
const num2 = 34;
const num3 = 78;
// triple(num1, num2, num3);
triple(myObj);
console.log(myObj);
| true |
d17da185a57f4ddf8f02fa4f41bb91c9e58929ee | JavaScript | atlefren/SpatialBBPresentation | /example/lib/markermodel.js | UTF-8 | 1,168 | 2.59375 | 3 | [] | no_license | var SpatialBB = window.SpatialBB || {};
(function (ns, undefined) {
"use strict";
ns.MarkerModel = Backbone.Model.extend({
initialize: function (attributes, options) {
options = options || {initPos: true};
if (options.initPos) {
this.createMarker(this.parsePosi... | true |
81453a052d520d458407d2d54348d3baf3dd5188 | JavaScript | utheris/ScrumPractice | /development/js/app.js | UTF-8 | 8,685 | 2.9375 | 3 | [] | no_license | // 2.3_Przechowywanie_i_dodawanie_imienia
function callme() {
let name = document.getElementById("inputName").value;
localStorage.setItem("userName", name);
location.reload();
}
function logout() {
localStorage.setItem("userName", "");
location.reload();
}
window.onload = function () {
document.getElemen... | true |
4b659c1c869ba8274c3c0f08408de889eecbe8da | JavaScript | sp1r1tcruh3r/Collections-hexlet | /areBracketsBalanced_trial.js | UTF-8 | 3,054 | 3.578125 | 4 | [] | no_license | /*
При работе с текстом скобки занимают важное место. Мы сплошь и рядом сталкиваемся со скобками разных видов (а если рассматривать шире, то с любыми парными сущностями, обозначающими начало и конец блока текста): это и программный код, и html-разметка, и форматы данных (например, JSON) и обычное письмо.
При этом ва... | true |
c9208471a3d4e25588a397d454bdf3815a1e3a8d | JavaScript | RyeRob/workshop-react | /src/components/level3/Level3.js | UTF-8 | 975 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
// Task-3.3
class Level3 extends Component {
// Task-3.2
constructor(props) {
super(props);
this.state = {
list: [
{ id: 0, title: "Pulp Fiction", content: "Many people cross pathscontent1" },
{ id: 1, title: "Title2", content: "A man is co... | true |
a2d2f612b0205db092b6c4db68fcbdd92b63c3b7 | JavaScript | DanielKubariev/homework | /1/if-else/2.js | UTF-8 | 605 | 3.328125 | 3 | [] | no_license | // Определить какой четверти принадлежит точка
// с координатами (х,у)
function getDot(x,y){
if((x,y) === undefined) {
return 'Введите входные данные';
}
if(x > 0 && y > 0) {
return 'Первая четверть';
}
if(x < 0 && y > 0) {
return 'Вторая четверть';
}
if(x < 0 && y < 0) {
return 'Третья чет... | true |
68092549a4b316989a702a78b86d9bad048208da | JavaScript | maartje/BridgeApp | /js-tests/fake-objects/fake-tree-node.js | UTF-8 | 4,121 | 2.671875 | 3 | [] | no_license | /**
* Used to unit test objects that interact with tree structured data
*/
define(function(require, exports, module) {
var FakeTreeNodeCollection = module.exports.FakeTreeNodeCollection = function(fakeNodes) {
this._nodes = fakeNodes || [];
};
FakeTreeNodeCollection.prototype = function() {... | true |
b0908f9b2084d9d7f056ca74560211d3fcd842a8 | JavaScript | TanoCuile/ddion | /web/js/providers/blocks/slider.js | UTF-8 | 3,552 | 2.59375 | 3 | [] | no_license | function initializeSliderBlock(app) {
app.provider('SliderBlock', [function(){
return {
$get: ['InfoBlock', function(InfoBlock){
SliderBlock.prototype = angular.extend({}, InfoBlock.prototype, SliderBlock.prototype);
return SliderBlock;
}]
}
... | true |
ab69c3f68bf055e6d3ae91e81ebf7cf344507f8f | JavaScript | shekhar94/coding | /HR-js/breakingEdges.js | UTF-8 | 2,942 | 3.328125 | 3 | [] | no_license | function main(input) {
var iparr = input.split("\n"),
noOfNodes = Number(iparr[0]),
v = iparr[1].split(' ').map(Number),
edgeArr = iparr.slice(2),
tree = new Array(noOfNodes).fill(null).map(() => new Array(noOfNodes).fill(0));
edgeArr.forEach(edge => {
var edge = edge.sp... | true |
a3759a1ef78e90d70de538da16c10ff7a8699ef4 | JavaScript | spencerbackman/assignments | /exercises/dailyteaching/ternary/src/App.js | UTF-8 | 446 | 2.59375 | 3 | [] | no_license | import React from 'react';
const App = () => {
let phrase
switch(props.phrase) {
case 'greeting':
return phrase = <h1> Hello </h1>
case 'question':
return phrase = <h1> What's Up? </h1>
case 'farewell':
return phrase = <h1> Bye Bye </h1>
defa... | true |
1e4aabcefd2347b26160d67750103b7782359a65 | JavaScript | Julius95/FunktionaalinenOhjelmointi | /v2/02/tehtava4.js | UTF-8 | 829 | 2.90625 | 3 | [] | no_license | 'use strict';
const Immutable = require('immutable');
const AnimatedObject = (function(){
const suojatut = new WeakMap();
class AnimatedObject{
constructor(p_id,p_ruudulla){
suojatut.set(this, {id: p_id, ruudulla: p_ruudulla});
}
animoi() {
... | true |
cea88957356f6eb9101e7c91430e06d6d1a97de6 | JavaScript | SeanBurt/js-learning | /callstack.js | UTF-8 | 1,223 | 3.578125 | 4 | [] | no_license | //example 1
try{
console.log('try start')
throw new Error('test error')
}catch(ex){
console.error('inner',ex.message)
}finally{
console.log('try end')
}
//example 2
(()=>{
try{
console.log('try start')
throw new Error('test error')
return 'try'
}catch(ex){
console.error('inner',... | true |
9572b22b2e14313993c58987ae6456aca9edcaab | JavaScript | mserranom/tableschema-js | /test/types/any.js | UTF-8 | 495 | 2.5625 | 3 | [
"MIT"
] | permissive | const { assert } = require('chai')
const types = require('../../src/types')
// Constants
const TESTS = [
['default', 1, 1],
['default', '1', '1'],
['default', '3.14', '3.14'],
['default', true, true],
['default', '', ''],
]
// Tests
describe('castAny', () => {
TESTS.forEach((test) => {
const [format... | true |
3da642a2bb4381fa5ee32fb2cc4b07d00d4a78f3 | JavaScript | nickrttn/weekoffood | /lib/helpers.js | UTF-8 | 2,454 | 2.53125 | 3 | [] | no_license | 'use strict';
// Require modules
const fs = require('fs');
const request = require('request');
const gravatar = require('gravatar');
const path = require('path');
const Grid = require('gridfs-stream');
// Require libs
const db = require('../lib/mongodb');
// Require models
const User = require('../models/user');
//... | true |
fa56a3797682c0041d1626793be3e131a7268450 | JavaScript | moactum/archived_moacscan | /templating.js | UTF-8 | 1,823 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | const nunjucks = require('nunjucks');
function syntaxHighlight(json) {
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls... | true |
f4e437ce92a660a845226c54bc9ed9450089ddb7 | JavaScript | fil7/154329-code-and-magick | /src/js/forms/review-form/checkForm.js | UTF-8 | 1,765 | 2.78125 | 3 | [] | no_license | 'use strict';
define(function() {
var nameField = document.getElementById('review-name');
var commentField = document.getElementById('review-text');
var formSubmitButton = document.querySelector('.review-submit');
var mandatoryLabels = document.querySelector('.review-fields');
var commentLabelMandatory = doc... | true |
ece68c536e8e96918e5ce396af7e932da89e28d1 | JavaScript | princequator/reactcrash | /src/components/Header.js | UTF-8 | 725 | 2.578125 | 3 | [] | no_license | import PropTypes from 'prop-types';
import Button from './Button';
// import Nav from "./Nav";
export const Header = (props) => {
const onClick = (e) => {
console.log("Button Clicked", e)
}
//const t = props.title;
return (
<header className="header">
Header
{/*... | true |
87fafed8c72eb8ca3d7e7c739763edb6e5694213 | JavaScript | Arty-ux/ReactWeather | /example-arrow-functions.js | UTF-8 | 823 | 3.84375 | 4 | [] | no_license | var names = ['Arty','Ausra','Matt'];
/*names.forEach(function (name) {
console.log('forEach', name);
});
console.log('-----');
names.forEach((name) => {
console.log('arrowFunc', name);
});
console.log('-----');
names.forEach((name) => console.log(name));
console.log('-----');
var returnMe = (name) => name + '!';... | true |
9c6619f364e512a8f37567940dc4f13d1062ea7a | JavaScript | vock98/biota_client | /view/scripts/script.js | UTF-8 | 1,102 | 2.546875 | 3 | [
"MIT"
] | permissive | // employee-id-input
$("#number_btn li").click(function(){
var $number = $(this).data("number"),
$input = $("#employee"),
$input_val = $input.val(),
$maxlength = $input.prop("maxlength");
switch($number){
case 11:
$input.val("");
break;
case 12:
event.preventDefault();
alert("script.js >... | true |
fa14a0a7ca3a5ab089d511974ad245aa581f53a5 | JavaScript | VetReseau/react-core | /src/app/helpers/routes-translator.js | UTF-8 | 1,206 | 2.703125 | 3 | [
"MIT"
] | permissive | function routeLanguageSwitcher(route, translations, currentLanguage, newLanguage) {
const reverseRoutes = {};
Object.keys(translations[currentLanguage])
.filter((translationKey) => translationKey.includes('routes'))
.forEach((key) => reverseRoutes[translations[currentLanguage][key]] = key);
const transla... | true |
801f4a5671117db84bb7f7a9669df484c588af98 | JavaScript | Lixianlai-2/Learn-Js-From-Jonas | /complete-javascript-course-master/05-Guess-My-Number/final/纯抄代码.js | UTF-8 | 1,706 | 3.5625 | 4 | [] | no_license | 'use strict';
let secretNumber = Math.trunc(Math.random() * 20) + 1;
let score = 20;
let highscore = 0;
const displayMessage = function (message) {
document.querySelector('.message').textContent = message;
};
document.querySelector('.check').addEventListener('click', function () {
const guess = Number(document.q... | true |
6cf7c7bccc8726f73067cedc86be31e79fc67882 | JavaScript | tirthshah147/Booster_Batch_Codes | /React JS Sessions/hooks/src/components/UseMemo.js | UTF-8 | 796 | 3 | 3 | [] | no_license | import React from 'react'
import { useState,useEffect, useMemo } from 'react'
// user = {name: "Tirth", likes:likes} -> 3000
// user = {name: "Tirth", likes:likes} -> 4500
export default function UseMemo() {
// console.log("Starting...");
const [num,setNum] = useState(0);
const [likes,setLikes] = useState(0);
... | true |
5cf0e923a97d818e2dc8118226ac5d12d73ba8ed | JavaScript | TremblingOdin/FallingSand | /scripts/game.js | UTF-8 | 887 | 3.015625 | 3 | [] | no_license |
class Game {
constructor(width, height) {
/* Scaling for device */
const onscreenPixelRatio = window.devicePixelRatio;
const onscreenScaledWidth = onscreenPixelRatio * width;
const onscreenScaledHeight = onscreenPixelRatio * height;
const onscreenCanvas = document.getElementById("mainCanvas");
ons... | true |
87afbc1162844a9ab20ec886670f8d55f81edeb1 | JavaScript | JakePitman/portfolio-2_0 | /src/components/AboutMeSubComponents/StaggeredAppearanceParagraph.js | UTF-8 | 3,971 | 2.578125 | 3 | [] | no_license | import React from 'react';
import styled, { keyframes } from 'styled-components';
import lifecycle from 'react-pure-lifecycle';
import generateScrollEffect from '../../utilities/generate-scroll-effect';
import SubHeading from '../SubHeading';
import { MAIN_PARAGRAPH_FONT } from '../../constants/fonts';
import getMainC... | true |
b66180d4c26255022401a16e4343dca145067db8 | JavaScript | borie88/wxparse-richtext | /sample.js | UTF-8 | 455 | 2.515625 | 3 | [] | no_license | // page.js
const Html = require('/parse-rich/html.js');
Page({
data: {
item: {}
nodes: []
},
onLoad: function () {
getItem().then(item => {
this.prepareBody(item.body)
})
},
prepareBody: function (body) {
var nodes
function start (body) {
return Html.html2json(body, 'main')
}
... | true |
f28356f30c1d375d39eec8cae42a576fec6f252c | JavaScript | lisalinlizhe/Leetcode | /Google/447_NumberOfBoomerange_review.js | UTF-8 | 607 | 3.296875 | 3 | [] | no_license | /**
* Created by lizhelin on 18/9/9.
*/
// pay attention to where we put the map (where we init the map!).
var numberOfBoomerangs = function(points) {
var res = 0;
for(var i = 0; i < points.length; i++) {
var map = {};
for(var j = 0; j < points.length; j++) {
if(i === j) continue;
var dis = ge... | true |
f9641a4160b3ce7706b0d1d3fb9aad5ab58b7b4d | JavaScript | visualkhh/book-visualkhh | /it/html5/html5_API/source_사전처럼 바로 찾아쓰는 HTML5 핵심API/chapter3/3_10_2.js | UTF-8 | 728 | 3.078125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
// 2D컨텍스트
var canvas = document.querySelector("canvas");
var context = canvas.getContext("2d");
// 선의 공통속성
context.lineWidth = 20;
context.strokeStyle = "black";
// lineJoin의 값
var types = ['bevel', 'round', 'miter'];
// 세 종류의 선을 그림
for( i=0; ... | true |
3b7f670f20d1e3655fdf7269d2053f5db37e8275 | JavaScript | charlottetan/Algorithms-2 | /Arrays/twoNumberSum.js | UTF-8 | 776 | 3.875 | 4 | [] | no_license | // Find sum of two number and return indices
// https://leetcode.com/problems/two-sum/
const twoNumberSum1 = (nums, targetSum) => {
const map = {}
const numLen = nums.length
for (let i = 0; i < numLen; i++) {
const complement = targetSum - nums[i]
if (complement in map) {
return [map[complement... | true |
d46a1f6a3897ff3956c00efe6636cb8c8c2a6f06 | JavaScript | mbrinkmeier/abbozza-calliope | /pkg/js/abbozza/calliopeC/blocks/Motor.js | UTF-8 | 5,037 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /**
* @license
* abbozza!
*
* Copyright 2015 Michael Brinkmeier ( michael.brinkmeier@uni-osnabrueck.de )
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/... | true |
9dcbf94da1e91bfc0ea3fa17fff3eebb24bc2048 | JavaScript | jinho6225/hackerRank | /Stacks/Maximum Element.js | UTF-8 | 922 | 3.296875 | 3 | [] | no_license | function processData(input) {
let arr = input.split('\n')
let stack = []
arr = arr.slice(1)
let array = []
for (let i = 0; i < arr.length; i++) {
if (arr[i].includes(' ')) {
array.push(arr[i].split(' '))
} else {
array.push(Number(arr[i]))
}
}
... | true |
ebf53357ad02c6bbe3639c40ef087b0ab2af6c72 | JavaScript | zhoujiaping/doc | /leetcode/0066-plusOne.js | UTF-8 | 494 | 3.453125 | 3 | [] | no_license | //let max = Math.pow(2,53)//9007199254740992
var plusOne = function(digits) {
digits[-1]=0
let carry = 1,i=digits.length-1
while(carry>0){
digits[i] +=carry
carry = digits[i]/10|0
digits[i] %= 10
i--
}
if(digits[-1]>0)digits.unshift(digits[-1])
delete digits[-1]
... | true |
923834da157117b7fe8a62c74b8865e4d610da32 | JavaScript | daggi29a/usta | /client/src/components/ShowStuff2.js | UTF-8 | 1,168 | 2.65625 | 3 | [] | no_license | // Example of component you can copy/paste to create new components
import React, { Component } from 'react';
// import { Route, Switch, NavLink, Link } from 'react-router-dom';
// import api from '../api';
// import './Sample.css';
import { Button } from 'reactstrap';
class ShowStuff extends Component {
showVmen... | true |
1ff79db253c28bbf5e7726b0a5c31b7df6ca04b8 | JavaScript | ritstudentgovernment/evals | /server/termCode.js | UTF-8 | 298 | 2.921875 | 3 | [
"MIT"
] | permissive | /* Data sources represent term codes differently, e.g., as 2141 -or- 20141.
* The evaluation system persists all codes as a 5 digit Number.
*/
Meteor.getStdTermCode = function (termCode) {
return (termCode.length == 5) ? Number(termCode) : Number(termCode[0] + "0" + termCode.substr(1,3));
};
| true |
67cdb53348cdd4eb2606c6e1b6ec50aa1b04ac06 | JavaScript | VictorFarfan98/Desarrollo-de-Apps | /UFMAppDevelopment 2/www/js/NotaNueva_JS.js | UTF-8 | 9,724 | 3.234375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function showTextModal(){
// Get the modal
var modal = document.getElementById('myTextModal');
// Get the button that opens the modal
var btn = document.getElementById("myTextBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// ... | true |
572597be7b015a3aa1e8a97b313069fee1f1782b | JavaScript | ivdim1992/JavaScript-Core | /JS Fundamentals/ObjectsExercises/storeCatalogue.js | UTF-8 | 1,038 | 3.21875 | 3 | [] | no_license | function catalogue(strArr) {
let summary = new Map();
for(let row of strArr){
let [product,price] = row.split(/\s:\s/g);
price = Number(price);
let firstInitial = product[0];
if(!summary.has(firstInitial)){
summary.set(firstInitial,new Map());
}
let... | true |
1ce31ea079f5611c7e0d59d4430cc571ee6027fa | JavaScript | nealxyc/jSanno | /test/object-prototype-test.js | UTF-8 | 1,434 | 2.765625 | 3 | [] | no_license | (function(){
var test = NUnit.Test("test that the Object is writtable.");
test.objectGetOwnPropertyDescriptor = function(a){
a.notNull(Object["getOwnPropertyDescriptor"], "Object.getOwnPropertyDescriptor() function should not be null");
};
test.objectWritable = function(a){
var config = Object.getOwnPropertyDe... | true |
2e8e1c95659a8b27f51ff0e4c136945abe591b47 | JavaScript | ltl237/Llamas-CreativeCoding-F16 | /stella.js | UTF-8 | 393 | 3.1875 | 3 | [] | no_license | var d = 300;
var offset = 15;
function setup(){
createCanvas(600,600);
background(200);
}
function draw(){
//ellipse(width/2, height/2, d, d);
//ellipse(width/2, height/2, d-20, d-20);
//for(start condition; exit condition; iterator){
// ellipse(width/2, height/2, d, d);
//}
for (var i = 0; i < 10;... | true |
06a8ca1ced7321e068500652e4b9d5eb121cee82 | JavaScript | jspruance/weatherapp-react | /src/components/WeatherContainer.js | UTF-8 | 4,465 | 2.765625 | 3 | [] | no_license | import React, { Component } from "react";
import Search from "../components/Search";
import WeatherCard from "../components/WeatherCard";
class WeatherContainer extends Component {
constructor() {
super();
this.state = {
searchedcurrentconditions: {},
savedcurrentconditions: [],
savedlocati... | true |
9f1f7d86a15edb19eca160f77651079e701e254b | JavaScript | npmcdn-to-unpkg-bot/course-angular | /js-design-patterns/js/cadsystem_old.js | UTF-8 | 11,844 | 3.15625 | 3 | [] | no_license | function init() {
var canvas = document.getElementById('canvas');
if (canvas !== null && canvas.getContext){
var ctx = canvas.getContext('2d');
loadDynamic('js', 'shape_decorators.js', function() { test1(ctx);});
} else {
alert("Problem creating canvas 2D drawing context");
}... | true |
22d46665baf530940375c16f0d47054bcf42a781 | JavaScript | DHAIRYASINDHWANI/Virtual-Pet-1 | /sketch.js | UTF-8 | 907 | 3.453125 | 3 | [] | no_license | //Create variables here
var dog, dog1, happyDog, database, food, foodStock;
function preload()
{
//load images here
happyDog = loadImage("images/dogImg1.png");
dog1 = loadImage("images/dogImg.png");
}
function setup() {
createCanvas(500, 500);
database = firebase.database();
dog = createSprite(250, 300, 1... | true |
29c08663b6f9aa006a53d28ef9a61896b18c58ce | JavaScript | fernanda1411/sei-premium-prep-72 | /SelfAssessment1 - final/Exercise9/arraysAndStrings/arraysAndStrings.js | UTF-8 | 745 | 4.8125 | 5 | [] | no_license | /*
Write a function nextTwoBusTimes which takes
in an array of numbers representing (in minutes)
when the busses come for the day. Your function
should return a string which denotes when the
nearest bus arrives, and the one after that.
//Write a function nextTwoBusTimes
//takes in an array of numbers
//repres... | true |
b6f6735f0f730de52d6f5bb7b5eac502d8a33688 | JavaScript | benbaler/qnsee | /assets/js/functions.js | UTF-8 | 2,571 | 2.5625 | 3 | [] | no_license | $(document).ready(function () {
// Detect whether device supports orientationchange event, otherwise fall back to
// the resize event.
/*var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
window.addEven... | true |
3620e626e87c672e37984a635ef4aae9b0be4aaf | JavaScript | jackkrebsbach/partner-maker | /utils/main.js | UTF-8 | 1,529 | 3.84375 | 4 | [] | no_license | /*
Function that will reate partners and a return an object with the students as keys and the partners as values.
*/
const getPartners = (students) => {
students.length % 2 === 0 ? students : students.push("No Partner");
let length = students.length;
// Initilaizing Array of Partners
let partners = {}; // cr... | true |
0a868ec85fb0d50d6742f228370c8cb7c447fdca | JavaScript | Mike-Savin/employee-list-website | /client/js/controllers/employees/index.js | UTF-8 | 825 | 2.59375 | 3 | [] | no_license | var EmployeesIndexController = function($scope, prompt, Employee) {
$scope.employees = [];
$scope.delete = function (employee) {
prompt({
title: 'Delete',
message: 'Are you sure you want delete ' +
employee.firstName + ' ' + employee.lastName + '?'
}).then(function () {
return Empl... | true |
25317c19ba69701ce94ee04ec778c018f260b08d | JavaScript | umbcgdc/umbcgdc.github.io | /warhorse/Horse.js | UTF-8 | 2,113 | 3.3125 | 3 | [] | no_license | // WARHORSE BUT IT'S SIMPLE
// helper functions
function irandom_range(n1, n2) {
if (n1 < n2) {
var minn = Math.ceil(n1);
var maxx = Math.floor(n2);
} else {
var minn = Math.ceil(n2);
var maxx = Math.floor(n1);
}
return Math.floor(Math.random() * (maxx - minn + 1)) + minn;
}
const TRAINING = [... | true |
b4f60722c4c8a55f209d10159026260729eb7014 | JavaScript | Bozhidar83/Software-University | /Advanced-JavaScript/08.AMD-and-RequireJs/Homework-AMD-and-RequireJS/js/models/container.js | UTF-8 | 3,014 | 3.203125 | 3 | [] | no_license | define(['section'], function(Section) {
return (function () {
function Container(dayOfWeek) {
this._dayOfWeek = dayOfWeek;
this._sections = [];
}
Container.prototype.addToDOM = function () {
var parentElement = document.getElementById('wrapper');
... | true |
68dce4a0db431e5917efe85cbb3438851c8224ac | JavaScript | felichio/radiancejs | /source/identity.js | UTF-8 | 211 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* @description
* Identity function. Returns the first passed argument
* @signature
* a -> a
* @example
* let result = identity(3);
* //-> 3
*/
const identity = x => x;
export default identity; | true |
54f632134db6533304882cce33a88b11a1f62149 | JavaScript | BlueBoi904/LeetCode-HackerRank-Challenge-Solutions | /JS/array-string.js | UTF-8 | 1,039 | 4.125 | 4 | [] | no_license | /*
Task
Given a string, , of length that is indexed from to , print its even-indexed and odd-indexed
characters as space-separated strings on a single line (see the Sample below for more detail).
Note: is considered to be an even index.
Input Format
The first line contains an integer, (the number of test cas... | true |
918dc32c7b8e2137c1b42d6139c04642b4340246 | JavaScript | wojdzie/project-euler | /problems/problem-10.js | UTF-8 | 454 | 3.8125 | 4 | [] | no_license | // Problem 10: Summation of primes
// Find the sum of all the primes below n
function primeSummation(n) {
let sieve = new Array(n);
for (let i = 2; i < n; i++) {
for (let j = i; j < n; j += i) {
if (sieve[j] === undefined) {
sieve[j] = i;
}
}
}
le... | true |
649e74dc86421e1ffced059a03537e7f85a4e8ed | JavaScript | howkj1/Phaser-1 | /server.js | UTF-8 | 680 | 2.515625 | 3 | [] | no_license | var http = require('http'),
fs = require('fs'),
url = require('url'),
phaser = fs.readFileSync('phaser.html');
http.createServer(function (req, res) {
var action = url.parse(req.url, true).pathname;
if( action.indexOf(".png") > 0) {
var img = fs.readFileSync("." + action);
res.writeHead(200, {'Content-Type': ... | true |
1d4029d56583503b2ef8d02ce11f2a0766f34eff | JavaScript | Code-Institute-Submissions/Discover-Dublin | /assets/js/weather.js | UTF-8 | 2,173 | 3.421875 | 3 | [] | no_license | // https://bithacker.dev/fetch-weather-openweathermap-api-javascript - code that helped with weather API
function weatherBalloon( cityID ) {
var key = 'e33520267233b063fa7fb34f23828f0f';
fetch(' https://api.openweathermap.org/data/2.5/weather?id=' + cityID+ '&appid=' + key)
.then(function(resp) { retu... | true |
66837b499fb1cfdc7ec9c64fbbb5663b69579699 | JavaScript | wcylou/PersonalSite | /html/js/main.js | UTF-8 | 1,673 | 2.875 | 3 | [] | no_license | $(document).ready(function() {
// Add smooth scrolling to all links
$("a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var ... | true |
d5cb35552885c643e6527d139007ec6ad6997c87 | JavaScript | LeonardoVelarde/ucbacm | /tests/coderPersistor.test.js | UTF-8 | 2,595 | 2.546875 | 3 | [] | no_license | var CoderPersistor = require('../models/CoderPersistor');
var Coder = require('../models/Coder');
var assert = require('chai').assert;
var pg = require('pg').native;
var Pool = pg.Pool;
var DBconfig = {
user: 'postgres', //env var: PGUSER
database: 'ucbacm', //env var: PGDATABASE
password: 'postgres', //env var:... | true |
73d59df6c239f0c71be08a56173720f25fbdc713 | JavaScript | marcecabelloh/insta-collage | /assets/js/main.js | UTF-8 | 475 | 3.125 | 3 | [] | no_license |
//api drag and drop
function drag(ev){ //ev de event es lo mismo, los atributos pueden variar
ev.dataTransfer.setData('text', ev.target.id);
//img se lee como text en el navegador
//target es el objetivo
}
function finalDrop(ev){
ev.preventDefault();
//SIEMPRE se pondrá esto
}
function drop(ev){
ev.preve... | true |
0cf036f0e891e2e8b55b8a780d855df78f621f83 | JavaScript | asutoshb/user-crud-MVC | /src/controllers/user.controller.js | UTF-8 | 2,033 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const User = require('../models/user.model');
const Post = require('../models/post.model');
const Comment = require('../models/comment.model');
router.post("/",async function (req, res) {
const user = await User.create(req.body);
return r... | true |
6a47ae390aff1220690fa60742932e6bf353f97c | JavaScript | yucanon/prela | /view/js/script.js | UTF-8 | 664 | 2.546875 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////
// SCRIPT
////////////////////////////////////////
$(function(){
var setImg = $('.switch'),
namePc = '_pc',
nameSp = '_sp',
switchWidth = 640;
setImg.each(function(){
var selfImg = $(this);
function switchImg(){
if(window.innerWidth > switchWidth) {
... | true |
371c7777e2050ec20a567b49dd28647c522262d4 | JavaScript | monika200/NODE-TASK-1 | /index.js | UTF-8 | 1,527 | 2.796875 | 3 | [] | no_license | const os = require('os');//1 module
const path = require("path");//2 module
const fs = require("fs");
const http = require("http");
let httpserver =http.createServer((req,res)=>{
res.end("Welcome")
})
httpserver.listen(3000);
fs.writeFile("book.txt","Hello How are you?",(err)=>{
if(err)... | true |
7c4f7ef1caf462b7b5ee531fdcf796b334ca204e | JavaScript | derekrliang/funnies | /src/index.js | UTF-8 | 1,387 | 2.65625 | 3 | [
"MIT"
] | permissive | import _ from 'lodash';
import defaultMessages from './funnies';
import FunniesComponent from './react';
class Funnies {
constructor(messages=[]) {
this.messages = defaultMessages.concat(messages);
// convert messages into a map of message to how many times it has been
// used.
this.record = {};
... | true |
fcfa0563102c559d8e0b0ca0e61686248cce0e8e | JavaScript | aofolts/fthelines | /src/utilities/data.js | UTF-8 | 936 | 2.734375 | 3 | [
"MIT"
] | permissive | export const normalizeEntry = entry => {
if (entry.fields) {
Object.assign(entry,entry.fields)
delete entry.fields
}
entry.type = getEntryType(entry)
entry.isPublished = entryIsPublished(entry)
entry.type = getEntryType(entry)
const fieldKeys = Object.keys(entry)
fieldKeys.forEach(key => {
... | true |
a641fd47ef9e2230015ff53e0dfeadd0b3f185f9 | JavaScript | SynergyDataSystems/pacman-public | /game/grafics.js | UTF-8 | 6,538 | 3.015625 | 3 | [
"MIT"
] | permissive | var now;
var then = Date.now();
var interval_frame = 1000/fps;
var delta;
/*
* This method handles the whole view site of the game.
*/
function draw() {
requestAnimationFrame(draw);
now = Date.now();
delta = now - then;
if (delta > interval_frame) {
// update time stuffs
... | true |
d4cd459afe0dd610d56bb1af0f63486042cd1fd8 | JavaScript | kalepadot/CatBoard2.0 | /catboard-interface-2/src/components/PostList.js | UTF-8 | 1,061 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, {useEffect, useState} from 'react';
import PropTypes from 'prop-types'
import PostComponent from './PostComponent'
import PostDetails from './PostDetails'
function PostList(props){
const [view, setView] = useState(<p>Loading...</p>)
useEffect(() => {
get();}, []
);
const get = () => {
... | true |
0fa3e893fdeed9991c05ed0be2c94be5dc8aff03 | JavaScript | LCHCAPITALHUMAIN/awsPlaybox | /nodejs/lambda/returnDataToCaller.js | UTF-8 | 645 | 3.09375 | 3 | [] | no_license | exports.handler = (event, context, callback) => {
var resultString = "";
var timestamp = new Date();
console.log('firstName =', event.firstName);
console.log('lastName =', event.lastName);
console.log('email =', event.email);
for (var i=0; i < event.classes.length; i++) {
conso... | true |
910d20e24e6a69b0fd4299b34a93e387b32c5eb9 | JavaScript | jbirkland/engTeam_empInfo | /index.js | UTF-8 | 3,700 | 3.203125 | 3 | [] | no_license | let inquirer = require('inquirer');
const path = require("path");
const fs = require("fs");
const Employee = require("./public/employee")
const Manager = require("./public/manager");
const Engineer = require("./public/engineer");
const Intern = require("./public/intern");
const render = require("./public/htmlRenderer"... | true |
10e8881e4d5e6b64c44719a226569258ae16e7cc | JavaScript | Cess-Uyi/BP-backend | /index.js | UTF-8 | 2,107 | 2.765625 | 3 | [] | no_license | // function openNav() {
// console.log("open");
// let sideNav = document.getElementById("side-nav");
// let openBtn = document.getElementById("open-btn");
// let closeBtn = document.getElementById("close-btn");
// console.log("open-btn ", openBtn.style.display);
// console.log("close-btn ", closeBtn.style.... | true |
d879f302b5eb03bef2fa81cd4e2409175e51e714 | JavaScript | krmayank911/api_inplay | /user_modules/routes.js | UTF-8 | 1,045 | 2.71875 | 3 | [] | no_license | var webScrapper = require('./web_scrapper.js');
module.exports = function(app){
// =============================Get Method=============================
app.get('/',function(req,res){
// res.send("its working");
res.send("Api Connection done");
});
// ---------------------------------------------------... | true |
637e35f1fbb1b1cb592b625215341fd3fb72663c | JavaScript | wipaaa/react-tic-tac-toe | /src/components/App.jsx | UTF-8 | 1,847 | 3.015625 | 3 | [] | no_license | import { useState } from 'react';
import './App.scss';
import Board from './Board/Board';
import History from './History/History';
import Status from './Status/Status';
const App = () => {
const PLAYER_X = 'x';
const PLAYER_O = 'o';
const [history, setHistory] = useState([{ squares: Array(9).fill(null) }]);
... | true |
5b8fbf9655a46efb47f04f22c2ad22ac3f254fba | JavaScript | snowy-white/redux-example | /app/component/TodoForm.jsx | UTF-8 | 998 | 2.703125 | 3 | [] | no_license | import React, {Component, PropTypes} from 'react';
class TodoForm extends Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
}
handleChangeValue(event) {
this.setState({ value: event.target.value });
}
render() {
var value ... | true |
e604430efe103e3ee827ba22bc089fde469dd96d | JavaScript | George-Payne/react-render-to-markdown | /src/components/block/Quote.js | UTF-8 | 1,171 | 2.703125 | 3 | [
"MIT"
] | permissive | import Component from '../../constructors/Component';
class Quote extends Component {
kind = 'block';
renderChildren(pre) {
for (let i = 0; i < this.children.length; i += 1) {
if (typeof this.children[i] === 'string') {
this.root.doc[this.root.doc.length - 1] += this.childr... | true |
bad0fc4997be72c15b7788b53cb8e412aa608c82 | JavaScript | moguonyanko/moglabo | /lang/java/webcise/web/esproposal/globalthis/sharedworker.js | UTF-8 | 401 | 2.65625 | 3 | [] | no_license | /**
* globalThis調査用SharedWorker
* SharedWorker内のコードChromeでデバッグするには以下にアクセスする。
* chrome://inspect/#workers
*/
globalThis.onconnect = event => {
console.log(`self === globalThis: ${self === globalThis}`);
const port = event.ports[0];
port.onmessage = e => {
port.postMessage(e.data.reduce((acc, current) => a... | true |
31f6c45b1e99804f96902e1c812e8123c885416f | JavaScript | kelajatu/algorithms-repo | /Leetcode/Strings/countAndSay.js | UTF-8 | 763 | 4.53125 | 5 | [] | no_license | // The count-and-say sequence is the sequence of integers with the first five terms as following:
// 1. 1
// 2. 11
// 3. 21
// 4. 1211
// 5. 111221
// 1 is read off as "one 1" or 11.
// 11 is read off as "two 1s" or 21.
// 21 is read off as "one 2, then one 1" or 1211.
// Given an integer n where ... | true |
830f34e51aa89bb83b6b105a43df910b3861469f | JavaScript | warwick-one-metre/dashboard | /static/w1m-reduction.js | UTF-8 | 1,867 | 2.75 | 3 | [
"MIT"
] | permissive | function reductionFrameDate(data) {
if (!data || !('date' in data))
return ['ERROR', 'text-danger']
var date = parseUTCDate(data['date']);
return [formatUTCDate(date)]
}
function reductionFrameExposure(data) {
if (!data || !('exptime' in data))
return ['ERROR', 'text-danger']
return [data['exptime']... | true |
b5ffa83a9f3a0d082848902cabfed90f7f13937f | JavaScript | thelonious/kld-webassembly-reader | /lib/sections/CodeSection.js | UTF-8 | 1,070 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | let Section = require('./Section'),
ReadBuffer = require('../ReadBuffer');
class CodeSection extends Section {
constructor() {
super(10);
this.bodies = [];
}
get typeName() {
return "CodeSection";
}
read(buffer) {
let count = buffer.readVarUint(32);
fo... | true |
8fe2387af24a029241b862c21e460d3c57c20654 | JavaScript | Loksli17/math-train | /lib/pagination.js | UTF-8 | 3,618 | 2.703125 | 3 | [] | no_license | function Pagination(_params){
// this.pageOffset = _params.pageOffset;
this.pageSize = _params.pageSize;
this.limit = _params.limit;
this.url = _params.url;
this.count = _params.count;
this.maxPage = Math.ceil(_params.count / this.limit);
this.page = _params.page;... | true |
c893cd876d806f5b7fc205bc5597fd0de64a9d75 | JavaScript | corefw/core-common | /lib/fs/adapter/Local.js | UTF-8 | 1,807 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* @file
* Defines the Core.fs.adapter.Local class.
*
* @author Luke Chavers <me@lukechavers.com>
* @version 1.0
* @copyright 2019 C2C Schools, LLC
* @license MIT
*/
"use strict";
// Load dependencies using the Core Framework
const { _, TIPE, FS, GLOB, PATH } = Core.deps( "_", "tipe", "fs", "glob", "path" ... | true |
8539279223babe05eebb30ac4c2e568d8c10bced | JavaScript | rajat-kushawaha/cli-calculator | /test/testLanguageInterpreter.js | UTF-8 | 805 | 2.78125 | 3 | [] | no_license | const assert = require('assert');
const { performCalculation } = require('../src/languageInterpreter');
describe('performCalculation', function() {
it('should add two numbers and give result', () => {
const actual = performCalculation('add', 6, 'to', 4);
assert.strictEqual(actual, 10);
});
it('should su... | true |
a167234e450fd9942a66c2c8d96827ca2e86211a | JavaScript | adityakadakia/webdev | /public/assignment/client/views/forms/fields.controller.js | UTF-8 | 7,207 | 2.546875 | 3 | [] | no_license | "use strict";
(function () {
angular
.module("FormBuilderApp")
.controller("FieldController", FieldController);
function FieldController($routeParams, FormService, FieldService) {
var model = this;
model.addField = addField;
model.removeField = removeField;
model... | true |
da29b04b9f44e56d33b27b04934338f2cf0ddfa8 | JavaScript | skybluecat/skybluecat.github.io | /confluence/game/core_libs/mcts.js | UTF-8 | 8,026 | 3 | 3 | [] | no_license | /* Takes an instance of a Board and optionally some keyword
arguments. Initializes the list of game states and the
statistics tables.
*/
function MonteCarlo(board, state, turnsTaken, options) {
this.board = board;
this.states = deepClone(state);
this.wins = {'eve': {}};
this.plays = {'... | true |
e321c6c6a182b0b95d904e3a72971cb0eec38c5b | JavaScript | nicholasrwx/timer | /timer1.js | UTF-8 | 227 | 2.984375 | 3 | [] | no_license | const time = process.argv.slice(2);
console.log(time);
for (let t of time) {
if (t > 0 && !isNaN(t)) {
t *= 1000;
setTimeout(() => {
process.stdout.write("beep\n");
}, t);
}
}
console.log(process.argv);
| true |