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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
096c3e382733ebb68740102f349e2ab970bda2bd | JavaScript | LucasVarela42/threejs-car | /ThreeJSCar/script.js | UTF-8 | 7,469 | 2.625 | 3 | [] | no_license | "use strict";
var stats = new Stats();
var cena = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(5, 2, 3);
var render = new THREE.WebGLRenderer({
antialias: false
});
render.setSize(window.innerWidth, window.innerHe... | true |
1cb8b7b28c70b0f7713496a17e9f6cde4332fc97 | JavaScript | n0n3br/react-notes | /src/helpers/localstorage.js | UTF-8 | 391 | 2.6875 | 3 | [
"MIT"
] | permissive | export const get = key => {
if (!key) return false;
try {
return JSON.parse(window.localStorage.getItem(key));
} catch (e) {
throw new Error(e);
}
};
export const set = (key, value) => {
if (!key || !value) return false;
try {
window.localStorage.setItem(key, JSON.stringify(value));... | true |
5555bf9a3ec3f3795aad6c03863945c414e02e8c | JavaScript | jesusninoc/CursoJS | /codigos clase/03_dinamismo/scripts/01_dinamismo.js | UTF-8 | 2,904 | 3.421875 | 3 | [] | no_license | // DOM
// nodos
// elementos --> a, div, button, p, h1
// atributos --> href, class, id, style
// texto --> "asdasdasd"
// página --> document
// comentario --> //
console.log(document.getElementById('personalizado'));
let parrafoElemento = document.getElementById('personalizado');
//console.log(parrafoElemento.inne... | true |
81492292fd80ebf7c6f2386fec392c8d4da541a7 | JavaScript | PreedomCL/StoryOfTheStars | /entities.js | UTF-8 | 4,733 | 2.59375 | 3 | [] | no_license |
let entityManager = {
entities: [],
add: function(entity) {
this.entities[this.entities.length] = entity;
},
tick: function() {
for(let i = 0; i < this.entities.length; i++){
let entity = this.entities[i];
if(!entity.active){
... | true |
61a19ecc47a7473a55ed111f3f8bef9190c7f813 | JavaScript | cynthiawupore/array | /array.js | UTF-8 | 1,665 | 4.125 | 4 | [] | no_license |
// “最后加” concat 连接两个或更多的数组,并返回结果。
var a = ['a','b','c'];
var b = ['x','y','z'];
var c = a.concat(b,true);
// alert(c) //c变成 a,b,c,x,y,z
// join 把数组的所有元素放入一个字符串。元素通过指定的分隔符进行分隔。
var d = a.join('');
// alert(d) //d变成abc
var e = a.join(';');
// alert(e) //d变成a;b;c
// “最后加” push 向数组的末尾添加一个或更多元素,并返回新的长度。
... | true |
19179c9e836018b8dd29965ae22530540a3e5c91 | JavaScript | Aare-/solpeo_doom | /src/code/player.js | UTF-8 | 2,459 | 3 | 3 | [] | no_license | var keyboard =
{
left : false,
right : false,
up : false,
down : false
};
function Player() {
this.pos = new Victor(1.5 * config.map.tileS, 1.5 * config.map.tileS);
this.direction = new Victor(0, 1);
Engine.Input.on('keydown', function(e){
switch (e.key){
case 'A': return keyboard.left = true;
case '... | true |
71cbb023c16ffa37601bb0ddc99575d5c0730566 | JavaScript | trakos/fbpviewer | /assets/js/keyboardHandler.js | UTF-8 | 787 | 2.671875 | 3 | [
"MIT"
] | permissive | const $ = require("jquery");
class KeyboardHandler {
constructor() {
this.keys = {
alt: 18,
W: 87,
A: 65,
S: 83,
D: 68,
equal: 187,
dash: 189,
num_add... | true |
0120d20e0eb73ad3c856941158d3911dc6031530 | JavaScript | it-chhaya/spring-boot-webmvc-with-arraylist | /src/main/resources/static/js/article.js | UTF-8 | 3,954 | 2.921875 | 3 | [] | no_license | let endPoint = "/api/articles";
let uiEndPoint = "/ui/articles";
let id;
let articleForUpdate;
$(document).ready(function () {
getArticles();
$('.btnSave').on('click', function () {
let article = {
title: $('.inputTitle').val(),
details: $('.inputDetails').val()
}
... | true |
cfdbf19251a887372ddd07479deab58973215686 | JavaScript | taint1996/Document_Learning | /Example_Map_Filter_Reduce_JS/ex5.js | UTF-8 | 780 | 4.28125 | 4 | [] | no_license | // [[a, b, c], [d, e, f], [g, h i]] -> [a, b, c, d, e, f, g, h, i]
const letterArr = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']];
const out = letterArr.reduce((acc, curr) => { return acc.concat(curr) }, []);
console.log("Output", out);
const numberArr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
const outputs = number... | true |
b6ddc55faecd48012cb8fe3eb4def3ad65d9f499 | JavaScript | Aziz-Mattar/mongodb | /mongodb_assignment/test/7-nesting_test.js | UTF-8 | 651 | 2.59375 | 3 | [] | no_license | const assert = require('assert');
const Movie = require('../models/MoviesModels');
describe('Nesting', function(){
var movie;
it('Create a new movie and Nest the Actors record',function(done){
movie = new Movie({
name:"Tenet",
year:2020,
genre: "Tenet",
... | true |
b81b16db26807bac515baaa497bd572ba2c96d43 | JavaScript | jiameng123/Mengt.js | /src/assoc.js | UTF-8 | 679 | 2.984375 | 3 | [
"MIT"
] | permissive | import _curry3 from "./utils/_curry3";
/**
* 浅复制对象,然后设置或覆盖对象的指定属性。
* assoc :: String -> a -> {k: v} -> {k: v}
* @func
* @member {Object}
* @param {String} prop 要设置的属性名称
* @param {*} val 要设置属性的值
* @param {Object} 要克隆的对象
* @return 返回Object除已更改的属性外,等效于原始对象的新对象
* @example
*
* M.assoc('c', 3, {a: 1, b: 2}... | true |
c1d2bed019080116125d41fb2b435eabe8aaac58 | JavaScript | Houssk/Synthese-d-images-avec-OpenGL | /Materials/MultiMat/WebGL/Pyramid.js | UTF-8 | 4,255 | 2.625 | 3 | [] | no_license | // Définition de la classe Pyramid
// superclasses et classes nécessaires
Requires("libs/Mesh/Mesh.js");
Requires("libs/Mesh/MeshModuleDrawing.js");
Requires("ColorPerVertexMaterial");
Requires("RedMaterial");
Requires("GreenMaterial");
Requires("ProceduralMaterial");
class Pyramid
{
/**
* Constructeur
... | true |
08537cdea1a00f2fd2d096d6fb9bc23a265aaed4 | JavaScript | orgforweb/birthday | /backup/js/gradient.js | UTF-8 | 2,298 | 2.78125 | 3 | [] | no_license | /// <reference path="./theme.js" />
// background gradient special effects animation
var Gradient = (function () {
"use strict";
var trg = Theme.resources.gradient;
var currentMovingStop = trg.movingStop.max;
// caching gradient colors
var sR = trg.start.red, sG = trg.start.green, sB = trg.start... | true |
ad449f7a8883e634b6702d637abeeef4637872d8 | JavaScript | Rabab-art/js-fizzbuzz | /js/script.js | UTF-8 | 985 | 3.9375 | 4 | [] | no_license | // Scrivi un programma che stampi i numeri da 1 a 100,
// ma per i multipli di 3 stampi “Fizz” al posto del numero e per i multipli di 5 stampi Buzz.
// Per i numeri che sono sia multipli di 3 che di 5 stampi FizzBuzz.
for (var i = 1; i <= 100; i++) {
console.log(i);
if (i % 3 === 0 && i % 5 == 0) {
... | true |
dcdc0d818fa7ac2d996fac05c9b77f3ac5a8f81d | JavaScript | Hlsorrells/algorithms | /Numbers/largestNumInArr.js | UTF-8 | 621 | 4.78125 | 5 | [] | no_license | // Write a function that returns the largest number present in a given 'arr' array.
// Solution 1 ES6 arrow function and deconstructs the array
const array1 = [1, 3, 2];
var maxNum = arr => Math.max(...arr)
console.log("Solution 1a: " + maxNum(array1)) // expected output: 3
console.log("Solution 1b: " + Math.max(...... | true |
aa443b72cea8b0f273c0e422dd7c94daf43a0aec | JavaScript | ihafkenschiel/java_skilltests | /Fibonacci/test.js | UTF-8 | 680 | 3.46875 | 3 | [] | no_license |
const solution = (array) => {
function merge(left, right) {
let merged = [];
let i = 0;
let j = 0;
while (i < left.length && j < right.length) {
if (i == left.length || left[i] < right[j]) {
merged.push(right[i++]);
} else {
merged.push(left[j++]);
... | true |
29918b8998debbb600e9adec535b2e91a90e8b10 | JavaScript | jvrcavalcanti/Joguinho-sem-nome-Js | /Ai_Vs_Ai/fruit.js | UTF-8 | 536 | 3.390625 | 3 | [
"MIT"
] | permissive | x_possibles = []
y_possibles = []
for(let i = 0; i <= 475; i+=25){
x_possibles.push(i)
y_possibles.push(i)
}
var Fruit = {
"x": 0,
"y": 0,
"width": 25,
"height": 25,
"draw": function(){
Game.ctx.beginPath()
Game.ctx.rect(this.x, this.y, this.width, this.height)
Gam... | true |
5ea1f6880ec336db5773ae01787e207492dc07c9 | JavaScript | joari2021/app-recarga-saldo | /app/javascript/channels/script_login_and_register.js | UTF-8 | 2,405 | 2.71875 | 3 | [] | no_license | //Variables
document.addEventListener("turbolinks:load", function () {
$("#btn__registrarse").click(register)
$("#btn__iniciar-sesion").click(login)
anchoPagina()
window.addEventListener("resize", anchoPagina)
})
function anchoPagina(){
if (window.innerWidth > 850) {
$('.caja__trasera-login').css({"display"... | true |
d383efd1334c975e0bf84e150f33d5932e3edff0 | JavaScript | asadnisar98/ecommerce-gatsbyjs | /src/redux/reducers/sortReducer.js | UTF-8 | 1,549 | 2.53125 | 3 | [
"MIT"
] | permissive | import * as actionTypes from '../actions/constants/actionTypes';
const initialState = {
products: [],
};
export default function(state = initialState, action) {
switch (action.type) {
case actionTypes.All_Products:
return { ...state, products: action.data };
case actionTypes.Alphabetically_A_to_Z:
... | true |
afcf932dbeb5b3f71b7bd23d11c042c59e76866a | JavaScript | skyraider256526/MyWay | /src/components/add-url.jsx | UTF-8 | 1,635 | 2.6875 | 3 | [] | no_license | import React from "react";
import { connect } from "react-redux";
import { addUrlToPlaylist } from "../redux/playlist.action";
export const AddUrl = ({ dispatch }) => {
const ENTER_KRY = 13;
//urlCheck1 for url copied from the addres bar, with http:// and without
const urlCheck1 = url =>
/http:\/\/www.yout... | true |
cbe1473d82b8b8ee780be1a4329e30d1ce5415f5 | JavaScript | Chandler-Song/sample | /javascript/node/course/web/use-nunjucks/app.js | UTF-8 | 1,957 | 3.0625 | 3 | [] | no_license | const nunjucks=require('nunjucks');
function createEnv(path,opts){
// 创建env需要的参数可以查看文档获知
// http://mozilla.github.io/nunjucks/
var
autoescape=opts.autoescape===undefined?true:opts.autoescape,
noCache=opts.noCache||false,
watch=opts.watch||false,
throwOnUndefined=opts.throwOn... | true |
a837371dd6b98e9b5a238c204250da3455522b88 | JavaScript | SubjectRefresh/codevisor | /modules/extensions/index.js | UTF-8 | 1,412 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | var fs = require('fs');
var colours = JSON.parse(fs.readFileSync(__dirname + '/colours.json', 'utf8'));
var defaultColour = "#ececec";
function ext(ext) {
// Turn extension to colour
var keys = Object.keys(colours);
for (i=0; i<keys.length; i++) {
var extensions = colours[keys[i]].extensions;
try {
for (j=... | true |
ef2c9f4be6d8c2bf49d2d370ed8f66536f93ecd0 | JavaScript | davidbkemp/jsqubits | /examples/algorithms/quantumTeleportation.js | UTF-8 | 2,212 | 3.890625 | 4 | [
"MIT"
] | permissive | /*
* The quantum teleportation algorithm
* If Alice and Bob share a pair of entangled qubits, then Alice can transmit the state of a third qubit to Bob
* by sending just two classical bits.
*/
import jsqubits from '../../lib/index.js'
const applyTeleportation = function (state) {
const alicesMeasurement = state... | true |
f3ca15450ce2b67697127db48f012a54a4c085ec | JavaScript | mjrosenberg/data-structures-algorithms | /nonrepeatedCharacter.js | UTF-8 | 734 | 4.4375 | 4 | [] | no_license | /**
* Given an arbitrary input string, return the first nonrepeated character in
* the string. For example:
*
* firstNonRepeatedCharacter('ABA'); // => 'B'
* firstNonRepeatedCharacter('AACBDB'); // => 'C'
*/
var firstNonRepeatedCharacter = function(string) {
// TODO: your solution here
var numTimesInStri... | true |
cb57ae0add9547b14d93aad6cf505e6816edbbd5 | JavaScript | uan4ik/CSE-110-Project | /jasmine-standalone/spec/listallSpec.js | UTF-8 | 2,894 | 3.015625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | /* Test cases to test Listall.js*/
describe("Should create an object of Lost and Found class and call all their methods ", function(){
it ("Downloader() should create a new object named Lost ", function(){
var lost = new Downloader("Lost", 0,0);
expect(lost.className).toBe("Lost");
});
it ("The value of ... | true |
1da3156238a0d01d62838c015edfeb02fe97b123 | JavaScript | felipealvessi/jogo-coleta-diamante | /game.js | UTF-8 | 4,046 | 3.09375 | 3 | [] | no_license | // Inicialize o objeto Phaser Game e defina o tamanho padrão da janela do jogo
const game = new Phaser.Game(800, 600, Phaser.AUTO, '', {
preload: preload,
create: create,
update: update
})
// Declarar variáveis compartilhadas na parte superior para que todos os métodos possam acessá-las
let score = 0
let score... | true |
d249c9598e9c60b194a490ab2bca9dabfef2565e | JavaScript | ratednitesh/my-portfolio | /js/script.js | UTF-8 | 6,385 | 2.640625 | 3 | [] | no_license | console.log("Application Started!");
document.getElementById('development-know').addEventListener('click', function () {
if (document.getElementById('development-know').textContent === "Know More") {
document.getElementById("design").style.display = "none";
document.getElementById("creativity").st... | true |
f703b3f91a7b553ebfecfc0a43389ffc038f48de | JavaScript | anakellyc/lab-react-ironnutrition | /starter-code/src/App.js | UTF-8 | 5,399 | 2.578125 | 3 | [] | no_license | import React, { Component } from "react";
import "./App.css";
import "bulma/css/bulma.css";
import foods from "./foods.json";
import Onefood from "./components/FoodCards";
class App extends Component {
constructor(props) {
super(props);
this.state = {
y: foods,
search: "",
modalActive: fals... | true |
83dd8020102f9eb8c59abe4a4c135344e97f458d | JavaScript | Shuttl-Tech/terrace.js | /bin/generators/utils/error-handlers.js | UTF-8 | 568 | 2.625 | 3 | [
"MIT"
] | permissive | import v from 'voca';
import { BAD_ARGUMENT_PATTERN, MISSING_ARGUMENT } from './error-codes';
export const CriticalError = (msg, code = -1) => { console.error(msg); process.exit(code); };
export const PatternMismatchError = () => CriticalError('Name doesn\'t fit pattern. It must be a single dasherized string. It\'ll ... | true |
03306eaa52567c00c47ca7fa44dd10d659b5236a | JavaScript | milancakic89/Sentiment | /app/assets/js/includes/Analize.js | UTF-8 | 5,108 | 3.234375 | 3 | [] | no_license | const Elements = require('./Elements');
const LS = require('./LS');
exports.analizeDocument = function(){
let input = Elements.buttonUpload;
let textArea = Elements.calculatorTextArea.value;
if(input.files[0]){
let reader = new FileReader();
reader.onload = function(){
... | true |
6c21588917526a69acb280974da1fb2824123ac1 | JavaScript | abraojr/javascript | /exercises/ex_020.js | UTF-8 | 738 | 4.40625 | 4 | [] | no_license | /*Create a program to identify the amount to be paid by a health plan given the age of the insured considering
that everyone pays R$100 plus an additional one according to the following table: 1) children under 10 years
pay R$80; 2) members between 10 and 30 years pay R$50; 3) members above 30 and up to 60 years pay R$... | true |
a149c2f78b54aab4233c3d5840943acca0a09a74 | JavaScript | smrq/advent-of-code | /2021/01b.mjs | UTF-8 | 407 | 2.890625 | 3 | [] | no_license | import { getRawInput, autoparse } from '../lib.mjs';
const input = parseInput(getRawInput());
console.log(run(input));
function run(input) {
let count = 0;
for (let i = 4; i < input.length; ++i) {
const a = input[i-3] + input[i-2] + input[i-1];
const b = input[i-2] + input[i-1] + input[i-0];
if (b > a) {
... | true |
8eeebf521eab2bbf0a2f2ba0f4e6966455fc68a7 | JavaScript | maxistar/etherra-core | /assets/ztools.js | UTF-8 | 45,112 | 2.890625 | 3 | [] | no_license | /**
* base.js - Base of ztools library
*
*
* The main file of the library. It contains some useful functions that can be used together with
* another parts of the library.
*
* @example examples/core/empty
*
*/
/**
* z(s,defaults) getter of z.Element object
*
* this function contains al... | true |
d86fd802d60f949492cdda68a4a01753e5e08b25 | JavaScript | estherlaraaaa/Laboratorio_05_00049717 | /ejercicio_1.js | UTF-8 | 229 | 3.65625 | 4 | [] | no_license |
function palindromo(palabra){
palabra=palabra.toLowerCase();
var aux="";
for (i in palabra){
aux = palabra[i] + aux;
}
if (palabra == aux){
return true
}else{
return false
}
}
| true |
e83a67b7eb77c19960d42b2ccaf84cd577476102 | JavaScript | na-ya-ririri/portfolio2.github.io | /jquery/scroll_current.js | UTF-8 | 2,009 | 2.59375 | 3 | [] | no_license | // -------スムーススクロール-------------------------------
// ドロワーメニュー
$('.drawer-menu__link').on('click',function() {
var navHeight = 68;
var id = $(this).attr('href');
console.log(id)
var position = $(id).offset().top - navHeight + 1;
console.log(position)
$('html, body').animate({
'scrollTop':position
}, 5... | true |
b6f6d58e22fbf19c1b29781d78e76ef6f46b387e | JavaScript | gopikrishna487/angular-2-samples | /components/input-output/input-output-demo.js | UTF-8 | 1,228 | 2.515625 | 3 | [
"MIT"
] | permissive | import { Component } from '@angular/core';
var InputOutputDemo = (function () {
function InputOutputDemo() {
this.count = 0;
this.runningTotal = 0;
this.myString = '';
this.myTitle = 'Input/Output Demo';
}
InputOutputDemo.prototype.update = function () {
this.count++;... | true |
018b9aa8230e8bac6a63df4dd86f4679b0de3cd2 | JavaScript | swindex/leet-mvc | /core/DeBouncer.js | UTF-8 | 3,067 | 3 | 3 | [] | no_license | /**
* DeBouncer module
*/
export var DeBouncer = {
/**
* Run debounced function FIRST only ONCE per life of the debouncer
*/
onceFirst: function(func){
var _executedOnce = false;
return function(){
var context = this;
if (!_executedOnce && (_executedOnce = true)){
if (t... | true |
f2259e24185517498b85daa212dd533164bf3603 | JavaScript | Bilal-Gujjar/React | /context_provider/src/Components/Child5.js | UTF-8 | 311 | 2.515625 | 3 | [] | no_license | import React,{useState} from 'react'
function Child5() {
const [counter, setCounter] = useState(2)
return (
<div>
<h5>Hello form the Child5 Component{counter}</h5>
<button onClick={setCounter(counter)}>StateButton</button>
</div>
)
}
export default Child5
| true |
6e7bed5d595d8b754ef7313792ff42c6f0c2dab3 | JavaScript | ArjunJoshi0507/Project-35 | /sketch.js | UTF-8 | 1,822 | 3.296875 | 3 | [] | no_license | var dogHappy
var dogStand
var foodS
var FoodStock
var foodObject
var lastFed
function preload()
{
dogHappy = loadImage("images/dogHappy.png");
dogStand = loadImage("images/dogStand.png");
//load images here
}
function setup() {
createCanvas(1000, 400);
database = firebase.database();
foodStock = database.re... | true |
df09a86eb7205691f7935e86989de2b9226cb4dd | JavaScript | SorrelBrigman/similar_tastes_nashville | /app/factories/getRestaurantsFact.js | UTF-8 | 880 | 2.734375 | 3 | [
"MIT"
] | permissive | app.factory('getRestaurantsFactory', function($http){
return {
getAllRestaurants : () => {
//get all the restaurantss from api
return $http
.get('https://similar-tastes-nashville-api.herokuapp.com/api/v1/restaurants')
//parse the return from api, just returning the data object
.then(... | true |
1f9944bbeaa0f2392033b2f5331472289b99ef20 | JavaScript | Kiki-Q/node-demo | /service/.history/servers/pubsub_20200828175940.js | UTF-8 | 2,964 | 2.828125 | 3 | [] | no_license | //用事件发射器实现简单的发布/订阅系统
let events = require('events');
let net = require('net');
let fs = require('fs');
let watchDir = '../watch', processedDir = '../done';
//扩展EventEmitter,添加处理文件的方法
Watcher.prototype.watch = function() {
let watch = this;
//保存对Watcher对象的引用,以便在回调函数read敌人中使用
fs.readdir(this.watc... | true |
95b051dc37482ffb93d90ae1bc04c4e14a82567f | JavaScript | ShwetaPatel1/ComIT_Practice | /JS_Exercise/index163.js | UTF-8 | 958 | 4.75 | 5 | [] | no_license | // Create a new index163.js
// Define a add function
// This function will return a numeric value with result of adding all the numbers
//that we pass as parameter
// As we don't know how many parameters we are going to get we need to use a dynamic way to add this functionality
// Call the add function passing 5 numbe... | true |
0d3279b8e6bf524daf0a9600063103b8cb2254be | JavaScript | loveandmusic/lvnms.github.io | /js/sc-lyrics.js | UTF-8 | 1,115 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | //sound-cloud歌词同步插件
//需要jquery支持
// 先在网页<script>标签里定义一下 var lyrics = ".lrc文件的路径"
$(document).ready(function() {
//定义全局变量
var lyricsTime;
lyricsBank = [];
// 获得正在播放的秒数
function currentTime(){
var timeraw = $(".sc-position").text().split(".");
var time = parseInt(timeraw[0])*60 + parseInt(timeraw[1]);
... | true |
7de3f13e06c4d4334d102ef0d32a1f9315d1cc80 | JavaScript | Calypso4597/love_for_code | /Mission-13/libs/main.js | UTF-8 | 2,719 | 2.703125 | 3 | [] | no_license | // Base game varaible
var g = {};
g.mabC = function () {
if (window.innerWidth <= 800 || window.innerHeight <= 600) {
return true;
} else {
return false;
}
};
// Number of ticks passed since the game started.
g.tm = 0;
// Game refresh alpha value.
g.a = 1;
// Game canvas.
g.cv = document.g... | true |
66bf619541a515ed9e7cf6d23efed9efc68eb040 | JavaScript | Priya411/pozyx-positioning | /canvas/src/apps/BoxingApp.js | UTF-8 | 2,533 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
import Boxing from '../components/Boxing';
import './App.css';
class BoxingApp extends Component {
constructor(props) {
super(props);
this.state = {
coordinates: {},
accelereation: 0,
velocity: {}
}
}
compo... | true |
906d9b42159d2ada072ca26b23657e6f14f39986 | JavaScript | HenriqueeRodrigues/Web-developer-JS | /index.js | UTF-8 | 477 | 4.53125 | 5 | [] | no_license | /**
* Abaixo vemos duas váriaveis que serão usadas para realizar um cálculo
* Os valores precisam ser numero inteiros
* Use a função calcular()
*/
let a = 1;
let b = 2;
console.log(a * b);
function calcular(numero1, numero2, operador) {
return eval(`${numero1} ${operador} ${numero2}`);
}
//console.log(calcula... | true |
c878f250b63591560f87a3a2af3d05dba0dbb9ee | JavaScript | s-seguin/cm-pdsa-server | /src/controllers/helpers/sortKeyCleanUpHelper.js | UTF-8 | 2,947 | 2.75 | 3 | [] | no_license | import PrimarySkillArea from '../../database/models/metadata/primarySkillArea';
import PdsaItem from '../../database/models/pdsaItem';
import SecondarySkillArea from '../../database/models/metadata/secondarySkillArea';
/**
* Remove all references to the secondarySkillAreaId we are deleting, from the arrays in PDSAIte... | true |
c1740a55874fa533c4934795c535a3d92f630517 | JavaScript | imulus/js-knowedge-share | /Examples/slideshow/js/Gallery.js | UTF-8 | 955 | 2.921875 | 3 | [] | no_license | function Gallery(config){
var Gallery = this;
var Slides = [];
var Thumbnails = [];
Gallery.active = 0;
Gallery.init = function(){
build();
activate(0);
return this;
};
Gallery.goTo = function(index){
activate(index);
return this;
};
Gallery.next = function(){
/* If we're on the last slide... | true |
84d3a88a0f799bd184a41e72ff0fb5b9fb95c61f | JavaScript | michaelpumo/Carbonara | /bin/carbonara.js | UTF-8 | 2,604 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
// 👆 Used to tell Node.js that this is a CLI tool
const chalk = require('chalk')
const boxen = require('boxen')
const colors = {
red: '#EC697C',
navy: '#242842'
}
const options = {
padding: 1,
margin: 1,
borderStyle: 'round',
borderColor: colors.red,
backgroundColor: colors.navy
}
... | true |
0b097e07c30542939477a0a6308881da2498d303 | JavaScript | hjxcorner/LeetCode | /剑指offer/6-青蛙跳台阶问题.js | UTF-8 | 1,020 | 3.96875 | 4 | [] | no_license | // 一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。
// 答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。
// 示例 1:
// 输入:n = 2
// 输出:2
// 示例 2:
// 输入:n = 7
// 输出:21
// 示例 3:
// 输入:n = 0
// 输出:1
// 解题思路:设跳上 n 级台阶有 f(n) 种跳法。在所有跳法中,青蛙的最后一步只有两种情况: 跳上 1 级或 2 级台阶。
// 当为 1 级台阶: 剩 n-1 个台阶,此情况共有 f(n-1) 种跳法;
// 当为 2 级台阶: 剩 n... | true |
f0ac0b561c79958b62a421044a249ae8f31b5e38 | JavaScript | anaberrocal/hs-js-cartoon-collections-js-cartoon-collections-000 | /index.js | UTF-8 | 855 | 3.4375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function dwarfRollCall(dwarves) {
let dwarvesArray = [];
for ( let i = 0 ; i < dwarves.length; i++)
{
dwarvesArray.push(`${i + 1}. ${dwarves[i]} `);
}
return dwarvesArray.join('');
};
function summonCaptainPlanet(planeteerCalls){
let planeteerArray = [];
for (let i = 0; i < planeteerCalls.length; ... | true |
55b023c94d1add3dd0e4cfc912f6f491f35822e4 | JavaScript | indykiss/DataStructures-Algos | /Leetcode/Hards/Best_time_buy_sell_stock_III.js | UTF-8 | 1,205 | 4.25 | 4 | [] | no_license |
/*
Best Time to Buy and Sell Stock III
You are given an array prices where prices[i] is the price of a given stock on the ith day.
Find the maximum profit you can achieve. You may complete at most two transactions.
Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock befor... | true |
6bf1c99dff9f79dd100eca086ceb47040f56610b | JavaScript | bjw1234/review | /具体问题/素数的个数.js | UTF-8 | 509 | 3.515625 | 4 | [] | no_license |
// 求解在 num 范围内素数的个数
// 埃筛法 - 利用数组或是满足标记,找出合数,进而降低运算次数
const getValue = (num) => {
let result = 0
const map = new Map() // 用于标记合数
for (let i = 2; i < num; i++) {
if (!map.has(i)) {
result++
// 2*i,3*i,4*i.... ---> i*i作为初始值
for (let j = 2 * i; j < num; j += i) {
map.set(j, 0) // 满足条件的... | true |
b47055be9337f482d15ce15bee506cb6d0fe9dcb | JavaScript | 974026158/1826-blak_homeitem | /1826-blackHome--two/js/login.js | UTF-8 | 1,279 | 2.96875 | 3 | [] | no_license | $uname = $("#login_number");//用户名
$upwd = $("#login_password");//密码
$(function(){
//用一个变量接受cookie
var str = document.cookie;
//console.log( str );// y=18602237500; m=zhangzhihang
//分割 慢慢取出cookie
var str1 = str.split("; ")
//console.log( str1 );// ["y=18602237500", "m=zhangzhihang"]
for(var i = 0; i < str1.... | true |
f0ebbca8eb65006ecfb560a187485e73df5d77d0 | JavaScript | NolanAguirre/fun2learncode-api | /routes/stripe.js | UTF-8 | 5,235 | 2.625 | 3 | [] | no_license | const stripe = require('stripe')(process.env.STRIPE_TOKEN)
const db = require('../db')
const express = require('express')
const router = express.Router()
const stripCard = (card) => {
return {
last4:card.last4,
exp_year: card.exp_year,
exp_month: card.exp_month,
brand:card.brand,
... | true |
40911f3d0fec5a4a4e6fb2d48af7f5552255f915 | JavaScript | MadeByL9/LiveUniversity | /js/main.js | UTF-8 | 2,497 | 2.75 | 3 | [] | no_license | let checklist = [];
let isNavbarClicked = false;
$(document).ready(function() {
// responsive sidenav
$(".sidenav-button").click(function(e) {
if (!isNavbarClicked) {
e.preventDefault();
$(".sidenav").show();
$(".sidenav").attr("style", "transform:translateX(0)");
isNavbarClicked = true... | true |
d6b036ff8b5d4d876302656f34990b7289daa021 | JavaScript | yablokoff/fantasy-NBA | /src/pages/LoginPage/validation.js | UTF-8 | 1,251 | 2.828125 | 3 | [] | no_license | // validation
export const composeValidators =
(...validators) =>
value =>
validators.reduce((error, validator) => error || validator(value), undefined);
export const required = value => (value ? undefined : 'Required');
export const emailRegexp = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Z0-9.-]+\.[A-Z]{... | true |
2b69a3b88f4269582471cee06adf55989d932038 | JavaScript | hypothetical-andrei/webtech-1087 | /s10/simple-gui/src/App.js | UTF-8 | 1,410 | 2.5625 | 3 | [] | no_license | import './App.css'
import React from 'react'
import Person from './Person'
import PeopleStore from './PeopleStore'
import AddPersonForm from './AddPersonForm'
import PersonDetails from './PersonDetails'
class App extends React.Component {
constructor () {
super()
this.state = {
people: [],
sele... | true |
fe9447ebaf9ed29dd2b0999171891281a209c7b0 | JavaScript | 3009420/mgapartnership | /models/volunteer_info.js | UTF-8 | 1,654 | 2.609375 | 3 | [] | no_license | /**
* Created by Dominic on 14-Jul-2014.
*/
var assert = require('assert');
var Volunteer = function(args){
var volunteer = {};
assert.ok(args.firstName, "Volunteer first name is required");
assert.ok(args.surname, "Volunteer surname is required");
assert.ok(args.gender, "Volunteer gender i... | true |
83e677e3e57764b450dc2c2f157cefa3180d076f | JavaScript | TitanLi/Titan | /node-js/async-await/async-queue.js | UTF-8 | 1,228 | 3.34375 | 3 | [] | no_license | //queue可想像是parallel的加強版,其功能實際上是一個串列的訊息序列,透過限制worker數量,不再一次性全部執行
//當worker數量不夠時,新加入的任務將會排隊等候,直到有心的worker可用
//該函數有多個點可供回傳,如worker用完、無等候任務時、全部執行完時
//queue(worker,concurrency)
var async = require('async');
var q = async.queue((task,callback) => {
console.log('worker is processing task:',task.name);
callback();
},2);
... | true |
6bff32fd12a70d89ae26b678d2bf9879b727b88c | JavaScript | Alex413Vazhenin/FeedReaderTest | /jasmine/spec/feedreader.js | UTF-8 | 2,978 | 3.15625 | 3 | [] | no_license | $(function () {
// RSS Feeds test suite
describe('RSS Feeds', function () {
// Validating structure of feed object and that it is not empty
it('feeds are defined', function () {
expect(allFeeds).toBeDefined();
expect(allFeeds.length).not.toBe(0);
});
//... | true |
39749c3b8e2f6705e302e9338f751ab77a4635a6 | JavaScript | kinan-sleman/javascript | /Lesson96/app.js | UTF-8 | 2,648 | 2.609375 | 3 | [] | no_license | // ------------------------------------------------------------------------------------------------------
// navigator.geolocation يستخدم لتحقق إن كان متصفح وجهاز مستخدم يدعم خاصية تحديد مواقع
// navigator.geolocation.getCurrentPosition()يستخدم لطلب صلاحية وصول إلى موقع من المستخدم
// ... | true |
e50143d44dd0d68a091333d5f2c906735859dd66 | JavaScript | smboolean/js-lista-cognomi | /js/script.js | UTF-8 | 1,102 | 4.4375 | 4 | [] | no_license | // Chiedi all’utente il cognome,
// inseriscilo in un array con altri cognomi,
// stampa la lista ordinata alfabeticamente.
// Scrivi anche la posizione della lista in cui il nuovo
// utente si trova.
// 1. definisco lista cognomi
var listaCognomi = ["Bianchi", "Rossi", "Duzioni", "Balsano", "Verdi"];
// 2. chiedo all... | true |
53d06b2b418f734a0e0a4b83dd4f7d203ad7f273 | JavaScript | sebastian018/EjerciciosJS | /Ejercicios JavaScript/set.js | UTF-8 | 490 | 4.03125 | 4 | [] | no_license | var mySet = new Set();
mySet.add(1);
mySet.add(5);
mySet.add("some text");
var o = {a: 1, b: 2};
mySet.add(o);
mySet.has(1); // true
mySet.has(3); // false, 3 no ha sido añadido al Set
mySet.has(5); // true
mySet.has(Math.sqrt(25)); // true
mySet.has("Some Text".toLowerCase()); // true
mySet.has(o); // ... | true |
6436e73d9647a10af61900565d16a56169e85a7f | JavaScript | omar2112/animationScroller | /js/app.js | UTF-8 | 3,460 | 2.90625 | 3 | [] | no_license |
var myApp = angular.module('myApp', [])
// Main controller
.controller('MainController', function($scope) {
// Data for the chart
$scope.data = [
{id:0, text:'Scroll for a locking animation. Square: Data. Circles: Processes.'},
{id:1, text:'Problems arise when two parallel processes attempt to... | true |
0855e62b677fca7f56a08889322b04f002abc9f7 | JavaScript | EliasYoc/react-project-yocNotas | /src/components/NoteCard.js | UTF-8 | 1,432 | 2.53125 | 3 | [] | no_license | import { useContext, useEffect, useRef } from "react";
import NotesContext from "../context/NotesProvider";
import { TYPES } from "../types";
import "./NoteCard.css";
const NoteCard = ({ id, body, title, date }) => {
const { dispatchNotes, setNoteForm } = useContext(NotesContext);
const refBody = useRef();
const ... | true |
4154196f3f3d88f9f2418fbbbc1e4ff09aea0e27 | JavaScript | gMorning-Wp/ES6-Study | /Proxy/proxy-08-apply-01-方法说明和基础实例.js | UTF-8 | 589 | 3.375 | 3 | [] | no_license | // apply方法拦截函数的调用、call、apply
// apply方法接受三个参数,分别是目标对象、目标对象的上下文(this)、和目标对象的参数数组
// var handler ={
// apply (target,ctx,args){
// return Reflect.apply(...arguments);
// }
// }
//要被拦截的函数
var target = function (){ return 'I am target';};
//处理函数
var handler ={
apply:function(){
return 'I am ... | true |
831c284d7c39c41a3ce501abcd7eb97723383ea2 | JavaScript | ismailam/API-development | /modules/tenant.js | UTF-8 | 3,051 | 2.875 | 3 | [] | no_license |
'use strict'
const schema = require('../schema/schema')
/**
* This module gets all the tenants added to the database!
* @return {Promise<object|Error>} All tenants in the database.
*/
exports.getTenants = () => new Promise( (resolve, reject) => {
schema.Tenant.find({}, (err, tenants) => {
if (err) reject(new E... | true |
636538f130ebf2a36acaa2fd9aa1eded1ecbdd35 | JavaScript | mikeseven/node-opencl | /examples/saxpy.js | UTF-8 | 4,777 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* @Author: mikael
* @Date: 2015-09-22 21:13:24
* @Last Modified by: Mikael Bourges-Sevenier
* @Last Modified time: 2018-02-24 19:30:06
*/
'use strict';
var cl = require('../lib/opencl');
var log = console.log;
saxpy();
function get_event_exec_time(event)
{
// times are 64-bit values in nanoseconds. They ar... | true |
e6243147a5e35e6be90b42567ece28cc55924ff2 | JavaScript | mkdata95/boiler-plate-dev1 | /index.js | UTF-8 | 1,304 | 2.515625 | 3 | [] | no_license | const express = require("express");
const app = express();
const bodyParser = require("body-parser");
const { User } = require("./models/User"); // 사용자 정보를 가져온다.
const config = require("./config/key");
app.use(bodyParser.urlencoded({ extended: true })); // 서버에서 가져온 정보를 변경해줌.
app.use(bodyParser.json()); // 제이슨 타입으로 변경해... | true |
c43ae00ae4db45cb2b11654e00824cb5640d5936 | JavaScript | larafale/uteel-sender | /source/index.js | UTF-8 | 1,239 | 2.640625 | 3 | [] | no_license | require('isomorphic-fetch')
// HELPERS
const fetchJson = async (url) => (await (await fetch(url)).json())
const render = require('mustache').render
const renderKeys = (data, subs, keys) => {
return (keys || Object.keys(data)).reduce((acc, key) => {
if(data[key]) acc[key] = render(data[key], subs)
return acc
... | true |
e46d55c646ba15c1ec30d8d03969a4aec57d2f2c | JavaScript | Diermanio/Delitos-en-Mira_React | /src/assets/js/login.js | UTF-8 | 822 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import L from "leaflet";
import * as $ from "jquery";
function LogIn() {
$("#login").on("click", function() {
$.getJSON("./credenciales.json", function(credencial) {
var longitud = credencial.length;
for (var i = 0; i < longitud; i++) {
const us = credencial[i].username;
const pass =... | true |
e511800f53b8006333890f55a15b5a1aa77a772c | JavaScript | MuyePeikon/node-lessons | /lesson8/app.js | UTF-8 | 1,347 | 3.296875 | 3 | [] | no_license | var express = require('express');
var app = express();
var fibonacci = function(n) {
if(n > 40) {
throw new Error('EXCEEDS LIMIT!');
} else if(n > 1) {
return fibonacci(n-1) + fibonacci(n-2);
} else if(n == 1){
return 1;
} else if(n == 0){
return 0;
} else {
... | true |
7a2b452a0977bb96299ae31bfae229631370f8a1 | JavaScript | hbhandal80/Spinner | /spinner2.js | UTF-8 | 267 | 2.859375 | 3 | [] | no_license | process.stdout.write('hello from spinner1.js... \rheyyy\n');
let spinner = ['|', '/', '-', '\\', '|', '/', '-', '\\', '|', '\n']
let delay = 100;
for (const char of spinner) {
setTimeout(() => {
process.stdout.write(`\r${char}`);
}, delay);
delay += 200;
} | true |
d604ad6a3f4647e0e1d9699f9f9412a9b3237157 | JavaScript | sugarlabs/sugarizer | /activities/Speak.activity/lib/widepalette.js | UTF-8 | 5,893 | 2.828125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | define(function () {
'use strict';
var palettesGroup = [];
function getOffset(elem) {
// Ugly hack to consider the palette margin.
var style = elem.currentStyle || window.getComputedStyle(elem, '');
// Remove 'px' from the strings.
var x = -2 * style.marginLeft.slice(0, -... | true |
ab62922bccfba54f95de66d48b93e2c33d2274b6 | JavaScript | codeacademyprogramming/17-05-2021-MNMammadov | /src/ExchangeWallet.js | UTF-8 | 3,333 | 2.59375 | 3 | [] | no_license | import React from 'react';
import './ExchangeWallet.css';
import arrowDownUp from './arrow-down-up.svg';
import rates from './rates.json';
function ExchangeWallet() {
const [convertAmount, setConvertAmount] = React.useState("0");
const [fromCurrency, setFromCurrency] = React.useState("--");
const [toCurren... | true |
e819c6ec3c385a925c74b43f4bcc68740fa19680 | JavaScript | nousath/ecommerce | /backend/tools.js | UTF-8 | 1,668 | 2.546875 | 3 | [] | no_license | // utils
// useful function for generate random, https://gist.github.com/6174/6062387
function randomToken() {
return Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15);
}
// check all options for variable empty
function isE... | true |
29d337bc6effb48c67e1484cd9184c758b39d783 | JavaScript | patractlabs/redspot-v0.1 | /packages/redspot/bin/redspot.ts | UTF-8 | 789 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env node
import spawn from 'cross-spawn';
process.on('unhandledRejection', (err) => {
throw err;
});
const scripts = ['build', 'migrate', 'test'];
const args = process.argv.slice(2);
const scriptIndex = args.findIndex((x) => scripts.includes(x));
const script = scriptIndex === -1 ? args[0] : args[script... | true |
4004853279f90b37a996421ce968e07c1e06e0b6 | JavaScript | yomandawg/AdvancedNodeStarter | /services/cache.js | UTF-8 | 1,845 | 2.703125 | 3 | [] | no_license | const mongoose = require('mongoose');
const redis = require('redis');
const util = require('util');
const redisUrl = 'redis://127.0.0.1:6379';
const client = redis.createClient(redisUrl);
// client.get = util.promisify(client.get);
client.hget = util.promisify(client.hget);
// Untoucheed copy
const exec = mongoose.Q... | true |
20c3d197a2bc7c785fb3f67178949bf4f67b6d2c | JavaScript | richHong/socketrps | /public/app.js | UTF-8 | 8,345 | 3.171875 | 3 | [] | no_license | $(document).ready(function(){
//Connect to socket.io
var socket = io();
console.log(io)
//Game object
var game = {
currentRound:1,
gameWinGif:'',
roomName:''
};
//Player 1 object
var player1 = {
currentChoice: '',
score:0
};
//Player 2 object
var player2 = {
currentChoic... | true |
30f4cd6154ad37ad944be5a9ebfb6aff3e1aec97 | JavaScript | dzhumhur/Softuni | /JavaScript/Homeworks/JavaScript-Functions-Homework/Problem 1 - Array object extractor.js | UTF-8 | 774 | 3.28125 | 3 | [] | no_license | function solve(arr){
//var currentRes = [];
arr = arr.filter(function (element){
return element instanceof Object &&
!(element instanceof Array);
})
//for (var element in arr) {
// if(arr[element]instanceof Object && !(arr[element]instanceof Array)){
// currentRe... | true |
32e313b16b6c7c2455e80680afbc2a186f71906b | JavaScript | KChen8516/practice | /sandbox/colors/test.js | UTF-8 | 282 | 3.0625 | 3 | [] | no_license | // ELEMENTS
const gameContainer = document.querySelector('.color-game');
// VARIABLES
const EASY_GRID = 4;
const MED_GRID = EASY_GRID * 4;
const HARD_GRID = MED_GRID * 6;
// EVENTS
document.addEventListener('DOMContentLoaded', initGame);
// FUNCTIONS
function initGame() {
} | true |
002ce1f7a7316e2fbad3ac266f625844213e19f5 | JavaScript | PuZheng/chuangye-mis-backend | /lite-sm/index.js | UTF-8 | 1,527 | 2.84375 | 3 | [] | no_license |
class StateMachine {
constructor(logger) {
this.logger = logger;
this.states = {};
}
bundle(arg) {
if (arg === void 0) {
return this._bundle;
}
this._bundle = arg;
return this;
}
state(label) {
if (label === void 0) {
return this._state.label;
}
this._state = t... | true |
563730d8ab424380273ea5d5bd6f6fbf95151bdb | JavaScript | DavisKerr/prove02 | /web/battleBoats/Scripts/register.js | UTF-8 | 3,401 | 3.15625 | 3 | [] | no_license | $(document).ready(function(){
$("#confirmBtn").click(function(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var passwordConf = document.getElementById("confirmPassword").value;
var screenName = document.getElementById("screen_nam... | true |
17b43effeab31b820e41c55c2bdcb05d2220c13d | JavaScript | BYK0911/v3d | /demo/demo1.js | UTF-8 | 532 | 2.546875 | 3 | [] | no_license |
import v3d from '../src';
var scene = new v3d.Scene();
scene.perspective = 500;
scene.setSize(window.innerWidth, window.innerHeight);
scene.setLight(0, 1, 1);
document.body.appendChild(scene.renderer.dom);
var cubic = new v3d.Cubic(0, 0, 0, 150, 150, 150);
cubic.fill = '#5fa';
scene.add(cubic);
scene.render();
l... | true |
33b60bbbd778ffe6f7cbef12ef07a9cb52287ae4 | JavaScript | DevTechConnect/DevTechConnect | /test/serverTest.js | UTF-8 | 7,851 | 2.578125 | 3 | [] | no_license |
// see https://scotch.io/tutorials/test-a-node-restful-api-with-mocha-and-chai for documentation
//During the test the env variable is set to test
process.env.NODE_ENV = 'test';
//Require the dev-dependencies
let chai = require('chai');
var expect = require('chai').expect;
let chaiHttp = require('chai-http');
let se... | true |
4fbdebec6ecae94b1ab20638a612a1f01c79bb39 | JavaScript | stangah/project-euler | /question-001.js | UTF-8 | 403 | 4.125 | 4 | [] | no_license | /*
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
*/
function eulerOne()
{
var total = 0, x = 1;
while (x < 1000)
{
if (x % 3 === 0 || x % 5 == 0)
{
... | true |
17d8d72e4d19075ea4b4dae35985796463d66c51 | JavaScript | hermzz/youtube-scrobbler | /youtube.js | UTF-8 | 733 | 2.53125 | 3 | [] | no_license | $(document).ready(function() {
// check for youtube detected song
detected_song = $('.watch-extra-info-left');
if(detected_song.length)
{
artist_name = detected_song.find('a strong').text();
// use standard JS DOM access because jQuery does not see the text node
song_name = detected_song[0].childNodes[2].d... | true |
eb84e8b9770647b25bb2dc8cbcfb065743a67a1c | JavaScript | nlholdem/natter | /chromeExtensions/hack2/popup.js | UTF-8 | 2,565 | 2.75 | 3 | [] | no_license |
payloadEnums = {
SEED : 0,
JOB: 1
};
var seedDir = "/tmp/1492466045424-0";
function getPayload(x){
switch(x) {
case payloadEnums.SEED:
var payLoad = '{"name": "nutch","seedUrls":[{"seedList": null,"url": "http://nutch1.apache.org/"}]}';
break;
case payloa... | true |
3410deadf1c7e301ba578f9fa7d4f3869e1bc371 | JavaScript | rtorr/reactive-class | /src/App.js | UTF-8 | 697 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import Button from './Button';
import Buttons from './Buttons';
class App extends Component {
constructor(props) {
super(props);
this.state = { total: 0 }
this.addHandler = this.addHandler.bind(this);
}
addHandler() {
this.setState({total: this.state.tot... | true |
3bff19211f03e9672c53d7be1817cd1eaf9cf520 | JavaScript | shanemcgraw/allomorphic | /warp.js | UTF-8 | 4,314 | 3.28125 | 3 | [
"Unlicense"
] | permissive | var warpDrive = function(engage){
//To get ourselves a nice clean closure, we return a function with an added "destination" param, aka the URL of the request (since they'll be changing every movie)
//Everything else is a basic XHR request
return function(destination){
//A helpful search gif that will display a r... | true |
e3f956e312a9d004e2aee0de0b47c9eb4ef940ac | JavaScript | lesthoward/diet | /src/routes/usuarios.routes.js | UTF-8 | 1,594 | 2.59375 | 3 | [] | no_license | const { Router, request, response } = require('express')
const router = Router()
router.get('/', (req=request, res=response) => {
const db = res.locals.readDatabase()
res.json(db)
})
router.get('/:id', (req=request, res=response) => {
const db = res.locals.readDatabase()
const uniqueUser = db.find(si... | true |
f204a786badd586006927e39c724c959e903a0d7 | JavaScript | JGeek00/pepebits-ui | /src/components/Toast.jsx | UTF-8 | 1,987 | 2.65625 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
const Toast = ({type, text, icon, showToast, hideToast, duration}) => {
const [toastClass, setToastClass] = useState("");
const [toastDisplay, setToastDisplay] = useState({display: "none"});
let displayInterval;
let hideInterval;
useEffect(() => {... | true |
ca5a54fa0d8460ba6ca1a5688a507b19fe6a0976 | JavaScript | mhess/react-in-motion | /src/rotating-digit/RotatingDigit.js | UTF-8 | 2,530 | 2.78125 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import "./RotatingDigit.css";
const intervalMs = 1000;
export default class RollingDigit extends Component {
constructor(props) {
super(props);
this.state = { number: props.target, nextNumber: null, rotationState: 0 };
}
shouldComponentUpdate(nextProps, nextSt... | true |
cc45f9ad7e64fb1ad3a1cdd45b1be6990e4ea3b4 | JavaScript | leigler/f19webadvanced | /files/f19-oct-18/demo-boilerplate/assets/script.js | UTF-8 | 2,069 | 3.328125 | 3 | [] | no_license | // Documentation: https://www.metaweather.com/api/
// New York woeid: 2459115
var fetchingCityWOEID = function(cityString){
// WOEID is the WHERE ON EARTH IDENTIFIER
// https://en.wikipedia.org/wiki/WOEID
var weather = `https://www.metaweather.com/api/location/search/?query=${cityString}`,
query = `https://cor... | true |
50326b02970ccb45d4f83c2a4d04c6787aa93a66 | JavaScript | Predjo/codility-lessons | /src/10 Prime and composite numbers/CountFactors.js | UTF-8 | 219 | 3.046875 | 3 | [] | no_license | export function solution(N) {
let result = 0;
let i = 1;
while (i < Math.sqrt(N)) {
if (N % i === 0) {
result += 2;
}
i++;
}
if (i === Math.sqrt(N)) {
result++;
}
return result;
}
| true |
892f0b2c23fdc6344bba0b90bdb8cb7f98469a4d | JavaScript | cbryant24/sporttrace | /server/routes/helpers.js | UTF-8 | 2,946 | 2.734375 | 3 | [] | no_license | const models = require('../models');
const Game_History = models.game_history;
const Games = models.games;
const sequelize = models.sequelize
/**
* @module player_count
* @function
* @param {Object} game represents a single game from the joined game and game_history table
* @returns {Object} game object with the... | true |
37fedebb6886f48bcb470fb0995da14186277753 | JavaScript | codylindley/learnjs | /public/javascripts/edition2/Ch06/DynamicPrototypeExample.js | UTF-8 | 529 | 3.953125 | 4 | [] | no_license | //https://github.com/nzakas/professional-javascript/blob/master/edition2/Ch06/DynamicPrototypeExample.htm
//Dynamic Prototype Pattern Example
function Person(name, age, job){
//properties
this.name = name;
this.age = age;
this.job = job;
//methods
if (typeof this.sayName != "f... | true |
3ee9e3ca01d0c7beada508dff95901ecc92315f0 | JavaScript | denshou223/sample | /anime/js/common.js | UTF-8 | 6,341 | 3.421875 | 3 | [] | no_license | //canvasアニメーション
var w = $('.contents01').width();
var h = $('.contents01').height();
$('canvas').attr('width', w);
$('canvas').attr('height', h);
var canvas = document.getElementById("cvs");
var canvas2 = document.getElementById("cvs2");
var canvas3 = document.getElementById("cvs3");
var ctx = canvas.getContext("2d")... | true |
dc21f91b551f2c2784e83e308296c1286ed9246f | JavaScript | AlexanderAlatorreGovea/test-ibe | /basics/app.js | UTF-8 | 891 | 2.671875 | 3 | [] | no_license | //const EventEmiter = require("events");
const Logger = require("./logger");
const logger = new Logger();
//Register a listener
emitter.on("messagedLogged", (arg) => {
console.log("Listener called", arg);
});
logger.log("message");
// const os = require('os');
// const totalMemory = os.totalmem();
// var freeMem... | true |