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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f54cf9b438f4542ef445ede1279971f6404cd5e5 | JavaScript | jlynaugh/homework1 | /index.js | UTF-8 | 2,763 | 3.265625 | 3 | [] | no_license | // Primary file for the homework1 assignment API
// Dependencies
const http = require('http');
const url = require('url');
const StringDecoder = require('string_decoder').StringDecoder;
// The server should respond to any requests to the /hello route
// with a JSON object containing a greeting
const server = http.cre... | true |
11cbad1910b939e58ac5e49285e7866ccb17054b | JavaScript | WaylandField/javascriptlearning | /hasOwnProp.js | UTF-8 | 355 | 3.390625 | 3 | [] | no_license | var People = function(){
this.name = "name";
};
People.prototype.sayName = function(){
return this.name;
};
People.prototype.attr = "attr";
var farmer = new People();
farmer.land = "land";
alert(farmer.hasOwnProperty("name"));
alert(farmer.hasOwnProperty("land"));
alert(farmer.hasOwnProperty("sayName"));
al... | true |
73b260388d98fa0a23dc6c108468f59b8912883a | JavaScript | ananthuasokkumar/Desktop_codes | /unit-1/week-3/day-2/a.js | UTF-8 | 207 | 3.0625 | 3 | [] | no_license | var array = ["apple", "windows", "ubuntu", "cola", "system"];
var a = function (x) {
if(x.charAt([0])=="a"||x.charAt([x.length-1])=="a")
return x;
}
var output = array.filter(a);
console.log(output); | true |
465a938af980af2d2ef92460ecd350c818acbce5 | JavaScript | cloneforyou/content-review-lookup | /dist/devastio/Common.js | UTF-8 | 542 | 2.84375 | 3 | [
"CC-BY-4.0"
] | permissive | function attachHandlers(){
var e = document.getElementsByClassName('pictureButton');
for (i = 0; i < e.length; i++){
e[i].addEventListener('click', handleExternalLinkButton, false);
}
}
function handleExternalLinkButton(){
window.location.replace(this.getAttribute('data-href'));
}
function getIma... | true |
b215494e7757508345afe592d9dbd5b2f9052294 | JavaScript | enbermudez/types-doodler | /tests/numbers/palindrome.test.js | UTF-8 | 879 | 2.78125 | 3 | [
"MIT"
] | permissive | import palindrome from '../../src/numbers/palindrome';
describe('Number - Palindrome', () => {
it('Should throw an error if the "number" provided is not a number', () => {
expect(() => palindrome({ number: false })).toThrow('ValidationError: "number" must be a number');
});
it('Should throw an error if no "... | true |
4b943224b348cef66b54cfc44c8f3aed4464dc56 | JavaScript | justin-loyola/contacts | /app/modules/contacts.list/factories/contacts.list.factory.js | UTF-8 | 1,788 | 2.953125 | 3 | [] | no_license | ; // jshint ignore:line
(function () {
'use strict';
require('lodash');
angular.module('ContactsApp.factories.contacts.list', [])
.factory('ContactsList', function() {
/**
*
* @constructor
*/
function ContactsList() {
... | true |
b426fc8c60ebf1259b7afa953846955436ab38c3 | JavaScript | bethirahul/Game-Programming-Portfolio-2015 | /games/tiles/main.js | UTF-8 | 6,224 | 2.78125 | 3 | [] | no_license | var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
function adjustedMouseCoords(l_mouseCoords)
{
var totalOffsetX = 0;
var totalOffsetY = 0;
var canvasX = 0;
var canvasY = 0;
var currentElement = this;
do
{
totalOffsetX += curr... | true |
349520523dcc39734d10e9103c5b3240bbba7093 | JavaScript | nhunzaker/js-client-apps | /frameworks/marionette/js/src/helpers.js | UTF-8 | 921 | 2.5625 | 3 | [] | no_license | /**
* @name Application::Helpers
*/
define(['handlebars', 'moment'], function(Handlebars, moment) {
Handlebars.registerHelper('with', function(context, options) {
return options.fn(context);
});
Handlebars.registerHelper('link', function(url, text) {
text = Handlebars.compile(Handlebars.Utils.escapeExpress... | true |
673a51ed50b1b26044442963a65750c751347018 | JavaScript | tobiasmuecksch/NRF24-test | /sender_without_wrapper.js | UTF-8 | 1,032 | 2.78125 | 3 | [] | no_license | 'use strict';
const nrf24 = require('nrf24'); // Load the module
// Init the radio
const rf24 = new nrf24.nRF24(22, 0);
rf24.begin();
console.log('Radio connected:' + rf24.present());
console.log('Is + Variant:' + rf24.isP()); // Prints true/false if radio is + Variant
// Configure the radio
rf24.config({
PALevel:... | true |
fd8e9c55d128ef95e3bc483152732c11264e7510 | JavaScript | Ishwarya510/Recipe | /src/Form.js | UTF-8 | 1,421 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
class Form extends Component {
constructor(props) {
super(props)
this.state = {
usernamer:"",
email:"",
comment:""
}
this.message=this.message.bind(this)
}
changev=(e)=>{
this.setSt... | true |
fce233ee4afbb21b67906018c8b0479cc0e61ede | JavaScript | JhoneLee/nodejsActualCombatCode | /code/chapter2_chatroom/lib/chatUtils.mjs | UTF-8 | 641 | 2.734375 | 3 | [] | no_license |
/**
* 管理用户名
* @param {object} socket socket对象
* @param {number} guestNumber 连接用户数
* @param {object} nickNames 用户昵称表
* @param {array} nameUsed 注册昵称列表
* @returns {number} guestNumber
*/
function assignGuestName(socket,guestNumber,nickNames,nameUsed){
let name = `guest${guestNumber}`; // 分配默认用户名
console.lo... | true |
5b05ed6870454971df9a44b3e088250dcf65cb71 | JavaScript | oddsGold/clock-app | /src/reducers/app-reducer.js | UTF-8 | 1,116 | 2.640625 | 3 | [] | no_license | import {usersApi} from "../api/Api";
const INITIALIZED = 'INITIALIZED';
const SET_USERS_DATA = 'SET_USERS_DATA';
let initialState = {
initialized: false,
users:[]
}
const appReducer = (state = initialState, action) => {
switch (action.type) {
case INITIALIZED:
return {
... | true |
a686dab48d5b8d68da8f54379fbf1d46e78eb1d0 | JavaScript | JonathanMyer/DiscordBot | /commands/key.js | UTF-8 | 1,337 | 2.9375 | 3 | [] | no_license | module.exports = {
name: 'key',
description: 'get something from wow api',
execute(message, args) {
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
const xhr = new XMLHttpRequest();
let reply;
try{
xhr.open('GET', 'https://raider.io/api/v1/characters/profile?region=' +
args[0] + '&real... | true |
31e0baff12eb44b482ed322e230a9506b7d5cfc3 | JavaScript | TheDarkBenBerom/thedarkv12 | /komutlar/unban.js | UTF-8 | 1,026 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | const Discord = require('discord.js');
exports.run = async(client, message, args) => {
if(!message.member.permissions.has("BAN_MEMBERS")) return message.cannel.send('Ufaklık sen ilk bir yetkili olda gel');
let unbanid = args[0]
if(!unbanid) return message.channel.send('Bir üye id belirt.')
let bans ... | true |
f4d4e755abc15487f1351c970a0825aaa820c671 | JavaScript | Silver-IT/bubble-sheet-mobile | /src/screens/index.js | UTF-8 | 3,234 | 2.59375 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import {Text, View, TouchableOpacity, StyleSheet} from 'react-native';
import ImagePicker from 'react-native-image-crop-picker';
import Toast from 'react-native-toast-message';
import BubbleSheetAPI from '../common/api/bubble-sheet';
import {ToastStatus} from '../commo... | true |
d9c8f8aeafe59d2260a171527c0e0d87ce836dc3 | JavaScript | Jovtcho/JSCore | /JSApplications/6.Async-Programming-Exercises/P03Books/app.js | UTF-8 | 4,062 | 2.734375 | 3 | [] | no_license | class Book {
constructor(title, author, isbn, tags) {
this.title = title;
this.author = author;
this.isbn = isbn;
this.tags = tags
}
}
function attachEvents() {
const USER = 'Pesho';
const PASSWORD = '123';
const ENDPOINT = 'https://baas.kinvey.com/appdata/kid_HkQ7jr... | true |
7cca14bde43304ec8b175540693bf216d6c19f5e | JavaScript | green-fox-academy/benebp | /week-06/day-03/content-2.js | UTF-8 | 274 | 3.171875 | 3 | [] | no_license | 'use strict';
let animalList = ['apple', 'banana', 'cat', 'dog'];
let list = document.querySelectorAll('li');
for (let i = 0; i < list.length; i++) {
list[i].innerText = animalList[i];
}
let uElement = document.querySelector('ul');
uElement.classList.toggle('color'); | true |
2e15214496625fb53766a5ab5b9eea12151b0b9b | JavaScript | aleitner/p5-shmup | /defaultWeapon.js | UTF-8 | 1,438 | 3.296875 | 3 | [] | no_license | function defaultWeapon() {
this.maxShots = 10;
this.shots = [];
this.bulletSpeed = 4;
this.firing = false;
this.fire = function(originx, originy, direction) {
if (this.shots.length >= this.maxShots) {
return;
}
this.shots.push(new defaultShot(originx, originy, direction));
this.firing ... | true |
0cfa8e79f9685848f940944763c0f44ccdadb297 | JavaScript | yash-gitRepo/SimonGame | /index.js | UTF-8 | 1,000 | 3.078125 | 3 | [] | no_license | userClickedPattern = [];
gamePattern =[];
buttonColors = ["red", "blue", "green", "yellow"];
function nextSequence(){
var randomNumber = Math.floor(Math.random() * 4);
return randomNumber;
}
if ($(document).keypress()){
var randomChosenColour = buttonColors[nextSequence()];
// $("#red").addClass("pr... | true |
518fb2cab6e63fd4170a6517f58af17731b089b8 | JavaScript | Danilo-Zekovic/javascript-algorithms | /testHeap2.js | UTF-8 | 644 | 3.328125 | 3 | [
"MIT"
] | permissive | function dispArr(arr) {
for (var i = 0; i < arr.length; ++i) {
process.stdout.write(arr[i] + " ");
if (i % 10 == 9) {
process.stdout.write("\n");
}
}
if (i % 10 != 0) {
process.stdout.write("\n");
}
}
var MAX = 50
var sort = require('./src/sorting/heapsort2.js').heapSort;
/*var values = [... | true |
f53a0ad130271ec279d68b04cc49644c721fed81 | JavaScript | LindseyJeeJan/employee-tracker | /index.js | UTF-8 | 11,455 | 3.28125 | 3 | [
"MIT"
] | permissive | const mysql = require('mysql');
const inquirer = require('inquirer');
const cTable = require('console.table');
const connection = require('./config/connection');
const { prompt } = require('inquirer');
const typeChoices = ["Departments", "Roles", "Employees", "Return to main menu"];
const promptMain = {
name: "main... | true |
b917d18386901950c8588a17561fcf337d92fd24 | JavaScript | gidmp/Employee-Tracker | /index.js | UTF-8 | 7,225 | 2.90625 | 3 | [] | no_license | const mysql = require("mysql");
const inquirer = require("inquirer");
const cTable = require("console.table");
const Database = require("./async");
require("dotenv").config();
// create the connection information for the sql database
var connection = mysql.createConnection({
host: process.env.MYSQL_HOST,
port: pro... | true |
8989affa4b0c2da8ce689f308c67f119146d52b2 | JavaScript | bvrajugithub2017/MyDataproExecutive | /index.js | UTF-8 | 1,686 | 2.515625 | 3 | [] | no_license | var express = require('express');
//express is a Node.js framework. It is used to simplify some of the basic tasks.
var bodyParser = require('body-parser');
var rajuRoutes = require('./routes/api'); //.js not required
var app = express(); //set up express application
var mongoose = require('mongoose');
const config... | true |
7a8061144adb1a44e28b1559cae0401d27e91b0c | JavaScript | matthiase/twitter-webos | /app/extensions/formatters.js | UTF-8 | 2,070 | 2.953125 | 3 | [] | no_license | var Formatters;
if (Formatters == null)
Formatters = {};
/////////////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////////////
Formatters.datetimeFormatter = function(value, item) {
try {
var now = ... | true |
f1b893f3e615830d18391dca5ac8fcaf3dccfa75 | JavaScript | kajsaunge/unit-converter | /src/main.js | UTF-8 | 2,492 | 3.625 | 4 | [] | no_license | document.getElementById('getDegree').addEventListener('click', () => {
showResult('fahrenheit');
document.getElementById('fahrenheit').focus();
})
document.getElementById('getDl').addEventListener('click', () => {
showResult('cups');
document.getElementById('cups').focus();
})
function prevent... | true |
01b6e045861ad376c700bbd48c522a18b642fc11 | JavaScript | Janesee3/CatPlace | /src/components/fave-button/FaveButton.js | UTF-8 | 3,140 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import "./FaveButton.css";
import { Button } from "react-bootstrap";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faHeart } from "@fortawesome/free-solid-svg-icons";
import { faHeart as faHeartEmpty } from "@fortawesome/free-regular-svg-icons";
imp... | true |
8a11d8bdebfefa90334cbbcda2fcc98008a3f447 | JavaScript | Joker7777/ReservingRoom | /resources/js/api/booklist.js | UTF-8 | 1,404 | 2.71875 | 3 | [] | no_license | import { callbackify } from 'util';
const axios = require('axios');
const API_URI = '/api/booklist';
export default {
/**
* 表示する1週間分の予約リストを取得
*
* @param {Object} dateObj 取得する週の日曜日のDateオブジェクト
* @param {*} callback
*/
getBookList(dateString, callback) {
axios.get(API_URI + '/'... | true |
62ba32323a2a4928f4c75390d175bad0a577d1e6 | JavaScript | dsaccon/c1 | /c1_backend/web/static/js/autoform.js | UTF-8 | 1,387 | 2.65625 | 3 | [] | no_license | /* function to do magic auto forming */
invokeUpdate = function(e) {
var targetElement = e.target;
var parentElement = $(targetElement).parent();
var payload = {'table': $(targetElement).data('table'),
'table-key': $(targetElement).data('table-key'),
'id': $(targetElement).data('... | true |
94e7be14e9f3ca6be54068321b435e5f24c33b12 | JavaScript | gfvillorente/BWorld-SparkUp | /Do-companies-still-look-at-an-applicants-grades/js/pushMenuLeft.js | UTF-8 | 1,772 | 2.6875 | 3 | [] | no_license | var menuLeft = document.getElementById('cbp-spmenu-s1');
var showLeftPush = document.getElementById('menu');
var body = document.body;
var signIn = document.getElementById('signin');
var logo = document.getElementById('logo');
var state = false; //initially close
showLeftPush.onclick = function() {
classie.toggle(this... | true |
c20673f73f6303c486ccd2d3dd67b37caad91844 | JavaScript | Vijay375-a/React_Training | /Toshiba-React-main -Day5/es6apps/src/index-functionliteral.js | UTF-8 | 373 | 4.0625 | 4 | [] | no_license |
//function declaration
function sayHello(name = 'foo') {
return `Hello ${name}`
}
console.log(sayHello('subramanian'));
//store the function into a variable.
const hello = sayHello;
console.log(hello('ram'));
//way 2
//anonomous function ; funciton without name : es 5
const greeter = function(name='bar') {
r... | true |
31ba5d6ee341c8b15645831dac70d1a123fc1345 | JavaScript | SmolnikovAM/LeetCode | /js/1001. Grid Illumination/test.1001.js | UTF-8 | 1,218 | 2.96875 | 3 | [] | no_license | const fs = require('fs');
const solution = require('./solution.1001.js');
const loadDataFromFile = path => {
const strToArr = str =>
str
.replace(/^\[/, '')
.replace(/^\[/, '')
.replace(/\]$/, '')
.replace(/\]$/, '')
.split('],[')
.map(s => s.replace("'", ''))
.map(s =>... | true |
562fb94de1f6aca110b42fb666c85e93a68a7934 | JavaScript | SaadGamer599/-m- | /كرر كلام بس يعكسه.js | UTF-8 | 694 | 2.859375 | 3 | [] | no_license | client.on('message', message => {
// اذا كان الشخص بوت ماينفذ الامر
if (message.author.bot) return;
// `!`يتاكد ان الامر بدا بـ
if (message.content.indexOf('$un') === 0) {
// `!` ياخذ الرساله بس بدون الـ
var text = message.content.substring(1);
// يعكس ال... | true |
4c79b3ec3cdcc5f022e0701704a08c283828c9f9 | JavaScript | hama28/PolyTech | /html-css/JavaScript/js/Ch02-Lesson02.js | UTF-8 | 364 | 2.921875 | 3 | [] | no_license | let num = 500;
let dec = 3.14159265;
let name = "Tendo Yoshimi";
let br = "<br>";
document.write("<p>◆変数「num」の表示</p>");
document.write(num);
document.write(br);
document.write("<p>◆変数「doc」の表示</p>");
document.write(dec);
document.write(br);
document.write("<p>◆変数「name」の表示</p>");
document.write(name);
document.write(b... | true |
5be3897a8571930d32770af5c55102a17caea359 | JavaScript | Kbuchanan032/TriviaGame | /assets/javascript/app.js | UTF-8 | 696 | 3.0625 | 3 | [] | no_license | function check() {
var question1 = document.quiz.question1.value;
var question2 = document.quiz.question2.value;
var question3 = document.quiz.question3.value;
var correct = 0;
var timeleft = 30;
if (question1 == "Darth Vader") {
correct++;
}
if (question2 == "Purple") {
correct++;
}
if (qu... | true |
46313d4c864989fd303ca5e55233b09a740cd885 | JavaScript | noribang/random_string_js | /script.js | UTF-8 | 1,023 | 3.890625 | 4 | [] | no_license | function randomString() {
var stringAlpha = "abcdefghijklmnopqrstuvwxyz";
var indexNum = 5;
var randomNum;
//Math.floor(Math.random() * 26);//Returns random number from 0 to 25
//Math.random() returns random float
/*Math.floor() returns nearest integer
rounded down*/
//alert... | true |
92a69309e813524b5a7618470346adbe52bc1c8f | JavaScript | Choozii/React-PokemonDictonary_exercise | /src/actions/pokemonActions.js | UTF-8 | 1,005 | 2.640625 | 3 | [] | no_license | import axios from 'axios';
export const getPokemonList = page => async dispatch => {
try {
dispatch({
type: 'POKEMON_LIST_LOADING'
});
const limit = 15;
const offset = (page - 1) * limit;
const res = await axios.get(`https://pokeapi.co/api/v2/pokemon?limit=${lim... | true |
a35875295bb2c370c6a8f776b9a2cb5f639df6da | JavaScript | catapult-project/catapult | /tracing/third_party/oboe/src/pubSub.js | UTF-8 | 1,500 | 3.53125 | 4 | [
"BSD-2-Clause",
"BSD-3-Clause",
"BSD-2-Clause-Views"
] | permissive | /**
* pubSub is a curried interface for listening to and emitting
* events.
*
* If we get a bus:
*
* var bus = pubSub();
*
* We can listen to event 'foo' like:
*
* bus('foo').on(myCallback)
*
* And emit event foo like:
*
* bus('foo').emit()
*
* or, with a parameter:
*
* bus('foo').emit('ba... | true |
723ad174edef3c62964c0a211fd0a503aa8d8e18 | JavaScript | etseng02/project-roundup | /public/scripts/proposal-page.js | UTF-8 | 7,067 | 2.8125 | 3 | [] | no_license | let hrefVal = $(location).attr("href");
//let url = hrefVal.slice(31);
//localhost
let url = hrefVal.slice(28);
let optionID = 0;
let timeArray = [];
$(document).ready(() => {
$.ajax({
url: "/api/loadtable",
method: "GET",
data: { url: url },
success: function(response) {
let allTimes = [];
... | true |
ce1c08a817c362ee86d62a2463ce86b144914040 | JavaScript | sihan010/Cyborg | /components/Decypher.js | UTF-8 | 4,459 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import { View, Clipboard, ToastAndroid } from 'react-native'
import { Button, TextInput, Text } from 'react-native-paper'
import nodejs from 'nodejs-mobile-react-native';
class Cypher extends Component {
constructor(props) {
super(props);
this.state = {
... | true |
b1a16bcf90562295974038363982036349adb15c | JavaScript | tanmoy1990/ReactJSByShiv | /src/AddUser.js | UTF-8 | 2,817 | 2.734375 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
class AddUser extends React.Component {
constructor(props) {
super(props);
this.state = {
user: {
name: '',
age: '',
salary: ''
},
... | true |
5f47b11b5bc3d90a9c92e5ca85ed5153376e3e8d | JavaScript | dadapeer362/gradient-generator | /src/components/GradientGenerator/index.js | UTF-8 | 3,429 | 2.6875 | 3 | [] | no_license | import {Component} from 'react'
import GradientDirectionItem from '../GradientDirectionItem'
import {
MainContainer,
Container,
Heading,
Paragraph,
GradientDirectionContainer,
Form,
ContainerForm,
ContainerLabelAndInput,
ParagraphForm,
Input,
Button,
} from './styledComponents'
const gradientDire... | true |
99314c0a966b5d763feae64513743bcacd39df47 | JavaScript | DanielOhn/project7-pixel-paint | /src/components/App.js | UTF-8 | 3,472 | 2.765625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import '../styles/App.css'
function App() {
const mouse = { x: 0, y: 0 }
var canv
var ctx
var background = '#555'
useEffect(() => {
const painting = document.getElementById('paint')
const paint_style = getComputedStyle(painting)
canv = documen... | true |
a2495c4376a8a3944485e22b8bd2acc55a5147cb | JavaScript | plucodev/website-v2 | /src/test/_utils.js | UTF-8 | 2,267 | 2.78125 | 3 | [] | permissive | const fs = require('fs');
const path = require('path');
const jsyaml = require("js-yaml");
const fm = require('front-matter');
var colors = require('colors');
const walk = function(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
var pending = list.length;
... | true |
ca05fa46a3e5c6fcbba185e43129d3aa0b772b27 | JavaScript | paullewallencom/javascript-978-1-7843-9432-5 | /_/chapter_5/1_orc.js | UTF-8 | 642 | 3.890625 | 4 | [
"Apache-2.0"
] | permissive | function ExaggeratingOrc(name) {
var that = this
// public property
that.name = name
// private property
var realKills = 0
// private method
function killCount() {
return realKills + 10
}
// public method using private method
that.greet = function() {
console.log("I am " + that.name + " ... | true |
8a93e5037626bfc10df0b86d636d4f605ff41bff | JavaScript | Mainor89/AseguramientoDeCalidad | /Asignacion 2/funciones_de_verificacion.js | ISO-8859-1 | 4,746 | 3.90625 | 4 | [] | no_license | //Compara ambas fechas y retorna verdadero en caso de que la fecha 2 sea mayor que la fecha 1
function ValidarComparacionFechas(pDay1, pMonth1, pYear1, pDay2, pMonth2, pYear2){
var fechaValida = true;
if(pYear1 > pYear2){
fechaValida = false;
}else{
if(pYear1 == pYear2 && pMonth1 > pMonth2){
fechaValida = fal... | true |
b8c78f19b173366edb2fd137b8de71e384e76d8d | JavaScript | emullins/Letter-Game | /assets/javascript/Psychic.js | UTF-8 | 1,595 | 3.984375 | 4 | [] | no_license |
var letters = ["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"];
var wins = 0;
var losses = 0;
var numberOfGuesses = 10;
var guessedLetters =[];
var computerChoice =[];
var newComputerChoice = function () {
computerChoice = lette... | true |
93fa1467c312b9fe5e822f1c63a9deeef94cf21b | JavaScript | adityakale3/nodeall | /nodebasic/events.js | UTF-8 | 522 | 3.25 | 3 | [] | no_license | const events = require('events');
const event = new events.EventEmitter();
// Def function 1
var first_event = (a,b) => {
console.log(`First Event Parameters ${a} ${b}`);
//triggering 2nd Event
event.emit('Second_event');
}
// Def function 2
var second_event = () => {
console.log('Second Event Triggre... | true |
075a59967a7ad9c2bfd7371da345e2a055b2a5eb | JavaScript | Drewsup123/DOM-I | /js/index.js | UTF-8 | 5,998 | 2.84375 | 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\n Is\n Awesome",
"button": "Get Started",
"im... | true |
503cae97dd3338733097b6d4406480cd230a0ed7 | JavaScript | charlestmichaeljr/mean-course | /backend/controllers/posts.js | UTF-8 | 3,865 | 2.796875 | 3 | [] | no_license | const Post = require('../models/post');
exports.createPost = (req, resp, next) => {
const url = req.protocol + '://' + req.get('host');
const post = new Post({
title: req.body.title,
content: req.body.content,
imagePath: url + '/images/' + req.file.filename,
creator: req.userDa... | true |
7a109ecef1ef94bd2faa16d1b1c3ccd114673506 | JavaScript | vrallabhandi/NativeJSTraining | /Task2/partition-on.js | UTF-8 | 564 | 3.890625 | 4 | [] | no_license | // partition the items array so that all values for which pred returns true are
// at the end, returning the index of the first true value
function partitionOn(pred, items) {
var falseValues = [],
trueValues = [];
items.forEach(function (item) {
if (pred(item)) {
trueValues.push(ite... | true |
c8f5881d8da7e36ac57ba406c9e0d4b459a74162 | JavaScript | L3oneM/FullstackOpen | /Part_5/bloglist-frontend/src/App.js | UTF-8 | 4,177 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { useField } from './hooks'
import loginService from './services/login'
import Blog from './components/Blog'
import blogService from './services/blogs'
import Notification from './components/Notification'
import CreateForm from './components/CreateForm'
import T... | true |
2351a6b946e3e1607343859f29d91bcf2e2cc499 | JavaScript | liaomint/myspringboots | /src/main/resources/public/js/if_heng.js | UTF-8 | 785 | 2.515625 | 3 | [] | no_license | /**
* Created by qq368 on 2017/5/4.
*/
function orient() {
var $body = $('body');
if($body.width() > $body.height() ) {
//ipad、iphone横屏;Andriod横屏
$body.append('<div class="heng-show vetically" style="position: fixed;left: 0;top:0;width: 100%;height: 100%;background:rgba(0,0,0,.7);color: white;font-si... | true |
f70fcc3f88353bc454528b0dfa38eb5cf320a4d2 | JavaScript | patricia-bettio/animals | /animals_basic.js | UTF-8 | 2,077 | 3.90625 | 4 | [] | no_license | "use strict";
window.addEventListener("DOMContentLoaded", start);
let animals;
function start( ) {
console.log("ready");
loadJSON();
}
function loadJSON() {
fetch("animals.json")
.then( response => response.json() )
.then( jsonData => {
animals = jsonData;
// when loaded, displ... | true |
acd1dde38f6d8417adab486646925d0fc49bdbc4 | JavaScript | paarthsharma23/pro-c-25 | /ground.js | UTF-8 | 388 | 2.828125 | 3 | [] | no_license | class Ground {
constructor(x,y,width,height){
var option ={
'isStatic':true,
'restitution':0.3,
'friction':0.5
}
this.width = width ;
this.height = height ;
this.body = Bodies.rectangle(x,y,this.width,this.height,option);
World.add(world,this.body);
}
display(){
push();
rectMode(CENTER);
rect(this.body.p... | true |
5f5e79dc6fa2dd90bce286072c34190f1564b157 | JavaScript | thembajsph/settings-bill-expressjs | /index.js | UTF-8 | 3,316 | 3 | 3 | [] | no_license | const express = require("express");
// instantiate or reference handlebars
const exphbs = require('express-handlebars');
// //get body parser / instantiate
const bodyParser = require('body-parser');
var moment = require('moment'); // require
moment().format()
//require the settings bill factory function
const Sett... | true |
0e3b3f3889c4cbbd7a516cefc340b2f89ae74379 | JavaScript | Mattlomet/paperboy_frontend | /src/App.js | UTF-8 | 2,048 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import "./App.css";
import SignIn from "./SignIn";
import Profile from "./Profile";
import axios from "axios";
class App extends Component {
constructor() {
super();
this.state = {
LogIn: false,
user_id: 0,
feed_id: 0
... | true |
8e3d65cbc24b5c6fe710fdc1b9522bfa93d0d313 | JavaScript | reggi/package-yml | /index.js | UTF-8 | 1,602 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | var yaml = require('js-yaml');
var fs = require('fs');
var path = require("path");
function yamlToJsonSync(yamlFilePath, jsonFilePath) {
var yamlFileData = fs.readFileSync(yamlFilePath, "utf8");
yamlFileData = yaml.load(yamlFileData);
yamlFileData = JSON.stringify(yamlFileData, null, 4);
return fs.writeFileSyn... | true |
703956efe771fda54f2c79c88c30d413f1484815 | JavaScript | trylang/Learning | /rxjs&&axios/src/js/day_4_25.js | UTF-8 | 1,674 | 2.78125 | 3 | [] | no_license | import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/observable/timer';
import 'rxjs/add/operator/concat';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/throttle';
import 'rxjs/add/operator/mapTo';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/de... | true |
39a1072fa3d03795ada6a72960b364bc584cf909 | JavaScript | taokexia/codewars-js-training | /6kyu-Make the Deadfish swim/index.js | UTF-8 | 1,173 | 4.03125 | 4 | [] | no_license | // Write a simple parser that will parse and run Deadfish.
// Deadfish has 4 commands, each 1 character long:
// i increments the value (initially 0)
// d decrements the value
// s squares the value
// o outputs the value into the return array
// Invalid characters should be ignored.
// parse("iiisdoso") => [ 8, 64 ... | true |
21f757f96e0e5bf2c306f30cc5c4cb63996fd4bc | JavaScript | kpmakwana/TimeLine | /src/App.js | UTF-8 | 2,738 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react'
import './main.css';
import TimeLineItem from './Components/TimeLineItem'
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
data:[
{//First Step
actionDate: "July 2",
status:"You have taken Test Drive",... | true |
cdf147048ea0aa0b7ce6ce17b0ad1eb400063055 | JavaScript | lucaswerkmeister/FirefoxOS-Ceylon | /js/app.js | UTF-8 | 680 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // DOMContentLoaded is fired once the document has been loaded and parsed,
// but without waiting for other external resources to load (css/images/etc)
// That makes the app more responsive and perceived as faster.
// https://developer.mozilla.org/Web/Reference/Events/DOMContentLoaded
window.addEventListener('DOMConten... | true |
09aec02facdda6e3d95bbde47f75d5e531cf9e8b | JavaScript | 707amitsingh/Datastructure-and-Algorithms | /factorialRecursion.js | UTF-8 | 164 | 4.125 | 4 | [] | no_license | const factorial = (num) => {
if(num === 2) return 2
return num*factorial(num - 1)
}
const result = factorial(500)
console.log('The factorial is: ', result) | true |
1d9b7d10c2543627ca1bfe0841136247dfcec950 | JavaScript | oshoham/code-sketches | /random-grid-2/sketch.js | UTF-8 | 605 | 3.03125 | 3 | [] | no_license | function setup() {
createCanvas(640, 640);
}
function draw() {
// Talma, Spectrum 7 Colors
background('#487A9C'); // Teal
noSmooth();
stroke('#E1C779'); // Pollen
strokeWeight(20);
noFill();
randomSeed(mouseX);
var m = 84;
for (var y=0; y < height; y+=m) {
for (var x = 0; x < width; ... | true |
f57fe5964c02565b56ee2b775352ea4c732484bd | JavaScript | eternalsakura/DIE-corpus | /jsc/script-tests/f/function-apply.js | UTF-8 | 5,396 | 3.1875 | 3 | [] | no_license | console.log('Tests to ensure that Function.apply works correctly for Arrays, arguments and array-like objects.');
function argumentsApply1(a, b, c) {
function t(a, b, c) {
return a;
}
return t.apply(null, arguments);
}
function argumentsApply2(a, b, c) {
function t(a, b, c) {
return b;
}
return ... | true |
c9aa0d54a4906be20bf0e243fef5669655d8b5b7 | JavaScript | quantrananh2304/ClientApp | /rootui-react/src/utils/index.jsx | UTF-8 | 1,123 | 2.71875 | 3 | [] | no_license | export const canUseDOM = !! (
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
/**
* Check if email is valid.
*
* @param {string} email email string.
*
* @return {boolean} is valid.
*/
export function isValidEmail( email ) {
// eslint-disable-next-line
cons... | true |
3a254318d5981359638ffc92e86646033f176683 | JavaScript | StijnJansen00/webshop | /js/head.js | UTF-8 | 684 | 2.75 | 3 | [] | no_license | function showAdminUsers() {
let adminUsers = document.getElementById('adminUsers')
let users = document.getElementById('users')
adminUsers.classList.remove('hide')
adminUsers.classList.add('show')
if (users.classList.contains('show')) {
users.classList.remove('show')
users.classLis... | true |
f6a6308d55e1053cb82cae29c57e1a80fe85c442 | JavaScript | liaoyanming/letao | /public/m/js/category.js | UTF-8 | 1,398 | 2.71875 | 3 | [] | no_license | $(function(){
// 根据后台数据渲染一级分类菜单
getFirstCategoryData(function(data){
$('.cate_left ul').html(template('firstTemplate',data));
// 根据一级分类的ID渲染对应的二级分类菜单
var categoryId=$('.cate_left ul li:first-child').find('a').attr('data-id');
render(categoryId);
});
//点击一级分类加载对应的二级分类
$('.cate_left').on('tap','a',fu... | true |
fd4333bba49c168504de5cf09536303c49abff92 | JavaScript | el-chuck/gulp-tasks | /src/copy.spec.js | UTF-8 | 2,011 | 2.71875 | 3 | [
"MIT"
] | permissive |
const gulp = require('gulp');
const runSequence = require('run-sequence');
const rimraf = require('rimraf');
const lstat = require('fs').lstat;
const copy = require('../index').copy;
describe('copy method', () => {
it('returns a config and a task', () => {
const result = copy();
expect(result).toEqual({
... | true |
57e4a6406320eaa4ec1cc66a2b277987c3f112f8 | JavaScript | seanrreid/Salon | /models/reviewsModel.js | UTF-8 | 1,675 | 2.75 | 3 | [] | no_license | const db = require("./conn")
class ReviewsList {
constructor(id, user_id, review_text, date, object_id) {
this.id = id
this.user_id = user_id
this.review_text = review_text
this.date = date
this.object_id = object_id
}
static async showAllReviewsProfile(user_id) {
... | true |
6fbf6719d890ae39e7aeb763fed2975726aaf170 | JavaScript | chrisdykstra/Alphabetize | /javascript/database.js | UTF-8 | 1,894 | 2.859375 | 3 | [] | no_license |
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('DataBank.db');
function createTable() {
db.all("SELECT name FROM sqlite_master WHERE type='table'", (error, tables) => {
if (error) {
console.log(error);
}
console.log(tables);
if (tables.... | true |
ed4fdd9459edbc3607fdb5063e006bd00c79ab51 | JavaScript | Ndex471/belajar-ecmascript-6 | /.history/destructuring object dan array/destructuring array/7-destructuring-array-default-values-es6_20200802162431.js | UTF-8 | 318 | 3.46875 | 3 | [
"MIT"
] | permissive | const favorites = ["Seafood"];
const [myFood, herFood = "Salad"] = favorites
/**
* Ketika melakukan array destructuring namun terdapat variabel yang posisinya
tidak dapat terjangkau oleh array, maka variabel tersebut akan bernilai
undefined
*/
console.log(myFood);
console.log(herFood);
/* output:
Seafood
Salad
*/ | true |
0cb0822d41764409b5303804f9eaca9cb9aa4617 | JavaScript | bharath-balasubramaniam/react-hooks | /src/components/CommentsForm.js | UTF-8 | 3,313 | 2.71875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
function CommentsForm({ info }) {
const [cmnt, setCmnt] = useState({
id: "",
postId: "",
name: "",
email: "",
body: "",
});
useEffect(() => {
if (info.id) {
setCmnt({
id: info.id,
postId: info.postId,
name:... | true |
f361183da843bab64e40f7e25579caa28d4c942c | JavaScript | dAsty190e/MoogleMail | /Moogle mail/Audio.js | UTF-8 | 471 | 2.71875 | 3 | [] | no_license | var song;
function setup() {
var currentPage = window.location.href;
if (currentPage.includes('maile')) {
// if i am on the home page, get song from here
song = new Audio('./Moogle song/cupo sound.mp3');
} else if (currentPage.includes('Table')) {
// else if i am on the table page g... | true |
ea28cf5e1a5668bb27d5a30ae6c597ba454ec56c | JavaScript | dianne1102/web | /AM/main.js | UTF-8 | 2,575 | 2.875 | 3 | [] | no_license | $(document).ready(function Schedule() {
//setMonthAndDay(4, 1);
/*
var sMonth = -1;
var sDay = -1;
alert('Bclick');
$("input").click(function()
{
var monthElement = document.getElementById("month");
var month = monthElement.value;
var dayElement = document.g... | true |
dacf1c62e2505722d82bf5d9c924c57034e45435 | JavaScript | irlen3/ajs18-4test-ci_2matchers | /src/js/__tests__/lifeline.test.js | UTF-8 | 508 | 2.640625 | 3 | [] | no_license | import lifeLine from '../lifeline';
test('should be result', () => {
const player = { name: 'Маг', health: 100 };
const result = lifeLine(player);
expect(result).toBe('healthy');
});
test('should be result', () => {
const player = { name: 'Маг', health: 50 };
const result = lifeLine(player);
expect(resu... | true |
4d851eeb375216b63dfdf54668acaab0c84d67d6 | JavaScript | jeanyoungkim/set-game | /src/reducers/TodosReducer.js | UTF-8 | 940 | 2.53125 | 3 | [] | no_license | import {ADD_TODO, EDIT_TODO} from 'actions/TodosActions';
export default function todos(state = [], action) {
switch (action.type) {
case ADD_TODO:
return [...state, {
summary: action.payload.summary,
done: false
}];
case EDIT_TODO:
... | true |
18e7fd83a994f2250802863b8687459dca6c9ee3 | JavaScript | rombau/osext | /source/chrome/content/requestqueue.js | UTF-8 | 4,404 | 2.5625 | 3 | [] | no_license | /**
* Klasse für eine Seite in der Verarbeitungswarteschlange.
* @constructor
*/
OSext.RequestQueueSite = function (uri, params, post, status) {
this.uri = uri;
this.params = params;
this.post = post;
this.status = status;
};
/**
* Klasse für eine Verarbeitungswarteschlange von {@code HTMLDocument}en.
* @c... | true |
13d511933c3d2cc531028007a714f14e4a10cb91 | JavaScript | shubhashish-kumar/react-tutorial | /src/example8/App.js | UTF-8 | 1,933 | 2.984375 | 3 | [] | no_license | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import logo from '../logo.svg';
import '../App.css';
class App extends Component {
render() {
const name = "Robert"
const user = {
firstName: "Robert",
lastName: "Singh"
}
const greeting = <h1>Hel... | true |
d8d8fe40df4176f83638b01ae288374b04ae0ccc | JavaScript | LissetCuevas/phonebook | /client/src/App.js | UTF-8 | 6,052 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import personService from './services/persons'
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
const Notification = ({ message, type }) => {
if(message === null){
return null
}
return(
<div className={type}>
{message}
</div>... | true |
2b23d8cd45e32d5f8aaffc74d4098987e4435c75 | JavaScript | smiljkanenadovic/Test3 | /src/components/filter.js | UTF-8 | 661 | 2.6875 | 3 | [] | no_license | const selector = () => {
let divSel = document.createElement('div');
let selector = document.createElement('select');
let optionT = document.createElement('option');
optionT.value = 'All';
optionT.innerHTML = 'All';
selector.appendChild(optionT);
let optionO = document.createElement('optio... | true |
b893f9c90463faa3588c6f2e412ff6abdaccfd03 | JavaScript | SankalpaFernando/dashboard-covid | /src/components/CardHolder.js | UTF-8 | 1,819 | 2.5625 | 3 | [] | no_license | import React from "react";
import "./component.scss";
import {
FaGlobeEurope,
FaSkullCrossbones,
FaBullseye,
FaShieldAlt,
} from "react-icons/fa";
import thousands from 'thousands';
import {connect} from 'react-redux'
import {motion} from 'framer-motion'
function Card({ icon, color,label,number }) {
const st... | true |
3e0c03729c37a707fd7a197ece87ebf68791d8a8 | JavaScript | liangfung/9-ways-to-cross-origin | /2_CORS/server2.js | UTF-8 | 389 | 2.609375 | 3 | [] | no_license | const express = require('express')
const app = express()
const whiteList = [
'http://localhost:3000'
]
app.use((req, res, next) => {
let { origin } = req.headers
if (whiteList.includes(origin)) {
res.setHeader('Access-Control-Allow-Origin', origin)
}
next()
})
app.get('/api/a', (req, res) => {
res.en... | true |
8aebd315aa0e24c1e5982cce99743467a2e24c12 | JavaScript | rahman629/assignment.js | /assignment.js | UTF-8 | 1,212 | 3.921875 | 4 | [] | no_license | function feetToMile(feet){
var mile = feet / 5280;
return mile;
}
var result = feetToMile();
console.log(result);
//woodCalculator
function woodCalculator(chair,table,bed){
var chair = chair * 1;
var table = table * 3;
var bed = bed * 5;
var totlalelements = chair + table + bed;
return ... | true |
1b0eb3be5c9a661a33e138d56355296d2e432505 | JavaScript | keathleydavidj/microstates-polygon-example | /src/polygon.js | UTF-8 | 282 | 2.703125 | 3 | [] | no_license | export default class Polygon {
sides = Number;
sideLength = Number;
incrementSides(value = 1) {
if (this.state.sides + value < 3) {
return this;
} else {
return this.sides.increment(value);
}
}
get canDecrement() {
return this.sides > 3;
}
} | true |
b8809ac243f90979534d1f71436d1dab6db86c7c | JavaScript | avatarfreak/fcc-personal-library | /routes/api.js | UTF-8 | 3,913 | 2.734375 | 3 | [] | no_license | /*
*
*
* Complete the API routing below
*
*
*/
"use strict";
var expect = require("chai").expect;
var MongoClient = require("mongodb").MongoClient;
var ObjectId = require("mongodb").ObjectId;
const MONGODB_CONNECTION_STRING = process.env.DB;
require("dotenv").config();
let Book;
MongoClient.connect(
M... | true |
4e7807f572e0b5b84a1ddfc0cb9715b982f76548 | JavaScript | woori9/jjack_sparrow_frontend | /screens/CalendarScreen.js | UTF-8 | 3,509 | 2.578125 | 3 | [] | no_license | import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import { Calendar, CalendarList, Agenda, Arrow, LocaleConfig } from 'react-native-calendars';
LocaleConfig.locales['fr'] = {
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septe... | true |
79d420a7ba0d47b32e853f8bbb5ebd13282208cd | JavaScript | MariuszRozycki/29-js-suma-zmiennych | /js/main.js | UTF-8 | 294 | 3.421875 | 3 | [] | no_license | let firstNumber;
let secondNumber;
firstNumber = 10;
secondNumber = 12;
function addParams(firstNumber, secondNumber) {
return firstNumber + secondNumber;
}
console.log(`Wynik dodawania parametrow funkcji addParams(firstNumber, secondNumber), to: ${addParams(firstNumber, secondNumber)}`); | true |
ccf0b182bebf16b78e172132584e33f0345b7249 | JavaScript | esalcidom/react-next-bitcoin | /components/Evento.js | UTF-8 | 756 | 2.53125 | 3 | [] | no_license | const Evento = (props) => {
const {evento} = props;
let desc = evento.description.text;
if(desc){
desc = desc.substr(0, 250) + '...';
}
return(
<div className="card mb-3">
<h3 className="card-header">Eventos en Mexico</h3>
<div className="card-body"... | true |
abb1e0d425aab60e85fd591a9d65b7c8e7d3cda7 | JavaScript | benoybose/wolf-lexer | /lib/wolf-lexer.js | UTF-8 | 5,218 | 2.890625 | 3 | [
"MIT"
] | permissive | /*
* wolf-lexer
* https://github.com/benoybose/wolf-lexer
*
* Copyright (c) 2016 Benoy Bose
* Licensed under the GPL license.
*/
'use strict';
function WolfLexer() {
this.position = 0;
this.length = 0;
this.rules = [];
this.resumeOnError = false;
this.errorOccured = false;
this.defaultRu... | true |
0eb3a2ce223d4adeab278bb935758d1560b474d3 | JavaScript | harryHui/zf-project | /20-0 stream/read/ReadStream.js | UTF-8 | 2,370 | 2.90625 | 3 | [] | no_license | let EventEmitter = require('events')
let fs = require('fs')
class ReadStream extends EventEmitter {
constructor(path, options = {}) {
super()
this.path = path
this.flags = options.flags || 'r'
this.highWaterMark = options.highWaterMark || 64 * 1024
this.start = options.start || 0
this.end = op... | true |
d73ea938099bb9f0f7af35d99febbbb4478b2998 | JavaScript | SnoopSqueak/react-monty-hall | /src/components/Door.js | UTF-8 | 879 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
class Door extends Component {
render() {
let doorClass = this.props.isOpen ? "door door-open" : "door door-closed";
let prizeClass = this.props.content;
let parentClass = "door-container";
if (this.props.isSelected) parentClass += " door-selected";
if (!... | true |
f956949e999a7329a7df4f11a17e9446db6e866c | JavaScript | bottlezz/Gears-GC-Libs | /GcJS/unitTest/gamecenter.js | UTF-8 | 7,250 | 2.84375 | 3 | [] | no_license |
//client network layer
//can send data in binary
//init objects
// var recievedObject; // recieved json object
function GameCenter(port) {
console.log(this);
this.wsPort= port==null?"50000":port.toString();
this.ip="127.0.0.1";
this.connected=false;
this.onConnect=function(){};
//to close connection conne... | true |
690b7b479d66f54fb4275f62d69a514a7a772003 | JavaScript | davidcalhoun/flickryql | /flickryql.js | UTF-8 | 1,582 | 2.5625 | 3 | [] | no_license | var flickrYql = (function() {
var container, username, size, query, results;
var getImageHTML = function(obj) {
// Default values
obj.size || (obj.size = 's'); // default to thumbnail size
console.log(obj);
if(obj.farm && obj.server && obj.id && obj.secret) {
return '<a href="http://w... | true |
793e09f27e1645a8b3d353d01be227abab9f7287 | JavaScript | jotaen/webshell.js | /src/view/persistState.js | UTF-8 | 519 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | exports.read = (id) => {
const key = 'webshelljs_' + id
const value = window.localStorage.getItem(key)
if (!value) return undefined
const result = JSON.parse(value)
if (result.lastActivity) result.lastActivity = new Date(result.lastActivity)
return result
}
exports.delete = (id) => {
const key = 'webshel... | true |
9fda6b25004b37a2f3b440488e61572c46648bf3 | JavaScript | ihgrant/quotebot | /parse.js | UTF-8 | 833 | 2.625 | 3 | [] | no_license | var _ = require('lodash');
var quotes = require('./quotes');
var triggers = ['!quote', 'quotebot', 'quotbot'];
function parseMessage(msg) {
return Promise.resolve().then(() => {
const [trigger, command, input, ...rest] = _.split(msg, ' ');
if (!trigger || !_.includes(triggers, trigger)) {
... | true |
ae89f24778a324ae4658db41ba2a4ffb323facff | JavaScript | MichaelSSS/chat | /web/js/User.js | UTF-8 | 1,305 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | 'use strict';
angular.module('chatApp')
.factory('User', ['$q', 'API', function($q, API) {
var User = {};
User.access_token = null;
User.messages = [];
User.isGuest = function() {
return !Boolean( this.access_token );
};
User.getToken = function(data) {
var defer = $q.defer();
API.post(... | true |
23ea24e3cf4fa8ec69bebe53d8a3f8afb1a3b9c7 | JavaScript | MoonPerformer/Moon-Practice | /public/m/js/searchList.js | UTF-8 | 1,763 | 2.578125 | 3 | [] | no_license | $(function () {
var page = 1;
var pageSize = 5;
var key = getSearch().key;
$(".lt_search input").val(key);
render();
// 获取地址栏参数
function getSearch() {
var search = location.search;
search = decodeURI(search);
search = search.slice(1);
var arr = search.split("&... | true |
ed46741871911a920878d82d11ed1506a37c6b96 | JavaScript | HeyIcey/Zby_IFE_TASK2 | /js/util.js | UTF-8 | 10,051 | 3.375 | 3 | [] | no_license | // 判断arr是否为一个数组,返回一个bool值
function isArray(arr) {
if (Object.prototype.toString.call(arr) === '[object Array]') {
console.log(true);
} else {
console.log(false);
};
}
// 判断fn是否为一个函数,返回一个bool值
function isFunction(fn) {
if (Object.prototype.toString.call(fn) === '[object Function]') {
... | true |
ba0d1cf91052d96acf826844e669d92bc5d7e0ad | JavaScript | Douglasproglima/curso-de-javascript-moderno-do-basico-ao-avancado | /04_funcoes_avancado/61_funcoes_geradoras/assets/js/main.js | UTF-8 | 2,777 | 4.25 | 4 | [] | no_license | //#region FUNÇÕES GERADORAS
//Lazy Evaluation: Uma função que entrega em partes o código, com pausas
/*
Estrutura da função geradora:
function* nomeFuncao(){ yield or return}
*/
/*
YIELD:
Pode ser inserido diversas vezes dentro do escopo da função geradora;
A primeira vez que é chamada a função, reto... | true |
22b92dfb6cfaaadf42e0505d2ed4e5f520e0d305 | JavaScript | HelenaMinond/sugerencia_de_videos | /assets/src/script.js | UTF-8 | 1,324 | 2.8125 | 3 | [] | no_license | class Multimedia {
constructor(url) {
const _url = url;
this.obtenerUrl = () => _url;
}
get getUrl() {
return this.obtenerUrl();
}
setInicio() {
return 'Este método es para realizar un cambio en la URL del video';
}
}
class Reproductor extends Multimedia {
constructor(url, id) {
super... | true |