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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f162415305580917cea7781204c3f36d811b7dd5 | JavaScript | kaganjd/databasing-the-homeless | /databasing.js | UTF-8 | 2,628 | 3.09375 | 3 | [] | no_license | var rawData;
var modals = [];
var picker;
function init() {
// tabletop.js init() function returns data as an array of objects, like this:
// [{"animal": "horse",
// "color": "brown"},
// {"animal": "chick",
// "color": "yellow"}]
// alt key: '1asZC5tWkBpMZ47S05VxJj0fh3gyMjaKYpK1sDNE2iCA'
Tabletop.init(... | true |
15363f3562ef6bb2825c25c0378524ffbc79f129 | JavaScript | GustavoGuke/Curso-JavaScript-TypeScript | /modulo-6Prototypes/rev-obj.js | UTF-8 | 729 | 3.84375 | 4 | [] | no_license | // revisão de Objetos
const pessoa1 = {
nome: 'Gustavo',
sobreNome: 'Lima',
nasc: '10/09/1994',
dado: function dados(){
console.log(`Perfil 1: ${this.nome} ${this.sobreNome}, nasceu em ${this.nasc}`)
}
}
// pessoa1.dado()
// //ver chaves
// for(let i in pessoa1){
// console.log(i)
// }
... | true |
b462b417e1df6d0f0281fa7eb60d908ce35e7a2c | JavaScript | Noah999/RNDemo-Expo | /store/reducer.js | UTF-8 | 651 | 2.65625 | 3 | [] | no_license | import { combineReducers } from 'redux'; //整合分散store
const defaultState = {
count: 0
};
// 接收关于store改变的操作,state无法修改state,可以通过深拷贝一份,返回新的state
const TODOReducer = (state = defaultState,action) => {
const newState = JSON.parse(JSON.stringify(state));
if(action.type === 'INCREMENT'){
newState.count ... | true |
6a0d79f6e99fef76686a9a9795be846c53650806 | JavaScript | NydiaGuo/notes-for-today | /server.js | UTF-8 | 2,121 | 2.578125 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
// const fs = require('fs');
const mongoose = require('mongoose');
// const db = JSON.parse(fs.readFileSync('data/data.json', 'utf8'));
let dataURL = 'mongodb://firstdatabase:test2018@ds119692.mlab.com:19692/text2018';
//connect to mLab
mo... | true |
596815c53cd833789e771696856c8e6a13c2949b | JavaScript | cadu-LF/estudoLista-1 | /ex2 - conversao_p_segundos.js | UTF-8 | 366 | 3.453125 | 3 | [] | no_license | function principal(){
var tempo = prompt(`Informe o tempo: hh:mm:ss`).split(':')
for(var i = 0; i < 3; i++){
tempo[i] = Number(tempo[i])
}
var resp = conversor(tempo)
console.log(resp)
}
function conversor(tempo){
var seg = tempo[0] * 3600
seg = seg + tempo[1] * 60
seg ... | true |
690650d4f9a77001c1b834ce0e759f2c069d4123 | JavaScript | thuysddoox/clique | /app/js/vendors/home.js | UTF-8 | 12,543 | 2.953125 | 3 | [
"MIT"
] | permissive | var choice = document.querySelector('.choice');
var bar = document.querySelector('.bar__content');
const urlUsers = 'https://test.cliquefan.com/api/portal/app/login';
const urlPosts = 'https://test.cliquefan.com/api/portal/fan/home?status=1&pageSize=50&pageIndex=0';
const urlFavorited = "https://test.cliquefan.com/api/... | true |
10ebc4f2dd9eea7b0e275ad89faf0021400f3c58 | JavaScript | nfssfn/FIIT | /INFO 4 - 1,2,3,4 semester/INFO 4 - 2. semester/ZTIA/ZTIA priklady/5_Widgets/2_node/node.js | UTF-8 | 949 | 3.84375 | 4 | [] | no_license | // Object Node
function Node(name) {
// Nodes to message
this.nodes = []
this.name = name
}
// Add node
Node.prototype.add = function(node) {
this.nodes.push(node)
}
// Remove node
Node.prototype.remove = function(node) {
var index = this.nodes.indexOf(node)
delete this.nodes[index]
}
// Pass message "ev... | true |
36011d238533bacd4e7ba028571d5e54e25afd81 | JavaScript | ajlopez/ClojJS | /test/seq.js | UTF-8 | 1,035 | 2.78125 | 3 | [
"MIT"
] | permissive |
const clojjs = require('..');
const lists = require('../lib/list');
const vectors = require('../lib/vector');
exports['seq nil'] = function (test) {
test.equal(cljs.core.seq(null), null);
}
exports['seq empty list'] = function (test) {
test.equal(cljs.core.seq(lists.emptyList), null);
}
exports['seq list'] ... | true |
56dd4fe5e9b18c5dee1a0103f3c5694c97d6e5cf | JavaScript | felix-orduz/vehiculos-html | /deploy/js/index.js | UTF-8 | 1,351 | 3.25 | 3 | [] | no_license | 'use strict'
const btnTransfer = document.getElementById('btnTransfer')
const btnService = document.getElementById('btnService')
const transfer = document.getElementById('transfer')
const service = document.getElementById('service')
const fTransfer = document.getElementById('formTransfer')
const fService = document.ge... | true |
3ea0dd259ef19a4f01bf684c352aa0b626643afb | JavaScript | udars623/nanhida | /src/button.js | UTF-8 | 1,465 | 2.875 | 3 | [
"MIT"
] | permissive | let BUTTON_OFFSET_X = 10;
/*
How to add button:
Usually, you don't need to change this file.
(1) Add the button in Game.makeButtons().
(2) Add consts.buttons entry.
(3) Add button trigger in AbsCon.clickButton().
(4) Implement the functionality of button in Game, UnitBase, etc.
*/
export default class Button {
... | true |
f762d6f47d0ecc4655e4755591c6a4d9a61c8cb7 | JavaScript | verlainek83/git-clone-https---verlainek-bitbucket.org-verlainek-mini-chat | /jj/index1.js | UTF-8 | 1,780 | 2.78125 | 3 | [] | no_license | function afficher_liste_pseudo()
{
var url="php/recuperer_pseudos.php";
var xhr=getXHR();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.status == 200) {
afficher_liste_pseudo_cb(xhr.responseText);
}
}
};
xhr.open("GET", url, true);
xhr.send(null);
}
function ... | true |
f39cba7bebebb48b49f4075f2985e4eb68cacd28 | JavaScript | lawlorseanr/blog-service | /server/middleware/posts/sortResponse.js | UTF-8 | 446 | 2.796875 | 3 | [] | no_license | const compareFn = {
asc: (a, b) => a < b,
desc: (a, b) => a > b,
};
const sortFn = (a, b, fn) => {
if (a === b) {
return 0;
}
if (fn(a, b)) {
return -1;
}
return 1;
};
module.exports = (req, res, next) => {
const { posts } = res.body;
const { sortBy, direction } = req.query;
const directio... | true |
2ecf07dfe942ba4af08f61489ba20c212f9c7ef1 | JavaScript | zakkreyshort/celeb-dating-game | /js/scripts.js | UTF-8 | 656 | 2.609375 | 3 | [] | no_license |
$(document).ready(function () {
$("#result-button").click(function () {
var food = $("input:radio[name=food]:checked").val();
var music = $("input:radio[name=music]:checked").val();
if (food === "Mexican" && music === "Rock" || music === "EDM") {
$("#santapic").show();
$("#buddypic").hid... | true |
c7ca4457596a8a03b89a8490522b3e46cb8c158e | JavaScript | Satya12325/closer_Debouncing_And_Throtlet | /useState.js | UTF-8 | 1,247 | 4.03125 | 4 | [] | no_license | // function
// it is a way that an inner function still references a value which is available outside it
const allStates=[]
function useState(init)
{
let state = init;
const update = (newValue)=>{
const previousValue = allStates[allStates.length-1];
if(typeof newValue === 'function... | true |
2f5466ff479a029be894d6690ec5fc307f258828 | JavaScript | Aria-bs4/Game-of-life | /view/javascripts/myjs.js | UTF-8 | 25,724 | 2.515625 | 3 | [] | no_license | window.onload = function() {
if($( document ).width() > 992){
$(".top-loader").remove();
$("body").css("overflow","auto");
}else{
$(".loader").html("we are sorry. screen of your device is too small<br>please use landscape or a bigger screen.").removeClass("loader").addClass("small-s... | true |
49f7abc10dc305a3d1458ab2662e079575547a38 | JavaScript | Impey/s-storygame | /main.js | UTF-8 | 5,230 | 2.96875 | 3 | [] | no_license |
alert("To play this game type in the opitions given click ok to start the game")
const playerName = prompt("Enter your character name:").toLowerCase();
const playerClass = prompt("Choose your Class\nWarrior\nRanger\nMage").toLowerCase();
let quest = prompt("You walk up to the local quest board in the town of Varrock. ... | true |
b5c8763faf8acbb11b2b0275b291e8334086c0bc | JavaScript | ajf412/Data-Structures | /src/linked-list.js | UTF-8 | 1,683 | 4.375 | 4 | [] | no_license | class LinkedList {
/* Do not modify the constructor */
constructor() {
this.head = null;
this.tail = null;
}
/* Add the given value to the tail
of the list. The `tail` pointer
should be updated accordingly */
addToTail(value) {
const newNode = {
value,
next: null
}
if(thi... | true |
d1a369206bc3a3fd0228348ce6b622502f70363b | JavaScript | gabrielSantosLima/sep | /src/components/Table/index.js | UTF-8 | 1,612 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react';
import { Container } from './styles';
const Table = ({ children, startIndex = 0 }) => {
const isChildrenEmpty = !children
const isNotArray = !children?.length
const [indexFrame, setIndexFrame] = useState(startIndex)
function handleFrame(index){
set... | true |
07357cdc3e7fbad1d7f39727576e960ad562d9cb | JavaScript | NelsonL19/kmpgame | /engine/view/View.js | UTF-8 | 930 | 2.921875 | 3 | [] | no_license | class View {
/**
* creates a new View object
* @param {Socket} socket instance of socket object that represents the connection made by clientView.js running client-side
*/
constructor(socket) {
this.socket = socket;
}
gameWon(winner, totalTime, score) {
this.socket.emit("... | true |
6747c24f349a1fcd0cf8fb10f77c71001ec5fa0a | JavaScript | andrerondon/Code-Core--Web-Application | /semester_1/js/higher_functions/maximum.js | UTF-8 | 505 | 4.34375 | 4 | [] | no_license | // Write a method that returns the maximum number in an array in two ways without using Math.max or Array#sort:
// Using iteration.
// Examples:
// maximum([ 213, 12, 66, 999 ]); # should return 999
// maximum([ 1, 2, 3, 11, 3, 6, 5 ]); # should return 11
function maximum (numbers){
let maxValue = [];
for(le... | true |
8c2b12a76c80ad99a9cb31e0e66e9b063875acc7 | JavaScript | Hristov98/fmi-Front-End-Web | /Homework 2/task1.js | UTF-8 | 1,891 | 3.546875 | 4 | [] | no_license | function processData(input) {
let inputLowerCase = input.toLowerCase();
let alphabetCounters = getCountOfEachLetter(inputLowerCase);
let mapOfValueOccurrences = getNumberOfDisctinctCounters(alphabetCounters);
printStringStatus(mapOfValueOccurrences);
}
function getCountOfEachLetter(inputString) {
v... | true |
69667ed7644ae73905f642446fdf685b703b15b1 | JavaScript | Mailnickko/js_algos | /challenges/linked_lists/linked_lists.spec.js | UTF-8 | 2,438 | 3.25 | 3 | [] | no_license | 'use strict';
const solution = require('./linked_lists.js');
const expect = require('chai').expect;
describe('linked lists', () => {
let expected;
let res;
let myList;
describe ('linked list data set', () => {
beforeEach(() => {
myList = new solution.LinkedList(5);
});
it ('should create a... | true |
243983538b0fc43cf4f018b47f173f12cf07aac1 | JavaScript | adobe/react-spectrum | /packages/@internationalized/date/tests/queries.test.js | UTF-8 | 17,137 | 2.5625 | 3 | [
"LicenseRef-scancode-unicode",
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | /*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... | true |
60c9e6b982a3886232d42708ae176d348d413fac | JavaScript | behnazsheikhi/Javascript | /JavaScriptTopLearn/JScripts/object.js | UTF-8 | 484 | 3.984375 | 4 | [] | no_license | var name="Behnaz";
var family="Sheikhi";
function helloClick(){
var fullName=name+" "+family;
alert(fullName);
}
function hello(){
var fullName=name+" "+family;
return fullName;
}
document.getElementById('lblResult').innerHTML=hello();
// definition of object
var person={
Name:'Behnaz',
Family:... | true |
a91a07681dbab9ae3423ed4f614b1874c75bd5c4 | JavaScript | nimi96/QrCMS | /public/javascripts/main.js | UTF-8 | 643 | 2.59375 | 3 | [] | no_license |
/*
function myFunction() {
var code = document.getElementById('code').value;
console.log(code);
}
*/
$(document).ready(function(){
$('#btn').click(function(){
var code = document.getElementById('code').value;
console.log(code);
$.post("users/data",
{
data:code
... | true |
4db18d8d9e1b4afc9c7b87d8fd9ad0e8bd3f8360 | JavaScript | AOcampo93/CIT-230 | /TempleInn/js/NextEndowment.js | UTF-8 | 551 | 3.40625 | 3 | [] | no_license | //Get table values
var MexicoTemple = [8,9,10,11];
var d = new Date();
var hour = d.getHours();
var minutes = d.getMinutes();
//Compare this table with the actual hour
if(minutes >= 1){
hour = hour + 1;
}
switch (hour) {
case 8:
hour = "8:00 AM";
break;
case 9:
hour = "9:00 AM";
break;
case 10:... | true |
0e4215c8576ef5d35c3244c4c0337e7d35d10dee | JavaScript | CJSCommonPlatform/online-plea | /src/app/components/common/regexps/national-insurance-number-regex.constant.js | UTF-8 | 620 | 3.046875 | 3 | [] | no_license | /*
^ # beginning of string
\s* # optional leading whitespace
[a-zA-Z]{2} # match two letters
(?:\s*\d\s*){6} # six digits, with optional whitespace leading/trailing
[a-zA-Z]? # zero or one letter
\s* # optional trailing whitespace (just in case)
$ ... | true |
f1604c35ae26131a8160143c83c0c8cdf6d0d6ea | JavaScript | flazewang/Serum-Discord-PriceBot | /app.js | UTF-8 | 3,143 | 2.5625 | 3 | [
"MIT"
] | permissive | // Brought you by StonksDev - https://github.com/StonksDev - https://www.stonkscoin.org/
const {Discord, Guild, Client, Channel, GuildMemberManager} = require('discord.js');
const client = new Client();
const {Account, Connection, PublicKey} = require('@solana/web3.js');
const {Market} = require('@project-serum/serum')... | true |
744477b28e8de74f46facc4b824887e1828f4b69 | JavaScript | zxyuling/z7z8 | /dialog/api.js | UTF-8 | 4,515 | 3.21875 | 3 | [] | no_license | define(function(require,exports,module)
{
var EventUtil =
{
addEvent : addEvent,
removeEvent : removeEvent,
getEvent : getEvent,
getTarget : getTarget,
preventDefault : preventDefault,
stopPropagation : s... | true |
08bbd9459838b4b77e061e0e617dcddaabbe58f7 | JavaScript | Zming-ming/linux-command | /src/markdown/sleep.md.js | UTF-8 | 729 | 2.84375 | 3 | [] | no_license | module.exports = `
将目前动作延迟一段时间
## 补充说明
**sleep命令** 暂停指定的时间。
### 语法
\`\`\`shell
sleep(参数)
\`\`\`
### 参数
时间:指定要暂停时间的长度。
时间长度,后面可接 s、m、h 或 d,其中 s 为秒,m 为 分钟,h 为小时,d 为日数。
### 实例
有时在写一些以循环方式运行的监控脚本,设置时间间隔是必不可少的,下面是一个Shell进度条的脚本演示在脚本中生成延时。
\`\`\`shell
#!/bin/bash
b=''
for ((i=0;$i<=100;i++))
do
printf "Progre... | true |
f902f5b1cb9e5f3cbf7665c6511565b28747a29d | JavaScript | therapy-records/cms | /src/utils/strings.test.js | UTF-8 | 1,230 | 2.8125 | 3 | [] | no_license | import {
containsNumber,
isAString,
isEmptyString
} from './strings';
describe('(Utils) strings', () => {
describe('containsNumber', () => {
it('should return true when a string contains a number', () => {
expect(containsNumber('test01')).to.eq(true);
});
it('should return false when a str... | true |
b2eff71566cba171437e3a9d0c2b59e481909b3e | JavaScript | TheAppMentor/trynatural | /exactMatchSearcher.js | UTF-8 | 1,347 | 2.65625 | 3 | [] | no_license | var _ = require('lodash')
var plog = require("./prash-logger.js")
var now = require('performance-now')
var TrieSearch = require('trie-search');
var inputData = require('./inputData.js')
var ts
export let buildTrie = (dataSet) => {
plog.magenta("Start Building Trie : Object count " + _.size(dataSet))
var sta... | true |
a1aa755b0466d31bdf0b7c99dceed4bed15d5327 | JavaScript | 98munozpatricia/Minimo1 | /backend/controllers/bike.js | UTF-8 | 990 | 2.6875 | 3 | [] | no_license | 'use strict'
const Bike = require('../models/bike')
const bikeCtrl = {}
bikeCtrl.postBike = async(req, res)=> {
console.log(req.body)
let bike = new Bike()
bike.name = req.body.name
bike.kms = req.body.kms
bike.description = req.body.description
bike.status= req.body.status
console.log(bik... | true |
9cedf4b1ca72ef4e571b16d3743fe0193d040873 | JavaScript | markbirbeck/beamish | /test/tap/node-streams/io/Request/raw.js | UTF-8 | 1,560 | 2.6875 | 3 | [
"MIT"
] | permissive | /**
* Implement requests as a transform, using only Node streams:
*/
const tap = require('tap')
/**
* For input, output and transform streams:
*/
const fetch = require('node-fetch')
const fs = require('fs')
const path = require('path')
/**
* Pipeline runner:
*/
const stream = require('stream')
const util = r... | true |
42fc45d117013ba6f68b314b8bb27e7a6f2ee0cd | JavaScript | astevens926/WordGuess-Cli | /word.js | UTF-8 | 1,293 | 3.5625 | 4 | [] | no_license | var Letter = require("./letter.js");
function Word(word){
this.word = word;
this.makeArray = function(word){
letters = word.split("");
newArray = letters.map(function(letter){
return new Letter(letter);
});
return newArray;
}
this.lettersArray = this.makeArra... | true |
66045d6d86000929c59afb19c4f8b5ce1ff39a8d | JavaScript | 4nth0ny1/learn-react-1 | /src/App.js | UTF-8 | 1,961 | 2.609375 | 3 | [] | no_license | import logo from './logo.svg';
import './App.css';
import React from 'react';
import HomeContainer from './components/HomeContainer';
import Search from './components/Search';
import { useState } from 'react';
import HomeForm from './components/HomeForm';
function App() {
const [ homes, setHomes ] = useState([
... | true |
f21a694a93e7e83ea8b9c18b0e20ef8c8e23c7f7 | JavaScript | beware-of-leopard/letsGetFunctional | /arrays.js | UTF-8 | 2,534 | 4.375 | 4 | [] | no_license | // ---------------------------
// The Arrays You Will Work With
// ---------------------------
var numbers = [1,12,4,18,9,7,11,3,101,5,6];
var strings = ['this','is','a','collection','of','words'];
var instructors = [
{ firstname : 'JD', teaches : 'JavaScript'},
{ firstname : 'Tim', teaches : 'JavaScript'},
... | true |
5b0f119255bedac7af729436b276568fc0561821 | JavaScript | PandaCodes/jsFuncWorkshop | /step7.js | UTF-8 | 214 | 2.71875 | 3 | [] | no_license | function reduce(arr, fn, initial) {
return (function helper(index) {
if (index < 0) return initial;
return fn(helper(index - 1), arr[index], index, arr);
}(arr.length - 1));
}
module.exports = reduce;
| true |
02c97e013c03df45cb752b4d5d4061e5fab983b2 | JavaScript | biaaib/biaaib.github.io | /myweb/js/game.js | UTF-8 | 7,805 | 2.953125 | 3 | [
"MIT"
] | permissive | var timer;
var color;
var nextcolor;
var activeBlock = new Array(4);
var nextBlock = new Array(4);
var grid = new Array(16);
for (var i = 0; i < 16; i++) {
grid[i] = new Array(10);
}
for (var i = 0; i < 16; i++) {
for (var j = 0; j < 10; j++) {
grid[i][j] = 0;
}
}
function generateColor() {
var tcolor;
var tc =... | true |
736a7f727c0b80448dd69c44e284546d359d1e79 | JavaScript | sarah-svg/30-containorWithHooks | /src/services/fetchApi.js | UTF-8 | 594 | 2.90625 | 3 | [] | no_license | export const getCharacters = () => {
return fetch('https://rickandmortyapi.com/api/character')
.then((res) => res.json())
.then(json => json.results);
};
export const getOneCharacter = (character) => {
return fetch(`https://rickandmortyapi.com/api/character/${character}`)
.then((res) => res.json());
}... | true |
cec0cc46325cceb1efe606f77089a95a6cc78a9e | JavaScript | zhiyelee/leetcode | /js/mergeSortedArray/merge_sorted_array.js | UTF-8 | 1,462 | 3.6875 | 4 | [
"MIT"
] | permissive | /**
* @param {number[]} nums1
* @param {number} m
* @param {number[]} nums2
* @param {number} n
* @return {void} Do not return anything, modify nums1 in-place instead.
*/
// var merge = function(nums1, m, nums2, n) {
// // only keep m items
// nums1.splice(m, nums1.length - m);
//
// var low = 0;
// ... | true |
0f4545d3b972442667c8a7136689ca00b37d50b4 | JavaScript | Peter-eid/soajs.dashboard | /utils/utils.js | UTF-8 | 3,829 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
var async = require('async');
var tenantsColName = 'tenants';
module.exports = {
/**
* Check if error is available and return it in response, else return callback function
*
* @param {Object} soajs
* @param {Callback Function} mainCb
* @param {Object} data
* @param {Callback Function} cb
... | true |
6f1f100e87485afe0b2e3af081ec14edecbc1bf1 | JavaScript | gregjacobs/Data.js | /src/persistence/operation/Deferred.js | UTF-8 | 10,019 | 2.859375 | 3 | [] | no_license | /*global define */
define( [
'jquery',
'lodash',
'Class'
], function( jQuery, _, Class ) {
/**
* @private
* @class data.persistence.operation.Deferred
*
* Used internally by the {@link data.persistence.operation.Operation} object, OperationDeferred is an "extension" (of sorts)
* of the jQuery Deferred... | true |
3761cb2df2b5df90956e511427aa2e74a3aa3975 | JavaScript | sri-dosapati/student-management-system | /AngularApp/app/student/studentsController.js | UTF-8 | 2,592 | 2.515625 | 3 | [] | no_license |
(function () {
'use strict';
var controllerId = 'studentsController';
angular
.module('Demo')
.controller(controllerId, ['studentService', 'notificationService', '$location', studentsController]);
function studentsController(studentService, notificationService, location) {
... | true |
c826c3a8d3c94084a0d8246e146df5506adf0442 | JavaScript | ericabasak/fewpjs-event-listening-nyc-web-100719 | /index.js | UTF-8 | 319 | 3.640625 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
//create a variable called input which finds the element by id=input
const input = document.getElementById("input");
function addingEventListener() {
//listen for the click and the second argument is a callback function
input.addEventListener("click", function(e) {
alert("I was clicked");
});
}
| true |
3048e1b6daffd8c75f83e930dd0057b2b526bc29 | JavaScript | jomicm/tweeter | /public/scripts/composer-char-counter.js | UTF-8 | 624 | 2.640625 | 3 | [] | no_license | /*eslint-env jquery*/
// eslint-disable-next-line no-undef
$(document).ready(function() {
const input = $('.input-tweet');
//const counter = input.parents().find('.counter');
input.on('input', e => {
const counter = $(e.target).parents().find('.counter');
const msgLength = e.target.value.length;
const... | true |
a88de8f0cf637a6b747e91661eecb46cbc27761a | JavaScript | jrschmidt/familia | /src/view-model-methods/get-pair-shape.js | UTF-8 | 342 | 2.671875 | 3 | [] | no_license | // Function to return the "shape" ('singleton', 'normal',
// 'compressed') of a pair component based on its generation
// in the tree view.
export const getPairShape = (location) => {
if ( location === 'gen0root' ) {
return 'singleton'
} else if ( location[3] === '4' ) {
return 'compressed'
} else {
... | true |
858f9a3f80176f56ea1c0eca1cb9f0ae0892ab13 | JavaScript | fracture46/WEBGL_DAWIN | /Projet/projet.js | UTF-8 | 16,304 | 2.90625 | 3 | [
"MIT"
] | permissive | function loadText(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
xhr.overrideMimeType("text/plain");
xhr.send(null);
if(xhr.status === 200)
return xhr.responseText;
else {
return null;
}
}
// variables globales du programme;
var canvas;
var gl; //context... | true |
889ddf27f54e4d2e40415e7643e3d5789d8d83ef | JavaScript | elbehary01/checkout-form | /src/js/Fetch.jsx | UTF-8 | 1,362 | 2.9375 | 3 | [] | no_license | import React from 'react';
export default class Fetch extends React.Component {
constructor(props){
super(props)
this.state = {
data: {
author: '',
filename: ''
}
}
}
callPicture(e) {
e.preventDefault()
// var divs = document.querySelectorAll('#products > d... | true |
1831fec5ae98f330fe37c003c871da5a427ac2dd | JavaScript | josebroldant/web_app_container | /application/src/local_server.js | UTF-8 | 2,110 | 2.53125 | 3 | [] | no_license | //Import libraries
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const mongo = require('mongoose');
//Connection to MongoDB local server on PC
let db = mongo.connect("mongodb://localhost:27017/web_app_container", function(err, response){
if(err){consol... | true |
382088956c1c9f55a3c263bfa95c1246984729a6 | JavaScript | amg28/js-demo-react-app | /src/components/characters/CharacterCard.js | UTF-8 | 1,041 | 2.609375 | 3 | [
"MIT"
] | permissive | import React from 'react'
import './Card.css';
const CharacterCard = ({data}) => {
const {name,image,gender, location, origin, species, status, episode} = data;
console.log(name);
return (
<div className="card-container">
<div className="card">
<div className="card-fro... | true |
49bf01f0b1b7f61e2bfcd8373291ff1ea6b15d92 | JavaScript | teenkwn/heroku_betnrun | /server.js | UTF-8 | 824 | 2.53125 | 3 | [] | no_license | const express= require("express");
const bodyParser = require("body-parser");
const app = express();
const mongoose = require("mongoose");
const PORT = process.env.PORT || 8080
mongoose.connect("mongodb://localhost:27017/userDB",{useNewUrlParser:true});
app.use(bodyParser.urlencoded({
extended:true
}));
const use... | true |
eff59cfcf7650913e037240e1f3cb3433103bdee | JavaScript | rizap-usa/web-tools-ca | /assets/js/multi-langs.js | UTF-8 | 641 | 2.671875 | 3 | [] | no_license |
if (localStorage.getItem("lang")!=null) setLang(localStorage.getItem("lang"));
function setLang(lang){
//console.log(lang);
localStorage.setItem("lang", lang);
switch (lang) {
case 'en':
$("#langSelection").text("English");
break;
case 'jp':
$("#langSelection").text("日本語");
bre... | true |
3afc38b7ec7eb3f449a5ecbacf2b4ce08aef32f3 | JavaScript | ptrchoi/App-Weather-React | /src/Components/ForecastDay.jsx | UTF-8 | 3,461 | 2.96875 | 3 | [] | no_license | // LIBRARIES
import React from 'react';
import { v4 as uuidv4 } from 'uuid';
// UTILITY FUNCTIONS
import { formatTemp, getRainIconFillHeight } from './../Utils';
// COMPONENTS
import C from '../constants';
// LOCAL CONSTS
const DAYS_OF_THE_WEEK = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
const FORECAST_DAYS... | true |
21785e9aaa3def631b24d97931b01abf98926d03 | JavaScript | matowens/platform | /src/Oro/Bundle/LocaleBundle/Resources/public/js/extend/moment-timezone.js | UTF-8 | 808 | 2.921875 | 3 | [
"MIT"
] | permissive | define(function(require) {
'use strict';
var moment = require('moment-timezone');
var origTz = moment.fn.tz;
/**
* Getter/Setter for moment's timezone
*
* @param {string} name of timezone
* @param {boolean=} keepTime flag if datetime have to be preserved as it is on timezone change... | true |
d50a6cbd63fb6b8fcb60323806b472510b56bdca | JavaScript | Atulya1905/Air-Ambulance-Service | /Homepage.js | UTF-8 | 361 | 2.609375 | 3 | [] | no_license | // Once the user enters all of his credentials , he will be re-directed to this homepage
// Here the user will be preseted with 2 options: Call Ambulance or Consult A doctor
// If the user chooses Call Ambulance, he will be re-directed to the ambulance booking portal
// If the user chooses Consult A doctor, he will... | true |
30fa48d3733a33845ac1a684bdae1b53e4333e3f | JavaScript | humble-ahitofel/kirjastohakemisto | /public/js/init.deobfuscate-email.js | UTF-8 | 1,194 | 3.265625 | 3 | [
"MIT"
] | permissive | /**
* Deobfuscate email addresses protected against spam.
* Email addresses must be printed on the page in ROT13-encoded format.
* Character '@' can be replaced with '#'.
*/
$(() => {
/*
* Source: https://gist.github.com/dsoares/c65f1bacac0acd46fd9f
*
* NOTE: Only handles lower-cased strings.
*/
fu... | true |
05896e9682a97afb2f900983090511642c9a53a7 | JavaScript | batuhangurkan/covid19 | /index.js | UTF-8 | 4,682 | 3.328125 | 3 | [
"MIT"
] | permissive | window.onload = function(){
getCovidStats();
}
//add commas to numbers and return as string
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function getCovidStats(){
fetch('https://corona.lmao.ninja/v2/all')
.then(function(resp){
if (!resp.ok) throw new Error(`S... | true |
50f0418e32020225d723f9b60fb46047caed2ca4 | JavaScript | gortron/portfolio | /gatsby-node.js | UTF-8 | 5,001 | 2.515625 | 3 | [
"MIT"
] | permissive | const { get, uniq, kebabCase } = require("lodash")
const { createFilePath } = require(`gatsby-source-filesystem`)
exports.createPages = async ({ actions, graphql, reporter }) => {
const postsResult = await graphql(`
{
allFile(filter: { sourceInstanceName: { eq: "posts" } }) {
nodes {
chil... | true |
549a2f3bcbf2ca8552280b8bc08ea97e51fe56f3 | JavaScript | JuanDavidAlvarezGil/test_valid | /src/controllers/searchController/SearchController.js | UTF-8 | 1,771 | 2.59375 | 3 | [] | no_license | import React, { useState } from 'react';
import ServiceInteractor from '../../model/services/ServiceInteractor'
import Loading from '../../views/default/loading/Loading';
import SearchView from '../../views/searchView/SearchView'
export default function SearchController({ navigation }) {
const [artists, setArtis... | true |
a55f14f39d4a312bf5876753a6364ffed492b683 | JavaScript | tonyflow90/gvt_ea02 | /src/main.js | UTF-8 | 2,041 | 3 | 3 | [] | no_license | let canvas, gl;
let aVertices = [];
document.body.onload = _ => {
canvas = document.querySelector('#canvas');
gl = canvas.getContext('webgl');
// Pipeline setup
gl.clearColor(.25, .35, .45, 1);
let verticies = createVertices(16);
draw(gl.LINE_LOOP, 0, 48, verticies);
};
let createVertices =... | true |
f0281a47acb6e984a22839f558aa885512e7b3c9 | JavaScript | eurusiam/gulp-vue-simple | /design/assets/js/windowSize.js | UTF-8 | 1,409 | 2.53125 | 3 | [] | no_license | var width_size = 768;
$(function () {
updateContainer();
$(window).resize(function () {
updateContainer();
});
});
function updateContainer() {
var $containerHeight = $(window).width();
if ($containerHeight <= width_size) {
var clock = new FlipClock($('.your-clock'), 180, {
... | true |
66060629a30289a77e54473d8635be7b5d639f7f | JavaScript | IkusasaTech/website2019 | /js/hosting.js | UTF-8 | 1,936 | 3.015625 | 3 | [
"MIT"
] | permissive | /*
============================================
Branding & Design Quote
============================================
*/
var optionwebsiteB = false;
var optionapplicationB = false;
var optiondomainB = false;
var optionemailB = false;
var optionsslB = false;
var priceTypeB = 0;
var totalPriceB = 0;
var finalPriceB = 0;
a... | true |
212d15e74366de4b2408c964a5148093c9d59e40 | JavaScript | daisty/common-demo | /ts-study/step3/Generics/generics3.js | UTF-8 | 202 | 2.609375 | 3 | [] | no_license | // 定义泛型的时候,可以一次定义多个类型参数
// 定义了一个swap函数,用来交还输入的元祖
function swap(tuple) {
return [tuple[1], tuple[0]];
}
swap(['hello', 12]);
| true |
b751da80c64467cd5927d6c82277417aefd2b330 | JavaScript | satls/PacMan | /PacMan.js | UTF-8 | 1,623 | 3.015625 | 3 | [] | no_license | function PacMan(startX, startY, b){
var board = b;
var posX = startX;
var posY = startY;
var vX = 0;
var vY = 0;
var nextVX = 0;
var nextVY = 0;
this.resetV = function(){
vX=0;
vY=0;
}
this.getX=function(){
return posX;
}
this.getY=function(){
return posY;
}
this.getVX=function(){
return vX;
}... | true |
09c42d0665c3fd33ffc2b18bd15d7a952d055871 | JavaScript | DanielAlfonso17/ARSWLAB6 | /src/main/resources/static/js/RenderizandoElementos.jsx | UTF-8 | 220 | 2.578125 | 3 | [] | no_license | function tick() {
const element = (
<div>
<h1>Reloj:</h1>
<h2>Son las: {new Date().toLocaleTimeString()}.</h2>
</div>
);
ReactDOM.render(element, document.getElementById('reloj'));
}
setInterval(tick, 1000); | true |
bb088891314b7fe8bef94f4d81c9fe19451f2d7d | JavaScript | rafal-szymanko/javascript-prework | /js/functions.js | UTF-8 | 2,184 | 3.53125 | 4 | [] | no_license | function printMessage(msg){
const div = document.createElement('div'),
createMessages = document.getElementById('messages');
div.innerHTML = msg;
if (msg == `Wygrałeś!!!`) {
createMessages.appendChild(div).style.color = 'green';
} else if (msg == `Przegrałeś :((`) {
createMessages.appendChild(div).style.col... | true |
245edb93c21080e2b0931c866a684eb61d4284df | JavaScript | Davidimproject/hackathon8_new | /JS/app.js | UTF-8 | 956 | 2.640625 | 3 | [] | no_license | $(document).ready(function() {
$(window) .resize(function(){
$('body, html') .css ('overflow', 'hidden');
var screenWidth = $(window).width();
$('body, html') .css ('overflow', 'visible');
if (screenWidth >= 769) {
$('#menu').css ({'display':'block'});
} else {
... | true |
1d4999abeda744d174d17fda53ecfd7bbff5c733 | JavaScript | adishare/h8-p0-w5 | /live-code-week-5/003.js | UTF-8 | 1,276 | 3.78125 | 4 | [] | no_license |
/*
Tranpose the Matrix
================
Author: Muhammad Ramadiansyah
Description: matrixTranspose adalah sebuah fungsi untuk menukar posisi baris dan kolom
dari sebuah matriks
Examples:
1. input = [
[1, 2],
[3, 4],
[5, 6]
]
output = [
[1, 3, 5],
[2, 4, 6]
]
2. input = [
[1, 2]
]
... | true |
171b0f8de2fe89713dfbe0e6c628192bda3e8726 | JavaScript | turbanpride/For-Orion | /src/Results/Result.js | UTF-8 | 4,728 | 2.53125 | 3 | [] | no_license | import React,{Component} from 'react';
import './Result.css';
import {Row,Col} from 'react-bootstrap';
import NoImage from './../Images/noImage.png'
class Result extends Component
{
render()
{
var self = this;
var searchedValLen = this.props.searchedVal.length;
var i=0,count=0,data... | true |
b3526b66712864e14bb7e3f7ac0e4c95414a4d47 | JavaScript | SantiagoYpes/Contenedor | /controllers/contenedor.controlles.js | UTF-8 | 1,585 | 3.390625 | 3 | [] | no_license | const contenedores = (req, res) => {
function llenarcontenedor(pesoMaximo = 0, pesos = [], valores = []) {
let n = pesos.length;
let numIter = 0
numIter += 1 + 3 * n + n * Math.log2(n);
let fracciones = valores.map(v => 0);
let precios = valores.map((v, i) => [i, v / pesos[i]... | true |
32e5cb02b1259295647bfc5b5443e0d65e0c481b | JavaScript | katherinegotovsky/product-initiative | /functions.js | UTF-8 | 1,438 | 2.75 | 3 | [] | no_license | //make the diamonds move
$(document).ready(function(){
$('.timeline-event').each(function(e) {
$(this).hover( function() {
$('#' + this.id + ' .timeline-event-icon').css('transform', 'rotate(45deg)');
$('#' + this.id + ' .timeline-event-icon').css('background-color', '#76C962');
}, function () {
... | true |
11a4d86ba5d719c28658df4e03e1723217efb585 | JavaScript | madping/javascript | /zerocho/lesson2/test8_promise_2.js | UTF-8 | 2,744 | 3.984375 | 4 | [] | no_license | //calback --> promise
/*
function findAndSaveUser(Users){
Users.findOne({},(err,user)=>{
if(err){
return console.log(err);
}
user.name='zero';
user.save((err)=>{
if(err){
return console.log(err);
}
Users.findOne({gender:... | true |
1b5a28db7387906aa31a6229248b2e5ec768ea57 | JavaScript | EathonYe/jsvm | /src/index.js | UTF-8 | 977 | 2.640625 | 3 | [] | no_license | const { parse } = require("@swc/core");
const { Scope, ScopeType } = require("./scope");
const { ESMap } = require("./es");
const { Path } = require("./path");
function evaluate(path) {
if (!path.node.type) {
return evaluate(path.createChild(path.node.expression));
}
return ESMap[path.node.type](path);
}
as... | true |
a90d68978d34d5d3aac418a203e7b9b97019bc6b | JavaScript | Chava-feldman/dotos | /node/app/controllers/user.controller.js | UTF-8 | 1,124 | 2.984375 | 3 | [] | no_license | const User= require('../models/user.model.js');
// Create and Save a new Book
exports.create = (req, res) => {
// Validate request because in model we required the title
if(!req.body.name||!req.body.mail) {
return res.status(400).send({
message: "Please enter name and mail."
});
... | true |
8416deae0ccd0ecddf935e8da2014c692c98fc31 | JavaScript | MeGaDeTH91/SoftUni | /JsCore/02.JsAdv/14.JsClasses/Ex/07.InstanceValidation.js | UTF-8 | 1,738 | 3.296875 | 3 | [] | no_license | class CheckingAccount{
constructor(clientId, email, firstName, lastName){
this.clientId = clientId;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
}
get clientId(){
return this._clientId;
}
set clientId(val){
let numPattern =... | true |
fa84ec3bb48eadc7e1cbd236570a3f813754d8a2 | JavaScript | guskoro/Angular-Firend-App | /friend-app-server/server/api/friend/friend.controller.js | UTF-8 | 732 | 2.765625 | 3 | [] | no_license | var friendList = [
{ name: 'Mary Lim', email: 'mary@yahoo.com', contact: '69054637' },
{ name: 'Peter Ho', email: 'pete@gmail.com', contact: '54629874' },
{ name: 'June Lee', email: 'jl@yahoo.com.sg', contact: '12457898' }
];
exports.list = function(req, resp) {
resp.status(200);
resp.type('application/json'... | true |
981ede02d291a3a3eab5b30bb31153b54cdf771b | JavaScript | ed-sivick/19-employee_directory | /src/components/dataAvenger.js | UTF-8 | 3,586 | 2.84375 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
export default class DataArea extends Component {
state = {
employees: [],
allEmployees: [],
isLoading: true,
};
headings = ["name..."];
componentDidMount() {
fetch("/avengers.json")
.then(function (response) {
return response.json();
... | true |
f70976007adc013066331179dbddcfd45c6af8d5 | JavaScript | trunov/mern-blog | /frontend/src/utils/api.js | UTF-8 | 3,261 | 2.65625 | 3 | [] | no_license | /* eslint-disable import/prefer-default-export */
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable no-underscore-dangle */
const handleOriginalResponse = (res) => {
if (!res.ok) {
return Promise.reject(`Ошибка: ${res.status}`);
}
return res.json();
};
class Api {
constructor(options) {
... | true |
9ffad71e748e70903148e352f5e2adfc459cfbdc | JavaScript | charliephung/javascript | /functional/8-trampoline.js | UTF-8 | 360 | 3.453125 | 3 | [] | no_license | const trampoline = fn => {
return (...args) => {
let res = fn(...args);
while (typeof res == "function") {
res = res();
}
return res;
};
};
const sumTrampolined = trampoline(function f(sum, num, ...nums) {
sum += num;
if (nums.length == 0) return sum;
return () => f(sum, ...nums);
});... | true |
ff95ef5ec69f35ac8889cfa01fe3769514544a9d | JavaScript | ashcaseydevI/udacity-react-state-management-ex-managing-state | /src/Challenge.js | UTF-8 | 381 | 2.78125 | 3 | [] | no_license | import React from 'react';
const Challenge = (props) => {
return (
<div>
<h2>Mental Math</h2>
<div className="equation">
<p className="text">{`${props.value1} + ${props.value2} + ${props.value3} = ${props.proposedAnswer}`}</p>
</div>
<button>True</button>
<butt... | true |
ef2fb10ade3f6cb238b7a648d7dbdc9f1054f929 | JavaScript | enspirit/finitio.js | /specs/unit/attribute/fetch_on_spec.js | UTF-8 | 1,114 | 2.5625 | 3 | [
"MIT"
] | permissive | import Attribute from '../../../src/finitio/support/attribute';
import should from 'should';
import { intType } from '../../spec_helpers';
describe('Attribute#fetchOn', () => {
const attr = new Attribute('red', intType);
const subject = (arg, cb) => attr.fetchOn(arg, cb);
it('with an object that does not supp... | true |
e0bdbebd86f9830701775c2c4fe8594972e3066d | JavaScript | KimrLong/Nov2020Cohort | /week08/2-Tuesday/labs/sample.js | UTF-8 | 535 | 2.625 | 3 | [] | no_license |
// let lastName = require('./sample2');
let Stack = require('./stack');
const superheroes = require('superheroes');
console.log(superheroes.all);
let Stack1 = new Stack();
Stack1.push(3);
Stack1.push(30);
Stack1.push(33);
Stack1.push(31);
console.log(stack1.peek());
let Stack2 = new Stack();
Stack2.push(6)
Stac... | true |
1004439b35a7b261ddafcde4816dc8ccd23aef2c | JavaScript | euberdeveloper/unitn-statistica | /exercises/2019-03-27.js | UTF-8 | 1,920 | 3.34375 | 3 | [] | no_license | class FunzioneProb {
_f(x) {
if(x < 0) {
return 0;
}
else {
return 1 - Math.exp(-this.lambda * x);
}
}
_interval(x, y) {
return this._f(y) - this._f(x);
}
_solve(intervals) {
let res = 0;
for(let i = 0; i < intervals.... | true |
822c6b4a39a93c5ad8604c22f8a726842e7a4aa1 | JavaScript | arfordweb/react-global-hoc | /src/utils/getReactElementText.js | UTF-8 | 1,017 | 3.4375 | 3 | [
"MIT"
] | permissive | /**
* @description
* Given a React element (instance of a component), returns the text contained within.
*
* @param {string|react.element} element The element we'd like to extract text from. If
* the element is a string already, simple returns the
* ... | true |
5082a602512934360374c0a8f56ea53da0584e4d | JavaScript | atmelino/MPPT | /version3_0/raspberryPi/develop/writeFile/RTC.js | UTF-8 | 5,235 | 3.28125 | 3 | [
"MIT"
] | permissive | /**
* RTC Class
*/
// Define registers values from datasheet
const SECONDS = 0x00;
const MINUTES = 0x01;
const HOURS = 0x02;
const DAYOFWEEK = 0x03;
const DAY = 0x04;
const MONTH = 0x05;
const YEAR = 0x06;
const CONTROL = 0x07;
// variables
var rtcAddress = 0x68; // I2C address
// initial configuration - square wa... | true |
19cfad5ac68fedbcfe9cb4cbe21949406645c659 | JavaScript | Jhailing/Ejercicios-DOM | /dom.js | UTF-8 | 6,104 | 3.5625 | 4 | [] | no_license | /*Ejercicio 1: Saludo
const nombre = prompt ('Ingrese nombre');
const titulo = document.querySelector('h1');
titulo.innerText = (`Hola soy ${nombre}, bienvenido`);
titulo.style.textAlign = 'center';
titulo.style.fontSize = '25px';
titulo.style.fontFamily = 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida ... | true |
a85a7ee88e2c805862c1d2904b4a83a9728fdfc8 | JavaScript | KStomberg/tarjan-state-objects | /src/App.js | UTF-8 | 639 | 2.96875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class App extends Component {
//Define our initial state
state= {
cohortName: 'Tarjan',
salutation: 'Hello!',
name: 'Kieran',
whereILive: 'Minneapolis',
pizzaTopping: 'Sausage',
}
render() {
return (
<div>
<h1>{... | true |
cec15248b89493d5ff2a56530d5c2604bc2eefd7 | JavaScript | pathange-s/Flyeer | /script.js | UTF-8 | 5,107 | 3.1875 | 3 | [] | no_license | var block = document.getElementById("block");
var hole = document.getElementById("hole");
var polo = document.getElementById("polo");
var character = document.getElementById("character");
var jumping = 0;
var counter = 1;
var holetop = 0;
var holebottom = 0;
var ctop = 0;
var cbottom = 0;
var pholetop = 228;
var pho... | true |
bb4056dc1b6d378b2d2d82401aaa052a56b117d4 | JavaScript | LiliyaStefanova/js_exercises | /objects/arrays_sum.js | UTF-8 | 171 | 2.984375 | 3 | [] | no_license | const arrays = [[1,4], [11], [3, 5, 7]];
const sum = arrays.reduce((sum, subArray) => sum + subArray.reduce((subSum, number) => subSum + number, 0),0);
console.log(sum); | true |
2cdff35f7b656dae613813b1be3f5dc5e6076c28 | JavaScript | raghav2906/Restaurant-Website-Static | /src/js/about.js | UTF-8 | 1,262 | 2.640625 | 3 | [] | no_license |
function zero()
{
document.getElementById("c1").style.display="none";
document.getElementById("c2").style.display="none";
document.getElementById("c3").style.display="none";
document.getElementById("c4").style.display="none";
}
function first()
{
document.getElementById("c1").style.display="inline-... | true |
a347b6424be70fab37334ea6747381634537a80b | JavaScript | jjvaz25/ga-projects | /unit1/unit1-HamishL/slackerbot.js | UTF-8 | 12,514 | 3.59375 | 4 | [] | no_license | 'use strict'
module.exports = (robot) => {
//ONE - CALL AND RESPONSES
// First basic call and response, used for testing if bot is on
robot.respond(/do you even work?/i, (res) => {
res.send(`I *ACTUALLY* never work sorry`)
})
// Second call and response. Do you like X statements.
robot.respond(/do you... | true |
e7d79313d5d2541366872a82cc3aaebd5dde379f | JavaScript | YigaoFan/RPC | /src/TreeCodeGen/main.js | UTF-8 | 3,653 | 2.90625 | 3 | [] | no_license | const text = document.querySelector('#id-log')
const printCode = function(s) {
text.value += s
text.value += '\n'
}
const printTreeCode = function(root) {
var leafIdx = 0
var middleIdx = 0
root.traverse(function (data, subNodeNames) {
var name = null
if (subNodeNames.length == 0) {
... | true |
98fe015865bacab87756af169c8009ff3d8d6862 | JavaScript | eunapark/Data-button | /js/main.js | UTF-8 | 1,109 | 2.8125 | 3 | [
"MIT"
] | permissive | (function(){
d3.csv('data/DOITT_SUBWAY_ENTRANCE_01_13SEPT2010.csv', function(error, subwayData){
if(error){
console.log(error);
}
subwayData.forEach(function(subwayStation){
var delimiter = '(';
var subway_station_name_parts = subwayStation.name.split(delimiter);
var subway_direction = subway_stati... | true |
1570c8f9b496e06164b0e47cef2c219db9101a71 | JavaScript | zenz34/love-programming | /leetcode/DS/quick-union.js | UTF-8 | 746 | 3.34375 | 3 | [
"MIT"
] | permissive | class QuickUnionDS {
constructor(n) {
this.id = [];
for (let i = 0; i < n; i++) {
this.id[i] = i;
}
}
find(p) {
while (p !== this.id[p]) {
p = this.id[p];
}
return p;
}
isConnected(p, q) {
return this.find(p) === this.... | true |
9f7469fc29099c4873d4195cc8e79d34c7ea51bf | JavaScript | mattcosta7/deeperLearning | /public/javascripts/chat.js | UTF-8 | 3,198 | 2.84375 | 3 | [] | no_license | //https://www.twilio.com/blog/2016/02/add-chat-to-a-rails-app-with-twilio-ip-messaging.html?utm_source=rubyweekly&utm_medium=email
//CHAT FUNCTION DUDE!
//function that appends a new message to the window
function printMessage(author,message) {
$('#messages').append("<span class='newMessage'><a class='chat-user' href... | true |
d3c8b51b700e09fe123289f262c06b4b1e838931 | JavaScript | puppycodes/Gladys | /test/unit/api/validator/sentenceValidator.js | UTF-8 | 522 | 2.6875 | 3 | [
"MIT"
] | permissive | module.exports = validate;
function validate(sentence) {
if (sentence instanceof Array) {
sentence.forEach(validateSentence);
} else {
validateSentence(sentence);
}
}
function validateSentence(sentence) {
sentence.should.be.instanceOf(Object);
sentence.should.have.property('uuid');
sentence.shou... | true |
3c987160207db172d1ff6a9b90694453a6078c53 | JavaScript | pipiscrew/code_snippets | /VBdotNET/File Operations/Dialogs/ColorDialog.js | UTF-8 | 515 | 2.59375 | 3 | [] | no_license | Public Function ShowColorDialog() As System.Drawing.Color
Dim cDLG As New ColorDialog
Try
Dim result As DialogResult = cDLG.ShowDialog()
If (result = DialogResult.OK) Then
Return cDLG.Color
Else
Return Nothing
End If
... | true |
89abd03b8c747b9e06619dc3dfd50000b3452c21 | JavaScript | bouwe77/my-spaceship-21feb2020 | /src/server/useServer.js | UTF-8 | 2,037 | 2.671875 | 3 | [] | no_license | import { useState, useEffect, useRef, useCallback } from "react";
import io from "socket.io-client";
import { getSpaceship } from "./api";
const useServer = spaceshipId => {
const [currentPosition, setCurrentPosition] = useState({});
//const [messages, setMessages] = useState([]);
const socketRef = useRef();
... | true |
68d56a38ad03337e613f1bd5c70abe9fc023b407 | JavaScript | AdamWGrise/node-hangman | /index.js | UTF-8 | 5,383 | 3.4375 | 3 | [] | no_license | // Requiring the word file and Inquirer
var Word = require('./word.js');
var inquirer = require('inquirer');
// Options for a word.
var wordBank = ['TABLE SAW', 'POWER DRILL', 'JIG SAW', 'BAND SAW', 'HAMMER', 'TAPE MEASURE', 'CHISEL', 'SCREWDRIVER', 'CALIPER', 'CLAMP', 'SAW HORSE', 'WORK BENCH', 'GRINDER', 'PALM SANDE... | true |