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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
124e5c4ada08eeef561a439bb98097d9aead8f79 | JavaScript | dacodemaniak/4d-assets-management | /assets/js/contact-form.js | UTF-8 | 871 | 3.4375 | 3 | [] | no_license | /**
* contact-form
* Manage contact form
*/
// Sets a constant that is the form
const form = document.getElementById('contact-form')
// Detect any changes on the form (i.e set an event listener)
form.addEventListener(
'keyup', // Event that i want to listen to
(event) => { // Arrow function : what d... | true |
d4a0c1d31b5d8dd58441dc49c68b4ee40f5212a2 | JavaScript | delivan/javascript-algorithms-practice | /src/data-structures/trie/__test__/TrieNode.test.js | UTF-8 | 3,021 | 3.265625 | 3 | [] | no_license | import TrieNode from '../TrieNode';
describe('TrieNode는', () => {
it('trie node 인스턴스를 생성할 수 있어야 한다.', () => {
const trieNode = new TrieNode('c', true);
expect(trieNode.character).toBe('c');
expect(trieNode.isCompleteWord).toBe(true);
expect(trieNode.toString()).toBe('c*');
});
... | true |
363c0181cd1e0ccf95e5f8392d9f1a66878c8d2f | JavaScript | AnonymousSB/HackerRankChallenges | /Algorithms/ConstructiveAlgorithms/NewYearChaos/index.js | UTF-8 | 685 | 3.859375 | 4 | [] | no_license | function minimumBribes(q)
{
let bribes = 0;
let tooChaotic = false;
for (let i = q.length - 1; i >= 0; i--) {
if (tooChaotic) continue;
if (q[i] - (i + 1) > 2) {
tooChaotic = true;
}
for (let j = Math.max(0, q[i] - 2); j < i; j++)
{
if (q[j] > ... | true |
ec08c05dcea9951d4b4e13628a731ac9d6dd1ef1 | JavaScript | girlycoder/mean-exercises | /javascript-exercises/exercise1.js | UTF-8 | 139 | 3.375 | 3 | [] | no_license | var max = function(numberA, numberB)
{
if (numberA > numberB)
return numberA;
else
return numberB;
};
console.log (max(6, 7));
| true |
071bc8ca9df2e2fb8328c77a89558207a48b9294 | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-13.js | UTF-8 | 875 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | /// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* @path ch15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-13.js
* @description Array.prototype.filter - deleting own property with prototype property causes prototype index property to be visited on an Array
*/
function testcase() {
function call... | true |
684c63215b660eb8e56cd4f9e907e5e53a662c20 | JavaScript | therelvas/AVT_Project | /FroggerJS/camera.js | UTF-8 | 2,265 | 2.9375 | 3 | [] | no_license | function Camera(v) {
this.view = v;
this.ortho = 30.0;
}
Camera.prototype.getView = function() {
return this.view;
}
Camera.prototype.setView = function(v) {
this.view = v;
}
Camera.prototype.draw = function(camX, camY, camZ, oX, oY, oZ, side) {
var width = gl.viewportWidth;
var height = gl.viewportHeight;... | true |
b42e6e5dc602c5e1419ce2055172e4c9164b5e19 | JavaScript | woeichern/WFinalCoce | /WFinalCode.js | UTF-8 | 5,907 | 2.8125 | 3 | [
"MIT"
] | permissive | var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetConfig = ss.getSheetByName('config');
var sheetUser = ss.getSheetByName('user');
var numRowUser = sheetUser.getLastRow();
var configLine = getConfig(2);
var LINE_CHANNEL_ACCESS_TOKEN = configLine.ChannelAccessToken;
var LINE_HEADERS = {'Content-Type': 'ap... | true |
090d401693b4ecdeab490c12f7eef3c7e04e91c7 | JavaScript | handyxuefeng/webpack-all-config-demo | /6.plugin-principle/plugins/HashPlugin.js | UTF-8 | 2,092 | 2.84375 | 3 | [] | no_license | /**
* HashPlugin 插件
* hash 每次编译都会产生一个hash值,整个项目文件只要有一个文件发生变化,hash值就会改变
* chunkHash: 代码块hash,每个文件都有自己的hash值,每个文件的变化,只会影响该文件的代码块hash
* contentHash: 内容hash,文件的内容发生变化,hash值才变化
*/
class HashPlugin {
constructo(opts) {
this.opts = opts;
console.log('HashPlugin构造函数 = ', this.opts);
}
apply(co... | true |
dc5e5fab8c1cce3a3f906c8efc52e4c4e4a1aa83 | JavaScript | wstrinz/cat-loc-game-test | /public/game/displayFunctions.js | UTF-8 | 268 | 2.640625 | 3 | [] | no_license | var displayFunctions = {
descriptionForObject: function(obj){
if(obj.tags.amenity){
return "A " + obj.tags.amenity;
}
else if(obj.tags.building){
return "A Building";
}
else{
return JSON.stringify(obj.tags,null,2);
}
}
};
| true |
026a8f5a3d628fb7702ecadd03054dd481d592cb | JavaScript | meow1meow/JS-Function-Grid | /script.js | UTF-8 | 1,033 | 2.828125 | 3 | [] | no_license |
function setColor(row, col, color) {
var cell = $('#t')[0].rows[row].cells[col];
cell.style.backgroundColor = color;
}
// Write your code below this };
setColor(9, 4, "lightgreen");
setColor(8, 4, "lightgreen");
setColor(7, 4, "lightgreen");
setColor(6, 4, "lightblue");
setColor(6, 3, "lightblue");
setColor(6,... | true |
cd3a8eefb4d69243352e575f21b79106cc78a93d | JavaScript | broekeson/Math-Game | /javascript.js | UTF-8 | 10,216 | 3.0625 | 3 | [] | no_license | var playing = false;
var score;
var action
var timeremaining;
var correctAnswer;
var beginner = document.getElementById("beginner");
// var intermediate = document.getElementById("intermediate");
var advance = document.getElementById("advance");
// if we click on the start/reset button
document.getElementById("start... | true |
d5b2d0069351a8c31f31ff57bab0c5ca3bf1fc8c | JavaScript | juansinmiedos/lab-mongoose-movies | /starter-code/controllers/movies.js | UTF-8 | 1,330 | 2.6875 | 3 | [] | no_license | const Movie = require('../models/Movie')
exports.createMoviePage = async (req, res, next) => {
const movies = await Movie.find()
.then((movies) => {
res.render('movies', {movies})
})
.catch((err) => {
console.log(`está entrando a error ${err}`)
next()
})
}
exports.createMovieDetailPage = async (... | true |
523eca5a6d5446e720d21fd223e7e4ef27bf3ea4 | JavaScript | zcr1/search | /js/priority.js | UTF-8 | 829 | 3.6875 | 4 | [] | no_license | //A basic priority queue created for A*
function PriorityQueue(){
"use strict";
this.contents = [];
this.enqueue = function(data, priority){
var node = new Node(data, priority);
this.contents.push(node);
this.contents.sort(this.sortFunc);
};
this.sortFunc = function(a, b){
return a.priority - b.priorit... | true |
f1ed0c27460c463ab3fc029a2c7ed31d7e97761f | JavaScript | emileljaszewicz/dashboard_project | /js/functions.js | UTF-8 | 3,338 | 2.640625 | 3 | [] | no_license | function getPanelContainer(){
return $('.absolute-window');
}
function dateFormatting(date){
var dateOb, day, month, year;
dateOb = new Date(date);
day = dateOb.getDate();
month = dateOb.getMonth()+1;
year = dateOb.getFullYear();
if (day < 10) {
day = "0" + day;
}
if (month... | true |
3d9d3d1a4871851df9690e8e93f4187503182d70 | JavaScript | npfate/htmlAcademyCourses | /JS/Beginner/Objects/10-forLoopsInForLoops.js | UTF-8 | 691 | 3.65625 | 4 | [] | no_license | var gameRules = {
diceNumber: 2,
maxAttempts: 3
};
var firstCat = {
name: 'Кекс',
points: 0
};
var secondCat = {
name: 'Рудольф',
points: 0
};
var cats = [firstCat, secondCat];
// console.log(cats);
var runGame = function (rules, players) {
for (var currentAttempt = 1; currentAttempt <= rules.maxAttem... | true |
0ca2014ad0541cedd6ed453160fbb521498bf95c | JavaScript | vinceallenvince/ifttt-rss-spotify | /src/feedmanager.js | UTF-8 | 1,016 | 2.71875 | 3 | [] | no_license | var FeedParser = require("feedparser");
var request = require("request");
function FeedManager(eventEmitter, feedUrl, cachedItems) {
if (!feedUrl) new Error();
this.eventEmitter = eventEmitter;
this.feedUrl = feedUrl;
this.cachedItems = cachedItems;
this.eventTitles = [];
}
FeedManager.prototype.requestFeed = fu... | true |
b83a16b3876776969b2bcc61843b1ad52e44b260 | JavaScript | ztao-sd/robotics-prototype | /robot/basestation/static/js/elements/controls/turntable-controls.js | UTF-8 | 6,408 | 3.1875 | 3 | [
"MIT"
] | permissive | // turn table graphics
const twopi = 2 * Math.PI
const pi = Math.PI
run = async () => {
const canvas = document.getElementById('turntable-canvas')
const w = canvas.width
const h = canvas.height
const context = canvas.getContext('2d')
const x = 0.8 // at x=1 circle touches canvas edge
const r = x * 0.5 * M... | true |
212c985efde947c0e36748b42e669393ff98f3f5 | JavaScript | Stefanroets180/React-course | /Hello React/3.5 Exploring JSX /indecision-app/public/scripts/app.js | UTF-8 | 1,255 | 3.546875 | 4 | [] | no_license | 'use strict';
console.log('App.js is running!');
// JSX - JavaScript XML code. This syntax/code is not understood by browsers.
var template = React.createElement(
'div',
null,
React.createElement(
'h1',
{ id: 'someid' },
'Indecision App'
),
React.createElement(
'p',
null,
... | true |
a7fa8f502762938677f38d2d88ff1e2a5eb19f14 | JavaScript | SnowiiDream/GAD405 | /03_Loops/sketch.js | UTF-8 | 969 | 3.4375 | 3 | [] | no_license | let size = 50;
//Initialization function
function setup() {
createCanvas(500,500);
//noLoop();
frameRate(5)
}
function draw() {
//Rendering function
//Mini squares
stroke(0);
strokeWeight(1);
for (let x = 0; x < 10; x++) {
for (let i = 0; i < 10; i++) {
fill(72, 168, 242);
stroke(255,255,255)
rec... | true |
9d4bb6fb123a958e87b02f339ce023a54baf667d | JavaScript | slavam/hmc-rails52 | /app/javascript/packs/wmo_stations/find_edit_station.jsx | UTF-8 | 5,464 | 2.625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import FindStation from './find_station';
export default class FindEditStation extends React.Component{
constructor(props){
super(props);
this.state = {
name: '',
country: '',
latitude: null,
longitude: null,
altitude:... | true |
91a9b2e8d10f62c0486a510747cf242e3baa6822 | JavaScript | wesbdss/SensorMobileWeb | /teste2/teste.js | UTF-8 | 848 | 2.90625 | 3 | [
"MIT"
] | permissive | window.addEventListener("deviceorientation", handleOrientation, true);
function handleOrientation(event) {
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
var ballPos = (gamma/90)*200;
$('.absolute').html(absolute);
$('.alpha').html(alp... | true |
a40a108103a1315485200ac8e7834381a8f5838f | JavaScript | ertprs/Estudo | /Glass/Scripts/MDFe/ctrlPedagioRodoviarioMDFe.js | UTF-8 | 7,071 | 2.671875 | 3 | [] | no_license |
function carregaPedagioInicial(nomeControle, fornecedor, responsavel, numeroCompra, valorPedagio) {
var tabela = document.getElementById(nomeControle + '_tabela');
if (fornecedor.indexOf(';') > -1) {
var _fornecedor = fornecedor.split(';');
var _responsavel = responsavel.split(';');
v... | true |
da59cf154ef52998dc09f8d3280c5bb637f8b843 | JavaScript | allania7med11/BestElectricBike | /js/app.js | UTF-8 | 1,756 | 3.078125 | 3 | [] | no_license | // built navigation dynamically as an unordered list.
addLists = function() {
var list = [
{ id: "homeLink", class: "active", href: "#landing", text: "Home" },
{ id: "featuresLink", class: "", href: "#features", text: "Features" },
{ id: "reviewsLink", class: "", href: "#reviews", text: "Reviews" },
{... | true |
da8ef9cfacd09c1738dc2aec2a1e45fc26b9dbb5 | JavaScript | Aescosaurus/Block-Land-The-World-Beyond | /js/Door.js | UTF-8 | 1,102 | 2.75 | 3 | [] | no_license | class Door
{
constructor( dir )
{
var images =
[
gfx.LoadImage( "Images/Doors/DoorU.png" ),
gfx.LoadImage( "Images/Doors/DoorD.png" ),
gfx.LoadImage( "Images/Doors/DoorL.png" ),
gfx.LoadImage( "Images/Doors/DoorR.png" )
];
var width = 0;
var height = 0;
var pos = { x: 0,y: 0 };
//
this.I... | true |
159cf6411a80ae74dd48a0651067bb88c53bc6f5 | JavaScript | krakus2/runcodeapp-frontend | /src/utils/index.js | UTF-8 | 702 | 2.78125 | 3 | [] | no_license | export const hexToRgb = (hex) =>
hex
.replace(
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
(m, r, g, b) => '#' + r + r + g + g + b + b
)
.substring(1)
.match(/.{2}/g)
.map((x) => parseInt(x, 16))
export const addAlphaChannel = (color, a) =>
`rgba(${hexToRgb(color).join(', ')}, ${a})`
expor... | true |
59ca33d11998999de1fff5c29559115d02dccaa4 | JavaScript | ZloyBatarejka/betterToDo | /src/redux/actions.js | UTF-8 | 2,282 | 2.578125 | 3 | [] | no_license | import axios from 'axios';
import {
CREATE_POST,
DELETE_POST,
COMPLETE_POST,
HIDE_ALERT,
SHOW_ALERT,
HIDE_LOADER,
GET_DATA,
} from './types';
const URL = process.env.REACT_APP_URL;
export function hideAlert() {
return {
type: HIDE_ALERT,
};
}
export function showAlert(text) {
return (dispatch... | true |
2ece17a89cd096ff6f3e313b2718d304e454af67 | JavaScript | hashiguchip/git-cz | /lib/formatCommitMessage.js | UTF-8 | 2,473 | 2.734375 | 3 | [] | no_license | const wrap = require('word-wrap');
const MAX_LINE_WIDTH = 72;
const makeAffectsLine = function (answers) {
const selectedPackages = answers.packages;
if (selectedPackages && selectedPackages.length) {
return `\naffects: ${selectedPackages.join(', ')}`;
}
return '';
};
const formatTemplate = function (t... | true |
e63501cb733215140c0ff79c98e56c132b56eb35 | JavaScript | metanveer/shopilist | /server/controllers/shoppingListController.js | UTF-8 | 2,069 | 2.6875 | 3 | [] | no_license | import asyncHandler from "express-async-handler";
import ShoppingList from "../models/shoppingListModel.js";
const addShoppingList = asyncHandler(async (req, res) => {
const newList = req.body;
const userId = req.user._id;
const listWithSameName = await ShoppingList.findOne({
title: newList.title,
creat... | true |
f943a7016afbc7c7f4e165a46403e90f02a3cf79 | JavaScript | musicode/cc | /src/function/ucFirst.js | UTF-8 | 349 | 2.875 | 3 | [] | no_license | /**
* @file 第一个字母转成大写
* @author musicode
*/
define(function (require, exports, module) {
'use strict';
/**
* 转成 number 类型
*
* @param {string} word
* @return {string}
*/
return function (word) {
return word.charAt(0).toUpperCase()
+ word.slice(1);
};
... | true |
f3ff12af128217ff01e3fc09a2caf310b8720f82 | JavaScript | benjamindally/engage3 | /models/index.js | UTF-8 | 3,404 | 2.578125 | 3 | [] | no_license | "use strict";
var Sequelize = require("sequelize");
var env = process.env.NODE_ENV || "development";
var config = require(__dirname + "/../config/config")[env];
var db = {};
//Start a new sequelize instance
if (process.env.JAWSDB_URL) {
var sequelize = new Sequelize(process.env.JAWSDB_URL);
} else {
var sequelize... | true |
b850e6bcab4e31834c6c4984cbb44a242af859f0 | JavaScript | waitxiao/1234- | /1234美食网/js/Buy.js | UTF-8 | 11,849 | 3.1875 | 3 | [
"MIT"
] | permissive |
/*首先获取元素,获取的li是一个数组,调用onmouseover()函数,当鼠标放上去
停止跳转,当鼠标离开,开始跳转。*/
/*为每个轮播图设置一个定时器,即可以实现不同轮播图的跳转互不干扰*/
var timer;
var timer1;
var timer2;
var timer3;
var timer4;
var timer5;
var index=0;
var images=document.getElementById("goodspic1");
var lis=images.getElementsByTagName("li");
var images1=document.getElementById("goo... | true |
2547fb72cd4d08e566c0d050a2858607f8c2f45e | JavaScript | mdl95r/findCyrillic.js | /findCyrillic.js | UTF-8 | 1,496 | 3.078125 | 3 | [] | no_license | const fs = require("fs");
const glob = require("glob");
const chalk = require('chalk');
let counter = 0;
const opts = {
dir: 'dir',
verticalResult: true,
}
if (!opts.dir || !fs.existsSync(opts.dir)) {
console.log('Введена несуществующая или не задана директория!');
} else {
const getDirectories = function (dir, ... | true |
f470c1c5ebdfbf2164a245009a4480f2eb823896 | JavaScript | albertbahia/wdi_june_2014 | /w06/d04/jon_porras/in_class/js_exercises.js | UTF-8 | 1,166 | 3.46875 | 3 | [] | no_license | // Differences:
// 1) Semi colons everywhere
// 2) curly braces evrywhere
// 3) parenthesis everywhere
// 4) vars everywhere
// 5) camelCase everywhere
var myFavoriteNum = 13;
var message = "Hello, I\'m a string";
var otherMessage = "Hi, I'm a less formal string.";
var myName = "Jon";
var myGreeting = "Hi, " + myName... | true |
952bdc8b462c3440983938257973a2f1dcc79c6a | JavaScript | tlo-hikes/Calculators | /script/drums_length.js | UTF-8 | 472 | 2.5625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | function getMaxDrumLength() {
v = $('#len_poisson').val();
t = $('#len_thick').val();
r = $('#len_id').val();
E = $('#len_e').val();
k = $('#len_ds').val();
F = $('#len_f').val();
d = $('#len_cable').val();
temp1 = Math.pow((1 / (1 - (v * v))), 3) * ((t * t) / (r * r));
tempa = Math.pow(temp1, 1 / 4);
temp2... | true |
d00fe8e543df8bdbb31abbd3bbffde3a7aa64ea2 | JavaScript | guosamuel/advent-of-code-2020 | /day-2/index.js | UTF-8 | 4,305 | 3.96875 | 4 | [] | no_license | /*
--- Day 2: Password Philosophy ---
Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan.
The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day. "Something's wrong with our computers; we can't log in!" You ask if you can take a lo... | true |
440cad1049b852fec076c61748f21672a0e1faaf | JavaScript | 1337Nerd/doto | /assets/background.js | UTF-8 | 788 | 2.765625 | 3 | [] | no_license | function get_background() {
var i = Math.floor(Math.random() * bgCount),
image = "assets/backgrounds/" + i + ".png",
loader = document.createElement('img');
loader.setAttribute('src', image);
loader.onload = function() {
document.getElementsByTagName('body')[0].style.backgroundImage... | true |
f7e571e49ee207d525179cd1ef5447aed7f73487 | JavaScript | ArenAzibekyan/MpprNeuralNetwork | /static/js/myScript.js | UTF-8 | 5,197 | 2.59375 | 3 | [
"MIT"
] | permissive | 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 cookie string begin with the name we ... | true |
8e0dadd7e2a443399246b1853c2f6feaf6525d73 | JavaScript | svk31/react-stockcharts | /src/lib/interactive/utils.js | UTF-8 | 1,187 | 2.609375 | 3 | [
"MIT"
] | permissive | import { isDefined, mapObject } from "../utils";
export function getValueFromOverride(override, index, key, defaultValue) {
if (isDefined(override) && override.index === index)
return override[key];
return defaultValue;
}
export function terminate() {
this.setState({
current: null,
override: null,
});
}
ex... | true |
70cf1c5bccdbaf46ba7083dc7ee93c98f4680042 | JavaScript | neethunsr/whatsaroundCET | /src/components/Form.js | UTF-8 | 2,144 | 2.8125 | 3 | [] | no_license | import React, { useState } from 'react';
import axios from 'axios';
function Form(props) {
const [title, setTitle] = useState("");
const [content, setContent] = useState("");
const [type, setType] = useState("");
const handleSubmit = async (e) => {
e.preventDefault();
try {
await axios.pos... | true |
d691560e0c89901f58843b2a9d3a12fbc18021dc | JavaScript | sysaxis/ellibre | /src/binding.js | UTF-8 | 5,792 | 3.234375 | 3 | [
"MIT"
] | permissive |
window.bindObjectWithDOM = bindObjectWithDOM;
window.bindElement = bindElement;
function _getTargetPropertyAtAddress(object, address) {
var _object = object;
var point;
address = address.split('.');
var lastNode = address.pop();
while(point = address.shift()) _object = _object[point];
return {... | true |
f300f800dac85e33a847c64c3d7ebdfcb80c6f99 | JavaScript | folkforms/docker-healthcheck | /index.js | UTF-8 | 1,031 | 3.078125 | 3 | [
"MIT"
] | permissive | const shelljs = require("shelljs");
// FIXME Take these from args
const CONTAINER_NAME = "test-health-check";
const RETRIES = 3;
const trim = str => {
const start = str.indexOf('"') + 1;
const end = str.indexOf('"', start + 1);
return str.substring(start, end);
}
let interval;
const exit = (message, code) => ... | true |
a9d3884e4faa02c40d8f092af37b73f9f5d926f9 | JavaScript | Deiwin-Ignacio-Monsalve-Altamar/holbertonschool-higher_level_programming | /0x13-javascript_objects_scopes_closures/100-map.js | UTF-8 | 201 | 2.625 | 3 | [] | no_license | #!/usr/bin/node
const mapped = require('./100-data').list;
function print (list) {
console.log(list);
const mapeado = list.map((val, idx) => idx * val);
console.log(mapeado);
}
print(mapped);
| true |
83d6ee3dcb1910ae45223bf85377ecd02a81edba | JavaScript | jmantonellini/curso-JavaScript-moderno | /8 - FETCH API - Eventos/js/eventbrite.js | UTF-8 | 636 | 2.6875 | 3 | [] | no_license | class EventBrite {
constructor() {
this.token_auth = 'V5K2HZKY7R5MBZHJKDYR';
this.ordenar = 'date';
}
// Obtiene las categorías en init()
async obtenerCategorias() {
// Consutlar las categorías a la REST API de event brite
const respuestaCategorias = await fetch... | true |
93a7e6793941cafbb44dca87d67077ad2ae889b7 | JavaScript | connk/My-Project | /src/assets/js/rsacopy/code_conversion.js | UTF-8 | 432 | 2.984375 | 3 | [] | no_license | // JavaScript Document
var code_base = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'a':10,'b':11,'c':12,'d':13,'e':14,'f':15};
function code_conversion(str){
if(str.length%2!=0){
alert('必须成对');
return "";
}
var rtn = '';
for(var i=0;i<str.length;i=i+2){
var a = code_base[str[i]];
var b =... | true |
20c37d96b2ad3a22e381af17c0bbe6675a552e4b | JavaScript | jesus-rangel/superhero-app-v2-react | /src/helpers/helperFunctions.js | UTF-8 | 769 | 3.71875 | 4 | [] | no_license | /* If a PowerStat is not known, show "Unknown" instead of an empty string or the null value */
export const showPowerStat = (powerstat) => {
if (powerstat === null || powerstat === "null") {
return "Unknown";
}
return powerstat;
};
/* Sum of each powerstat for the team (intelligence, strength, etc) */
expor... | true |
aaa0450ffb01018a6888a877adb6825d0ac1aa09 | JavaScript | vanrick/DailyPro2 | /20_sumDigits/solutions/rv_solutions2.js | UTF-8 | 656 | 4.15625 | 4 | [] | no_license | // function sumToSingle(num){
// do {
// var stringNum = String(num);
// let numToArr = stringNum.split('')
// var num = 0
// numToArr.forEach(function(key){
// num += Number(key)
// })
// } while (stringNum.length > 1);
//
// console.log(num);
// return num
// }
//
// sumToSingle(1234... | true |
cb742dae5185a857082b0f7c368fa72f52021d9c | JavaScript | dustin181/SA_frontend | /samples/basics/arrowfunctions/script.js | UTF-8 | 321 | 3.3125 | 3 | [] | no_license | "use strict"
// function mult(a,b) {
// return a * b;
// }
// var mult = (a,b) => a * b;
const mult = ((a,b) => {
return a * b;
});
// setTimeout(function() {
// console.log(mult(5,10));
// },1000)
// setTimeout(() => {
// console.log(mult(5,10));
// },1000)
setTimeout(() => console.log(mult(5,10)) ,1000... | true |
ebbe8f6d572e098feae1bbd68e4fc7bdf56a0913 | JavaScript | danitrod/chatbot-mobile-app | /src/redux/reducers/chat.js | UTF-8 | 925 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import * as actionTypes from '../actions/actionTypes';
const initialState = {
history: [],
err: false
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.ADD_MESSAGE_SUCCESS:
return { history: state.history.concat(action.message), err: false }... | true |
e820a4566289f2828640dc2c4cb3a8adf2dedcad | JavaScript | liyanxiangable/CodingNotes | /LeetCode/1.js | UTF-8 | 417 | 3.125 | 3 | [] | no_license | /**
* Created by liyanxiang on 2017/9/13.
*/
function first(n) {
let result = '';
if (n < 0) {
result += '-';
}
let carry = 0;
for (let carry = 0; carry < 5; carry++) {
if (Math.pow(10, carry) <= n) {
continue;
} else {
break;
}
}
whi... | true |
b429343aa9615535a1a0a46be95684e7207b4c15 | JavaScript | jonr11/WorthyJerky | /Index_Java.js | UTF-8 | 701 | 2.734375 | 3 | [] | no_license | $(document).ready(function(){
var counter = 0,
$items = $('.Slideshow figure'),
Items = $items.length;
var showCurrent = function(){
var itemToShow = Math.abs(counter%Items);
$items.removeClass('show');
$items.eq(itemToShow).addClass('show');
};
var myVar = setInterval(function(){Forward()}, 10000);
function mySto... | true |
320c22545b121b5dad3a5347bc40d9b33e98ea27 | JavaScript | cpooniwala/movieSpotter | /moviescript.js | UTF-8 | 4,488 | 2.78125 | 3 | [] | no_license |
var apiKey = "6e42aba18accf15f6000946c4a42e940";
// var queryURL = "https://api.themoviedb.org/3/movie/" + movieid + "?api_key=6e42aba18accf15f6000946c4a42e940";
var adultContent = "true";
var clickedmovieGenre = [];
// var masterQuery = queryURL + "/api_key=" + apiKey + "&language=en-US" + "&sort_by=primary_release_d... | true |
a2d23075fc6c06fdbe592c5d3c731f759da5cb6e | JavaScript | FlattenTheCurve19/Front-End | /src/Store/Actions/covid19Actions.js | UTF-8 | 2,186 | 2.703125 | 3 | [
"MIT"
] | permissive | import axios from "axios";
import moment from "moment";
export const SET_INITIAL_DATA = "SET_INITIAL_DATA";
const csv = require("csv/lib/sync");
export const setInitialData = () => dispatch => {
const currentDate = moment().format("MM-DD-YYYY")
const yesterdayDate = moment(currentDate, 'MM-DD-YYYY').subtract(1, "... | true |
fd1641c57887ec10ea37a89f7f4776b222b2a747 | JavaScript | Anadev1/Portfolio | /js/main.js | UTF-8 | 5,770 | 3.28125 | 3 | [] | no_license | "use strict"
/* FRONTPAGE PICTURE */
function fadeOverlay(nr) {
document.querySelector(`#piece-${nr}`).addEventListener("mouseover", function () {
document.querySelector(`#purple-container-${nr}`).classList.add("showOverlay");
document.querySelector(`#info-${nr}`).style.display = "block";
... | true |
f2e3250232fc7127e42b5ab6cfced8620f460117 | JavaScript | BlueInt32/super-sprint | /docs/pixijs&box2d sample/pixijs_box2d/MouseJoint/src/Main.js | UTF-8 | 7,637 | 2.703125 | 3 | [] | no_license | /**
* @author kozakluke@gmail.com
*/
(function Main()
{
const STAGE_WIDTH = window.innerWidth, STAGE_HEIGHT = window.innerHeight;
const METER = 100;
var bodies = [], actors = [];
var stage, renderer;
var world, mouseJoint;
var touchX, touchY;
var isBegin;
var stats;
(functio... | true |
32ff4b79e995f0f72e4e1abda57abb5f596180bf | JavaScript | sodegarami/programacao-absoluto-zero | /secao8-objetos/3-basico_2.js | UTF-8 | 304 | 3.59375 | 4 | [] | no_license | const produto = { // 3 atributos ou propriedades
nome: 'Ipad',
preco: 5600,
desconto: 0.15,
precoComDesconto: function() { // METODO = funcao dentro do contexto do objeto
return preco * (1 - desconto);
}
}
console.log(produto.nome);
console.log(produto.precoComDesconto());
| true |
07c9fa092f6a4b965610dda0336d677a5efe6fed | JavaScript | VishakAmin/auth_app | /components/Charts/PaymentBarChart.js | UTF-8 | 1,881 | 2.5625 | 3 | [] | no_license | import React from 'react';
import { Bar } from 'react-chartjs-2';
import moment from 'moment';
const HorizontalBarChart = ({bar_data}) => {
const chartDataPoints = [
{ label: 'Jan', value: 0 },
{ label: 'Feb', value: 0 },
{ label: 'Mar', value: 0 },
{ label: 'Apr', value: 0 },
{ label: 'Ma... | true |
ba5644584a1e4d13ca159135ee1b139c5514c951 | JavaScript | aarjoon/hello-world | /file.js | UTF-8 | 414 | 3.234375 | 3 | [] | no_license | function helloConsole () {
console.log("Hello, World!");
}
function helloPopup () {
alert("Hello, World!");
}
function helloBrowser () {
var p = document.getElementById("helloBrowser");
p.innerHTML = "Hello, World!";
}
function helloStranger () {
var username = prompt("Enter Your Name");
var greeting = d... | true |
2d08125c8aedd5ee821918331dbee7b9d043f074 | JavaScript | AlexeyKasaev3/softServe-academy | /next-version/index.js | UTF-8 | 581 | 3.125 | 3 | [] | no_license | function nextVersion(currentVersion) {
let data = currentVersion.split('.');
for (let i = data.length - 1; i >= 0; i -= 1) {
const nextVersion = Number(data[i]) + 1;
if (nextVersion === 10 && i !== 0) {
data[i] = 0;
} else {
data[i] = nextVersion;
return data.join('.'... | true |
75434b8ee2f2346b632a862d09f4c9b91297bbdd | JavaScript | D-DF/exo-loops-iterations | /threeWayCountDown.js | UTF-8 | 195 | 3.46875 | 3 | [] | no_license | let nb1 = 102;
for (let i = 0; i < nb1; i++) {
if ( i % 2 === 1) {
console.log(i)
}
}
let j = 0;
let nb2 = 102;
while (j < nb2) {
j++
if(j % 2 === 1) {
console.log(j)
}
}
| true |
e5f1b7d16ca9c689b9fb637ecee90efcc2e9cd69 | JavaScript | codeUsLab/eventus | /server/config/helpers.js | UTF-8 | 2,292 | 2.671875 | 3 | [] | no_license | "use strict";
// jwt = JSON Web Token
var jwt = require("jwt-simple");
// var request = require("request");
module.exports = {
// TODO: decide if we need these
// errorLogger: function (error, req, res, next) {
// // log the error then send it to the next middleware in
// // middleware.js
// console... | true |
209ae3861028b9e65694ff6e6fd61ebaea74bc25 | JavaScript | wss2020/refactoring | /笔记重构/第8章 搬移特性/8.6 移动语句(Slide Statements)/范例1/范例1.js | UTF-8 | 6,296 | 3.765625 | 4 | [] | no_license | /**
移动代码片段时,通常需要想清楚两件事:1)本次调整的目标是什么,2)以及该目标能否达到。
第一件事通常取决于代码所在的上下文。最简单的情况是,我希望元素的声明点和使用点互相靠近,因此移动语句的目标便是将元素的声明语句移动到靠近它们的使用
处。不过大多数时候,我移动代码的动机都是因为想做另一项重构,比如在应用提炼函数(106)之前先将相关的代码集中到一块,以方便做函数提炼。确定要把代码移动
到哪里之后,
我就需要思考第二个问题,也就是此次搬移能否做到的问题。为此我需要观察待移动的代码,以及移动中间经过的代码段,我得思考这个问题:如果我把代码移动过去,
执行次序的不同会不会使代码之间产生干扰,甚至于改变程序的可... | true |
767c6140c740474a997d0d1d8166c7741f18322c | JavaScript | agnynureza/nodejs-kyu-6 | /Node.js/find-missing-letter.js | UTF-8 | 1,190 | 3.578125 | 4 | [] | no_license | const BenchMark = require('./speed-library')
function findMissingLetter(array){
//mysolution
// let dictionary = 'abcdefghijklmnopqrstuvwxyz'
// let check = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
// let temp = []
// let oke = 0
// for(let i = 0 ; i < array.length ; i++){
// let index = dictionary... | true |
9243978f8aa703c0fb476682ded7d5d5cfa7e295 | JavaScript | mishogv/JTS | /src/FE/jts/src/views/tournament-details.js | UTF-8 | 2,853 | 2.53125 | 3 | [] | no_license | import MainLayout from "../layouts/main-layout";
import React, { useState, useEffect } from "react";
import TournamentService from './../services/tournaments-service';
import { Table } from 'react-bootstrap';
import Category from './../components/categories/category';
import JudokaTournament from './../components/judok... | true |
a03f798042bb79de937101cbc89fc40484113562 | JavaScript | Huzaifa77/Survey-Form | /src/components/CreateSurvey.js | UTF-8 | 2,785 | 2.765625 | 3 | [] | no_license | import {useState} from 'react'
import TypeSelector from './TypeSelector'
import Question from './Question'
import Option from './Options'
import { useHistory } from "react-router";
const CreateSurvey = ({squestions,setSquestions})=>{
const history = useHistory();
const getRandom = () =>{
return Math.f... | true |
62e8d151acd4f1ec962558fc1ca39987b2acbc1a | JavaScript | JaneChelle/BY_-preparation | /_05_JS/尚硅谷_JavaScript高级/_04_线程机制与事件机制/_01_进程与线程.js | UTF-8 | 788 | 3.65625 | 4 | [] | no_license | // 相等 ==
// console.log(NaN == !NaN);
// console.log(null == null);
// console.log(undefined == undefined);
// console.log('1', null == undefined);
// console.log([] == ![]);
// console.log({} == {});
// console.log(!!'');
// console.log(0 == '');
// console.log([] == false);
//通过FormData构造函数创建一个空对象
var formdata = new ... | true |
c5b6e006418f98340e4989d2967e988ed36277d6 | JavaScript | ctc87/PracticaRobotIA | /pruebas_sarabia/js/matrix.js | UTF-8 | 4,922 | 3.203125 | 3 | [] | no_license | // Definimos el constructor Entorno
function Entorno(m, n, numObstaculos, manual) {
this.n = n; //largo
this.m = m; //ancho
this.pintada = false;
this.manual = manual;
this.PosRobot = [];
this.arrayDePaquetes = [];
if(numObstaculos > (this.n * this.m) - 1) {
console.log('Error en la creación del entor... | true |
b5e52a82026f1ace48aa199fa633e0afe791985c | JavaScript | owenbharrison/js-projects | /VisualEffects/StrangeEffect/sketch.js | UTF-8 | 933 | 3.09375 | 3 | [] | no_license | var points = [];
var index = 0;
var size = 100;
var play = true;
var col = {r:255,g:255,b:255};
function setup(){
createCanvas(400, 400);
if(play){
for(var i=0;i<50;i++){
points.push(createVector(random(width), random(height)));
}
}
else{
for(var x=0;x<width;x+=size/3){
... | true |
12bec7456e0ae3e6071f7325b1896875058a726c | JavaScript | thedat237/C4EJS106DOTHEDAT | /lesson3/homework3/homework3.js | UTF-8 | 8,034 | 3.703125 | 4 | [] | no_license | // console.log("Ex1")
// console.log("1.")
// let a=5;
// let b=6;
// [a,b]=[b,a];
// console.log(a,b);
// console.log("2.");
// let a=5;
// let b=6;
// let temp;
// temp=a;
// a=b;
// b=temp;
// console.log(a,b);
// console.log("EX2")
// let s="Hello beauty there";
// let a=s.split(" ",3);
// console.log(a);
// let s... | true |
6410c29c2006fb6547bf4d951bf290345a8339cd | JavaScript | caiquexavier/mediastream-challenge | /02-javascript/index.js | UTF-8 | 1,004 | 3.421875 | 3 | [] | no_license | 'use strict';
console.log(`
2.
---
Take a look at the 'requester' function.
- What it does?
- It makes a async rest call to an API and return a Promise;
- How it's used? Add different use-case examples that covers every functionality.
- Use case in the code bellow, we have to initialize the requester functi... | true |
fea7227b8e3b661fff5bfe64bcb7ab1ef0f6c37e | JavaScript | zhibinhu/tps_webself | /src/misc/vue-validator.js | UTF-8 | 12,569 | 2.9375 | 3 | [] | no_license | (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory()
: typeof define === 'function' && define.amd ? define(factory)
: (global.VueValidator = factory())
}(this, function () {
'use strict'
/**
* 获取变量的字符串值
*/
function toString (v... | true |
31e7f9f257258305820fb8f7bd11f6e05f908d0b | JavaScript | Bunnydog/javascriptPractice | /demo14/index.js | UTF-8 | 1,176 | 3.140625 | 3 | [] | no_license | window.onload = function () {
var oBtn = document.querySelectorAll("button");
var oBox = document.querySelector(".box");
var oBox2 = document.querySelector(".box2");
oBtn[0].onclick = function () {
/*
clearInterval(timer);
//要想用js实现动画的效果,得借助定时器。
//用timer来控制动画的结束时机
... | true |
24adc47b4ecb50c6f93d103dfc77301cf3f977b7 | JavaScript | SocialGouv/dila-api-client | /examples/fetch-code.js | UTF-8 | 1,692 | 2.609375 | 3 | [] | no_license | const { DilaApiClient } = require("../src");
const dilaClient = new DilaApiClient();
/*
fetch a full code from table des matieres and add all individual articles
*/
const tableMatieres = params =>
dilaClient.fetch({
path: "consult/code/tableMatieres",
method: "POST",
params
});
const getArticle = ... | true |
e060f77831b8172e34f44368023385969d39d8ac | JavaScript | earthctzn/craft-frontend | /src/actions/breweryActions.js | UTF-8 | 2,557 | 2.578125 | 3 | [
"MIT"
] | permissive | import {
ADD_BREWERIES,
SELECTED_BREWERY,
LOADING_BREWERIES,
} from '../actionTypes'
// 'https://craft-brew-backend.herokuapp.com'
// 'http://localhost3000'
const thisURL = 'https://craft-brew-backend.herokuapp.com'
const setBreweries = ( breweries ) => {
return { type: ADD_BREWERIES, payload: brewe... | true |
9237e39ff3353009c482d93276b641166b24acf8 | JavaScript | mr-parus/full-stack-test-task | /server/utils/req.parser.js | UTF-8 | 778 | 2.53125 | 3 | [] | no_license | import Busboy from 'busboy';
/**
* Parses one file from a Node request
* and returns it as a Stream
*
* @param {http.IncomingMessage} req
* @return {Promise<{ file: Stream, filename: string }>}
*/
export const parseOneFile = req => {
return new Promise((resolve, reject) => {
const { headers } = req;
c... | true |
abb9776ceb17c4de75fcccb72333dad5e73383d8 | JavaScript | salmanrrana/coding_interview_course | /exercises/steps/index.js | UTF-8 | 3,572 | 4.5 | 4 | [] | no_license | // // --- Directions
// // Write a function that accepts a positive number N.
// // The function should console log a step shape
// // with N levels using the # character. Make sure the
// // step has spaces on the right hand side!
// // --- Examples
// // steps(2)
// // '# '
// // '##'
// // steps(3)
... | true |
f1b9f4d3274e9a89d71ad1824e273ee0d7a89354 | JavaScript | jillwilliams/Solving-Systems-of-Equations | /script.js | UTF-8 | 163 | 2.953125 | 3 | [] | no_license | const myProblem = () => {
return " 1. (3,2) 2. (1, 5) 3. (4, 2)";
};
const myCalc = () => {
document.getElementById("demo").innerHTML = myProblem();
}; | true |
cf6710c185ee62401dcdfd911d32ab4880e88b33 | JavaScript | firebase007/satellity | /web/src/components/color.js | UTF-8 | 289 | 2.75 | 3 | [
"MIT"
] | permissive | class ColorUtils {
constructor() {
this.colors = ['#EF564F', '#4B93D1', '#9354CA', '#414141'];
}
colour(str) {
let i = Math.floor(Math.random() * 100);
if (str !== '') {
i = str.charCodeAt(0);
}
return this.colors[i % 3];
}
}
export default ColorUtils;
| true |
1167151bb792346533a3918c2d0633f74cceaf5f | JavaScript | wso2/product-is | /modules/features/org.wso2.identity.jaggery.apps.feature/src/main/resources/portal/themes/portal/js/draggable-0.1.js | UTF-8 | 4,403 | 2.78125 | 3 | [
"Apache-2.0",
"CC-BY-4.0",
"EPL-1.0",
"BSD-3-Clause",
"GPL-2.0-only",
"LGPL-2.0-only",
"CDDL-1.0",
"LicenseRef-scancode-unknown"
] | permissive | /**
* draggable - Class allows to make any element draggable
*
* Written by
* Egor Khmelev (hmelyoff@gmail.com)
*
* Licensed under the MIT (MIT-LICENSE.txt).
*
* @author Egor Khmelev
* @version 0.1.0-BETA ($Id$)
*
**/
(function( $ ){
function Draggable(){
this._init.apply( this, arguments );
};
... | true |
7c540c780caa70e83c0166d2842d17f132574966 | JavaScript | ainuo5213/ts-version | /js/index.js | UTF-8 | 17,221 | 3.015625 | 3 | [] | no_license | var Star = /** @class */ (function () {
function Star(type, row, col) {
// 宽度
this.width = 40;
// 高度
this.height = 40;
this.row = row;
this.col = col;
this.type = type;
}
/**
* 创建div,给div添加一些样式
*/
Star.prototype.createBlock = function () ... | true |
0415345d38cf1d470db8d7866dd0deee52e821bc | JavaScript | mirfishe/weather-forecast | /src/components/weather/HourlyForecast.js | UTF-8 | 2,690 | 2.875 | 3 | [] | no_license | import React from "react";
import {useSelector} from "react-redux";
import {Col, Row, Card, CardBody, CardText, CardHeader, CardFooter} from "reactstrap";
const HourlyForecast = (props) => {
const componentName = "HourlyForecast.js";
const weatherData = useSelector(state => state.weather.weatherData);
c... | true |
ea786e82abffade6ed92a4f21fc4b04b25e33b8f | JavaScript | ctjsctjs/ElderHome | /js/generateContent.js | UTF-8 | 532 | 2.609375 | 3 | [] | no_license |
$(document).ready(function () {
console.log("OK");
$.getJSON("js/data.json", function (json) {
var container = $("#data-row");
//Generate app list from adapters.JSON
json.adapters.forEach(function (day) {
var li = $('<li class="app">').appendTo(container);
var a = $('<a target="_blank">')... | true |
f9b820b6190eed4169711568bb0130574ea31a20 | JavaScript | Salaah01/tetris | /src/store/reducers/gameGrid.js | UTF-8 | 2,480 | 3.375 | 3 | [] | no_license | /**Contains the redux reducers related to the game grid. These include:
* updateShapeUnitsCount: Updates the shape units count.
* updateGrid: Using an updated sub grid of the current grid, occupied the
* elements in the grid placing it with the values in the sub grid.
* startDropNewBlock: Start to drop blocks... | true |
da0ad002e7a3967144e578842407962e55e52c7f | JavaScript | guozeyi666/cart | /src/data/data.js | UTF-8 | 1,796 | 2.640625 | 3 | [] | no_license | const sendRequest = (url, method = 'GET', body = {})=>{
// 处理url,添加时间戳,保证每次请求不会被缓存
if (/\?/.test(url)){
url += '&_='+(+new Date());
}else{
url += '?_='+(+new Date());
}
let params = {method};
// 判断请求是否属于post请求
if (method == 'POST'){
params.body = JSON.stringify(body);
}
return fetch(... | true |
e8d54f61c1f5b464ae07e64d4435b7be7355a0cc | JavaScript | morita657/exercism | /word-count/word-count.js | UTF-8 | 454 | 3.234375 | 3 | [] | no_license | function Words() {
}
Words.prototype.count = function (input) {
var obj = {};
var str = input.replace(/ +/g, " ");
var counter = str.toLowerCase().split(/\s/g);
for (var i = 0; i < counter.length; i++) {
console.log(typeof counter);
var word = counter[i];
if (obj[word] === undefi... | true |
01990891c77961614a9b71c0592e343fe092cb8b | JavaScript | multivoltage/whosings | /src/core/actions/gameActions.js | UTF-8 | 2,194 | 2.65625 | 3 | [] | no_license | /***************************************************************/
import { UpdateMatches } from '../../ls'
import { buildSchema } from '../../api'
export const INIT_GAME = 'INIT_GAME'
export const NEXT_SONG = 'NEXT_SONG'
export const END_GAME = 'END_GAME'
export const STOP_GAME = 'STOP_GAME'
export const ANSWER_OK = '... | true |
2b61869a7e3016efcb7a1014326136276476c7b1 | JavaScript | keleslz/arcea | /assets/js/lib/option/Action.js | UTF-8 | 3,581 | 3.015625 | 3 | [] | no_license | import { Menu } from "./Menu";
/**
* @class contains all element event when right click
*/
export class Action extends Menu
{
constructor()
{
super();
this.options = this.optionList().className;
this.menu = document.querySelector('#option-menu');
let optionListName = this.... | true |
13441c736cea817a5c88370b544d33e5f9f915b0 | JavaScript | iconjone/learnGit | /quotes.js | UTF-8 | 5,617 | 2.515625 | 3 | [] | no_license | function get_random_inspiring_quote() {
var $blockquote = $(document.createElement("blockquote"));
var quote = INSPIRING_QUOTES[parseInt(Math.random() * INSPIRING_QUOTES.length)];
// $blockquote.append("\"" + quote.text + "\" — ");
quote.text.replace("'", "'");
var $q = $(document.createElement("q"));
... | true |
779863fb64ccbc2f4e10c987aed3a85dd37142e5 | JavaScript | ahijaouy/Horizons-Slackbot | /routes/routerHelper.js | UTF-8 | 3,855 | 2.859375 | 3 | [] | no_license | /********** File with Helper Functions for Routes.js (pronounced rOOOOtes) ***********/
const utils = require('../services/utils');
const calendar = require('../services/calendar');
const mongoose = require('mongoose');
const User = require('../models/user');
const Reminder = require('../models/reminder');
// create ... | true |
3e9b140681fc73d6e0b63c113ff8796048658666 | JavaScript | MaykonM/api-nasa-spa | /src/App.js | UTF-8 | 1,181 | 2.5625 | 3 | [] | no_license | import React, { useState } from 'react';
import './App.css';
import { connect } from 'react-redux';
import { getApod } from './actions';
function App(props) {
console.log(props);
const [date, setDate] = useState("");
return (
<div class="App">
<div class="header">
<img src="/assets/nasa.pn... | true |
aa491f3e33ffe38cef830fc5558261b2a831fc6b | JavaScript | imsamuel/js-dsa-masterclass | /09-challenging-recursion-problems/some-recursive.js | UTF-8 | 412 | 4.40625 | 4 | [] | no_license | // Write a recursive function called someRecursive which accepts an array and
// a callback. The function returns true if a single value in the array
// returns true when passed to the callback. Otherwise, it returns false.
const someRecursive = (arr, f) => {
if (arr.length === 0) {
return false;
}
if (f(ar... | true |
c7b13e937fe5e9f07f4032f7227fc8be8c76b42a | JavaScript | chase-abbott/code-challenges | /src/code-challenges/object-keys-entries/object-keys-entries.js | UTF-8 | 766 | 3.375 | 3 | [] | no_license | export function capitalizeObjectKeys(obj){
const array = Object.keys(obj);
return array.map(item => item.toUpperCase());
}
export function sortedKeys(obj){
const array = Object.keys(obj);
return array.sort((a, b) => {
if (a[0] > b[0]) return 1;
if (a[0] < b[0]) return -1;
return 0;
});
}
export ... | true |
33f6a7ab9ffbb2ba794bca5a7f46ff5d7270c869 | JavaScript | StupidCodeThief/js-assigments | /Homework-6/script.js | UTF-8 | 5,346 | 3.578125 | 4 | [] | no_license | // Task 1
// const camelize = str => {
// return str
// .split("-")
// .map(item => {
// return item.charAt(0).toUpperCase() + item.slice(1);
// })
// .join("");
// };
// console.log(camelize("background-color"));
// console.log(camelize("list-style-image"));
// console.log(camelize("-webkit-tr... | true |
d347b368e99fe150857da224adc0597cb440b1d0 | JavaScript | danidesalvio/dani-site | /client/src/components/pages/blog/Blog.js | UTF-8 | 1,464 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from "axios";
// this is where I'm getting a bit lost is with the front end CRUD actions
// and where to put axios or why we're using it, i need to go back and look
class Blog extends Component {
state= { blogs: [] };
... | true |
bc23d6551d3b134c04a8b14a2d4b29ef20778484 | JavaScript | rsbabcock/MovieListApp | /MovieListNative/api/AsyncManager.js | UTF-8 | 717 | 2.65625 | 3 | [] | no_license | import React from 'react';
import {
AsyncStorage,
} from 'react-native';
export async function saveUserId(userId){
try{
await AsyncStorage.setItem('userId', userId)
} catch (error) {
// Error retrieving Data
console.log(error.message)
}
}
export async function getUserId(){
... | true |
72f0d20f96d995cb9c6505fd65d42d0edbb80705 | JavaScript | knodejs/react-mui-sample-app | /components/StockInputSelector.js | UTF-8 | 1,301 | 2.53125 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
import AutoComplete from 'material-ui/lib/auto-complete.js';
import stockDB from '../data/mockStockDB';
class StockInputSelector extends Component {
constructor(props) {
super(props);
this.state = {
stockDB: stockDB.map(el => `${el.name} - ${el.ticke... | true |
04fe3959aabd7fc1bfbb7505115a146dd076e8a8 | JavaScript | david-martin/types-validator | /index.js | UTF-8 | 2,039 | 2.96875 | 3 | [] | no_license | var util = require('util');
var exceptionMessages = {
MISSING_CONFIG : 'The Config object is missing!',
MISSING_SCHEMA : 'The Schema object is missing!',
MISSING_CONFIG_SECTION : 'Config section %s missing!',
MISSING_CONFIG_FROM_SCHEMA : 'The config section %s is missing from the validation schema',
BAD_CONFI... | true |
418c7756cdc8a1fe0aaa9d652957e73957814467 | JavaScript | IrynaGr/Projects | /chatbot/src/reducers/messages.reducer.js | UTF-8 | 2,468 | 2.671875 | 3 | [] | no_license | import { findIndex } from 'lodash';
import { FETCH_MESSAGES_SCHEMA, SAVE_RESPONSE } from '../contstants/actionTypes';
const findCurrentIndex = (data, lastIndex) =>
findIndex(data, el => !el.text, lastIndex);
const templateToString = (template, data) =>
template.replace(new RegExp('\{([^\{]+)\}', 'g'), (e, dat... | true |
ecc02b14a69960521248b5d2ef2faecc20e847f5 | JavaScript | clamslam12/webapp_spring2021_covid_center | /ExpressJS/middleWares_Routes/main.js | UTF-8 | 1,578 | 3.09375 | 3 | [] | no_license | const port = 3000,
express = require("express"),
app = express();
//Middlewares
//To assist in reading the body contents, you add express.json and express.urlencoded to your app instance to analyze incoming request bodies.
//specifies that we want to parse incoming requests that are URL-encoded (usually, form po... | true |
ce735a610b27e19556684d7e57706556d50e6d14 | JavaScript | made-by-jonny/test-login | /__tests__/hooks/useForm.test.js | UTF-8 | 1,549 | 2.828125 | 3 | [] | no_license | import React from "react";
import "@testing-library/jest-dom";
import { render, fireEvent } from "@testing-library/react";
import useForm from "../../hooks/useform";
const mockData = {
email: "something@gmail.com",
password: "password123!!"
}
const FormComponent = ({onSubmit}) => {
const [submitAction] = ... | true |
7af9d6481be7e3f2dbc3be9486a09df1b44babd8 | JavaScript | Nayjest/H5FTBS | /js/decorator.js | UTF-8 | 3,176 | 3.5625 | 4 | [] | no_license | /**
* Javascript decorator.
* Usage examples:
* <code>
* var decorator = require('path/to/libs/decorator');
* decorator.decorateBefore(
* MyClass.prototype,
* 'methodName',
* function(){
* console.log('methodName call!');
* }
* );
* </code>
*
* @author Vitaliy [Nayjes... | true |