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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6c69a4bbeec66c54335a9cd59fa99898bdd6c9bb | JavaScript | davidlosasgonzalez/javascript-challenges | /challenges/check-nums/solution.js | UTF-8 | 140 | 2.8125 | 3 | [
"MIT"
] | permissive | function CheckNums(num1, num2) {
console.log((num1 === num2) ? '-1' : (num1 > num2) ? false : true);
}
CheckNums(6, 4);
| true |
9f26d2ed485da41d41c70245931af8f7c8c5c2f4 | JavaScript | fychinesepjj/webpackRequireCases | /src/media/bundle_require.js | UTF-8 | 1,423 | 2.671875 | 3 | [] | no_license | $(function () {
// require('__JS__/utils');
/**
* bundle本质是对require.ensure的封装,bundle会对__COMP__目录下文件进行预处理,
* 编译时产生大量的trunk文件用于异步加载,对比 Example 7,它最大的优点是不会把文件都打包到一个trunk中。
*/
// 页面初始化js加载:bundle_require.js
// 点击load_header事件,触发加载header.trunk.js文件
// 点击load_footer事件,触发加载footer.trunk.js文件
... | true |
da880ef2c159ddb0fc40b636e04c66c1bd92726c | JavaScript | toshetoo/ObjectFighterJS | /src/api/mockFighters.js | UTF-8 | 2,173 | 2.609375 | 3 | [
"MIT"
] | permissive | import {Fighter} from "../entities/fighter";
export function getFighters() {
return new Promise((resolve) => {
setTimeout(() => {
let fighters = [
new Fighter({
id: 1,
name: 'Gosho',
health: 1000,
strength:... | true |
4786566355e16c063378aeb76438e7e61b60a15e | JavaScript | skylogin/CloudBridge | /public/resource/js/common.js | UTF-8 | 785 | 2.875 | 3 | [
"MIT"
] | permissive | var whiteSpace = " ";
function flashWindow(nick, time){
/* 팝업으로..
var host = location.origin;
var url = host + "/popup";
var flag = document.hasFocus();
if(flag == false){
window.open(url);
}
*/
/* 타이틀 메시지 변경..
var oldTitle = document.title;
var msg = (nick=="... | true |
b637bad9fc2507db09d680aab8c49d22fa50b104 | JavaScript | 509dave16/resource-aggregate-utility | /src/Examples/StaticPage/OutputTreeView.js | UTF-8 | 2,604 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* @file A tree view that displays the ouptout from trasnforming a collection of
* resources using an one of the resource aggregation utility funtions
*
* @see {@link https://github.com/chenglou/react-treeview/blob/master/demos/uncontrolled.js} for source that is component is based off of.
*/
import React fr... | true |
de72923bf499c271910269aa2ea9a874555176e7 | JavaScript | taku0823/react-todo-app | /src/hooks/useLocalStorage.js | UTF-8 | 537 | 2.578125 | 3 | [] | no_license | import { useState, useEffect } from "react";
function useLocalStorage(key, initState) {
const [state, setState] = useState(() => {
const val = JSON.parse(window.localStorage.getItem(key));
let initVal;
try {
initVal = val.length ? val : initState;
} catch (err) {
console.warn(err);
... | true |
bc8ff6c8170ed96480c153644863cb4f616bc461 | JavaScript | kaitlynflynn/Sprint-Challenge--Redux | /smurfs/src/components/SmurfForm.js | UTF-8 | 1,298 | 2.578125 | 3 | [] | no_license | //IMPORT DATA
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { reduxForm, Field } from 'redux-form';
import { createSmurf } from '../actions';
import '../index.css';
//SMURF FORM DATA
class SmurfForm extends Component {
constructor(props) {
super(props);
thi... | true |
b26932bf7c0baaef31a0af91dccfc68af4caf18c | JavaScript | TomBecker1987/Personal | /week-7/Stacks & Queues/main.js | UTF-8 | 1,100 | 4.03125 | 4 | [] | no_license | class Stack{
constructor(){
this.list = []
this.length = 0
}
push(item){
this.list[this.list.length] = item
this.length++
}
isEmpty(){
if ( this.length > 0 ) {
return false
}
else {
return true
}
}
... | true |
767f01414fe0dd7ada10ff996e19df12932ec1e5 | JavaScript | blackbird71SR/Free-Code-Camp | /Intermidate Algorithm Scripting/missingLetters.js | UTF-8 | 516 | 3.859375 | 4 | [] | no_license | function fearNotLetter(str){
var str1;
var letters = str.split("");
var beg = str.charCodeAt(0);
var end = str.charCodeAt(str.length -1);
var char = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
for(var i = 0 ;i <= str.length -1; i++)
... | true |
102ecfd81520f23c9322e34b3406fb3c4dbbd1f3 | JavaScript | MiniKeb/nuts | /nuts-api/src/card.js | UTF-8 | 683 | 2.6875 | 3 | [] | no_license | var _ = require("underscore")._;
var Colors = require("./colors").Colors;
var Values = require("./values").Values;
var Card = function(value, color){
if (!Values.contains(value))
{
throw Error("The value "+ value +" is not managed.");
}
if (!Colors.contains(color))
{
throw Error("The color should be 'Club : ... | true |
cb76dcac221eb5926ea55c0edd202e02d079d97d | JavaScript | blake-buck/react-1-afternoon | /src/components/Topics/EvenAndOdd.js | UTF-8 | 2,150 | 3.84375 | 4 | [] | no_license | import React, {Component} from 'react';
class EvenAndOdd extends Component{
constructor(prop){
super(prop);
this.state = {
array: [],
evenArray: ["[]"],
oddArray: ["[]"],
userInput: ""
}
}
//updateArray takes whatever is in the input field, and throws it into stringArr. a for-loop then
//filte... | true |
e8d142b7e5e306a9e830004e5676a86154890bd0 | JavaScript | YahirKeym/CursoDeLoginFront | /src/views/NoLogueado/index.js | UTF-8 | 1,772 | 2.59375 | 3 | [] | no_license | import React,{useState} from 'react';
/**
*
* @param {*} User
* @param {*} Password
*/
function SendLogueo(User,Password){
let dataUser = {
User: User,
Password: Password
}
let Options = {
method:'POST',
headers:{
Accept: 'application/json',
'Co... | true |
9af1bbfab6747c2f7e5cdc42c5a4e66a17829cd8 | JavaScript | PeterArriaza/hot-or-cold-guessing-game-react | /src/GuessForm.js | UTF-8 | 1,005 | 2.703125 | 3 | [] | no_license | import React from 'react';
import './GuessForm.css'
export default class GuessForm extends React.Component {
handleSubmit(e) {
e.preventDefault();
this.props.onSubmit(this.textInput.value);
this.textInput.value = '';
}
render() {
if (this.props.solved === true) {
return (
... | true |
23a911e67fb96fb653a103e4876b8a73d0bfd774 | JavaScript | milanpatel0104/HotelManagementServer | /gateway/app.js | UTF-8 | 3,670 | 2.53125 | 3 | [] | no_license | // Import express
let express = require("express");
// Import Body parser
//Import Model
// require('./model')
let bodyParser = require("body-parser");
// Import Mongoose
// let mongoose = require('mongoose');
const cors = require("cors");
// const create = require('./controllers/createHotel');
// const paginate = requ... | true |
ef5e2a09a51383b21ca7d5348d5a5fa8bfd21a93 | JavaScript | alejandrochang/Algorithms | /CTCI/chapter01/1.2-checkPermutations.js | UTF-8 | 1,008 | 3.890625 | 4 | [] | no_license |
/*
High Level:
1. Same number of chars across each one, return the length
a. Time: O(n) + O(m), Space; O(n) + O(m)
2. Sort string return the same length
a. O(nlog(n)) + O(mlog(m)), Space: O(1)
*/
// 2
function checkPermute(s1, s2) {
if (s1.length !== s2.length) return false;
const formatSort = (s... | true |
8617f19c46720fe131ddd175fa57f6cd5588c764 | JavaScript | carribus/forcetracker | /client/src/ui/component.js | UTF-8 | 1,176 | 2.78125 | 3 | [
"MIT"
] | permissive | export class Component {
constructor(display, dimensions) {
this.display = display;
this.dimensions = dimensions;
this.rect = null;
}
containsPoint(x, y) {
return ( x >= this.rect.x && x <= this.rect.x + this.rect.w && y >= this.rect.y && y <= this.rect.y + this.rect.h );
... | true |
1c6455c17a28ecf85345eb86519a9b8467a27e5d | JavaScript | LieuKR/Myboard | /serverside_functions/alertfunctions.js | UTF-8 | 399 | 2.96875 | 3 | [] | no_license | /* 알람 함수들. 쿠키를 만들면 그 내용이 알람에 나오게 함.*/
// 좋은 알람 (초록색으로 표시됨)
exports.green = function (res, alerttext) {
res.cookie('greenalert', alerttext ,{maxAge: 1000 * 1});
};
// 안좋은 알람 (노란색으로 표시됨)
exports.yellow = function (res, alerttext) {
res.cookie('yellowalert', alerttext ,{maxAge: 1000 * 1});
}; | true |
92e93cd090b0f728303436836b298a526ca45916 | JavaScript | motech/reporting-spike | /ananya-bbc-reports-web/src/main/webapp/js/validation.js | UTF-8 | 4,049 | 2.765625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$('form').submit(function(event){
var form = $(event.target);
var result = true;
var trimSpaceInputs = form.find('.trim-space').each(function(index, element){
element = $(element);
element.val($.trim(element.val()));
});
... | true |
1c9874f15a921337ad3421c643fe7d410d4d7921 | JavaScript | writetome51/mongodb-stitch-serverless-functions | /functions/pub_userExists/source.js | UTF-8 | 320 | 2.515625 | 3 | [] | no_license | exports = async ({email}) => {
const {exec} = require("realm-function-exec");
try {
// If user doesn't exist, error is triggered.
await exec("getUserByEmail", email);
}
catch (error) {
// Don't bother returning error. {success: false} is sufficient.
return {success: false};
}
return {success: true};
};
| true |
4d0bcc4d21737a188545a581cd702d1e122086ee | JavaScript | jordan-dobarreiro/React-project | /src/components/AddCard.js | UTF-8 | 3,162 | 2.734375 | 3 | [] | no_license | import React from 'react';
import { YearPicker, MonthPicker } from 'react-dropdown-date';
import * as api from '../services/api/createCard.js';
import 'react-dropdown/style.css';
export default class AddCard extends React.Component {
constructor(props) {
super(props);
this.state = {
l... | true |
50ddc50db965faf63a7d92ef7d20c8e12bf31479 | JavaScript | Paperytxt/bot.txt | /botmaking.js | UTF-8 | 4,625 | 3.171875 | 3 | [] | no_license | const Discord = require('discord.js');
const bot = new Discord.Client();
const fs = require("fs");
const math = require("mathjs");
const coins = require("./coins.json")
const ownerid = "yourid"
bot.on('ready', () => {
bot.user.setActivity("Being a bot is hard.")
console.log("Bot is online.")
});
bot.on('message... | true |
02fbcf8e1a5ee5551b6f65d05b75f050609d2712 | JavaScript | mishapapasha/textReader | /src/js/utilities/textReader.js | UTF-8 | 209 | 2.96875 | 3 | [
"MIT"
] | permissive |
function readText(){
let textArea = document.getElementById("textToSpeach");
console.log(textArea);
var msg = new SpeechSynthesisUtterance(textArea.value);
window.speechSynthesis.speak(msg);
} | true |
ba765ad228ba69b6f3e6ea9483b2d327100bd427 | JavaScript | StianIsmar/guitar-tuner | /client/src/components/VisualiseTuning.js | UTF-8 | 2,418 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react";
import "../css/VisualiseTuning.css";
class VisualiseTuning extends Component {
constructor(props) {
super(props);
this.state = { recorderWidth: "" };
}
static getDerivedStateFromProps(props, state) {
if (props.recorderWidth !== state.recorderWidth) {
r... | true |
d254f46d20693aab44238f4f4f675efc966cb75f | JavaScript | yoojeonghan/algorithm | /javascript/funcDevelopment/index.js | UTF-8 | 617 | 3.140625 | 3 | [] | no_license | function solution(progresses, speeds) {
const answer = [];
while (progresses.length > 0) {
let num = 0;
for (let i = 0; i < progresses.length; i++) {
progresses[i] += speeds[i];
}
for (let i = 0; i < progresses.length; i++) {
if (progresses[i] >= 100) {
... | true |
626676a637049705728e70bffaf720349652ad77 | JavaScript | martinhecher/config-proxy | /router.js | UTF-8 | 1,213 | 2.59375 | 3 | [
"MIT"
] | permissive | var hyperprox = require('hyperprox')
function processRoute(route){
if(route.indexOf('env:')==0){
var parts = route.split(':')
return process.env[parts[1]]
}
else{
return route
}
}
module.exports = function(args){
if(!args.routes) args.routes = {}
if(!args['default']){
throw new Error('yo... | true |
5e34a26eccc36b0d507af5e8085b5b1538b4a39d | JavaScript | jithender4ever/simple-weather-app | /src/common/utils.spec.js | UTF-8 | 1,728 | 2.75 | 3 | [] | no_license | import { transformData, getDisplayDate } from "./utils";
describe("Util functions", () => {
const props = {
classes: {},
weather: {
data: {
weather: [
{
description: "TEST"
}
],
main: {
temp: 100
},
name: "CITY"
}
... | true |
76b39b2f24538e032b126e6d7a5c88fad44949e2 | JavaScript | zxk-github/zufeng | /node/13.stream/7.pause.js | UTF-8 | 565 | 2.921875 | 3 | [] | no_license | const fs = require('fs');
const PauseReadStream = require('./7.pauseReadStream');
const rs = new PauseReadStream('./demo1.txt', {
highWaterMark: 3
})
// 在实际的情况下, 当可读流出创建之后会立刻进入暂停模式, 其实会立刻填充缓存区
rs.on('readable', () => {
// 获取当前缓存区大小
console.log(rs.length);
let char = rs.read(1);
// 一旦发现缓存区的字节数小于... | true |
1b0d9a327f60b04b33b174ff121454e4a6fdc0b1 | JavaScript | changodiez/e-commers | /client/src/components/Login.jsx | UTF-8 | 3,107 | 2.5625 | 3 | [] | no_license | import React, { useState } from "react";
import { Redirect } from "react-router-dom";
const Login = (props) => {
const [inputs, setInputs] = useState({
email: "",
password: "",
loginError: "",
loginSuccess: "",
});
const setAuth = props.setAuth;
//Managing login
const { email, password, log... | true |
15535dee4fd03e92f4357acf86190d6e48a2baa4 | JavaScript | viniciusnw/angular-started | /public_html/app/services/rest/Rest.js | UTF-8 | 3,252 | 2.78125 | 3 | [
"MIT"
] | permissive | //
// ---------------------------------------------------------------------------
//
// # REST - App
//
// Version: 1.0
// Homepage: *
// Latest update: 12 Dez, 2016
// Code~Review: Vinicius Inácio <viniciusnw@hotmail.com>
//
// DESC:
//
// Service padrão para requisicoes REST( POST, GET, OPTION, PUT, DELET... | true |
193273ead6b7015c37f21fcfa0fe2db3fbe6b122 | JavaScript | marco-a/object-buffer | /src/example.js | UTF-8 | 657 | 3.03125 | 3 | [
"MIT"
] | permissive | import ObjectBuffer from './ObjectBuffer'
const instance = new ObjectBuffer;
// { temperature: [ 10, 0, 0, 0 ] }
console.log(instance.update({
'^temperature[4]#': 10
}))
// { temperature: [ 20, 10, 0, 0 ] }
console.log(instance.update({
'^temperature[4]#': 20
}))
// { temperature: [ 30, 20, 10, 0 ] }
console.log(... | true |
7f135a12aee5f95f46ebf7eb4b6dfce51e88421d | JavaScript | reharik/freakin-react-forms | /src/components/Form.js | UTF-8 | 3,316 | 2.65625 | 3 | [
"MIT"
] | permissive | import React, { PropTypes } from 'react';
import validationRunner from './../helpers/validation/validationRunner';
import normalizeModel from './../helpers/normalizeModel';
import decorateInputs from './../helpers/decorateInputs';
class Form extends React.Component {
state = {
formIsValid: true
};
component... | true |
46259891f9ce254a30af17e48ac4a58deb71c7ed | JavaScript | widadina28/BackEndAPI | /src/controller/location.js | UTF-8 | 2,936 | 2.578125 | 3 | [] | no_license | const {
getDataLocationByIDModel,
createLocationModel,
putLocationModel,
deleteLocationModel,
getDataLocationModel
} = require('../models/location')
module.exports = {
getDataLocationByID: async (req, res) => {
const {
id
} = req.params
try {
const result = await getDataLocationByID... | true |
c3246af1a2e28d52acb1dc586b2261f04bee6167 | JavaScript | svetoslavmishev/Javascript-Proraming-Basic | /7 Advanced Loops/05. Sequence 2k+1/app.js | UTF-8 | 172 | 3.1875 | 3 | [
"MIT"
] | permissive | function sequence([arg1]) {
let n = Number(arg1);
let num = 1;
while (num <= n) {
console.log(num);
num = num * 2 + 1;
}
}
sequence(["10"]); | true |
c33f80893d65d8277cda979a3bf3ec0f0f131202 | JavaScript | cheng022074/zbee-sdk | /src/mindmap/data/node/from.fn.js | UTF-8 | 424 | 2.65625 | 3 | [] | no_license |
/**
*
* 根据所提供的标识来获得脑图节点
*
* @import is.string
*
* @import isObject from is.object
*
* @import from from .from scoped
*
* @param {mixed} node 脑图节点标识
*
* @return {data.Record} 脑图节点
*
*/
let {
nodes
} = this ;
if(isString(node)){
return nodes.get(node) ;
}else if(isObject(node)){
l... | true |
e9c94e16c86368262cfdf2d0e32c9def3a9bff7e | JavaScript | pryvalovbogdan/simple-google-extension | /popup/popup.js | UTF-8 | 866 | 3.03125 | 3 | [
"ISC"
] | permissive | const redBtn = document.getElementById('red');
const blueBtn = document.getElementById('blue');
const greenBtn = document.getElementById('green');
const input = document.getElementById('input');
const sendMessagePopUp = message => {
const params = {
active: true,
currentWindow: true
};
chrome.tabs.query(... | true |
fa9925a59173c769a588bf39c8fb69b52b3be523 | JavaScript | lorenaquint/IniciandoJavascript2 | /Mod1/js/variables.js | UTF-8 | 1,948 | 3.890625 | 4 | [] | no_license | //Pedir datos por teclado
/*
var nombre = prompt("Ingrese su nombre");
console.log(nombre);
alert(nombre);
*/
//** Variables numércias */
var num = 5;
console.log("num",num);
//** Variables de texto */
var palabras = "palabras";
console.log("palabras",palabras);
//** Variables booleanas */
var activo = true;
consol... | true |
16d79166bba9c26d4a2e34ef5b54f637691093b4 | JavaScript | FreemanS98765/contract-mgmt-system | /src/utils/utils.js | UTF-8 | 2,522 | 2.984375 | 3 | [] | no_license | export const getFormattedDate = (val) => {
// Converts date object to string
if (Object.prototype.toString.call(val) === "[object Date]") {
return `${val.getMonth() + 1}/${val.getDate()}/${val.getFullYear()}`;
}
return val;
};
export const getLongFormattedDate = (val) => {
let options = {
weekday: "... | true |
40cabce6687d305dcd11d9f00f3486736d6d2ba6 | JavaScript | loilo/livy | /bin/rename-js-to-mjs | UTF-8 | 1,416 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env node
const fs = require('fs')
const { promisify } = require('util')
const { extname, basename, join } = require('path')
const { packageDir, argv } = require('./_helpers')
const verbose = argv.verbose || argv.v
/**
* Recursively rename .js files to .mjs inside a directory
*
* @param {string} path The... | true |
fcff7610c0a585f84b8c1b03995732e356115959 | JavaScript | cupofjoakim/sudoku-service | /src/services/sudoku-generator.test.js | UTF-8 | 846 | 2.921875 | 3 | [
"MIT"
] | permissive | import { VALID_BOARD } from '../helpers/test-helper';
import SudokuGenerator from './sudoku-generator';
describe('generateBoard', () => {
it('returns a complete solution', () => {
const board = SudokuGenerator.generateBoard();
const flattenedArray = Array.prototype.concat(...board);
for (const digit of f... | true |
3e418caf8575ccf1b9d8b1e9f5b4c96b64c6132f | JavaScript | sadovskyic/FL-11 | /FL_11_16_homework_inheritance/homework/js/task3.js | UTF-8 | 4,268 | 3.671875 | 4 | [] | no_license | {
function Pokemon() {
Object.call(this);
}
Pokemon.prototype = {
getType: function () {
return this.element;
},
getSpecie: function () {
return this.specie;
},
canFly: function () {
return this.flying;
},
g... | true |
231d748fb72504c060548490f5eff5a700832f2b | JavaScript | joongex2/Try | /src/components/TodoList.js | UTF-8 | 2,273 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
import Bin from "../bin.png"
export default class TodoList extends Component {
state = {
todo: [],
inputField: ""
}
componentDidMount() {
this.fetchTodoList();
}
fetchTodoList = async () => {
const ... | true |
5540166b36c707ffa7dff2b097cbc60f368fc58a | JavaScript | adam-kosinski/adam-kosinski.github.io | /Air War/airWarRisingAnimation.js | UTF-8 | 1,335 | 3.234375 | 3 | [] | no_license | function riseAnimate(centerElement,textContent,style){
/* centerElement: element on which original position of textContent will be centered
textContent: visible text that will rise
style: CSS styling to be applied to <p> element that will house textContent
*/
disableClicks();
var body = document.getElements... | true |
a764b3f47cfeff2121ec9120ff9f3087117ce223 | JavaScript | ShellMonster/flashToAnim | /tools/flashScript/3.导出动画数据.jsfl | UTF-8 | 10,886 | 2.5625 | 3 | [] | no_license | /*
copyright 2016 wanghongyu.
The project page:https://github.com/hardman/FlashAnimationToMobile
My blog page: http://blog.csdn.net/hard_man/
*/
fl.outputPanel.clear();
print("-----------------execute begin--------------")
//fl.openDocument("file:///C:/Users/Color/Desktop/fljs/测试.testTest.fla")
var do... | true |
1bb26e7d2df42f4917aa93da252be63daf0cb1cf | JavaScript | toupstream/toupstream.github.io | /projects/iDwa.js | UTF-8 | 5,993 | 2.78125 | 3 | [] | no_license | var stars = [];
var link = [];
//star.
var speed = 0;
var sp = 1;
var spm = 30;
var di = 0;
var dr = 3;
var md = 0;
//increment.
var op = 0;
var oq = 0;
var or = 0;
var amp = 0.01;
var opp = 0;
//main character.
var wd = 0;
var wd2 = 0;
var t = 0;
//link.
var sz = 1;
var szi = 0.01;
//excursion.
var loff = 0;
var roff ... | true |
78a3bb5c6b315fc7d264c9e498b81b327313d413 | JavaScript | soham-git/soham-github | /script.js | UTF-8 | 449 | 3.5625 | 4 | [
"MIT"
] | permissive | let c = document.querySelector(".clock");
let d = document.querySelector(".date");
setInterval(() => {
let today = new Date();
let hh = today.getHours();
let mm = today.getMinutes();
let ss = today.getSeconds();
let date = today.toDateString();
c.innerText = `${padding(hh)} : ${padding... | true |
12f8f0ef9828af00b529a8eeb47a87e61fed03fb | JavaScript | brianbreitsch/geodetic-scatter-plot | /index.js | UTF-8 | 4,009 | 2.5625 | 3 | [] | no_license | // geodetic-scatter-plot viz
var _ = require('lodash');
var inherits = require('inherits');
var d3 = require('d3');
// creates our Google map and subclasses ScatterOverlay, which
// may only be done after Google Maps API has loaded
function initializeMap(viz) {
var mapOptions = {
center: new google.map... | true |
bd76ef7a7639dcf2cdfb6b833b12caa949881b60 | JavaScript | mikkqu/leetcode-js | /math/compute-gcd.js | UTF-8 | 470 | 3.5625 | 4 | [] | no_license |
/*
Do not use *, / or %
O(log(x) + log(y))
*/
let gcd = (x, y) => {
if (x == y) {
return x
} else if ((x & 1) == 0 && (y & 1) == 0) {
return gcd(x >>> 1, y >>> 1) << 1
} else if ((x & 1) == 0 && (y & 1) != 0) {
return gcd(x >>> 1, y)
} else if ((x & 1) != 0 && (y & 1) =... | true |
fee607d9ed3d1632fe1f6ea0075d17e1b5f881bd | JavaScript | eldanka/Day04 | /ex10/src/index.js | UTF-8 | 230 | 2.546875 | 3 | [] | no_license | function main(){
myFirstName = "Eldan";
myLastName = "Kahrovic";
myHomeTown = "Sarajevo";
return {
myFirstName,
myLastName,
myHomeTown
};
}
console.log(main());
module.exports = main; | true |
676aee1157a94fd21644c23d1673975528a1cbc9 | JavaScript | code-warrior/es6--the-javascript-weve-been-waiting-decades-for | /es6-examples/js/05--strings--tagged-templates.js | UTF-8 | 623 | 3.5625 | 4 | [] | no_license | // Strings: Tagged templates
let firstDonor = `Frank`,
firstDonation = 3,
secondDonor = `Jane`,
secondDonation = 1;
function thanksForYourDonation(literals, name, donationAmount) {
return literals[0] + name + literals[1] + donationAmount + literals[2];
}
console.log(thanksForYourDonation`Hi, ${firstDo... | true |
0084f09e7e58a15a6324b89e8b0c29c849c942a6 | JavaScript | lizharris90210/the-green-room | /server.js | UTF-8 | 1,154 | 2.5625 | 3 | [] | no_license | // Dependencies
var express = require('express');
var path = require('path');
var app = express();
var PORT = 3000;
var reservations = [];
var waitList = [];
// Express app setup / data parsing
app.use(express.urlencoded({ extended: true }));
app.subscribe(express.json());
// Data
// Starts the server to begin li... | true |
957dd2e2aa292dad7d7b405aeadaf0282c51acb6 | JavaScript | LC022867/EE19-ar2 | /JavaTrain/beginner/datatypes/datatypes.js | UTF-8 | 308 | 3.46875 | 3 | [] | no_license | let yourAge = 18; //number
let yourName = 'Luciano'; //string
let name = {first: 'Jane', last: 'Doe'}; //Object (dosen't care about the order)
let truth = false; //boolean
let groceries = ['apple', 'banana', 'oranges']; //array (cares about the order)
let random; //undefined
let nothing = null; //value null | true |
e2e77cd6e4055407a918a39811c371dd584d8653 | JavaScript | katy-tsai/react-socket | /public/js/login.js | UTF-8 | 2,079 | 2.65625 | 3 | [] | no_license | const React =require('react');
const update = require('react/lib/update');
const ReactDOM = require('react-dom');
var io = require('socket.io-client') ;
var socket = io('http://localhost:3000');
var LoginForm = React.createClass({
getInitialState:function(){
return {
user:{account:"",password:""},
is... | true |
d06d07ba29d6f29dbaa2baa4838bba55f5380496 | JavaScript | marwia/Tastysnap | /api/controllers/ProductController.js | UTF-8 | 8,445 | 2.6875 | 3 | [
"MIT"
] | permissive | /**
* ProductController
*
* @description :: Server-side logic for managing Products
* @help :: See http://links.sailsjs.org/docs/controllers
*/
/**
* Module dependencies
*
* Prese da https://github.com/balderdashy/sails/blob/master/lib/hooks/blueprints/actions/find.js
*/
var actionUtil = require('sai... | true |
020bc4cd10f87fa9b3b843d9234daf291f02b5b2 | JavaScript | pWydmuch/PSW-Lab | /zad4.js | UTF-8 | 1,677 | 3.34375 | 3 | [] | no_license |
// let isDrawing = false;
// let x = 0;
// let y = 0;
// const myPics = document.getElementById('draw');
// const context = myPics.getContext('2d');
// let width =1;
// const rect = myPics.getBoundingClientRect();
// document.addEventListener('keydown',e=>{
// if(e.keyCode>48 && e.keyCode<58)
// width = e.k... | true |
277bf56422e7c6415597d9f17aac250b7cabf0d5 | JavaScript | gigatodadze/solotypewriter | /index.js | UTF-8 | 6,730 | 2.671875 | 3 | [] | no_license | // import 'Gen' from "sentence-generator";
// const jsdom = require('jsdom')
// const dom = new jsdom.JSDOM("")
// const jquery = require('jquery')(dom.window)
// const sentenceGenerator = require("sentence-generator");
// const gen = sentenceGenerator('src/content.txt');
// const a = gen.take(3);
// return;
... | true |
d21466ca82abc5b9012eae9f405e8af7549841bf | JavaScript | Tanmay53/cohort_3 | /submissions/sm_108_krishna-kant/week_03/day_3/session_2/range_limit.js | UTF-8 | 121 | 3 | 3 | [] | no_license | var limit = 10;
// function
function print(args) {
console.log(args);
}
for (i = 0; i <= limit; i++) {
print(i);
}
| true |
2ca37fd8df1e679442eb3b603ed1de23b8139a35 | JavaScript | lylycs/restaurant | /scripts/restaurant.js | UTF-8 | 9,570 | 2.90625 | 3 | [] | no_license | var url = new URL(window.location.href);
var restaurantId = url.searchParams.get("id");
// Component Variables
const title = document.querySelector(".title");
const rname = document.getElementById("rname");
const about = document.getElementById("about");
const phone = document.getElementById("phone");
const websiteurl ... | true |
0d85b3ff9bcf2d11951041bfee7101c54203f506 | JavaScript | Lovaro/tp-ventasPc | /tests.js | UTF-8 | 2,016 | 2.84375 | 3 | [] | no_license | describe("precio Maquina componentes", () => {
it("1 - precioMaquina", () => {
const precioTotal = 320;
expect(
precioMaquina(["Monitor GPRS 3000", "Motherboard ASUS 1500"])
).to.be.eql(precioTotal);
});
it("2 - cantidad Ventas Componente", () => {
const venta = 2;
expect(cantidadVentas... | true |
599abafec37b1999cb212468dd2cc30db5fa4022 | JavaScript | bertGo/jnzzdichan | /statics/js/nav.js | UTF-8 | 502 | 2.546875 | 3 | [] | no_license | $(function() {
// var winw = parseInt($(window).width());
// $('.menu .nav .box').css({
// // 'padding-left': (winw - 960) / 2,
// // 'padding-right': (winw - 960) / 2,
// });
var navLi = $(".menu .nav li");
navLi.mouseover(function() {
$(this).find("a").addClass("current");
$(th... | true |
e4aaaa2a1fe7f79118a2cddb383a40f9a6bd5503 | JavaScript | swpllmp/anisa | /obj.js | UTF-8 | 246 | 3.3125 | 3 | [] | no_license | var obj={
title:'java',
author:'anisa',
1:'one'
};
console.log(obj);
//obj.title='java';
//obj.author='anisa';
/*console.log(obj);
console.log(obj['title']);
console.log('the author is '+ obj.author);*/
console.log(obj[1]); | true |
1c63838414cf4f1a3e892dfeb55a9840a239c6e7 | JavaScript | kombat-fml/mini-projects | /typing-text/scripts.js | UTF-8 | 504 | 3.296875 | 3 | [] | no_license | 'use strict';
const input = document.querySelector('.input'),
text = document.querySelector('.text');
function print() {
text.textContent = input.value;
}
function debounce(time) {
return function () {
let previousCall = this.lastCall;
this.lastCall = Date.now();
if (previousCall && this.lastCall - ... | true |
b7041aa7b66a5a0553525630b662e20bb91f14f5 | JavaScript | balde16/Web_Scraping_NodeJs_Mongodb | /models/urlInsert.js | UTF-8 | 1,187 | 2.75 | 3 | [] | no_license | const mongoose = require('mongoose')
const Schema = mongoose.Schema
const urlSchema = new Schema({
url: { type: String, unique: true },
status: String // OK / NOT OK
})
const CollectionURL = mongoose.model('URL', urlSchema)
module.exports = class UrlInsert {
constructor(url) {
this.url = url
this.collec... | true |
921c14bcd0f35c0f740d91fac880911d61b5e0cc | JavaScript | laosdirg/ftbrowser | /src/actions.js | UTF-8 | 878 | 2.5625 | 3 | [] | no_license | // -----------------ACTORS---------------------------
export const REQUEST_ACTORS = 'REQUEST_ACTORS'
function requestActors() {
return {
type: REQUEST_ACTORS
}
}
export const RECEIVE_ACTORS = 'RECEIVE_ACTORS'
function receiveActors(actors) {
return {
type: RECEIVE_ACTORS,
actors: actors,
received... | true |
42434762a2891e06e48083f0223f25c14d67362e | JavaScript | pietroballarin/Game-Project | /src/player.js | UTF-8 | 508 | 3.03125 | 3 | [] | no_license | class Player {
constructor() {
this.x = 210;
this.y = 480;
this.width = 60;
this.height = 120;
}
preload() {
this.carImg = loadImage('./resources/player/car.png');
}
draw() {
image(this.carImg, this.x, this.y, this.width, this.height);
this.... | true |
d368485bcb3f9506448e8e983c7b429e11d4904e | JavaScript | j4eubtgbg/run-jaxon-run | /Project_Template_C11_Let-s_Run_JAXON-main/sketch.js | UTF-8 | 1,417 | 3.078125 | 3 | [] | no_license | var j,jrun;
var bomb,b1;
var road,path;
var score = 0
var coin, money;
function preload(){
//pre-load images
jrun = loadAnimation('R1.png','R2.png')
bomb = loadAnimation('bomb.png');
path = loadAnimation('path.png');
coin = loadAnimation('coin.png');
}
function setup(){
createCanvas(400,400);
//create s... | true |
d110d039d641abe40102b9a104b8e5039dc2a04d | JavaScript | Manouchehri/ExpoSE | /tests/regex/split/split_5.js | UTF-8 | 208 | 3.078125 | 3 | [
"MIT"
] | permissive | //Tests replace on a global regex
var x = symbolic X initial '';
var b = /.../;
assume x.length < 2;
x = x.split(b);
if (x.length > 1) {
throw 'Unreachable';
}
if (x.length == 1) {
throw 'Reachable';
} | true |
cd8b6a2339d25f83e8ae1ab0cfa0754109c646f0 | JavaScript | mariu6/JS-Advanced-Sept-2019 | /12 EXERCISE DOM/04. Numpad-Calculator/solution.js | UTF-8 | 2,307 | 3.15625 | 3 | [] | no_license | function solve() { // греката е в спейсинга: 3 . 6x2.5
let input = "";
let operand = "";
let operations = {
"/": function () { return input[1] ? input[0] / input[1] : NaN },
"x": function () { return input[1] ? input[0] * input[1] : NaN },
"-": function () { r... | true |
4d2664f6a9f50db243f289fb96d60a120a427b38 | JavaScript | ptnghiabioif/FrontEndCourse | /01_Javascript_A-Z/B41_promise/index.js | UTF-8 | 1,210 | 3.828125 | 4 | [] | no_license | // Promise: để then tiếp theo chờ then trước đó thì phải trả về 1 promise
// var fs = require('promise-fs');
// function onDone(song){
// console.log(song);
// }
// function onError(error) {
// console.log(error);
// }
// function readFile(path) {
// return fs.readFile(path, {encoding: 'utf8'});
// }
//... | true |
d75858139cf64ff020de5b05400046a4a9ed76b6 | JavaScript | eliteReaper/learningMERN | /controllers/auth.js | UTF-8 | 2,180 | 2.515625 | 3 | [] | no_license | const User = require("../models/user");
const bcrypt = require("bcryptjs");
const { validationResult } = require("express-validator/check");
exports.postLogin = (req, res, next) => {
// console.log(req.body);
User.findOne({ email: req.body.email })
.then((user) => {
if (!user) {
res.send(false);... | true |
0b558d511828dc69bf9953649342cd8de9f5aa74 | JavaScript | Makoq/blog | /routes/comments.js | UTF-8 | 1,556 | 2.59375 | 3 | [] | no_license | const express=require('express')
const router=express.Router()
const checkLogin=require('../middlewares/check').checkLogin
const CommentModel = require('../models/comment')
//POST /comment 创建一条留言
router.post('/',checkLogin,function(req,res,next){
const author = req.session.user._id
const postId = req.fields.pos... | true |
ce91f6541dd1f7d9495d08f821cfebf5a96c5278 | JavaScript | JuanPabloMesaAlvarez/React-course | /react-complete-guide 1 to 6/src/AppAssignment2.js | UTF-8 | 1,420 | 2.984375 | 3 | [] | no_license | import { React, Component } from 'react';
import Validation from './Validation/ValidationComponent';
import Char from './Char/Char';
class AppAssignment2 extends Component {
state = {
word: [],
length: 0
};
inputChangedHandler = (event) => {
let word = [...this.state.word];
... | true |
a65b8d61ad8dc087c21f2dac84a8d90a9977cbc0 | JavaScript | Blackwolf948/IT107FInal | /Functions.js | UTF-8 | 4,248 | 4 | 4 | [] | no_license | console.log("COPY PASTES ")
function sayHelloWorld(){
console.log("Hello, world!");
}
sayHelloWorld();
// Expected output: "Hello, world!"
// friendName is our parameter. It's a placeholder that we can use inside the function
function greetAFriend(friendName){
console.log(`Hello, ${friendName}!`)... | true |
236aa111919aa941429d11ef57679a2154093282 | JavaScript | brunarbcampos/n1-meli-logica-2 | /3_estrutura/exercicio.js | UTF-8 | 1,117 | 3.546875 | 4 | [] | no_license | var r = require("readline-sync");
var produtos =[
{produto: "lasanha", tempoDeValidade: 20, Congelado: true},
{produto: "sorvete", tempoDeValidade: 50, Congelado: true},
{produto: "biscoito", tempoDeValidade:80, Congelado: false}
];
var posicao = parseInt(r.question("Escolha um produto: 0 - lasanha, 1 - s... | true |
c0baf379113bc0af3f0282474c2496e4a0bf64ae | JavaScript | kuakling/template-react-16-ssr | /api-graphql/data/schema.js | UTF-8 | 1,823 | 2.578125 | 3 | [
"MIT"
] | permissive | // Schema for sample GraphQL server.
// ----------------------
// IMPORTS
// GraphQL schema library, for building our GraphQL schema
import {
GraphQLObjectType,
GraphQLString,
GraphQLSchema,
} from 'graphql';
import * as schemas from './schemas/index';
// ----------------------
// Root query. This is our 'p... | true |
656fa1d9fb393e6efd33f4b358f2064b8cbc6594 | JavaScript | duribeiro/trybe-exercises-1 | /FRONT-END/BLOCO_09/DIA_1/exercicio2/vowels.js | UTF-8 | 456 | 3.25 | 3 | [] | no_license | function vowels(str) {
const strArr = str.split("");
return strArr.reduce((acc, letter) => {
if (
letter === "a" ||
letter === "e" ||
letter === "i" ||
letter === "o" ||
letter === "u" ||
letter === "A" ||
letter === "E" ||
letter === "I" ||
letter === "O" |... | true |
908acb7f72957e1f83e0267090c32ef0e09d20a8 | JavaScript | GustavoGuke/Curso-JavaScript-TypeScript | /modulo-10node/fs/fs02/index.js | UTF-8 | 574 | 2.90625 | 3 | [] | no_license | const path = require('path')
const caminhoArquivo = path.resolve(__dirname, 'texto.json')
const escrever = require('./modulos/escrever')
const ler = require('./modulos/ler')
// const pessoas = [
// {nome: 'pessoa1'},
// {nome: 'pessoa2'},
// {nome: 'pessoa3'},
// {nome: 'pessoa4'},
// ]
// let jsons ... | true |
7b82c0b200e0b83f190a3c95d8cd2cd8e6dc0b1e | JavaScript | scottblinch/alien-invasion-exemption-request | /js/main.js | UTF-8 | 4,556 | 3.0625 | 3 | [] | no_license | (function() {
function toggleNavigation(event) {
event.stopPropagation();
if (navigationIsOpen()) {
closeNavigation();
} else {
openNavigation();
}
}
function navigationIsOpen() {
return site.classList.contains('site-navigation-open');
}... | true |
70d41190bafb7ea9d04110108bae052f964b7988 | JavaScript | ossimlabs/tlv | /apps/tlv-app/grails-app/assets/javascripts/time-lapse.js | UTF-8 | 19,990 | 2.5625 | 3 | [
"MIT"
] | permissive | function aFeatureHasBeenSelected(feature, event) {}
function buildSummaryTable() {
var table = $( "#timeLapseSummaryTable" )[ 0 ];
for ( var i = table.rows.length - 1; i >= 0; i-- ) { table.deleteRow( i ); }
var row = table.insertRow( 0 );
$( row ).css( "white-space", "nowrap" );
var cell = row.i... | true |
13f01ccb3d12b322d881bbf467ae00e9583186a9 | JavaScript | Tihi777/hotel-admin-panel | /client/src/reducers/serviceReducer.js | UTF-8 | 583 | 2.515625 | 3 | [] | no_license | import { CREATE_SERVICE, FETCH_SERVICES, UPDATE_SERVICE, DELETE_SERVICE } from '../constants/serviceConstants';
const serviceReducer = (services = [], { type, payload }) => {
switch (type) {
case CREATE_SERVICE:
return [...services, payload];
case FETCH_SERVICES:
return payload;
case UPDATE_S... | true |
50c16e00d433de06b53953c19fc0d0f58778f257 | JavaScript | Puune/EventPlanner | /ep-frontend/src/components/OccasionsList.js | UTF-8 | 1,024 | 2.6875 | 3 | [] | no_license | /**
* This module contains occasion list component
* @module OccasionsList
*/
import React from 'react';
import _ from 'lodash';
import Occasion from './OccasionClass';
import ListGroup from 'react-bootstrap/ListGroup';
/**
* This component builds a list of occasions
* @class
* @param {*} props
*/
const Occ... | true |
539a945f95cde71dd9bed909d8709f1b6981632c | JavaScript | khanakia/redis-examples | /queue/server.js | UTF-8 | 758 | 2.671875 | 3 | [] | no_license | const uuidv4 = require('uuid/v4');
var redis = require("redis");
var client = redis.createClient({
db: 1
});
function waitForData () {
client.brpop('demolist', 0, function (listName, item) {
//## RECEIVE MESSAGE
const message = JSON.parse(item[1])
console.log(message)
//## SEN... | true |
a0bd8677bf15f3464b884964a14a80e80ede4bc3 | JavaScript | Alejo-Martinez-Grau/miniChango | /src/components/navbar.jsx | UTF-8 | 973 | 2.734375 | 3 | [] | no_license | /* eslint-disable jsx-a11y/anchor-is-valid */
import React from "react";
import cart from "../images/cart.png";
// stateless functional component
// snippet sfc
const NavBar = (props) => {
//
const totalSum = (i) => {
let totalArray = [];
let total;
for (i = 0; i < props.counters.length; i++) {
... | true |
3a11701c6bbc2bdffcfc79cf163972d9591b8504 | JavaScript | dpolican/OrderEntry | /src/model/Order.js | UTF-8 | 1,966 | 2.578125 | 3 | [] | no_license | import moment from 'moment';
const COMPLETED = 'completed',
OUTSTANDING = 'outstanding',
CANCELLED = 'cancelled';
const PRODUCTION = 'production',
SAMPLE = 'sample';
class Order {
static get TYPE_PRODUCTION() {
return PRODUCTION;
}
static get TYPE_SAMPLE() {
return SAMPLE;
... | true |
f6d476bb11ce69c1a9699b2bd615636a8c3a5ac3 | JavaScript | ar94952/JavaScript | /assign5/reservation/reservation.js | UTF-8 | 1,562 | 3.5 | 4 | [] | no_license | /****************************
*Anthony Rivera
*anthonyriv2@my.smccd.edu
*CIS 117 OL
*reservation.js
*Assignment #5
*10/21/2017
****************************/
function validateForm() {
//Assign form values to variables
var arrivalDate= document.getElementById("arrival_date").value;
var noOfNights=document.getEl... | true |
2e5187b5c7c21cebf8def569a07da907eb97ea0a | JavaScript | aliev98/student_portfolio | /portfolio_aliev1/src/constants/links.js | UTF-8 | 2,273 | 2.671875 | 3 | [
"MIT"
] | permissive | import React from "react"
import { globalHistory } from "@reach/router"
import { Link } from "gatsby"
/*
A tricky component, because I hade to get the animations
working in the right way.
I also use the globalHistory object of gatsby router in order
to check which page we are. I use this in the sidebar.
If... | true |
ed28121445030ea3313b2e709a4fa4f74c2481fe | JavaScript | BacqEstelle/javascript-exercice-2 | /0.exoNext/Ajax/js-exercises-ajax-webservice/script.js | UTF-8 | 552 | 3.375 | 3 | [] | no_license | /*async function returnCharacter(){
try{
let response = await fetch("https://thatsthespir.it/api");
let valueGraphic = await response.json();
console.log(valueGraphic);
let title = document.getElementById("firstHeading");
let addGraphic = document.createElement("p");
... | true |
d73b176a0ec25fd0bbcbd5781bc7ce9ab192c8b9 | JavaScript | dl-academy-edu/vt-du-daria-3 | /src/pages/main/index.js | UTF-8 | 2,808 | 2.703125 | 3 | [] | no_license | console.log ("form2");
let wrapper = document.querySelector(".slider__wrapper");
let innerWrapper = document.querySelector(".slider__inner-wrapper");
let slides = document.querySelectorAll(".slider_slide");
let buttonBack = document.querySelector(".button-prev_back");
let buttonNext = document.querySelector(".button-ne... | true |
9532680eded376b053c77cd8fb2eff010a81026d | JavaScript | Priya-bharambe/TypeScript | /interface.js | UTF-8 | 138 | 3.234375 | 3 | [] | no_license | var calculator = {
add: function (first, second) {
return first + second;
}
};
console.log(calculator.add(30, 30));
| true |
8ea6fbeec6634b7de85420dcfd0497c154bfc094 | JavaScript | jellybellyy/whatwegot | /client/src/components/Recipes/EditRecipe.js | UTF-8 | 2,525 | 2.859375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
function EditRecipe({ match, history }) {
//////////////////////////////// HOOKS ///////////////////////////////////
const [recipeId] = useState(match.params.id);
const [recipeDetails, setRecipeDetails] = useStat... | true |
098cbb163e13c7208385d718fc14c431490be24a | JavaScript | DivyaVineeth/imad-2016-app | /ui/main.js | UTF-8 | 391 | 2.75 | 3 | [] | no_license | console.log('Loaded!');
//change the text of the main-text
var element=document.getElementById('main-text');
element.innerHTML="New girl";
//move image
var img=document.getElementById('madi');
var marginLeft=0;
function moveRight(){
marginLeft=marginLeft+6;
img.style.marginLeft= marginLeft + 'px';
}
img.on... | true |
f2e5baca58478692320ee57c7b863a963901a8a9 | JavaScript | sanaabdullah/FinalYearProjectA---SmartGarden | /angular-script-4.js | UTF-8 | 1,535 | 2.515625 | 3 | [] | no_license | // Application module
var crudApp = angular.module('crudApp',[]);
crudApp.controller("DbController",['$scope','$http', function($scope,$http){
// Function to get Light details from the database
getInfo();
function getInfo(){
// Sending request to LightDetails.php files
$http.post('databaseFiles/LightDetails.php').suc... | true |
5a7508d10b72a4315d6fd4c618951871253c0bf3 | JavaScript | luoyeshu0507/upskills | /learn/learn-rxjs/test5.js | UTF-8 | 242 | 2.515625 | 3 | [] | no_license | const Rx = require('rxjs/Rx')
const source$ = Rx.Observable.interval(1000).take(5)
const subject = new Rx.Subject()
source$.subscribe(subject)
subject.subscribe(console.log)
setTimeout(() => {
subject.subscribe(console.log)
}, 1200)
| true |
92675ed375e76609e6067e64e637593ee033dfe0 | JavaScript | gloomyKevin/simulated-React | /simulated_react.js | UTF-8 | 7,712 | 3.015625 | 3 | [
"MIT"
] | permissive | const RENDER_TO_DOM = Symbol("render to dom")
export class Component {
constructor() {
this.props = Object.create(null);
this.children = [];
this._root = null;
this._range = null;
}
setAttribute(name, value) {
this.props[name] = value;
}
appendChild(compone... | true |
637f1d748bc9d217ef354ac22c45658ba77c4571 | JavaScript | zhugeafanti/DoraemonKit | /Web/packages/utils/src/utils.js | UTF-8 | 1,246 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | export const isObject = function (obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
export const isFunction = function (obj) {
return typeof obj === 'function'
}
export const isMobile = function() {
if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|... | true |
301dc22cc0472e845c83edd52535a8d53669a19d | JavaScript | sagasofia/sagasofia.github.io | /class-work/google-maps-example/js/app.js | UTF-8 | 547 | 2.75 | 3 | [] | no_license | var map;
function initMap() {
// google.maps.Map(element, options)
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 40.785091, lng: -73.968285},
zoom: 11
});
var marker = new google.maps.Marker({
position: {lat: 40.785091, lng: -73.96828... | true |
95ed95d82b57cd4ca99a8bd95ba9b9d23d088a62 | JavaScript | pschmidt01/luriflix | /public/js/views/moviedetails.js | UTF-8 | 1,360 | 2.515625 | 3 | [] | no_license | window.MovieView = Backbone.View.extend({
initialize: function () {
this.render();
},
render: function () {
data = _.clone(this.model.attributes);
$(this.el).html(this.template(data));
if(data.Type == "series") {
$(this.el).append(new EpisodeView({model: thi... | true |
9994cd6e065461a086b90f8f32999401adce8eab | JavaScript | dshundal94/Javascript_calculator | /js/index.js | UTF-8 | 1,350 | 3.3125 | 3 | [] | no_license | $(document).ready(function() {
var entry = '';
var operators = ['+', '-', '*', '/'];
var decimal = false;
$('button').click(function() {
entry = $(this).attr("value");
// Get the input and button values
var input = document.querySelector('#answer');
var inputVal = input.innerHTML;
if(entry == 'ac') {... | true |
0e07db3221c90d22d85125a29c1b1bc27605def1 | JavaScript | codingwithsandid/myapi | /server.js | UTF-8 | 649 | 3 | 3 | [] | no_license | const express = require('express')
const app = express()
app.use(express.json())
const port = 3000
const items = [
{id: 1, name: 'item1'},
{id: 2, name: 'item1'},
{id: 3, name: 'item1'}
]
app.get('/items', (req, res) => {
res.send(items)
})
app.get('/items/:id', (req, res) => {
const item = it... | true |
a7509dfd8b9636625f46172278750c1eb7c7143b | JavaScript | lovros/phonebook | /phonebook-vue/src/helpers/base64-converter.js | UTF-8 | 519 | 2.9375 | 3 | [] | no_license | export default { getBase64StringFromFile }
function getBase64StringFromFile(file){
return new Promise((resolve, reject) => {
var reader = new FileReader();
reader.readAsBinaryString(file);
reader.onload = function(e) {
let binaryString = e.target.result;
let base64S... | true |
fda6fed33027004113c6db75e78be0ea7a37077e | JavaScript | Ganjingdedamao/COMP531Spring | /hw6-backend/src/following.js | UTF-8 | 809 | 2.578125 | 3 | [] | no_license | const Followers={username:'sep1', following:['wl49', 'wl49test']}
const getFollowing=(req,res)=>{
res.send({
username: req.params.user||'sep1',
following: Followers.following
})
}
const putFollowing=(req,res)=>{
if (!Followers.following.includes(req.params.user)) {
Followers.following = [
...F... | true |