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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e258242bc9ae09537660a36304f95b6aecfcf9bb | JavaScript | OutBigpeng/Yzyl_RN | /code/test/test.js | UTF-8 | 2,979 | 2.515625 | 3 | [] | no_license | /**
* Created by Monika on 2017/8/29.
*/
let listData = {};
let text = ["Home","University","News"];
let labels = {'Home': {}, 'University': {}, 'News': {}};
let selectedLabel = {'Home':'', 'University': '', 'News': ''};
// let wenzhang = [,{'id':2,'title':'标题啦','time':'20170605','author':'作者大大'},{'id':2,'title':... | true |
3f446a50aff866b9d36a5790b4e755af01eb422e | JavaScript | thealjey/webcompiler | /lib/JS.js | UTF-8 | 4,849 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict';
exports.__esModule = true;
exports.JS = undefined;
var _JSCompiler = require('./JSCompiler');
var _JSLint = require('./JSLint');
var _noop = require('lodash/noop');
var _noop2 = _interopRequireDefault(_noop);
var _logger = require('./logger');
var _findBinary = require('./findBinary');
function _i... | true |
22a2d20369f59f45330ccaa982153772f057a439 | JavaScript | riddhijit2702/Plucking-Mangoes-Try-2 | /sketch.js | UTF-8 | 2,249 | 2.875 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint
var mango1,boyImage;
function preload()
{
boyImage=loadImage("Plucking mangoes/boy.png")
}
function setup() {
createCanvas(800, 700);
engine = Engine.create();
... | true |
62e3394508906a222f31401c4c3cc35a45668541 | JavaScript | CaptEmulation/harry_potter-marauders_map | /app.js | UTF-8 | 313 | 2.65625 | 3 | [
"MIT"
] | permissive | var express = require('express');
var app = express();
// Create a static web route to public folder
app.use(express.static(__dirname + '/public'));
// Start listening on port 3000
app.listen(3000, function (err) {
if (err) {
throw new Error(err)
}
console.log('Harry Potter\'s adventure begins....');
});
| true |
039c8af30de709dfed76237493827e5570e15fa8 | JavaScript | bendrucker/dot-parts | /index.js | UTF-8 | 330 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict'
module.exports = function dotParts (path) {
var result = []
var parts = path.split('.')
for (var i = 0; i < parts.length; i++) {
var part = parts[i]
while (part[part.length - 1] === '\\') {
part = part.slice(0, -1) + '.'
part += parts[++i]
}
result.push(part)
}
return... | true |
6b9eb812843a0a4b354f7b6664ae7acf4f28c786 | JavaScript | PositivePeriod/Transformation-Visualization | /TransVisual/src/paint.js | UTF-8 | 3,046 | 2.84375 | 3 | [
"MIT"
] | permissive | import { Transform } from "./transform.js";
import { clear } from "./drawUtil.js";
import { Throttle } from "./throttle.js";
import { functionDict } from "./function.js";
export class Paint {
constructor() {
this.trans = new Transform();
this.trans.origin = [0, 0];
this.funcName = 'Identity... | true |
02226d8b81498e2177e5bb6d681e1fb38f0227ae | JavaScript | komandur/speech-of-life | /src/game.jsx | UTF-8 | 3,762 | 2.921875 | 3 | [] | no_license | var React = require('react');
var ticker = require('ticker');
var LIFE = require('./life');
function pickRandomCoords(board) {
var x = Math.floor(Math.random() * board.width);
var y = Math.floor(Math.random() * board.height);
return {x: x, y: y};
}
function inBoard(coordinates, board) {
return (coordinates.m... | true |
3ca3847262ad6f915a2e54de18eb39e727f9ddef | JavaScript | shteeven/scr-radio | /modules/contents/tests/server/content.server.routes.tests.js | UTF-8 | 11,878 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
var should = require('should'),
request = require('supertest'),
path = require('path'),
mongoose = require('mongoose'),
User = mongoose.model('User'),
Content = mongoose.model('Content'),
express = require(path.resolve('./config/lib/express'));
/**
* Globals
*/
var app, agent, credentials,... | true |
9a93b0863b7402c14015b86cadcdb95c2e900aac | JavaScript | Woozical/springboard-47.10 | /graph.js | UTF-8 | 3,067 | 3.734375 | 4 | [] | no_license | class Node {
constructor(value, adjacent = new Set()) {
this.value = value;
this.adjacent = adjacent;
}
}
class Graph {
constructor() {
this.nodes = new Set();
}
// this function accepts a Node instance and adds it to the nodes property on the graph
addVertex(vertex) {
this.nodes.add(verte... | true |
8044eafe2649924f241051fcc18377e43740c617 | JavaScript | carlssonemil/adventofcode | /2020/day10/src/partOne.js | UTF-8 | 437 | 3.109375 | 3 | [] | no_license | export default (input) => {
const data = input.split('\n').map(Number).sort((a, b) => a - b);
const adapters = [0, ...data, data[data.length - 1] + 3];
let oneJolt = 0;
let threeJolt = 0;
for (let i = 0; i < adapters.length - 1; i++) {
const difference = adapters[i + 1] - adapters[i];
switch (diffe... | true |
4321a7ae3768fb9b6203e1f82be2733a61e289d3 | JavaScript | shekharj21/dice2 | /index.js | UTF-8 | 805 | 3.828125 | 4 | [] | no_license | ///////////1st dice/////////
var randomnumber1 =Math.floor(Math.random() * 6)+1; //1-6
var randomdiceimage = "images/dice" + randomnumber1 +".png"; //dice1 -dice6
var image1=document.querySelectorAll("img")[0];
image1.setAttribute("src",randomdiceimage);
//////// 2nd dice//////////
var ra... | true |
9efc3b7ef9d4194648a3aa2492e8976d64f4a06b | JavaScript | HishamHosni/Test-mouse | /Mouse Clicking Game/Assets/Player.js | UTF-8 | 1,034 | 2.671875 | 3 | [] | no_license | //Player Script
//Inspector Variables.
var respawntime : float=5;
var raydistance : float=100.0;
//Private Variables.
function Start () {
}
function Update ()
{
//use mouse button to select on Go in the Screen
if(Input.GetMouseButtonDown(0))
{
//Debug.Log("Pressed left click.");
var hit :RaycastHit;
... | true |
3f05684d29a26ff1074308075a29828e8b02a19e | JavaScript | mikenorthorp/CaptchaStudy | /js/timer.js | UTF-8 | 525 | 2.859375 | 3 | [] | no_license | // This function takes the start time when the page is loaded and the end time
// when the page is closed and sends the time to a timer.php script
$(function() {
var start = null;
// Get start time on window load
$(window).load(function(event) {
start = event.timeStamp;
});
// Get end time o... | true |
45ae2fe05cd92e4657aa3be2a6acd49aa4232a6b | JavaScript | abdalllah22/Attendance-System | /project/js/2-login.js | UTF-8 | 4,664 | 2.71875 | 3 | [] | no_license |
window.addEventListener('load',function () {
login = document.getElementById('logbtn');
username = document.getElementById('username')
pass = document.getElementById('pass')
usernameerror = document.getElementById('usernameerror')
passerror = document.getElementById('userpasserror')
... | true |
04bf607f4daea128012a6f6716cc598ddae845ee | JavaScript | xxGw1997/frontendStudy | /leetcode/盛水最多的容器.js | UTF-8 | 1,464 | 4 | 4 | [] | no_license | /**
给你 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) 。在坐标内
画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0)。找出其中的两条线,
使得它们与 x 轴共同构成的容器可以容纳最多的水。
*/
let theMostWaterArea = function (arr) {
let left = 0
let right = arr.length - 1
let leftLine = left
let rightLine = right
let maxArea = 0
let... | true |
703acb9498347cd98986c104fa28183c2e798dea | JavaScript | KauanCS/react-kauan | /src/board/index.js | UTF-8 | 4,087 | 2.90625 | 3 | [] | no_license | import React from "react";
import _ from "lodash";
import {
Status,
Square as SquareComp,
BoardRow,
Botao,
Body,
Tabela,
ContainerButton,
T3
} from "./styles";
import { Redirect } from "react-router";
const Square = ({ value, handleClick }) => {
return <SquareComp onClick={handleClick}>{value}</Squar... | true |
75703e30c5dffaea32ac77d6069471fdf459b4a9 | JavaScript | front-ant/udacity-p7-myreads | /src/App.js | UTF-8 | 1,563 | 2.671875 | 3 | [] | no_license | import React from 'react';
import * as BooksAPI from './BooksAPI';
import './App.css';
import ListBooks from './ListBooks';
import SearchBooks from './SearchBooks';
import {Link, Route} from 'react-router-dom';
class BooksApp extends React.Component {
state = {
books: []
};
// Get currently shelved books an... | true |
4c48c756dab111d1dfc9c375264da2c9784384d3 | JavaScript | jasonLaster/devtools-reps | /src/reps/text-node.js | UTF-8 | 1,969 | 2.515625 | 3 | [] | no_license | // ReactJS
const React = require("react");
// Reps
const {
isGrip,
cropString,
wrapRender,
} = require("./rep-utils");
const { MODE } = require("./constants");
// Shortcuts
const DOM = React.DOM;
/**
* Renders DOM #text node.
*/
let TextNode = React.createClass({
displayName: "TextNode",
propTypes: {
... | true |
ebd2b53b09647d6060b73bed98d5511020b033d4 | JavaScript | rockyliwanag/bib-yo-file | /controllers/books.js | UTF-8 | 1,819 | 2.75 | 3 | [] | no_license | const Book = require('../models/book');
const User = require('../models/user');
module.exports = {
index,
new: newBook,
create,
show,
edit,
update,
deleteBook
};
function index(req, res) {
Book.find({}, function(err, books) {
res.render('books/index', {books});
});
}
fun... | true |
7f96a4caf2ebd1b9a3a0cc5de3646b8ea2a1ff7f | JavaScript | shenchaoran/shenchaoran.github.io | /scripts/xiaomi/1.js | UTF-8 | 516 | 3.328125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | var readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal:false
});
rl.on('line', token => {
console.log(getRst(parseInt(token)));
});
function getRst(v) {
var fib = [1,1];
if(v === 1)
return 0;
if(v === 2)
... | true |
6b1dec684dc734a094378a86d563f92bac555aad | JavaScript | savtym/comp_systems | /app/js/appController.js | UTF-8 | 1,057 | 2.828125 | 3 | [] | no_license | //
// appController.js
//
import Observer from './common/observer.js';
import Variables from './common/variables.js'
import ModelController from './modelController.js';
import ViewController from './viewController.js';
export class AppController {
static start() {
Observer.addListener(Variables.isBusyProce... | true |
783d848ddcf224f9545eb86cbb86ddab7dfee11b | JavaScript | jppresents/Documentation | /scripts/helpers/importer/formatJson.js | UTF-8 | 1,199 | 2.53125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* formats json
* @type {*}
*/
var path = require('path');
var async = require('async');
var _ = require('lodash');
var config = require('./config');
var callApi = require('./callApi');
module.exports = function (array, cb) {
var flatArray = [];
flatArray = flattenArray(array, flatArray);
flatArra... | true |
962779eaea8e7be6429fe2642cf7477360e0d3a0 | JavaScript | trainings-juanmaguitar/training-leadtech-spring2019 | /staff/dbenavente/03-and-more/5.js | UTF-8 | 543 | 4.25 | 4 | [] | no_license | /*
randomRandom()
Randomizes a number n in range 0..100. Now randomizes n more numbers in that range, printing the largest of them.
*/
function randomRandom(){
var randomNumber = Math.floor(Math.random()*(101))
console.log('Quantity: '+randomNumber)
var array = []
var max = 0
for (var i=0;i<randomNumber;i++)... | true |
b658fde54dc11c16f264c8284fd9916daa0a340a | JavaScript | NunoGaioPereira/meditation-timer | /js/main.js | UTF-8 | 12,453 | 2.671875 | 3 | [] | no_license | const app = () => {
window.addEventListener('load', function(){
const loader = document.querySelector('.loader');
loader.className += ' hidden';
});
const bd = document.getElementsByTagName('body')[0];
const time_picker_element = document.querySelector('.time-picker');
// var hr_e... | true |
24ff121afed5d83e9220592b45cd0ba8c6514574 | JavaScript | PacktPublishing/Mastering-MEAN-Web-Development | /app/src/modules/services/socialAuth/socialAuth.spec.js | UTF-8 | 3,642 | 2.546875 | 3 | [] | no_license | /**
@todo
- figure out how to make google auth not break karma coverage..
- figure out timing / how to get the appSocialAuth data to be/stay set for 2nd call..
*/
'use strict';
var googleInfo =[
{
token: {
access_token: 'accessToken'
},
extraInfo: {
user_id: 'userId',
emailPrimary: 'emailPrimary'
}
... | true |
a2e4699c51c874d7e4c9287272f8d889665620fe | JavaScript | zz3599/Chat | /src/server/public/recorder.js | UTF-8 | 795 | 2.828125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var audioContext = new AudioContext();
var audioInput;
var inputPoint;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia || navigator.msGetUserMedia;
function gotStream(stream){
audioInput = audioContext.createMedi... | true |
a2a7ce93df1024c24e2593502935ac246851b9a7 | JavaScript | asd123ea/agua | /location.js | UTF-8 | 2,692 | 3.109375 | 3 | [] | no_license | // Posição padrão (São José dos Campos, SP)
var defaultPosition = new google.maps.LatLng(-23.1895062,-45.8630128);
// Definições para uso do Google Maps
var optionsGmaps = {
center: defaultPosition,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
},
mapTypeId: google... | true |
dae97e14f2094229db88ca16629045fa56324348 | JavaScript | FyDongGe/wbc | /es6/dist/js/index.js | UTF-8 | 245 | 2.921875 | 3 | [] | no_license | "use strict";
function bar() {
var x = arguments.length <= 0 || arguments[0] === undefined ? 2 : arguments[0];
var y = arguments.length <= 1 || arguments[1] === undefined ? x : arguments[1];
return [x, y];
}
var r = bar();
console.log(r); | true |
fdf006193eb3d14b0db5bcb4d2cfa2cc02a0868d | JavaScript | pcjser/leaning | /JYB/jyb/src/utils/tools.js | UTF-8 | 161 | 2.734375 | 3 | [
"MIT"
] | permissive | const rem = function (value) {
var photoWidth = 750;
var num = (parseInt(value, 10) / photoWidth * 10).toFixed(6)
return `${num}rem`;
}
export default rem | true |
d2f294bca8c9c530c85097079390e482486fb2d3 | JavaScript | chrisoreilly11/isItDumping | /isitDumping/js/main.js | UTF-8 | 1,517 | 2.90625 | 3 | [] | no_license | var API_KEY = "9e98ff202e28c0404208daae4abc71b0";
var cel = false;
var wd;
function displayTemp(fTemp, c){
if(c) return Math.round((fTemp - 32) * (5/9)) + " C";
return Math.round(fTemp) + " F"
}
$(function(){
var loc;
$.getJSON('http://ipinfo.io', function(d){
console.log("assigning the data...")
... | true |
46dbdcfef3d0a687bb6f0cb44c4f43822635e297 | JavaScript | zoeyusti/challenge-discos | /GameStation/public/Misc/js/registro.js | UTF-8 | 3,310 | 3.359375 | 3 | [] | no_license | var infoUsuarios = {};
var Usuarios = [];
var datos = localStorage.getItem('Usuarios');
var passwordOK = false;
var emailOK = false;
document.getElementById('botonNoRegistrado').addEventListener("click", mostrarRegistrar);
document.getElementById('botonRegistrado').addEventListener("click", mostrarIngresar);
document... | true |
e1b55465b0665c5a5c5742d3420d948f82f2f0d9 | JavaScript | buleok/vue-project | /src/filter.js | UTF-8 | 3,336 | 2.8125 | 3 | [] | no_license | // 全局过滤器
// 全局 filters
import Vue from 'vue';
import moment from 'moment';
// 地址拼接
Vue.filter('address', function (data) {
return data.province + data.city + data.district;
});
// 详情地址拼接
Vue.filter('addressDetail', function (data) {
console.log(data);
if (data.province) {
return data.province + da... | true |
c813c01039390fd932d8208c402f9abddad80400 | JavaScript | Jorditm/ProjectM1-superheroes | /js/SuperheroAPI.js | UTF-8 | 3,234 | 3.34375 | 3 | [] | no_license | "use strict";
let filtered = [];
let allHeroes = [];
const searchInput = document.querySelector("#search-input");
searchInput.addEventListener("input", filterHeroes);
function filterHeroes(event) {
const heroNames = searchInput.value.toLowerCase();
filtered = allHeroes.filter((oneObj) => {
if (!oneObj.name) {
... | true |
258d57b525bb36e98c16bd3f2da9bc44323d9977 | JavaScript | Mihozavr/Lab-Web-Programm | /index/technical_support_script.js | UTF-8 | 1,681 | 2.6875 | 3 | [] | no_license | var mydb = openDatabase("bicycles_rental_db", "0.1", "Bicycles database", 1024 * 1024);
mydb.transaction(function(t) {
t.executeSql("CREATE TABLE IF NOT EXISTS bicycles (id INTEGER PRIMARY KEY ASC, point TEXT, name TEXT, tel TEXT, date TEXT, bykePrice TEXT, start_time TEXT)");
});
if (!mydb) { alert("Failed to conn... | true |
828fcc440bf2b1b627e6096d9c2909f560449d43 | JavaScript | hansanguk0222/Computer_Architecture | /CPU/CPU_javascript/index.js | UTF-8 | 3,537 | 2.9375 | 3 | [] | no_license | const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
const input = []
let which = 0
const CPU = require('./CPU')
const Memory = require('./Memory')
const memory = new Memory()
const cpu = new CPU()
const parseValue = (str) => {
return... | true |
61e743d201e4ea4a02d529780d0d28a36802e362 | JavaScript | kyleect/ttk | /src/factory.js | UTF-8 | 1,349 | 2.625 | 3 | [
"MIT"
] | permissive | import defaultOptions from './defaultOptions';
import template from './template';
/**
* factory
* Returns a new template function with options applied
* @param {Object} options
* @param {boolean} options.mergeMiddleware If middleware defined in options should be merged with defaults. Default: false
* @param {stri... | true |
ce68feb353a23c7ab4d2466b157efcc4e090e8f5 | JavaScript | ismriv/mongodb-then | /tests/test-streaming-cursor.js | UTF-8 | 521 | 2.5625 | 3 | [
"MIT"
] | permissive | var assert = require('assert');
var insert = require('./insert');
insert([{
hello:'world1'
},{
hello:'world2'
}], function(db, done) {
var cursor = db.a.find();
var runs = 0;
var loop = function() {
var doc;
while (doc = cursor.read()) {
assert.ok(doc.hello === 'world1' || doc.hello === 'worl... | true |
a8aec482096a98a7eb336b7037291d95cc5a01f1 | JavaScript | roelwagner/WincAcademy | /eindopdracht_03/script.js | UTF-8 | 3,664 | 3.34375 | 3 | [] | no_license | // Variables
let menu = document.querySelector(".fa-bars");
let menuList = document.querySelector(".list");
let listItem = document.querySelector(".list__item");
let check = Array.from(menuList.children);
let backGround = document.querySelector("#background");
let grey = document.querySelector(".grey");
let red = docum... | true |
b1ba4e975b1e43fa0baa5acb4511aaeb8435987a | JavaScript | MiguelColo/lab-javascript-memory-game | /starter-code/src/memory.js | UTF-8 | 764 | 3.609375 | 4 | [] | no_license | var MemoryGame = function (cards) {
this.cards = cards;
this.pickedCards=[];
this.pairsClicked=0;
this.pairsGuessed=0;
};
MemoryGame.prototype.shuffleCards = function () {
var arrayLength =this.cards.length
for(var i=arrayLength-1; i>=0; i--){
var randNumer = Math.floor(Math.random()*(arrayLeng... | true |
2713c2d7363793e335ccf0df5ef04d2bf5f1e39d | JavaScript | owenlilly/bookmarkapp | /server/api/BookmarkApiController.js | UTF-8 | 1,163 | 2.546875 | 3 | [
"MIT"
] | permissive | import BookmarkService from "../services/BookmarkService";
export default function BookmarkApiController(app) {
const bookmarkService = new BookmarkService();
app.delete('/api/bookmarks/:id', (req, res) => {
if(!req.user){
res.status(401).json({ error: 'Login required' });
return;
}
bo... | true |
6c1a393877107d6ec7f75ef001961189c0394d30 | JavaScript | Peterlau7520/Redux_todo | /app/reducers/index.js | UTF-8 | 1,226 | 3.203125 | 3 | [] | no_license | // Inside app/reducers/index.js
const reducer = (state = [], action) => {
switch (action.type) {
// Missing cases
case 'ADD_TODO':
// copy new state so no mutations to old state
const newState = [ ...state ];
// create the todo from the action object
const n... | true |
34a2288ce97762516154c7b24063aad4823980d8 | JavaScript | nelsonwellswku/Random-Old-Stuff | /js/pong/ball.js | UTF-8 | 1,398 | 3.4375 | 3 | [] | no_license | var Ball = function(obj) {
//private vars
var ctx;
var x, y;
var dx, dy;
var radius;
//initialize private vars
this.ctx = obj.ctx;
this.x = obj.x || 75;
this.y = obj.y || 75;
this.dx = obj.dx || 5;
this.dy = obj.dy || 5;
this.radius = obj.radius || 10;
//public getter and setters
this.get_x = function... | true |
92dfb1408aea5093e977d2656204615f4f94f6bc | JavaScript | Eating-simulator/Eating-simulator.github.io | /doggobox/scripts/random.js | UTF-8 | 1,293 | 3.296875 | 3 | [
"MIT"
] | permissive | var random = {
flipACoin: function() {
if (Math.random() < 0.5) return true;
return false;
},
oneChanceOutOf: function(n) {
if (this.getRandomIntUpTo(n - 1) == 0) return true;
else return false;
},
getRandomFloat: function() {
return Math.random();
},
... | true |
074911500627ce3df60c785e3e05d03284e1d34a | JavaScript | delta94/code-katas | /src/61-find-a-duplicate-space-edition/findADuplicate.test.js | UTF-8 | 730 | 3.171875 | 3 | [
"MIT"
] | permissive | const {findADuplicate} = require('./findADuplicate')
describe("finding duplicates of an array without using space", () => {
test("single duplicate", () => {
const numbers = [1,2,2,3,4,5,6,7,8,9]
expect(findADuplicate(numbers)).toBe(2)
})
test("multiple duplicates", () => {
const num... | true |
6a0435c69d8660677c7c44048065c974f00892e9 | JavaScript | torch2424/assemblyscript-regex | /__tests__/quantifiers.js | UTF-8 | 856 | 2.6875 | 3 | [
"MIT"
] | permissive | const { RegExp, expectNotMatch, expectMatch, matches } = require("./util");
it("matches empty strings", () => {
expectMatch("a?", [""]);
expectMatch("a*", [""]);
});
it("zero or one", () => {
expectMatch("a?", ["a"]);
// expectNotMatch("a?", ["bc"]);
});
it("one or more", () => {
expectMatch("a+", ["a", "a... | true |
d21b251bbc6f03048057468152a2d0e1de57c9ec | JavaScript | hala1224/gradelink | /app/assets/javascripts/students.js | UTF-8 | 5,197 | 3.359375 | 3 | [] | no_license | const homeUrl = 'http://localhost:3000/'
// To make sure the DOM is loaded
// - Document ready function to hijack the click/submit events
// - jQuery => $ interface with the library
$(() => {
listenForAllStudentsClick();
// listenForNewStudentFromClick();
listenForStudent();
listenForNewStudentSubmission();
... | true |
693ac79e19d81d5dce9a883335f76828d96850fc | JavaScript | mhfairbank/challenging-front | /conde-nast/conde-nast-interview.js | UTF-8 | 612 | 3.140625 | 3 | [] | no_license | var SQUARE_COUNT = 25;
(function () {
var addOn = "";
for (var i = 0; i < SQUARE_COUNT; i++) {
addOn += '<div class="square"></div>';
}
// console.log(addOn);
$('.container').append(addOn);
$('.container').on('click', '.square', function(){
$('.square').removeClass... | true |
4e702f008ea4092652e30cbd803aa96ee1dcf2e9 | JavaScript | jhreact/mytunes | /client/views/SongQueueEntryView.js | UTF-8 | 672 | 2.6875 | 3 | [] | no_license | // SongQueueEntryView.js - Defines a backbone view class for the song queue entries.
var SongQueueEntryView = Backbone.View.extend({
initialize: function() {
// Listen for model changes and propagate to ui
this.model.on('change', this.render, this);
},
className: 'songQueueEntryViewRow',
tagName: 'tr',... | true |
a774fcb416ab0a3c44341e4a0aac851d2875c3fa | JavaScript | nikhila29/10XAcademy-Assignments | /Root/HTML ,CSS,JS/simple TODO list and closure/arrayToObject.js | UTF-8 | 557 | 4.25 | 4 | [] | no_license | /* Convert an array([1,2,3,4,5]) to an
object({‘0’: 1, ‘1’: 3, ‘2’: 6, ‘3’: 10, ‘4’: 15})
where key represents the index of the array
and value represents sum of values up until
that index in the array.*/
function arrToObject(arr){
return arr.reduce(function(accumulator,num,index){
if (index===0){... | true |
d2966b555c192ffa3c5bd05ee196acba414fbee9 | JavaScript | iamclif/ES6-cheat-sheet | /javascript-basics/built-in-objects-methods.js | UTF-8 | 746 | 4.09375 | 4 | [] | no_license | // built in objects and methods //
// setTimeout - method on the window object
setTimeout(thisFirstParamIsTheFunction, thisSecondParamIsTheTime)
setTimeout(function(){
console.log('finished');
}, 1000)
// setInterval runs every x seconds
setInterval(functionHere, interval)
// stop the setInterval
var interval = setI... | true |
5ad248b5eb395a06d98819d2a676ba3dc71029fe | JavaScript | amsross/pull-fmap | /test/index.js | UTF-8 | 709 | 2.640625 | 3 | [
"MIT"
] | permissive | 'use strict';
const test = require('tape');
const pull = require('pull-stream');
const fmap = require('../');
test('fmap throughs ends stream', function (t) {
const err = new Error('unwholesome number');
pull(
pull.values([
[1, 2, 3],
[3.4, 4],
]),
fmap(function (e) {
if (e !== ~~e) ... | true |
908d9fae540d04f194e8a12a641fc40bc3e0041b | JavaScript | mshatikhin/potapkin | /src/redux/actions/storiesActions.js | UTF-8 | 751 | 2.65625 | 3 | [] | no_license | // @flow
export const UPDATE_STORIES = 'UPDATE_STORIES';
export function updateStories(stories: any[]) {
return { type: UPDATE_STORIES, stories };
}
export function storyRequest(userId: string, apiKey: string) {
return (dispatch: any) => {
return fetch(`https://api.flickr.com/services/rest/?method=fl... | true |
0513c2230aead957c623a09f9704ce7a04a24319 | JavaScript | carols10cents/aoc-rs-2019 | /aoc-13-02-wasm/www/index.js | UTF-8 | 3,873 | 3.28125 | 3 | [
"MIT"
] | permissive | import { Screen, Tile, Joystick } from "aoc-13-02";
import { memory } from "aoc-13-02/aoc_13_02_bg";
const CELL_SIZE = 10; // px
const GRID_COLOR = "#CCCCCC";
const EMPTY_COLOR = "#FFFFFF";
const WALL_COLOR = "#000000";
const BLOCK_COLOR = "#CC00CC";
const PADDLE_COLOR = "#00CCCC";
const BALL_COLOR = "#CCCC00";
// Co... | true |
efa258949cb2d7e0072924066b41a2631d71eca7 | JavaScript | ysfktluu/-hmm | /komutlar/yardım-not.js | UTF-8 | 20,992 | 2.65625 | 3 | [] | no_license | const Discord = require("discord.js");
const db = require("quick.db");
exports.run = async (client, message, args) => {
var p = "prefixiniz"
if (!args[0])
return message.channel.send(
new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`Lütfen bir komut belirtin. Eğer not haznel... | true |
f331591f163cf4103e704d2679dcdcd0f06f1a2a | JavaScript | thephilwells/js_homework | /button.js | UTF-8 | 126 | 2.765625 | 3 | [] | no_license | var func = function buttonAlert() {
alert("You clicked the button.");
}
document.getElementById("myButton").onclick = func;
| true |
3dcd57b5c30a6c953026ba01e0112b8d9eeba19c | JavaScript | orYoffe/corona | /src/utils.js | UTF-8 | 1,799 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, {memo} from 'react';
import {Text, View} from 'react-native';
import {white} from './colors';
export const chartList = {
Cases: 'confirmed',
'Active cases': 'active',
Recovered: 'recovered',
Deaths: 'deaths',
'Population infected': 'precentage',
};
export const generateBarData = (countries, so... | true |
30248e0d61a89ae7930a75e3302e9c29e83d3a2e | JavaScript | goFrendiAsgard/chimera-framework | /example/web/chains/components/mean.js | UTF-8 | 256 | 2.828125 | 3 | [
"MIT"
] | permissive | module.exports = mean
function mean (data) {
let total = data.reduce((total, num) => { return total + num })
return parseFloat(total) / data.length
}
if (require.main === module) {
let data = JSON.parse(process.argv[2])
console.log(mean(data))
}
| true |
dc1533ee195e17e6105b9fdcca2576532495efe4 | JavaScript | deepak9518/expensify_new | /frontend/src/components/balanceSheet.js | UTF-8 | 2,050 | 2.5625 | 3 | [] | no_license | import React ,{useState,useEffect}from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
const BalanceSheet = () => {
const [results, setResults] = useState({
income: [],
});
useEffect(() => {
axios.get('http://localhost:5000/api/')
.then(response => {
... | true |
79e862aa4ee64a5f0e15604ad9a8536657871029 | JavaScript | janevsky/React.js | /cas8/src/components/App.js | UTF-8 | 568 | 2.703125 | 3 | [] | no_license | const App = () => {
return (
<div className='app'>
</div>
);
};
/* Homework 08
1. Create simple signup form. The form should be consisted of:
* First name - reuqired, minimum length 2 characters, maximum length 15 characters
* Last name - reuqired, minimum length 2 characters, maximum length 20 ... | true |
ec362799fe5adb2cf8f3eb75b81accc4d63539ba | JavaScript | skmuddamsetty/ds-and-algorithms | /javascript/binary-tree-problems/shared/tree.js | UTF-8 | 591 | 2.9375 | 3 | [] | no_license | const { Node } = require('./node');
/* Construct below tree
1
/ \
/ \
2 3
/ / \
/ / \
4 5 6
/ / \ \
/ / \ \
7 8 9 10
*/
let a = new Node(1);
a.left = new Node(... | true |
afbb66278ce6873760cd257fed710ef79a00bc11 | JavaScript | GomesCamila/Conceitos-Node | /index.js | UTF-8 | 1,510 | 2.984375 | 3 | [
"MIT"
] | permissive | const express = require('express');
const server = express();
server.use(express.json());
const tasks = {
'1': {id: "1", title: "Projeto 1", tasks: ["Tarefa1", "Tarefa2"]},
'2': {id: "2", title: "Projeto 2", tasks: ["Tarefa1", "Tarefa2"]},
'3': {id: "3", title: "Projeto 3", tasks: ["Tarefa1", "Tarefa2"]}
... | true |
df7361562963bf608eab3586a1d599391517d8e6 | JavaScript | DmitryParkhomenko/eloquentjavascript | /functions/exercises.js | UTF-8 | 411 | 4.03125 | 4 | [] | no_license | /*
function power(base, exponent) {
if (exponent === undefined)
exponent = 2;
var result = 1;
for (var count = 0; count < exponent; count++)
result *= base;
return result;
}
console.log(power(4));
console.log(power(4, 3));*/
function multiplier(factor) {
return function (number) {
... | true |
5a839aa5f13c64e01dfd39a387c5a0424c3cd2c0 | JavaScript | kaponnon-s/Backend_individual_project | /server.js | UTF-8 | 6,795 | 2.75 | 3 | [] | no_license | var http = require("http");
var url = require("url");
const {
register,
addMoney,
payMoney,
checkTollStation,
checkMoney,
listTransaction,
Validator,
} = require("./function");
getPost = async (req) => {
return new Promise((resolve) => {
let req_input = [];
req
.on("data", (chunk) => {
req_input.pu... | true |
9602d13a645d65c3f44d5ade3862162736757192 | JavaScript | scy/jquery.regexpclass | /jquery.regexpclass.js | UTF-8 | 2,577 | 3.265625 | 3 | [] | no_license | // jQuery RegExpClass plugin v0.1
// Allows .hasClass and .removeClass to receive a RegExp parameter.
// by Tim Weber <scy@scy.name>
// Code taken from https://github.com/NV/jquery-regexp-classes, cleaned and commented.
(function ($) {
'use strict';
var space = /\s+/;
(function (origHasClass) {
// Replace hasClass... | true |
dd27d5f2fc92065ba3d7ce6fff305029514a6286 | JavaScript | Keatenh/helpful-snippets | /serverless/exercise/ui/src/App.js | UTF-8 | 2,355 | 2.90625 | 3 | [] | no_license | import React, { Component } from 'react';
import TodoList from './TodoList'
import TodoItems from './TodoItems'
// import logo from './logo.svg';
import './App.css';
// const env = ENV.toLowerCase()
class App extends Component {
inputElement = React.createRef()
constructor(props) {
super(props)
this.state ... | true |
9f72f32ac19596875614fb742c1231de4e5f7e9e | JavaScript | gravitybone/mp-picross | /server/game/GameModel.js | UTF-8 | 360 | 2.515625 | 3 | [
"MIT"
] | permissive | class GameModel {
constructor(roomId) {
this.gameState = [];
this.numOfXs = 0;
this.isGameOver = false;
this.isGameWon = false;
this.userMoves = [];
this.roomId = roomId;
}
getGameState() {
return this.gameState;
}
getHintData() {
return this.hintData;
}
getLeftToFill() {
return this.numToFill... | true |
cee5a8bc2e44d8eb99be7808a901cce9c1292351 | JavaScript | janicedong0214/frontendSkills | /es6/array.js | UTF-8 | 726 | 3.890625 | 4 | [] | no_license | //map实现
function myMap(fn,context) {
let arr = Array.prototype.slice.call(this);
let newArr = [];
for(let i=0,len=arr.length;i<len;i++){
if(fn&&arr.hasOwnProperty(i)){
newArr.push(fn.call(context,arr[i],i,this));
}
}
return newArr;
}
let arr = [1,2,3,4,5];
let... | true |
c09a17e7a10264d03877ef5bc268c0b327ff621f | JavaScript | TriangleBill/dohoot | /src/js/module/filter.js | UTF-8 | 306 | 3.046875 | 3 | [] | no_license | const category = document.querySelector('#category');
const categoryItems = document.querySelectorAll('.category');
category.addEventListener('click', (event) => {
const target = event.target;
categoryItems.forEach(item => item.classList.remove('active'));
target.classList.add('active');
});
| true |
63cda4bc1ed6d76b40495693bbb9cfcd968fa663 | JavaScript | arangodb/arangodb | /3rdParty/V8/v7.9.317/test/mjsunit/regress/regress-1423.js | UTF-8 | 2,394 | 2.65625 | 3 | [
"bzip2-1.0.6",
"BSD-3-Clause",
"Apache-2.0",
"SunPro",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception... | permissive | // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | true |
14e4ffa027a947b8c17fd537d1a404d0d82bb9fb | JavaScript | malerey/clase-64- | /index.js | UTF-8 | 3,493 | 4.3125 | 4 | [] | no_license | // Metodos de array
// Son metodos que reciben como parametro una funcion
// Y esa funcion se le va a aplicar a todos los miembros del array
// Casi todos reciben como parametros en esa funcion cada uno de los elementos,
// el indice, y el array
// MAP
// Retorna un array nuevo, cuyos elementos son lo que retorna la... | true |
17ae7cb4d4b5f79ebf29d996f0773d8e9bae2c43 | JavaScript | NguyenSiTrung/DemoChatSOTATEK | /server/server.js | UTF-8 | 5,985 | 2.671875 | 3 | [] | no_license | //setup express
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var mongodb = require('mongodb');
var fs = require("fs");
var MongoClient = mongodb.MongoClient;
var url = 'mongodb://localhost:27017/chatapp';
var roles = {
sende... | true |
c542e25628f5cbd08784d8191979e7237d9b9924 | JavaScript | ymegan08/bamazon | /bamazonCustomer.js | UTF-8 | 2,799 | 3.0625 | 3 | [] | no_license | var inquirer = require("inquirer");
var mysql = require("mysql");
// initiate mySQL package with configurations
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "",
database: "bamazonDB"
});
// give function of what we want to do when connected
conne... | true |
d23d1cd4f6563337f8de2b89861bde2b353e34c6 | JavaScript | tolomero/react-gifexpertapp | /src/helpers/getGifs.js | UTF-8 | 1,207 | 2.84375 | 3 | [] | no_license |
// aca toca expoportarlo y ver que estado esta usando par allamarlo he importar
export const getGifs = async( category ) => {
// ACA BUSCAMOS LA URL EN GUIPHY DEVELOPERS POR SEARCH LA COPIAMOS LA PEGAMOS EN
// EL PROGRAMA POSTMAN ESCRIBIMO S api_key y alfrente pegamos la url que nos dio
// la pagina de... | true |
25e01d5d10fcee353e16b46f7458a09a45f86965 | JavaScript | wagnxx/whatsapp-clone | /web/public/workers/hash.js | UTF-8 | 826 | 2.515625 | 3 | [] | no_license | const workSelf = this;
// eslint-disable-next-line no-undef
importScripts('/workers/spark-md5.js');
workSelf.onmessage = (e) => {
const chunkList = e.data;
const spark = new workSelf.SparkMD5.ArrayBuffer();
let count = 0;
let percentage = 0;
loadNext(0);
function loadNext(index) {
const reader = new F... | true |
0e9da72df38b19d8b9158909b977dd1c564d25d6 | JavaScript | TONYABAH/rules-engine | /src/core/DefaultParser.js | UTF-8 | 25,537 | 2.515625 | 3 | [
"MIT"
] | permissive | /* jshint esversion:8 */
// import CustomEvent from './CustomEvent'
import pubsub from './EventPubSub'
import Lexer from './DefaultLexer'
import { MATH_CONSTS, MATH_FUNCS } from './Regex'
import ParseToken from './DefaultTokenParser'
import {
YES, NO, TRUE, FALSE, ELSE, ELSEIF, AND, OR, IF, RULE, THEN, /* CF, MOD, */... | true |
6a742dd0335d7231485e55266b7a3b3eeb903028 | JavaScript | williamhbaker/js101 | /lesson_5/11.js | UTF-8 | 463 | 3.9375 | 4 | [] | no_license | let arr = [{ a: 1 }, { b: 2, c: 3 }, { d: 4, e: 5, f: 6 }];
/*
let newArr = arr.map((obj) => {
return Object.fromEntries(Object.entries(obj).map((pair) => {
return [pair[0], pair[1] + 1];
}));
});
console.log(arr);
console.log(newArr);
*/
let newArr = arr.map((obj) => {
let incrementedObj = {};
Object.... | true |
b5c64b64f1009fa17ab150483a9820c4caa02d31 | JavaScript | rvsriller/dioBuscaSubstituicaoJavascript | /4-Jogo.js | UTF-8 | 1,532 | 3.90625 | 4 | [] | no_license | /*
Pedra-papel-tesoura-lagarto-Spock é uma expansão do clássico método de seleção em jogo de pedra-papel-tesoura.
Atua sob o mesmo princípio básico, mas inclui outras duas armas adicionais: o lagarto
(formado pela mão igual a uma boca de fantoche) e Spock (formada pela saudação dos vulcanos em Star Trek).
Isso red... | true |
5d18ce63605a2f6434e4d4a95236374951f1f3c3 | JavaScript | jldiegel/oregon_trail | /oregon_trail.js | UTF-8 | 1,774 | 4.03125 | 4 | [] | no_license | (function(){
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function Traveler(name, amount, isHealthy){
this.name = name
this.amount = amount
this.isHealthy = isHealthy
}
fun... | true |
eeba67da3f18ff889ac3f691613048200ac1755d | JavaScript | tejas77/codechef-nodejs | /Beginner/CHEFDETE/index.js | UTF-8 | 497 | 3.09375 | 3 | [] | no_license | process.stdin.resume();
process.stdin.setEncoding('utf8');
var arr = '';
process.stdin.on('data', function (chunk) {
arr += chunk;
});
process.stdin.on('end', function () {
arr = arr.split('\n');
let n = Number(arr[0]);
const nArray = arr[1].split(' ').map(Number);
let s = new Set();
nArray.fo... | true |
473b56bca10bed3ca2a9e8a0d22ec2ca343b7d17 | JavaScript | PurslaneQAQ/2D-Contour-Generator | /mesh.js | UTF-8 | 5,028 | 2.671875 | 3 | [] | no_license | var Mesh = function(dCanvas, manager, data, id)
{
CanvasLayer.call(this, dCanvas, manager, id);
this.vtx = [];
this.elements = [];
this.centers = [];
this.weights = [];
// console.log($(pic)[0].width);
let lines = data.split("\n");
let vtxNum = parseInt(lines[0]);
for(let i = 0; i < ... | true |
7c9eeaf430eda84c080189a9d1e03cc1aaf3fedb | JavaScript | bruno911/test | /003.js | UTF-8 | 4,037 | 3.390625 | 3 | [] | no_license | /*
003: Create a small gallery with some images of your choice. The images can be stored in a static list (so
you can just use Javascript & HTML, and if you want some CSS, but don’t worry about the look and
feel). Gallery doesn’t have to be of type “slider”, it should be possible to go to the next and previous
image ... | true |
87b9f237c2b3284b4176021a3a760aeab441f3d4 | JavaScript | nataliyabondareva/joke-display | /src/actions/jokes.js | UTF-8 | 376 | 2.59375 | 3 | [] | no_license | import request from 'superagent'
export const fetchedJoke = joke => {
return ({
type: JOKE_FETCHED,
joke
})
}
export const fetchJoke = () => dispatch => {
request
.get(`https://official-joke-api.appspot.com/jokes/programming/random`)
.then(res => {
dispatch(fetchedJoke(JSON.parse(res.text)... | true |
4859dbaef9282afaf47db745d4a86fa83c7068fe | JavaScript | hannahlouwho/coding-120 | /Week 11/Nov 4, 2019/scripts/index.js | UTF-8 | 1,336 | 3.453125 | 3 | [] | no_license | /*
Author: Hannah Wheeler
Purpose: Making a Game
Date: Nov 4, 2019
Revised Date:
*/
var x = 50;
var y = 50;
var diameter = 50;
var speed = 3;
var speedY = 5;
var squareX = 100;
var squareY = 100;
function setup()
{
createCanvas(1265, 600);
function draw()
{
background(211,211,211);
noStroke();
... | true |
d8a005db65b3f97aa327db90f706513345fab385 | JavaScript | YeimerKilLP/AplicacionPresupuestos | /js/Dato.js | UTF-8 | 357 | 2.890625 | 3 | [] | no_license | //Clase Padre
class Dato {
constructor(description, valor) {
this._description = description;
this._valor = valor;
}
get description() {
return this._description;
}
set description(description) {
this._description = description;
}
get valor() {
return this._valor;
}
set valor(val... | true |
cd19e1133b6c9ee33ec52ab3a9b08858893e10f9 | JavaScript | rebbbeccao/Constructor-Hangman-BritneySpears-Hits | /library/game.js | UTF-8 | 3,658 | 3.6875 | 4 | [
"Apache-2.0"
] | permissive | var inquirer = require('inquirer');
var chalk = require('chalk');
var Word = require('./word');
// Game constructor is responsible for keeping score
// & controlling the flow of the overall game
function Game() {
// Saved as reference because 'this' will change in Inquirer
var self = this;
var round = 1;
// S... | true |
4dc8c4fe44f32b29ce4e8493c9dc737e1b16bda0 | JavaScript | aubrielee/aubrielee.github.io | /main.js | UTF-8 | 10,074 | 2.96875 | 3 | [] | no_license | //Wait for the HTML Document Object Model to load
document.addEventListener("DOMContentLoaded", function (event) {
//Returns a string with an octothorpe in front
let anchor = document.location.hash;
let firstIndex;
const aboutPage = document.getElementById('about');
const aboutContent = document.... | true |
ab1c59cfc367f0aaaa927d4ebd016bb08a7fbc16 | JavaScript | AdalDesign/WP-snippets | /FAQ_runs_client_side.js | UTF-8 | 1,576 | 2.890625 | 3 | [] | no_license | // Turn simple header and paragraph HTML into an indexed FAQ, client side and lite!
$('#FAQ section h2, #FAQ section h3').each(function( index, domEle ) {
index = index + 1;
var $class = '';
if ( $(domEle).is('h3') ) { $class = 'class="space-left"'; }
$('#FAQ .side-nav').append('<li><a points="h-' + index ... | true |
2fe1851dd141dcca22521ccc5009143044b00910 | JavaScript | AgustinCastellaro/front-end-test-coding | /src/hook/httpUsers.js | UTF-8 | 387 | 2.78125 | 3 | [] | no_license |
export function get(path, query){
let API = "https://api.github.com/search/users?";
console.log(path)
console.log(query)
if(path == "user"){
API = "https://api.github.com/users/" + query;
}
if(path == "users"){
API = API + "q=" + query + "&per_page=10";
}
console.... | true |
4a24efd3d9532aaccd5da199d28a969e93dca487 | JavaScript | YurleyTorres/Taller3_16_04_2021 | /Ejercicio5.js | UTF-8 | 159 | 3.671875 | 4 | [] | no_license | //5. Realizar un programa que permita escribir los 100 primeros pares
let i;
for(i = 0; i<= 100 ; i++){
if(i%2==0){
console.log(`Numeros pares ${i}`);
}
} | true |
77fcdb29932f3392606f823b0f4643befdaff89b | JavaScript | rohangrg/hackmit-puzzle-2018 | /hackgps/web/src/utils.js | UTF-8 | 297 | 2.609375 | 3 | [
"MIT"
] | permissive | function isValid(r, c, gridH, gridW) {
return !(r < 0 || r >= gridH || c < 0 || c >= gridW);
}
function toNode(r, c, gridH, gridW) {
return r * gridW + c;
}
function toCoord(node, gridH, gridW) {
return [(node - node % gridW) / gridW, node % gridW];
}
export { isValid, toNode, toCoord }; | true |
e0a40132fe6812d88d98773f72867bde1291258f | JavaScript | xpolb01/Learning | /02-Factory-Functions/calculator.js | UTF-8 | 266 | 3.109375 | 3 | [] | no_license | var createCalculator = function() {
return {
result: 0,
value: function() {
return this.result;
},
add: function(num) {
this.result += num;
},
subtract: function(num) {
this.result -= num;
}
};
}; | true |
2427e10585dc9e05186d1400862b9e44a56ea3ee | JavaScript | cinemaouvert/Sizif | /dist/js/built.js | UTF-8 | 103,939 | 3.328125 | 3 | [] | no_license | /**
* @file This file handles the "util" name space.
*/
/**
* The "util" name space contains independent methods used occasionally
* by some part of the application.
* @namespace
*/
util = {};
/**
* It adds scripts using a classic way which means using the "script" tag
* in the asynchronous case. If it's a... | true |
67780059d1be49e9a55f141c8dc8699ebe362b5c | JavaScript | SreenityaPonipireddy/SnickerdoodleRecipe | /sketch.js | UTF-8 | 825 | 2.765625 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
var paper1;
var ground1;
var dustbin1;
var engine, world;
function setup() {
createCanvas(1000, 700);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
paper1 = new Paper(200, 400,10);
ground1=ne... | true |
c8af91d75b1ca7e6270bdd5f5ddea20690e677eb | JavaScript | AndreVarandas/the-flappy-bird | /src/scenes/background.js | UTF-8 | 1,981 | 3.140625 | 3 | [
"MIT"
] | permissive | import { Sprite } from 'kontra'
import { GAME_WINDOW } from '../utils/window'
/**
* This class manages the Background Sprite.
* The image to display at the background will depend on the
* time of the day.
*/
class Background {
constructor(imageAssets) {
this.imageAssets = imageAssets
this.backgroundSprit... | true |
4af164d3200b7cf9b2cb428d1adda8129ebce47b | JavaScript | Tiamat-Tech/pieces-alex-bainter | /packages/utilities/src/theory/get-octave.js | UTF-8 | 194 | 2.75 | 3 | [
"MIT"
] | permissive | const getOctave = (note = '') => {
const match = note.match(/[abcdefg][#b]?(\d+)/i);
if (!match) {
return null;
}
return Number.parseInt(match[1], 10);
};
export default getOctave;
| true |
340dfb77f78471ba4ac478acebe98b530ad76fb3 | JavaScript | AwayAwayAway/FoodDeliverReact | /src/components/OrderInput/useInput.js | UTF-8 | 698 | 2.875 | 3 | [] | no_license | import {useState} from 'react';
const useInput = validateValue => {
const [enteredValue, setEnteredValue] = useState('');
const [isTouched, setIsTouched] = useState(false);
const valueIsValid = validateValue(enteredValue);
const valueIsInvalid = !valueIsValid && isTouched;
const valueChangeHandler = ev... | true |
c1641e30d0bc4ddcc78ef1b948de3c8fd0788aa9 | JavaScript | kenjiwebdev/pomodoro-overload | /src/components/PomodoroStatistics.js | UTF-8 | 1,846 | 2.765625 | 3 | [
"MIT"
] | permissive | import React from 'react';
import { useState } from 'react';
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import ls from 'local-storage'
/*
Pomodoro Statistics Component allows the user to see the task s/he have done
and the total ammount of Pomodoro s/he have finish.
*/
fu... | true |
dd221b3565584ecc436925cb45935dcc8385d21b | JavaScript | korylprince/snmp-tracker-ui | /store/date.js | UTF-8 | 2,340 | 2.59375 | 3 | [
"MIT"
] | permissive | import {format, sub, parse} from "date-fns"
export const state = () => ({
start_date: null,
end_date: null,
})
export const mutations = {
update_start_date(state, start_date) {
state.start_date = start_date
},
update_end_date(state, end_date) {
state.end_date = end_date
},
}
e... | true |
9768c90adb3953521fbbadc0a2c9ef70a700135b | JavaScript | Johnsontgm2/johnson_travis_SDI2 | /Day9/js/Day9anon.js | UTF-8 | 588 | 4.09375 | 4 | [] | no_license |
/*
Travis Johnson
Section 00
07/25/15
Day 9 anon
*/
//alert("Testing");
//Basic Anonymous function
//var functionName = functions(){};
//Extremely popular in javascript and jquery
//Important in Object oriented programming
//For now, it is a matter of style choice between anon and regular
//create anon fu... | true |
1df314e48afbb28cdc2d6d20d63943c192a793eb | JavaScript | webSongNO1/my_study_node_cese | /传智播客/example/demo5/readdir.js | UTF-8 | 915 | 2.515625 | 3 | [] | no_license | var http=require('http'),fs=require('fs');
http.createServer(function (req,res) {
//略过小图标
if(req.url=='/favicon.ico'){return}
//遍历album里的所有文件夹
fs.readdir('./album/',function (err,files) {
//他会打印出来这个文件夹中所有文件和文件夹
//存放文件夹数组
//强制把异步变同步
var webjianjia=[],wenjian=[];
(f... | true |