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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10c8130182f25876ca9b2fab45cffb329b41af59 | JavaScript | ttngocthao/socialPost | /script.js | UTF-8 | 2,347 | 2.90625 | 3 | [] | no_license | //initial moment
moment().format();
//upload file to storage
var storage = firebase.storage();
// Get elements
var uploader = document.getElementById("uploader");
var fileButton = document.getElementById("fileButton");
// Listen for file selection
if (fileButton !== null) {
fileButton.addEventListener("change", func... | true |
b6105ffde6f7410dccbc8417718607bb5b050e6f | JavaScript | alnvdl/wcf | /server/context.js | UTF-8 | 4,908 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | const {Response, ErrorResponse} = require("./application");
class Context {
constructor(registry, db, clientData) {
this.registry = registry;
this.db = db;
this.clientData = clientData;
if (!this.clientData) {
this.clientData = {}
}
}
verifyRunning() {
... | true |
736076cb8db0fa09a34f66bde9874f045c4df2ff | JavaScript | AktanTech/santaRosa | /menu.js | UTF-8 | 1,201 | 2.625 | 3 | [] | no_license | $(document).ready(function() {
var banner_height = $("#navbar").height();
var lastScrollTop = 0;
$(window).scroll(function() {
var scroll = $(window).scrollTop();
var currScrollTop = $(this).scrollTop();
if (scroll <= banner_height && currScrollTop < las... | true |
8de4deec3b5f472ca9011489342aba9968b5ccb4 | JavaScript | RudraNilBasu/Fortior | /Assets/scripts/backgroundFader.js | UTF-8 | 658 | 2.609375 | 3 | [] | no_license | #pragma strict
var theBackground : GameObject;
var timeToStay : int ; // 8 seconds
var willFade = false;
var currentTime : float;
function Start ()
{
currentTime=0.0f;
}
function Update ()
{
/*
if(Input.GetKey(KeyCode.K))
{
willFade=true;
}
*/
if( willFade )
{
currentTime+=Time.deltaTime;
var a : Co... | true |
ef3b3dfffc4483def439d62af8f2d2ae02286ad6 | JavaScript | garyDav/FundamentosDeJavaScript | /22 sistema_modulos.js | UTF-8 | 2,599 | 3.203125 | 3 | [] | no_license | // ¿Por que escribir módulos?
// 1. Encapsulamiento:
// Cada parte de código se hace responsable de cumplir una tarea pero la cumple
// bien, Cáda módulo debe ser pequeño y de tener una sola responsabilidad
// 2. Dependencias:
// Mi módulo requiere otro modulo y si otra dependecia usa ese modulo
// no hay que e... | true |
804018882fba202084b76e1a8838460f635ee5ed | JavaScript | guoqin721/niujiaosuo | /hk2/hk/src/public/js/egs.js | UTF-8 | 3,158 | 2.6875 | 3 | [] | no_license | $(function () {
var _href = window.location.href;
var insurance = _href.split('?')[1].split('=')[1].split('&')[0];
var customerSex = "FN";
var customerSmoke = "无关";
var coverAge = $('.radioMoney').val();
$('#premium').html(coverAge);
var customerYears =$('.radioYears:checked').val();
var slideOption = $... | true |
933289b15d83a724fc73f355d5e550a6f6ad0df6 | JavaScript | jpmontoya182/jest-and-enzyme | /src/containers/Counter.js | UTF-8 | 1,053 | 2.921875 | 3 | [] | no_license | import React, { Component } from 'react';
class Counter extends Component {
constructor(props) {
super(props);
this.state = {
counter: 0,
message: ''
};
}
handleClickIncrement = () => {
this.setState({
counter: this.state.counter + 1,
message: ''
});
};
handleClickDecrement = () => {
co... | true |
f93cd26bd5c0e03ece4ababc4e1f3989c4bbe4d4 | JavaScript | green-fox-academy/puteulanus | /week-01/day-04/animal.js | UTF-8 | 298 | 3.3125 | 3 | [] | no_license | 'use strict';
class Animal {
constructor() {
this.hunger = 50;
this.thirst = 50;
}
eat() {
this.hunger -= 1;
}
drink() {
this.thirst -=1;
}
play() {
this.hunger += 1;
this.thirst += 1;
}
}
module.exports = Animal; | true |
a2ae2943c20cf20ba340dde54e1ca9822c08112c | JavaScript | 223kazuki/csr-tis | /api/__tests__/util.test.js | UTF-8 | 1,497 | 2.90625 | 3 | [] | no_license | const util = require('../src/util');
describe('errorWithStatus', () => {
it('returns an instance of Error when provided with a string', () => {
expect(util.errorWithStatus('Test message') instanceof Error).toBeTruthy();
})
it('returns an instance of Error when provided with an error', () => {
expect(util... | true |
83cdadf6e28da949890a65c80c466d01c27cdb4c | JavaScript | blinking12/w5d2-test-a-library | /examples.js | UTF-8 | 808 | 2.625 | 3 | [] | no_license | // Your test code examples go here. Make sure you console.log() results.
//one()
console.log(md.one('.nav-sidebar'))
//all()
console.log(md.all('.sub-header'))
//remove()
console.log(md.all('.page-header'))
console.log(md.remove('.page-header'))
//addClass()
console.log(md.addClass('.nav-sidebar', 'newClass'))
// /... | true |
ee10a0fca3781b3a87d224e083f0947ff6accdda | JavaScript | NokoDOjo/ShitTalk_Generator | /generate_shitTalk.js | UTF-8 | 811 | 2.671875 | 3 | [] | no_license | function generate_shitTalk(target) {
const jobList = {
engineer: '工程師',
designer: '設計師',
entrepreneur: '創業家'
}
const task = {
engineer: ['加個按鈕', '加新功能', '切個版', '改一點 code'],
designer: ['畫一張圖', '改個 logo', '順便幫忙設計一下', '隨便換個設計'],
entrepreneur: ['週末加班', '要能賺錢', '想個 business model', '找 VC 募錢... | true |
b091889ebf5493b8dfc92ef9b61e94fb56537783 | JavaScript | audiomuse1/javascript-workbook | /07week/towersOfHanoi/script.js | UTF-8 | 908 | 2.84375 | 3 | [] | no_license |
'use strict';
class TowersOfHanoi extends React.Component {
constructor(props) {
super(props);
this.state = {
a: [100, 75, 50, 25],
b: [],
c: [],
blockHeld: []
}
}
moveBlock = (event) => {
const stack = event.target.getAttribute('data-stack');
const blocks = this.st... | true |
07c6225bc7cd72c70d3a36dfb44fea1bba78b6c4 | JavaScript | ericguthrie/tinyapp | /express_server.js | UTF-8 | 5,117 | 2.578125 | 3 | [] | no_license | const helpers = require('./helpers');
const express = require("express");
const app = express();
const PORT = 8080;
const bcrypt = require('bcrypt');
var cookieSession = require('cookie-session');
const bodyParser = require("body-parser");
const {
response
} = require("express");
app.use(bodyParser.urlencoded({
... | true |
20e4eaf6f4258a89b23c7c8838e31813293f60ae | JavaScript | kentokage/js-practice | /src/arrays.js | UTF-8 | 1,381 | 4.5625 | 5 | [
"MIT"
] | permissive | // * Array Iteration and Properties
// !don't use for in for an Array....why would you?
// * because for in loop enumerates all the properties that are on the prototype chain, need to use hasOwnProperty to check
// * best to use classic for loop
var list = [1, 2, 3, 4, 5, 100000000];
// it's a good idea to cache the... | true |
a28de6e63afe42d9fb096d140b470b10430b490e | JavaScript | cybergit66/myreactredux | /v09-thunk middleware-exercise/index.js | UTF-8 | 913 | 2.703125 | 3 | [] | no_license | // create redux store
// store receives a reducer as a parameter
// in this instance, we pass in 'combineReducers'
// from reducers/index.js
var store = Redux.createStore(combineReducers, Redux.applyMiddleware(logger, crashReporter, thunk));
var valueEl = document.getElementById('value');
var value2EL = documen... | true |
7c29a0574d8982694d2a7b6fc2fe2338a9a1c930 | JavaScript | colorpeach/fecommand | /app/util.js | UTF-8 | 1,999 | 2.5625 | 3 | [] | no_license | var store = (function () {
return {
set: function (name, data) {
localStorage.setItem(name, JSON.stringify(data));
},
get: function (name) {
var data = localStorage.getItem(name);
return data ? JSON.parse(data) : null;
}
}
})();
// 防止抖动
// modal组件
Vue.component('modal', $.extend(... | true |
d00f36ed770920d4a48b8c8666fb468133df061f | JavaScript | kulanah/temsim-react | /src/components/MSWindow/Checkbox.js | UTF-8 | 1,073 | 2.84375 | 3 | [] | no_license | import React from 'react';
class Checkbox extends React.Component{
constructor(props){
super(props);
this.state = {selected: false};
this.selectCheckbox = this.selectCheckbox.bind(this);
this.generateCheckbox = this.generateCheckbox.bind(this);
this.returnState = this.returnState.bind(this);
}
... | true |
7e75197e4ca8ebb3541702a133f0e0a0be1b105c | JavaScript | rrockwel/JavaScript_DOM_Net_Ninja | /Video5(Editing_HTML_And_Text)/app.js | UTF-8 | 418 | 3.25 | 3 | [] | no_license | let books = document.querySelectorAll('#book-list li .name');
Array.from(books).forEach(function(book){
book.textContent += ' (book title)';
});
const bookList = document.querySelector('#book-list');
//bookList.innerHTML = '<h2> Books to NOT read </h2>'
bookList.innerHTML += '<p>This is how you add HMTL</p>'
//bookL... | true |
c4f12233c132b59b34cfc6a1db38c196f1036f64 | JavaScript | nmtrang29/creative-coding | /42 happy sad/sketch.js | UTF-8 | 2,038 | 3.21875 | 3 | [] | no_license | var message = ":-) :-) :-) :-) :-) :-) :-)";
var f;
var r = 150;
var col1=[];
var col2=[];
var count = 0;
var speed1 = 500;
var speed2 = 100;
var speedCol = 40;
var letterSpacing = 1.2;
function setup() {
createCanvas(800, 800);
// The text must be centered!
textAlign(CENTER);
textFont("Play");
... | true |
153ed6ef5e84bb5f1ae83fb5938604ff0204bf58 | JavaScript | niuzhi/cpachecker | /src/org/sosy_lab/cpachecker/core/counterexample/test/test.js | UTF-8 | 160 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | //Sample test case
describe("true", function () {
var a;
it("Should be true", function () {
a = true;
expect(a).toBe(true);
});
}); | true |
a80757a6eaa0e692c654b494a45f356cfeb7f211 | JavaScript | chrisslater/snapperfish | /src/models/__tests__/Post-test.js | UTF-8 | 2,014 | 2.5625 | 3 | [
"MIT"
] | permissive | import { expect } from 'chai';
import Post from '../Post';
import Image from '../Image';
// id: string;
// title: string;
// body: string;
// slug: string;
// image: Image;
// publishedDate: string;
//
// public_id: string,
// url: string,
// height: number,
// width: number,
// format: string,
//public_id: string,
/... | true |
49bbbeaec0b87654cc8840c8caf32c464861a31d | JavaScript | luisbravoa/expense-log | /api/mockData.js | UTF-8 | 861 | 2.875 | 3 | [] | no_license |
let categories = require('./data/categories.json');
let expenseData = require('./data/expenses.json');
let expenses = [];
// rent, water, electriciy, internet, cable, phone bill,
// grosuries, spending, restaurant, transportation,
// savings, gifts, repairs
function generateExpenses (length){
for(let i =... | true |
08f2c927b954283dd1438338d4bc7eb1dd17849a | JavaScript | borshon420/explore-function-object-javascript | /object-properties.js | UTF-8 | 351 | 3.03125 | 3 | [] | no_license | var computer = {
price: 29000,
memory: '160gb',
display: 'white',
processor: 'intel i5'
}
// console.log(computer.processor);
// var computerPrice = computer.price;
// console.log(computerPrice);
// computer.price = 22000;
computer["price"] = 23000;
var priceProperty = 'price';
computer[priceProperty] ... | true |
82e9e7e09a8e9b43afceb7e6042774dedcee542d | JavaScript | tonykwon/Bento | /bento/message/js/auto/message.js | UTF-8 | 3,720 | 2.875 | 3 | [] | no_license | // Hijack the alerts
/*
alert = function( message ){
// There you go
debug( message );
bento.message.open({'text':message,'clear':true});
// method
}*/
// This creates nice messages using the form messaging system
bento.message.log = new Array();
bento.message.open = function( options ){
// Set this up
if( !o... | true |
3fc3b8fb4f86142f8d6777290eb544faa9a2dca6 | JavaScript | RyinckevichDaniil/Homework-8 | /src/index.js | UTF-8 | 1,165 | 3.90625 | 4 | [] | no_license | let array = [1, 2, 3, 4, 5, 6];
function map(arr, callback) {
let result = [];
for(let i = 0; i<arr.length; i++) {
const functionVariable = callback(arr[i], i, arr);
result.push(functionVariable);
}
return result;
}
function calculator(item) {
return item * 2 + 4;
}
function filter(arr, callb... | true |
6ee55a9bdd8c31952c9af4a22a67bd30d6b748da | JavaScript | DeepakBandhu/JavaScript-Projects | /Project3_math_operations/divide.js | UTF-8 | 126 | 2.6875 | 3 | [] | no_license | function division() {
var simple_Math=48/6;
document.getElementById("Math").innerHTML= "48 / 6 = " + simple_Math;
} | true |
824750781d6b178f57e7e206a75df003bde25806 | JavaScript | lauraeiras/CursoIngresoJS | /5-InstruccionWhile/jsIteracionesWhile-10.js | UTF-8 | 2,490 | 3.984375 | 4 | [] | no_license | /*
Al presionar el botón pedir números
hasta que el usuario quiera, mostrar:
1-Suma de los negativos.
2-Suma de los positivos.
3-Cantidad de positivos.
4-Cantidad de negativos.
5-Cantidad de ceros.
6-Cantidad de números pares.
7-Promedio de positivos.
8-Promedios de negativos.
9-Diferencia entre positivos y negativo... | true |
758ffc66b7869c43901f271ad545ed0f2dbd2c81 | JavaScript | rjmccallumbigl/Google-Apps-Script---Return-Dropbox-Shared-Files-using-API-Public | /Code.gs | UTF-8 | 4,695 | 2.9375 | 3 | [] | no_license | /**
*
* Primary function, get things started. The purpose of this script is to return your Dropbox links from https://www.dropbox.com/share/links to a Google Sheet.
*
*/
function primaryFunction(){
// Declare variables
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
// Get shared Dropbox files
... | true |
20d22f89e1db18fe49915e348ca2831efb1edfbd | JavaScript | Luuk-4A5A/Villaverde-Laan | /javascript/AJAX/test.js | UTF-8 | 635 | 3.109375 | 3 | [] | no_license | function ajax(url) {
let ajax = new XMLHttpRequest();
ajax.open("GET", url, true);
ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
let methods = {};
methods.readyStateChange = (loadCallback) => {
ajax.onreadystatechange = () => {
if(ajax.readyState == 4 && ajax.status ==... | true |
294c8b2db71bb73534b5c1ef37dd57bf59c4f64d | JavaScript | NoalTessman/Assignments | /exercise/high/regEz.js | UTF-8 | 726 | 3.609375 | 4 | [] | no_license | // var str = "cowecodeibadlsiblbadbflibnsdlifbildsbfilsacofe";
// var regEx = /(co\we)/gi;
// console.log(str.match(regEx));
// function sum(x, y){
// if(typeof x !== "number" || typeof y !== "number"){
// throw new TypeError("inputs must be number");
// } else{
// return x + y;};
// };
// try {
/... | true |
7d040b10dfffa509eadb919e871d9384f2a4d9ae | JavaScript | Njel/gyroscope | /client/views/holidays/holidayDialog.js | UTF-8 | 1,852 | 2.59375 | 3 | [] | no_license | Template.holidayDialog.selectedHoliday = function() {
return Session.get('selectedHoliday');
};
Template.holidayDialog.hol = function() {
var holId = Session.get('selectedHoliday');
if (holId) {
var h = Holidays.findOne(holId);
if (h) {
var hol = {
date: h.date,
title: h.title,
... | true |
1b9a1b928b572b10994c474b3a101830675a8bb9 | JavaScript | vradrackly/TI-Start---Turma-2-SbM-Academy- | /Ciclo_2/JavaScript/aula17/exercicio/codigo.js | UTF-8 | 733 | 4.09375 | 4 | [] | no_license | //// Exercicio 16
// Crie uma função que some dois valores
//a) Os valores serão adicionados em dois elementos input
//b) O resultado será aparesentado em um terceiro elemnto input
//c) A soma será efetuada quendo perder o foco do segundo input
//usar o blur para saida de foco do elemento html do tipo text
function... | true |
752714dba9534c372a186e61bb84ea06d4430817 | JavaScript | jpw2065/web-app-dev-project-one | /src/Services/router.js | UTF-8 | 6,760 | 2.546875 | 3 | [] | no_license | const url = require('url');
const query = require('querystring');
const sizeof = require('object-sizeof');
const webRoutes = require('../web-routes.js');
const apiRoutes = require('../api-routes.js');
const errorController = require('../Controllers/error.js');
const dneUrl = errorController.doesNotExist;
/**
* R... | true |
38d8e2852aae81f73097757654804ff2443f4b50 | JavaScript | Gunjan6788/Todo-Application | /todo/src/Redux/Todo/todoreducer.js | UTF-8 | 2,593 | 2.578125 | 3 | [] | no_license | import {
ADD_TODO,
EDIT_ITEM,
DEL_ITEM,
CHECK_BOX,
CLEAR_COMPLETE_TASK
} from "./actionTypes";
import { getData } from "../../LocalStorage/LocalStorage";
import { saveData } from "../../LocalStorage/LocalStorage";
const initState = {
todoArr: getData("todoArr") || [],
cartArr: getData("cart... | true |
e92eebe7830b9ba50fd79249f1c4adc4e95ca5b1 | JavaScript | thomasyxy/v-preview | /utils/imageLoaded.js | UTF-8 | 309 | 2.6875 | 3 | [] | no_license | export default function imageLoaded (selector, onload) {
let img = new Image()
let dom = document.querySelector(selector)
img.onload = function () {
//real_width,real_height
onload.call(dom, this.width, this.height)
img.onload = null
img = null
}
img.src = dom.getAttribute('src')
}
| true |
f393a28003a4576632adad0ce9937b193bdeb1f7 | JavaScript | YiTaChen/node-practice | /learning_code/01/09-簡單的模塊化_js讀取不同的js檔案/a.js | UTF-8 | 397 | 3.140625 | 3 | [] | no_license |
var foo = 'aaa'
console.log('a start')
console.log('a var foo = ', foo)
console.log('a use require b.js')
require('./b.js')
console.log('now back to a')
console.log('a foo = ', foo)
// 使用反引號 可以在console 直接換行
console.log(`so in node 沒有全域變數
相同 foo 只作用與自己內部
命名相同的 foo 原來的也不會被更動
`)
console.log('a end')
| true |
5d6c8439b89215d0bbbc2f5a224688e080db7b75 | JavaScript | FlorenceSoudain/exo-commentaires | /script.js | UTF-8 | 498 | 2.9375 | 3 | [] | no_license | function ajaxRequest()
{
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var obj = JSON.parse(this.responseText);
document.getElementById('message').innerHTML = this.responseText;
console.lo... | true |
52c1838cfcfc5888ec59fa4aa275dad97f123154 | JavaScript | newmediaclub/newmediaclub-site | /src/drawing.js | UTF-8 | 1,907 | 2.953125 | 3 | [] | permissive | let penSize = 100;
let penState = 0;
let drawings = [];
let colors = ["240,83,90","220,30,100","4,84,98","0,24,100","14,73,100","43,61,100","158,100,76"];
let color;
let colornum;
let introdraw = false;
function setup(){
var element = document.getElementById('drawing-canvas');
var positionInfo = element.getBou... | true |
5ddf3fae3b8a24d2218404e8f6594909ce9a50b4 | JavaScript | paullewallencom/javascript-0-470526-91-2 | /ch16/jsb-16-01.js | UTF-8 | 1,607 | 3.8125 | 4 | [] | no_license | // initialize when the page has loaded
addEvent(window, 'load', initialize);
function initialize()
{
// do this only if the browser can handle DOM methods
if (document.getElementsById)
{
// point to critical elements
var oButton = document.getElementsById('dollars');
var oEntry = doc... | true |
969e5768342048290a5600ba7a0553bde238a6f7 | JavaScript | manhdg98/Jstutorial | /toantunew.js | UTF-8 | 295 | 3.265625 | 3 | [
"MIT"
] | permissive | var mouse = {
weight : 0.2,
getHeight : function() {
return this.weight;
}
};
function Mouse(color) {
this.type = 'mouse';
this.color = color;
this.weight = 0.2;
}
var mouse1 = new Mouse('white');
var mouse2 = new Mouse('black');
console.log(mouse1);
console.log(mouse2); | true |
279382698e31fbeefe7537c67e6982a09c0ac3d3 | JavaScript | BilyanaBorislavova/JS-Core | /JS Fundamentals/Control-Flow Logic - Lab/10. Chess Board.js | UTF-8 | 479 | 3.40625 | 3 | [] | no_license | function chessBoard(num) {
console.log("<div class=\"chessboard\">");
for (var i = 1; i <= num; i++) {
console.log(" <div>");
for (var j = 1; j < num; j++) {
if(i + j % 2 == 0){
console.log(" <span class=\"black\"></span>");
}else{
c... | true |
e962deeeb6107f93216b9601d348f1a43ea35c1e | JavaScript | mateuszpytlak/sitOnChair | /app/app.js | UTF-8 | 8,102 | 2.515625 | 3 | [] | no_license | function init() {
// -------------------DROP DOWN MENU
const liFirma = document.querySelector('.firma');
const liGaleria = document.querySelector('.galeria');
const liKontakt = document.querySelector('.kontakt');
const ulFirmaDropdown = liFirma.querySelector('.dropdown');
const ulGaleriaDropdo... | true |
7a8cb4e5affb4bfe9c2e6e77eed8786a0b75c9c4 | JavaScript | Olanetsoft/30DaysOfCode | /Day12/Task12.js | UTF-8 | 926 | 4.4375 | 4 | [] | no_license | //the pagrams function below
function thePangramsFunction(str) {
//Declare the whole alphabets
var alphabets = "abcdefghijklmnopqrstuvwxyz";
//match all whitespace, not just the first.
var theRegex = /\s/g;
//convert all to lower case then replace theRegex with nothing
var lowercase = str.toL... | true |
7ee029cbad7ffb380cba0431fc02d89f08fce75e | JavaScript | zzetao/react-use-reach-bottom | /example/src/App.jsx | UTF-8 | 1,391 | 2.71875 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect, useRef, useCallback } from 'react'
import useReachBottom from 'react-use-reach-bottom'
function getRandomList(num = 20) {
return new Array(num).fill(0)
}
export default function App() {
const [ list, setList ] = useState([])
const [ loading, setLoading ] = useState(false)
... | true |
145b43a620766aa8ef9e25e193c5ae3b3d86db96 | JavaScript | pipi-sour/Procon2017_Associator | /1回戦第3試合/script.js | UTF-8 | 2,948 | 2.96875 | 3 | [] | no_license | window.onload = function() {
var x = document.getElementsByClassName("pNumber");
var y = document.getElementsByClassName("points");
for(var i = 0; i < y.length; i++) {
x[i].style.fontSize = "24px";
y[i].style.display = "none";
changeBgColor(y[i]);
}
};
function changeBgColor(target) {
if(target.i... | true |
100f7b43cfcd5218b8e2c64ed9d416cd5fe64b99 | JavaScript | fullstackcardboard/site | /cards/scripts/views/cardView.js | UTF-8 | 3,053 | 2.75 | 3 | [] | no_license | import CardTemplateFactory from "../templates/cardTemplateFactory.js";
const cardTemplateFactory = new CardTemplateFactory();
export default class CardView {
get currentCardContainer() {
return document.getElementById("currentCard");
}
get nextCardContainer() {
return document.getElementById("nextCard"... | true |
f39731277475948ce3e68a367241d50ef550782c | JavaScript | EvgeniyLifantiy/Vue-Weather-App | /src/lib/Api.js | UTF-8 | 1,082 | 3.21875 | 3 | [] | no_license |
class Forecast {
constructor (MinTemp, MaxTemp, Description, Day, Icon) {
this.MinTemp = MinTemp
this.MaxTemp = MaxTemp
this.Description = Description
this.Day = Day
this.Icon = Icon
}
}
const forecast = []
showForecast('Moscow')
function showForecast (City) {
fetch('http:/... | true |
bf562cdb2e6b9a30564dd08eb544f2608d016f96 | JavaScript | EIVE/leetcode | /easy/67.add-binary.js | UTF-8 | 881 | 3.765625 | 4 | [] | no_license | /*
* @lc app=leetcode id=67 lang=javascript
*
* [67] Add Binary
*/
/**
* @param {string} a
* @param {string} b
* @return {string}
*/
var addBinary = function(a, b) {
// 将字符串转数组,反转,进位计算
let aArr = a.split('').reverse();
let bArr = b.split('').reverse();
let MaxLen = Math.max(aArr.length, bArr.len... | true |
ab5827f05849a7d8c2110753e950319d003ca9ab | JavaScript | nulvinge/delest-frontend | /js13kpwa/app.js | UTF-8 | 8,030 | 2.65625 | 3 | [
"CC0-1.0"
] | permissive | let parser = {};
// Generating content based on the template
const template = `<article>
<h3>AUTHOR GROUP</h3>
<span class="date">DATE</span>
TEXT
MEDIA
CHILDS
</article>`;
const mediaTemplate = `<img width='WIDTH' height='HEIGHT' src='data/img/placeholder.png' data-src='' style="background-color:COLOR;" >`
... | true |
0c923655a0f5b945d97d9bfbef1f8f7dec6f7eb3 | JavaScript | akarithedev/Minera | /commands/moderation/unlock.js | UTF-8 | 726 | 2.640625 | 3 | [
"MIT"
] | permissive | const djs = require('discord.js')
const color = 'BLACK';
module.exports = {
name: 'unlock',
category: 'moderation',
description: 'Un-locks the locked channel',
aliases: ['unlockchannel', 'ulchannel'],
run: async(client, message, args) => {
if(!message.member.hasPermission('MANAGE_CHANNELS')) return messa... | true |
660b5b960e3721a5159c09a95abcb69dc817c3a1 | JavaScript | RicePavel/news | /app/components/Main.jsx | UTF-8 | 296 | 2.5625 | 3 | [] | no_license | var React = require("react");
class Main extends React.Component {
constructor(props) {
super(props);
this.message = 'Hello world!';
}
render() {
return (
<div>
<h1>{this.message}</h1>
</div>);
}
}
export {Main};
| true |
ebee1c92cd72c4ac92e1b9681b62e72ead083ad1 | JavaScript | chanhpm/chapycard | /Code/chapycard/themes/bootstrap/views/layouts/js/global.js | UTF-8 | 184 | 2.5625 | 3 | [
"MIT"
] | permissive | (function(){
var nav = $('.navbar');
$(window).on('scroll', function(e){
if ($(window).scrollTop() > 50)
nav.addClass('sticky');
else
nav.removeClass('sticky');
})
})(); | true |
e80f41fa1361e8f26a0defc325ca41416c592f8c | JavaScript | carlosvillu/partytown-trucho | /web-worker.js | UTF-8 | 747 | 3.359375 | 3 | [] | no_license | self.document = {
getElementById(id) {
const QUERY = `document.getElementById("${id}").innerText`
// 2) Enviamos al Service Worker la información
const xhr = new XMLHttpRequest();
xhr.open('post', '/__MAIN_THREAD__', false ) // La magia está en hacer SINCRONA esta petición AJAX
xhr.send(QUERY) /... | true |
1b9db56814e47674c7271479b8cc8b8b3f502ab0 | JavaScript | ValeriiVasin/algorithms | /hackerrank/problems/2s-complement/index.js | UTF-8 | 2,151 | 3.4375 | 3 | [] | no_license | 'use strict'
// https://www.hackerrank.com/challenges/2s-complement
import { read } from '../../lib/read';
const solve = (reader) => {
const T = reader.readNumber();
let ranges = [];
for (let i = 0; i < T; i++) {
let [start, end] = reader.readNumbers(2);
// ranges.push({ start, end });
console.log... | true |
f3d4d2d72e8ae6340a55d628782a68877f149d8e | JavaScript | coveyz/pokemon | /简单/58.移除函数.js | UTF-8 | 608 | 4.3125 | 4 | [] | no_license | const question = `给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素`;
const removeElement = (nums, val) => {
for (let index = 0; index < nums.length; index++) {
if (nums[index] === val) {
nums.splice(index, 1);
index--;
}
}
... | true |
c1394eab831addd47b9f7ab1ef92850d853e031c | JavaScript | lizamihalevich/itechart-native-js | /libs/reduce.js | UTF-8 | 404 | 2.953125 | 3 | [] | no_license | const reduce = (arr, callback, initialVal) => {
if (!Array.isArray(arr)) {
throw new Error('You should pass an array');
}
let accumulator = initialVal;
for (const [index, value] of Object.entries(arr)) {
if (!accumulator) {
accumulator = value;
} else {
accumulator = callback(accumulat... | true |
3434127a0ea57eb9c32a57018deadfc0b58e8598 | JavaScript | kzachos/RiskHuntingAppTest | /RiskHuntingAppTest/JavaScript/wink/fx/_animation/js/animation.js | UTF-8 | 22,672 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive | /*--------------------------------------------------------
* Copyright © 2009 – 2010* France Telecom
* This software is distributed under the "Simplified BSD license",
* the text of which is available at http://www.winktoolkit.org/licence.txt
* or see the "license.txt" file for more details.
*----------------... | true |
e2182dd1a303a6b5a5a727c4e5e073c58cd6b673 | JavaScript | MontessoriX/Rome | /src/test/command/comment.test.js | UTF-8 | 1,607 | 2.5625 | 3 | [] | no_license | import webdriver, { Key } from 'selenium-webdriver';
import TestConfig from '../TestConfig';
const testCommentBetweenLines = 'test comment in between lines';
describe('test write string', () => {
let driver;
beforeAll(async () => {
driver = new webdriver.Builder().withCapabilities(TestConfig.CAPABILITIES).bu... | true |
f234fc2712adf048694d40a2850c71d73a15a0d6 | JavaScript | manikumarkv/reacrSession | /src/day6/User.js | UTF-8 | 931 | 2.515625 | 3 | [] | no_license | import React from "react";
class User extends React.Component {
constructor(props) {
super(props)
console.log('constructor')
this.data = []
this.x = 12
}
componentWillMount() {
console.log('before render')
// this.data = getUsers()
// const d =thi... | true |
7cf793c4bb8dfe7a8162a33dcee6d8348f7e8d4a | JavaScript | ArkayaVenture/earthquake-latest-earthquakes | /src/htdocs/js/mvc/ModalView.js | UTF-8 | 7,272 | 2.640625 | 3 | [
"LicenseRef-scancode-public-domain-disclaimer"
] | permissive | /**
* Generic class for modal dialog views. Modal dialogs present a blocking
* interface to the user and require user-interaction in order to be closed
* (i.e. clicking a button etc...).
*
* It is important to note that while the interface appears blocked while a
* modal dialog is open, Javascript continues to ex... | true |
90b24102123f98a369c99d7fe327ecd08c7de931 | JavaScript | JCGrant/Whitman | /src/main.js | UTF-8 | 1,107 | 2.875 | 3 | [] | no_license | import React from 'react';
import { render } from 'react-dom';
import adjectives from './adjectives';
import adverbs from './adverbs';
import nouns from './nouns';
import verbs from './verbs';
import structures from './structures';
const TYPES_MAP = {
'/adjective': adjectives,
'/adverb': adverbs,
'/noun': noun... | true |
e6a7b1804410e110cd99309d960ea52fd52ec4c2 | JavaScript | EvanKerr90/github-avatar-downloader | /download_avatars.js | UTF-8 | 1,755 | 2.984375 | 3 | [] | no_license | var request = require('request');
var fs = require('fs');
var authorization = require('./secrets.js');
var owner = process.argv.slice(2,3);
var repo = process.argv.slice(3);
console.log('Welcome to the GitHub Avatar Downloader!');
//sets the url to be queried and the user information needed to access github api.
func... | true |
2b4a53d9e245f160a38e89e6a0f22d326513c1d8 | JavaScript | joncoop/rgb-color-sliders | /rgb-sliders.js | UTF-8 | 1,412 | 3.125 | 3 | [] | no_license | function update() {
r = document.getElementById("red").value;
g = document.getElementById("green").value;
b = document.getElementById("blue").value;
rgb = "rgb(" + r + "," + g + "," + b + ")";
document.getElementById("decimal-red").innerHTML = r;
document.getElementById("de... | true |
6c6990867e6701593729773fb696d8e810edb4fc | JavaScript | PaolaMBIA/gom-jabbar | /schitts/Paola_test_projet/client/src/pages/Statistic.js | UTF-8 | 7,171 | 2.578125 | 3 | [] | no_license | import React, { useState } from 'react';
import axios from 'axios';
import CanvasJSReact from '../assets/canvasjs.react';
import {StyleStatistic } from '../styles/styled-components/StyleStatistic';
//var CanvasJSReact = require('./canvasjs.react');
let CanvasJS = CanvasJSReact.CanvasJS;
let CanvasJSChart = CanvasJSRe... | true |
2f1e742b3ed427f0f1631aeac1e1122070150251 | JavaScript | kuttyselva/ecom | /src/redux/cart/cart.util.js | UTF-8 | 737 | 2.890625 | 3 | [] | no_license | export const addItemToCart = (cartItems, cartAdd) => {
const existing = cartItems.find(cartItem => cartItem.id === cartAdd.id);
if (existing) {
return cartItems.map(citem =>
citem.id === cartAdd.id ? { ...citem, quantity: citem.quantity + 1 } : citem
);
}
return [...cartItems... | true |
7f950aa2a79c85f14ab04668ae93676132398d2f | JavaScript | sam1rm/intentify | /content.js | UTF-8 | 618 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var storedHref = window.location.href;
if (window.location.href.indexOf("facebook") != -1) {
window.setInterval(function() {
if (window.location.href != storedHref) {
storedHref = window.location.href;
if (storedHref.indexOf("photo.php") != -1) {
var photoUrl = $... | true |
0feb24ae1fafcd0a2df81a661501c0ae4c8ed2de | JavaScript | glow2590/Node-yelpcamp | /seed/index.js | UTF-8 | 2,467 | 2.515625 | 3 | [] | no_license | //PACKAGES and requires
const mongoose = require('mongoose');
const cities = require('./cities')
const {places,descriptors}=require('./seedhelpers');
const methodOverride = require('method-override')
const Campground=require('../models/campground');
//CONNECTIONS
mongoose.connect('mongodb://localhost:27017/yelpCamp',... | true |
a452a4af040d509d3002d13c49f0ee7e98f47f23 | JavaScript | sidpillai91/sidpillai91.github.io | /palettess/user_data/packages/default/js/itembox.js | UTF-8 | 561 | 2.640625 | 3 | [] | no_license | function itemOn(nGoodsID,itemNum) {
var arrColor = new Array('#EEEEEE','#EEEEEE','#EEEEEE','#EEEEEE','#EEEEEE','#EEEEEE');
document.getElementById('item-box'+nGoodsID).style.backgroundColor = arrColor[itemNum];
//document.getElementById('item-box-price'+nGoodsID).style.backgroundColor = '#FFFFFF';
}
function it... | true |
1af923022f582c3b0e68a59b3a9fd9a21188fe7b | JavaScript | struanking/components | /src/utils/index.js | UTF-8 | 386 | 2.6875 | 3 | [] | no_license |
function withDelimiter(num) {
const tempValue = num.toString();
const delimiter = ',';
const groupLength = 3;
if (num.length <= groupLength) {
return num;
}
return tempValue
.split('')
.reverse()
.map((n, index) => {
return index && index % groupLength === 0 ? n + delimiter : n;
... | true |
2e981d2ca6a8d561467d5b3e03f455947330c5ed | JavaScript | tcolejimenez/codeup-web-exercises | /js/extras-8-15.js | UTF-8 | 921 | 4.125 | 4 | [] | no_license |
var longestWord = function(sentence) {
var words = sentence.split(" ");
var longestWord = 0;
for (var i = 0; i < words.length; i++) {
if (words[i].length > longestWord) {
longestWord = words[i].length;
}
}
return longestWord;
}
var test = prompt("Please enter a sent... | true |
ff9eb2fc0c9776bf6c94db297de754b3210fe651 | JavaScript | davidfernandoza/paiven | /public/js/ipCountry.js | UTF-8 | 782 | 2.75 | 3 | [] | no_license | class IpCountry {
getCountry (){
return new Promise(resolve => {
// Optener ip:
this.getIp().then(getDataCountry).catch(sendError)
// Optener pais por su IP:
function getDataCountry(ip) {
$.getJSON(`https://ipapi.co/${ip}/json/`)
.done(sendCountry)
.fail(sendError)
}
function sendCo... | true |
5c131cc1f9ed06f3aaafde3297747936d204e324 | JavaScript | MichalStajerski/Projekt | /Print/level2/script.js | UTF-8 | 1,103 | 3.5625 | 4 | [] | no_license | const upperLimit = 100
const select = document.getElementById('mySelect')
let lowerLimit = 1
function countForwardsByOneIteration () {
for (let i = 0; i < 1; i++) {
if (lowerLimit <= upperLimit) {
const option = document.createElement('option')
if (modulo(lowerLimit, 3) == 0 && modulo(lowerLimit, 5) ... | true |
5669b10e13c2bd1e86cc46b1a51644e3015219f2 | JavaScript | Simon-Li/yisouApp | /www/lib/main.js | UTF-8 | 518 | 3.265625 | 3 | [] | no_license | import _ from 'lodash';
class q {
constructor() {
this.es6 = 'Hello world! ES6';
this.test = t => console.log(t);
}
}
export function bootstrap() {
// bootstrap code here.
let t = new q();
console.log(t.es6);
t.test("Hello my first ES6 APP!");
let s = new Set();
s.add(1);
s.add(2);
s.add(3);
... | true |
4755eb438132e1e714de3447cf1d8a6f0776e310 | JavaScript | WongueShin/JsStudy | /nativeJS/brad_Go/momentum/js/background.js | UTF-8 | 706 | 3.625 | 4 | [] | no_license | // img 폴더 안에 있는 이미지 이름들과 동일하게 배열의 index값을 작성
const images = ["0.jpg", "1.jpg", "2.jpg"];
// index값을 random하게 줘서 변수에 저장
const chosenImage = images[Math.floor(Math.random() * images.length)];
// 새로운 이미지 태그를 생성해서 소스를 설정하고 body의 끝에 img태그 붙여넣기
// js에서 html 요소를 생성!!
// const bgImage = document.createElement("img");... | true |
57771d2197010b9fa3150cd80fb2b21eb3999b6a | JavaScript | calliePepper/The-man-next-door | /public/script/glitch.js | UTF-8 | 6,448 | 2.703125 | 3 | [] | no_license | function glitchThis(targetImage) {
$('.staticOverlay').addClass('showStatic');
console.log(' SON OF A GLITCH ');
$('body').prepend('<audio id="whispers" src="sounds/whispers.mp3" volume="0.2"></audio>');
$('#whispers').prop('volume',0.06);
var audioEl = document.getElementById('whispers');
var c... | true |
30e530c360fa6be8118b5b72d28d390e2245c5af | JavaScript | oliverpdahl/spaced-repetition | /spaced-repetition-frontend/index.js | UTF-8 | 7,430 | 3.078125 | 3 | [
"MIT"
] | permissive | const BASE_URL = "http://localhost:3000"
const MEMORIES_URL = `${BASE_URL}/memories`
const memoryContainer = document.getElementById('memory-cards')
const newMemoryForm = document.getElementById('new-memory-form')
class Memory {
constructor(id, title, category, strategy, startDate){
this.id = id,
this.title ... | true |
ba6bc3c18bfa3c640a01931f8496aaf3fa326533 | JavaScript | gamboagirl/Work_AEMM_Cordova | /js/geolocation.js | UTF-8 | 1,740 | 3.046875 | 3 | [] | no_license | /* ********************************************************
Geolocation
**********************************************************/
function geolocationInfo() {
navigator.geolocation.getCurrentPosition(geolocationSuccess,
geolocationError);
}
function geolocationSuccess(position) {
var latitude = po... | true |
d322ed017cef952dd35de45806a82c00f8100578 | JavaScript | quinhill/quinlan-hill-site | /src/Nav/Nav.js | UTF-8 | 1,127 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import './nav.css';
class Nav extends Component {
constructor() {
super()
this.state = {
bio: 'active',
projects: '',
resume: '',
}
}
toDisplay = (event) => {
const id = event.target.id;
this.props.toDisplay(id);
this.setActive... | true |
fdffde0d5b1500546a57a5721be5517b62e42d08 | JavaScript | srogersact/srogersact.github.io | /tutorials-v4/commas_v1/problems.js | UTF-8 | 6,990 | 2.6875 | 3 | [
"MIT"
] | permissive | var analysis_problems = [
{
analyzedSentence: 'The history of ancient Egyptian civilization began in 3200. It lasted for thirty centuries.',
composedSentence: 'The history of ancient Egyptian civilization began in 3200 and lasted for thirty centuries.',
},
{
analyzedSentence: 'The Nile River flooded every year. It depo... | true |
d9a6fbeadc09ed05bd2ef18979352d9c6de75c5f | JavaScript | 7more0/MyNote | /Functions/dialog.js | UTF-8 | 1,864 | 2.859375 | 3 | [] | no_license | //process dialog form format
function hide_dialog(id) {
//hide dialog form
var obj = document.getElementById(id);
obj.style.display = "none";
obj.style.position='absolute';
}
function show_dialog(id, width, height) {
//show object with input id.
var obj = document.getElementById(id);
var wi... | true |
1b4a4ef7762f0c2e72d475512535c9a320297e5f | JavaScript | jbrasko2/sort-table-practice | /api/api.js | UTF-8 | 603 | 2.640625 | 3 | [] | no_license | import { camelizeKeys } from 'humps'
// A lightweight wrapper around the Fetch API (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
async function fetchWrapper(url, options, config) {
const { camelizeBody } = config
const response = await fetch(url, options)
const data = await response.json()
if (... | true |
a97e4d58c9d3aead05504af6026180641526cb98 | JavaScript | yakoup46/cartel | /assets/functional.js | UTF-8 | 1,602 | 2.515625 | 3 | [
"MIT"
] | permissive | var fun, socket;
$(function(){
socket = io('http://cartel:1337');
fun = $.functional();
});
(function($,f){
if(!$) return false; //no jQuery
var Functional = function(){
var _ = this;
this.board = ini.board;
this.players = ini.players;
this.init = function(){
... | true |
83481fc5f48ab7b12651855ab69182f080d67942 | JavaScript | westleft/SunFlower_3DCard | /all.js | UTF-8 | 1,777 | 2.890625 | 3 | [] | no_license | const container = document.querySelector('.container');
const card = document.querySelector('.card');
const post = document.querySelector('.post');
const img = document.querySelector('.img_box');
const title = document.querySelector('.title');
container.addEventListener('mousemove', function(e){
//定義旋轉角度
l... | true |
9050a092a3a7f228f7736c30829fd3c5be13eccd | JavaScript | cyio/leetcode-javascript | /5.最长回文子串.js | UTF-8 | 402 | 3.1875 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=5 lang=javascript
*
* [5] 最长回文子串
*/
// @lc code=start
/**
* @param {string} s
* @return {string}
*/
var longestPalindrome = function(s) {
let res = null
let l = 0
let r = 0
let i = 0
while(i < s.length){
let cur = s.substr(l, r + 1)
if (isPal(cur) && cur.length > re... | true |
3c2fdcf5d9ad1aef55783d98a45cc5689b46a1c3 | JavaScript | gd602546628/qjg | /src/service/localStorage/localStorage.service.js | UTF-8 | 1,145 | 2.703125 | 3 | [] | no_license | /**
* Created by gd on 2017/6/13/013.
*/
class LocalStorageUtil {
storage = {}
setStorage(key, value) {
let data = this.storage
if (localStorage) {
data = localStorage
}
if (typeof value === 'string') {
data[key] = value
} else {
data[key] = value ? JSON.stringify(value) : n... | true |
314af5fceb25996525ee2c8101d95d9539799b26 | JavaScript | piique/LowStore | /backend/tests/tests.js | UTF-8 | 2,555 | 2.875 | 3 | [] | no_license | const express = require("express");
const bodyParser = require("body-parser");
const fs = require("fs");
const obj = require("./teste.json");
const server = express();
server.use(express.json());
const users = [
"Pedro",
"Luis",
"Tulio",
"Joao",
"Walter",
"Bleme",
"Anna",
"Andrew"
];
// Middleware glo... | true |
c5c114dd4411792aa490ce58c8827d9fe9b23620 | JavaScript | elu206/CreativeCoding_Project_1_Utter | /project_1/sketch.js | UTF-8 | 7,733 | 3.109375 | 3 | [] | no_license | flames = []
smoke = []
// explosions = []
let reappear = -600 // moving new match into the picture
let disappear = 0 //moving burnt match out of the picture
let burnlength = 0 //burning the match
let movedown = 0 //fire going down match
let counter = 0 //timer
let noiseMax = 200 //noise
let zoffset = 0; //perlin noise... | true |
7ad823a19e792ad36bdf6bac99baf5d1a0bf45a7 | JavaScript | davidgoen/Curso_Babel | /JSWEB/Basico/app/main.js | UTF-8 | 1,421 | 3.53125 | 4 | [] | no_license |
/*Cuando hay errores del this pork cambia su valor se puede utilizar el metodo
.bind(this) y ejecutaria el metodo que sea, lo de antes del punto del objeto this pasado
document.querySelectorAll("#btnRegistrar")[0].addEventListener("click",this.btnRegistrar.bind(this),false)
quiere decir que cuando encuentre un... | true |
45731c63ffa98a496917ea5059a4367edc5c28b9 | JavaScript | maksimpetrov55/maksimpetrov55.github.io | /stolica/js/scripts.js | UTF-8 | 11,487 | 2.671875 | 3 | [] | no_license | $(document).ready(function() {
$('.calc__hover').click(function(){
$('.calc__info').addClass("calc__info--show");
});
$('.calc__info--close').click(function(){
$('.calc__info').removeClass("calc__info--show");
});
$("#polzunok").slider({
animate: "slow",
range: "min",
value: 50,
step: 10,
min: 10,... | true |
0f873a7597d5a9ff5bc45ac0061e1f656141cfa1 | JavaScript | MinhKhangTran/react-self-tours-tailwind | /src/App.js | UTF-8 | 1,177 | 2.703125 | 3 | [] | no_license | import React from "react";
import Loading from "./Loading";
import Tours from "./Tours";
const url = "https://course-api.netlify.app/api/react-tours-project";
export default function App() {
const [tours, setTours] = React.useState([]);
const [loading, setLoading] = React.useState(true);
const removeTour = (id) ... | true |
1f762f81f179750b7c449e89bec15c5572e0cca3 | JavaScript | Thaerious/moodle-julia | /challenges/test.js | UTF-8 | 548 | 3.828125 | 4 | [] | no_license | var removeDuplicates = function(nums) {
let leftIndex = 0;
let rightIndex = 1;
console.log(leftIndex);
console.log(rightIndex);
while (rightIndex <= nums.length){
console.log(leftIndex + ", " + rightIndex);
console.log(nums);
if (nums[leftIndex] == nums[rightIndex]){
... | true |
9d1d63d97aa325fdc72a5f986ec54cf09e7cdb25 | JavaScript | ttalessoft/node-modulo-01 | /index.js | UTF-8 | 1,202 | 3.109375 | 3 | [] | no_license | var express = require('express');
var server = express();
server.use(express.json());
// Query params = ?firstName=joao
// Route params = /users/1
// Request body = { "name": "João", "email":"joao@emaildele.com.br"}
const users = ['joaozinho', 'luizinho', 'maria', 'mariana', 'bruna'];
// midlleware
server.use((req... | true |
c611eea859577bad87aa75a4e305516f66ad4ad9 | JavaScript | lizhanyi/tools | /src/lib/watermark/index.js | UTF-8 | 2,205 | 3.046875 | 3 | [] | no_license | /**
* 水印工具类
* @dec 通过 canvass 实现 水印效果
*/
import { dom } from 'dom';
import defaultOpt from './conf'; // 默认配置项
export default class Watermark {
constructor( options ){
// 合并配置项
const pad = { ...defaultOpt.pad, ...options.pad }
this.options = { ...defaultOpt, ...options, pad }
}
/**
* 功能:获取文案... | true |
d7e6f56589f1dab7eef82db054c913be5d03779c | JavaScript | pratikmakune3/Functional-Programming-JS | /Ch02/02_03/Start/examples.js | UTF-8 | 450 | 3.765625 | 4 | [] | no_license | const double = (x) => x * 2;
const subtractOne = (x) => x - 1;
const triple = (x) => x * 3;
const add5 = (x) => x + 5;
const functionArray = [double, subtractOne, triple, add5, Math.sqrt];
let number = 42;
const applyMathFunctions = (number) => {
functionArray.forEach((fun) => {
number = fun(number);
});
r... | true |
c6aa3726a697413305a059af09e0571a7c3e99d2 | JavaScript | GeorgeAgabon/IT2320-GeorgeAgabon-Fall2018 | /Week 8 Lab 8/home.js | UTF-8 | 3,079 | 2.90625 | 3 | [] | no_license | $(function(){
//$("#wrapperSection1") will be used as a frame of reference
//parent()
//parents()
//find()
//siblings() // examples are sections
//children()
$("#btn1").on("click",function(){
console.log($("#wrapperSection1").parent().attr("id"));
$("#wrapperSec... | true |
5456dcc1716437e28f0759a7b4b9cfe0ff62f3e0 | JavaScript | thegunner686/psychlearningexperiment | /public/scripts/Components/SubmitButton.js | UTF-8 | 602 | 2.59375 | 3 | [] | no_license | import React from "react";
export default class SubmitButton extends React.Component {
constructor() {
super();
let id = "k" + Math.floor(Math.random() * 1000000) + "-" + Math.floor(Math.random() * 1000);
this.class = "submitbutton " + id;
}
componentDidMount() {
let butt... | true |
63de70ce579767831e8d956c3889dc2da9907b12 | JavaScript | m24927605/javascript_algorithm | /bubble_sort.js | UTF-8 | 602 | 3.375 | 3 | [] | no_license | const {isSorted}=require('./utils');
function bubbleSort(arr){
let compareCount=arr.length;
//We don't need to compare the last item because the last two element has been compared and changed in the last second time.
while(compareCount-1>0){
compareCount--;
for(let i=0;i<compareCount;i++){
//If the... | true |
ce1bf0941833522806ded9acc46e92311f18da40 | JavaScript | joshsuson/joshsuson-frontend | /src/components/FactGenerator.js | UTF-8 | 1,385 | 2.734375 | 3 | [
"0BSD"
] | permissive | import React, { useState, useEffect } from "react"
import { useStaticQuery, graphql } from "gatsby"
export default function FactGenerator() {
const [fact, setFact] = useState("Click the button to see a random fact")
const [facts, setFacts] = useState([])
const data = useStaticQuery(graphql`
{
allSanity... | true |
9e9b76109de3e05461d2718b4b22da7cfa32c69e | JavaScript | MROS/todolist-react | /src/todo.jsx | UTF-8 | 4,952 | 2.84375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import { List, Map } from 'immutable';
class TodoApp extends React.Component {
constructor(props) {
super(props);
this.changeFilter = this.changeFilter.bind(this);
this.newItemChange = this.newItemChange.bind(this);
this.newItemEnter = this... | true |
8c537e24e77f598db2f0412a4b8415eca0ec0337 | JavaScript | 1better/mypractice | /第一阶段/shixi28/归并排序.js | UTF-8 | 527 | 3.65625 | 4 | [] | no_license | function mergeSort(arr) {
let len = arr.length
if(len == 1) {
return arr
} else {
let mid = Math.floor(len/2)
let left = arr.slice(0,mid)
let right = arr.slice(mid)
return merge(mergeSort(left),mergeSort(right))
}
}
function merge(left,right) {
var all = []
while(left.length>0&&right.le... | true |