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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4609e84cf4f1b6068e0c69804b874121405ca68d | JavaScript | pavelhristov/JSFundamentals | /UsingObjects/youngest-person.js | UTF-8 | 971 | 3.515625 | 4 | [
"MIT"
] | permissive | function solve(args) {
function makePerson(firstName, lastName, age) {
return {
firstname: firstName,
lastname: lastName,
age: Number(age),
toString: function() {
return this.firstname + ' ' + this.lastname;
}
};
}
v... | true |
38be427420585fa959779d6b60ab408b9924d568 | JavaScript | glassdome/blogowanie | /src/components/PostForm.js | UTF-8 | 2,745 | 2.75 | 3 | [] | no_license | import React from 'react';
import moment from 'moment';
class PostForm extends React.Component {
constructor(props){
super(props)
this.state = {
title: props.post ? props.post.title : '',
body: props.post ? props.post.body : '',
author: props.post ? props.post.author: '',
timestamp: ... | true |
10452a2b4aeaf6e97d8ceff9eb96acc3208827b1 | JavaScript | orbitmechanic/CryptoZoo | /client/assets/js/index.js | UTF-8 | 630 | 2.71875 | 3 | [
"Unlicense"
] | permissive | $(document).ready(function() {
// Activate index.html renderings
console.groupCollapsed('animal::constructor()');
var willCallAnimals = [];
// Instantiate
for (var i= 1; i<=5; i++) {
willCallAnimals.push(new animal('lineup' + i));
$('.col.lineup.slot' + i).prepend(
... | true |
79ca0044d7f43dbad54bc8dbaa1a63e969701238 | JavaScript | finmix/IrishWeather | /app.js | UTF-8 | 4,016 | 3.1875 | 3 | [] | no_license | var UI = require('ui');
var ajax = require('ajax');
var Vector2 = require('vector2');
var weather = require('weather');
// Show splash screen while waiting for data
var splashWindow = new UI.Window();
// Text element to inform user
var text = new UI.Text({
position: new Vector2(0, 0),
size: new Vector2(144, 168... | true |
58f3815b5d0a087b60996a0a657d311ff195a7b8 | JavaScript | NiaLikesCode/Japanese-Study-Helper-UI | /tests/shared/utility.test.js | UTF-8 | 5,544 | 2.984375 | 3 | [
"MIT"
] | permissive | import { findObjectInHTML, removeAllInstancesByTag, removeAllInstancesByAttribute } from '../../src/shared/utility';
import { parse } from 'node-html-parser';
describe('findObjectInHTML()', () => {
let object, property, value;
beforeEach(() => {
object = parse(`
<div id="parent" class="myC... | true |
bc4103e4152c82c9c80bb18e1b94c4c4fb0e58ed | JavaScript | arthurfcs98/LearningJS | /Fundamentals/Boolean.js | UTF-8 | 221 | 3.09375 | 3 | [] | no_license | let isAtivo = false
console.log(isAtivo)
isAtivo = true
console.log(isAtivo)
isAtivo = 1
console.log(!!isAtivo)
isAtivo = 0
console.log(!!isAtivo)
console.log('True')
let name = ''
console.log(name || 'Undefined')
| true |
2f6b3a5ac8b3200951185b9c3f2d072ba970534a | JavaScript | rrees/nanochoo-playground | /template/app.js | UTF-8 | 536 | 2.859375 | 3 | [] | no_license |
import choo from 'nanochoo';
import html from 'nanohtml';
function helloView(state, emit) {
function onclick() {
emit('inc', 1);
}
return html`
<section>
<p>Current count is ${state.count}</p>
<div><button onclick=${onclick}>Inc</button></div>
</section>
`;
}
function countStore(state, emitter) {
... | true |
c6eaa2431d863a686edd18c49fa0d797d1d11f82 | JavaScript | msbabenko/test-tasks | /maze.js | UTF-8 | 2,773 | 3.203125 | 3 | [
"MIT"
] | permissive | let maze = [
['#','#','#','#','#','#','#','#','#'],
['#','+','+','+','#','+','+','+','#'],
['#','+','#','+','#','+','#','+','#'],
['+','+','#','+','0','+','#','+','#'],
['#','#','#','+','#','#','#','#','#'],
['#','#','+','+','#','#','#','#','#'],
['#','#','+','#','#','#','#','#','#'],
['... | true |
e7fabeeba16c383e0fad2cb829c35116463a6869 | JavaScript | liuchenwei2000/JavaScript | /11,DOM扩展/11.1,选择符API/querySelector.js | UTF-8 | 806 | 3.390625 | 3 | [] | no_license |
/**
* querySelector() 方法接收一个 CSS 选择符,返回与该模式匹配的第一个元素,
* 如果没有找到匹配的元素,返回 null。
*
* 通过 Document 类型调用该方法时,会在文档元素的范围内查找匹配的元素。
* 通过 Element 类型调用该方法时,只会在该元素后代元素的范围内查找匹配的元素。
* 如果传入了不被支持的选择符,会抛出错误。
*/
// 获取 body 元素
var body = document.querySelector("body");
// 获取 id 为 mydiv 的元素
var div = document.querySelec... | true |
7f12b1a17f5fbee8a1f747e6cc8de9f78d6f5f81 | JavaScript | wladimir917/DOM-I | /js/index.js | UTF-8 | 4,405 | 2.5625 | 3 | [] | no_license | const siteContent = {
"nav": {
"nav-item-1": "Services",
"nav-item-2": "Product",
"nav-item-3": "Vision",
"nav-item-4": "Features",
"nav-item-5": "About",
"nav-item-6": "Contact",
"nav-item-7": "Home",
"nav-item-8": "Log In",
"img-src": "img/logo.png"
},
"cta": {
"h1": "DOM... | true |
90914f2ded18e838af901f18b3a5ec33c30f8b9a | JavaScript | VaderSteve76/DOM-I | /js/index.js | UTF-8 | 4,721 | 2.65625 | 3 | [] | no_license | const siteContent = {
"nav": {
"nav-item-1": "Services",
"nav-item-2": "Product",
"nav-item-3": "Vision",
"nav-item-4": "Features",
"nav-item-5": "About",
"nav-item-6": "Contact",
"img-src": "img/logo.png"
},
"cta": {
"h1": "DOM Is Awesome",
"button": "Get Started",
"img-sr... | true |
38a0e81c16d82a8a522efdeba50e0606360cdb35 | JavaScript | NguyenKimQuoc/MobileProject | /server_node/public/functions/plantsfn.js | UTF-8 | 7,370 | 2.953125 | 3 | [] | no_license | var plantparse; // Đây là biến lưu chuỗi JSON về thông tin cây
$('#idPlantForm').submit(function () {
// Thông thường khi ấn SUBMIT trong form thì hệ thống sẽ tự động chuyển đến 1 trang khác
// Tuy ta sẽ handle việc này bằng cách gọi hàm "EditPlantAreas()" thay vì chuyển sang 1 trang mới.
EditPlantAreas();
return ... | true |
9e0bc70a040d42ea31df16b8a1aa8d4b9488d6c5 | JavaScript | charles-tai/recursion | /src/extractArrays.js | UTF-8 | 2,187 | 3.65625 | 4 | [] | no_license | // var obj = [ [ ['inner', [ ['hidden'] ]], 'outer' ] ];
// var newArr = [];
// function mapArrays (array, func) {
// function checkArray (ele) {
// ele.forEach( function (ele) {
// if (Array.isArray(ele)) {
// checkArray(ele);
// } else {
// return ele;
// }
// });
// }
... | true |
ae3b4ecc37bdcf08db1b984103e6d0732cb95786 | JavaScript | viet-vo-360/todo-list | /src/utils/functions/formReducer.js | UTF-8 | 2,132 | 2.875 | 3 | [] | no_license | import { v4 as uuidv4 } from "uuid";
import { openNotification } from "./openNotification";
export function todoReducer(state, action) {
const [title, date, category, isImportant] = action.payload;
switch (action.type) {
case "ADD_TODO":
openNotification("bottomLeft", "TODO added");
return state.c... | true |
dac1e0a1a1bddf48287575162493ccaa2b09af7a | JavaScript | rheehot/BaekJoon-Algorithm | /Node.js/1094.js | UTF-8 | 492 | 3.0625 | 3 | [] | no_license | const fs = require('fs');
let input = fs.readFileSync("dev/stdin").toString();
let variable = input.split(' ');
let wantlength = variable[0];
let originstick = 64;
let stick1, stick2, answerstick, garbagestick;
stick1 = 32;
stick2 = 32;
for(let i = 0;wantlength==answerstick;i++){
garbagestick =... | true |
929c856bf0472b22c28efe5b17c4e8af2b802271 | JavaScript | VictorBelikov/RSS-GAME | /src/components/tasks/sequence-day/sequence-day.test.js | UTF-8 | 805 | 2.78125 | 3 | [] | no_license | import SequenceDayTask from './sequence-day';
describe('class SequenceDayTask', () => {
it('-generateTemplate- is a function', () => {
expect(SequenceDayTask.generateTemplate).toBeInstanceOf(Function);
});
it('-generateTemplate- returns an object with 2 values - template and answer', () => {
expect(type... | true |
ae489769adfa3de77120d5da92c61724e1711862 | JavaScript | Heyvlu/MyLeetCode | /数据结构/二叉搜索树中的搜索.js | UTF-8 | 261 | 3.125 | 3 | [] | no_license | var searchBST = function(root, val) {
if(root==null) return null;
if(root.val==val){
return root;
}
if(root.val<val){
return searchBST(root.right,val);
}
if(root.val>val){
return searchBST(root.left,val);
}
}; | true |
7d4dff7cf0668450a310e445a9bf1618f437250a | JavaScript | hao-wang/Montage | /js-test-suite/testsuite/20ceea621c21ee1ab142c558e422585d.js | UTF-8 | 6,085 | 3.375 | 3 | [
"MIT"
] | permissive | var testCase = function (actual, expected, message) {
if (actual !== expected) {
throw message + ". Expected '" + expected + "', but was '" + actual + "'";
}
};
var txtMsg = 'Error: arguments is not lexically binded inside of the arrow function ';
function afFactory0() {
return a => arguments;
}
... | true |
303f1decbba93adc6c24aac848743c643788bbb7 | JavaScript | onlyonegabe/AdventOfCode2019 | /src/Day3/getWirePositions.js | UTF-8 | 1,206 | 3.234375 | 3 | [] | no_license | let coordinateMarks
let i
let x
let y
export default function getWirePositions(wire) {
initialize()
wire.forEach(markAllCooridinates)
return coordinateMarks
}
function initialize() {
x = 0
y = 0
coordinateMarks = []
}
function markAllCooridinates(item) {
let direction = item.substring(0, ... | true |
185b6e968ee4c512434846f939cd5083adf8e58f | JavaScript | EricOlaf/advanced-js | /practice.js | UTF-8 | 2,996 | 3.578125 | 4 | [] | no_license | // Create a lastYear method on the Date object to get the previous year from a date.
// Date.prototype.lastYear = function(){
// return this.getFullYear() - 1;
// }
// console.log(new Date('1900-12-2').lastYear())
// Array.prototype.map = function(){
// let newArr = []
// for(let i = 0; i < this.length; i... | true |
59e418959a4023d912b81379274452a770d36ad6 | JavaScript | ghigbie/React-Router-Simple-App | /src/components/Lifecycles/Lifecycles.js | UTF-8 | 587 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
class Lifecycle extends Component{
constructor(props){
super(props);
this.state = {
title: 'Lifecycle Component'
};
}
//this component convers the lifecycle of a component
componentWillMount(){
console.... | true |
461703a16100ea471238c76af760a66cd5cff574 | JavaScript | abdulazizcode/portfolio | /js/main.js | UTF-8 | 266 | 2.65625 | 3 | [] | no_license | function overlay() {
var checkBox = document.getElementById("close");
var overlay = document.querySelector(".overlay");
if (checkBox.checked == true){
overlay.style.display = "block";
} else {
overlay.style.display = "none";
}
} | true |
6dd87a844d1166e9a95f9e72a6f3ced4bcb4f498 | JavaScript | VasilyMur/topkovorking.ru | /models/Company.js | UTF-8 | 5,410 | 2.671875 | 3 | [] | no_license | const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
const slugify = require('slugify');
const validators = require('mongoose-validators');
const accounting = require('accounting');
const companySchema = new mongoose.Schema({
name: {
type: String,
trim: true,
required: 'Введите назва... | true |
c8bce192196d0b4ff90c7676d3cc8baf8494f804 | JavaScript | soheimam/visualiser-music | /sketch.js | UTF-8 | 857 | 3.171875 | 3 | [] | no_license | let song;
let amp;
let button;
let volhistory = [];
function toggleSong() {
if (song.isPlaying()) {
song.pause();
} else {
song.play();
}
}
function preload() {
song = loadSound('song.mp3');
}
function setup() {
createCanvas(1200, 800);
angleMode(DEGREES);
button = createButton('toggle');
bu... | true |
f7a644a3cefba41fb60e39b7abd52384a76e68b3 | JavaScript | lzvn/misc | /js/eloquent-js/ch17/pie.js | UTF-8 | 1,393 | 3.359375 | 3 | [] | no_license | const results = [
{name: "Satisfied", count: 1043, color: "lightblue"},
{name: "Neutral", count: 563, color: "lightgreen"},
{name: "Unsatisfied", count: 510, color: "pink"},
{name: "No comment", count: 175, color: "silver"}
];
document.addEventListener("DOMContentLoaded", () => {
let cx = document.querySelect... | true |
73c778c763c0133e83629482be2670796b91a883 | JavaScript | goncharovk911/homework2 | /homework2/10/10.js | UTF-8 | 79 | 3.453125 | 3 | [] | no_license | var number = prompt("Ведите число", )
alert(Math.pow(number, 2))
| true |
01efadd9a74f04c6f3464fe134d3472ef1227cb5 | JavaScript | algomaster99/markdown-transform | /packages/markdown-slate/src/SlateTransformer.test.js | UTF-8 | 4,886 | 2.578125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | /*
* 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/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed u... | true |
11b7469ee12a88f43158309c4b281defd46ade1a | JavaScript | Galaxy-Wanderer/paideusis-website-new | /src/components/Levels.js | UTF-8 | 4,653 | 2.515625 | 3 | [] | no_license | import React, { useContext, useState } from 'react'
import './styles/Levels.css'
import LevelsBoy from '../images/levels-boy.png'
import { GlobalContext } from '../GlobalState'
const Levels = () => {
const { checkLan } = useContext(GlobalContext)
const [level, setLevel] = useState(1);
return (
<section clas... | true |
8b9b835edb7e15904d0080a4a71ed9dda0a99fe1 | JavaScript | maboiteaspam/phantomizer-websupport | /shared/js/vendors/go-phantomizer/queuer.js | UTF-8 | 2,482 | 2.921875 | 3 | [
"MIT"
] | permissive | "use strict";
define([],function () {
var queuer = function(is_built, is_building){
this.is_built = is_built;
this.is_building = is_building;
};
queuer.prototype.is_built = null;
queuer.prototype.is_building = null;
// list handlers to execute
queuer.prototype.items = [];
// queue an handler, to be ... | true |
4cba645c24bd654544401e5944c4a28acce7843f | JavaScript | DimkaSklyar/kuban24-img-editor | /src/functions/getColsTextArea/index.js | UTF-8 | 1,892 | 3.3125 | 3 | [] | no_license | var calculateContentHeight = function (ta, scanAmount) {
var origHeight = ta.style.height,
height = ta.offsetHeight,
scrollHeight = ta.scrollHeight,
overflow = ta.style.overflow;
/// only bother if the ta is bigger than content
if (height >= scrollHeight) {
/// check that our browser supports chan... | true |
9915f44477d4a4040d2fc4a4dddf98ab6239867e | JavaScript | eviltadashi/AulaJS | /js/formNovoCartao.js | UTF-8 | 3,567 | 2.625 | 3 | [] | no_license | ;(
function(){
let contador = 0
const form = $(".formNovoCartao")
form.submit(function(event){
event.preventDefault()//função que define que o submit não sera recarregado a pagina.
const textarea = form.find(".formNovocartao-conteudo")
... | true |
317dc5e0b52bd9f241e3792a0ee2882d8897d221 | JavaScript | LalanaChami/Pharmacy-Mangment-System | /backend/routes/doctorOders.js | UTF-8 | 5,050 | 2.5625 | 3 | [
"MIT"
] | permissive | const express = require("express");
const router = express.Router();
const nodemailer = require("nodemailer");
// var handlebars = require('handlebars');
// var fs = require('fs');
const DoctorOder = require('../models/doctorOders');
router.post("",(req,res,next)=>{
const docOder = new DoctorOder({
doctorName:... | true |
d18f8b63b6887339b6f387c0a0fa6933f7bc8411 | JavaScript | Hikaru-Ichikawa/2D-Game | /keyboard.js | UTF-8 | 5,884 | 3.265625 | 3 | [] | no_license | // (注意)このモジュールを使うとグローバル定数keyboardを定義する。
// enterキーの追加
class Keyboard {
constructor(){
// 方向キー
this.left = false;
this.up = false;
this.right = false;
this.down = false;
// 東方
this.shift = false;
this.z = false;
this.x = false;
... | true |
a0beaa56829a1d3df3c104c2fdfc96be88558ddd | JavaScript | ADeoZ/react-lifecycle-http-3 | /src/components/Chat.js | UTF-8 | 2,209 | 2.625 | 3 | [] | no_license | import { Component, createRef } from 'react';
import ChatForm from './ChatForm';
import ChatMessage from './ChatMessage';
import { nanoid } from 'nanoid';
const serverURL = 'http://localhost:7777/messages';
export default class Chat extends Component {
state = { messages: [], waiting: false };
messagesElement = c... | true |
ce8985a1df17a4221d2edcfd3574600d15fe516c | JavaScript | GeeksHubsAcademy/ejercicios-fundamentos-js-juelfer | /promise4.js | UTF-8 | 253 | 2.734375 | 3 | [] | no_license | var promise = new Promise (function (fulfill, reject) {
fulfill("I FIRED");
var err = new Error ("I DID NOT FIRE");
reject(err);
});
function onRejected(error) {
console.log(error);
};
promise.then(onRejected,onRejected);
| true |
b0249782b4bb099815dd4da38d50c7144411c52d | JavaScript | diegomdias/testeEstagio | /src/index.js | UTF-8 | 1,182 | 2.84375 | 3 | [] | no_license | import "core-js"
import "regenerator-runtime/runtime"
import { getPost } from "./api";
const section = document.querySelector('section');
async function exibirPost(){
let result = await getPost();
result.forEach(element => {
const div = document.createElement('div');
div.classList.add('div-content... | true |
b6267dbae103ca8837524ac0e3917be22d57ec68 | JavaScript | bloges56/API-Joker | /scripts/Joke.js | UTF-8 | 619 | 3.359375 | 3 | [] | no_license | // Define and export a function called Joke.
// It should accept a joke object as a parameter and return an html string
export const Joke = (joke) => {
if(joke.type !== "knock-knock"){
return `
<p class="joke-setup">
${joke.setup}
</p>
<button class="punc... | true |
ae58e3ebedb4f990eee7b344dd4ec4d8d0d945b4 | JavaScript | lianjp/foo | /src/utils/browserType.js | UTF-8 | 1,733 | 2.671875 | 3 | [] | no_license | function BrowserType() {
let userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
let isOpera = userAgent.indexOf('Opera') > -1 // 判断是否Opera浏览器
// var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
let isIE = window.ActiveXObject || 'ActiveXObject' in win... | true |
da8c31e04158f37277607d13626dde18bd69d015 | JavaScript | EduardoSantosGit/netstat-conn | /src/netstat.js | UTF-8 | 946 | 2.859375 | 3 | [] | no_license | import co from 'co'
export default class NetStat {
netstat(args, options) {
if (args === undefined) {
//call method
}
else if (args !== undefined && this.validateArgs(args) === true) {
}
else {
throw new Error("Error invalid argument")
... | true |
720180c75be993afe69d508b3d56e3804a65fbe1 | JavaScript | tonioloewald/bindinator.js | /source/show.js | UTF-8 | 1,706 | 3.484375 | 3 | [
"BSD-3-Clause"
] | permissive | /**
# Show and Hide
show(element, ...); // show the element
Shows the element (via the CSS `display` value -- restoring a previously altered value where
appropriate). Triggers a synthetic `show` event on any elements with `show` event handlers
passing any additional arguments.
hide(element, ...); // hide the... | true |
9bee6bc391ecaae4dd993a9c6ea962bc5578cc85 | JavaScript | pete-otaqui/grove-hooks | /src/github-components/github-search/github-search.js | UTF-8 | 2,630 | 3.59375 | 4 | [] | no_license | /*
* GitHub Search Component
*
* This component uses react's `useState` hook, and the `fetch` api.
*
* We expect a function to be given as the child of this component, in the
* "render props" pattern. This function will be passed the following props:
*
* `search` - a function to call with search parameters
* ... | true |
c3b5c9f5c094d5c4982578a1044e0b60017c9778 | JavaScript | jacobpaine/flexbox-intro | /inclass/js-intro/functions.js | UTF-8 | 379 | 3.328125 | 3 | [] | no_license | const friends = ["Dave", "Phil", "Bob", "Greg"];
const notGreg = ["Dave", "Phil", "Bob"];
const checkForGreg = (array) => {
for (let i = 0; i < array.length; i++) {
if (array[i] === "Greg") {
return "Greg is here.";
} else {
return "no Greg";
}
}
};
console.log("friends!:", checkForGreg(fr... | true |
e2bcc9b6bf4bc8c4ffbfb9ff5a02e0445c903765 | JavaScript | jambis/21-card-trick | /src/Components/InitialDeck.js | UTF-8 | 1,821 | 2.640625 | 3 | [
"MIT"
] | permissive | import React from "react";
import TweenOne from "rc-tween-one";
import PuffLoader from "./Loader";
import BezierPlugin from "rc-tween-one/lib/plugin/BezierPlugin";
TweenOne.plugins.push(BezierPlugin);
const InitialDeck = ({ imagesArr, setCardPicked }) => {
const animation = {
bezier: {
type: "thru",
... | true |
a0699bb6560367d58daa53fc638a8f676cacd1d6 | JavaScript | reaper1067MSX/circle_webclient | /src/funciones_globales/format.js | UTF-8 | 1,133 | 2.859375 | 3 | [
"MIT"
] | permissive | import moment from 'moment';
import 'moment/locale/es';
export const completar_String = (cadena, char_relleno, tam_final) => {
let tam_actual = cadena.toString().length;
let veces_repetir = tam_final - tam_actual;
return char_relleno.repeat(veces_repetir).concat(cadena);
}
export const formatearFecha ... | true |
6d56ee32328871c0769d06d32ad2a6a495a4e0da | JavaScript | LukeDaviesWeb/strained_buds | /src/components/Result.jsx | UTF-8 | 2,924 | 2.9375 | 3 | [] | no_license | import React, { Component } from 'react';
import './result.css';
export default class Result extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.getFlavors = this.getFlavors.bind(this);
this.getPositive = this.getPositive.bind(this);
this.g... | true |
c29e2edafc8e290ff439e70d289ad20a6849ef81 | JavaScript | mariusz5581/valmetMap | /public/js/shared/language/language.js | UTF-8 | 1,266 | 2.640625 | 3 | [] | no_license | var lang = 'PL';
function SetLanguage(languageCode) {
lang = languageCode;
}
//sorts getting text by views
function GetElementLangText(view, action) {
switch (view) {
case 'login':
return GetLoginLangText(action);
}
}
function GetBlockLangText(blockName) {
var textCode = blockName + lang;
switch (textCode) ... | true |
42db5ae691bffda8c7b9e9131caa404b1c189da7 | JavaScript | fearvalkorn/orc | /New folder/main.js | UTF-8 | 995 | 3.546875 | 4 | [] | no_license | function CreateMarin() {
var self = this;
this.weapon = makeWeapon();
this.damage = makeMarinDamage(self);
this.health = makeMarinHealth();
}
var allMarin = [];
function makeMarinHealth() {
var rezultat = Math.floor(Math.random() * (600 - 400 + 1) + 400);
return rezultat;
}
func... | true |
f4293c5c1d5c7973b67fd1d7a42e4736ba643ddc | JavaScript | fernandogiovanini/CardGen | /CardGen/scripts/Main.js | UTF-8 | 1,095 | 2.59375 | 3 | [] | no_license | /*
* By Fernando Giovanini (fernando@giovanini.me)
*
* Icons by http://www.yootheme.com/icons
*/
function clickVisa(info, tab){
click(info, tab, 'visa');
}
function clickMaster(info, tab){
click(info, tab, 'master');
}
function clickAmex(info, tab){
click(info, tab, 'amex');
}
function cli... | true |
45ce1a1d7a94352761843becc32d6d348f17bdaf | JavaScript | luigiplr/sloth-bot | /src/plugins/owl/utils/owlapi.js | UTF-8 | 1,973 | 2.71875 | 3 | [
"Beerware"
] | permissive | import needle from 'needle'
import moment from 'moment'
const BASE_API_URL = 'https://api.overwatchleague.com'
const ENDPOINTS = {
maps: '/maps',
standings: '/v2/standings?locale=en_US&season=%p%',
teams: '/teams?locale=en_US',
players: '/players?locale=en_US'
}
export const cache = {}
export const cacheTs = ... | true |
0e07ce6388240ffa397fc0b30cbc00553f5e0511 | JavaScript | genny-project/alyson-v3 | /src/utils/storage/Storage.web.js | UTF-8 | 2,020 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | class Storage {
get = key => {
return new Promise(( resolve, reject ) => {
if ( key == null )
return reject( 'Argument passed to `Storage.get( key )` is either `null` or `undefined`.' );
try {
const item = localStorage.getItem( key );
resolve( item );
}
catch ( er... | true |
a03ef24e4a409d505e9c09ca2afd33fb9b6b0023 | JavaScript | 1070841863/mydemo | /bootstrap1/WebContent/js/myjs.js | UTF-8 | 5,383 | 2.6875 | 3 | [
"MIT"
] | permissive | var path="";
$(function(){
path=$("#path").val();
//分页并查询
getAllByPage();
//增加
myadd();
//修改
myupp();
//删除
mydel();
//行内修改
getChange();
});
function getChange()
{
$("body").on("click","#tb_departments .xname",function(){
//得到人要修改的的编号
var id=$(this).parent().parent().find("td:eq(1)").text(... | true |
4b8e23b30145d0e492d1f62f5697cce74c352cc7 | JavaScript | phobal/shadowsocks-free-account | /src/puppeteer.js | UTF-8 | 758 | 2.75 | 3 | [] | no_license | const puppeteer = require('puppeteer');
const chunk = (arr, size) =>
Array.from({ length: Math.ceil(arr.length / size) }, (v, i) =>
arr.slice(i * size, i * size + size)
);
async function run(url) {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await pa... | true |
dccbdd5a4dd5dda25b754fb1216f816fb15c79c0 | JavaScript | tomataso/ProyectoParalelo | /cenfotecsoftwarehousev17/public/js/horas/servicio_horas_registrar.js | UTF-8 | 2,725 | 3.25 | 3 | [] | no_license | /*
Responsabilidades del servicio
- Procesamiento de datos (cálculos)
- Almacenamiento temporal de los datos
- Comunicar el public (front-end) con el api (back-end)
*/
'use strict';
//variables globales--------------------------------
//funciones--------------------------------------
function registrarH... | true |
bfcf17618f5f6662a2ee80e116a87e1cbe38082c | JavaScript | kick07230723/webstorm_restaurantReview | /picture/eventclick.js | UTF-8 | 311 | 2.78125 | 3 | [] | no_license | /**
* Created by hoyeo on 2017-04-09.
*/
var arr = document.getElementsByTagName("img")
var clickImg = document.getElementsByClassName("picture")
for (var i=0;arr.length >=i;i++){
arr[i].addEventListener("click" , function () {
clickImg[0].innerHTML = "<img src = " + this.src + '>'
})
} | true |
e35cae6ced1afc3b9c3d64a0682ff34444300356 | JavaScript | eczn/vdom | /src/js/VirualDOM/from$Node.js | UTF-8 | 1,278 | 2.78125 | 3 | [
"MIT"
] | permissive | const VNode = require('./VNode');
let { h } = VNode;
/**
* @description 根据 DOM 节点构造 VNode 对象
* @param { Node } 节点 DOM
* @returns { VNode } 虚拟 DOM
*/
function from$Node($node){
let { nodeType } = $node;
if (nodeType === 3){
if (!$node.nodeValue.trim()) return null;
else return new ... | true |
b9009be6a50ca1135b1f6eb5c8fbd5da4b180637 | JavaScript | Jakobtottrup/DW-AJAX1 | /js/play_quiz.js | UTF-8 | 5,052 | 2.625 | 3 | [] | no_license | let score = 0;
$("#load_btn").click(function () {
$(".hidden").css("display", "block");
let stored = JSON.parse(localStorage.getItem("quizzes"));
let author = $("#get_creator").val().toLowerCase();
let quiz_to_play = {};
function findQuizzesByAuthor() {
return stored.filter(
fun... | true |
5008a4905eae38090f8b9784e4326ef58ea45ac2 | JavaScript | chingkamhing/ims-security | /web/src/components/ConfirmModal/ConfirmModal.js | UTF-8 | 2,185 | 2.625 | 3 | [] | no_license | import React from 'react'
import ConfirmDialog from './ConfirmDialog'
// This confirmation dialog is mainly copied from https://itnext.io/add-confirmation-dialog-to-react-events-f50a40d9a30d
class ConfirmModal extends React.PureComponent {
static propTypes = {
// none
}
static defaultProps = {
... | true |
dcfe80f1039e8f1730d1b2841ba5cf735acab554 | JavaScript | zhengyangca/algorithms_datastructures_js | /practice/stringShifts/index.js | UTF-8 | 1,070 | 3.71875 | 4 | [] | no_license | /**
* @param {string} s
* @param {number[][]} shift
* @return {string}
*/
var stringShift = function (s, shifts) {
let result;
if (!s) {
return s;
}
let realShift = [0, 0];
shifts.forEach(shift => {
if (shift[0] === 0) {
realShift[1] -= shift[1];
} else {
... | true |
f2803be56b1962d8f2b9623d2535c13909d7d23a | JavaScript | BryanEC-dev/API-PORTAFOLIO | /api/components/user/controller.js | UTF-8 | 3,106 | 2.65625 | 3 | [] | no_license | const mongo = require('../../../store/mongo')
const bcrypt = require('bcrypt');
const saltRounds = 10;
const COLLECTION = 'user'
async function get(id){
try {
data = await mongo.list(COLLECTION,id)
return data
} catch (error) {
throw new Error(error)
}
}
async function... | true |
910960d516af81e97cad4449d9161955554dd100 | JavaScript | nephente1/Weather-App-React | /js/Weather.jsx | UTF-8 | 2,516 | 2.734375 | 3 | [] | no_license | import React from 'react';
import styled from 'styled-components';
const Bodybg = styled.div`
background:url('https://stmed.net/sites/default/files/river-wallpapers-28027-7511542.jpg');
background-size:cover;
display:flex;
justify-content: center;
align-items:center;
height:100vh;
`
const Maindiv = styled.div`
... | true |
ce45cda1c1ea83f407629746b088c1b9d9cf26b4 | JavaScript | bemsuero/steamvents | /app/javascript/packs/application.js | UTF-8 | 1,324 | 2.765625 | 3 | [] | no_license | /* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//... | true |
e3706a1db3d934406491f65d612f70840fc06400 | JavaScript | tbold5/Junk-Dunker | /public/engine/GameOver.js | UTF-8 | 3,284 | 3.1875 | 3 | [] | no_license | var resetBtn;
var exitBtn;
var userName;
var highScore;
var gameOverText;
// Subclass of Phaser engine is created
class GameOver extends Phaser.Scene {
constructor() {
super({
key: 'GameOver'
});
}
// Loads the assets onto the scene
preload() {
// Loads the play a... | true |
291efa40e8fc4473926068c9720e339aee581ad7 | JavaScript | Tomahawkd/Subdomain-Detect | /util.js | UTF-8 | 593 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | const fs = require('fs');
module.exports = {
readList: (path) => {
var urlList = [];
var data = fs.readFileSync(path);
var current = 0;
while(current < data.length) {
var index = data.indexOf('\n', current);
if (index == -1) break;
urlList.push(da... | true |
9c0eea240f75a6932676d91114a48584a6953067 | JavaScript | allenevans/essencejs | /test/references/multiple-instances.spec.js | UTF-8 | 1,914 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
* File : multiple-instances.spec.js
* Description : TEST using multiple instances of essencejs.
* ------------------------------------------------------------------------------------------------ */
"use strict";
var path = require("path"),
EssenceJs = require(path.join(process.cwd(), "src/Essenc... | true |
b39c144a3e2276fb0aa1e148a000520102c0fa54 | JavaScript | muchamadagush/todo-app | /src/App.js | UTF-8 | 826 | 2.609375 | 3 | [] | no_license | import './App.css';
import { useState } from 'react';
import Navbar from "./components/Navbar/index.js";
import Container from "./components/Container/index.js";
import FormInput from "./components/FormInput/index.js";
function App() {
const [value, setValue] = useState('')
const [todos, setTodos] = useState([])
... | true |
935c9e7088433d03567777b8f0b87f54e472d3f5 | JavaScript | nakandakare/Modulo-2---Fundamentos-de-node | /tercer_ejercicio/app3.js | UTF-8 | 926 | 3.90625 | 4 | [] | no_license | //Requerimos la funcion para generar archivos.
const generarArchivo = require('./generarArchivo');
//Seteamos un valor por el cual vamos a multiplicar
const base = 5;
//Seteamos la cantidad de veces que vamos a multiplicar
const cantMax = 10;
//Creamos una variable para concatear los resultados.
let resultados = '';
... | true |
3f8cc118698665ffd1321fc509acdce1c4b83257 | JavaScript | ThynStyx/vzome | /react-library/src/fields/root2.js | UTF-8 | 2,943 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive |
// Most of this code is from Jacob Rus: https://observablehq.com/@jrus/zome-arithmetic
const SQRT2 = Math.sqrt(2)
function gcd( a, b )
{
a = Math.abs(a)
b = Math.abs(b)
while ( b !== 0 ) [a, b] = [b, a % b]
return a
}
function simplify3( v0, v1, v2 )
{
if ((v0|0) !== v0 || (v1|0) !== v1 || (v2|0) !== v2)... | true |
c3c2f9a92ff268a3380fbb1061b01548504b7ccc | JavaScript | orennitzan/jest-tests | /helpFuncs.js | UTF-8 | 299 | 2.5625 | 3 | [] | no_license | const axios = require('axios');
const helpFuncs = {
dayInWeek: () => {
return (new Date()).getDay() + 1;
},
fetchUser: () => axios.get('https://jsonplaceholder.typicode.com/users/1')
.then(res => res.data)
.catch(err => err.data),
};
module.exports = helpFuncs; | true |
30e1db31479d1239d71af2c1cb8e042cedbf0063 | JavaScript | nahomtefera/myArcadeGame | /js/app.js | UTF-8 | 6,068 | 3.640625 | 4 | [] | no_license | // Enemies our player must avoid
var Enemy = function(x, y, speed) {
// Variables applied to each of our instances go here,
// we've provided one for you to get started
this.x = x;
this.y = y;
this.width = 80;
this.height = 30;
this.speed = speed;
// The image/sprite for our enemies, thi... | true |
464de0960e0303e34d1331b321d1c25dee1287f8 | JavaScript | nsaini-05/Socio | /backend/server.js | UTF-8 | 865 | 2.671875 | 3 | [] | no_license | const app = require('./app');
const dotenv = require ('dotenv');
//Handling Uncaught Exception
process.on('uncaughtException', (error)=>{
console.log(`Error: ${error.message}`);
console.log('Shutting down the server due to uncaught exception');
process.exit(1);
})
//environment variables config file
doten... | true |
d080134aed09caf16c07a2fe4ad9f09afef68909 | JavaScript | developert1990/League-Of-Legends_React.js | /client/src/components/EmailVerification.jsx | UTF-8 | 1,347 | 2.6875 | 3 | [] | no_license | import React, { useState } from 'react';
export const EmailVerification = ({ verifyNum, setOpenSignUpPage, sendEmail, setEmailVerifiCation }) => {
console.log('verifyNum: ' + verifyNum);
const [code, setCode] = useState('');
const handleChange = (e) => {
const input = e.target.value;
cons... | true |
1544f2f04bf2887e4024d4086ad91464300fe8fa | JavaScript | danhunlee/bamazon | /bamazonManager.js | UTF-8 | 4,808 | 3 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "dlgjs123!",
database: "bamazon_DB"
})
connection.connect(function(err) {
if (err) throw err;
console.log("connected as id " + ... | true |
1f2a45854ba8c7d600f1e22c981c5cd59ce4ef22 | JavaScript | StevenCThaller/MERN_Sep | /FullStackMERN/MERNTogether/client/src/components/Details.js | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { Link, navigate } from '@reach/router';
import axios from 'axios';
const Details = props => {
const [thing, setThing] = useState({});
const [loading, setLoading] = useState(true);
useEffect(()=>{
axios.get(`http://localhost:8000/api/test/$... | true |
efd0ce136e6b181f01a29b40ea7eb5f7e45e8a09 | JavaScript | Junior743/alquimia | /poc-hello_world_type_script/js/interface.js | UTF-8 | 188 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | function greenter(person) {
return 'Hello, ' + person.nome + ' ' + person.sobrenome;
}
var usuario = { nome: 'Penny', sobrenome: 'Lane' };
document.body.innerHTML = greenter(usuario);
| true |
e7761483ac54820ef0de4a2005055cb25945f188 | JavaScript | ancheetah/freeCodeCamp | /javascript/IntermediateAlgorithms/seek-and-destroy.js | UTF-8 | 470 | 4.5 | 4 | [] | no_license | /*
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
*/
function destroyer(arr) {
//Get items to remove from arr
let narr = [...arguments];
narr.sh... | true |
619655bc67dfc766f4f2123514f3d15fb8c9711d | JavaScript | chralsia/practise | /scripts.js | UTF-8 | 3,681 | 2.875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function (event) {
var login = "";
document.getElementById("btnIn").onclick = function () {
login = document.getElementById("login").value;
document.getElementById("login").value = "";
document.getElementById("btnIn").style.display = "none";... | true |
61761c3e203ed10b05fb8f1098569916d1cd0eb5 | JavaScript | adamcarchibald/snake-javascript | /script.js | UTF-8 | 1,746 | 3.28125 | 3 | [] | no_license | console.log('script.js loaded!');
var gameCanvas = document.querySelector('#gameCanvas').getContext("2d");
snake = {
position: [[50,50]],
direction: 0,
draw: function() {
gameCanvas.fillStyle = "#ff0000";
gameCanvas.fillRect(this.position[0][0], this.position[0][1], 10, 5);
},
clear: function() {
... | true |
cb444b837d848efe66852d54f97f41abdeb237fe | JavaScript | andrei9505/ALF | /TD1/String.js | UTF-8 | 390 | 2.90625 | 3 | [] | no_license | Varianta 1:
<!DOCTYPE html>
<html>
<body>
<script>
var str = "Hello Hello Hello World";
var part1 = /(Hello )+/g;
var res = str.match(part1);
document.write(res);
</script>
</body>
</html>
Varianta 2 :
<!DOCTYPE html>
<html>
<body>
<script>
var str = "Hello Hello Hello Vorld!";
var part1 = /^Hello Hello Hello/g;
var r... | true |
f349b6d53879cc3b4e5e16285539001d09cc4bec | JavaScript | mindaugas-karla/Front-End-Web-Developer-Nanodegree | /project-4-nlp-article/evaluate-news-nlp/__test__/translateScore.test.js | UTF-8 | 1,667 | 2.859375 | 3 | [] | no_license | // Import the js file to test
import { translateScore } from "../src/client/js/base"
describe("Testing score transalation", () => {
// The test() function has two arguments - a string description, and an actual test as a callback function.
test("Testing the translateScore() function", () => {
const i... | true |
fb86869284ba0726ee8ee96a43479ecd3bd92008 | JavaScript | pangff/video-diff | /lib/compare.js | UTF-8 | 3,305 | 2.640625 | 3 | [] | no_license | 'use strict';
const fs = require('fs');
const BMP = require('bmp-js');
const PNG = require('pngjs').PNG;
const pixelmatch = require('pixelmatch');
const mapReduce = require('mapred')(2);
const THRESHOLD_PIXELS_COUNT = 0;//最大可容忍不同像素点数
const PIXEL_MATCH_THRESHOLD = 0.1;//PIXEL_MATCH点的比对严格程度(0-1),值越小比对越严格发现的不同像素点越多。
c... | true |
420e502f8e4bdee29698ac1fd17a283a7f97600b | JavaScript | CuongNguyen1701/Raiden-Mei-Bot-Host | /commands/joinfact.js | UTF-8 | 2,501 | 2.515625 | 3 | [] | no_license |
const { currency, mongoPass } = require('../config.json');
const role = require('../roles.json');
const mongoose = require('mongoose');
//CONNECT TO DATABASE
mongoose.connect(process.env.mongoPass, { useNewUrlParser: true, useUnifiedTopology: true })
.catch(err => console.log(err));
//MODELS
const Data = require... | true |
a21432071853bae36e27e62c41c7856ac5b7d88b | JavaScript | heatherjmain/countries_bucket_list | /client/views/list_view.js | UTF-8 | 398 | 3.140625 | 3 | [] | no_license | var renderList = function(countries){
var mainDiv = document.querySelector("#main-div");
mainDiv.innerHTML = "";
var list = document.createElement("list");
countries.forEach(function(country){
var listItem = document.createElement("li")
listItem.innerText = country.country_name;
list.appendChil... | true |
23c1b39c4ea945fb6f7bfc68ef12ba595b627a57 | JavaScript | Shreyyas/TwitterTicker | /js/LinkedHashMapImplementation.js | UTF-8 | 8,620 | 3.640625 | 4 | [
"MIT"
] | permissive | (function() {
/**
* A utility that takes advantage on Javascript Object's power as a hashmap, and provide you insertion order.
* Useful if you need to randomly access a value with a key, but need to know who are your immediate neighbours, ie. a carousel.
*/
LinkedHashMap = function LinkedHashMap(values) {
if... | true |
e14fdf6bf5c5c01ae1706f6177b95f67401f7916 | JavaScript | sweco-secarl/d3js_samples | /js/lab.js | UTF-8 | 8,790 | 2.765625 | 3 | [] | no_license | /**
* Created by secarl on 2014-09-09.
*/
$(document).ready(function() {
function createRect() {
var rectDemo = d3.select("#rect").
append("svg:svg").
attr("width", 400).
attr("height", 300);
rectDemo.append("svg:rect").
attr("x", 100).
... | true |
67d37e222a20fd894554e1a2af6a9534c84d6a9c | JavaScript | coolfriends/coolpal | /lib/plugins/weather/plugin.js | UTF-8 | 2,712 | 2.875 | 3 | [
"MIT"
] | permissive | import weather from "weather-js";
import * as utils from "../utils";
import Plugin from "../plugin.js";
class WeatherPlugin extends Plugin {
constructor(pal, config = {}) {
super(pal, config);
/**
* The name for this command
*/
this.command = "weather";
/**
* The weather API client.
... | true |
92a1e5c887ebc9a87f6a373bba2936a13fa606bf | JavaScript | vivianmahr/Flowers-for-the-Past | /js/map/Map.js | UTF-8 | 13,054 | 2.953125 | 3 | [] | no_license | define(["lib/goody", "physics/Vector", "assets/vars"],
function(goody, Vector, vars)
{
function Map(json) {
this.height = json.height;
this.width = json.width;
this.pixelWidth = this.width * vars.tileDimension;
this.pixelHeight = this.height * vars.tileDimension;
this.le... | true |
94b746586b6dd1d8d0a490c613a505d003a4cbb3 | JavaScript | idoxer/big-panda | /src/components/Comments/CommentsForm.js | UTF-8 | 2,676 | 2.546875 | 3 | [] | no_license | "use strict";
import React, {Component, PropTypes, DOM, createElement as $} from "react";
import Actions from "../../actions/Actions";
import { Input, Textarea, Button } from "../../ui";
class CommentsForm extends Component
{
state = {};
fields = {};
render()
{
const { error, loader } = this.... | true |
7b139ee2e810980ca2e81f94775db92ba8964810 | JavaScript | martinhj/MBuild | /app.js | UTF-8 | 705 | 2.546875 | 3 | [] | no_license | const chalk = require('chalk')
const { Mbuild } = require('./server')
const mbuild = new Mbuild(async () => {
console.log('I\'m the callback')
await logging()
})
async function logging() {
console.log(chalk.blue('stuff happening...'))
console.log('more stuff happening...')
console.error(chalk.red... | true |
e9b8e40313775f4fdd851386f117e1f3af2c3ece | JavaScript | HenriqueFadoni/fictional-startup | /src/containers/Contact/Contact.js | UTF-8 | 2,117 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import Form from '../../components/Form/Form';
import GoogleMaps from '../../components/GoogleMaps/GoogleMaps';
class Contact extends Component {
state = {
message: {
name: '',
email: '',
title: '',
... | true |
30835b77a15bd6ab9e141e45770ef7e2bb5977cf | JavaScript | phillydorn/CAProject2 | /app/utils/auth.js | UTF-8 | 3,432 | 2.625 | 3 | [
"MIT"
] | permissive | // import jwtUtils from './jsonwebtoken';
const store = global.localStorage;
const document = global.document;
const fetchFromStore = (key) => {
// load any stored value from sessionStorage
let initValue = store && store.getItem(key);
if (typeof initValue !== 'undefined') {
try {
initValue = JSON.pars... | true |
87a1ac6597f8d27ec1e28a3ea349eef64786d6b0 | JavaScript | dosseh/WEB_WEB-objectmodel-lab | /src/index.test.js | UTF-8 | 19,545 | 2.671875 | 3 | [] | no_license |
import { version, Door, TimeSeries, Datum, Temperature, typeOfSensor, FanSpeed, fromNameToTypeOfSensor } from ".";
import { data } from '../resources/sensors_data';
describe('Sensor model tests', () => {
describe('Dummy tests', () => {
test('data is loaded with 3 elements', () => {
expect(data.length).toB... | true |
bac9381c57189c5453a5029986eae094fe378442 | JavaScript | weberl48/spotify-api-visualizer | /public/javascripts/scraps.js | UTF-8 | 6,611 | 2.578125 | 3 | [] | no_license | var input = document.getElementById('search');
var searchButton = document.getElementById('search-button');
var resultSection = document.getElementsByClassName('results');
var thumbsUp = document.getElementById('thumbs-up');
var audioPlayer = document.getElementById('player');
var currentAlbumId;
var canvas, ctx, sourc... | true |
5d6517c11042e98d32d733dd2c50ecad0bc4f3c0 | JavaScript | mgunwani/MCIT-PhaseTwo-WebDevelopment | /JavaScript-Fundamentals/JavaScript-Advanced-Concepts/5-prototyping-changing-example.js | UTF-8 | 935 | 3.9375 | 4 | [] | no_license |
function Person() {
this.firstName = "King";
this.lastName = "Kochhar";
}
Person.prototype.age = 30;
var p1 = new Person();
console.log("p1.age : " + p1.age); // 30
console.log('--------------')
var p2 = new Person();
console.log("p2.age : " + p2.age); // 30
console.log('--------------')
Person.prototy... | true |
263017f0773c5709292c69478699bf5beb8ba87a | JavaScript | magnuspaaske/jellyapp | /src/pug-fns.js | UTF-8 | 2,788 | 2.921875 | 3 | [] | no_license | // Various functions to be used in the frontend
const _ = require('lodash');
const showdown = require('showdown');
const capitalize = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
};
const numberToString = (num, qualifications) => {
if (qualifications === undefined) {
qualifications =... | true |
1feb0750425f834eb6a0436d178cd571c52eb0ae | JavaScript | dan-k-park/Faux-Cafe | /client/src/components/Specials/index.js | UTF-8 | 2,552 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import Image1 from "../../assets/images/coffee-1.jpg";
import Image2 from "../../assets/images/coffee-2.jpg";
import Image3 from "../../assets/images/coffee-3.jpg";
import {
SpecialsWrapper,
SpecialsCard,
SpecialsImage,
SpecialsH2,
SpecialsP,
} from "./SpecialsElement... | true |
0b6a2f8daf78f74d04499a52dfe6693f2780351e | JavaScript | JonatasFAlves/nodejs-rest-api | /api/routes/products.js | UTF-8 | 5,069 | 2.671875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const Product = require('../models/product');
// Routes
// Get all products, pass information about the product
// and metadata in general
router.get('/', (req, res, next) => {
Product.find().select('name p... | true |
62298fff0dce3da487aa4e8256613e30d3197aef | JavaScript | rpccon/the-movies-app | /src/components/home/Home.jsx | UTF-8 | 2,038 | 2.515625 | 3 | [] | no_license |
import ListGroupContainer from "../listGroupContainer/ListGroupContainer";
import { isEmpty } from "lodash";
import "./Home.sass";
const EMPTY = ""
const Home = (fullProps) => {
const { movies, selectedMovie, update_selected_movie } = fullProps;
const orderDate = (strDate) => {
let finalStr = EMPTY
if(st... | true |
e85c3457a2fd11258927db5a54690b512c6b33c6 | JavaScript | helenohyeah/advent-of-code | /2020/day-06/solution.js | UTF-8 | 1,090 | 3.234375 | 3 | [] | no_license | const format = (input) => input.trim().split(/\n\n/g).map(item => item.split(/\n/g));
const partOne = (input) => {
const allAnswers = format(input);
const countAnswers = (answers) => {
const tally = {};
answers.join('').split('').forEach(answer => tally[answer] = true);
const count = Object.keys(tal... | true |
262cad8b69511dbc95a8055f336bf844fa5cf4a7 | JavaScript | enan789/chopsticks-hand-game-js | /js/main.js | UTF-8 | 8,202 | 3.140625 | 3 | [] | no_license | // creates psuedo-namespace
var CHOP = {};
//###################
//# ENTRY POINT #
//###################
/**
* Sets global variables, adds click listener to hands, and starts game
* off with player-1's turn.
*/
$(document).ready(function() {
"use strict";
// creates global variables
CHOP.game = $(".game");... | true |
b446f0a72c0ce13d5ad4a445559d3486cd5663c1 | JavaScript | rvmook/rvmook.github.io | /_src/assets/scripts/utils/resizeCanvas.js | UTF-8 | 1,075 | 2.84375 | 3 | [] | no_license | var DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1,
_backingStoreRatio,
_canvasPixelRatio,
context = document.createElement('canvas').getContext('2d');
_backingStoreRatio = getBackingStoreRatio(context);
_canvasPixelRatio = DEVICE_PIXEL_RATIO / _backingStoreRatio;
function getBackingStoreRatio(context) {// esli... | true |