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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b2426fcc957f234e0c5840ee5f94f7096fb7c498 | JavaScript | thariii/Siyalla-Project | /check-password.js | UTF-8 | 637 | 3.1875 | 3 | [] | no_license | function checkPass(){
var currentPassword = document.getElementById('currentPass').value;
if (currentPassword == "") {
alert("Please enter current password");
return false;
}
var newPassword = document.getElementById('newPass').value;
var fnameRGEX = /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})+$/;... | true |
de9688a52a98ef8723d6a06306a8c7d219f1d273 | JavaScript | Alucarth/colegio | /assets/js/charts/c3/c3_lines_areas.js | UTF-8 | 2,372 | 2.8125 | 3 | [] | no_license | /* ------------------------------------------------------------------------------
*
* # C3.js - lines and areas
*
* Demo setup of line, step and area charts
*
* Version: 1.0
* Latest update: August 1, 2015
*
* ---------------------------------------------------------------------------- */
funct... | true |
622c88394253a818a562a6d307c4010f7a5a67ee | JavaScript | besseddrest/exercises | /bind.js | UTF-8 | 327 | 2.921875 | 3 | [] | no_license | // Function.prototype.bind = function() {...};
function bind(fn, context, args) {
return function() {
arguments // {0: Event(), 1: 'dog', 2: 'cat}
var passedArgs = [].slice.call(arguments, 0);
var newArray = args.concat(passedArgs);
fn.apply(context, newArray);
//e.fn(context, args);
... | true |
5f36738c79506a17842b7a06453c0cb629469faf | JavaScript | AshleyOh-bit/frontend-mod-1-prework | /section4/exercises/objects.js | UTF-8 | 4,812 | 4 | 4 | [] | no_license | /*
In the exercises below, write your own code where indicated
to achieve the desired result.
Two examples are already completed. Your task is to complete
any remaining prompt.
Make sure to run the file with node in your command line.
*/
// EXAMPLE: Write code below that will declare a vairable that stores an Object... | true |
9a17ecc5a9cf51c3440a81b669436e3a05ac3ada | JavaScript | FelipeJurisJacques/asfar | /source/util/services/UfBrClass.js | UTF-8 | 4,732 | 2.5625 | 3 | [] | no_license | export class UfBrClass {
validity(e) {
if (typeof e == 'string') {
e = e.toUpperCase(e).trim()
if (e == 'AC') {
return 'AC'
}
else if (e == 'AL') {
return 'AL'
}
else if (e == 'AP') {
... | true |
f9a4b0fb57de27920ddd3999abd3afbed3bfe183 | JavaScript | johnwarejunior/coding-exercises-js | /src/date.js | UTF-8 | 578 | 3.171875 | 3 | [
"MIT"
] | permissive | export default function date() {
var readlineSync = require('readline-sync');
var year = yyyy;
var month = mm;
var day = dd;
var d = new Date(yyyy-mm-dd);
var dateEntry = readlineSync.question('What is the date?')
if(year.length === 4, month.length === 2, day.length === 2) {
moment().format(YYYY-MM-DD);
... | true |
105877e6e5c60101ecb4982e3cb3dd72b1c65314 | JavaScript | ljquan/gen-structure | /src/run.js | UTF-8 | 8,226 | 2.546875 | 3 | [] | no_license | // 入口文件
const apiFs = require("./api/fs.js");
const fs = require("fs");
const path = require("path");
const regComment = /\/{2,}|\/[\*]+|[\*]+\/|^\s*[\*]+|[\*]+\s*|<!-{2,}|-{2,}>/g;
/**
* 计算注释文本属于介绍该代码文件说明的可能性的权重(概率)
* @param {string} text 文本
*/
function getWeight(text) {
if (/模块|组件|@desc/.test(text)) {
retur... | true |
3a2278c37de8dee50f6d7bae9a8e7bbb6ca8610f | JavaScript | Hemantnie/Reactive-Website-with-RXJS | /stopwatch.js | UTF-8 | 626 | 2.921875 | 3 | [] | no_license | import { interval, fromEvent } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
const startButton = document.getElementById("start-button");
const sstopButton = document.getElementById("stop-button");
const resultArea = document.querySelector<HTMLElement>('.output');
let tenthSecond$ = interval(100);
let... | true |
898c14e058c6731f972982691bbf7e7777bcfb88 | JavaScript | newyork-anthonyng/5217 | /src/components/time-display/test.js | UTF-8 | 449 | 2.84375 | 3 | [] | no_license | var expect = require('chai').expect;
test('should render time in milliseconds as minutes', function(context) {
// var timeInMs = 2 * 60 * 1000; // 2 minutes
// var output = context.render({ timeInMs: timeInMs });
// console.log(output.$('h1').html);
// console.log(output.$('h1').text);
// // console.log(outp... | true |
a2b69440c3e142106001bedee0c12cffa74ec6b7 | JavaScript | xuan6/react-practice | /02-tours/src/App.js | UTF-8 | 773 | 2.765625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import Loading from './Loading'
import Tours from './Tours'
const url = 'https://course-api.com/react-tours-project'
function App() {
const [loading, setLoading] = useState(true)
const [tours, setTours] = useState([]) //set a empty variable to store tours data... | true |
d6eb13b5d6a67be6b442f1eb0675a31ed3d816cc | JavaScript | scel-hawaii/control-tower | /api/models.js | UTF-8 | 7,999 | 2.6875 | 3 | [] | no_license | var pg = require('pg')
var gauss = require('gauss')
var _ = require('underscore')
var config = {
user: 'control_tower',
database: 'control_tower',
host: 'db',
port: 5432,
max: 10,
idleTimeoutMillis: 30000
};
/*
* Given: An SQL query
* Returns: The result of the SQL query
*
*/
function pg... | true |
7b73649cddf1e550027e43b387623b7eff91f225 | JavaScript | PROMODVRINDAVANAM/imad-2016-app | /ui/main.js | UTF-8 | 1,082 | 2.90625 | 3 | [] | no_license | //counter code
var button = document.getElementById('counter') ;
button.onclick = function(){
//make a request
var request = new XMLHttpRequest();
//capture the request
request.onreadystatechange = function(){
if (request.readyState ===XMLHttpRequest.DONE){
if (requ... | true |
86605fca720a10a9d7559d2841e0b6f38f48631b | JavaScript | markapuyan/react-todo-app | /src/store/reducers/todoListItem.js | UTF-8 | 1,339 | 2.75 | 3 | [] | no_license | import * as actionTypes from '../actions/actionTypes'
const initialState = {
todo: null,
itemTitle: '',
isItemAddable: false,
fetchLoading: false,
fetchError: false
}
const fetchTodoListItem = (state, action) => {
return {
...state,
fetchLoading: true
}
}
const setTodoListI... | true |
6f9ab5b1d8045265161b8328f37b1e23a8dabfe5 | JavaScript | zbcstudy/node-example | /buffer.js | UTF-8 | 114 | 2.515625 | 3 | [] | no_license | const buf = Buffer.from('aaron', 'ascii');
console.log(buf.toString("base64"));
console.log(buf.toString('hex')); | true |
02a03141e6a3de674308ff1d7a71ba637f098d92 | JavaScript | katana2w/leetcode-codewars | /js_features/Singleton.js | UTF-8 | 2,135 | 4 | 4 | [] | no_license | /*
* The most flexible, albeit somewhat advanced, approach involves using the Proxy object.
* The Proxy object is used to define so-called traps, methods that allow the definition of custom
* behavior for certain operations such as property lookup, assignment etc. The singleton pattern
* dictates that the given class c... | true |
57ed79e2f92eb8064653e4f5a1c15038cebdec4c | JavaScript | draqo666/kp-point-of-sale | /src/components/ImportTool/Importer.js | UTF-8 | 2,853 | 2.59375 | 3 | [] | no_license | import React from 'react';
import FileUploader from './FileUploader'
import ImporterStage1 from './ImporterStage1';
import ImporterStage2 from './ImporterStage2';
import ImporterStage3 from './ImporterStage3';
import { Progress, Row } from 'antd';
class Importer extends React.Component {
constructor(props) {
... | true |
b406dce3838d07da1406c430ed1f61d77823a9e2 | JavaScript | comely-fox/Code-Gather | /http/CORS/server.js | UTF-8 | 708 | 2.640625 | 3 | [] | no_license | const
http = require('http'),
fs = require('fs'),
url = require('url');
// 建立一个http服务
http.createServer((request, response) => {
const oUrl = url.parse(request.url, true);
// 请求的url地址
console.log(request.url, oUrl);
switch (oUrl.pathname) {
// 请求根
case '/':
var html = fs.r... | true |
6f522a6ab69d5d3aeb0a61069df87789a0d816a2 | JavaScript | zlv2s/mi-mall-backend | /utils/index.js | UTF-8 | 1,246 | 2.921875 | 3 | [] | no_license | const uuid = () => {
const s = []
const hexDigits = '0123456789abcdef'
for (let i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
}
s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the cloc... | true |
342dc569e2dcde2fba40c5fa56f4708c416dc27c | JavaScript | yuong1979/reactproject | /src/frontend/src/components/todos/TodoItems.js | UTF-8 | 1,051 | 2.546875 | 3 | [] | no_license | import React, {Component, Fragment} from 'react';
import PropTypes from 'prop-types';
class TodoItems extends Component {
getStyle = () => {
if (this.props.todos.completed === false)
{
return {textDecoration: 'line-through'}
} else {
return {textDecoration: 'none'}
}
}
render() {
const { tit... | true |
22163e56a0f9389e1b047c053e0e5c4dcc6cdafb | JavaScript | ediyacoo/test | /js/api/openlayers/kiein.openlayers.util.js | UTF-8 | 3,796 | 2.921875 | 3 | [] | no_license | if(!window.kiein){window.kiein=function(){};}
kiein.util=function(){};
/**
* @class
*/
kiein.util.converter = {}
/**
* 將openlayer的geometry(譬如point, linestring, polygon)轉換成Goverlay
* 但是,請先將geometry透過transform方法,轉換成經緯度座標!
* @param {Object} geometry 輸入openlayer的geometry
* @return {GOverl... | true |
707ad1a633623f7dd7a7874fe502254904fa17b0 | JavaScript | midfies/lj | /learning_journal/static/delete_post.js | UTF-8 | 615 | 2.5625 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var deleters = $(".delete");
deleters.on("click", function(e){
// send ajax request to delete this expense
$.ajax({
url: 'journal/' + $(this).attr("data") + '/delete',
success: function(){
console.log("deleted");
}... | true |
3259fe26f8be3c3a6a7066a540f0c07f73622b44 | JavaScript | ptown16/peyton-tanzillo-personal-website | /new-portfolio-site/textEffect.js | UTF-8 | 1,702 | 3 | 3 | [] | no_license | const names = document.getElementsByClassName('name-effect');
const below = document.getElementsByClassName('below-name');
let TEXT_CENTER = {
top: undefined,
left: undefined,
};
let SCREEN_CENTER = {
top: undefined,
left: undefined,
};
const TEXT_SHIFT_INTENSITY = 78;
function resizeWindow() {
TEXT_CENTE... | true |
8213feed3ced89820489e87d47490e6c7fd4ecb9 | JavaScript | apexem/psycho-survey | /src/App.js | UTF-8 | 3,609 | 2.625 | 3 | [] | no_license | import React, {useState} from 'react';
import ReactDOM from 'react-dom';
import './App.css';
import Question from './Components/Question';
import { CountdownCircleTimer } from 'react-countdown-circle-timer';
function App() {
function LearningExamples() {
return (
<div className="App-header">
<p>De... | true |
45ed790361becd291ce583e3b714924954276064 | JavaScript | panchal-h/hp12 | /SmartLibrary.Admin/Scripts/Validators.js | UTF-8 | 31,303 | 3.015625 | 3 | [
"MIT"
] | permissive | // this should handle all "" and whitespace situations
String.prototype.isEmptyOrWhiteSpace = function () {
return (this.length === 0 || !this.trim());
};
//rulesList = pass in list of fields to validate
//messages = pass in list of custom error messages
//highlightErrors = if false, will not highlight fields in ... | true |
b5ecf0f2d337edee10288a4a8a7886c32268af39 | JavaScript | orionz/websocket-relay | /client.js | UTF-8 | 456 | 2.5625 | 3 | [] | no_license | const process = require('process');
const WebSocket = require('ws');
const port = 8080
const host = `0.0.0.0:${port}`
const secret = '1234'
const ws = new WebSocket(`ws://${host}/connect/${secret}`);
ws.on('open', function open() {
ws.send('something');
let i = 0
setInterval(() => ws.send('something ' + (i++)),... | true |
9a8cfffcea1ac5bda40bb1a33e2c2030d8d9aa09 | JavaScript | vdiezel/pascal-js-interpreter | /src/ProcedureCall.js | UTF-8 | 1,418 | 2.578125 | 3 | [] | no_license | const ActivationRecord = require('./ActivationRecord')
const AST = require('./AST')
const { ParserError, ERROR_CODES } = require('./Error')
const SymbolTableBuilder = require('./SymbolTableBuilder')
class ProcedureCall extends AST {
constructor(procName, args, token) {
super()
this.procName = procName
t... | true |
161bae94b3c74c4e9e988183a7c030bb9f910e37 | JavaScript | Smolations/elite-bot | /models/jenkins/jenkins-job-runner.js | UTF-8 | 1,177 | 3.015625 | 3 | [] | no_license | const _jobs = Symbol('jobs');
function _jobStatuses(jobs = []) {
return jobs.map(job => job.status());
}
function _resolve(data = []) {
let success = true;
const results = [];
data.forEach((status, index) => {
if (status !== 'SUCCESS') {
success = false;
}
results.push({
job: this[_jo... | true |
07019b47669565c096066d7c82dad3e482ce6bbf | JavaScript | ericghpham/react-hotkeys | /src/hotkeys.stories.js | UTF-8 | 1,623 | 2.578125 | 3 | [] | no_license | import React from 'react';
import { storiesOf } from '@storybook/react';
import Hotkeys from './hotkeys';
storiesOf('Hotkeys', module)
.add('with collision', () => (
<div>
<Hotkeys keys="up up down down" callback={() => alert('hi')} />
<Hotkeys keys="up up down down" callback={() => alert('hi2')} />
... | true |
ec7a27afbfa72722bfa22542621344fdb3a0aa4c | JavaScript | leorojas22/yogscinema | /frontend/src/components/LiveIndicator.js | UTF-8 | 1,509 | 2.609375 | 3 | [] | no_license | import React from 'react';
import { ajaxHelper } from '../helpers/ajax';
class LiveIndicator extends React.Component {
constructor(props) {
super(props);
this.checkLiveInterval = null;
}
componentDidMount() {
this.checkIfLive();
}
checkIfLive() {
if(this.checkLi... | true |
a093a8817599ba23732b1174992c2f0fd2a86a4a | JavaScript | aaronbalthaser/webpack-starter | /src/components/Button/Button.js | UTF-8 | 294 | 2.6875 | 3 | [] | no_license | import './Button.scss';
export class Button {
btnClass = 'btn';
render() {
const button = document.createElement('button');
const body = document.querySelector('body');
button.innerHTML = 'Hello';
button.classList.add(this.btnClass);
body.appendChild(button);
}
}
| true |