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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
84b3cac628b50d4d163e9b5ae77b6367f6e79c2a | JavaScript | shdwskip/JS-Fundamentals | /Exam Preparation/Practice Exam - 1 Oct - 14h/task3.js | UTF-8 | 369 | 2.921875 | 3 | [] | no_license | function solve(args) {
let signal = args[0],
result = [];
for (let i = 0; i < signal.length; i += 1) {
const current = signal[i];
const next = signal[i+1];
if (current == next) {
continue;
}
result.push(current);
}
console.log(result.join(''));
}
... | true |
c12bce5fba740ef4415488151b5a1683777870fd | JavaScript | RomaniukVadim/automatic-movies-website | /wp-content/themes/theme/includes/wp_booster/wp-admin/js/td_edit_page.js | UTF-8 | 3,450 | 2.671875 | 3 | [
"WTFPL"
] | permissive | /**
* used in wp-admin -> edit page, not on posts
* this class hides and shows the metaboxes acording to the selected template
* @type {{init: Function, show_template_settings: Function, change_content: Function}}
*/
var td_edit_page = {
init: function () {
jQuery().ready(function() {
... | true |
5136e2a799d75f5648ef09281564dd08f9c1c7ee | JavaScript | langyazhixue/react-antd-umi-dva-ts-pro | /src/pages/myStudy/classTest/index.jsx | UTF-8 | 3,483 | 3.328125 | 3 | [] | no_license | import React, { Component } from 'react';
import style from './index.less';
import yay from '@/assets/yay.jpg';
// class组件通常拥有状态和生命周期,继承于Component,实现 render 方法
// 组件状态管:如果组件中数据会变化,并影响组件内容,则组件需要拥有状态(state)并维护状态
// class组件使用state和setState维护状态
// setState(object nextState[, function callback])
// 不能在组件内部通过this.state修改状态,... | true |
1b1a5fb6ce14f6c13c68b55a88c8f0d1a25e56bc | JavaScript | nunodavid/redecoautorias | /core/givecommunityaname.js | UTF-8 | 2,779 | 2.59375 | 3 | [] | no_license | var CommunityNaming = function() { };
CommunityNaming.prototype.Calculate = function(authors) {
let commutiesAlreadyCalculated = new Array();
let self = this;
authors.forEach(function(author) {
let communityInContext = author.communityId;
if(commutiesAlreadyCalculated.indexOf(communityInContext) != -1)
... | true |
6fcf1f922705248ef875fd2f59751e4be0688086 | JavaScript | mgrzeszczak/polygon-editor | /resources/scripts/objects/relation.js | UTF-8 | 2,710 | 2.84375 | 3 | [] | no_license | app.relations = {
VERTICAL : 1,
HORIZONTAL : 2,
LENGTH : 3,
NULL : 4
};
app.relation = function(type,length){
this.type = type;
this.length = length;
this.apply = function(edge,vertex){
if (this.check(edge)) return;
var from = vertex;
var to = edge.to==vertex?edge.f... | true |
0a0dec48e6927cbbe88040e34cad4c0ce4002261 | JavaScript | cathcart/Advent-of-Code | /6/problem.js | UTF-8 | 532 | 2.9375 | 3 | [] | no_license | var fs = require('fs');
var lights = require("./lib/lights.js");
var file = './data.txt';
fs.readFile(file, 'ascii', function (err, data) {
if (err){ throw err;}
var lightGrid = new lights.Grid(1000,1000);
var lightGrid2 = new lights.Grid2(1000,1000);
dataArray = data.trim().split("\n");
dataArray.map(func... | true |
8e844619a3229cc0a2281a11942dea607d66b389 | JavaScript | nshen/loaders.gl | /modules/gltf/test/lib/deprecated/packed-json/pack-binary-json.spec.js | UTF-8 | 2,198 | 2.515625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | /* eslint-disable max-len */
import test from 'tape-promise/tape';
import {GLTFBuilder, packBinaryJson} from '@loaders.gl/gltf';
const inputJSONTypedArraysMixed = {
slices: [
{
primitives: new Int8Array([3, 2, 3])
},
{
primitives: new Uint16Array([6, 2, 4, 5])
},
{
primitives: ... | true |
f63f14788a3791799d5ef313642216b29d092efe | JavaScript | BuildingCityDashboards/bcd-dd-v2.1 | /public/javascripts/hide_subnav_on_scroll.js | UTF-8 | 430 | 2.890625 | 3 | [
"MIT"
] | permissive | /* When the user scrolls down, hide the navbar. When the user scrolls up, show the navbar */
var prevScrollpos = window.pageYOffset
window.onscroll = function () {
const subnav = document.querySelector('.themes__subnav')
var currentScrollPos = window.pageYOffset
if (prevScrollpos > currentScrollPos) {
subnav.... | true |
d3a658f45f379c34ba35388ef4c3d24cbf3d68c9 | JavaScript | Alex-aka-ion/ra16-diploma-solution | /src/components/SafeImage.jsx | UTF-8 | 438 | 2.546875 | 3 | [] | no_license | import React, {useState} from "react";
export default function SafeImage(props) {
const [imgLink, setImgLink] = useState(props.src);
const [errored, setErrored] = useState(false);
const handleError = (e) => {
if (!errored) {
setImgLink('/img/no-image.png');
setErrored(true)... | true |
0a3c9c4bf0ddc1ce15caf8955856507937261bfe | JavaScript | Voldemat/react-learn | /src/store/reducers/userReducer.js | UTF-8 | 544 | 2.578125 | 3 | [] | no_license | const initialState = {
"id":null,
"token":"c84075889cb5ecc765f317b4415178b58da6249e",
"email":"you@email.com",
"avatar":"/media/users/avatars/joseph-barrientos-tT6hv8y4Iz8-unsplash_1.jpg"
}
function userReducer(state = initialState, action){
switch(action.type){
case "SET":
retu... | true |
9539c080140f437462af72db4f3c542846138de5 | JavaScript | AnaBucur0/clock | /script.js | UTF-8 | 1,374 | 3.625 | 4 | [] | no_license | function currenttime(){
var date = new Date;
var timenow = document.getElementById('nowclock')
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
if (hours<=9){
hours = "0"+hours
}
if (minutes<=9){
minutes = "0"+minutes
}
... | true |
1f8f4920f88a6972e9f9bed9e87d69875aa0ac97 | JavaScript | MaxPecsko/data-structures | /Algorithms/Sort/Elementary/InsertionSort.js | UTF-8 | 326 | 3.625 | 4 | [] | no_license | function insertionSort(arr) {
const swap = (arr, inx1, inx2) => {
return ([arr[inx1], arr[inx2]] = [arr[inx2], arr[inx1]]);
};
for (let i = 1; i < arr.length; i++) {
for (let j = i - 1; j >= 0; j--) {
if (arr[j] < arr[j - 1]) swap(arr, j, j - 1);
}
}
return arr;
}
insertionSort([5, 3, 1, 2,... | true |
cb0a46cc8ff7ff6d9fcaa3ba3ffd30116bd638e5 | JavaScript | clementgng/robofriends | /src/components/card.js | UTF-8 | 1,021 | 2.75 | 3 | [] | no_license | import React from 'react';
//hello
// you can only return 1 element
const Card = props => {
const { name, email, id } = props;
return (
<div className='tc bg-light-blue dib br4 pa2 ma3 grow-large bw5 shadow-5'>
<img
alt='robots'
src={`https://robohash.org/${id}`}
width='200'
... | true |
3b09bf47a08ee42bd1c971ce5c69e4a289b5e79c | JavaScript | etezare/MWA | /Labs/Lab2/question2/api/controllers/sum.controllers.js | UTF-8 | 281 | 2.953125 | 3 | [] | no_license | module.exports.sumNumber=function(req,res){
var num1=parseInt(req.params.number);
var num2=parseInt(req.query.number2);
var sum=num1+num2;
var total="sum of "+num1+" + "+num2+" = "+sum;
console.log("Sum of number is ",total);
res.status(200).json(total);
}
| true |
abe021b7c953a7bd911ac1238658719ee5c78149 | JavaScript | aramadsanar/nodejs-masterclass | /lib/logs.js | UTF-8 | 4,029 | 2.578125 | 3 | [] | no_license | var fs = require('fs');
var path = require('path');
var zlib = require('zlib');
var lib = {};
lib.baseDir = path.join(__dirname,'/../.logs/');
lib.append = (file, str, callback) => {
//open the file for appending
fs.open(lib.baseDir+file+'.log', 'a', (err, fileDescriptor) => {
if (!err && fileDescr... | true |
210a4ffa459628d25bb9b286b6022a55422a224e | JavaScript | wwl0409/haier | /dist/js/toEnlarge.js | UTF-8 | 1,389 | 2.578125 | 3 | [] | no_license | $(function(){
$('.js_img').mouseenter(function(){
// var wValue=1.5 * $(this).width();
// var hValue=1.5 * $(this).height();
$(".js_line").css("backgroundColor", "#0c5ca8");
$(this).stop().animate({width: "500",
height: "500",
left:"0... | true |
f2e35f9b6c290497970234ecb3970b1b60683675 | JavaScript | Odis22/TG-Pre-Work | /Code-Academy-Exercises/Introduction-To-JavaScript/Functions/Function-Declaration.js | UTF-8 | 243 | 3.078125 | 3 | [] | no_license | function getReminder() {
console.log('Water the plants');
}
function greetInSpanish() {
console.log('Buenas Tardes');
}
/* a function declaration consist of the function keyword,
its function name and the block of statements in its brackets
*/ | true |
d3303d3c7257f91677cd626333e567842a9d02e6 | JavaScript | Cyclone3DR/Scripts | /Pavement Inspection/PavementInspection-CreateLines.js | UTF-8 | 2,525 | 2.984375 | 3 | [] | no_license |
//be sure the user has selected a mesh and a polyline ++++++++++++++++++++++++++
var testForMesh = SPoly.FromSel()
if (testForMesh.length != 1)
throw new Error('No mesh selected.\nSelect a mesh and run the script again!');
var testForOnePoly = SMultiline.FromSel();
if ((testForOnePoly.length == 0) || (testFor... | true |
6a06d1990d4bff5c42ffc5a986c1248071f651c1 | JavaScript | TheDazedGaming/myMaple | /scripts/npc/world0/9201099.js | UTF-8 | 1,904 | 2.71875 | 3 | [
"MIT"
] | permissive | var status;
var selectedItem;
var items = [[2050004, 400], [2050000, 200], [2020012, 4500], [2020013, 5000], [2020014, 8100], [2020015, 9690], [2050001, 200], [2050002, 300], [2050003, 500], [2022000, 1650], [2002017, 5000], [2060004, 40000], [2061004, 40000], [2070010, 2000], [2022003, 1100], [2022177, 620], [2022002... | true |
99a465f7fee220a63cc6f03f0efd1508a9a1eaa0 | JavaScript | bohgman/DIVIMA | /public/js/v/visits.mjs | UTF-8 | 11,648 | 2.859375 | 3 | [] | no_license | /***************************************************************
Import classes, datatypes and utility procedures
***************************************************************/
import Visit from "../m/Visit.mjs";
// import Visitor from "../m/Visitor.mjs";
import Location from "../m/Location.mjs";
import {
fillSel... | true |
dbe9d810fa0039f62667d7fccd6e2ee962a3767f | JavaScript | MarcoSchaerfCourses/final-project-for-interactive-graphics-course-monkey-go | /game.js | UTF-8 | 22,988 | 2.53125 | 3 | [] | no_license | //html object
var restartButton = document.getElementById("restartButton");
var infoPasses = document.getElementById("passes");
var infoLife = document.getElementById("heart");
var infoBanana = document.getElementById("banana");
var infoGameOver = document.getElementById("gameOver");
var infoPause = document.getE... | true |
5e781af4f1a848de2b5624e0c7bf1c3ed83f1fad | JavaScript | mbentro/modern-javascript | /objects/objects-methods.js | UTF-8 | 666 | 3.703125 | 4 | [] | no_license | let restaurant = {
name: 'Raw Bar',
guestCapacity: 75,
guestCount: 0,
//a method is an object property whose value is a function
checkAvailability: function (partySize) {
let seatsLeft = this.guestCapacity - this.guestCount
return seatsLeft >= partySize
},
seatParty: function(partySize) {
... | true |
02cffbc7b2f1b326b125ddfdcbdf8b19c0b962cc | JavaScript | priyank99/hostel-portal | /models/parent.js | UTF-8 | 1,705 | 2.59375 | 3 | [] | no_license | var mongoose = require("mongoose");
var bcrypt = require('bcryptjs');
var parentschema = new mongoose.Schema({
username : String,
sid : {
type : mongoose.Schema.Types.ObjectId,
ref : 'Student'
},
name : String,
dob: Date,
password : String,
mobNo : String,
address : String,
emailID : String,
... | true |
18a419665d894a975704a85d32805e6dff91f002 | JavaScript | wurichengn/Elevator-sandbox | /js/index.js | UTF-8 | 7,552 | 2.6875 | 3 | [] | no_license | !function(){
//模拟核心
var mains;
//游戏参数
var gameData = {
//楼层数
floor:2,
//电梯数
e:1,
//电梯承载的人数
Emax:4,
//客户出现间隔
cd:60
};
//电梯组
lcg.bind("floors",function(){
//初始化Dom
this.initAll();
var self = mains = this;
//初始化楼层
this.floors = [];
this.initFloor = function(data){
this.floors = []... | true |
b633763fb99e821cb64bfe1fa9c101821c8c278a | JavaScript | emilia-m26/explore_final | /explore-frontend/src/components/Country.js | UTF-8 | 2,214 | 2.625 | 3 | [] | no_license | import React from 'react';
import { Link } from 'react-router-dom'
import Card from 'react-bootstrap/Card'
import Button from 'react-bootstrap/Button'
import CardDeck from 'react-bootstrap/CardDeck'
import 'bootstrap/dist/css/bootstrap.min.css';
const Country = ({country}) => {
console.log(country)
return (
... | true |
24e8ad4611100aa233898a6d80ba4c8b2aab67f3 | JavaScript | Nozbe/zacs | /src/legacy-runtime-styling/zacsify.js | UTF-8 | 9,789 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // How to run this codemod:
// npx jscodeshift -t bin/codemods/zacsify.js app/components app/pages && yarn prettier
function isStyledComponentDefinition(node) {
const { callee } = node
if (callee.type !== 'Identifier') {
return false
}
const { name } = callee
return (
name === 'view' ||
name ==... | true |
f137a26d00207026527971be26e02b0a53e68216 | JavaScript | gorzata-o/clock | /js/app.js | UTF-8 | 564 | 3.34375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function () {
var secondsHand = document.querySelector(".seconds");
var minutesHand = document.querySelector(".minutes");
var hoursHand = document.querySelector(".hours");
var now = new Date();
var setupClock = function() {
var secs = now.getSeconds();
var mins... | true |
81ee7bb551e65936cbacd5b7b3b74a807a9f25db | JavaScript | InSecker/quiprendquoi | /scripts/socket.js | UTF-8 | 2,636 | 2.59375 | 3 | [] | no_license | const io = require('./socket.io');
const socket = io('http://' + window.location.hostname + ':3001');
const form = document.querySelector('.form.items');
const partyID = window.location.pathname.replace('/party/', '')
socket.on('response', (items) => {
const $items = document.querySelectorAll('.item')
for (let i = ... | true |
037e820acdccd01fc5ad6f18ceb3611624f8b9a2 | JavaScript | shannonjen/SCC_2016 | /w2d2/if_else_ex/script.js | UTF-8 | 1,242 | 4.59375 | 5 | [] | no_license | // if else
// if (false) {
// console.log("This is my if");
// } else {
// console.log("This is my else");
// }
// # Exercises
// - Write a conditional that checks if a variable is less than 10. If
//it is, alert the user that their variable is less than 10. If it is not,
// let the user know what the variable w... | true |
8e094e316164ca3a8fd3b39b701e5170b5afc5d9 | JavaScript | brendanusa/codeFights | /simplifyPath.js | UTF-8 | 1,122 | 3.296875 | 3 | [] | no_license | function simplifyPath(path) {
let newPath = '';
let dir = 0;
let i = path.length - 1;
if (path[i] !== '/') {
i++;
path += '/';
}
const checkCharacter = () => {
if (i < 0) {
return;
}
if (path[i] === '/' && path[i - 1] && path[i - 2] && path[i - 1] === '.' && path[i - 2] === '.... | true |
b1586c16fd30071d9d52ba7b515ea68127be822a | JavaScript | IscoCuesta/RoutinesAPP | /scripts/routineplayer.js | UTF-8 | 10,514 | 2.640625 | 3 | [] | no_license | var config = {
apiKey: "AIzaSyC-ZLRM_MXbFLVFfHBN0XViz_46CHTmUMU",
authDomain: "zoezi-74ea6.firebaseapp.com",
databaseURL: "https://zoezi-74ea6.firebaseio.com",
projectId: "zoezi-74ea6",
storageBucket: "zoezi-74ea6.appspot.com",
messagingSenderId: "413250730618"
};
firebase.initializeApp(config);
var datab... | true |
5d36e7d65acb076710f9c30201e9422ea556580d | JavaScript | Phillyboi/oaktest-1 | /003.js | UTF-8 | 1,365 | 3.359375 | 3 | [] | no_license | var questions = $('.question');
function createQuestion (n) {
var qn = $(questions[n]);
qn.hide();
qn.submit(function (ev) {
ev.preventDefault();
console.log("Testing for whole number working...");
var theirAnswer = eval(qn.find('.answer').val());
console.log("Their... | true |
6c78a1cf537c94b141c3ed07e99ed1905b8c9729 | JavaScript | ITP-Mashups/Mashups | /05_Structuring_Your_App/WikiSearch/Example_1/wiki_ex1_script.js | UTF-8 | 2,455 | 4.0625 | 4 | [] | no_license | /*
Modified from:
NYU - MASHUPS CLASS
gihtub.com/craigprotzel/Mashups
WIKIPEDIA SEARCH - EXAMPLE #1
Wikipedia API Reference - http://www.mediawiki.org/wiki/API:Main_page
This example will immediately search Wikipedia for entries with the word "dogs"
And then populate those results on the page using jQuery
*/
var ap... | true |
1b39233c332009efaf19fb8986c34a743823365e | JavaScript | capsocrates/hs-online-v2 | /scripts/hsonline-action.js | UTF-8 | 2,698 | 2.9375 | 3 | [] | no_license |
function diceRoller(dice)
{
//Display symbols if Valkyrie dice are checked
if ($("#valDice").attr("checked")) {
valDice = 1;
} else {
valDice = 0;
}
$.post("rolldice.php", { roll: dice, val: valDice } );
}
function diceRollerD(dice)
{
//Dislay symbols if Valkyrie dice are checked
if ($("#valD... | true |
82954e1ea431459178fc69460583012bc9c10af9 | JavaScript | SERPANT/SERPANT.github.io | /partical Engine/SinWave Smoke/js/index.js | UTF-8 | 3,177 | 3.640625 | 4 | [] | no_license | /**
* Class of Sin Tree.
*/
class SinTree {
/**
* Constructor method.
*/
constructor(canvas) {
this.canvas = canvas;
this.canvasWidth = canvas.width;
this.canvasHeight = canvas.height;
this.context = canvas.getContext("2d");
this.time = 0;
this.period = 80;
this.zPosition = 0;
... | true |
dcb6313edd22e9abce660ab8c5a4a0b4d6d85d9b | JavaScript | postNuKe/kraken-php | /public/js/sticky-functions.js | UTF-8 | 881 | 2.84375 | 3 | [] | no_license | var edited = function(note) {
//alert("Edited note with id " + note.id + ", new text is: " + note.text);
$.get('notes/edit',{
id : note.id,
text : note.text,
x : note.pos_x,
y : note.pos_y,
w : note.width,
h : note.height
});
}
var created = function(note) {
//alert("Created note w... | true |
2b1ebbcaa703f4fa162be582816ca498b27c3cfb | JavaScript | chrisboaks/algorithmsjs | /source/dataStructures/TEST/binarySearchTree.js | UTF-8 | 6,655 | 3.390625 | 3 | [] | no_license | const assert = require('chai').assert;
import { Node, Tree } from '../binarySearchTree';
describe('Node', () => {
// manually construct a tree out of nodes
const two = new Node(2);
const threeA = new Node(3);
const threeB = new Node(3, two, threeA);
const nine = new Node(9);
const thirteen = new Node(13,... | true |
aacb2c03ead18b42e3532ccb7a05d6a8cb63f980 | JavaScript | Eduardo-html/1-_TESTE_NODE.JS | /parOuImpar.js | UTF-8 | 171 | 2.71875 | 3 | [] | no_license | module.exports = function parOuImpar(n){
if(!Number.isInteger(n)){
return 'impossivel';
}
if(n%2==0) return 'par';
if(n%2==1) return 'impar';
} | true |
47306e8715b8a1c80847d259d3bdbb1562b01dfd | JavaScript | mraak/non_brute_force | /cv-test/diff.js | UTF-8 | 1,683 | 2.78125 | 3 | [] | no_license | var streaming = true;
var video;
function init() {
// video.removeEventListener("play", tryInit);
let cap = new cv.VideoCapture(video);
let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(5... | true |
0e09db7adc77d6e9600a9e901b602190597970f7 | JavaScript | KimSiHun/ftftf | /HateCouple/src/main/webapp/resources/js/index.js | UTF-8 | 14,586 | 2.65625 | 3 | [] | no_license |
$(document).ready(function() {
//정보표시 구역(두번째)으로 이동
$("#go").click(function() {
if ($('#sample6_address').val() == ''){
alert('주소를 입력해주세요');
location.href="/hate";
}else{
var addr = document.getElementById('sample6_address').value;
document.getElementById('search_addr').value = ... | true |
fa2e7b9bdd1b6ed0708d0956f19f441bf616133b | JavaScript | ALHellen/semana-3 | /exercicio13.js | UTF-8 | 598 | 4.03125 | 4 | [] | no_license | let num1 = 4;
let num2 = 2;
let operacao = 'mais';
if(operacao == 'mais'){
let resultado = 4 + 2;
console.log('O resultado da soma é: ' + resultado);
}
else if(operacao == 'menos'){
let resultado = 4 - 2;
console.log('O resultado da subtração é: ' + resultado);
}
else if(operacao == 'multiplicacao'){
let resultado = ... | true |
d400ac5d5b9dbc70e7db6dfc10bed95568531eec | JavaScript | akber4747/todo-angular | /main.js | UTF-8 | 1,068 | 3.5 | 4 | [] | no_license | function ToDoCtrl($scope){
//initialize todo list
$scope.todos = [
];
// function to add to the list
$scope.addTodo = function(){
var newTodo = {
done: false, text: $scope.todoText
};
$scope.todos.push(newTodo);
$scope.todoText = "";
};
//function to remove from the lists
$scope.removeTodo = funct... | true |
e9bb66dd6a0b8f457bb6344181fd0ca2676230d0 | JavaScript | JesonRondo/webc-framework | /src/clz/text-node.js | UTF-8 | 431 | 2.921875 | 3 | [] | no_license | export default class TextNode {
constructor (text) {
this.data = text
this.type = 'text'
this.nodeType = 3
this.parent = undefined
}
get parentNode () {
return this.parent
}
get nextSibling () {
if (!this.parent) {
return null
} else {
const siblings = this.parent.chi... | true |
36c6fedd8fec1e50c22fee94ca20080e5d579d0e | JavaScript | minseokim/data-structures-tdd | /solution/BinaryHeapSolution.js | UTF-8 | 3,337 | 3.75 | 4 | [] | no_license | const Heap = function() {
this._storage = [];
this._size = 0;
};
Heap.prototype.swap = function(index1, index2) {
let temp = this._storage[index1];
this._storage[index1] = this._storage[index2];
this._storage[index2] = temp;
};
Heap.prototype.hasLeftChild = function(index) {
return this.getLeftChildIndex(in... | true |
6b8bdd092efe7e1ab99bb55559f8bffb48d18a9b | JavaScript | ProxN/code-katas | /katas/ep5/6kyu-digital-root.js | UTF-8 | 935 | 4.1875 | 4 | [] | no_license | /**
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
Kata Link: https://www.codewars.com/kata/541c8630095125... | true |
4cdd508af699757bd1e50aeb723fa02ac4bb47f7 | JavaScript | DemonDaddy22/30DaysOfJS | /DevToolsTricks/index.js | UTF-8 | 2,110 | 3.484375 | 3 | [] | no_license | const greenPara = document.getElementById('green');
let toggle = false;
function makeGreen() {
toggle = !toggle;
greenPara.style.color = toggle ? '#BADA55' : '#000000';
greenPara.style.fontSize = toggle ? '50px' : '16px';
greenPara.style.backgroundColor = toggle ? '#000000' : '#BADA55';
}
greenPara.ad... | true |
c98e4d472775473815644bab7080963a1962d50c | JavaScript | omegajudith/profile | /personal/judith.toyota/server.js | UTF-8 | 2,342 | 2.78125 | 3 | [] | no_license |
/*dependencies */
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var cors = require('cors');
const mariadb = require('mariadb');
app.use(cors());
/*db connection */
const pool = mariadb.createPool({
host: 'localhost',
user:'judith',
password: '',
... | true |
9378ef0346487c6188046a686e529dd39389b4c3 | JavaScript | code2heal/nodeproject_course | /server1.js | UTF-8 | 1,212 | 2.859375 | 3 | [] | no_license | const express = require('express');
var app = express();
//make a reqquest to a server
//From Localhost:3000.... Navigate To public/help.html
app.use(express.static(__dirname + '/public')); // __ double underscore dirname etc.
app.get('/', (request, response)=>{ // '/'..signifies tshe home page
//Request....e.g re... | true |
b150200ce43ace3aaa8eaff68c576dfa461467ec | JavaScript | alexgouveiadearaujo/buttonCreator | /script.js | UTF-8 | 1,613 | 2.890625 | 3 | [] | no_license | const controls = document.querySelector('#controls');
const cssTxt = document.querySelector('.css');
const btn = document.querySelector('.btn');
const range = document.querySelectorAll('input[type="range"]');
range.forEach(i=>{
i.value = 0;
});
controls.addEventListener('input' , handleChange);
const handleStyl... | true |
dc8b3304373b6ddb794dfe97e0fc1de5eb796c42 | JavaScript | linode/developers | /search/buildIndex.js | UTF-8 | 1,387 | 2.6875 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const _ = require("lodash");
const md5 = require("md5");
const buildAlgolia = require("./buildAlgolia");
require("dotenv").config();
// This assumes the version of the spec in data/ is the current version
const spec = require("../static/api/docs/v4/spec.json");
const BASE_URL = "https://deve... | true |
9aa75409059c874fdd44f1b7eb436e1e7177df08 | JavaScript | jyothi11lak/react-advanced | /src/App.js | UTF-8 | 398 | 2.921875 | 3 | [] | no_license |
import React, { useEffect, useState } from 'react';
function App() {
const [user, setUser] = useState(["a"]);
useEffect (()=>{
console.log("hi");
}, [user])
return (
<div>
{user}
<p>
Enter your name
</p>
<input
value={user}
onChange={(e) => se... | true |
c55cc6ba9f6059c90853c554a1028f0537ae8624 | JavaScript | Cheyzie/Django_tutorial | /polls/static/polls/scripts/results.js | UTF-8 | 632 | 3.359375 | 3 | [] | no_license |
var elements = document.getElementById('ul1').getElementsByTagName('li').length;
var values = [];
for (let i = 1; i <= elements; i++) {
values[i-1] = document.getElementById("res"+i).value;
}
Array.prototype.max = function() {
return Math.max.apply(null, this);
};
var sum = 0;
for (let i = 0; i < values.length; i... | true |
0d2ce011b0b13bd5bdd0f75be51da2064319685f | JavaScript | PredragBelos/Final-project-BIT | /src/components/Search box/searchBox.jsx | UTF-8 | 1,052 | 2.84375 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import './css/searchBox.css';
const SearchBox = ({candidatesData, setFilteredCandidates}) => {
//STATE
const[searchInput, setSearchInput] = useState("");
//LIFECICLE
useEffect(()=> {
setSearchInput(document.querySelector(".srcInput"));
}... | true |
caf8936eddfea9d4df20ffb903c5bbe39b9f0a78 | JavaScript | arlei/proyecto_pappcorn | /js/papp.js | UTF-8 | 14,812 | 2.609375 | 3 | [
"MIT"
] | permissive |
// CLIENTE
function consultar_clientes(){
html = '<div class="col-lg-12 text-center"> <img src="imagenes/carga.gif"/> </div>'
$("#contenido_principal").html(html);
$.ajax({
data: "",
type: "POST",
dataType: "json",
url: "consultar_cliente.data.php",
success: function(data){
var html... | true |
e4256efb6f4781ff80a68e2a4687532a87501341 | JavaScript | VladislavLinnik/starting-templates | /Snippets/Сниппеты jQuery/validDate.js | UTF-8 | 1,915 | 3.515625 | 4 | [] | no_license | // Эффективная проверка даты
// Наличие библиотеки даты очень часто является достаточно простым и не достаточным для расширенного форматирования.
// Хотя существует множество библиотек JS, которые упрощают работу с датами, иногда простой код, позволяет проверять введенную дату.
// В этом случае можно использовать сл... | true |
9bdba143bc3b8e1f712151263c1346d6bdd7fb1e | JavaScript | ferchapag/ferchapag.github.io | /rv/torre.js | UTF-8 | 1,006 | 2.734375 | 3 | [] | no_license | var puntos = [];
for(var i = 0; i<10; i++){
puntos.push(new THREE.Vector2(Math.sin(i*0.2)*1+10,(i)*2));
}
var material=new THREE.MeshNormalMaterial();
var rev=new THREE.LatheGeometry(puntos);
var base= new THREE.Shape();
base.moveTo(10,10);
base.lineTo(20,10);
base.lineTo(20,20);
base.lineTo(10,20);
base.lineTo(10,... | true |
bd33d26615838b10acf8e32b933d14c4dcf60792 | JavaScript | colakang/market_nyis_php_ui | /src/userDashboard/component/Profile.react.js | UTF-8 | 2,387 | 2.53125 | 3 | [] | no_license | /**
* Created by Shaochen on 1/3/2017.
*/
import React from 'react';
import * as ProfileService from '../service/ProfileService';
import {invokeProfileBasicModal, invokeProfileAddressModal} from '../utils/global';
let ProfileCard = ({title, entries, onEdit}) => {
function handleClick() {
onEdit();
}
retur... | true |
2db0c779402c86b83ffd9959d7679e830aad1780 | JavaScript | mackay218/React_feedback_form | /src/components/Comments/Comments.js | UTF-8 | 2,249 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import axios from 'axios';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
class Comments extends Component {
constructor(props) {
super(props);
this.state = {
... | true |
fafb764330f2d669d3ee60bbb189b446264f14b0 | JavaScript | ShopThoiTrang/DA2_ShopThoiTrang | /shopOnline/src/main/webapp/resources/js/ourjsfile.js | UTF-8 | 800 | 2.515625 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function checksize(size) {
if (size == 0)
alert("giỏ hàng trống");
else {
$.ajax({
type: 'POST',... | true |
d4e4fd03c29a31c2b3b4598dcb446a116c23ffec | JavaScript | rryanwatson/Micro-Picker | /microPicker.js | UTF-8 | 5,295 | 2.6875 | 3 | [
"MIT"
] | permissive | var microPicker = (function() {
var htmlCollection;
var canvas;
var context;
var iData;
var topPickedColor = {r:255,g:0,b:0};
var pickedColor = {r:255,g:0,b:0};
var canvasWidth;
var canvasHeight;
var layout;
var topHeight;
var colorPickedRectWidth;
var userElement;
... | true |
f7a010a180b5eaf1b4846c1800d52d86f0fc03bf | JavaScript | Unn4m3DD/JogosRetroSocketIO | /server/Snake.js | UTF-8 | 2,808 | 3.09375 | 3 | [] | no_license | module.exports = class Snake {
constructor(id, width, height) {
this.width = width
this.height = height
this.id = id
let middle = { x: Math.floor(width / 2), y: Math.floor(height / 2) }
this.snake = [{ x: middle.x - 1, y: middle.y }, middle, { x: middle.x + 1, y: middle.y }]
this.apple = this.... | true |
e5fbc34bdf1c395a2e8cce01ad8f22f7690a400a | JavaScript | hamsarajpitani/blog-app-mern | /backend/middleware/auth.js | UTF-8 | 513 | 2.53125 | 3 | [] | no_license | const jwt = require('jsonwebtoken')
exports.auth = async (req,res,next)=>{
try {
const authheader = req.headers['authorization'];
const token = authheader && authheader.split(" ")[1];
if(!token) return res.json({msg:"please signin before doing this"});
jwt.verify(token,'doremon',(... | true |
ac7dbc25dc86aa31f3172c4ba51ca165d1e5a791 | JavaScript | pw-andy/experimental | /backbone_images/requestHandlers.js | UTF-8 | 3,127 | 2.546875 | 3 | [] | no_license | var fs = require('fs');
var path = require('path');
var qs = require('querystring');
var counter = 1;
function start(request, response, postData) {
console.log("Request handler 'start' was called");
var body = '<html>' +
'<body>' +
'<form action="/upload" method="post">' +
'<textarea name="text" rows="20" ... | true |
1822b4a581456a5afa102ce9264d66138efbbc51 | JavaScript | Jitgitbit/whatez-client | /src/components/restAPI/NOTINUSEAdditivesCategory.jsx | UTF-8 | 1,481 | 2.578125 | 3 | [] | no_license | //FRONTEND OPTION FOR THIRD PARTY API, NOT RECOMMENDED !
import React, { Component } from 'react'
import axios from 'axios'
export default class AdditivesCategory extends Component {
state ={
additivesCategory: null
}
componentDidMount(){
console.log(`=========>> PROPS in Category:`,this.props)
le... | true |
85cfb5cea0ad7f153b8e90676371bcf7ff9ef9e2 | JavaScript | git-sgmoore/flat-demo-bitcoin-price | /postprocess.js | UTF-8 | 1,200 | 3.1875 | 3 | [
"MIT"
] | permissive | // This can be a typescript file as well
// Helper library written for useful postprocessing tasks with Flat Data
// Has helper functions for manipulating csv, txt, json, excel, zip, and image files
import { readJSON, writeJSON, removeFile } from 'https://deno.land/x/flat@0.0.11/mod.ts'
// Step 1: Read the downloade... | true |
90efd4a0f4ccb67659c5d2a6ffacbc89c3b0de9f | JavaScript | michalzelewski/NODEwpg | /JAVASCRIPT/index59.js | UTF-8 | 312 | 4.0625 | 4 | [
"MIT"
] | permissive | const firstNumber = 7;
const secondNumber = 69;
if (firstNumber === secondNumber) {
console.log(`They are the same number`);
} else if (firstNumber > secondNumber) {
console.log(`${firstNumber} is bigger than ${secondNumber}`);
} else {
console.log(`${secondNumber} is bigger than ${firstNumber}`);
} | true |
ece2dc1ff5c7b3d0678eeb0e1fb9e1667190adc8 | JavaScript | USERCALL/AngularJuego | /app/views/flappy/js/Juego.js | UTF-8 | 2,500 | 2.765625 | 3 | [] | no_license | var fondo;
var tubos;
var pajaro;
var luna;
var salto;
var timer;
var puntos;
var txtpuntos;
var Juego= {
preload: function(){
juego.load.image('fondo', '../img/paisaje.png');
juego.load.spritesheet('pajaro1', '../img/pajaro.png', 78, 80);
juego.load.spritesheet('tubo', '../img/tubo1.png');... | true |
b96787180fd79f3dc25ba8698609c76ed378cfc3 | JavaScript | lomithrani/E-protect | /SI/eProtectFinal/bridge.js | UTF-8 | 1,859 | 2.578125 | 3 | [] | no_license | //library to connect to sailsjs websockets
var socketIOClient = require('socket.io-client');
//var sailsIOClient = require('sails.io.js');
//library to do the tcp server
var net = require('net');
var server = net.createServer(function(tcpSocket) { //'connection' listener
//socket... | true |
6a80a7764a7da4604ef00af18053d194df3ced51 | JavaScript | torislocke/WDD330 | /W07/hiking/hikeClass.js | UTF-8 | 362 | 2.640625 | 3 | [] | no_license | // Set up the hike class
class Hike {
constructor(id, name, imgSrc, imgAlt, distance, difficulty, description, directions) {
this.id = id;
this.name = name;
this.imgSrc = imgSrc;
this.imgAlt = imgAlt;
this.distance = distance;
this.difficulty = difficulty;
this.description = description;
this.direction... | true |
5c690314153c2fca2247c3dffe14a3f7f8c06af8 | JavaScript | kpmdevgr/OnsenUI | /react-onsenui/src/oneTimeProp.jsx | UTF-8 | 1,162 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import React from 'react';
// For a prop with name `defaultProp`, sets the component's `prop` prop to the
// value of `defaultProp` when the component mounts only.
//
// For example, Input has a defaulttValue prop that should set the inner input's
// value when the component mounted and do nothing afterwards.
const on... | true |
5d960e8be916c4072d15da3f19b02c38c158d2c0 | JavaScript | OhhMihawk/OhhMihawk.github.io | /envoyer vers une autre page/EX8-2/js/script2.js | UTF-8 | 416 | 2.78125 | 3 | [] | no_license | var decoupage = "=";
var lien = location.href.split("?");
var partienombre = lien[1].split("&")[1].split(decoupage)[1];
var partietext = lien[1].split("&")[0].split(decoupage)[1];
var nombre = document.getElementById("nombrereponse");
var texte = document.getElementById("textereponse");
texte.innerHTML = "Votre Text e... | true |
a49ffba72b1ea13fb99cd99eaf7817c44a4fab12 | JavaScript | iwebexpert/corp-rostelecom-1 | /sml/lesson7/src/Good.js | UTF-8 | 1,175 | 3 | 3 | [] | no_license | /**
* @class Good - Класс Продукт, описывает товары продаваемые в магазине
* @var id - идентификатор продукта
* @var quantity - количество в корзине или на складе
* @var price - цена продукта
* @var currency - валюта
* @var name - наименование продукта
* @var imgLink - ссылка на картинку продукта
*/
class Good... | true |
1b480f2bf5aac12ba87b6c0b3379cd5d095915b3 | JavaScript | kkaufholdcodes/udemy-webdev-course | /week-6/Days-of-Week/index.js | UTF-8 | 336 | 3.671875 | 4 | [] | no_license | // DEFINE YOUR FUNCTION BELOW:
function returnDay(num) {
const daysOf = {
1: "Monday",
2: "Tuesday",
3: "Wednesday",
4: "Thursday",
5: "Friday",
6: "Saturday",
7: "Sunday",
}
if (daysOf[num]) {
return daysOf[num];
} else {
retur... | true |
732b02181e64062bfdac2b03b50669e3eb8fd268 | JavaScript | Reahana/JavaScript_Basic | /chapter_two/typeConversion.js | UTF-8 | 565 | 4.09375 | 4 | [] | no_license | var str ='10000'
var n =10
console.log(str);
console.log(n);
console.log(Number.parseInt(str));
console.log(n.toString());
console.log(Infinity);
console.log(Boolean(Infinity));
console.log(Boolean(-Infinity));
//Falsy Value
''
0
null
undefined
NaN
console.log(Boolean(''));
console.log(Boolean('wegtwefe'));
con... | true |
ee0d041ffc73100c0bb31e36da794e4b6c39c8fc | JavaScript | ubc-farm/ribbon-toolbar | /src/tablist/Tab.js | UTF-8 | 704 | 2.53125 | 3 | [] | no_license | import { createElement, PropTypes } from 'react'; /** @jsx createElement */
/**
* Defines a tab in the ribbon
* @param {ReactNode} props.children
* @param {any} props.id
*/
export default function Tab({ children, id, onClick, selected }) {
const handleClick = onClick ? onClick.bind(undefined, id) : undefined;
re... | true |
dc2be6db185fda94c49164d9df95ffd7390f528c | JavaScript | naoki-tsunekawa/GamersPlace | /app/assets/javascripts/reviews.js | UTF-8 | 1,094 | 3.71875 | 4 | [] | no_license | const stars = document.querySelector(".ratings").children;
const ratingValue = document.getElementById("rating-value");
const ratingValueDisplay = document.getElementById("rating-value-display");
let index;
for (let i = 0; i < stars.length; i++){
// マウスが乗った時の処理
stars[i].addEventListener("mouseover", function () {
... | true |
98b2eb904d78d8a030566e7d7dd6b9ba360c6299 | JavaScript | CostaPedro/Quiz-project | /app.js | UTF-8 | 5,299 | 2.875 | 3 | [] | no_license | $(document).ready(function(){
//list of questions
var state = {
currentQuestion: 0,
score: 0,
items: [
{
question: '9+4=',
answers: [
{
text: 10,
correct: false,
},
{
text: 11,
correct: false,
},
{
text:... | true |
03483990d1f778d456502a8b9dad06f9b0fa939c | JavaScript | TylerP33/Exercism | /javascript/simple-cipher/simple-cipher.js | UTF-8 | 1,839 | 3.453125 | 3 | [] | no_license | const possible = "abcdefghijklmnopqrstuvwxyz"
export function Cipher(key) {
switch (true){
case key === "":
throw ('Bad key');
break;
case /([1-9])\w+/.test(key):
throw ('Bad key');
break;
case /([A-Z])\w+/.test(key):
throw ('Bad key');
break;
case /([.,\/#!$%\^&\*;:{}=\-_`~()])\w... | true |
f366ef640bd767f7cd1dbbbcd946ef2d2f76bbbb | JavaScript | GustavoSouza12/React-Course | /React/class1-20/src/Components/16_Conditional_Rendering.js | UTF-8 | 992 | 2.96875 | 3 | [] | no_license | import { Component } from 'react'
export class CondtionalRendering extends Component {
constructor(props){
super(props)
this.state = {
isLoggedIn: false
}
// this.changeState = this.changeState.bind(this)
}
// changeState = () =>{
// this.setState({
... | true |
d1a633b96605219802bb420667c086fad430da4c | JavaScript | wisdman/mie-touch-map | /content/parser_many_words.js | UTF-8 | 3,530 | 2.765625 | 3 | [] | no_license | const fs = require("fs").promises
const path = require("path")
const mammoth = require("mammoth")
const request = require("request")
const baseDir = __dirname
async function getAllFilesRecursive(dir) {
let output = []
const files = await fs.readdir(dir)
for (const file of files) {
const fullPath = path.reso... | true |
aa947691da36809e0c633910a892f4bfdbd55de1 | JavaScript | leocomp7/FP | /FP Javascript/code/ProjectTestJS1/foreach.js | UTF-8 | 313 | 3.578125 | 4 | [] | no_license | /**
* Created by root on 22/12/16.
*/
var isOdd = function (n)
{
return n % 2 == 1;
}
var isEven = function (n)
{
return n % 2 == 0;
}
var vector = [1,2,3,4,5]
var sum=0;
vector.forEach(function(n)
{
if(this(n))
sum+=n;
},isOdd)
console.log('The foreach sum is: '+sum);
| true |
05084c792fef8697362c9786ff91fb03b78184b5 | JavaScript | Richienb/pial | /index.js | UTF-8 | 430 | 3 | 3 | [
"MIT"
] | permissive | "use strict"
// Adapted from https://stackoverflow.com/a/40200710/8384910
module.exports = (number) => {
if (typeof number !== "number") throw new TypeError("A number must be provided!")
if (number < 0) throw new TypeError("The number must be positive!")
if (number % 2 === 0 && number !== 2) return false
for (l... | true |
729c876df52a73f5e8db900ff4df1d61d52ce10e | JavaScript | oldboy303/cs-curriculum | /Exercises/src/binary.js | UTF-8 | 486 | 3.96875 | 4 | [] | no_license | 'use strict'
/*
Write a function that takes in a string in binary
And returns a number representing that number in decimal
Usage:
binaryToDecimal("010") => 2
You must not use `toString` or `parseInt` or any other
built-in method in javascript that could aid in the conversion.
*/
module.exports = function( str ) {... | true |
cd04b194e3889fbd3b5fbad4b00a23e18f8a9ea9 | JavaScript | arasharghavan/codeup-web-exercises | /js/Function_Drills.js | UTF-8 | 11,401 | 4.3125 | 4 | [] | no_license | // Make a function named isOdd(number)
function isOdd(number) {
return number % 2 !== 0 ;
}
console.log(isOdd(3));
// Make a function named isEven(number)
function isEven(number) {
return number % 2 === 0;
} console.log(isEven(4));
// Make a function named identity(input) that returns the input exactly a... | true |
efe44634914ebd9565904860dfaf4208c10a0ef6 | JavaScript | Pridestalker/js-euler | /tests/multiples.spec.js | UTF-8 | 2,313 | 3.1875 | 3 | [] | no_license | import test from 'ava';
import { palindromic } from '../solutions/004';
import { sumSquareDifference } from '../solutions/006';
import { seriedProduct } from '../solutions/008';
const m = require('../solutions/001/multiples');
test('Multiples of 3 and 5', test => {
test.is(m.multiples(10), 23, 'Multiples under 10 eq... | true |
2d91748740e5a5ba9cf691a7997bc067f2fe0a6d | JavaScript | daslicht/radio-meteor | /meteor/client/player.js | UTF-8 | 1,434 | 2.53125 | 3 | [
"MIT"
] | permissive | var currentChannel;
currentChannel = function() {
var name;
name = Session.get('channel');
if (name) {
return channels[name];
}
};
Template.player.channels = function() {
var c, i, len, ref, results;
ref = _.keys(channels).sort();
results = [];
for (i = 0, len = ref.length; i < len; i++) {
c =... | true |
19a94061110d31b272ee33b58c9c44453da01e9d | JavaScript | p7g/advent-of-code-2018 | /days/9/winningScore.js | UTF-8 | 622 | 2.734375 | 3 | [] | no_license | const { readFileSync } = require('fs');
const { join } = require('path');
const getPlayerScores = require('./.getPlayerScores');
const inputPath = join(__dirname, 'input.txt');
module.exports = function winningScore(file = inputPath) {
const contents = readFileSync(file).toString().trim();
let [,
numPlayers,
... | true |
79ae67d20e88d1394c9218f0f545f896b11833ed | JavaScript | C5m7b4/c5-react-utils | /src/lib/utils.test.js | UTF-8 | 6,033 | 3.28125 | 3 | [
"MIT"
] | permissive | import {
isValid,
formatDate,
formatTime,
addDays,
encrypt,
truncateString,
getDayOfWeek,
formatMoney,
pad,
} from "./utils";
describe("utils.js - isValid", () => {
it("should return false if a string has no length", () => {
const testObj = "";
expect(isValid(testObj)).toBe(false);
});
... | true |
d77c0473dbcab4e5f5dc092d3f64c8a56d2a6849 | JavaScript | amrohit/JavaScript | /Accelerated ES6 JavaScript/6. Promises/5.all-race.js | UTF-8 | 1,401 | 4.46875 | 4 | [] | no_license | let promise1 = new Promise(function (resolve, reject) {
setTimeout(function () {
resolve('Resolved!');
}, 1000)
});
let promise2 = new Promise(function (resolve, reject) {
setTimeout(function () {
reject('Rejected!');
}, 2000)
});
Promise.all([promise1, promise2])
.then(function (s... | true |
4b5c17f383b03e30eedf634056e485b58ea8228d | JavaScript | Julia-reAct/w | /src/Redux/ReducerCards.js | UTF-8 | 2,998 | 2.671875 | 3 | [] | no_license | import {cardsApi} from '../API/api'
const SET_WEATHER = 'SET_WEATHER'
const SET_WEATHER_CITY = 'SET_WEATHER_CITY'
const DELETE_WEATHER = 'DELETE_WEATHER'
const DELETE_WEATHER_CITY = 'DELETE_WEATHER_CITY'
const initialState = {
cities: {},
citiesSaved:JSON.parse(localStorage.getItem('citiesSaved') || ... | true |
9e073a712f68592df5749d0aad303bf376d2b4da | JavaScript | XTeamWorkX/simpleOnlineGame | /src/web/asset/js/index.js | UTF-8 | 6,041 | 2.875 | 3 | [] | no_license | /*jslint browser: true*/
//DOM宣告
var signup, signupBtn, loginAccount, loginPwd, signUpAccount, signUpPwd, signUpCheckPwd, email, nickname, birthday, gender;
var virifyAccount = {
account: ''
};
var signUpContent = {
account: "",
password: "",
email: "",
nickname: "",
birthday: "",
gender: "... | true |
68087d0c5821dfe6f32f60c42e26f62f00be36bc | JavaScript | zenwattage/jsCodeChallenges | /dangerous Aside builtin function constructors/app.js | UTF-8 | 812 | 3.859375 | 4 | [] | no_license | //built in function constructors
// (run in browser console)
var a = new Number(3);
// a
// a returns Number{3}
// __proto__: Number
// [{PrimitiveValue}] : 3
// so because it is a prototype - we have access
// to prototype methods like:
// a.toFixed(2)
// "3.00"
var a = new String("Scott")
// undefined
// a.in... | true |
a9725ae91432d814a9f60dda08489e6a7a26ee51 | JavaScript | Frankz/s3-tree | /test/index.js | UTF-8 | 3,137 | 2.546875 | 3 | [
"MIT"
] | permissive | var test = require('tape');
var proxyquire = require('proxyquire');
var Promise = require('bluebird');
test('should throw if bucket name was not provided', function (t) {
var s3tree = require('..');
t.throws(s3tree);
t.throws(s3tree.bind({}));
t.throws(s3tree.bind({bucket: 123}));
t.end();
});
test('should ... | true |
98c6f046830379577e48076df6595ef86928f4b3 | JavaScript | ninozka/sw-edu | /assets/js/juego/clase6.js | UTF-8 | 1,824 | 3.015625 | 3 | [
"MIT"
] | permissive |
var text;
var Clase6 = function(game){
};
Clase6.prototype = {
init: function(){
},
preload: function(){
this.game.load.spritesheet('btn-a','../assets/buttons/btn-a.png', 58, 58);
this.game.load.spritesheet('btn-s','../assets/buttons/btn-s.png', 58, 58);
this.game.load.sprites... | true |
2a077106236b844e18da253bf05560ece4e2adf0 | JavaScript | braulioceb/FiltrosApp | /functionality.js | UTF-8 | 1,323 | 2.890625 | 3 | [] | no_license | "use strict";
function spin(){
const spinner = document.getElementById("spinner");
let angle = 0;
setInterval(() => {
angle = angle +1;
spinner.style.transform = `rotate(${angle}deg)`;
}
,20)
}
spin();
const fileinput = document.getElementById("fileinput");
const canvas = document.getElementById("... | true |
b350998a6c782bbfc5fee5633c2ab6cbcf46970d | JavaScript | mangoooooo/nodejs-learn-01 | /stream/request_logo.js | UTF-8 | 955 | 2.6875 | 3 | [] | no_license | const http = require('http');
const fs = require('fs');
const request = require('request'); // npm install
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
// 法1:
// fs.readFile('../buffer/logo.PNG', function (err, data) {
// if (err) {
// ... | true |
74e9656b239c5beac8d5422bb988d75f51f4a1ed | JavaScript | sho0126hiro/2018-perform-map | /map_test/PreloadJS_test/test_main.js | UTF-8 | 706 | 2.890625 | 3 | [] | no_license | window.addEventListener("load",init);
function init(){
// load json
var queue = new createjs.LoadQueue(true);
var manifest =[
{"src":"./JSON/1.json","id":"j1"},
{"src":"./JSON/2.json","id":"j2"}
]
queue.loadManifest(manifest,true);
queue.addEventListener("complete",getJson);
}
// getJson data 全て読み込... | true |
822820c403b40a4ca3a620219a7d3b483ef919fc | JavaScript | BiserHristov/SoftUni | /04. JS Advanced/01. JS Advanced/Exam Preparation/27 June 2020/Pet_Me - Resources/solution.js | UTF-8 | 2,967 | 3 | 3 | [
"MIT"
] | permissive | function solve() {
let nameEl = document.querySelector('#container').children[0];
let ageEl = document.querySelector('#container').children[1];
let kindEl = document.querySelector('#container').children[2];
let ownerEl = document.querySelector('#container').children[3];
let addBtn = document.queryS... | true |
6bab96081568d895603270fc2535fa819c3ac2c7 | JavaScript | alexander-mathieu/whether_sweater_express | /routes/api/v1/favorites.js | UTF-8 | 3,719 | 2.625 | 3 | [] | no_license | var express = require('express');
var User = require('../../../models').User;
var Location = require('../../../models').Location;
var darkskyService = require('../../../services/darksky_service')
var googleMapsService = require('../../../services/google_maps_service')
var router = express.Router();
router.post('/',... | true |
c03f4647d5464e0b505bca912b468ac65950fca9 | JavaScript | parkerchristian/filtered-photo-gallery | /test/filter.test.js | UTF-8 | 1,581 | 2.90625 | 3 | [] | no_license | import { filterObjectsFunction } from '../src/filtering-component.js';
const test = QUnit.test;
QUnit.module('FILTER TEST');
const imagesArray = [
{ keyword: 'unicorn', horns: 1 },
{ keyword: 'unicorn', horns: 2 },
{ keyword: 'rhino', horns: 2 },
];
test('filter by keyword unicorn', assert => {
// a... | true |