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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eb1c44ad60ebff3d13bc83127cf4ba6ad66234e5 | JavaScript | atakori/backlog-trakker-api | /controllers/auth.js | UTF-8 | 1,320 | 2.8125 | 3 | [] | no_license | const User= require('../models/users');
const jwt= require('jwt-simple');
const {JWT_SECRET} = require('../config');
function tokenForUser(user) {
const timestamp= new Date().getTime();
return jwt.encode({ sub: user.id, iat: timestamp }, JWT_SECRET)
}
exports.login = function(req, res, next) {
//User is authorized... | true |
adc70c3060c0249145c63e41b2282ee3bf7f8f5e | JavaScript | NivBraz/Ex0 | /player_module/players_goals.js | UTF-8 | 910 | 2.71875 | 3 | [] | no_license | 'use strice';
var events = require('events');
var eventConfig = require('./config').events;
class Player extends events{
constructor(name,goals){
super();
this.name = name;
this.goals = goals;
//events.EventEmitter.call(this);
}
addGoal(){
this.goals++;
thi... | true |
b8141b409de54d10022c08318f95f20032092c24 | JavaScript | Eugenylis/weightbalance | /scripts/script.js | UTF-8 | 3,676 | 3.328125 | 3 | [
"MIT"
] | permissive | /*
* JS code to perform calculation and create a plot
*
* by YL
*/
// run only if the page is fully loaded
$(document).ready(function(){
// calculate values after pressing the button
$("#calculate-wob").click(function(){
var grossWeight = 0
var totalMoment = 0
var loadedCG = 0
... | true |
2ae1c1be62697402bb704e3537796960fd71a585 | JavaScript | mindnervestech/phpfrep | /WebContent/assets/js/demoTest.js | UTF-8 | 4,120 | 2.640625 | 3 | [] | no_license |
console.log(companies);
var myData = companies ;
var noOfRowstoShow = 100000; //set the maximum number of rows that should be displayed per page.
$("#exampleGrid").handsontable({
startRows: 5,
startCols: 5,
rowHeaders: true,
colHeaders: true,
columns: [
{ title: "COMPANY NAM... | true |
195b36bf7c2bcabeaf51407f152e4658f0857d7a | JavaScript | JosiahMc/dojo-jqueryfunctions | /app.js | UTF-8 | 1,788 | 2.78125 | 3 | [] | no_license | $(document).ready(function(){
$("#btnClick").click(function(){
$(".counter").text(parseInt($(".counter").text())+1);
});
$("#hideh2").click(function(){
$("h2").hide(2000);
});
$("#showh2").click(function(){
$("h2").show(3000);
});
$("#toggle").click(function(){
... | true |
4d59207142cabc3e7d951cad2d158c757f48f5c4 | JavaScript | killzdesu/simpic_scoreboard | /team-babel.js | UTF-8 | 402 | 2.640625 | 3 | [
"MIT"
] | permissive | class Team{
constructor(name){
this.name = name;
this.score = 0;
}
setName(name){
this.name = name;
}
}
var teams = [];
teams.push(new Team('MWIT'));
teams.push(new Team('SCORE'));
teams.push(new Team('HI'));
teams.push(new Team('FY'));
function addAllUsers(user){
teams.forEach(team => {
use... | true |
033e71dcd0ee35e19e34f3b5bb0cbf906e3a15f1 | JavaScript | GLSea1979/dataStructures | /agents.js | UTF-8 | 371 | 2.71875 | 3 | [
"MIT"
] | permissive | const agentList = [
{
createdAt : '20211001',
expiresAt : '20211111'
},
{
createdAt : '20211101',
expiresAt : '20211112'
}
]
/*
Write a function that looks over an agent list similar to above and returns a true/false for whether the agents time period ever overlaps.
... | true |
365c5fd7836f313d9dfeefb6cf5ff3f00ff68587 | JavaScript | maosan132/html-and-css-project | /hackerrank/queues-and-stacks/class-stack-linkedlist.js | UTF-8 | 1,235 | 4.46875 | 4 | [] | no_license | class Node {
constructor(next, value) {
this.next = next
this.value = value
}
}
class Stack {
constructor() {
this.stack = null
}
push(element) {
const head = this.stack;
const newNode = new Node(null, element);
if (!head) {
this.stack = n... | true |
7f4cf63d8c06a81b7dfacfba85a68568b40a2b25 | JavaScript | Tsarcastic/data_structures | /js/test/dll_js.test.js | UTF-8 | 3,804 | 3 | 3 | [
"MIT"
] | permissive | /*jshint esversion: 6 */
'use strict()'
var js_dll = require('../dll_js')
test('Node works', () => {
var test_node = new js_dll.Node(5)
expect(test_node.data).toBe(5)
})
test('Node exists in continuum 01', () => {
var test_dll = new js_dll.DoubleLinkedList()
test_dll.push_head('banana')
test_dll.... | true |
7c2b57baeaf15b32086840a4ceb62802e57df5d4 | JavaScript | vasasharath/AlgoCasts | /exercises/countOfAtoms.js | UTF-8 | 2,523 | 4.0625 | 4 | [] | no_license | /*
Given a chemical formula (given as a string), return the count of each atom.
An atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.
1 or more digits representing the count of that element may follow if the count is greater than 1. If the count is 1,... | true |
55f9fb078d2c6005af2b0b2bb4313517033126a6 | JavaScript | neg1t/acits | /src/redux/reducers/reducer.js | UTF-8 | 840 | 2.828125 | 3 | [] | no_license | const checkToken = () => {
if (localStorage.token && localStorage.token !== '') {
return true
} else {
return false
}
}
const initialState = {
isAuth: checkToken(),
todayAnimals: [],
animals: [],
toast: false
}
const reducer = (state = initialState, action) => {
switch(action.type) {
case ... | true |
491d3d2bbc8fe73710eee9dcf47fa6d4d47a1d95 | JavaScript | anil614sagar/openapi2apigee | /regex_rules_test.js | UTF-8 | 877 | 2.53125 | 3 | [
"MIT"
] | permissive | var elements = require('./regex_rules.json')
var print = function (m1, m2) {
console.log(m1, m2)
}
var context = {
setVariable: function (s, v) {
console.log(s, v)
},
proxyRequest: {
url: 'http://localhost/bla/x=create function foobar returns'
}
}
var block = function (haystack, filters) {
filters... | true |
586a874fb3f3c0510f3d1c614396ee6f1416e549 | JavaScript | AnnaCake2019/AnnaCake | /public_html/js/formAdmin.js | UTF-8 | 937 | 3.0625 | 3 | [] | no_license | const cake = document.forms.cake;
const p = document.getElementById('answerServer');
let q = 0;
let w = 0;
cake.addEventListener('submit', sendInfo);
function sendInfo(event) {
event.preventDefault();
const form_date = new FormData(this);
const xhr = new XMLHttpRequest();
xhr.open("POST", this.action, t... | true |
b3c449017afb8823b51931c279b7c498811bee25 | JavaScript | ilyisa98/OneDayOnlyAssessment | /js/main.js | UTF-8 | 1,058 | 3.390625 | 3 | [] | no_license | // ajax request
function ajax_request(){
// Create our XMLHttpRequest object
var aR = new XMLHttpRequest();
// data being displayed on : displayData.php
var url = "displayData.php";
// form variables
var first_name = document.getElementById("first_name").value;
var last_name ... | true |
b41e8a9814a03b41b84e934c24cddbd6b4dd55b2 | JavaScript | bezanis23/liri-node | /liri.js | UTF-8 | 2,962 | 2.703125 | 3 | [] | no_license | var Twitter = require('twitter');
var spotify = require('spotify');
var request = require('request');
var keys = require('./keys.js');
var operation = process.argv[2];
var song = process.argv[3];
var fs = require("fs");
var client = new Twitter (keys.twitterKeys);
function showLastTweets() {
var params = {scre... | true |
5480d7db298ad758d35143966af7378b6fdd2231 | JavaScript | allianz/ng-aquila | /projects/ng-aquila/src/phone-input/extract-calling-codes.js | UTF-8 | 1,640 | 3.078125 | 3 | [
"MIT"
] | permissive | /**
* A small script that extracts the calling codes from libphonenumber-js into a JSON file
*
* That saves us the dependency on libphonenumber and a lot of bundle size.
*/
const fs = require('fs-extra');
const path = require('path');
console.log(__dirname);
const meta = require('libphonenumber-js/metadata.full.... | true |
3627e1df4f726e0d97818fc92baf01cc6bd13d8f | JavaScript | Mwangiantony/antony-mwangi.com | /design.js | UTF-8 | 1,911 | 2.546875 | 3 | [] | no_license | const contact = document.querySelector("#contact");
const work = document.querySelector("#work");
const projects = document.querySelector("#projects");
const about = document.querySelector("#about");
const outPut = document.querySelector("#output");
about.addEventListener('click', () => {
outPut.innerH... | true |
576b30c1eb10399ba3103e88f7fdb6e0a17feba9 | JavaScript | ratushniakden/homework_3 | /assets/js/index.js | UTF-8 | 3,757 | 4.125 | 4 | [] | no_license | "use strict";
//Variable tasks
//Task 1
let a = 7, b = 5;
console.log(`Result of ${a} * ${b} is ${a * b}`);
//Task 2
let c = 10, d = 2;
console.log(`Result of ${c} / ${d} is ${c / d}`);
//Task 3
let e = 14, f = 26;
console.log(`Result of ${e} + ${f} is ${e + f}`);
//Task 4
let number = 11;
let bool = true;
let str... | true |
766ed10ee8afbd84ecc2999e1461f3f75b3d9f47 | JavaScript | xuege-cn/webpack-demos | /variableDeclaration-loader/index.js | UTF-8 | 117 | 3.140625 | 3 | [] | no_license | const person = {
name: 'xuqiang',
age: 29
}
console.log(person.name)
document.body.innerHTML = person.name; | true |
e0dcf87b9d69858a8eabbcec0bdaea7e9c97a296 | JavaScript | yunji98/study-react-blog | /blog-backend/src/createFakeData.js | UTF-8 | 691 | 2.609375 | 3 | [] | no_license | import Post from './models/post';
export default function createFakeData() {
// 0 1 2 ... 39 로 이루어진 배열 생성 후 포스트 데이터로 벼환
const posts = [...Array(40).keys()].map((i) => ({
title: `포스트 #${i}`,
body:
'fake data body aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaa... | true |
87c1abece08658f1d12ee036455edf9b73012242 | JavaScript | 18sMan/chrome-extension-getimage | /js/popup.js | UTF-8 | 2,008 | 2.984375 | 3 | [] | no_license | let srcList;
const getImageBtn = document.getElementById('get');
getImageBtn.addEventListener('click', async () => {
chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => {
let message = { start: true };
chrome.tabs.sendMessage(tab.id, message, (res) => {
srcList = Array.from(new Set(res... | true |
0f261bb1b4a25d966feaf29cbc9704effacd8113 | JavaScript | guidimarco/js-es6-cats | /assets/main.js | UTF-8 | 4,020 | 3.609375 | 4 | [] | no_license | $( document ).ready(function() {
// VAR ASSIGNMENT
const cats = [ // cats {name, age, color, gender}
{
name: "Aston",
age: 0.8,
color: "green",
gender: "male"
},
{
name: "Shelly",
age: 0.7,
color: "purple... | true |
62ebb19353cbd855e0f722e76d454da898746f1c | JavaScript | cd-Roid/js-aufgabe-dropdown-menu-slideshow-cnoss | /src/scripts/main.js | UTF-8 | 2,964 | 3.5 | 4 | [] | no_license | /**
* toogleMenu
*
* Blendet das Menü aus oder ein.
*
*/
function toogleMenu() {
const interactionElementClass = ".js-navigation-interaction-element";
const interactionElementAdditionalClass = "hamburger-button--is-open";
const menuElementClass = "main-header__menu-bar-nav--is-open";
const interactionEle... | true |
632acb791820a23bfedb98cae0d186db7d751165 | JavaScript | syzygypl/happinator-client | /src/MoodCollector.js | UTF-8 | 1,087 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react';
import Button from './Button';
import './MoodCollector.css';
const HAPPY = 'happy';
const NEUTRAL = 'neutral';
const SAD = 'sad';
class MoodCollector extends Component {
render() {
return (
<div className="mood-collector">
<Button label="... | true |
8a3847035aaa69f7bca9544e2c26dc610ed274d4 | JavaScript | EugineBelfer/browser-ssh-keygen | /js-keygen-ui.js | UTF-8 | 1,909 | 2.90625 | 3 | [] | no_license | function copy(id) {
return () => {
const ta = document.querySelector(id);
ta.focus();
ta.select();
try {
const successful = document.execCommand("copy");
const msg = successful ? "successful" : "unsuccessful";
console.log(`Copy key command was ${msg}`);
} catch (err) {
cons... | true |
6cec9f760f3bf3d27cf670638212532e2ce6c95f | JavaScript | marim49/gerenciarural | /public/js/select/SaidaMedicamento.js | UTF-8 | 2,264 | 2.890625 | 3 | [
"MIT"
] | permissive | function SaidaMedicamento() {
fazenda = JSON.parse($("#fazendas").val());
animais = fazenda.animais;
funcionarios = fazenda.funcionarios;
medicamentos = fazenda.medicamentos;
var selectAnimal = document.getElementById("animal");
var selectMedicamento = document.getElementById("medicamento");
... | true |
22c0bd35d3fc953b5b5b5b2a2d4042718c93f269 | JavaScript | eunjihannn/springframework | /team2/src/main/webapp/resources/js/productRegistration.js | UTF-8 | 1,099 | 2.671875 | 3 | [] | no_license | /**
*
*/
function checkForm(){
if(document.getElementById("productTitle").value.length == 0){
alert('판매글 제목을 입력해주세요.');
document.getElementById("productTitle").focus();
return false;
}
if(document.getElementById("productPrice").value.length == 0){
alert('상품 금액을 입력해주세요.');
... | true |
440f7d786432ae0754d07704b53b168e4ac38b8c | JavaScript | rtuttle93/express-note-taker | /apiRoutes.js | UTF-8 | 719 | 2.734375 | 3 | [] | no_license | const store = require('../db/store');
const router = require('express').Router();
const fs = require('fs')
// GET /api/notes should read the db.json file and return all saved notes as JSON.
router.get('/notes', (req, res) => {
store
.getNotes()
.then(notes => {
retu... | true |
6d39638bb097717d87a185ffd9087e781ff01273 | JavaScript | jenellelangford/homework-4 | /script.js | UTF-8 | 8,903 | 3.65625 | 4 | [] | no_license | // List all variables(HTML tags) needed to work
// variable for the start button
var startButton = document.getElementById("startbutton");
// variable for question div
var questionsAll = document.getElementById("question");
// variable for answers div
var answersOne = document.getElementById("answersOne");
var answe... | true |
63dd9954853a3ed856ae36e49252ea42295430d5 | JavaScript | ZaprevD/Social-Network | /middlewares/common.js | UTF-8 | 542 | 2.59375 | 3 | [] | no_license |
logger = (req, res, next) => {
console.log(`New Request! URL : ${req.url} , Method: ${req.method}`);
next();
}
wrongRoute = (req, res, next) => {
let error = new Error("This route does not exists please try with anotherone");
error.status = 404;
next(error);
}
errorHandler = (err, req, res, next)... | true |
cc71c8d11aa781f3116e86450b8d3c9fa1c08bfb | JavaScript | NekitSan/tixonow.nek.github.io | /tools/textFormatting/js/app.js | UTF-8 | 4,198 | 3.265625 | 3 | [] | no_license | const FORNATTING = document.querySelector(".formatting");
const SOURCE = FORNATTING.querySelector("#source");
const RESULT = FORNATTING.querySelector("#result");
const buttonNoSpace = FORNATTING.querySelector("#button__no_space"); // " "
const buttonHyphenInsertione = FORNATTING.querySelector("#button__hyphen_inserti... | true |
c27ba9c27f386558010f6133f09a8990a803c243 | JavaScript | atan77/learn-you-node | /program10.js | UTF-8 | 815 | 3.796875 | 4 | [] | no_license | //set requirement for net
var net = require('net')
//code to handle data from time server
var server = net.createServer(function (socket) {
//once data received, create variable to house date
d = new Date();
//convert date to format required, with zero fill for values less than 10 and remembering that mo... | true |
1c888c43cbd684275be851a77fd6c2d6fc4691f2 | JavaScript | azavea/adb-mongolia-nua | /src/app/filters/comparatize.filter.js | UTF-8 | 964 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | /** @ngInject */
export function Comparatize($log, $filter, numberFilter) {
return function (value, isComparison, isPercent) {
if (value === undefined) {
// The filter was called before the form's controller was instantiated.
// Returning undefined tells Angular that the value is still being
// ... | true |
24f26c25706b3fc466ae768ceceabb05da222670 | JavaScript | XinChou16/MIX | /React/30-days-of-React/05-props/src/index-3.js | UTF-8 | 741 | 2.984375 | 3 | [] | no_license | import ReactDOM from 'react-dom';
const DEFAULT_DATA = {
date: '2021-04-21',
num: 2
};
const Header = (props) => (
<header>
<p>Color is: {props.color}</p>
<button onClick={props.onClick}>click</button>
</header>
);
const Main = ({ date, num }) => (
<main>
<p>data is: {date}</p>
<p>num is: {... | true |
268b1dd1f9b06b1c3c05936eef30761eb20f72f5 | JavaScript | Alex-Ginsberg/Drinkstagram | /Drinkstagram2/app/store/currentContent.js | UTF-8 | 350 | 2.734375 | 3 | [] | no_license | /**
* ACTION TYPES
*/
const SET_CONTENT_TEXT = 'SET_CONTENT_TEXT'
/**
* ACTION CREATORS
*/
export const setContentText = text => ({type: SET_CONTENT_TEXT, text})
/**
* REDUCER
*/
export default function (state = '', action) {
switch (action.type) {
case SET_CONTENT_TEXT:
return action.text
defa... | true |
0e156ec454a7292db6e37f75448609dc679b6432 | JavaScript | zfing/dp-webSite | /app/helpers/auth.js | UTF-8 | 3,626 | 2.625 | 3 | [] | no_license | import get from 'lodash/get'
import jsCookie from 'js-cookie'
import { parse as cookieParse } from 'cookie'
// 存储 key 值
export const STORAGE_USER = 'STORAGE_USER'
export const STORAGE_TOKEN = 'STORAGE_TOKEN'
export const STORAGE_AUTHED = 'STORAGE_AUTHED'
export const LOCALE_LOGOUT = 'LOCALE_LOGOUT'
export const LOCALE... | true |
72a6e24ec13592aa97f29c1099f846ceab896fa4 | JavaScript | Quadramming/Knighting | /buildScripts/jsToCompiled.js | UTF-8 | 1,008 | 2.734375 | 3 | [] | no_license | // Compile JS from index.html to one JS-file
//================================================================
// Settings
//================================================================
const from = 'htmlRoot/index.html';
const output = 'build/compiled.js';
//========================================... | true |
6f1caa597a9ba116092ade9ce65b127ed0f7ad47 | JavaScript | TebohoLetsie/school_finder | /public/script.js | UTF-8 | 1,885 | 2.953125 | 3 | [] | no_license | const messageContainer = document.getElementById('message-container')
const roomContainer = document.getElementById('room-container')
const messageForm = document.getElementById('send-container')
const messageInput = document.getElementById('message-input')
// let nwu = io('https://Poweful-lake-61046.herokuapp.com/nwu'... | true |
bff1ac4b63f4878ba01d626b8f2ccf36bddb9a14 | JavaScript | hlee131/todoer | /todoproject/frontend/src/actions/todo.js | UTF-8 | 2,675 | 2.6875 | 3 | [] | no_license | import axios from "axios";
import {
GET_ITEMS,
NEW_ITEM,
ITEM_CHECK,
GET_CATEGORIES,
NEW_CATEGORY,
MESSAGE,
} from "./types";
export const getItems = () => (dispatch, getState) => {
axios
.get("/api/todo/todos", tokenConfig(getState))
.then((res) => {
dispatch({
type: GET_ITE... | true |
d3019fa0d127b614b81c4f1e8c660980c17d669f | JavaScript | NikitaLem/infotechs-task | /src/main.js | UTF-8 | 8,313 | 3.0625 | 3 | [] | no_license | import initialData from './data.json'; //импорт данного в задаче json
const sorterArr = document.querySelectorAll('.sorter'); //список всех элементов, инициализирующих сортировку
const editor = document.querySelector('.edit');
const visibilityController = document.querySelector('.visible-controller');
const table = d... | true |
852edb19c3233b7fa6a8a219149d2234f9d6f638 | JavaScript | salomvary/weatherr | /app/weather.js | UTF-8 | 7,016 | 2.828125 | 3 | [] | no_license | /* eslint-disable indent */
import {wire} from '/node_modules/hyperhtml/esm.js'
import WeatherNavbar from './weather-navbar.js'
import Icon from './icon.js'
/**
* @typedef { import('./store.js').State } State
*/
/**
* Weather view
*
* @param {State} state
* @param {() => void} onRetry
* @param {(location: stri... | true |
74a616b77cf3980a3d757c8da8bb19e04ecb60c5 | JavaScript | Coffee-Dragon/game-of-life | /sources/js/Gui.js | UTF-8 | 1,459 | 2.984375 | 3 | [] | no_license | export class Gui {
/**
* @param startBtn {HTMLButtonElement}
* @param stopBtn {HTMLButtonElement}
* @param pauseBtn {HTMLButtonElement}
*/
constructor(startBtn, stopBtn, pauseBtn) {
this.startBtn = startBtn;
this.stopBtn = stopBtn;
this.pauseBtn = pauseBtn;
th... | true |
26af1591d18aa39bafe9184d943d2e1b5a1c3ce4 | JavaScript | joaopedroasz/omnistack-8-tindev | /frontend/src/pages/Main.js | UTF-8 | 4,762 | 2.65625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import io from 'socket.io-client';
import './Main.css';
import api from '../services/api';
import logo from '../assets/logo.svg';
import like from '../assets/like.svg';
import dislike from '../assets/dislike.svg';
import its... | true |
0766e86878692e6ac1b7c3e6080613f0c75edc70 | JavaScript | Tempelhaug/Eksempler | /GoMap/js/components/apiAccess/sendFeedback.js | UTF-8 | 1,276 | 2.703125 | 3 | [] | no_license | /**
* Sends feedback to server with phonedata, userdata and a message from the user.
* The other fields required for this post function is fetched within this function
*
* @param {String} message - the message the user wants to send as feedback
* @param {String} userId - the uuid of the user that is sending the fe... | true |
c81bb329deb61d1ff0d463a3425028ac490c9905 | JavaScript | lukenems/phase-2-challenge | /part-1/functions.js | UTF-8 | 1,068 | 3.75 | 4 | [
"MIT"
] | permissive | //Month()
function month(date) {
console.assert(typeof date === 'string', "Please insert a date, with quotes, in the syntax: 'YYYY,MM,DD'");
let m = new Date(date)
const month = m.getMonth() + 1;
const monthName = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]
ret... | true |
06ae869fe844b231b8081f0d42e27fcb3e311f19 | JavaScript | Kiznaiver1998/Canvas-painter | /js/app.js | UTF-8 | 4,520 | 3.046875 | 3 | [] | no_license | let canvas = document.getElementById('canvas')
let ctx = canvas.getContext('2d')
ctx.globalCompositeOperation = 'source-atop';
let actionStatus = false
/* false 表示为默认铅笔模式,true 为橡皮模式*/
let lineWidth = 8
autoSetCanvasSize(canvas)
listenToMouse(canvas)
/* 设置 canvas 为页面大小 */
function autoSetCanvasSize(canvas){
resize()
... | true |
51e2cad90524771619930eada15ab09588c4338e | JavaScript | jacknoble/irc_bots | /lyricsBot.js | UTF-8 | 4,224 | 2.953125 | 3 | [] | no_license | var irc = require('irc');
var request = require('request');
var cheerio = require('cheerio');
var config = {
channels: [process.env.IRC_CHANNEL],
server: process.env.IRC_SERVER,
botName: 'LyricsBot'
};
var bot = new irc.Client(config.server, config.botName, {
channels: config.channels
});
bot.output = fu... | true |
105927a4ebc4fadb64f41b0be19b10b89ae3f1e1 | JavaScript | sugarfig/p5-lab-1 | /03_colors/sketch.js | UTF-8 | 691 | 3.65625 | 4 | [] | no_license | // Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 1-3: RGB Color
function setup() {
createCanvas(displayWidth, displayHeight);
noStroke();
}
function draw() {
background(255);
// Bright red -> change my fill!
fill(255,0,0);
ellipse(100,100,10... | true |
3d5d1f5253d4a95a035ce6e526a23c6ab9b7357f | JavaScript | EmanAlazmi/vector-field-visualizer | /js/get_field.js | UTF-8 | 2,299 | 2.8125 | 3 | [
"MIT"
] | permissive | function makeHttpObject() {
try {
return new XMLHttpRequest();
} catch (error) {
}
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (error) {
}
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (error) {
}
throw new Error("Could not cr... | true |
a75671051974ac7ca43fa9ed691012052c300bd9 | JavaScript | qszhu/thecodingtrain_coding_challenges | /72/lane.js | UTF-8 | 1,262 | 3.21875 | 3 | [] | no_license | class Lane extends Rectangle {
constructor(index) {
super(0, index * grid, width, grid);
}
static newSafety(index, c) {
const lane = new Lane(index);
lane.type = SAFETY;
lane.obstacles = [];
lane.col = c;
return lane;
}
static newObstacles(index, t, n, len, spacing, speed) {
cons... | true |
84eda0da04288f420f3b103dc92d0d0972bd44b6 | JavaScript | gitter-badger/nquest | /nquest.js | UTF-8 | 2,089 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* nquest core
* @author hiwangchi@gmail.com
* https://github.com/wangchi/nquest
* MIT
*/
'use strict';
var http = require('http');
var querystring = require('querystring');
var url = require('url');
function Nquest ( options, callback ) {
var urlParse = url.parse(options.url);
merge(o... | true |
330e572d450b4a3ddab6b29b19e148fe891af5f8 | JavaScript | garronmichael/toyProbs | /src/getADownArrow.js | UTF-8 | 776 | 4.1875 | 4 | [] | no_license | /*
Given a number n, make a down arrow shaped pattern.
For example, when n = 5, the output would be:
123454321
1234321
12321
121
1
and for n = 11, it would be:
123456789010987654321
1234567890987654321
12345678987654321
123456787654321
1234567654321
12345654321
123454321
1234321... | true |
639622eb0a0e25a4c71fa784825fa98537af50f6 | JavaScript | monica-jm/bookswap-client | /src/pages/Explore.js | UTF-8 | 7,907 | 2.5625 | 3 | [] | no_license |
import { useState, useEffect } from "react"
import { Col, Row, Card, Typography, Skeleton, Modal, Tooltip, Avatar } from "antd"
import { MoreOutlined, HeartOutlined, MailOutlined } from "@ant-design/icons"
import { getAllBooks, updateBookmarks } from "../services/book"
import { useAuthInfo } from '../hooks/authConte... | true |
3a3871ccbc149713a7c271c0bc31497beda786c3 | JavaScript | Battzing/data-structrue | /circle-linkedlist.js | UTF-8 | 3,563 | 3.65625 | 4 | [] | no_license | (function () {
//生成列表内部元素节点(generate inner data)
function Element (val) {
this.element = val;
this.next = null;
}
//循环链表数据结构(circle linked-list data structrue)
function ElementsList () {
this.head = new Element('head');
this.head.next = this.head;
this.find =... | true |
57df4d8df2e73302a9ec7c039551ceb9967dd494 | JavaScript | nickurane/notes | /note.js | UTF-8 | 3,191 | 3.21875 | 3 | [] | no_license |
function addnote()
{
let text=document.querySelector("#text_note");
let notes = localStorage.getItem("notes");
if (notes == null) {
notesObj = [];
} else {
notesObj = JSON.parse(notes);
}
notesObj.push(text.value);
localStorage.setItem("notes", JSON.s... | true |
6dd1ff07dd7a87f4311251ec79ca970a72748c64 | JavaScript | anshulBharath/CISC131-classwork | /day19/ColorSwap.js | UTF-8 | 688 | 3.265625 | 3 | [] | no_license | "use script";
/* Anshul Bharath
CISC 131
Spring 2020
03/06/20
This homework excercise demonstrates nested divs.
This program allows a new div to be created inside the existing div
evertime the user clicks on the div.
*/
window.onload = function()
{
var element;
element = document.getEl... | true |
c9790e08e66e7b4a50e5d94cb04e028c6fad9267 | JavaScript | elianarlivingston/Generador-de-Memes-ADA | /components/Canvas/index.js | UTF-8 | 1,596 | 2.65625 | 3 | [] | no_license | import { imageResize } from "../../Modules/resizeImage.js"
class UICanvas extends HTMLElement {
constructor() {
super()
this.isUp = null
}
handleEvent(event) {
switch (event.type) {
case 'mousedown':
this.resizeImage.handleMouseDown(event)
... | true |
dd76b920f94c8b852dec3c474d63b1df28738cf5 | JavaScript | alecashford/firebase-twitter-analytics | /helpers.js | UTF-8 | 8,135 | 2.625 | 3 | [
"MIT"
] | permissive | var dataRef = new Firebase("https://scorching-fire-1875.firebaseio.com/");
dataRef.limit(20).on("child_added", importFromFirebase);
function importFromFirebase(snapshot){
analyzeSentimentValue(snapshot.val());
};
$(function () {
$(document).ready(function() {
Highcharts.setOptions({
... | true |
f86da09a3decfa2e3fcd3179d2f9b9c757409b31 | JavaScript | Onebestever/fizzbuzz | /main.js | UTF-8 | 543 | 4.5625 | 5 | [] | no_license |
// Write a short program that prints each number from 1 to 100 to the console.
// For each multiple of 3, print "Fizz" instead of the number.
// For each multiple of 5, print "Buzz" instead of the number.
// For numbers which are multiples of both 3 and 5, print "FizzBuzz" instead of the number.
function fizz... | true |
637fcd534999bdda97d04a20a33118a0c54f2296 | JavaScript | Aaryan-R-S/JavaScript-Tutorials | /Tutorials/6PropMethodTemplate.js | UTF-8 | 1,317 | 3.90625 | 4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | console.log("Hi!")
const name = 'ARS'
const say = 'Good Mornning!'
console.log(name +' '+say)
let html;
html = "<h1> LOL</h1>"
console.log(html)
console.log(html.concat(" lolololol")) //add
console.log(html.toUpperCase())
console.log(html.toLowerCase())
console.log(html.length)
console.log(html.indexOf(">"))
console.l... | true |
9345084d4e84ce9986a4b3f254244d44d4334b5a | JavaScript | jonbaxt/NoDBProject | /src/components/select/IdSelect.js | UTF-8 | 1,128 | 2.859375 | 3 | [] | no_license | import React, { Component } from 'react';
export default class IdSelect extends Component {
constructor() {
super()
this.state = {
id: []
}
this.sendId = this.sendId.bind(this);
}
sendId(newId) {
this.props.getYear(newId)
}
handleChoice(event)... | true |
21fdda20b4d6f6116d00c4a323a5adddd9353b12 | JavaScript | mvnulman/DI_Bootcamp | /Week 8/Day 3/class-notes/robot.js | UTF-8 | 1,177 | 2.828125 | 3 | [] | no_license | const showRobots = () => {
let x = new XMLHttpRequest();
x.open('GET', 'https://jsonplaceholder.typicode.com/users');
x.send();
x.responseType = 'json';
x.onload = function(){
let robotsArray = x.response;
createRobots(robotsArray);
}
}
const getXML = () => {
let x = new XMLHttpRequest();
x.ope... | true |
1f0846d427383d97616594a354745a39014119b9 | JavaScript | Vylda/JAK | /util/xml.js | UTF-8 | 2,352 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
Licencováno pod MIT Licencí, její celý text je uveden v souboru licence.txt
Licenced under the MIT Licence, complete text is available in licence.txt file
*/
/**
* @overview Práce s XML
* @author Zara
*/
/**
* @namespace
* @group jak-utils
*/
JAK.XML = JAK.ClassMaker.makeStatic({
NAME: "JAK.XML",
VERSIO... | true |
8a089333d99c522240c407197d04df03acb67488 | JavaScript | 125761565/root | /skill/src/main/webapp/res/common/js/public.js | UTF-8 | 7,522 | 2.921875 | 3 | [
"MIT"
] | permissive | var strText;
var timeId = "";
$(function(){
var $search = $("input[keyword]");
strText =" "+$search.attr("keyword")+" ";//提示信息
var oldStrText=strText;//保存最原始的提示信息
var searchVal=$search.val();//查询条件
//搜索框鼠标悬浮事件监听
$search.mouseover(function(){
//alert(document.activeElement.id);
if(is... | true |
a0b74f738e537194365d171dc99e894c9c59b2c1 | JavaScript | YunxiBZ/E-commerce-bakery-ou-est-mon-pain | /src/selectors/category.js | UTF-8 | 1,029 | 2.984375 | 3 | [] | no_license | export default (products = [], category) => {
const productsWithOneCategory = products.filter(
(productFoundWithCategory) => (
productFoundWithCategory.categories.length !== 0
),
);
// Filter products with two categories
const productsWithTwoCategories = products.filter(
(productFoundWithCateg... | true |
0a38f7bf26c9e3cb9ed48dc8c64cf2cedaa1a8c1 | JavaScript | kenjiO/voting-app | /app/routes/index.js | UTF-8 | 5,900 | 2.5625 | 3 | [] | no_license | 'use strict';
var path = process.cwd();
var Poll = require('../models/Poll.js');
module.exports = function (app, passport) {
function requireLoggedIn (req, res, next) {
if (req.isAuthenticated()) {
return next();
} else {
res.redirect('/login');
}
}
function getLoggedInUser (req) {
if (req.isAuthe... | true |
cbb5562d167f34a24d750156f06ff1cca71b4e12 | JavaScript | storytellersoftware/storyteller | /src/main/resources/frontend/js/core/playback/settings.js | UTF-8 | 2,159 | 3.0625 | 3 | [] | no_license | /*
playback/SETTINGS.js
Contains everything needed for adjusting your settings uesd in a playback
(currently only the font size).
Requirements:
- playback/main.js
Holds the main playback object, which is where settings are stored
*/
function setupSettings() {
$("#settingsMenu").dialog({
autoOpen: false,... | true |
1ea6ec35ee5bd16c15e22faaf8a2055f22ffef3b | JavaScript | VladKitTort/javascript_basics | /lesson1/script_task1.js | UTF-8 | 201 | 3.296875 | 3 | [] | no_license | "use strict";
let temperatureValue = prompt('Введите температуру в цельсиях:');
alert(`Температура по фаренгейту: ${(9 / 5) * temperatureValue + 32}`); | true |
950fb02e0b4b968663fe1b0cbebf74bd9422665f | JavaScript | Cedrusco/alexa_bpm_session_service | /index.js | UTF-8 | 950 | 2.765625 | 3 | [] | no_license | var express = require('express');
var bodyparser = require('body-parser');
var app = express();
app.use(bodyparser());
var tasksList, index = 0;
app.post('/tasksList', function(req, res) {
console.log('recieved tasksList: ', req.body);
var body = req.body;
tasksList = body;
index = 0;
res.sendStatus(200)... | true |
add6a73dfa4858982c9081aa1774f7eeae461a48 | JavaScript | ang-zeyu/weathery | /src/index.js | UTF-8 | 7,827 | 2.546875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import Weacompo from './wea_component.js';
import Spinner from './loading.js';
import {Row, Col, Container} from 'react-bootstrap';
class App extends React.Component {
//f9655cc4f6b2e05ff5e3e6d316b0a1fd
state = {
longitude:null, latitude:null... | true |
e8fd828683d4f6b7e83ccf201df3e82b62fbeb9a | JavaScript | danhart/uswitch-test | /scripts/lib/validators/email-validator.js | UTF-8 | 671 | 2.84375 | 3 | [] | no_license | (function (factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
}
}(function () {
// It is notoriously difficult to write an RFC-compliant email address
// validator. As such, on the c... | true |
c319fffed0dbcbd3f7594ad2f2105cb8714b4ea8 | JavaScript | hongxiaomin/react-interview | /my-app/src/components/SearchBar.jsx | UTF-8 | 549 | 2.609375 | 3 | [] | no_license | import React,{Component} from 'react';
class SearchBar extends Component{
constructor(props){
super(props);
this.txtSearch = null;
this.state={term:''};
this.setInputSearchRef = e=>{
this.txtSearch = e;
}
}
onInputChange=(event)=>{
this.setState(... | true |
cf44e5101f4d53a842996433ce1ab04b011003a2 | JavaScript | MiracleUFO/github-clone | /index.js | UTF-8 | 480 | 3.078125 | 3 | [] | no_license | import { loadData } from './scripts/loadData.js';
window.addEventListener("load", function () { //Adds click event to retrieve-btn
let el = document.getElementById("retrieve-btn");
el.addEventListener("click", function (e){
sendUsername(e);
}, false);
});
const sendUsername = (e) => { //Sends usernam... | true |
7ea30ff91540935274fea8a0caaeb782f362e050 | JavaScript | FranEG80/pt-ximdex | /ximdex-node/src/Commercial/getFormules.js | UTF-8 | 1,571 | 3.09375 | 3 | [] | no_license |
import { calculatePos, getRawValue } from './utils';
const FORMULES = {
['€']: (cost, value) => cost + value,
['%']: (cost, value) => cost + (cost * value / 100)
}
const CHARACTERS_FORMULE = Object.keys(FORMULES)
const getFormules = json => {
let output = {}
Object.keys(json).forEach(key => {
const [firs... | true |
7caa6855f3546104ed946d6da261dfa738a17c5e | JavaScript | neurotoxinvx/easysns | /models/base.js | UTF-8 | 812 | 2.65625 | 3 | [] | no_license | function BaseModel(store, prefix){
this.store = store
this.prefix = prefix
}
module.exports = BaseModel
BaseModel.prototype.create = function(obj, callback){
obj.id = obj.id || Date.now()
this.store.set(this.prefix + obj.id, obj, callback)
}
BaseModel.prototype.get = function(id, callback){
this.store.get(... | true |
6c0ca1f49649935faa88a6f75c8b750004c35d5c | JavaScript | RubelAzad/management-system | /client-side/components/TopicsData.js | UTF-8 | 875 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import * as React from "react"
import { topicsURL } from "./api"
function TopicsList() {
const [topics, setTopics] = React.useState([])
const [loading, setLoading] = React.useState(false)
const [error, setError] = React.useState(null)
React.useEffect(() => {
setLoading(true)
fetch(topicsURL)
.the... | true |
35b56b163c6f5516d42771515178242fbc6e8266 | JavaScript | po1sigala/codingCracked | /dailykata/getmiddle.js | UTF-8 | 404 | 3.765625 | 4 | [] | no_license | function getMiddle(s) {
//get the middle character or if its even the middle two
switch (s.length % 2 === 0) {
case true:
return s.charAt(s.length / 2) + s.charAt(s.length / 2 + 1);
break;
case false:
return s[Math.floor(s.length / 2)];
break;
... | true |
a9c338343843edecec4e946e55d864721db795f3 | JavaScript | taiki-fw/AtCoder | /ABC152/B.js | UTF-8 | 472 | 3.203125 | 3 | [] | no_license | "use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));
function main(input) {
input = input
.split("\n")[0]
.split(" ")
.sort();
const char = input[0];
// let small = "";
// let big = "";
// if (input[0] > input[1]) {
// big = input[0];
// small = input[1];
// } else {
... | true |
61c7834c1213f97012bd66605f0416e9477dac80 | JavaScript | crazycracker/Final | /static/js/datepicker.js | UTF-8 | 2,499 | 2.8125 | 3 | [] | no_license | /**
* Created by vinay raj on 3/22/2017.
*/
$(function () {
$('#calendar').datepicker({
inline: true,
firstDay: 1,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
});
$( "#datepicker" ).datepicke... | true |
c19a133a928081ebbebdbaab226ba6ae93c9c0ab | JavaScript | hakloev/buzzerino | /public/js/Countdownr.js | UTF-8 | 498 | 2.90625 | 3 | [] | no_license | var Countdownr = (function($) {
var countdownrRunning = false
var countdownr = function(seconds) {
$('#countdownr').html(seconds)
if (seconds <= 0) {
countdownrRunning = false
console.log('Countdownr done')
} else {
setTimeout(countdownr, 1000, seconds - 1)
}
}
return {
startWithTime: functi... | true |
1c8d96e2721460e6c454f3145824b613d40461b2 | JavaScript | Acosta816/crown-clothing | /src/redux/store.js | UTF-8 | 1,016 | 2.640625 | 3 | [] | no_license | //we import applyMiddleware to use the redux-logger to basically just log the actions that get dispatched and processed thru the reducers which are junctioned at the root-reducer.
import { createStore, applyMiddleware } from 'redux';
import logger from 'redux-logger';// handy for debugging redux
import { persistStore }... | true |
449672fdd8422f56ab12ad9c8302510b57e352af | JavaScript | juannarguelles/coderpage | /js/ajax.js | UTF-8 | 508 | 2.5625 | 3 | [] | no_license | $(function () {
fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'POST',
body: JSON.stringify({
title: 'Formulario',
body: 'enviado',
userId: 1,
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
... | true |
9c89ef2dc1cb89e2dd9127450c29acb78fcf2c54 | JavaScript | eliasnepo/myclass | /frontend/src/core/components/Pagination/Pagination.jsx | UTF-8 | 1,361 | 2.53125 | 3 | [] | no_license | import React from 'react';
import styles from './Pagination.module.css';
import {ReactComponent as ArrowIcon} from '../../assets/images/arrow.svg'
export default function Pagination({totalPages, activePage, onChange}) {
const items = Array.from(Array(totalPages).keys())
const previousClass = totalPages > 0 && ... | true |
060e73ea50479f0114313ef7c92dfeaae1ae08c3 | JavaScript | lishengzxc/leetcode | /347.TopKFrequentElements.js | UTF-8 | 523 | 3.203125 | 3 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @param {number} k
* @return {number[]}
*/
var topKFrequent = function(nums, k) {
var hash = {};
var result = [];
for (var i = 0, len = nums.length; i < len; i++) {
if (hash[nums[i]]) {
hash[nums[i]]++;
} else {
hash[nums[i]] = 1;
}
}
var hashArr = [... | true |
f5756c9eda303802ba2139a323c3dd10fbb7134b | JavaScript | PedroH01/Site-PandeHelp | /js/carrossel.js | UTF-8 | 691 | 3.5 | 4 | [] | no_license | var wallindex = 1;
show_wall();
function plus_walls(n){
show_wall(wallindex += n);
}
function current_walls(n){
show_wall(wallindex = n);
}
function show_wall(n){
var i;
var walls = document.getElementsByClassName("wall");
var dots = document.getElementsByClassName("dot");
if(n > walls.len... | true |
b539723ed8ba91e0391248d5d9dcf2cc7df9e6fb | JavaScript | VickyRong/js-practice | /数组/demo.js | UTF-8 | 1,364 | 3.171875 | 3 | [] | no_license | /**
* 多状态精简写法一
*/
const action1 = {
'1': ['processing','IndexPage'],
'2': ['fail','FailPage'],
'3': ['fail','FailPage'],
'4': ['success','SuccessPage'],
'5': ['cancel','CancelPage'],
'default': ['other','Index'],
}
let num = Math.floor(Math.random()*10)
let result = action1[num] || action1['d... | true |
40bb3eb33fb39512b090eb5b58529e21c0b5ff67 | JavaScript | willymmerlet12/EmojiSearch | /src/App.js | UTF-8 | 1,257 | 2.890625 | 3 | [] | no_license | import React, { useState } from "react";
import "./App.css";
import emojiList from "./assets/data.json";
import Footer from "./components/Footer";
import Line from "./components/Line";
import Search from "./components/Search";
function App() {
const [results, setResults] = useState(emojiList.slice(0, 20));
const [... | true |
ea714f883ba4832b1c10661807dcf0fad3b31af6 | JavaScript | Aakratigoel/bamazon | /bamazon_customer.js | UTF-8 | 2,622 | 2.796875 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
// Your port; if not 3306
port: 3306,
// Your username
user: "root",
// Your password
password: "Jul@1989",
database: "bamazon_db"
});
connection... | true |
4eb846d50b6bd0f67dd9b5e0ebe62e3cc4c61f05 | JavaScript | danielnmai/interview_challenges | /js/leetcode/117.PopulatingNextRightPointersInEachNodeII.js | UTF-8 | 2,032 | 3.8125 | 4 | [] | no_license | /**
* // Definition for a Node.
* function Node(val, left, right, next) {
* this.val = val === undefined ? null : val;
* this.left = left === undefined ? null : left;
* this.right = right === undefined ? null : right;
* this.next = next === undefined ? null : next;
* };
*/
/**
* @param {Node} root... | true |
82527785163084f3842891943606609e91e00777 | JavaScript | juanpc10/prospectsApp | /frontend/src/context/appReducer.js | UTF-8 | 829 | 2.671875 | 3 | [
"MIT"
] | permissive | // eslint-disable-next-line
export default (state, action) => {
switch(action.type) {
case 'add_prospecto':
return {
...state,
prospectos: [action.payload, ...state.prospectos]
}
case 'delete_prospecto':
return {
...state,
prospectos: [...state.prospectos.s... | true |
153f53c52fa6ffe8fbd3eec2ddbddb0c29c77c93 | JavaScript | developerfranky/MusicTheory-RN | /src/redux_reducers/topic_reducer.js | UTF-8 | 1,541 | 2.5625 | 3 | [] | no_license | import { CHOOSE_CATEGORY, CHOOSE_TOPIC, NEW_HIGH_SCORE, CLEAR_NEW_HIGH_SCORE } from '../redux_actions/types';
import { MUSIC_DIR } from '../core_music_logic/types';
const INITIAL_STATE = {
category: '',
topic_dict: '',
topic_name: '',
topic_id: '',
new_high_score: null, // used for when a new high score ... | true |
3b458f25922503b1236e5c83411337f4772d8687 | JavaScript | familon16/coderbyte | /Easy/CheckNums.js | UTF-8 | 493 | 3.484375 | 3 | [
"MIT"
] | permissive | // Kimeshan Naidoo 2014, www.kimeshan.com.
//Coderbyte profile: http://www.coderbyte.com/CodingArea/Profile/?user=kimeshan
//Solution for Coderbyte Challenge: Check Nums (Easy)
//http://www.coderbyte.com/CodingArea/information.php?ct=Check%20Nums
//Compares 2 numbers, returns the larger one or "-1" if both are equal.
... | true |
f6f2ebcdbf0a47d0da4fb8a0dd5ba97b3914286a | JavaScript | 742PM/Quiz | /Quiz/QuizLevelManager/ClientApp/src/components/forms/CreateGeneratorForm.js | UTF-8 | 7,115 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import React from "react";
import '../../styles/EditorForm.css'
export class CreateGeneratorForm extends React.Component {
constructor(props) {
super(props);
this.state = {
topic: 'Cложность алгоритмов',
level: 'Циклы',
topicId: '',
levelId: '',
... | true |
48c1de52695b015e4ad45ee1d366a6eeb4a0b7b4 | JavaScript | dsicher/poker | /src/redux/actions.js | UTF-8 | 1,645 | 3.015625 | 3 | [] | no_license | import { HAND_SIZE, POINTS } from '../js/constants';
import { isStraight, isPair } from '../js/utils';
import newDeck from '../js/newDeck';
export const actionTypes = {
DEAL: 'POKER/DEAL',
DRAW: 'POKER/DRAW',
SELECT_CARD: 'POKER/SELECT_CARD',
};
/* Action Creators
* Return actions with a type and any required ... | true |
2f1ad03fee20be2523003b19e361e34d1cfeb3e5 | JavaScript | raptor-vrn/ajs_hometask_9-Regexp | /src/js/__tests__/Validator.test.js | UTF-8 | 849 | 2.734375 | 3 | [] | no_license | import Validator from '../Validator';
const validator = new Validator();
test('Success', () => {
expect(validator.validateUsername('Ivan123e')).toBe(true);
});
test('Start from number', () => {
expect(validator.validateUsername('666Ivan')).toBe(false);
});
test('Start from -', () => {
expect(validator.v... | true |
56ecdcda8052f694be84601583ef0a80de11ad51 | JavaScript | simonarcher99/ip-address | /src/components/IpAddress.js | UTF-8 | 1,487 | 2.625 | 3 | [] | no_license | import { useState, useEffect } from "react";
import LocationMap from "./LocationMap";
import classes from "./IpAddress.module.css";
const IpAddress = () => {
const [ipAddressDict, setIpAddressDict] = useState({});
const [httpError, setHttpError] = useState(null);
useEffect(() => {
fetch("http://ip-api.com/j... | true |
1b53220c0363dfe9bbfd09c73ade60e62000970d | JavaScript | gylee815/AWS | /Lambda/redirect/origin_request_redirect_default/index.js | UTF-8 | 1,871 | 2.578125 | 3 | [] | no_license | const countries_arr = require('./countries_arr.js');
exports.handler = async (event) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const req_url = request.uri;
const proto = headers['cloudfront-forwarded-proto'][0].value;
const host = headers['host'... | true |
11cddd43c761c116685e79e6cf462fb2179cb625 | JavaScript | 120m4n/Gifos | /js/favorities.js | UTF-8 | 1,224 | 3.0625 | 3 | [] | no_license | //update favorites gits in favorite section
const updateFavs = ()=> {
if (FavoriteGifs.length > 0) {
$favGifsResults.innerHTML = "";
$favGifsResultsEmpty.classList.add('hidden');
$favGifsResults.classList.remove('hidden');
if(FavoriteGifs.length > offsetFavs){
$favGif... | true |
d1f95a488eba1857a03fbee8f40fcd6acfe1d8b2 | JavaScript | dmorocho/Pursuit-Core-Web-Express-Passing-Data-Lab | /app.js | UTF-8 | 665 | 2.5625 | 3 | [] | no_license | const express = require("express")
const cors = require("cors")
const axios = require("axios")
const port = 3000
const app = express()
app.use(cors())
app.get("/gifs", async (req, res) => {
let gifs = await axios.get(`https://api.giphy.com/v1/gifs/search?api_key=nGBdesYGe92z2bDC8fBGIc8BVhxOZCBh&q=${req.query.search... | true |
49306e42291a739a8d25a8293eb8d8d98df20791 | JavaScript | L-Eli/leetcode | /algorithms/js/00058-length-of-last-word.js | UTF-8 | 431 | 3.71875 | 4 | [] | no_license | /**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord = function (s) {
let result = 0;
let space = false;
for (let i = 0; i < s.length; i++) {
if (s.charAt(i) === ' ') {
space = true;
} else {
if (space) {
space = false;
... | true |