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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e6fe10b5c7e7878dfc68d417f01288f152669d1f | JavaScript | negset/NoMeiryo | /script.js | UTF-8 | 1,073 | 2.515625 | 3 | [
"MIT"
] | permissive | const getFontName = () => new Promise(resolve => {
chrome.storage.sync.get(['fontName'], options => {
if (options.fontName != null) {
resolve(options.fontName);
} else {
import(chrome.extension.getURL('default_options.js'))
.then(module => {
chrome.storage.sync.set(module.default... | true |
28f2feca269543bb5e513ff0db71e31318db00d3 | JavaScript | shijiebei2014/react-f7 | /src/utils/functor.js | UTF-8 | 2,530 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | import {curry, compose} from 'ramda';
export const Container = function(x) {
this.__value = x;
}
Container.of = function(x) {
return new Container(x);
}
Container.prototype.map = function(f) {
return Container.of(f(this.__value));
}
Container.prototype.ap = function(c) {
return c.map(this.__value)
}... | true |
6f4c31f3874e48a55fb899fb8aaea35b802f0325 | JavaScript | Jstuddard/pilot-briefer | /http.js | UTF-8 | 1,693 | 3.15625 | 3 | [] | no_license | 'use strict';
const https = require("https");
const http = require("http");
const numberToWords = require('number-to-words');
// Set custom headers for CheckWX API
// const options = { headers: { 'X-API-KEY': '5a47bbf03f1bbf3bf7e05ef949' }};
var icao = 'KPBI'
var url = 'https://api.checkwx.com/metar/' + icao + ... | true |
4ca9c96376cc8190f4831b198f1d24d8c42637f1 | JavaScript | Dede2309/F4.1 | /F4.1/bai4/bai4.js | UTF-8 | 120 | 3.34375 | 3 | [] | no_license | let radius = prompt("Enter the radius of the circle");
let area = radius*3.14;
console.log('The circle area is '+area);
| true |
3602cc3a1fe7eb8845bb173851d256f622dea7b9 | JavaScript | irisfoox/React-custom-hook-with-fetch-api | /Ex.js | UTF-8 | 1,156 | 2.90625 | 3 | [] | no_license | import React, {useState} from 'react';
//heirorder component receives as prop the whole comp and returns a whole comp with change
//קומפ מסוג פונק שמקבלת פונק שמקבלת קלאס בתור פרופ
/*fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))*/
a... | true |
e129c192f3d2202c72735e67f6332edb15aa9c72 | JavaScript | prabhjotsingh10/ECommerce | /js/index.js | UTF-8 | 5,319 | 3.140625 | 3 | [] | no_license | /********VARIABLE DECLARATION *************/
let quantity;
let incBtn = document.getElementById("incrmnt");
let dcrBtn = document.getElementById("dcrmnt");
let incBtnFrShrts = document.getElementById("incrmntFrShrts");
let dcrBtnFrShrts = document.getElementById("dcrmntFrShrts");
let calcBtn = document.getElementById(... | true |
de14751a7da0fae12e4cce9b7b96471df899e07f | JavaScript | soraticat/groupProject | /assets/js/script.js | UTF-8 | 20,944 | 2.796875 | 3 | [] | no_license | //Declaring global variables from user input
var generalA = JSON.parse(localStorage.getItem("general"))
var foodA = JSON.parse(localStorage.getItem("food"))
var activeA = JSON.parse(localStorage.getItem("active"))
var goingA = JSON.parse(localStorage.getItem("goingO"))
var eventA = JSON.parse(localStorage.getItem("even... | true |
66cfe7245366229d157c226fd2f2e8199b07ae13 | JavaScript | ben-marcantel/bubbles | /bubbles.js | UTF-8 | 1,311 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
const chalk = require('chalk');
let num;
let counter = 0;
const random = ()=>{
num = Math.floor(Math.random()*4)+1;
return num;
}
const image = (num,counter)=>{
if (num === 1){
process.stdout.write(chalk.rgb(0,0+counter,255)(chalk.bgRgb(0,255-counter,255)(" o o ... | true |
c92b838a8e58b20fe9d2315771de7ae01989a9f0 | JavaScript | erwandrezen/timeline | /html/jeux d'essai/transition/js.js | UTF-8 | 1,663 | 2.796875 | 3 | [] | no_license | //comparaison
function get_position(){
let y_height = d3.select("#rect")
.node()
.getBBox().height;
let y = d3.select("#rect")
.node()
.getBBox().y;
let y_other = d3.select("#other")
.node()
.getBBox().y;
//let y_move = y+y_height;
y_other -= y_height;
return [y,y_other];
}
function ... | true |
776ded918ae7942c1166e1460ac4327450de5556 | JavaScript | MAGICSCIENTIST/imgPretreatment | /src/common/imgsimiler.js | UTF-8 | 1,507 | 2.8125 | 3 | [
"MIT"
] | permissive | const cv = require('opencv4nodejs');
const imgHash = require('imghash')
const levenshteinDistance = require('./levenshteinDistance');
const findWaldo = async () => {
// Load images
const originalMat = await cv.imreadAsync(`${__dirname}/../data/findwaldo.jpg`);
const waldoMat = await cv.imreadAsync(`${__dir... | true |
7f7a248fdfd64a942fc8608acfc0a3f71b0d03a4 | JavaScript | alexsyro/resto-service | /client/src/redux/reducers/dishesReducer.js | UTF-8 | 1,227 | 2.65625 | 3 | [] | no_license | import { GET_DISHES, UPD_DISH, DEL_DISH, GET_MEASURES } from '../actionTypes/actionType';
const initialState = { dishes: [], measures: [] };
const dishesReducer = (state = initialState, action) => {
switch (action.type) {
case GET_DISHES:
return { ...state, dishes: action.payload.positions };
case GE... | true |
fcb0410a7d9b0e6f28c80e6cd22f8bd93900aaf8 | JavaScript | j2kun/ellipse-experiments | /main.js | UTF-8 | 3,488 | 2.8125 | 3 | [] | no_license | import * as d3 from 'd3';
import { Vector, Ellipse } from './geometry';
let width = 600;
let height = 400;
let svg = d3.select("body").insert("svg", ":first-child")
.attr("width", width)
.attr("height", height);
// should abstract this into something like Euclidea... | true |
b2289ab62a259af2f7be74d720d0a1678fc9691b | JavaScript | Tostifrosti/RLSengine | /js/engine/Location.js | UTF-8 | 1,480 | 2.734375 | 3 | [] | no_license | /*
@author RLSmedia, Rick Smeets
*/
function Location(options) {
arguments.callee.coords = {
latitude: 0.0,
longitude: 0.0,
accuracy: 0
};
this.radius = 6371; // radius of the Earth in km
this.options = options || {
enableHighAccuracy: false,
timeout: 30000, //time in miliseconds, else errorHandler is ... | true |
b057df8a92f2a6f39c539572f083c563510b86e3 | JavaScript | stokedover9k/mesh-edit-js | /selectors.js | UTF-8 | 7,091 | 2.75 | 3 | [] | no_license | function is (x) { return function (y) { return x == y; }; }
function isNot (x) { return function (y) { return x != y; }; }
var SELECTED_COLOR = [1,0,0];
var UNSELECTED_COLOR = [.5,.5,.5];
/////////// SELCTOR /////////////
function _mark_selected_ (v) { v.SEL = true; }
function _mark_unselected_ (v) { delete v.S... | true |
b32afed0c3f8a0fec988665758ca88a8ca99538d | JavaScript | xDeltaFox/InfinityWeb | /js/main.js | UTF-8 | 3,397 | 2.515625 | 3 | [] | no_license | 'use strict';
// Initialize Firebase
var config = {
apiKey: "apiKey",
authDomain: "authDomain",
databaseURL: "databaseURL",
projectId: "projectId",
storageBucket: "storageBucket",
messagingSenderId: "messagingSenderId"
};
firebase.initializeApp(config);
var db = firebase.database();
var ref = ... | true |
e12016b7f18918c0a6ad50ac9eeed811fde4feab | JavaScript | nathancyam/anime-api-server | /src/services/NyaaTorrentSearcher/search.js | UTF-8 | 2,968 | 2.71875 | 3 | [] | no_license | const request = require('request');
const qs = require('querystring');
const xml2js = require('xml2js');
const crypto = require('crypto');
const path = require('path');
const NYAA_URL = `https://nyaa.si`;
const CACHE_TTL_MIN = 1000 * 60 * 5;
/**
* @param {String} url
* @return {Promise.<Object>}
* @private
*/
con... | true |
40b1d1c8a5f10a18967d0d578ed79d6978e5288b | JavaScript | Fiju/javascript-core-concepts | /Constructors/index.js | UTF-8 | 146 | 2.984375 | 3 | [] | no_license | function Employee(name, age, salary) {
this.name = name;
this.age = age;
this.salary = salary;
}
let emp1 = new Employee("Mike", 23, 4550);
| true |
15bb6108b4bcb1f363bbbc0fc953bb78013ab658 | JavaScript | nlamonaco86/Power_Nine | /models/card.js | UTF-8 | 1,014 | 2.90625 | 3 | [] | no_license | // Card model
// Since most of the resulting data comes from Scryfall API, this really only needs to
// keep track of the card name, and what user and set it belongs to.
// Cards are part of a Set, Sets are part of The Collection. Cards and Sets belong to a User, who has only one Collection.
module.exports = functio... | true |
51418ffc56edcd90bd38ada7da62398fb1b6d910 | JavaScript | NewForce-at-Mountwest/overly-excited | /overly-excited.js | UTF-8 | 3,661 | 4.28125 | 4 | [] | no_license | // // Create an addExcitement function that should console.log() rows of words. It should take an array containing the words of a sentence and output them in the developer console.
// // Example output:
// // The
// // The walrus
// // The walrus danced
// // The walrus danced through
// // The walrus danced thro... | true |
2d97a98e513f6bfaf73552491784c8b8590c6baa | JavaScript | CeciTeser/Ada | /Module-2-JavaScript/Estructura de control/Arrays/contiene(numero, numeros)/script.js | UTF-8 | 618 | 3.625 | 4 | [] | no_license | const numbers = [5, 10, 55, 27, 9, 35];
const questionBox=document.getElementById('question-box');
const winnerBox=document.getElementById('winner-box');
const contiene=()=>{
const add= numbers.includes(55);
winnerBox.innerHTML=add;
console.log(add);
}
questionBox.addEventListener('click', contiene);
c... | true |
bcf8e44f386bbae54af4bd56dc125b6f338a2d4e | JavaScript | teodor1991/JavaScript-Project-Example | /ProductName.JS | UTF-8 | 1,116 | 3.234375 | 3 | [] | no_license | function store([arg1, arg2, arg3]){
let productName = arg1.toLowerCase();
let cityName = arg2.toLowerCase();
let quantity = Number(arg3);
if (cityName == 'sofia'){
if(productName == 'coffe')
console.log(quantity * 0.5);
}else if ('water'){
console.log(quantity * 0.8);
}else if ('beer'){
console.log(qua... | true |
4744aec6b62c649cc192385833d71a250df68b58 | JavaScript | futagoza/gist-Blogger | /gistBlogger.js | WINDOWS-1252 | 2,534 | 3.0625 | 3 | [] | no_license | /*!
* gistBlogger.js
* 2012 The Daily Go-za
*/
// Will only load whan the page is ready
jQuery(document).ready(function($){
// Enable or disable logging
var LOGGING = false,
// a list of scripts to load
scripts = [];
// Shortcut for `console.log` that checks if logging is enabled.
function log ( ) {
... | true |
d3d0c9a765e668682c87a1cbe7647c8cefd81e2b | JavaScript | bush/internet-connection-logger | /src/index.js | UTF-8 | 3,809 | 2.796875 | 3 | [] | no_license | var isOnline = require("is-online")
var offline = 0;
var restarting = false;
var powerSwitch = require("pi-pins").connect(22);
var moment = require("moment-timezone");
var timr = require("timr");
var rest = require("rest");
var fs = require('fs');
var scheduler = timr();
var backlog = [];
var dweetClient = require("nod... | true |
04f43a654245f8fe88f6df00be18ec250a3c4e9a | JavaScript | Briny131/low-poly | /js/triangle.js | UTF-8 | 11,357 | 3.203125 | 3 | [] | no_license | function Points(x , y){
this.x=x
this.y=y
}
Points.prototype={
constructor:Points,
check:function(p){
return this.x==p.x&&this.y==p.y
}
}
function Edge(p1,p2){
this.p1=p1
this.p2=p2
}
Edge.prototype={
constructor:Edge,
check:function(e){
return this.p1.check(e.p1)&... | true |
0661b1bae4e42c5fc3d18c5eb0b516b95ee87945 | JavaScript | myapps-studio/41_project_test | /calculateStylePoints.test.js | UTF-8 | 636 | 2.6875 | 3 | [] | no_license | const assert = require('assert');
const calculateStylePoints = require('./calculateStylePoints');
describe('calculateStylePoints', () => {
describe('styleNotes', () => {
it('should return sum of 3 notes v1', () => {
const actual = calculateStylePoints(10, 10, 10, 10, 10);
const... | true |
786477c718d984beefe15b75cbe5c96f0c27a608 | JavaScript | YujohnNattrass/javascript_fundamentals | /javascript_basics/convert_string_to_number.js | UTF-8 | 414 | 3.875 | 4 | [] | no_license | function stringToInteger(str) {
const STR_TO_DIGITS = { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 0: 0 }
let number = 0;
let multiplier = 10 ** (str.length - 1)
for (let index = 0; index < str.length; index += 1) {
number += (STR_TO_DIGITS[str[index]] * multiplier);
multiplier /= 10;
}
... | true |
0692b042cf82f95bbefa58fbf9fd98847e96d4b8 | JavaScript | kkarim7/Notes | /assets/scripts/app.js | UTF-8 | 2,503 | 3.34375 | 3 | [] | no_license | const startNewNoteBtn = document.getElementById("addNote");
const cancelNewNote = document.getElementById("cancelNewNote");
const addNewNote = document.getElementById("addNewNote");
class Note {
constructor(title, content) {
this.title = title;
this.content = content;
}
}
class NoteList extends Note {
n... | true |
775fa41793142211b3a82d672ef9e62b6dd15490 | JavaScript | mrasdfdela/springboard_39-02_react-jsx-intro | /part-3/index.js | UTF-8 | 610 | 2.984375 | 3 | [] | no_license | const Person = ({name, age, hobbies}) => {
const msgVote = age >= 18? "please go vote!" : "you must be 18";
const msgName = name.length > 6 ? name.slice(0,6) : name;
return (
<div>
<h1>Hello, {msgName}</h1>
<h3>{msgVote}</h3>
<ul>
{ hobbies.map( h => <li>{h}</li> ) }
</ul>
... | true |
87c44181828a403954fc9a2009bcfdceacaece83 | JavaScript | Samuel-Martineau/RM-Comments-CLI | /lib/inquirer.js | UTF-8 | 1,405 | 2.78125 | 3 | [
"MIT"
] | permissive | const { prompt } = require('inquirer');
const chalk = require('chalk');
const { fileExists, getExtensionOfExistingFile, getExtensionOfNotExistingFile } = require('./files');
const isValidPath = require('is-valid-path');
module.exports = {
askForInputAndOutputFile: () => {
const questions = [
{
... | true |
ad230a79bbe94dd9a09cfc008b6dbe8f124e48bf | JavaScript | ZhouWanmei/blocks | /src/components/cityButtonBar/transformData.js | UTF-8 | 1,876 | 2.546875 | 3 | [
"MIT"
] | permissive | import _ from 'lodash'
export default {
cityData(ret){
var citysGroup = [];
var citys = {}
var cityIds = []
var citys1 = [];
citys1.push({
group: '*',
value: '1',
name: '全国',
pinyin: 'QUANGUO'
});
var cityGroupOb... | true |
e3324deb9316f6a423e0736836593fcf1e05b595 | JavaScript | BrunoPrdt/video-manager_light | /src/container/DetailsPage/index.jsx | UTF-8 | 2,624 | 2.5625 | 3 | [] | no_license | /**
* @author Bruno Prdt
* container/DetailsPage/Details
*/
import React from 'react';
import '../../css/Container.css';
import HeaderDetails from './HeaderDetails';
import ActorList from './ActorList';
import { Spinner } from '../Spinner/Spinner';
import { API_KEY, API_URL } from "../../config";
import axios from "... | true |
b242c0dc5b0d3abd556b130db859e4c5a8aefc92 | JavaScript | soltrinox/bonobos-graphql | /client/src/SongList.js | UTF-8 | 703 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import { graphql } from 'react-apollo';
import { getSongsQuery } from './queries';
class SongList extends Component {
displaySongs() {
let data = this.props.data;
if (data.loading) {
return( <div>Loading songs...</div>);
} else {
return data.songs.ma... | true |
ea71cc4a0d5ddc0f7cf14686d2035df79d033d5b | JavaScript | amberlovescats14/dodgeBall | /main.js | UTF-8 | 4,284 | 3.9375 | 4 | [] | no_license | "use strict"
// Im going to create a class that can construct first and last name
// Then Im going to extend that class with another class for extra values
// Then one more extend with a static property of the Blue teams color and mascot
//Then I need to add event listeners to the buttons which will move the innerHTM... | true |
b10d094349f8c62f041995b9aa9ec472392ff1a6 | JavaScript | gonzabjj/Curso-javascript | /Entrega 2/main.js | UTF-8 | 146 | 3.5 | 4 | [] | no_license | let numero = prompt('En que año naciste?');
if ((numero >= 10) && (numero <=50)) {
alert('Aceptable');
} else {
alert ('No Aceptable')
} | true |
6787fa43090c1810a47002f97f76b05658e6f621 | JavaScript | ggeorgievx/core | /scripts/preversion/version-checker.js | UTF-8 | 3,661 | 2.734375 | 3 | [
"MIT"
] | permissive | const { join } = require('path');
const fs = require('fs');
const getPackagesAllPaths = (packagesDirectory) => {
return new Promise((resolve, reject) => {
fs.readdir(packagesDirectory, (err, paths) => {
if (err) {
return reject(err);
}
const packagesPath... | true |
88d513b3d929b3e01c9e7b404084b4133445b139 | JavaScript | ddijk/functional-light-v3 | /recursion/ex.js | UTF-8 | 1,082 | 3.53125 | 4 | [] | no_license | "use strict";
function isPalindrome(str) {
var n = str.length;
if ( n <= 1 ) {
return true;
}
if ( str[0]==str[n-1]) {
return isPalindrome(str.slice(1, n-1));
} else {
return false;
}
}
console.log( isPalindrome("") === true );
console.log( isPalindrome("a") === true ... | true |
43afa1523725f1ee72f176d031392f0a242a0ec2 | JavaScript | bkspace/mars-robots | /src/utils/isValidDirection.js | UTF-8 | 428 | 2.984375 | 3 | [] | no_license | import { VALID_DIRECTIONS_ARRAY } from '../constants'
/**
* Asserts the validity of a direction. The direction must exist within:
* VALID_DIRECTIONS_ARRAY: ['N', 'E', 'S', 'W']
*
* @param {String} direction - the direction to perform the check on
* @returns {Boolean} isValid - true if direction is valid
*/
expor... | true |
0bbaac043a0f57976542916f18444e064a6b5c20 | JavaScript | zkf85/architecture_demo | /inspur_demo_site/fpga_cloud/static/fpga_cloud/js/fpga_cloud.js | UTF-8 | 1,904 | 2.6875 | 3 | [
"MIT"
] | permissive | // sync the gifs
$(window).load(function() {
$('.preload').attr('src', function(i,a){
$(this).attr('src','')
.removeClass('preload')
.attr('src',a);
});
});
var num = document.getElementById('num');
var watt = document.getElementById('watt');
step.innerHTML = '0';
watt.innerHTM... | true |
8a72e0bc44e2660aec972019c199ffa3f1f269a9 | JavaScript | rinsuki/tst-change-close-tab-button-behavior | /background.js | UTF-8 | 1,647 | 2.671875 | 3 | [
"MIT"
] | permissive | const TST_ID="treestyletab@piro.sakura.ne.jp"
const sleep = msec => new Promise(resolve => setTimeout(resolve, msec))
async function submitToTST() {
var retryCount = 0
while (retryCount < 5) {
console.log("trying to submit addon information to TST...", retryCount)
await sleep(1000 * retryCount... | true |
661d2906352b16b9c202f591d6ce45897fdee72b | JavaScript | isinferon/Projekt-licencjat | /styles/js/script.js | UTF-8 | 1,622 | 3 | 3 | [] | no_license | const galleryItems = document.querySelector(".gallery--items").children;
const prev = document.querySelectorAll(".prev");
const next = document.querySelectorAll(".next");
const page = document.querySelectorAll(".page-num");
let index = 1;
const maxItem = 5;
const pagination = Math.ceil(galleryItems.length / maxItem);
... | true |
bf0e653222626104c81ad7484cf3ec2dd99dd623 | JavaScript | diegosierra01/jsonplaceholder | /src/store/modules/galery.js | UTF-8 | 559 | 2.53125 | 3 | [] | no_license | import axios from 'axios'
export default {
state:{
galery: []
},
actions: {
loadGalery({commit}){
axios
.get('https://jsonplaceholder.typicode.com/albums')
.then(data => {
let galery = data.data
commit('SET_... | true |
9befc5bb36627027ae2d7485bb3f58d1eb702f22 | JavaScript | 2018-B-GR1-TecnologiasWebConJavascript/dutan-salas-jossue-andres | /01-javascript/01-variables.js | UTF-8 | 1,383 | 4.28125 | 4 | [] | no_license | // Int edad = 10; TIPADO
//
//NO TIPADO ES JS
var edad = 10; //number
var edadString = "10"; //string
var sueldo = 1.123; //number
var casado = false; //bolean
var hijos = null; //object
var dato; //undefined
var fechaNacimiento = new Date()
var jossue = {
"nombre":"Jossue",
'segundoNombre':'Andrés',
ap... | true |
4728aa429eabd23fe820b41528dc7d2a98079e0b | JavaScript | 3ventic/modcheckerhttp | /public/lookup.js | UTF-8 | 1,763 | 2.546875 | 3 | [
"MIT"
] | permissive | function numfrmt(num) {
// Format number for printing
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
$(document).ready(function() {
var user = window.location.pathname.split("/");
user = user[user.length - 1];
var dt = $("#dt").DataTable({
order: [[0, "asc"]],
columns: [
{ title: "Channel",... | true |
54dc6bfb57227e370a5190a5b0d84b9f4fb0c0c3 | JavaScript | Dmkurup/ui-components-buildToLearn | /ProgressBar/index.js | UTF-8 | 438 | 3.296875 | 3 | [] | no_license | var progressFlag=false;
function move() {
if (!progressFlag) {
progressFlag=true;
const el = document.getElementById("myBar");
var width = 10;
var timerId = setInterval(progress, 1000);
function progress() {
if (width >= 100) {
clearInterval(timerId);
progressFlag=false;
... | true |
ef7ded79f4e6e312483f25166974b422f25bee28 | JavaScript | sckatgame/frontend | /src/componets/Form/index.js | UTF-8 | 705 | 2.515625 | 3 | [] | no_license | import { useState } from "react";
import './index.css'
import Logup from '../Logup'
import Login from '../Login'
export default function Form(){
const [login,setLogin] = useState(false);
const [text,setText] = useState('Já possui uma conta? Entrar');
function change(type,text){
setLogin(type)
... | true |
c0013619477a10e735b45bdde08e9f8668079f2e | JavaScript | sishydishy/Kage-Bunshin-no-Jutsu | /graphQL_jutsu.js | UTF-8 | 1,054 | 2.75 | 3 | [] | no_license | // Require axios to perform easy promise-based POST request
const axios = require('axios');
// Define constant
// Endpoint URL
const githubUrl = 'https://api.github.com/graphql'
// Your personal access token
const token = process.env.token;
// The Authorization in the header of the request
const oauth = {Authorization:... | true |
a6da363b07b7c5f6693bf54243cc379a89671ed2 | JavaScript | SKLCC-PHP/Tutorial | /module/user/js/create.js | UTF-8 | 4,306 | 2.8125 | 3 | [] | no_license | function changeGroup(role)
{
if(role || roleGroup[role])
{
$('#group').val(roleGroup[role]);
}
else
{
$('#group').val('');
}
}
function createCheckbox(parentID){
var parent = document.getElementById(parentID);//获取父元素
var specialtyInput = document.getElementById('specialtyInp... | true |
74e91cc2218b61b33235b3c5a26bfe23670bcc05 | JavaScript | SouzRod/ProjetoFullStack | /backEnd/app/controllers/users.js | UTF-8 | 1,515 | 2.53125 | 3 | [] | no_license | const service = require('../services/users')
const getUser = async (req, res) => {
try {
let result
if (req.params.id) {
const id = req.params.id
result = await service.getUser(id)
if (result.error) {
const { status, message } = result.error
... | true |
a3bd606afaf1dcd9ef13a458f3f786ded1133568 | JavaScript | hdusantos/nodeJsChat | /chatUDP/server.js | UTF-8 | 4,910 | 2.90625 | 3 | [] | no_license | // Uso do socket
const dgram = require("dgram");
const server = dgram.createSocket("udp4");
const host = "localhost";
let portServer = 6001;
const serverList = [6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008]
const setPort = (port) => {
let checkPort = dgram.createSocket("udp4");
checkPort.on("error", (err)... | true |
eda7943523139b0dba43178502a9a0a2a78c7932 | JavaScript | kostuyn/kademlia | /bucket.js | UTF-8 | 524 | 2.859375 | 3 | [
"MIT"
] | permissive | class Bucket {
constructor(maxContacts) {
this._maxContacts = maxContacts;
this._contacts = [];
}
async addContact(contact) {
if(this._contacts.length < this._maxContacts) {
this._contacts.push(contact);
return;
}
const lastAvailableContact = this._contacts.shift();
const isA... | true |
08174ab9f0b12038942f654a1535d6496e76dce9 | JavaScript | Make-O-Matic/Model-Editor | /sources/Classes/standard/_uuid.js | UTF-8 | 588 | 2.703125 | 3 | [] | no_license | function __uuid(_uuid) {
var id;
(function() {
if(_uuid != null && typeof _uuid == "string") {
id = _uuid;
} else {
id = function() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
};
return s4() + s4() + '-' + s4() + '-' + s4() + '... | true |
23c25bd4523ee06d6842992d70f0a14590792bff | JavaScript | raphaelkieling/mock-xmlhttprequest | /src/MockXhrServer.js | UTF-8 | 5,848 | 2.5625 | 3 | [
"ISC"
] | permissive | import { normalizeHTTPMethodName } from './Utils';
/**
* Mock server for responding to XMLHttpRequest mocks from the class MockXhr. Provides simple route
* matching and request handlers to make test harness creation easier.
*/
export default class MockXhrServer {
/**
* Constructor
*
* @param {MockXhr} xh... | true |
392b6e36504cd1a0fb296e8fd3765053b9b6e6fe | JavaScript | zurez/reactClone | /src/index.js | UTF-8 | 1,042 | 2.578125 | 3 | [] | no_license | import { ElementNode, Elements } from './element.class';
import { render } from './render.class';
const div = {
type : "div",
attributes: {
class: "foo bar",
value: "Hello"
},
id: "SomeUniqueValue",
childNodes:[
{
type : "string",
attributes: {
... | true |
d753f92910cd4bee278fbcb1e31c30b87cf4edfd | JavaScript | microsoft/conversationlearner | /packages/ui/cypress/support/Helpers.js | UTF-8 | 7,436 | 3.59375 | 4 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
// Use this in an `afterEach` function to cause all remaining tests of a suite to be skipped when
// the test that just finished running failed.
//
// CAUTION: This MUST NOT be called using an arrow/lambda function. ... | true |
85e6fb6ac865c0696fb7d3724465fbd7fbbe8261 | JavaScript | QiandaoLakeYY/leetcode | /7.js | UTF-8 | 572 | 3.46875 | 3 | [] | no_license | var reverse = function (x) {
let str = ''
let flag = false
let resStr = ''
x = String(x)
if (x[0] === '-') {
flag = true
str = x.substr(1)
console.log(str)
} else {
str = x
}
if (flag) {
let tempArr = str.split('').reverse()
tempArr.unshift... | true |
1e3842667ae5a703d3dca2b616834d8a5f914597 | JavaScript | bote795/AnimeTracker | /app/util/Services/StorageWrapper.js | UTF-8 | 796 | 2.59375 | 3 | [] | no_license | import { isEmpty } from "ramda";
export default class StorageWrapper {
key = "";
default = {};
cache = {};
constructor(val, defaultObj) {
this.key = val;
this.default = defaultObj;
}
get() {
if (!isEmpty(this.cache)) {
return Promise.resolve(this.cache);
}
return browser.storage.sy... | true |
7494738119ba6c8e4a7df245c266cead3800abbc | JavaScript | rockdonald2/projects | /speech_text_reader/js/main.js | UTF-8 | 1,762 | 3.15625 | 3 | [
"MIT"
] | permissive | const curtain = document.querySelector('#curtain');
const textBox = document.querySelector('#textBox');
const open = document.querySelector('#open');
const close = document.querySelector('#close');
function openBox() {
textBox.classList.add('show');
curtain.classList.add('show');
}
function closeBox() {
... | true |
ff673aa66aa90e4f0897f4842b9ad33ce801749a | JavaScript | Arsh028/Contact-Manager | /routes/users.js | UTF-8 | 2,578 | 2.640625 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
//Validate data
const { check, validationResult } = require('express-validator');
const User = require("../models/User");
const jwt = require("jsonwebtoken");
const config = require("config");
const bcrypt = require('bcrypt');
const saltRounds = 10;... | true |
a1a1b54dc359bf766d0900d2d5c59a9e4875aa49 | JavaScript | arjunlol/Data-Structures-Algorithms | /2.5.js | UTF-8 | 1,360 | 4.3125 | 4 | [] | no_license | //sum reverse linked list
class Node {
constructor(data) {
this.data = data;
this.next = null;
}
}
class SinglyLinkedList {
constructor() {
this.head = null;
this.length = 0;
}
appendToTail(data) {
let node = new Node(data);
//if empty, set new node to head
if (this.length === 0) ... | true |
e9e6ac6d9bfe15b3cadf97e369f79c33f5eccd20 | JavaScript | chaitanyatyagi/Devsnest-Frontened--HTML-CSS-Js | /day 7/Q3.js | UTF-8 | 137 | 2.625 | 3 | [] | no_license | var student = { name : "David Rayy", sclass : "VI", rollno : 12 };
let num = 0;
for(let i in student){
num += 1;
}
console.log(num);
num | true |
e446a9786e17d75fd7cf16f82b3487dd881629ed | JavaScript | philipstubbs13/frontend_masters | /js_fundamentals/each.js | UTF-8 | 656 | 3.546875 | 4 | [] | no_license | const _ = {};
_.each = function(list, callback) {
//
if (Array.isArray(list)) { // true
// loop through array
for (var i =0; i < list.length; i++) {
// call the callback with a list item
callback(list[i], i, list);
}
} else { // object
// loop through object
for (var key in lis... | true |
45da1ac0324c06a1be578f577159454c1a52e7ff | JavaScript | bolasblack/node-aws-lambda | /test/fake-s3-service.js | UTF-8 | 1,262 | 3 | 3 | [
"MIT"
] | permissive |
module.exports = function() {
const objects = []
return {
putObject(params, callback) {
validateParams(params,
['Bucket', 'Key', 'Body'],
[], 'putObject')
objects.push(params)
callback()
},
getObject(params, callback) {
validateParams(... | true |
f31bc688c654acba16429d18e41312648a5d331e | JavaScript | 4KITLER/Talkerjs | /src/test/new_version.js | UTF-8 | 1,983 | 3.015625 | 3 | [
"MIT"
] | permissive | /* параметры кнопки */
const paramsButton = {
element: [
'button',
'icon',
],
newElement: {},
text: {
selfObj: '',
lang: 'en-EN',
utterance: '',
},
icon: [
'fas fa-volume-up',
'fas fa-microphone-alt-slash',
],
style2: {
display: 'none',
},
className: [
'voice',
... | true |
2c995486ac62d6cf434446e9816c2dcae43d60da | JavaScript | js-tasks-ru/nodejs-20200117_themaraero | /2-module/2-task/LineSplitStream.js | UTF-8 | 547 | 2.796875 | 3 | [] | no_license | const stream = require('stream');
const os = require('os');
class LineSplitStream extends stream.Transform {
constructor(options) {
super(options);
this.message = '';
}
_transform(chunk, encoding, callback) {
this.message += chunk.toString();
if (this.message.includes(os.EOL)) {
const par... | true |
4d2f8e068d5b98aec3fd7ba9943124456db2a27e | JavaScript | zigm0/gogokick-admin | /assets/js/polyfills.js | UTF-8 | 274 | 2.640625 | 3 | [] | no_license | const { $ } = window;
/**
*
* @param {Function} cb
* @returns {jQuery}
*/
$.fn.each$ = function(cb) {
return this.each((i, item) => {
return cb($(item), i);
});
};
$.fn.map$ = function(cb) {
return this.map((i, item) => {
return cb($(item), i);
});
};
| true |
7a7243e9677a7b997b463e2b5f2c9a54cc381044 | JavaScript | mrboot/strapi-hols | /server.js | UTF-8 | 1,375 | 2.640625 | 3 | [] | no_license | require('dotenv').config()
const strapi = require('strapi');
const cron = require('node-cron');
const fetch = require('node-fetch');
const BANK_HOL_API_URL = `${process.env.API_URL}/bank-holidays`
// Start Strapi
strapi(/* {...} */).start();
async function addBankHols() {
console.log('Fetching Bank Hols...')
co... | true |
32c311570ca653c653fab5253b98542cf97ecaac | JavaScript | christochow/i-want-to-pass | /client/src/helper/store.js | UTF-8 | 1,412 | 2.65625 | 3 | [] | no_license | import {createStore} from 'redux'
import {Cookies} from 'react-cookie'
const cookies = new Cookies();
const initialState = {
course: cookies.get('course') ? cookies.get('course') : []
};
let reducers = function (state = initialState, action) {
switch (action.type) {
case 'addCourse':
let... | true |
31226388064ac4dbe534d242ae39f5c32f389a65 | JavaScript | rkgallaway/archive-201 | /201d47/Jon/lab11/bus-mall/js/app.js | UTF-8 | 5,704 | 3.796875 | 4 | [
"MIT"
] | permissive | 'use strict';
var productImage1 = document.getElementById('product-image-1');
var productImage2 = document.getElementById('product-image-2');
var productImage3 = document.getElementById('product-image-3');
var currentImage1 = 0;
var currentImage2 = 1;
var currentImage3 = 2;
var clickCounter = 0;
var allProductArray... | true |
0a042a1b1a1fc5819c79c3454d79a3ec57d820d4 | JavaScript | kgarbos/covid19-case-tracker | /main.js | UTF-8 | 12,334 | 2.984375 | 3 | [] | no_license | async function app() {
try {
let response = await fetch('http://ejd.songho.ca/ios/covid19.json');
let json = await response.json();
jsonData(json);
sortedJsonForChart(json);
// Current Date
var NowMoment = moment();
var eDisplayMoment = document.getElementById('date');
... | true |
4e4a4be080ad20b8d556361221e1a74b98a7992c | JavaScript | kkdev250/React-Udemy-CompleteGuide | /s20_v354-Burger/src/components/Navigation/NavigationItems/NavigationItems.test.js | UTF-8 | 1,697 | 2.59375 | 3 | [] | no_license | import React from 'react';
import { configure, shallow } from 'enzyme'; //enzyme - to render react component
//'shallow' renders the component, but not deeply - nested components are rendered as placeholders
import Adapter from 'enzyme-adapter-react-16';
import NavigationItems from './NavigationItems';
import ... | true |
40e1253843c536db4e72a5098a493969d1bdfea0 | JavaScript | forsikhub/test-task-table | /src/components/table/Table.jsx | UTF-8 | 1,996 | 2.625 | 3 | [] | no_license | import React,{useState} from 'react';
import classes from './Table.module.css'
export default function Table({ persons, sortCallBack, personInfoCallBack}) {
const [isAscending, setIsAscending] = useState({
id:true,
firstName: true,
lastName: true,
email: true,
phone: true,
... | true |
6debaf5b0a5b71e0be6ce45aeb48adf4af397720 | JavaScript | beb97/js-p5-projects | /laser/js/piece.js | UTF-8 | 6,716 | 2.859375 | 3 | [] | no_license | class Piece {
constructor(cell, orientation = new Orientation(), player = null) {
this.cell = cell;
this.orientation = orientation;
this.player = player;
}
react(ray) {
return ray;
}
die() {
this.cell.piece = null;
this.cell = null;
}
touch... | true |
9f70e1842037a8c3acd1c383735f7147ee30b099 | JavaScript | jensnyder/linked-list-lab-dc-web-071618 | /index.js | UTF-8 | 1,263 | 3.28125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function getName(node) {
return node.name;
}
function headNode(linkedList, collection) {
return collection[linkedList];
}
function next(node, collection) {
return collection[node.next];
}
function nodeAt(index, linkedList, collection) {
let node = collection[linkedList];
for (let i = 0; i < index; i++) {
... | true |
2552b2c0c18b1878c2592978d4f8ab0b155f2cf4 | JavaScript | jorgenio/cartodb | /public/javascripts/admin/show/view/GOD.js | UTF-8 | 1,404 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive |
var GOD = (function() {
var subscribers = [];
var debug = false;
function unsubscribe(event) {
debug && console.log("Unsubscribe ->", event.ev);
subscribers = _.filter(subscribers,function(sub){
return sub != event
});
}
function subscribe(event,type) {
debug && console.log("Subscrib... | true |
a2d483b62dbba7b46194e4437338cb67cbc09428 | JavaScript | nodesense/dmi-react-2018 | /src/app/cart/components/ProductList.js | UTF-8 | 3,414 | 2.8125 | 3 | [] | no_license | import React from "react"
export default class ProductList extends React.Component {
constructor(props){
super(props)
this.state = {
products: [],
brands: [],
loading: false
}
}
// make two apis calls simulataneous, wait for both to return
... | true |
fc1238768338f046066ecd62a194bb252303dabd | JavaScript | garthus23/holbertonschool-higher_level_programming | /0x14-javascript-web_scraping/3-starwars_title.js | UTF-8 | 329 | 2.5625 | 3 | [] | no_license | #!/usr/bin/node
let movie;
if (process.argv.length === 3) {
const request = require('request');
request(`https://swapi-api.hbtn.io/api/films/${process.argv[2]}`, function (error, response, body) {
if (error) {
return console.error(error);
}
movie = JSON.parse(body);
console.log(movie.title);... | true |
6c24a3c6ee3362d460f4d2ac704042e1f8ad1c6c | JavaScript | jeliozver/SoftUni-JavaScript-Fundamentals | /06-Strings-and-Regex-Exercises/P03-Starts-With/isStartWith.js | UTF-8 | 339 | 3.421875 | 3 | [
"MIT"
] | permissive | function isStartWith(str, start) {
return str.indexOf(start) === 0;
}
// console.log(isStartWith('How have you been?', 'how'));
// console.log(isStartWith('The quick brown fox…', 'The quick brown fox…'));
// console.log(isStartWith(
// 'Marketing Fundamentals, starting 19/10/2016',
// 'Marketing Fundamenta... | true |
832cc395b698b56e9c801b16f8662b01df5ba167 | JavaScript | koldo24/Ejercicicios | /Ejercicios/js/main.js | UTF-8 | 2,021 | 3.53125 | 4 | [] | no_license | // fichero javascript para app
const personas = [
{
"nombre" : "Oconnor",
"avatar" : "img/avatar1.png",
"sexo" : "h"
},
{
"nombre" : "Pepa",
"avatar" : "img/avatar2.png",
"sexo" : "m"
},
{
"nombre" : "JoseMAri",
"avatar" : "img/avat... | true |
a77799540cb0575de7260f709f863c4ebb857561 | JavaScript | NaigoApps/Restaurant-Mobile | /src/utils/EntitiesUtils.js | UTF-8 | 1,926 | 2.53125 | 3 | [] | no_license | import {uuid} from "./Utils";
import DishStatus from "../model/DishStatus";
import {formatDate} from "../components/widgets/inputs/DateInput";
export const NEW_CUSTOMER_UUID = "new-customer-uuid";
export class EntitiesUtils {
static nameComparator(e1, e2) {
return e1.name.localeCompare(e2.name);
}
... | true |
fcb03181bea8a52599950478386c6ed4628912c6 | JavaScript | GermanShtey/codewars | /6-kyu/zipWith.js | UTF-8 | 826 | 4.03125 | 4 | [] | no_license | //zipWith takes a function and two arrays and zips the arrays together, applying the function to every pair of values.
// The function value is one new array.
//
// If the arrays are of unequal length, the output will only be as long as the shorter one.
// (Values of the longer array are simply not used.)
//
// Inputs ... | true |
0a34a8018750a2b32b4480bd4a06c658384032e2 | JavaScript | Blessed538/Algo-test | /Data_Structures/Linkedlist_2.js | UTF-8 | 2,674 | 4.09375 | 4 | [] | no_license | function linkedList() {
this.head = null;
this.tail = null;
}
function Node(value, prev, next) {
this.value = value;
this.prev = prev;
this.next = next;
}
linkedList.prototype.addToHead = function (value) {
var newNode = new Node(value, this.head, null);
if (this.head) this.head.prev = newNode;
else t... | true |
5591f34ae438b9ee9d28b8a0c038e547b6a147c6 | JavaScript | ClrsDream/restaurant-app-v2 | /client/src/app/Account/roleChecker.js | UTF-8 | 291 | 2.5625 | 3 | [] | no_license | const MANAGER = "MANAGER";
const CUSTOMER = "CUSTOMER";
export const isRoleMatch = (role, EXPECT) => {
return Boolean(role && role.toUpperCase() === EXPECT);
};
export const isManager = role => isRoleMatch(role, MANAGER);
export const isCustomer = role => isRoleMatch(role, CUSTOMER);
| true |
dd49d4e73a2e0ba5bc366ad3917ab37f0be4c9f1 | JavaScript | jorgegorka/demanda | /frontend/src/lib/utils/memoize.js | UTF-8 | 395 | 3.015625 | 3 | [
"MIT"
] | permissive | /* This function has been copied from:
http://inlehmansterms.net/2015/03/01/javascript-memoization/
*/
function memoize(func) {
var cache = {};
return function() {
var key = JSON.stringify(arguments);
if (cache[key]) {
return cache[key];
} else {
var val = func.apply(this, arguments);
... | true |
aee07a77f7827f4fe9e776c71d7930cd19c21d8c | JavaScript | StudioBatalle/Phasergame | /web/gametest.js | UTF-8 | 18,387 | 2.515625 | 3 | [] | no_license |
var mirandoderecha;
var nivaguante = 2;
var iaguante;
var aguante = 14;
var maxaguante;
var nivvida = 2;
var ivida;
var vida = 2;
var maxvida;
var KeyJ
var KeyK
var KeyA
var KeyW
var KeyS
var KeyD
var jabd = 1;
var tiempo = 0;
var maxtiempo = 10000000000000000000;
class Example extends Phaser.Scene {
constructor() {... | true |
0f8beec7b317cc07de905e6af8d6fe0f51d2ff9a | JavaScript | Super-Cereal/Ramda | /src/helpers/validators.js | UTF-8 | 6,784 | 3.609375 | 4 | [] | no_license | /**
* @file Домашка по FP ч. 1
*
* Основная задача — написать самому, или найти в FP библиотеках функции anyPass/allPass
* Эти функции/их аналоги есть и в ramda и в lodash
*
* allPass — принимает массив функций-предикатов, и возвращает функцию-предикат, которая
* вернет true для заданного списка аргументов, если... | true |
6465d61c33e0e99209403424773fcb0d5b571169 | JavaScript | kmsheng/codewars | /5kyu-Common-Denominators.js | UTF-8 | 922 | 3.078125 | 3 | [] | no_license | function lcm(d) {
const factors = [];
let denominators = d.slice();
let max = Math.max(...denominators);
let devisor = 2;
while (devisor <= max) {
const isDevisable = denominators.filter(d => d % devisor === 0).length > 1;
if (isDevisable) {
max = Math.max(...denominators);
denominators =... | true |
5b54b29c7f0087efb65200ad97a46177bffb5e6a | JavaScript | vitkarpov/jspatterns | /src/pub-sub/test.js | UTF-8 | 2,736 | 3.078125 | 3 | [] | no_license | describe('Publish Subscriber Pattern', function(){
var results = [];
var subscriber1 = pubsub().subscribe('someTopic', function() {
results.push('invoked someTopic');
});
var subscriber2 = pubsub().subscribe('someTopic', function() {
results.push('invoked someTopic one more');
});
... | true |
68fded5d17d86333e5451e0c6aaffa9f2424c61d | JavaScript | Makoq/TheAlgorithms-JavaScript | /jianzhioffer/_连续数组的最大和.js | UTF-8 | 1,158 | 3.796875 | 4 | [] | no_license | //HZ偶尔会拿些专业问题来忽悠那些非计算机专业的同学。
//今天测试组开完会后,他又发话了:在古老的一维模式识别中,常常需要计算连续子向量的最大和,当向量全为正数的时候,问题很好解决。
//但是,如果向量中包含负数,是否应该包含某个负数,并期望旁边的正数会弥补它呢?
//例如:{6,-3,-2,7,-15,1,2,2},连续子向量的最大和为8(从第0个开始,到第3个为止)。
//给一个数组,返回它的最大连续子序列的和,你会不会被他忽悠住?(子向量的长度至少是1)
//思路:刚开始还是很懵,其实就是两层for循环,遍历每一个数组中的元素,并对以其为开头数组进行求和,将最大和记下来就可以了
function FindGreate... | true |
5abe6ef911a008be5211d78e147b48e6277e79f3 | JavaScript | mchrupcala/leetcode-challenges | /Sorting/TopKSorted.js | UTF-8 | 1,295 | 3.875 | 4 | [] | no_license | var topKFrequent = function(nums, k) {
if (nums.length === 1) return nums;
// if (nums.length === 2 && nums[0] === nums[1]) return [nums[0]];
// if (nums.length === 2) return nums;
//.sort() is ruled out.
//Loop through all array elements. Add to dictionary, based on frequency. Loop through array, a... | true |
dd289122fe3f075440fca5e58d677af8fdeecb0b | JavaScript | RShergold/AnalyserNode | /pitch/pitch.js | UTF-8 | 3,956 | 3.078125 | 3 | [] | no_license | var elStartButton = document.getElementById('start');
elStartButton.onclick = start;
function start() {
elStartButton.parentElement.removeChild(elStartButton);
navigator.mediaDevices
.getUserMedia({ audio: true })
.then(main)
.catch(console.log);
}
function downsample(samples, ratio) {
return sampl... | true |
76059313441736d41e6450a6ee92eeb40d3565d6 | JavaScript | kryban93/Paint | /script.js | UTF-8 | 8,251 | 3.28125 | 3 | [] | no_license | //==========================VARIABLES DEVINITION================================
const lineColor = document.querySelector('#lineColor');
const bgColor = document.querySelector('#bgColor');
const lineSize = document.querySelector('input[name="size"]');
const clearSketch = document.querySelector('#clearSketch');
const dr... | true |
67392f1ba20102a4594fe0650203cccce9b8bd8e | JavaScript | artlyhub/buzzz-web-dev | /static/dist/js/save_portfolio.js | UTF-8 | 2,219 | 2.765625 | 3 | [] | no_license | ( function($) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this coo... | true |
06ed0e4995e9190d586c34dca68ace25b1b817f5 | JavaScript | esveo/react-basics | /src/sections/003-building-the-app/slides/04-sideEffects.js | UTF-8 | 6,410 | 2.578125 | 3 | [
"MIT"
] | permissive | import raw from 'raw.macro';
import React from 'react';
import { Slide } from 'spectacle';
import { dash } from '../../../__helpers/dash';
import { Code } from '../../../__helpers/slides/Code';
import { CodeBlock } from '../../../__helpers/slides/CodeBlock';
import { Footer } from '../../../__helpers/slides/Footer';
im... | true |
0402561f0a769462ad9f8834ad89ce195206c030 | JavaScript | codeinpink/tic-tac-toe-but | /frontend/src/components/game/models/board.js | UTF-8 | 1,059 | 2.96875 | 3 | [] | no_license | import { none, some } from '../../../util/option'
const blankBoard = [
'', '', '',
'', '', '',
'', '', ''
]
export class Board {
constructor ({boardId, cells = blankBoard, turn = '', winner = none, timeLimitMs = 0}) {
this.key = boardId
this.boardId = boardId
this.cells = cells
this.turn = tur... | true |
631eb81faf4e20e5650d86b50a4894795e0d6e65 | JavaScript | bela90/memory_game | /js/app.js | UTF-8 | 3,668 | 3.515625 | 4 | [] | no_license |
let openCards = [];
let clickCounter = 0;
let timerStarted = false;
let timer;
let seconds = 0;
let minutes = 0;
let starsNumber = 3;
let newCardsHtml = "";
let cards = $(".card");
// on page reload shuffle functions is called and shuffles array of cards
shuffle(cards);
// builting HTML string that is represent... | true |
87be95249f67ad886ab838d728265d38381ba127 | JavaScript | david2999999/Javascript | /Javascript The Definitive Guide/Chapter 8 - Functions/Call and Apply Methods/Basics.js | UTF-8 | 899 | 3.953125 | 4 | [] | no_license | // call() and apply() allow you to indirectly invoke (§8.2.4) a function as if it were a
// method of some other object. (We used the call() method in Example 6-4 to invoke
// Object.prototype.toString on an object whose class we wanted to determine, for example.)
// The first argument to both call() and apply() is the... | true |
8cc97e21fda4e9debcf252513536fa423e87e36a | JavaScript | luthfiajiw/problem-solving | /multiple_pointers.js | UTF-8 | 277 | 3.625 | 4 | [] | no_license | // O(n^2)
function sumZero(arr) {
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < arr.length; j++) {
if (arr[i] + arr[j] === 0) {
return [arr[i], arr[j]];
}
}
}
}
console.log(sumZero([-3, -2, -1, 0, 1, 2, 3]));
// result
// [-3, 3]
| true |
05419a7ddac3cbe028734a698927ab6171619af8 | JavaScript | josemg23/Sistema-Educativo- | /public/js/crucigrama.js | UTF-8 | 9,086 | 2.734375 | 3 | [
"MIT"
] | permissive | var grid = [ [0, 0, 0, 0, '1', 0, 0, 0, 0, 0],
[0, 0, 0, 0, '1', 0, 0, 0, 0, 0],
[0, 0, 0, 0, '1', 0, '2', 0, 0, 0],
[0, '3', '3', '3', '3,1', '3', '3,2', '3', '3', '3,4'],
[0, 0, 0, 0, 0, 0, '2', 0, 0, '4'],
[0, 0, 0, 0, 0, 0, '2', 0, 0, '4'],
... | true |
fee31d14f3f522fd6dc7f35e6a419a490146ec69 | JavaScript | zenithtekla/nodeMySQL | /_sample/webserver06.js | UTF-8 | 252 | 2.671875 | 3 | [] | no_license | // create server with express
var express = require('express');
var app = express();
var http = require('http');
var port = 3000;
app.get('/', function(req, res){
res.send('<font color=red>SAMPLE TEXT</font>');
})
http.createServer(app).listen(port); | true |
c51125f5fbafb3fdf629d57697bbe3b46b603008 | JavaScript | mackayneil/javascript-projects | /Projects/Drumkit/app.js | UTF-8 | 3,036 | 2.953125 | 3 | [] | no_license | //On button click and on key click, create sounds
//Show and hide reference
//When E,I,K is clicked, animate the cymbol
(function() {
let crashImg = document.getElementById("crash-img"),
splashImg = document.getElementById("splash-img"),
hiHatImg = document.getElementById("hiHat-img"),
crashAudio =... | true |