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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c528d1845f7628d5f156a3a30c5582d52bc3b8ad | JavaScript | mstankiewicz1/WAR_FER_W_15_Podstawy_programowania-master | /3_Zadania_domowe/js/zadanie6.js | UTF-8 | 173 | 3.484375 | 3 | [] | no_license | function getPi(n) {
var pi = 0
for (var i = 1 ; i <= n ; i += 4){
pi += ( 1 / i - 1 / (i + 2));
}
return 4 * pi;
}
var n = 9;
console.log(getPi(n)); | true |
097be11f8d32b584531ea7c2733d09964061b816 | JavaScript | simonluppescu/minimax-typescript-template | /src/js/board.js | UTF-8 | 665 | 2.6875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Board = /** @class */ (function () {
//TODO: Add all properties here
function Board() {
//TODO: Implement the constructor
}
/**
* TODO: Implement this method:
* This method accepts a move and applies the i... | true |
c27a7bf94de778b6429b8e5328fb9c386682f6de | JavaScript | seattletimes/savage-query | /index.js | UTF-8 | 4,382 | 3.109375 | 3 | [] | no_license | //simple clone
//necessary because SVG bounding box objects are read-only in IE
var clone = function(obj) {
var o = {};
for (var key in obj) {
o[key] = obj[key];
}
return o;
};
var NS = "http://www.w3.org/2000/svg";
var Savage = function(selector) {
if (!(this instanceof Savage)) return new Savage(sele... | true |
92d2883b89ade59dbdc8e037d690fce9bac652b2 | JavaScript | matiasgarrid0/Search-Recipes | /api/src/routes/recipe.js | UTF-8 | 2,497 | 2.6875 | 3 | [] | no_license | const { Router } = require('express');
const { Recipe, Type } = require('../db');
const axios = require('axios').default;
const { YOUR_API_KEY } = process.env;
const {URL_RECIPE } = require('../utils/path.js');
const router = Router();
const getAllDetail = async () =>{
const allUrl = await axios.get(`${URL_RECIPE... | true |
cd61c2504d5f92814fa1274c134d3dba9d7b317f | JavaScript | MufeedAdam/multiple-video-input-react | /src/App.js | UTF-8 | 2,014 | 2.640625 | 3 | [] | no_license | import React,{useState} from 'react';
import './App.css';
function App() {
const streamCamVideo =() => {
var video = document.getElementById("videoElement");
navigator.mediaDevices.enumerateDevices()
.then(devices => {
console.table(devices)
var camera = devices.filter(device => dev... | true |
c0e1266df97f945fb94c8489c1ff735f490ce9ed | JavaScript | doclements/vocab_search_interface | /js/vocabsite.js | UTF-8 | 1,428 | 2.78125 | 3 | [] | no_license | $(function() {
});
/**
* getParameterbyName
* @param name
*/
function getParameterByName( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == nu... | true |
2b39a8ad22797bccfe3242773f241eacaeb44962 | JavaScript | badogan/shoppingCartWithReact | /my-app/src/components/GetPriceForm.js | UTF-8 | 1,078 | 2.71875 | 3 | [] | no_license | import React from 'react';
class GetPriceForm extends React.Component {
state = {
enteredOffer: null
}
handleEnteredOffer = (event) => {
this.setState({
enteredOffer: event.target.value
})
}
componentDidMount(){
this.setState({
enteredOffer... | true |
21879fe1d49d7b1b29b960d016bf5cb41f693a68 | JavaScript | giraffe28/sevenDaysUI | /js/ll_memoryDetail.js | UTF-8 | 2,935 | 2.515625 | 3 | [] | no_license | mui.init();
mui.plusReady(function() {
var title = document.getElementById("title");
var content = document.getElementById("content");
var index; //要修改的十字记忆在缓存中的下标
//十字记忆详情页面
var memoryDetailWebview = plus.webview.currentWebview();
//获取上一个页面传入的十字记忆id
var memoryId = memoryDetailWebview.memoryId;
//console.log(me... | true |
f4b1bf9a0187dc0806e32d827186157aec36c171 | JavaScript | mission2placement/OOinJS | /ObjectOriented.js | UTF-8 | 2,146 | 4.375 | 4 | [] | no_license | /*
Writing Our first object
Explaining encapsulation. Our user object will encapsulate every thing.
*/
var userOne = {
name: 'James',
email: 'james.potter@hogwarts.wiz',
/* we can write the functions inside an object.
login: function(){}, but with es6 this can be shortend and we will write
*/... | true |
4f885a3a18abc43d4490eb887d716b9f8ee34b76 | JavaScript | Sachey-25/ReactTutorials | /ReactTesting/todo.test.js | UTF-8 | 1,015 | 3.625 | 4 | [] | no_license | /*import { add } from '../ReactTesting/todo'
import { sub } from '../ReactTesting/todo'
import { mul } from '../ReactTesting/todo'
import { div } from '../ReactTesting/todo'
import { total } from '../ReactTesting/todo'*/
const dimension = jest.fn(() => 3) //React function mocking in react testing
test('dime... | true |
8fa8b5da8588d08fce0f35133b71cd4c420797d0 | JavaScript | adishy/github_repo_download | /github_sync.js | UTF-8 | 4,128 | 2.953125 | 3 | [] | no_license | const { execSync } = require("child_process");
const fs = require('fs');
const GitHub = require('github-api');
const path = require('path');
/**
checkArgs: return expected command-line args provided, show usage information if incorrectly used
**/
function checkArgs() {
let requiredArgs =
[
{ name: "r... | true |
bb96498606c65c5537b4ee1449f62891a0e9bb12 | JavaScript | Kevin-Dy/Dy | /erp_web/src/main/webapp/js/returnorders_21.js | UTF-8 | 6,612 | 2.625 | 3 | [] | no_license | // oper是url中的一个参数, 是用来标识当前所做的业务,如:doCheck=审核业务, doStart确认
var oper = Request.oper
// 订单类型的标志, type=1代表采购, type=2代表销售订单
var type = Request.type * 1;
$(function(){
//销售退货申请,销售type=2
//http://localhost:8080/erp/returnorders.html?oper=myorders&type=2
//select * from returnorders;
//select * from returnorderdetail;
... | true |
6d3af9dc026784b2308ae6e8c65e1ecc0f85ed03 | JavaScript | eternaleclipse/js-minesweeper | /minesweeper.js | UTF-8 | 3,560 | 3.265625 | 3 | [] | no_license | var canvas = document.getElementById('msCanvas')
var ctx = canvas.getContext('2d')
var board = []
var revealedMap = []
var boardCols = 10
var boardRows = 10
var buttonSize = 30
var buttonMargin = 5
function AddButton(x, y, size, row, col, onClick) {
if (board[row][col] == 1) {
ctx.fillStyle = '#000000'
... | true |
f8eb7276f5d149886af23b01ed85cdbc90f0208a | JavaScript | oranngennew/paystation-embed | /src/app.js | UTF-8 | 4,971 | 2.53125 | 3 | [
"MIT"
] | permissive | var $ = require('jquery');
var _ = require('lodash');
var Exception = require('exception');
var LightBox = require('lightbox');
var ChildWindow = require('childwindow');
var Device = require('device');
module.exports = (function () {
function App() {
this.config = _.extend({}, DEFAULT_CONFIG);
this... | true |
e408d31bed90f7665b0257eb718c976818b7ade9 | JavaScript | Tech1989plus1/Code_Book | /Codes/component/API/cotains.js | UTF-8 | 211 | 2.640625 | 3 | [] | no_license |
export const contains = ({first_name, last_name, email}, query) => {
if (first_name.includes(query) || email.includes(query) || last_name.includes(query))
return true;
};
export default contains; | true |
a9b23a46796d5b203d255dcfd8a1d90134c5383b | JavaScript | pub-trivia/trivia-app | /client/src/components/StatsComponent/index.js | UTF-8 | 1,787 | 2.703125 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import API from "../../utils/API";
import { useGameContext } from '../../utils/GlobalState';
import './stats.css';
const StatsComponent = (props) => {
const [gamesPlayed, setGamesPlayed] = useState(0);
const [gamesWon, setGamesWon] = useState(0);
const ... | true |
fb718bec292b09e06cd78a557bdb537b08b95d29 | JavaScript | enjoyware/final-newspaper | /js/listView.js | UTF-8 | 2,224 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | /* global $ */
import moment from 'moment'
const listArticlesQL = `
query {
articles {
id
title
category
published
author {
name
}
content {
html
}
}
}
`
const filter... | true |
d7a41a3fba5022a652cd0af825ba10a210b2e73f | JavaScript | dbenavidesv/apithon-2019-node | /app/helpers/encryption.js | UTF-8 | 218 | 2.53125 | 3 | [
"MIT"
] | permissive | const { compare, hash } = require('bcryptjs');
exports.checkHash = (someString, hashedString) => compare(someString, hashedString);
exports.hashString = (someString, saltRounds = 10) => hash(someString, saltRounds);
| true |
c600ddafe11e730790a93714c58138442bdbce66 | JavaScript | rumkin/conclude | /test/example.js | UTF-8 | 816 | 3 | 3 | [] | no_license | conclude.after('all-tasks', function(){
console.log('All tasks complete');
});
// Define tasks with a string
conclude.after('mysql mongo memcache', function(){
console.log('Ready A');
});
// Define tasks as an Array
conclude.after(['mysql', 'mongo', 'memcache'], function(){
console.log('Ready B');
});
// Define tas... | true |
d03f04295c1d392ea62faf80ca2b10ec2556e99a | JavaScript | idle-js-games/js-like-rogue | /js/library/slots.js | UTF-8 | 3,271 | 2.796875 | 3 | [] | no_license | /**
* @class Damaging slot
* @augments RPG.Slots.BaseSlot
* @augments RPG.Misc.IDamageDealer
*/
RPG.Slots.Damage = OZ.Class()
.extend(RPG.Slots.BaseSlot)
.implement(RPG.Misc.IDamageDealer);
RPG.Slots.Damage.prototype.init = function(name, allowed) {
this.parent(name, allowed);
this._hit = null... | true |
1140ce9f314d4fd393f3ded00bd1a6f270394caa | JavaScript | NPSBlockchainLab/ScatterApps | /test/test.spec.js | UTF-8 | 1,742 | 2.875 | 3 | [] | no_license | const {assert} = require('chai');
require('mocha');
const TYPES = require('../types');
const fs = require('fs');
const flattenBlockchainObject = apps => {
return Object.keys(apps).reduce((acc, blockchain) => {
apps[blockchain].map(app => {
const assigned = app.hasOwnProperty('blockchain') ? app : Object.assign... | true |
80c0fc63e25d49cd9573d738f5d8ded2286911b1 | JavaScript | davidayalas/aws-s3-select-lambda | /data/src/conversor.js | UTF-8 | 2,830 | 2.734375 | 3 | [] | no_license | const csvFilesPath='../files/';
const _fileName='worldcities';
const fs = require("fs");
const exec = require("child_process").exec;
function execCmd(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
console.warn(error);
... | true |
4159f1b39c0b78d703ae11cd1ea03a4cdbac9613 | JavaScript | t0x3e8/Admiral | /FrontEnd_Test/GameEngine/game.test.js | UTF-8 | 2,194 | 2.78125 | 3 | [] | no_license | /* eslint-disable max-lines-per-function */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-magic-numbers */
/* global describe, it */
import { expect } from "chai";
import Game from "./../../FrontEnd/GameEngine/game.js";
import Player from "./../../FrontEnd/GameEngine/player.js";
import { createGameRe... | true |
63c2020607100b60024cadea8da0c04d839d6e2b | JavaScript | ScottehMax/where-s-our-food | /scrollingElements/netServer.js | UTF-8 | 892 | 2.765625 | 3 | [
"MIT"
] | permissive | global.soc = function(server, port, callback){
var net = require("net");
var socket = 0;
this.init = function(){
socket = net.Server();
socket.listen(port, server);
socket.on('connection', function(e){
callback(e);
});
socket.on('listening', function()... | true |
7694962765c3e8f98da9828eaa732ebf481ed7d2 | JavaScript | Jakobeha/FreeForum | /public/javascripts/screen.js | UTF-8 | 541 | 3.15625 | 3 | [] | no_license | /**
* Scrolls below the current screen.
* @param screen : HTMLElement */
function scrollScreenDown(screen) {
const screenFrame = screen.getBoundingClientRect()
scrollTo(screenFrame.left, screenFrame.bottom)
}
document.addEventListener("DOMContentLoaded", function() {
const arrows = document.getElementsBy... | true |
381035b9611da82c78f5c3f0894ad67bf2a6af54 | JavaScript | AbrahamBrookes/TheTurtleGame | /public/js/lib/Player.js | UTF-8 | 5,383 | 3.046875 | 3 | [
"MIT"
] | permissive | /*
A Player class to handle all the intricacies of our player
we will store such things as:
* 3D mesh
* position and velocity
* collision
This player class can only be called from within the callback of a THREE.JSONLoader()'s load() function
as it needs to store the resulting mesh asynchrono... | true |
a4ab29bf2471f445b2a8d8f24d588012cd671b8f | JavaScript | megancostello/d3brushzoom | /AreaChart.js | UTF-8 | 2,945 | 3.140625 | 3 | [] | no_license | // input: selector for a chart container e.g., ".chart"
export default function AreaChart(container){
// initialization
const margin = {top:20, left:50, right:20, bottom:20};
const width = 650 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
const svg = d3.select(containe... | true |
2f6061d86ca0c1ecd02850804ba8a80acde0a824 | JavaScript | vakulka95/Practical-JS | /unit_4/script.js | UTF-8 | 6,631 | 3.5625 | 4 | [] | no_license | // Task 1
let checkFigBtn = document.querySelector('.guess-figure-btn');
let checkFigInp = document.querySelector('.guess-figure-inp');
let figure = Math.floor( Math.random() * 10 );
console.log(figure);
// guessFigInp = parseInt(guessFigInp.value);
function checkFigure(){
input = checkFigInp.value
input ... | true |
fe8786748b35d3ffc272c368fe0c3a32e3fec964 | JavaScript | GhostTrainSF/Web | /src/Selectors.jsx | UTF-8 | 2,239 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import SelectRoute from './SelectRoute.jsx';
import SelectStation from './SelectStation.jsx';
import axios from 'axios';
class Selectors extends Component {
constructor(props) {
super(props)
this.state = {
routes: [
'J - Inbound',
'J - Outbound'... | true |
23b06ec6d4a113e4c92930d944465a4c1703bf52 | JavaScript | theck01/upstreame | /public/scripts/invaders/actors/projectile.js | UTF-8 | 1,364 | 2.921875 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | define(['core/actors/base'], function (Base) {
// Projectile objects are simple actors that follow a trajectory
//
// Arguments:
// opts: object with the following required fields
// group: String group name of the object ['Enemy', 'Player', etc]
// sprite: Instance of Sprite representing visual ... | true |
e0fb1df45a0df809fffbc7ecc55d443628eae3ae | JavaScript | Camilo95VP/Drums_machine | /src/App.js | UTF-8 | 1,790 | 2.609375 | 3 | [] | no_license | import React from "react";
// import logo from "./logo.svg";
import "./App.css";
// const keys= ["Q", "W", "E", "A", "S", "D", "Z", "X", "C"];
const sounds = [
{
key:'Q',
mp3: 'https://s3.amazonaws.com/freecodecamp/drums/Chord_1.mp3',
},
{
key:'W',
mp3:'https://s3.amazonaws.com/freecodecamp/dru... | true |
9fcc8b9bb52ec7471edfc5f17dfd180df7619658 | JavaScript | yin/code-examples | /languages/javascript/bowyerwatson-triangulation/triangulation_dev.js | UTF-8 | 2,145 | 2.75 | 3 | [] | no_license | var bw = require('bowyerwatson.js')
var draw = require('draw.js')
var ts;
var canvas;
var ctx;
function randomXY(offx, offy, x, y){
return [ Math.random()*x+offx, Math.random()*y+offy ];
}
/*
var p = [
];
for (var i = 0; i < 2500; i++) {
p.push(randomXY(30, 30, 580, 420));
}
setInterval(doStep, 5);
/*/
//*/
var d =... | true |
2e1b4efd7a84bb37ed040fc85a3a9615649cea49 | JavaScript | CATOCHE/five-n-one | /app/src/pages/starwars/index.js | UTF-8 | 1,301 | 2.6875 | 3 | [] | no_license | import React from 'react'
import { connect } from 'react-redux'
import { map } from 'ramda'
import { Link } from 'react-router-dom'
function li(c) {
return <li key={c.id}>{c.name}</li>
}
const StarWars = props => {
return (
<div>
<h1>Star Wars Character Names</h1>
<Link to="/starwars/new"> Add New... | true |
2b6465e06c9ed41c07056e12f53bd12a9813ced4 | JavaScript | gpko369/SellerQnA | /src/utility/utilFunctions.js | UTF-8 | 2,223 | 2.515625 | 3 | [] | no_license | import { JSHash, JSHmac, CONSTANTS } from "react-native-hash";
import base64 from "base-64";
export function fn_dateTimeToFormatted(value) {
const today = new Date();
const timeValue = new Date(value - 32400000);
const betweenTime = Math.floor(
(today.getTime() - timeValue.getTime()) / 1000 / 60
);
if (... | true |
8cc3300c148015902958bbdd20f25e33ec265b9f | JavaScript | Anri1214/javascript-challenge-2a | /src/main.js | UTF-8 | 935 | 3.265625 | 3 | [] | no_license | /**
* @const {Array} URLS - Generated endpoints address.
*/
const URLS = (() => {
const indexes = Array.from(Array(100).keys());
const template = 'http://jsonplaceholder.typicode.com/posts';
return indexes.map(val => `${template}/${val + 1}`);
})();
/**
* @function load data from endpoints by chain.
* @para... | true |
daf60bdde561564e016aba95bca966da56246fb4 | JavaScript | danmee10/learnyounodeSolutions | /babySteps.js | UTF-8 | 123 | 2.875 | 3 | [] | no_license | var response = process.argv.slice(2).reduce(function(p, c){
return parseInt(p) + parseInt(c);
});
console.log(response); | true |
156457959d84a1351f0246b4038c1e44eee715f5 | JavaScript | HariniVenkat/myanatomy | /src/reducers/booksReducers.js | UTF-8 | 2,885 | 3.5625 | 4 | [] | no_license | "use strict"
// 1.1 const reducer = function (state = [], action) {
export function booksReducers(state = {
books: []
}
, action) {
// const reducer = function (state = { books: [] }, action) {
switch (action.type) {
case "GET_BOOKS":
return { ...state, books: [...action.p... | true |
e721c35a38efd4b8baf9f84f64613d017457dc80 | JavaScript | drzamich/warsawjs-workshop-38 | /exercises/observables/no3.js | UTF-8 | 771 | 3.21875 | 3 | [] | no_license | const { Observable } = require('rxjs');
const promiseToObservable = (promise) => (
new Observable(observer => {
promise
.then(res => observer.next(res))
.catch((err) => observer.error(err))
.finally(() => observer.complete());
})
);
const goodPromise = new Promise((res,rej) => {
setTimeout... | true |
d8262e12e4835cccf4a0ca1049a29c288787f549 | JavaScript | nss-lyrical-seastars/nutshell | /src/scripts/DOMManager/welcome.js | UTF-8 | 4,075 | 2.84375 | 3 | [] | no_license | const fragment = document.createDocumentFragment();
const usersManager = require("../APIManager/userManager");
const $ = require("jquery");
const userManager = require("../APIManager/userManager")
const session = require("../APIManager/activeUser")
const dashboard = require("../DOMManager/dashboard")
$(document).ready... | true |
670abb2de06a3d9113ebfe270ce4b6f4fad04b11 | JavaScript | FrezzeLain/toDo | /MyRoomOOP.js | UTF-8 | 7,325 | 2.859375 | 3 | [] | no_license | // Микрофон
class Microphone{
config= {
Color: 'Black', //Цвет
Type: 'Dynamic', //Тип
State: 1 //Состояние
// ...
}
Turn_On(){
//Включить микрофон
this.config.State = 1
}
Turn_Off(){
//Выкл... | true |
553d3687cb77b7c137722972293a65f0221e39c1 | JavaScript | kevnroberts/rallyexercises | /templateEngine.js | UTF-8 | 639 | 3.046875 | 3 | [] | no_license | /* exercise 5 - templating engine */
function templateEngine(values, template) {
'use strict';
var result = template;
var tokenRegex = /\$\{\w*\}/gi;
var tokens = template.match(tokenRegex);
var prop, propRegex;
var i, len;
for (i = 0, len = tokens.length; i < len; i += 1) {
prop =... | true |
83ec50ce615b01e32eb85411ea3da0b0da17c4a9 | JavaScript | kevvor/giftionary | /api/helpers/random.js | UTF-8 | 118 | 2.84375 | 3 | [] | no_license | /* Random element in array */
module.exports = array => {
return array[Math.floor(Math.random() * array.length)]
}
| true |
c0cf40fc61f526c8058025bc370f179699f6dbb5 | JavaScript | wolframkriesing/jasmine-node | /lib/jasmine-node/spec-collection.js | UTF-8 | 2,541 | 2.734375 | 3 | [
"MIT"
] | permissive | var collection = (function() {
var fs = require('fs'),
isFile = function(path) {
var isFile = false;
// fs.fstatSync will pass ENOENT from stat(2) up
// the stack. That's not particularly useful right now,
// so try and continue...
try {
isFile = fs.statSync(pa... | true |
11ba381d2b500374fa073adffe2c474c728ea96b | JavaScript | adrian-hintze/fullstack-dev-challenge | /server/src/utils/interest/interest.js | UTF-8 | 911 | 3.265625 | 3 | [] | no_license | export function calculateMonthlyCompoundInterest(
initialSavings,
monthlySavings,
yearlyInterestRate,
interestFrequency,
numMonths
) {
// TODO sanity checks (throw error):
// check that every parameter is a number
// check that initialsavings >= 0
// check that interestFrequency ... | true |
78d53e87df429cc7d07d886ba05f392e4cb2b007 | JavaScript | MURA199918/Practice_Problems_JAVASCRIPT | /RegEx.js | UTF-8 | 1,255 | 3.125 | 3 | [] | no_license | console.log("Welcome to validation using RegEx.");
//UC1 - PINCODE
{
let regEx_PINCODE = RegExp('^[1-9]{1}[0-9]{5}$');
var pincode1 = 400076;
if(regEx_PINCODE.test(pincode1)){
console.log("UC1 - Pincode validated successfully");
}else{
console.log("UC1 -... | true |
35b4cc8b7cffa34895b4dc03a76be270249cc4e9 | JavaScript | stuartpyoung/agua | /html/dojo-1.5.0/dojox/uuid/tests/uuid.js | UTF-8 | 13,968 | 2.515625 | 3 | [
"AFL-2.1",
"BSD-3-Clause"
] | permissive | dojo.provide("dojox.uuid.tests.uuid");
dojo.require("dojox.uuid");
dojo.require("dojox.uuid.Uuid");
dojo.require("dojox.uuid.generateRandomUuid");
dojo.require("dojox.uuid.generateTimeBasedUuid");
dojox.uuid.tests.uuid.checkValidityOfUuidString = function(/*String*/uuidString){
// summary:
// A helper function that... | true |
4ade525bc517bd4a586c172fedc0beeeb9d98881 | JavaScript | codemewell/polygon-shortest-path | /render.js | UTF-8 | 1,851 | 3.390625 | 3 | [] | no_license | class Renderer {
constructor() {
this.canvas = document.getElementById("render-output");
this.cxt = this.canvas.getContext("2d");
this.resizeHandler = () => {};
window.addEventListener("resize", () => this.setCanvasSize());
this.setCanvasSize();
}
setCanvasSize() {
... | true |
6aa471cdbf2f47be21626f319b6a3426e6e89a31 | JavaScript | lycenway/chr-mobi-app-prj | /assets/www/app/collection/visits.js | UTF-8 | 1,254 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | define(['backbone',
'model/visits',
'./visit-business-type'
], function(Backbone, Visits, VisitBusinessTypeCollection) {
var Visits = Backbone.Collection.extend({
model: Visits,
url: function() {
return '/visitInfo'
},
toViewJSON: function() {
var se... | true |
eef748628bbefb40d4ae88403f4d94b7baa10e18 | JavaScript | themaxsi/visualisering-Project-Folder | /JavaScript assignments/JS-Loops/JavaScript.js | UTF-8 | 1,046 | 3.84375 | 4 | [] | no_license | //---------- Loops assignment 1 -------
var i = 1;
while(i < 11)
{
console.log(i)
i++;
}
console.log("")
//---------- Loops assignment 2 -------
var i = 10;
while(i < 101)
{
console.log(i)
i++;
}
console.log("")
//---------- Loops assignment 3 -------
var i = 10;
while(0 < i)
{
console.log(i)
... | true |
b02aa4cf9d472baee73fa370e20a6dd127ebf41b | JavaScript | yehuo2003/case | /common.js | UTF-8 | 6,721 | 3.234375 | 3 | [] | no_license | /*
根据id属性的值,返回对应的标签元素
@param id id属性的值 string类型
@return {Element}元素对象
*/
function my$(id){
return document.getElementById(id);
}
//根据标签name属性值获取元素
function $name(name){
return document.getElementsByName(name);
}
//根据标签名获取页面元素 拿到的是伪数组
function $Tn(name){
return document.getElementsByTagName(name)... | true |
7794df67554dbeac91b90351a7e5ef0a6a6773cd | JavaScript | KeshriAyushi22/React-First-Project | /src/components/LoginPage.js | UTF-8 | 2,171 | 2.71875 | 3 | [] | no_license | import React from "react";
import { PostData } from "../Services/postData";
import "../css/Login.css"
class LoginPage extends React.Component {
constructor(props) {
super(props);
this.state = {
username: "",
password: "",
};
this.onChange = this.onChange.bind(this);
this.login = this... | true |
dc8ed883dd57dee5390e111d696521e843dccc69 | JavaScript | nauberinho/nauberinho.github.io | /FEUMVT/questions.jsx | UTF-8 | 4,972 | 3.34375 | 3 | [] | no_license | class Quizz extends React.Component{
constructor(props) {
super(props);
this.state = {
rightAnswers: 0,
questions: [
{
text: "Questions 1",
a1: "Correct answer",
a2: "Wrong answer",
a3: "Also Wrong answer"
},{
text: "Que... | true |
eba74aed513657fd45fcec23a3e466c3a8bc05e5 | JavaScript | forrestbthomas/ts-nqueens | /nqueens.js | UTF-8 | 4,548 | 3.03125 | 3 | [] | no_license | var Board = (function () {
function Board(size) {
this.size = size;
this.buildBoard(size);
this.numQueens = 0;
this.countQueens = 0;
this.lastPos = [];
this.rowOneY = -1;
}
Board.prototype.buildBoard = function (size) {
var board = [];
for (var... | true |
9fb017640303fedaf5e6c54f8809c376768413dc | JavaScript | zhengjunxiang/Arithmetic | /codeing/formatNum.js | UTF-8 | 230 | 3.046875 | 3 | [] | no_license | function convert(money) {
var res = money.toString().replace(/\d+/, function (n) {
return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
return $1 + ",";
});
});
return res;
}
console.log(convert(100000.01))
| true |
54db88e9df777afb90760df68b8842cb6bf37d65 | JavaScript | leeight/email | /src/client/dep/esui/src/lib/string.js | UTF-8 | 3,285 | 3.109375 | 3 | [] | no_license | /**
* ESUI (Enterprise Simple UI library)
* Copyright 2013 Baidu Inc. All rights reserved.
*
* @ignore
* @file 字符串相关基础库
* @author otakustay
*/
define(
function (require) {
var u = require('underscore');
/**
* @override lib
*/
var lib = {};
var WHITESPACE = /... | true |
255a833f4acab07e5c7c78d14cd6d51d6e1280ef | JavaScript | JHYOOOOON/Collection | /programmers/level1/시저암호.js | UTF-8 | 322 | 3.140625 | 3 | [] | no_license | function solution(s, n) {
return s.split("").map(a => {
if(a === " ") return " ";
let tmp = String.fromCharCode(a.toUpperCase().charCodeAt(0) + n);
if(tmp > 'Z') tmp = String.fromCharCode(tmp.charCodeAt(0) - 26);
return (a >= 'a') ? tmp.toLowerCase() : tmp;
}).join("");
... | true |
902ad1ff7437d3c2ddd8fa79ffc06eaca1853e68 | JavaScript | AbhishekRanjan8051/abhishek-dev | /UNIT-1/DSA-V/equalto42.js | UTF-8 | 984 | 3.875 | 4 | [] | no_license | /*You are given an array of N integers. Output "Yes" if 42 is present in array, else print "No".
Input = 5
3 7 0 9 8
Output = No
*/
function runProgram(input) {
var newInput = input.split("\n");
var data = newInput[1].trim().split(" ").map(Number);
var result = "";
for (var i = 0; i < data.... | true |
b41c7f0ae943a8865d38b93dfebda801e72504e0 | JavaScript | Dnelre-Slin/WebScience | /testing/utilities/scripts/gameLogic.js | UTF-8 | 2,362 | 3.265625 | 3 | [] | no_license | function getGuessColor(current_row, columns) {
var guessColors = [];
for (var i = 0; i < columns; i++) {
var piece = $("#piece" + current_row + "_" + i);
if (piece.attr("class").indexOf("is_empty") > -1) {
guessColors[i] = "empty";
} else {
guessColors[i] = piece.css("background-color");
}
}
retur... | true |
e4313801435b6e7a69c0bf111947799641681337 | JavaScript | lmjing/AlgorithmStudy | /JavaScript/Programmers/Lv1/K번째수.js | UTF-8 | 2,266 | 3.4375 | 3 | [] | no_license | console.log(solution([1, 5, 2, 6, 3, 7, 4], [[2, 5, 3], [4, 4, 1], [1, 7, 3]]));
// console.log(solution([9, 8, 7, 6, 5, 4, 3, 2, 1], [[1, 9, 5]]));
//
// let inputArray = [];
// for (let i=100; i>0; i--) {
// inputArray.push(i);
// }
// let inputCommans = [];
// for (let i=1; i<=50; i++) {
// inputCommans.push... | true |
b29f8d7f03e3a1189db3e5868de4ee2ac791d4c9 | JavaScript | mundtp/nabefinder | /src/scripts/actions.js | UTF-8 | 4,135 | 2.8125 | 3 | [] | no_license | import {User, NabeModel} from './models/models'
import NABE_STORE from './store'
import toastr from 'toastr'
toastr.success.background = 'black'
const ACTIONS = {
//WE WANT TO LOG THE USER IN IMMEDIATELY AFTER THEY REGISTER (AS LONG AS THEY REGISTER SUCCESFULLY) THE FIRST METHOD REGISTERS AND THE SECOND LOGS T... | true |
b23b83e4e0328068c83df57636d2d73c1d3f3dc7 | JavaScript | RegularSvensson/friend-lover | /js/app.js | UTF-8 | 2,221 | 3.078125 | 3 | [] | no_license | /* ======= Model ======= */
var model = {
currentFriend: null,
friends: [
{
clickCount: 0,
name: 'Meron',
imgSrc: 'img/meron.jpg'
},
{
clickCount: 0,
name: 'Isak',
imgSrc: 'img/isak.jpg'
},
{
clickCount: 0,
name: 'Robban',
imgSrc: 'img/robban.jpg'
},
{
clickCount: 0,
na... | true |
25240519b735a1f8d84b34b3a8e378003d5ec87b | JavaScript | AlexY99/Audifast | /src/main/webapp/resources/js/auditoria.js | UTF-8 | 1,739 | 2.640625 | 3 | [] | no_license | $('#select-plantilla').on('change', function() {
var idPlantilla = this.value;
var idAuditoria = $('#txtIdAuditoria').val()
if(idPlantilla!=0){
enviarDatos(idPlantilla,idAuditoria);
}else{
$('#div-procesos').html("");
}
});
function enviarDatos(idP,idA){
$.ajax({
url: 'P... | true |
8a24f4eacea0a86492c260ac7fa1da83819339b6 | JavaScript | amediop/projet_html | /index.js | UTF-8 | 1,441 | 2.984375 | 3 | [] | no_license | let ajouter=document.getElementById("ajout");
let conteneur=document.getElementById("conteneur");
let formulaire=document.getElementById("formulaire");
let inputs=document.querySelectorAll("#conteneur inputs");
ajouter.addEventListener("click",function() {
let new_div=document.createElement("div");
let new_di... | true |
626df5618d3e54a7b77553dc28f53b1be00aedd6 | JavaScript | vctrubio/timestamp | /app/javascript/plugins/create.js | UTF-8 | 643 | 3.296875 | 3 | [] | no_license | const lat = document.getElementById('lat')
const lon = document.getElementById('lon')
const submitButton = document.getElementById('make-event')
const eventForm = document.getElementById('new_event')
const geolocationSuccess = (pos) => {
const latitude = pos.coords.latitude;
console.log(`got the lat, its ${lat}`)
... | true |
beac5c62ad42cbaa60ed2eed114c1f4f7e8fe87f | JavaScript | carolanncan/deafgrandma | /js/processInput.js | UTF-8 | 184 | 2.65625 | 3 | [] | no_license | module.exports = function (input) {
if (input === null || input === undefined) {
return ''
}
var sentence = input.toString();
return sentence.slice(0, sentence.length-1)
}
| true |
e722c921f58cecbc5f6b19d3bc5098109c350a9b | JavaScript | Keerthi-Mani/Scraper_News | /server.js | UTF-8 | 7,749 | 2.921875 | 3 | [] | no_license | //Dependencies
var express = require("express");
var exphbs = require("express-handlebars");
var logger = require("morgan");
var mongoose = require("mongoose");
var bodyParser = require("body-parser");
var path = require("path");
// Our scraping tools
// Axios is a promised-based http library, similar to jQuery's Ajax ... | true |
bbec910411a81c1ce7656f77455ed6c7208ed73f | JavaScript | NatalieNunez/edabit | /bug4.js | UTF-8 | 276 | 3.921875 | 4 | [] | no_license | function greeting(name) {
if(name === "Mubashir") {
return "Hello, my Love!";
} else {
return "Hello, " + name + "!";
}
} // if else statement looks cleaner
/* function greeting(name) {
return name === "Mubashir" ? "Hello, my Love!" : "Hello, " + name + "!";
} */ | true |
1fcd8d85362b03b236b444a762fe35c9118c551a | JavaScript | nayt17/h8-p0-w2 | /exercise-5.js | UTF-8 | 2,133 | 4.28125 | 4 | [] | no_license | //Soal exercise 5
//Nomor 1
var word = 'Javascript '
var second = 'is '
var third = 'awesome '
var fourth = 'and '
var fifth = 'I '
var sixth = 'love '
var seventh = 'it!'
console.log(word.concat(second,third,fourth,fifth,sixth,seventh))
//Nomor 2
var word = 'wow Javascript is so cool'
var exampleFirstWord = word[0]... | true |
d1ec7d063260fef0d36a697a88442c409b903724 | JavaScript | IlianaB/TelerikAcademy | /Homeworks/JavaScript Fundamentals/Conditional Statements/07. The Biggest of Five Numbers/js/scripts.js | UTF-8 | 753 | 4.65625 | 5 | [] | no_license | /*
Problem 7. The biggest of five numbers
Write a script that finds the greatest of given 5 variables.
Use nested if statements.
*/
var result = document.getElementById('result');
var a = 5,
b = 2,
c = 2,
d = 4,
e = 1;
console.log('The biggest number is: ' + findBiggestNumber(a, b, c, d, e));
res... | true |
9d1adce3f2f8a0a947268e3e1d8e6772aa71b333 | JavaScript | szeeshana/node-course-2-todo-api | /playground/mongodb-update.js | UTF-8 | 1,204 | 2.53125 | 3 | [] | no_license | const { MongoClient, ObjectId } = require('mongodb'); // Using Object Destructuring
MongoClient.connect('mongodb://localhost:27017/TodoApp', (err, db) => {
if (err) {
return console.log(`Unable to connect to Mongo Server : ${err}`);
}
console.log('Connected To MongoDB');
/* https://docs.mongod... | true |
4074fe10c98a2fdca555ecd8ca501f4e05066f16 | JavaScript | vicradon/csv-parser-api | /controllers/csv.js | UTF-8 | 2,131 | 2.59375 | 3 | [] | no_license | const Joi = require("joi");
const { promisify } = require("util");
const fs = require("fs");
const readFileAsync = promisify(fs.readFile);
const axios = require("axios");
const detectCSV = require("detect-csv");
const { v4: uuid } = require("uuid");
const neatCsv = require("neat-csv");
class CsvController {
getSampl... | true |
c428b635e24115fe822e2fe6b4ad7fbca21b7280 | JavaScript | tranc99/reviewboard | /reviewboard/static/rb/js/configForms/views/tests/listViewTests.js | UTF-8 | 2,107 | 2.53125 | 3 | [
"MIT"
] | permissive | describe('configForms/views/ListView', function() {
describe('Manages items', function() {
var collection,
list,
listView;
beforeEach(function() {
collection = new Backbone.Collection(
[
{text: 'Item 1'},
{t... | true |
2f4d5aaaf602911d7c09733b66dbaefdb90900d1 | JavaScript | jeremylenz/quote-maker-react-lab-web-060517 | /src/containers/QuoteForm.js | UTF-8 | 3,390 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import uuid from 'uuid';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { addQuote, removeQuote, upvoteQuote, downvoteQuote } from '../actions/quotes';
export class QuoteForm extends Component {
constructor(props) {
super(props... | true |
8aabed4c474f209b6b3f265dbe7c33ab67ed4da8 | JavaScript | saarimz/advent-of-code | /2017_js/day1.js | UTF-8 | 974 | 4 | 4 | [] | no_license | // http://adventofcode.com/2017/day/1
//NOTE: BOTH FUNCTIONS EXPECT A INPUT OF TYPE STRING
// part one
function findpairs(n) {
const arr = n.replace(/\D/g, '0').split('').map(Number);
const pairs_arr = arr.map( (val,index,arr) => {
if (index == arr.length - 1) {
return [val,arr[0]];
} else {
... | true |
2aa32a86406424c6a80784297601cdb4bc93b874 | JavaScript | S17cis526/gallery-part-1-cavossman | /public/gallery.js | UTF-8 | 976 | 2.640625 | 3 | [] | no_license | // Javascript for the gallery page
var title = document.getElementById('gallery-title');
title.onclick = function(e) {
e.preventDefault();
var form = document.getElementById('gallery-title-edit');
form.style.display = 'block';
}
var images = document.getElementsByClassName('thumbnail');
function showImage(i) {
... | true |
713817b434a7fce42d08fc4a428ffaae2fedb8e6 | JavaScript | valervarga/angular-store | /backend/src/services/ProductServices.js | UTF-8 | 1,656 | 2.6875 | 3 | [] | no_license | /**
* @file Defines all product related business logic.
* @author Valer Varga
*/
const Products = require('../models/Product');
const ProductService = {
// CREATE
createOne(product) {
return new Promise((resolve, reject) => {
if (!product.title) return reject('Title is required.');
if (!product... | true |
2694c9c91f438eed19ae82686d6ee855a3b39369 | JavaScript | bingoooo/jeudelamortquitue | /js/script.js | UTF-8 | 1,085 | 2.71875 | 3 | [] | no_license | 'use strict';
console.log('link : script');
var size = 9;
var ants = {};
var ant = {
init : function(){
ant.create();
ant.move();
},
create : function(){
var fourmi = $('#ant-template').html();
var placed = false;
for (var i = 0; i < size; i++){
for (var j = 0; j < size; j++){
var tileChecked = $('... | true |
05986eddc28411159bf9f5c24a8d5888bf8e9c5c | JavaScript | Mastrianth/crop | /src/functions/cropImage.js | UTF-8 | 1,333 | 2.875 | 3 | [] | no_license | import createImage from './createImage';
import getSmallerImage from './getSmallerImg';
import getRadianAngle from './getRadianAngle';
export default async function getCroppedImg(imageSrc, pixelCrop, rotation = 0) {
let image = await createImage(imageSrc);
let {
width, height, x, y,
} = pixelCrop;
if (ima... | true |
9fc2934cea3ca4862c354c9963ed3617f1bfd8bf | JavaScript | bolobob/d3 | /line_chart.js | UTF-8 | 2,243 | 2.796875 | 3 | [] | no_license | $(function() {
var w = 600, h = 400, padding = 80;
//var dataset = [123, 90, 20, 12, 3, 1, 0, 0, 1, 0, 0, 0];
var dataset = [
{month: '2013-04', registryNum: 123},
{month: '2013-05', registryNum: 90},
{month: '2013-06', registryNum: 20},
{month: '2013-07', registryNum: 12},
{month: '2013-08', ... | true |
aef7eb6400a2e4aea41ed20f62743735378905bf | JavaScript | gooddima96/ingipro-practice | /app/components/mediator/index.js | UTF-8 | 543 | 2.75 | 3 | [] | no_license | class Mediator {
constructor() {
// @fixme remove `console.log`
// eslint-disable-next-line
console.log('"Mediator" created');
}
on(type, listener) {
// @fixme remove `console.log`
// eslint-disable-next-line
console.log('mediator.on', type, listener)
... | true |
35c5e9c57bde2df1b6b0b08ccd681b9f5bb8fe7a | JavaScript | Jair333771/rest-node | /cero-a-experto/promises.js | UTF-8 | 1,423 | 3.796875 | 4 | [] | no_license | const users = [
{
id: 1,
name: "karen",
},
{
id: 2,
name: "Linda",
},
{
id: 3,
name: "Luisa",
}
];
const amount = [
{
id: 1,
value: 200000,
},
{
id: 2,
value: 150000,
}
];
const getEmployee = (id) =... | true |
fe0a9e80b561b5796d886e8ad876b3830b7c9d7e | JavaScript | Annieday/Weekdays | /index.ios.js | UTF-8 | 1,688 | 2.765625 | 3 | [] | no_license |
// Import code we need
import Moment from 'moment';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View
} from 'react-native';
import DayItem from './src/day-item';//composition of components
// Create a react component
var Weekdays = React.createClass({//class Weekdays extends Component { r... | true |
11c88aa9877b1397f5dded86a7a75e3633450b92 | JavaScript | simoncozens/xedit | /actions.js | UTF-8 | 1,498 | 3.171875 | 3 | [] | no_license | setButtonAction = {
surround: function(buttonX, button) {
button.makesElement = buttonX.getAttribute("element");
button.addEventListener("click", function () {
makeSelection(this.makesElement)
}, true);
},
replace: function(buttonX, button) {
button.makesElement ... | true |
4a0beed4cea09b74d3f930d536ff567d17d36c98 | JavaScript | junhui/hubot-scripts | /dist/octocat.js | UTF-8 | 1,469 | 2.640625 | 3 | [
"MIT"
] | permissive | // Description:
// Show random octocat
// Dependencies:
// "xml2js": "0.1.14"
// Configuration:
// None
// Commands:
// hubot octocat me - a randomly selected octocat
// hubot octocat bomb me <number> - octocat-splosion!
// Author:
// joshuaflanagan
var show_octocats, xml2js;
xml2js = require('xml2js')... | true |
7724419cbb75c5b3c346420b5cf9dc1d615c64cb | JavaScript | larsimmisch/couchpotato | /_attachments/mealmaster.js | UTF-8 | 2,423 | 2.84375 | 3 | [] | no_license | function lstrip(s) {
var m = /\s*(\S*)/.exec(s)
if (m) {
return m[1]
}
}
function each(a, fn) {
var r = []
for (var i in a) {
r.push(fn(a[i]))
}
return r
}
function mm_parse(str) {
function parse_recipe(lines) {
function isNumber(str) {
// understands floating point numbers and
// fractions ... | true |
29d8c07b7882ea0fe6cdaaf418644d4a9c3c36ff | JavaScript | m-tartag/Random-Algorithms | /diff.js | UTF-8 | 227 | 3.234375 | 3 | [] | no_license | function diffArray(arr1, arr2) {
const newArr = [];
const NEW = arr1.concat(arr2);
NEW.filter(function(item) {
return !arr1.includes(item) || !arr2.includes(item);
});
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
| true |
cdcd0f6df796dfb31e5700724b1060d7b56e81b3 | JavaScript | Modupeade/per | /add_data.js | UTF-8 | 320 | 2.9375 | 3 | [] | no_license |
function addField(){
var container = document.getElementById('field-container');
var field = document.createElement('div');
field.innerHTML = "<input type='text' name='awards[]' placeholder='Enter Award' ><input type='text' name='years[]' placeholder='Enter Year' > " ;
container.appendChild(field);
}
| true |
267ec347954a38226819fff76be8127cd9fb501f | JavaScript | MrM4/zhuque.js | /node/03fs文件模块/03unlink.js | UTF-8 | 626 | 2.609375 | 3 | [] | no_license |
/*
unlink 删除文件 不能删除文件夹
readdir 读取文件夹目录信息
rename 重命名,文件移动
rmdir 删除文件夹 只能删除空文件夹
*/
const fs = require("fs");
const path=require("path")
let fp=path.join(__dirname,"/test");
//异步
fs.unlink(fp,(err)=>{if(err)throw err});
//同步
fs.unlinkSync(fp);
fs.readdir(fp,(err,info)=>{
... | true |
6ab2796ec5bac6b0af88e3547e60833bf6cbb0e1 | JavaScript | lexm/hackerrank-code | /Data_Structures/Linked_Lists/compare-two-linked-lists.js | UTF-8 | 559 | 4.21875 | 4 | [] | no_license | /*
Compare two Linked Lists A and B
Return 1 if they are identical and 0 if they are not.
Node is defined as
var Node = function(data) {
this.data = data;
this.next = null;
}
*/
// This is a "method-only" submission.
// You only need to complete this method.
function compareLinkedL... | true |
b8de68bee367ad049b1eee819f740d2452a37281 | JavaScript | TheodoraDimitrova/TECH-JS | /Arrays - More Exercise/03. Rotate Array.js | UTF-8 | 253 | 3.34375 | 3 | [] | no_license | function solve(array) {
let times = Number(array[array.length - 1]);
array.pop();
while (times--) {
let temp = array.pop();
array.unshift(temp);
}
console.log(array.join(" "));
}
solve(["Banana", "Orange", "Coconut", "Apple", "15"]);
| true |
f0976ba6e8429e8b356e451011ac85412ea7ee64 | JavaScript | olashina201/react-room-homepage | /src/components/slider.js | UTF-8 | 5,511 | 2.671875 | 3 | [] | no_license | import React, {useEffect} from 'react';
import '../static/style.css';
import AngleLeft from '../images/icon-angle-left.svg';
import AngleRight from '../images/icon-angle-right.svg'
import arrow from '../images/icon-arrow.svg'
import "react-slideshow-image/dist/styles.css";
export default function Slider() {
use... | true |
ae072a7eedbbefb14d01fdfea101de837a147f6e | JavaScript | ededmond/New-York-Times-API- | /nyt.js | UTF-8 | 2,086 | 2.84375 | 3 | [] | no_license | var apiKey = "2uLSCfNAfY93MR1jQWuIUkNjuKASxxGD";
var articleSection = $("#article-section");
function search(term,limit,startYear,endYear) {
var queryURL = "https://cors-anywhere.herokuapp.com/https://api.nytimes.com/svc/search/v2/articlesearch.json?"
var dates = "";
if (startYear < endYear) {
dat... | true |
1a3afab7aefc70c2f030f1d9abe2e2623383a519 | JavaScript | Azerothian/code-deck | /src/utils/deck.js | UTF-8 | 2,103 | 2.546875 | 3 | [
"MIT"
] | permissive | import StreamDeck from "elgato-stream-deck";
import crc32 from "fast-crc32";
export const ICON_SIZE = 72;
export const NUM_FIRST_PAGE_PIXELS = 2583;
export const NUM_SECOND_PAGE_PIXELS = 2601;
export const NUM_TOTAL_PIXELS = NUM_FIRST_PAGE_PIXELS + NUM_SECOND_PAGE_PIXELS;
export const WIDTH = 72 * 5;
export const HEI... | true |
ae4a39a7a7abcef3e7201e916a8cf2cc6d8a69de | JavaScript | ser2331/it-react-kabzda-1 | /src/redux/profile-reducer.js | UTF-8 | 2,391 | 2.765625 | 3 | [] | no_license | const ADD_POST = "ADD-POST";
const UPDATE_NEW_POST_TEXT = "UPDATE-NEW-POST-TEXT";
const SET_USERS_PROFILE = "SER_USERS_PROFILE"
const LOOK = "LOOK"
const UNLOOK = "UNLOOK"
let initialState = {
posts: [
{id: "1", message: "Hi, how are you?", likesCount: "8"},
{id: "2", message: "It's my first... | true |
016cfaa52802f51698d63ea66e957876f8c360ed | JavaScript | caiocapasso/PrimeirasAulas_HTML_GAMA | /node/index.js | UTF-8 | 1,378 | 3.578125 | 4 | [] | no_license | const readLine = require('readline');
const rl = readLine.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Pedra (1), Papel (2) ou Tesoura (3)? ', resposta => {
const opcoes = {
1: 'pedra',
2: 'papel',
3: 'tesoura'
};
const escolhaUsuario = r... | true |
c2b5d19d0305de88e005342d9a676ca773d3c44d | JavaScript | ExecutorBG/docapp | /js/collections/DocumentsCollection.js | UTF-8 | 2,523 | 2.609375 | 3 | [] | no_license | define([
'models/DocumentsModel',
'collections/CategoriesCollection'
], function (DocumentsModel, CategoriesCollection) {
var DocumentsCollection = Backbone.Collection.extend({
model: DocumentsModel,
lastId: 0,
initialize: function (models, options) {
this.loadDocuments... | true |
e9c7c203551756cbb15e9d78846aac87ded6e126 | JavaScript | RainStrong532/oneGuide | /src/modules/DataManager.js | UTF-8 | 1,545 | 2.59375 | 3 | [] | no_license | import { AsyncStorage } from 'react-native';
const APP_PREFIX = 'ONE_GUIDE_'
const saveValue = async (value, key) => {
const app_key = `${APP_PREFIX}${key}`
try {
if (value) {
await AsyncStorage.setItem(app_key, value.toString());
} else {
await AsyncStorage.removeItem(app_key)
}
retu... | true |
48766317a30af008f27223299895639159fe3b71 | JavaScript | 1001v/Range.js | /test/test.js | UTF-8 | 6,451 | 2.96875 | 3 | [
"MIT"
] | permissive | const Range = require('../src/range.js');
const assert = require('assert');
describe('Range', () => {
describe('Constructor', () => {
it('should create number range', () => {
let min = 1;
let max = 10;
let range = new Range(min, max);
assert.equal(min, range.m... | true |
f75327522866e9e789bf5cf31a4b017e0741ec68 | JavaScript | GabrielAlacchi/Dramaha | /assets/js/hooks/Showdown.js | UTF-8 | 2,390 | 2.703125 | 3 | [] | no_license |
// Positions to slide pots to relative to the table
const targetRelativePos = {
"1": { x: 0.5, y: 0.24, xRef: 'center', yRef: 'bottom' },
"2": { x: 0.15, y: 0.4, xRef: 'left', yRef: 'bottom' },
"3": { x: 0.15, y: 0.25, xRef: 'left', yRef: 'top' },
"4": { x: 0.5, y: 0.15, xRef: 'center', yRef: 'top' },
"5": {... | true |
7730fceba1d9e23cd46cea63b6bc1c4bcbc69e80 | JavaScript | thiagoferrari/API-gobarber-Node.js | /src/app/controllers/NotificationController.js | UTF-8 | 1,263 | 2.578125 | 3 | [
"MIT"
] | permissive | import User from '../models/User'
import Notification from '../schemas/Notification'
class NotificationController {
async index(req, res) {
/**
* checando se este usuário logado é um prestador:
*/
const checkisProvider = await User.findOne({
where: { id: req.userId, p... | true |