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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fe98670d438e2966be3def42f33fb027405c7c85 | JavaScript | TekMonksGitHub/xforge | /lib/crypt.js | UTF-8 | 4,577 | 2.90625 | 3 | [
"MIT"
] | permissive | /*
* (C) 2015 - 2018 TekMonks. All rights reserved.
*/
if (!global.CONSTANTS) global.CONSTANTS = require(__dirname + "/constants.js"); // to support direct execution
const cryptmod = require("crypto");
const crypt = require(`${CONSTANTS.CONFDIR}/crypt.json`);
/**
* Encrypts the given string or Buffer
* @param {s... | true |
24ea693228e7e6295e9ce0c09d88319e73091f88 | JavaScript | dinndev/JS_Lessons | /1_JS_Fundamentals/window_methods.js | UTF-8 | 1,731 | 3.734375 | 4 | [] | no_license | // WINDOW METHODS - OBJECT & PROPERTIES
// alert
// alert('Hello World!');
// Prompt
// const input = prompt();
// alert(input);
// Confirm
// if(confirm('Are you sure?')) {
// console.log('Yes');
// } else {
// console.log('No');
// }
let val;
// // Outer height and width
// val = window.outerHeight;
// val ... | true |
e5366ff4fc1bcad104b935e2a6a31033e26c325a | JavaScript | nari10/getjobweb | /TeamWeb/getjob/static/calendar/certificate.js | UTF-8 | 3,415 | 2.765625 | 3 | [] | no_license | $().ready(function(){
/* 자격증 리스트 받아와 띄우기 */
$.ajax({
url: 'http://localhost:8787/getcer.job',
type: "GET",
dataType: "json",
success: function (data) {
for (var i in data) {
var option = `<option value= ${data[i].codeno}>${data[i].codename}</optio... | true |
20a449096e2a74ef79022a9443a5ef90414a4d27 | JavaScript | kcabading/lyricals | /src/helpers/parseMoreResults.js | UTF-8 | 650 | 2.6875 | 3 | [] | no_license | import $ from 'jquery';
export default (html) => {
let arResults = [];
let objMainContent = $(html).closest("div.main-page");
let objResultsContent = $(objMainContent).find('.col-xs-12');
let objResultsTable = $(objResultsContent).find('table').html();
let objRows = $(objResultsTable).find('tr... | true |
196e2a28a368da31e285546a5044364433c1e91e | JavaScript | bambora-na/battlesnake-node | /test/fsm.js | UTF-8 | 2,020 | 2.875 | 3 | [] | no_license | 'use strict';
require('mocha');
// Ensure we are using the 'as promised' libs before any tests are run:
require('chai').use(require('chai-as-promised'));
var expect = require('chai').expect;
describe("ai", function() {
describe("fsm", function() {
it('Should create FSM', function() {
var fsm = require('... | true |
dd5aa557a15644f133096881e16ee0896ab51623 | JavaScript | GerrardE/EPIC-Mail | /server/middlewares/group.js | UTF-8 | 2,216 | 3.328125 | 3 | [] | no_license | // Regex Validations: stack overflow
class GroupValidatorHandler {
static validGroupName(req, res, next) {
let {
name
} = req.body;
if (name === undefined) {
return res.status(400)
.send({
status: 400,
message: 'Error: name field cannot be empty',
}... | true |
484c3cb39a27ec62dff37bbd97d7814b8e0b004b | JavaScript | mojdruginalog/bit-cs | /arrays/array1.js | UTF-8 | 269 | 3.28125 | 3 | [] | no_license | var months = ['january','february','march','april','may','june','july','august','september','october','november','december'];
var newMonth = [months[5], months[9],months[0]];
console.log(newMonth);
console.log(newMonth[1])
//console.log(months[5], months[9],months[0]) | true |
5f729cb23afbf7c5c76a0755ea116259817930e7 | JavaScript | YanaVG/js-int-course | /lesson-3/prototypes/class-ES6.js | UTF-8 | 758 | 3.59375 | 4 | [] | no_license | class SuperPerson {
constructor(name, gender){
}
getFamilyStatus2() {
if (!this.family) {
return 'Free';
}
return 'married';
}
getFamilyStatus() {
if (!this.family) {
return 'Free';
}
return 'married';
}
}
class Person extends SuperPerson {
constructor(name, gen... | true |
459a63fda01dcd5a0c1808123414483871c29ef9 | JavaScript | svmarinez/lab-javascript-vikings | /starter-code/src/viking.js | UTF-8 | 2,814 | 3.796875 | 4 | [] | no_license | // Soldier
function Soldier(health, strength) {
this.health = health;
this.strength = strength;
}
Soldier.prototype.attack = function() {
return this.strength;
}
Soldier.prototype.receiveDamage = function(damage) {
this.health -= damage;
}
// Viking
function Viking(name, health,... | true |
43069805ab7e8b6c83311d79dee5c0e817fa39b4 | JavaScript | melaniaSIIT/frontend5-1 | /models/MovieList.js | UTF-8 | 439 | 2.6875 | 3 | [] | no_license | function Movies() {
}
// Even though search URLS are put on top of URL for all movies, keep methods separate
Movies.prototype.getAll = function(takeValue, skipValue) {
return $.get("https://ancient-caverns-16784.herokuapp.com/movies/?take=" + takeValue + "&skip=" + skipValue);
}
Movies.prototype.searchByTit... | true |
0a2ea2a60b0a4ec480142240def41552e4ceb10f | JavaScript | nestorbe/payroll-metamask | /src/containers/Contractors.js | UTF-8 | 3,604 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import Button from '@material-ui/core/Button';
import { Box } from '@material-ui/core';
import Chip from '@material-ui/core/Chip';
import { StyledTextField, StyledAlert, StyledTextFieldMulti } from './Styles'
class Contractors extends Component {
constructor(props) {
sup... | true |
ed5426824cc29288b2ea65ec695f03b5a99dc390 | JavaScript | bboy-xp/InterviewCode | /async-post.js | UTF-8 | 1,361 | 3.375 | 3 | [] | no_license | function getData(urls) {
return new Promise((resolve, reject) => {
// 新建一个res数组用来储存请求返回的数据
const res = [],
len = urls.length;
// 传入一个urls数组,遍历发送请求
urls.forEach((url, i) => {
fetch('http://localhost:8080' + url).then(data => data.json())
.th... | true |
fe339297fb7372cf7a5e1cbfaca961d0be388576 | JavaScript | ro8t/UCB-DA-Projects | /JS Assignment/static/js/app.js | UTF-8 | 578 | 3.078125 | 3 | [] | no_license | // from data.js
var tableData = data;
var tbody = d3.select("tbody");
function buildTable(data) {
tbody.html("");
data.forEach((dRow) => {
var tr = tbody.append("tr");
Object.values(dRow).forEach((val) => {
var td = tr.append("td");
td.text(val);
}
);
});
}
function handleCl... | true |
59567e37428494af46328aa79f82686be597daf4 | JavaScript | HansKre/react-calculator | /src/Button.js | UTF-8 | 2,745 | 2.75 | 3 | [] | no_license | import React from 'react';
import './Button.css';
export default class Button extends React.Component {
constructor(props) {
super(props);
this.state = {
keys: this.setKeys(props.name.toUpperCase())
}
this.handleKeyPress = this.handleKeyPress.bind(this);
this.handleClick = this.handleClick.... | true |
d023f21af10226f915ad3fb67adfc326627f72b2 | JavaScript | philpownall/metermaid | /MeterMaid.js | UTF-8 | 3,568 | 2.875 | 3 | [] | no_license | //
var RogersClickCount = 0;
var HydroClickCount = 0;
var mydate = 0;
var dayusage = 0;
var day$ = 0;
var monthusage = 0;
var month$ = 0;
var yearusage = 0;
var year$ = 0;
var VirginClickCount = 0;
var TelusClickCount = 0;
$("#HydroData").load("HydroData.txt");
$(document).ready(function(){
// get the last line (... | true |
08de628508c0f3dae51bc1129c3ba46f362df64f | JavaScript | graflann/HTML5Shooter | /js/dev/panels/components/scoreViewComponent.js | UTF-8 | 2,158 | 2.703125 | 3 | [] | no_license | goog.provide('ScoreViewComponent');
/**
*@constructor
*Energy meter displaying user's current level
*/
ScoreViewComponent = function() {
/**
*@type {Container}
*/
this.container = null;
this.score = null;
this.scoreOverlay = null;
this.bonus = null;
this.bonusOverlay = null;
this.init();
};
/**
*@public... | true |
ae0f1446a4101b37b5b606085ad9bf1be8ea718d | JavaScript | gionel73/ig-happy-readers | /happy-readers/src/http.js | UTF-8 | 875 | 2.796875 | 3 | [] | no_license | function handler(request, success, error) {
if (request.readyState == 4) {
if (request.status < 300 && request.status >= 200) {
success(request.responseText);
} else {
error(request.responseText);
}
}
};
function get(url, success, error) {
var request = new X... | true |
7f3f901f40a6a256d2a2efb2492c3c01d640864b | JavaScript | pkanev/javascript-basics | /homework-2-JavaScript-Syntax/Problem 6. Build a Table/build-a-table.js | UTF-8 | 1,179 | 4 | 4 | [] | no_license | var input = [999999, 1000000];
function Solve(arr) {
//new function, this one creates an associative array and does the fib sequence only once
var fibNums = isFib(arr[1]);
function isFib(val){
var fibNums = { 1: true };
var f1 = 1;
var f2 = 1;
while (true) {
var f3 = f1 + f2;
... | true |
fe71e0af01370e5b18f8a1354c1469d9fff64191 | JavaScript | andrey-shostik/js-tasks | /grid/grid.js | UTF-8 | 2,516 | 2.75 | 3 | [] | no_license | window.onload = function () {
var initializeGrid = function (gridColumns, gridLines) {
if (gridColumns === '' || gridColumns === '0' || gridLines === '' || gridLines === '0') {
return false;
} else if (document.getElementById('grid')) {
document.body.removeChild(document.getElementById('grid'));
... | true |
ecaf96fb40f3dc5d71051405a592b5fb57036baa | JavaScript | Ahogorira/yrd | /src/main/webapp/script/CzTx.js | UTF-8 | 1,704 | 2.984375 | 3 | [
"MIT"
] | permissive | function tx() {
//获取用户输入的金额
var money = parseFloat($("#money").val());
//获取用户账户余额
var zhye = parseFloat($("#zhye").text());
if(money>zhye||money>50000){
$("#money").val(" ");
}
}
function txSubmit(){
if($("#money").val().length<=0){
$("#moneyAlt").text("请输入提现金额,最少为1,最多为5W");
... | true |
f48ae2ca3616337fb17a9dac532b1ac32119261d | JavaScript | CarlHanns/Roller | /assest/main.js | UTF-8 | 907 | 3.5 | 4 | [] | no_license | //variables
const rollButton = document.querySelector("#rollButton");
let Die = document.querySelector("#Die");
let totalScore = document.querySelector("#totalScore");
const showRolls = document.querySelector("#showRolls");
let rollsList = document.querySelector("#rollsList");
let dieRoll = []; // will record die roll
... | true |
8da5af51fac4122c01daac8ab2f683fcdd85b662 | JavaScript | ncesar/reactjs-infinite-scroller | /src/App.js | UTF-8 | 2,447 | 2.984375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
import ContactList from './components/ContactList';
class App extends Component {
state = {
contacts: [], //array de contatos, que pega as infos da api
perPage: 8, //results per page
page: 1,
totalPages: null,
... | true |
3e70dabd22e80fa92a1ec869e97240a07c4fce32 | JavaScript | ar-mac/cypress_as_example | /src/App.js | UTF-8 | 1,002 | 2.703125 | 3 | [] | no_license | import './App.css'
import axios from 'axios'
import { useRef, useState } from 'react'
const instance = axios.create({
baseURL: 'http://localhost:3001',
})
function App() {
const inputRef = useRef()
const [urls, setUrls] = useState([])
const fetchResourceWithToken = async (path) => {
const resp = await in... | true |
e49e9a60907b17df66fd7ed0fae78ecfa0a93bb4 | JavaScript | Thunderducky/office_hours_react | /src/components/TodoList.js | UTF-8 | 424 | 2.640625 | 3 | [] | no_license | import React from "react"
function TodoList(props){
console.log(props);
return <div>
TodoList, this is where my todos will go
{
(props.todos.length === 0)
? (
<div>This is empty</div>
)
: (
<ul>
{props.todos.map(todo => {
return <l... | true |
e77d2b93db03220de6252e4eebae9e125921e80c | JavaScript | DashFire61/Vschool | /codingpreproject/app.js | UTF-8 | 1,298 | 3.296875 | 3 | [] | no_license |
var myDate = new Date();
var hrs = myDate.getHours();
var greet;
if (hrs < 12)
greet = 'Good Morning';
else if (hrs >= 12 && hrs <= 17)
greet = 'Good Afternoon';
else if (hrs >= 17 && hrs <= 24)
greet = 'Good Evening';
document.getElementById('lblGreetings').innerHTML =
'<b>' + greet + '</b>';
... | true |
39c4a3caec1236f3f71256f0f593a2db8f66cfae | JavaScript | emmacodes19/ACA_web101_emmanuelle_berda | /New Dashboard/new.js | UTF-8 | 902 | 3.46875 | 3 | [] | no_license |
var loc = document.getElementById('myloc');
console.log(loc)
function myLocation() {
console.log("location:", loc)
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
loc.innerHTML = "Location Tracking not Possible.";... | true |
c6a3b965ce848b9534f0a56b2cd312aa5d81d916 | JavaScript | whj768702/exercises | /deepClone/deepClone.js | UTF-8 | 676 | 3.265625 | 3 | [
"MIT"
] | permissive | function deepClone(initalObj, finalObj) {
var obj = finalObj || {};
for (var i in initalObj) {
var prop = initalObj[i]; // 避免相互引用对象导致死循环,如initalObj.a = initalObj的情况
if (prop === obj) {
continue;
}
if (typeof prop === 'object') {
obj[i] = (prop.constructor === Array) ? [] : {};
//ar... | true |
a3cfe7eeda1439eb00c9eb4d95975fc46c9fcb27 | JavaScript | wpsmith87/getRegs-getDokt-app | /i.js | UTF-8 | 4,665 | 2.75 | 3 | [] | no_license | /// Create today
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yy = today.getFullYear().toString().substr(2);
var fullYear = today.getFullYear().toString();
var halfYear = (fullYear-30);
if(dd<10) {
dd = '0'+dd
}
if(mm<10) {
mm = '0'+mm
}
today = mm ... | true |
82ffe4c499baab7d0ece17630ac41c377d8b2517 | JavaScript | Alexandr-fly-code/graphQl | /server/schema/schema.js | UTF-8 | 1,926 | 2.5625 | 3 | [] | no_license | const graphql = require("graphql");
const _= require('lodash');
const {
GraphQLObjectType,
GraphQLString,
GraphQLSchema,
GraphQLID,
GraphQLInt,
GraphQLList
} = graphql;
const books = [
{name: 'Name of the Wind', genre: 'Fantasy', id: '1', authorsId: '1'},
{name: 'The Final Empire', genre: 'Fantasy... | true |
ae46dec918ac892a6036b08c048aab7cf2cc21c6 | JavaScript | Odvin/rabbitmq-template | /work-queues/consumer.js | UTF-8 | 676 | 2.609375 | 3 | [
"MIT"
] | permissive | const amqp = require('amqplib');
async function main() {
const connection = await amqp.connect('amqp://localhost');
const channel = await connection.createChannel();
const queue = 'workQueue';
await channel.assertQueue(queue, { durable: true });
console.log(
`Waiting for messages from the Queue - ${qu... | true |
4e3d35e86884987cba7a9a5564564bc5543268e2 | JavaScript | sparkoo/che-jsonrpc-training | /websocket/client.js | UTF-8 | 358 | 2.703125 | 3 | [] | no_license | const WebSocket = require('ws');
const ws = new WebSocket('ws://localhost:8080/');
ws.on('open', async function open() {
for (var i = 0; i < 3; i++) {
ws.send('Hello from js client [' + i + ']');
await new Promise(r => setTimeout(r, 1000));
}
ws.close(1000)
});
ws.on('message', function incoming(data) ... | true |
298e5223afa2036f7ea88141cb93c46ca512dcef | JavaScript | ReehnataCarvalho/N2-jsapi-1 | /exe-profiles/script.js | UTF-8 | 1,812 | 3.359375 | 3 | [] | no_license | const app = document.getElementById('root');
const authors = document.createElement('div');
authors.setAttribute('class', "authors");
app.appendChild(authors);
const request = new XMLHttpRequest();
request.open('GET', 'https://randomuser.me/api/?results=10', true);
request.onload = funct... | true |
ead8d929393dec598af8eca4ad2c4fe2ad917051 | JavaScript | wzmJimmy/Jupiter | /WebContent/scripts/module.js | UTF-8 | 1,551 | 3.171875 | 3 | [] | no_license | /**
* A helper function that creates a DOM element <tag options...>
* get an Element or set attribute by key-value pair given by options.
* @param tag
* @param options
* @returns
*/
function $(tag, options) {
if (!options) {
return document.getElementById(tag);
}
var element = document.createElement(tag);
... | true |
35d4fe9117d860fa6c770d9cddd5783990fafe79 | JavaScript | Korilakkuma/XSound.js | /build/xsound-server-session-ws.js | UTF-8 | 2,814 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* xsound-server-session-ws.js
* @fileoverview WebSocketServer
*
* Copyright 2013, 2014@Tomohiro IKEDA
* Released under the MIT license
*/
'use strict';
process.stdout.setEncoding('UTF-8');
process.stderr.setEncoding('UTF-8');
var port = 8000;
if (process.argv.length >= 3) {
var p = parseInt(process.... | true |
7283b6596cf3cab50322e6e89aeeb3e92a938d8b | JavaScript | EstebanVignon/SnowTricks | /assets/js/tricks/edit-form-collection-pictures.js | UTF-8 | 1,293 | 2.59375 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', function (event) {
document.getElementById('add-another-collection-widget-picture').addEventListener('click', function () {
let pictureParent = document.getElementById('trick_edit_pictures');
const picturewidgetsCounter = document.getElementById('picture... | true |
7948c67ea43107b11d6659f9914146f8720ab430 | JavaScript | FikoReborn/FikoReborn.github.io | /js/main.js | UTF-8 | 2,501 | 2.6875 | 3 | [] | no_license | stickyHeader = (header, nav) => {
// Make nav fixed to top after scrolling past header
const windowTop = window.scrollY;
const headerHeight = header.offsetHeight;
windowTop > headerHeight ? nav.classList.add('fixed-header') : nav.classList.remove('fixed-header');
}
activateMButton = (header, nav) => {
... | true |
4234da4c7e9578e46faa8594df14f02ff3fba9e5 | JavaScript | Miss-qi/react-demo | /src/views/ControlPanel.js | UTF-8 | 1,326 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import Counter from './Counter';
const style = {
margin: '20px'
};
class ControlPanel extends Component {
constructor(props) {
super(props);
this.initValues = [0, 10, 20];
const initSum = this.initValues.reduce((a, b) => a + b, 0);
this... | true |
85ec7ad3c0e84083f46daf44663ab3055766c62c | JavaScript | sfkrieger/benchmarking-reports | /benchmarking/engine.js | UTF-8 | 1,649 | 2.609375 | 3 | [] | no_license | /**
*
*/
var all_modules = {
helpers : require("../js/helpers.js"),
// nan_c : require('bindings')('ncmod.node'),
// c : require('bindings')('cmod.node'),
nan_c : require('../cpp/build/Debug/ncmod.node'),
c : require('../cpp/build/Debug/cmod.node'),
js : require("../js/js.js")
};
var NO_TIMES = 100000;
/... | true |
0997c5be409ac336925f5800f4268496f2b9a130 | JavaScript | tanhauhau/tanhauhau.github.io | /src/routes/playground/flock/flock.js | UTF-8 | 2,839 | 3.28125 | 3 | [] | permissive | export default function flock(canvas) {
const ctx = canvas.getContext('2d');
const width = document.body.clientWidth;
const height = document.body.clientHeight;
canvas.height = height;
canvas.width = width;
const totalBirds = 500;
const numNeighbourToConsider = 10;
const birdSize = 2;
const separationFactor =... | true |
8986ad874bcd8239fd56f719d8c9897b81e530b3 | JavaScript | hannatiaraaa/Starships | /src/utils/api.js | UTF-8 | 892 | 2.625 | 3 | [] | no_license | import axios from "axios";
// url
export const BASE_URL = "https://swapi.dev/api";
function* doRequest(endpoint, options) {
try {
let response;
const { method, body, headers } = options;
const result = yield axios({
url: `${BASE_URL}${endpoint}`,
method,
data: body,
headers: head... | true |
b489ea52dbd09e60aebe5cad19ba325bf5744523 | JavaScript | riztaha/page-fetcher | /fetcher.js | UTF-8 | 631 | 3.015625 | 3 | [] | no_license | const request = require("request");
const fs = require("fs");
const args = process.argv;
// console.log(process.argv);
let url = args[2];
let fileName = args[3];
const fetch = function(url) {
console.log("Calling readFile...");
content = request(url, (error, response, body) => {
write(fileName, body);
});
}... | true |
7711e129d3d714e0aeefcefe646d2d9478d8ac6c | JavaScript | Emtiaz2000/profile-app | /es-6app.js | UTF-8 | 3,918 | 3.0625 | 3 | [] | no_license | class Profile {
constructor(id, name, email, profession) {
this.id = id;
this.name = name;
this.email = email;
this.profession = profession;
}
}
class UI {
//add new tr
addProfile({
id,
name,
email,
profession
}) {
... | true |
74db8f86afc20d30eeea75139277751e3f0966ea | JavaScript | OpenTMI/opentmi | /app/controllers/builds.js | UTF-8 | 1,350 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
Builds Controller
*/
// native modules
// 3rd party modules
const mime = require('mime');
// own modules
const DefaultController = require('./');
class BuildsController extends DefaultController {
constructor() { super('Build'); }
static indexParam(req, res, next, Index) {
if (!isNaN(Index)) {
... | true |
d608c1b80e127b0dc03fc97b0f38d79545655c8d | JavaScript | SiobhanCoady/awesome-tweets | /db/seed.js | UTF-8 | 489 | 2.765625 | 3 | [] | no_license | const db = require('./conn');
const faker = require('faker');
for (let i = 0; i < 20; i++) {
let body = faker.hacker.phrase();
let length = body.length;
db.query(`
INSERT INTO tweets (username, body, length) VALUES ($<username>, $<body>, $<length>)
`, {
username: faker.name.findName(),
body: body,
... | true |
566f6f55c62ac3cae2bf1f956a75836354dd9991 | JavaScript | Tetiana-10/Tetiana-10.github.io | /js/coins.js | UTF-8 | 2,281 | 2.6875 | 3 | [] | no_license | jQuery(document).ready(function($) {
function flipCoin(e) {
e.preventDefault();
var flipTime = 2500;
var $theCoin = $('#coin');
var $flipTrigger = $('.js-flip-coin');
var heads = 'is-heads';
var tails = 'is-tails';
var flipping = 'is-flipping';
$("p").fadeOut(1250);
$("#anim_div").... | true |
416b01fa8a14650e103287cbaacf725ede5f6cb4 | JavaScript | MichaelHolland23/cooking-conversions | /js/scripts.js | UTF-8 | 400 | 3.296875 | 3 | [] | no_license | // Business (or back-end) logic:
var galToLiter = function(gal) {
return gal * 3.78541;
};
// User interface (or front-end) logic:
$(document).ready(function() {
$("form#gal-liter").submit(function(event) {
var number1 = parseFloat($("#galinput").val());
var result = galToLiter(number1);
$("#output")... | true |
36104e8dc2058eec3daac123553af2310db78e66 | JavaScript | sundvall/memory-game-react | /src/components/imagesize.js | UTF-8 | 518 | 3.078125 | 3 | [] | no_license | /*
imagesize
usage:
the height is calculated to preserve the aspect ratio from a provided image or given value
return:
{w,h}
*/
function sizeFromImage (src, cb) {
const img = new Image();
const size = {};
img.onload = function onload() {
size.w = this.width;
size.h = this.height;
cb(this.height, this.wi... | true |
e26522ef10040bf5c6719f5f798e8cc81b57aa43 | JavaScript | wardiabdi/fibonacci | /Object.js | UTF-8 | 971 | 3 | 3 | [] | no_license |
// let team = {
// "Id": 0012,
// "Name": "James",
// "Surname": "John",
// "Dept": "HR"
// };
// let person = {
// Id: "",
// name: "",
// lastname: "",
// age: null,
// qualifications: "",
// skillSet: ["JS", "HTML", "CSS"]
// Department: "",
// Experience: "8",
// ... | true |
252b9c64522e93c62eff0bd2d36c12ed723abeec | JavaScript | Nootuff/API_Pokedex | /Public/JS/funcs.js | UTF-8 | 2,145 | 2.578125 | 3 | [] | no_license | var openClose = document.getElementById("openClose");
var under = document.getElementById("under");
var openClose = document.getElementById("openClose");
var img = document.getElementById("img");
var zoomMinus = document.getElementById("zoomOut");
var zoomPlus = document.getElementById("zoomIn");
var inner = docu... | true |
aadf25665732463f1abd1a17b842abe44b14a2cb | JavaScript | azotova/data-structures | /sprint-one/src/functional-shared/queue.js | UTF-8 | 695 | 3.28125 | 3 | [] | no_license | var makeQueue = function(){
// Hey! Rewrite in the new style. Your code will wind up looking very similar,
// but try not not reference your old code in writing the new style.
var someQueue = {};
someQueue.count=0;
someQueue.storage={};
_.extend(someQueue, queueMethods);
return someQueue;
};
var queueMet... | true |
018a349ab78166e20428c7f6aeea0740de60aba8 | JavaScript | ahmedfares19/backend-course | /day2/index.js | UTF-8 | 817 | 3.5625 | 4 | [] | no_license | // let obj = require('./add');
// obj.go()
// console.log(obj.go);
console.log("serve is running");
/* banknotes = [200, 100, 50, 20, 10, 5, 1];
function greedy(amount) {
// process
for (let bancknote of banknotes) {
howMany = Math.floor(amount / bancknote); // 2.555
if(howMany) {
console.log(ban... | true |
9b4ef8018b6aa8a0208dd1c6749d99d507e1609f | JavaScript | Jorgeeab-jz/dulces-parttwo | /script.js | UTF-8 | 6,430 | 2.71875 | 3 | [] | no_license | const firebaseConfig = {
apiKey: "AIzaSyBhEEjKEDyuJQ0fXY0R3VyMvssNEffLaMI",
authDomain: "dulces-vicky.firebaseapp.com",
databaseURL: "https://dulces-vicky-default-rtdb.firebaseio.com",
projectId: "dulces-vicky",
storageBucket: "dulces-vicky.appspot.com",
messagingSenderId: "877270025588",
ap... | true |
edee149a5d514140e33f05b082c8161df1dd1bb7 | JavaScript | Mark-Seaman/50-Tricks | /doc/node/mongoose/account.js | UTF-8 | 1,664 | 2.609375 | 3 | [] | no_license | console.log ("Account.js start");
var mongoose = require('mongoose');
mongoose.connect('localhost', 'test');
var AccountSchema = new mongoose.Schema({
email: { type: String, unique: true },
password: { type: String },
name: {
first: { type: String },
last: { type: String }
},... | true |
62ec1b9c3d7482fa538960255bb7602d1c8b1231 | JavaScript | qweghj1245/F2E5 | /js/GamePlay.js | UTF-8 | 14,420 | 2.65625 | 3 | [] | no_license | const getRandom = (max, min) =>{
return Math.floor(Math.random() * (max - min + 1)) + min;
};
const gamePlay = {
key: 'gamePlay',
preload: function(){
// 載入資源
this.load.image('playbg', 'assets/w5_90secgame_地圖1背景圖.png');
this.load.image('playbg2', 'assets/w5_90secgame_地圖2背景圖.png');
... | true |
5bc24e94001fbfcb92ecf12cc6a68cbe1fa3407b | JavaScript | lseffer/profile-page | /js/util.js | UTF-8 | 696 | 2.578125 | 3 | [] | no_license | window.onscroll = function () {
navbar_transparent();
};
function navbar_transparent() {
if (
document.body.scrollTop > window.innerHeight ||
document.documentElement.scrollTop > window.innerHeight - 100
) {
document.getElementById("Navigation").className = "nav solid";
} else {... | true |
f68f02788cb6df2f5016139f172bee00695c93df | JavaScript | Yura440/yura440.github.io | /TestSite/www/scripts/index.js | UTF-8 | 2,108 | 2.546875 | 3 | [] | no_license | // Основные сведения о пустом шаблоне см. в следующей документации:
// http://go.microsoft.com/fwlink/?LinkID=397704
// Для отладки кода на странице загрузите его в cordova-simulate либо в эмулятор или на устройство Android: запустите приложение, задайте точки останова.
// , а затем запустите "window.location.reload(... | true |
947540793727be602c89b703cd7ae48ed736e62a | JavaScript | michaelmansy/code-player.github.io | /app.js | UTF-8 | 1,478 | 2.828125 | 3 | [] | no_license | function updateOutput(){
//output panel to get updated by html entere in html panel and css too
$('iframe').contents().find('html').html("<html><head><style type='text/css'>" + $('#cssPanel').val() + "</style></head><body>" + $('#htmlPanel').val() + "</body></html>");
//now target the javascript using eval
documen... | true |
be78fffdd9a0d924a1fe95caab53823219b2537a | JavaScript | vidhik2002/Navigator | /routers/socketHandler.js | UTF-8 | 1,182 | 2.640625 | 3 | [] | no_license | const socketio = require("socket.io")
module.exports = (app) => {
const io = socketio(app);
const lobbyHandler = io.of("/game/lobby");
lobbyHandler.on("connection", (socket) => {
console.log("someone connected " + socket.id);
lobbyHandler.to(socket.id).emit("request room");
... | true |
044a9b906ddae954a45aa08702f06d77b89c14d3 | JavaScript | Peteropon/JSexercises | /ajax1.js | UTF-8 | 1,808 | 3.0625 | 3 | [] | no_license | var xhr = new XMLHttpRequest;
var data;
var url = 'https://www.hulabeck.se/html/temp/response.json';
var header = document.querySelector('header');
var section = document.querySelector('section');
xhr.onreadystatechange = function () {
if(xhr.readyState == 4) {
if (xhr.status == 200) {
console... | true |
afc36ff1dc1a85339f81bf95791d254d30b090ae | JavaScript | adamshapiro/tictactoe | /app/javascript/packs/board.jsx | UTF-8 | 3,733 | 3.21875 | 3 | [] | no_license | import 'bootstrap/dist/css/bootstrap.min.css'
import React from 'react'
import ReactDOM from 'react-dom'
function Square(props) {
return (
<div className='col-4 col-sm-2 px-0 border border-dark'>
<div className='square'>
<span onClick={props.onClick}>
{props.... | true |
84e9f71fa3132690bcdc3a3a7006bc7053b7788e | JavaScript | PowerCoders-Milan/js-arrays-loops-zubairmawya | /06-is-prime-number/is_prime_number.js | UTF-8 | 548 | 3.984375 | 4 | [] | no_license | // check if a number is prime or not
const isPrime = number => {
let PrimeArrySize = getPrimes(number);
console.log(number + " => " + PrimeArrySize);
if (PrimeArrySize.length <= 2) {
return true
} else {
return false
}
}
const getPrimes = amount => {
let primeArray = []
f... | true |
cc77f052770d2c912f12e2303f831698f83f58bc | JavaScript | kkinaman/practice_interview_questions | /Coding/simplifyPolynomials.js | UTF-8 | 3,630 | 4.03125 | 4 | [] | no_license | /*
When we attended middle school were asked to simplify mathematical expressions like '3x-yx+2xy-x' (or usually bigger),
and that was easy-peasy ('2x+xy"). But tell that to your pc and we'll see!
Write a function:
simplify(poly)
that takes a string in input, representing a multilinear non-constant polynomial in in... | true |
8b9761b3c712049be8f58437df135a149fe954bb | JavaScript | jue89/node-tsfoo | /lib/fsbackend/file.js | UTF-8 | 4,602 | 2.84375 | 3 | [
"MIT"
] | permissive | const assert = require('assert');
const fs = require('fs');
const fsExt = require('fs-ext');
const util = require('util');
const events = require('events');
const open = util.promisify(fs.open);
const stat = util.promisify(fs.stat);
const close = util.promisify(fs.close);
const access = util.promisify(fs.access);
cons... | true |
73af685a976155423bfa8a78550442aff6697a00 | JavaScript | fashevskij/Fish-game | /js/life.js | UTF-8 | 590 | 3 | 3 | [] | no_license | function creatureLifes() {
//создаем блок div с жизнями
lifes = document.createElement("div");
//даем ему id
lifes.id = "lifes";
//Помещшаем его на поле игровое
full.appendChild(lifes);
//нулевая позиция жизней
let currentQuantityLifes = 0;
//создаем жизни и добавляем на поле lifes
... | true |
90a2c92cd545592bc54bdc8b4896bb71ff3c062f | JavaScript | xiamidong/studingdemo | /node/zhufeng/zhufeng_node9/2.node/1.js | UTF-8 | 333 | 3.171875 | 3 | [] | no_license | //先读文件 读取后在写入文件
function readFile(callback) {
setTimeout(function () {
console.log('读完了');//可以写了
callback();
},2000);
}
function writeFile() {
console.log('写入');
}
readFile(writeFile); //当一个代码执行完后在操作的函数
// 五个人吃一碗饭
| true |
72c21fc48066b2da2ae464de373211bb2279e8ce | JavaScript | kartoschka/WF-js-sebastien-tamas-wolfgang | /Basic/Basic 3/scripts/script.js | UTF-8 | 435 | 3.640625 | 4 | [] | no_license | class Person {
constructor(name, surname, age, description) {
this.name = name,
this.surname = surname,
this.age = age,
this.description = description,
this.introduce()
}
introduce() {
console.log(
`I am ${this.name} ${this.surname}, ${this.ag... | true |
777feb9e7a0a7c6f302b3844e50c612c3e15874c | JavaScript | slytherin20/DoYouKnowTriangles | /src/components/AreaThree.jsx | UTF-8 | 1,780 | 3.3125 | 3 | [] | no_license | import { useRef, useState } from "react";
function AreaThree(){
const resultBox = useRef(null);
const [a,setA] = useState(0);
const [b,setB] = useState(0);
const [angle,setAngle] = useState(0);
const [area,setArea] = useState("");
const [text,setText] = useState("");
function changeValues(... | true |
c442763118d714da1de0c5e90e4b4f35c6959eff | JavaScript | christinebonk/bamazon2 | /bamazonSupervisor.js | UTF-8 | 1,614 | 2.609375 | 3 | [] | no_license | var mysql = require("mysql");
var cTable = require('console.table');
var inquirer = require("inquirer");
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "password",
database: "bamazon"
});
// function supervisorOptions() {
// inquirer.prompt ([
// {
// "name": "supervisorChoice"... | true |
0cfe59160b7fa8c52007a66a6912e42c3c88f878 | JavaScript | johnny21-9/goit-js-hw-07 | /js/task-08.js | UTF-8 | 1,596 | 3.40625 | 3 | [] | no_license | const inputRef = document.querySelector('input');
const renderRef = document.querySelector('[data-action="render"]');
const destroyRef = document.querySelector('[data-action="destroy"]');
const boxesRef = document.querySelector('#boxes');
let boxCollection = [];
let amount;
let boxSide = 30;
function randColor(max) {
... | true |
b92a9b1793c737f4caed02ed75715ad4f83c1c40 | JavaScript | BrunoNishimura/JavaScript-do-basico-ao-avancado | /AULAS/9 - Programação Assíncrona com JavaScript/2_Promises.js | UTF-8 | 2,670 | 4.3125 | 4 | [
"MIT"
] | permissive | //Aula 255: Promises
/*
- As promises são ações assíncronas que podem produzir um valor em algum momento no código;
- Uma forma de dizer a linguagem que um valor pode estar presente em um ponto futuro do código;
- O objeto das promises é Promise, resolve é o método que resolve um Promise, o then é o que faz ela poder ... | true |
68fca1df2ef2b58754d4d883e5ccb8dde2014ca6 | JavaScript | Mishqq/gameEngine | /src/utils/Event.js | UTF-8 | 251 | 2.578125 | 3 | [] | no_license | export default class Event {
constructor( type, targetObject ){
this.type = type;
this.targetObject = targetObject;
this._stopped = false;
}
stopPropagation(){
this._stopped = true;
}
get stopped(){
return this._stopped;
}
}
| true |
eea4afaacd6259bb468eec0bd2fa31766a10e185 | JavaScript | mordehg/AP_ex3 | /ex3/View/singlePlayerGame/js/SinglePlayer.js | UTF-8 | 3,015 | 2.875 | 3 | [] | no_license | (function ($) {
$.fn.drawMaze = function (mazeData, startRow, startCol, exitRow, exitCol,
playerImage, exitImage, ableToMove, makeMove) {
var myCanvas = document.getElementById("mazeCanvas");
var context = mazeCanvas.getContext("2d");
... | true |
63a91ce0a11e71f1d9e437a1c7228d2d53a24528 | JavaScript | NuraiG/Game2048 | /assets/2048.js | UTF-8 | 8,891 | 3.125 | 3 | [] | no_license | function game2048() {
let counter = 1;
function generateColor() {
let cells = document.getElementsByClassName('cell');
for (let i = 0; i < cells.length; i++) {
switch (parseInt(cells[i].innerHTML)) {
case 0: cells[i].style.backgroundColor = '#CCFFFF';
... | true |
c6d009cb1afcb5e513ff2a6f3eb6384b48aefb98 | JavaScript | makesjs/makes | /test/preprocess/if.spec.mjs | UTF-8 | 4,805 | 2.609375 | 3 | [
"MIT"
] | permissive | import {test} from 'zora';
import preprocess from '../../lib/preprocess/index.js';
test('@if works in html syntax', t => {
const source = `a
<!-- @if foo -->
b
<!-- @endif -->
c`;
t.is(preprocess('a/b.html', source, null, ['foo'], 'html'), 'a\nb\nc');
t.is(preprocess('a/b.html', source, null, ['bar'], 'html'), ... | true |
699ecdca97d9907d73a0e029b1befda4633d1037 | JavaScript | loiclegoff/Projet-ASI2-rendu | /nodejs/app/controllers/content.controller.js | UTF-8 | 4,225 | 2.53125 | 3 | [] | no_license | //content.controller.js
const uuidv1 = require('uuid/v1');
var contentModel = require("./../models/content.model.js");
var CONFIG = require("./../../config.json");
process.env.CONFIG = JSON.stringify(CONFIG);
var path = require("path");
var fs = require("fs");
// LIST
this.list = function(request, response) {
var... | true |
a0e78e39bd194b904cfc466ef7f7d2482d63634e | JavaScript | rcrichton87/heroes_and_rats_lab | /specs/quest_spec.js | UTF-8 | 647 | 2.828125 | 3 | [] | no_license | var Quest = require('../quest.js');
var assert = require('assert');
describe("Quest", function(){
var quest;
beforeEach(function(){
quest = new Quest(2, 4, 1000);
});
it("has a difficulty", function(){
assert.strictEqual(2, quest.difficulty);
})
it("has an urgency", function(){
assert.stric... | true |
43814fc53dfbb3454ae096f696efd537601efed1 | JavaScript | Adarsh14112008/kjasd | /sketch.js | UTF-8 | 2,063 | 2.84375 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var box1, box2, box3, box4, box5 ,box6,box7,box8,box9,box10,box12,box13,box14,box15,box16;
var box17, box18, box19, box20, box21 ,box22;
var ground1,ground2;
var Stone1;
var rope1;
var score;
func... | true |
ba2b90e198388b483334dd0e423b55646bc5ede4 | JavaScript | Rushik98/loginregister | /src/component/HomePage.js | UTF-8 | 2,461 | 2.734375 | 3 | [] | no_license | import React from "react";
import { useState } from "react";
import AddUserForm from "./AddUserForm";
import EditUserForm from "./EditUserForm";
import "../App.css";
function HomePage() {
const usersData = [{ id: 1, body: "Rohan", title: "floppy" }];
// Setting state
const [users, setUsers] = useState(usersData);
... | true |
5a43d07e82bc0b17cb54a73a66f8189e061c02b0 | JavaScript | abu7elo/dline_tsk | /libs/mysqlHelper.js | UTF-8 | 6,517 | 2.765625 | 3 | [] | no_license | var mysql = require('mysql');
var fs = require("fs");
var sqlConfig = require("../configs/sqlConfig");
var connection = mysql.createConnection(sqlConfig.mysql_config);
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err);
process.exit(1);
}
});
// Trancate Table
f... | true |
64debac5a028996e5746cadf133ab3d5b21aaf11 | JavaScript | ihaiucom/ihaiu.LayaCodeDivision | /LayaCodeDivision/bin/laya_bin_out/fairygui/ColorMatrix.js | UTF-8 | 3,357 | 2.6875 | 3 | [] | no_license | //class fairygui.utils.ColorMatrix extends Array
var ColorMatrix=(function(_super){
// initialization:
function ColorMatrix(){
ColorMatrix.__super.call(this);
this.reset();
}
__class(ColorMatrix,'fairygui.utils.ColorMatrix',Array);
var __proto=ColorMatrix.prototype;
// public methods:
__proto.reset=function... | true |
63e8ec96ef8599e0a7e7e0b2e66dd423895782ef | JavaScript | ironSource/pickpick | /examples/simple.js | UTF-8 | 1,477 | 2.890625 | 3 | [
"MIT"
] | permissive | const { Experiment, ExperimentContainer } = require('./index')
// first create the experiments:
let e1 = Experiment.create({
name: 'buy page button color experiment',
id: '953d6fe0',
// prettier-ignore
variations: [
{ object: '#ff0000', weight: 4 },
{ object: '#ff0000', weight: 1 },
{ object: '#00ff00', wei... | true |
e23c3ed0c03289d81d7525a5fa9d451354d69fd9 | JavaScript | juniweb/freeStudy | /Javascript/inflearn_EcmaScript6/12_object_setprototypeof_chain.js | UTF-8 | 509 | 3.5625 | 4 | [] | no_license | // parent
const healthObj = {
showHealth : function () {
console.log('오늘 운동시간 : ' + this.healthTime);
},
setHealth : function (newTime) {
this.healthTime = newTime;
}
};
// child
const healthChildObj = {
getAge : function () {
return this.age;
}
};
const lastHealthObj = Object.setPrototypeOf(h... | true |
fd77383d030092e83a64921253f6f6cc918451c8 | JavaScript | vpaladino778/vpaladino778.github.io | /assets/js/scripts.js | UTF-8 | 666 | 2.75 | 3 | [
"MIT"
] | permissive | // Scroll down button
$(document).ready(function(){
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
})... | true |
e0428172ace491a931cfa4c4e37355788ac1d43e | JavaScript | BesuglovS/wiki.nayanova.edu | /Chess/js/main.js | UTF-8 | 18,280 | 2.78125 | 3 | [] | no_license | $(function () {
var ShowGameResult = function (game) {
if (game.in_draw() === true || game.in_stalemate() || game.in_threefold_repetition()) {
BootstrapDialog.show({
title: 'Игра окончена',
type: BootstrapDialog.TYPE_SUCCESS,
message: "Ничья"
... | true |
c6406f01bd662d09bf512b9e5ffe3be24eeae0ed | JavaScript | likethemammal/overwatch-table | /src/units.js | UTF-8 | 1,083 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import _ from 'underscore'
export const emptyRows = rows => {
if (!rows) {
throw 'No rows defined'
}
return _.filter(rows, (data) => _.isEmpty(data))
}
export const fullRows = rows => {
if (!rows) {
throw 'No rows defined'
}
return _.filter(rows, (data) => !_.isEmpty(data))
}... | true |
2344b54782710cb9f30d38cc7268d6970630d630 | JavaScript | manderly/DataStructuresAndAlgorithms | /lib/doublylinkedlist.js | UTF-8 | 2,445 | 3.90625 | 4 | [] | no_license | 'use strict';
var LinkedList = function() {
this.head = new Node("head");
};
this._Node = function(item) {
this.element = element;
this.next = null;
this.prev = null;
};
LinkedList.prototype.find = function(item) {
var currNode = this.head; //create a new node and assign it as the head node
while (currNod... | true |
c57899319b2a62ffb33935c5c41b5c26d2aae60e | JavaScript | eatrocks/remedial-js | /4-objects/array.js | UTF-8 | 736 | 4.34375 | 4 | [] | no_license | // Arrays
// Arrays are objects with a
// special length property that returns one more than the highest index
var colors = ['red', 'white', 'blue'];
console.log('colors array length is ' + colors.length);
// you can add to any index of an array
colors[100] = 'pink';
// notice what length returns (101, not 4)
conso... | true |
5d4a9e955efe463df24c916bbff4794cd820b4a5 | JavaScript | rajaramghosh/Scribbler | /scripts/common.js | UTF-8 | 1,558 | 2.984375 | 3 | [] | no_license | /* Get Reference of Sign Up and Sign In Modals */
var signUpModal = document.getElementById("signUpModal");
var signInModal = document.getElementById("signInModal");
/* Get Reference of the Sign Up Button, Sign In Button and Sign Up Hyperlink to open the Modals */
var signUpBtn = document.getElementById("signUpBtn");
... | true |
26ffa61f00f86527375a7e193c5ae49b36a176b2 | JavaScript | hung623/exercises | /oppgaver/2/svar.js | UTF-8 | 725 | 4.1875 | 4 | [] | no_license | // Oppgave 2
// Nå vil jeg at du skal lage en funksjon som legger sammen to tall. Syntakset for å skrive en funksjon er som følger:
// function funksjonsNavn(inputA, inputB) {
// her kan du bruke parameter inputA og inputB
// }
// For å kalle funksjonen skriver du funksjonsnavnet (og eventuelle parameter):
// funk... | true |
30c3c2cbefe1f0078213ebb5c5285ca4452e1b05 | JavaScript | ProstoBoris/number-to-words-converter | /src/App.js | UTF-8 | 1,239 | 2.984375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import InputPage from './containers/InputPage';
import ResultPage from './components/ResultPage';
class App extends Component {
state = {
words: [],
loading: false
}
onGetResult = (childData) => {
this.setState({ ...this.state, words: [..... | true |
e68a9e3e9063dee9fc567e4500bbe540e6c0823a | JavaScript | mucsi96/service-worker-test-2 | /public/custom-service-worker.js | UTF-8 | 1,248 | 2.546875 | 3 | [] | no_license | self.addEventListener("install", () => {
self.skipWaiting();
});
self.addEventListener("message", (event) => {
console.log(event.data);
});
self.addEventListener("fetch", (event) => {
const requestUrl = new URL(event.request.url);
if (event.request.destination) {
return;
}
self.clients
.matchAll... | true |
72ec24010d2bea295be7495a9166e8353168c9fe | JavaScript | maricolm/jbyt | /JBYTYH/WebContent/iol/static/fayh/js/verifyChe.js | UTF-8 | 774 | 2.5625 | 3 | [] | no_license | $(document).ready(function(){
$("[name='allSel']").click(function(){
if($(this).is(':checked')){
$("[name='sele']").attr('checked',true);
}else{
$("[name='sele']").attr('checked',false);
}
})
$("[name='sele']").click(function(){
var allSel=false;
$("[name='sele']").each(function(){
if(!$(this).i... | true |
371ff19e038262fce8576d147bdf6337c845add1 | JavaScript | rohanrags/NotesApp | /notes.js | UTF-8 | 1,422 | 3.59375 | 4 | [] | no_license | const fs = require('fs');
fetchNotes = () => {
try {
var notes = fs.readFileSync('notes_data.json');
return JSON.parse(notes);
} catch(e) {
return [];
}
};
saveNotes = (notes) => {
fs.writeFileSync('notes_data.json',JSON.stringify(notes));
};
//Function to add a new Note
addNote = (title,body) =>... | true |
a5a8da71bf9f468e0164ba0ebad8d6b4d6c0bd6f | JavaScript | AerialAcer7/Plinko | /particle.js | UTF-8 | 314 | 2.890625 | 3 | [] | no_license | class Particle{
constructor(x,y){
this.body = Bodies.circle(x,y,10);
this.color = color(random(0,255),random(0,255),random(0,255));
World.add(world,this.body);
}
display(){
var pos = this.body.position;
ellipseMode(CENTER);
fill(this.color);
circle(pos.x,pos.y,10,10);
}
} | true |
19544864df4395bfe7be5e387c57cf22930acc83 | JavaScript | bigairali/jQuery-Task-Manager | /js/main.js | UTF-8 | 24,154 | 2.53125 | 3 | [
"MIT"
] | permissive | // Date.create().set({ month: Date.create().getMonth() + 1 }).format('{Month}') > June;
// month change
/*
LocalityME task manager
Author: Chris J. Whitman
*/
(function($){
//===============================================
//=========================== APPLICATION GLOBALS
var win = $(window),
body = $(doc... | true |
87922f350b284a1dc0f08dfd04c8316434f274be | JavaScript | dweinberger/TicTacToeML | /main-node.js | UTF-8 | 9,619 | 3 | 3 | [
"MIT"
] | permissive | // plays random TicTacTo games
// const http = require('http');
// const hostname = '127.0.0.1';
// const port = 3000;
// const server = http.createServer((req, res) => {
// res.statusCode = 200;
// res.setHeader('Content-Type', 'text/plain');
// res.end('Hello World\n');
// });
// server.listen(port, hostname, ... | true |
394d68aae3e465771205354ec3f61f034f9abd7e | JavaScript | Androidest/Graduation-Design | /Ljh_Template/Source/Assets/GameUIs/HUD/HUDPanel.js | UTF-8 | 5,222 | 2.65625 | 3 | [] | no_license | class HUDPanel extends Rectangle
{
constructor()
{
let height = Game.canvas.height;
super(0, 0, 1, (height*0.4)+"px");
this.background = null;
this.energyColor = "#FFA6F8";
let energySize = height*0.09;
this.energy = new TextBlock(0, "49%", 1,... | true |
b079cb3b371c7149d159eb3b0ca5ba819d302177 | JavaScript | sipsynergy/js-proto-validator | /src/requests.js | UTF-8 | 578 | 2.671875 | 3 | [] | no_license | export default function sendRequest(server, service, rpc, message) {
let endpoint = server;
if (server[server.length - 1] !== '/') {
endpoint += '/';
}
endpoint += service.concat(rpc).join('/')
return fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringi... | true |
84464e950d3e6bebc292abf6c6ca29cf30f50bc6 | JavaScript | rakhat5555/movieTicket | /js/scripts.js | UTF-8 | 783 | 3.546875 | 4 | [] | no_license |
//Business logic
function Ticket(movie,time,age) {
this.movie = movie;
this.time = time;
this.age = age;
}
Ticket.prototype.fullInfo = function() {
return this.movie + " at " + this.time;
}
//User interface logic
$(document).ready(function() {
$("form").submit(function(event) {
event.preventDefault();... | true |
ea1f4ce03789a83a2e9dd094bc66133a9a2edcd6 | JavaScript | luisTJ/nodeschool_learnyounode_solution | /juggling_async_1_9.js | UTF-8 | 557 | 2.921875 | 3 | [
"MIT"
] | permissive | var http = require('http');
var async = require('async');
var urls = [];
for(var i = 2; i< process.argv.length;++i)
urls.push(process.argv[i]);
async.map(urls,get,print);
function get(item,callback){
http.get(item, function(res){
var result = "";
res.on("error",function(err){
callback(err);
});
res.on("... | true |