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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
126abdcf4e8ee94590ab6af35f7a82cea7e11f01 | JavaScript | mukeshcgs/p5 | /app/index.js | UTF-8 | 4,350 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* Application entry point
*/
// Load application styles
import "styles/index.scss";
import p5 from "p5";
import dat from "dat.gui";
import Stats from "stats-js";
import { hexagon, hexagonLine, squareLine } from './helper'
// import { Layers, Circle } from './Layers'
// ================================
// START Y... | true |
851a0b4b5cff5ad44e2cbfd04622842bbd71d153 | JavaScript | nina-stoyanova/js_basics_softuni_exersices | /nestedLoops/sumOfTwoNumbers.js | UTF-8 | 770 | 4.375 | 4 | [] | no_license | function sumOfTwoNumbers(array) {
let firstNumber = Number(array.shift());//1
let secondNumber = Number(array.shift());//10
let magicNumber = Number(array.shift());//5
let count = 0;
let flag = "equals";
for (let i = firstNumber; i <= secondNumber; i++) {
for (let j = firstNumber; j <... | true |
1953ad8b6ec60455dd2b17464032b4e80233030a | JavaScript | fossabot/Donate-Anything | /donate_anything/static/js/organization/suggestion_sidebar.js | UTF-8 | 2,936 | 2.515625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | $("#menu-toggle").click(function(e) {
e.preventDefault();
$("#full-body-wrapper").toggleClass("toggled");
});
function add_to_sidebar(edit_id, username, edit, created, updated) {
let converter = new showdown.Converter();
converter.setFlavor('github');
let date;
if (created === updated) {
... | true |
25b85d2042683170b22d9373a60de9770106afe3 | JavaScript | bbasinsk/info445project | /client/info445client/src/CreateCustomer.js | UTF-8 | 2,691 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Card, CardContent, Button, TextField } from '@material-ui/core';
class CreateCustomer extends Component {
constructor(props) {
super(props);
this.state = {
form: false,
firstName: '',
lastName: '',
email: '',
phone: ''
};
}
async createCustom... | true |
6291fb5a984b105ec765351e01abf43a1bc0dcef | JavaScript | nikhiltri/aicdams-lakeshore | /app/assets/javascripts/lakeshore/deleted_files.es6 | UTF-8 | 362 | 2.515625 | 3 | [] | no_license | export class DeletedFiles {
// Monitors the form and runs the callback if the delete button in the fileupload is clicked
constructor(form, callback) {
this.form = form
$('#fileupload').on('click', '.delete', callback)
}
get lastFile() {
let fileField = this.form.find('input[name="uploaded_files[]"]... | true |
ff44835fc64b73e14fa288ac5f4741f0c9576a29 | JavaScript | fadlytanjung/dilo-meetup-with-react | /src/pages/Home/Home.js | UTF-8 | 3,788 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import styles from './styles.module.css';
import ListItem from '../../components/ListItem';
import InputTodos from '../../components/InputTodos';
class Home extends Component {
constructor(props){
super(props);
this.state = {
isOpen: [false,false,false],
... | true |
ac2d5ebf5b4c9479bff6510b423b8a3533de1bba | JavaScript | mihai-scurtu/partycles | /js/Force.js | UTF-8 | 329 | 3.390625 | 3 | [] | no_license | function Force(x, y) {
this.x = x;
this.y = y;
this.applyTo = function(object, delta) {
object.x += this.x * delta;
object.y += this.y * delta;
}
}
Force.random = function(amplitude) {
var x = Math.random() * amplitude - amplitude / 2;
var y = Math.random() * amplitude - amplitude / 2;
return new Force... | true |
4995e4b0df7c309e439bfefe82d49974c21cd7c3 | JavaScript | dyutidk/session3 | /basics/myFunction.js | UTF-8 | 72 | 2.640625 | 3 | [] | no_license | function sayHii(name){
console.log("Hai "+name);
}
sayHii("Dyuthi"); | true |
1d3e08e22adf9542f1389edd7f8a1bc8c00a53ef | JavaScript | JxSx/algorithm-javascript | /src/BinaryTree/serialization.js | UTF-8 | 982 | 2.796875 | 3 | [] | no_license |
const { binaryTreeDataSource } = require('../common/data');
const TreeNode = require("../common/TreeNode");
/**
* 前序遍历实现序列化,二叉树转换为数组
* @param {*} root
* @param {*} arr
*/
function serialize(root, arr = []) {
if (!root) {
arr.push(null);
return;
}
arr.push(root.val);
serialize(roo... | true |
e25ea4f4b0b925df1b4f137114ada5048d9dd4b5 | JavaScript | stdChicken/netflix_desktop_remote | /plugin/script.js | UTF-8 | 2,974 | 2.625 | 3 | [] | no_license |
//document.body.style.border = "5px solid red";
let socket = null;
/*
fetch('https://cdn.ghacks.net/wp-content/uploads/2015/12/firefox-addon-detector.jpg', { method: 'GET' }).then(function(msg) {
console.log("test");
}).catch( function(err) {
console.log("error 3 " + err);
});
*/
function Click_Netflix... | true |
100cbe5d5f168725efec24330c1cf06b70eca8b4 | JavaScript | heeymala/Dojobox | /Day1/latihan1.js | UTF-8 | 1,355 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | /* alert("Selamat datang!");
var nama = prompt('Masukkan nama kamu : ');
document.writeln('Selamat belajar kak, ' + nama + '!' + '<br>' + '<br>'); */
var angka1 = 22;
var angka2 = 10;
document.write('Bilangan 1 : ' + angka1 + '<br>')
document.write('Bilangan 2 : ' + angka2 + '<br>' + '<br>')
document.write('... | true |
7e9148332ba88db5d38c760c3c90178e0fd91a2a | JavaScript | JustinBoydCodes/CreativeCodingHomework | /BOYD_Final Music Visualizer/sketch.js | UTF-8 | 289 | 2.671875 | 3 | [] | no_license | function setup() {
createCanvas(500, 500); //WEBGL);
img = loadImage("./data/Bubble Color.jpg")
}
function draw() {
background(0,255,255);
//rotateX(frameCount *0.01);
//rotateZ(frameCount *0.01);
fill(img);
ellipse(56, 46, 55, 55);
//texture(img);
//sphere(50,48);
} | true |
7fd5e3e277464ceab9f290cc38ee833d8e16481c | JavaScript | valvic66/website2 | /src/components/DescriptionCard/index.jsx | UTF-8 | 1,618 | 2.59375 | 3 | [] | no_license | import React from 'react'
import './index.css'
export default class extends React.Component {
constructor (props) {
super(props)
this.state = {
isLogoMouseEnter: null
}
}
titleCSS = () => {
const classes = ['description_card_title']
const {isLogoMouseEnter} = this.state
if (is... | true |
ebc0e481b48464b2cb5ffec0918668a3da938296 | JavaScript | zjt-401/wechat_shop | /view/partials/image_link/image_link.js | UTF-8 | 2,149 | 2.578125 | 3 | [] | no_license | const app = getApp();
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
data: {
type: JSON,
value: 'default value',
}
},
data: {
// 这里是一些组件内部数据
someData: {},
display:"none"
},
ready:function(){
console.log("popimage数据", this.data.data)
let that=this;
... | true |
9734dbe28e297746df3c259abcb39eb33bfadcbb | JavaScript | Zmetser/advent-of-code | /2021/js/day_5.js | UTF-8 | 1,126 | 3.03125 | 3 | [] | no_license | const path = require('path');
const fs = require('fs');
const input = fs.readFileSync(path.join(__dirname, '..', 'inputs', 'day5.txt'), { encoding: 'utf-8' })
.split('\n');
const lines = input.reduce((acc, line) => {
const [_, x1, y1, x2, y2] = line.match(/(\d+),(\d+) -> (\d+),(\d+)/)
acc.push([x1, y1, x2, y2])... | true |
eaf095eafef20890490af6d078a8c130a4b1ba99 | JavaScript | Jiasai/study-web | /nodeJS/koa2/study-koa-generator/db/test1.js | UTF-8 | 1,925 | 3.4375 | 3 | [] | no_license | //使用 model 操作 mongodb 数据
const {User} = require("./model");
//定义一个 async的匿名函数并执行。为了里面能用 await(因为创建、查询等都是异步操作)
!(async()=>{
//新增数据:方式1
const zhangsan = new User({
username:"zhangsan",
password:'abcde',
age:20,
city:"BeiJing",
gender:1
})
zhangsan.save(); //保存新增
... | true |
9581b8ab98a1cbb800bc0ed024d6fce476e33c8c | JavaScript | wbrowar/WB-Leap-Demos | /js/main.js | UTF-8 | 8,239 | 2.84375 | 3 | [] | no_license | // testing variables
var jq = jQuery;
var currentColor_enabled = 1;
var currentColor_H_enabled = 1;
var currentColor_S_enabled = 1;
var currentColor_L_enabled = 1;
var colorBGSlider_enabled = 1;
var currentColor_h = 200;
var currentColor_s = 50;
var currentColor_l = 50;
// Change "output" text
function output_log(ne... | true |
e128598670b529db89d9f1cb51190b3ded832139 | JavaScript | cyuket/native-calculator | /App.js | UTF-8 | 4,167 | 2.953125 | 3 | [] | no_license | import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
export default class App extends React.Component {
constructor() {
super()
this.state = {
resultText : "",
calculationText : ""
}
this.operations = ["DEL", "/", "*", "-","+"]
}
o... | true |
aed0df9ad1f4f6a8a063d08df61ca51a71bd9b4c | JavaScript | Max5254/a2-shortstack | /server.improved.js | UTF-8 | 4,538 | 2.921875 | 3 | [] | no_license | const http = require( 'http' ),
fs = require( 'fs' ),
// IMPORTANT: you must run `npm install` in the directory for this assignment
// to install the mime library used in the following line of code
mime = require( 'mime' ),
dir = 'public/',
port = 3000
// Load the SDK for JavaScr... | true |
b3da5001fcab2734a4a2a95826423992e159cc33 | JavaScript | ashishgopalhattimare/30DayJavaScriptChallenge | /day08.js | UTF-8 | 451 | 3.3125 | 3 | [] | no_license | // Window Scope : Is available in the Window
// Global Scope : Can be accessed every where in the same file
// Local Scope :
const Dog =
{
name : 'Flexi',
legs : 4,
color: 'black',
age : 4,
bark : function() {
return 'woof woof'
}
}
const copy = Object.assign({}, Dog)... | true |
a3dbbf42182907005ef5aca5af5cb4edb2ae45bc | JavaScript | helsten-jeff/Javascript | /examples/fns-and-arrays.js | UTF-8 | 1,036 | 3.703125 | 4 | [] | no_license | // See this working at https://codepen.io/jhelst/pen/gOYqbEZ?editors=0012
const people = [
{
name: "stan",
age: 18,
height: 63
},
{
name: "george",
age: 27,
height: 75
},
{
name: "frank",
age: 59,
height: 69
},
{
name: "suzie",
age: 22,
height: 60
}
];
co... | true |
2d85ebd810879bd1f7aa9970b0e905dc569b7566 | JavaScript | summersky92/redux_react_sample_2 | /src/actions/index.js | UTF-8 | 327 | 2.71875 | 3 | [] | no_license | //action creators
//simple functions to return an action
export function selectBook(book) {
//console.log('a book is selected:', book.title);
//selectBook is a action creator, it need to return an action
//an object must have a type property
return {
type: 'BOOK_SELECTED',
payload: book
... | true |
a427ec9224beecc5a4abbc0e8f36ab66f76b8f91 | JavaScript | RRuais/mean_login_and_registration | /client/assets/factories/usersFactory.js | UTF-8 | 982 | 2.75 | 3 | [] | no_license | app.factory('usersFactory', ['$http', function($http){
var users = [];
var UsersFactory = function(){
var _this = this;
this.login = function(data, callback){
$http.post('/login', data).then(function(returned_data){
console.log(returned_data);
callback(returned_data);
});
}
this.index = funct... | true |
edd516e8c2851f68cbdd3dd115fec239a9980e35 | JavaScript | yenbekbay/bmo-slackbot | /test/library-engine.js | UTF-8 | 2,677 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
const Lab = require('lab');
const expect = require('code').expect;
const Chance = require('chance');
const Rx = require('rx-lite');
const LibraryEngine = require('../src/library-engine');
const MockLogger = require('./utils').MockLogger;
const chance = new Chance();
const lab = exports.lab = Lab.script... | true |
b045425bfd70bb465106894800610e7955a82a55 | JavaScript | nahla-hussam/frontendmasters-advanced-state-management-in-react | /5-redux-and-react/jetsetter-undo/src/reducers/history-reducer.js | UTF-8 | 768 | 2.71875 | 3 | [] | no_license | import { UNDO, REDO } from '../constants';
export default function(state = {}, action) {
if (action.type === UNDO) {
if (!state.history.past.length) return state;
const newFuture = [state.currentState, ...state.history.future];
const [currentState, ...newPast] = state.history.past;
return {
... | true |
53b69ad7983bf626e76f4e7ce49b9b9255d3285b | JavaScript | ecmarsh/algorithms | /exercises/mergeKLists.js | UTF-8 | 2,915 | 3.828125 | 4 | [
"MIT"
] | permissive | /**
* Merge k Sorted Linked Lists
*
* Merge _k_ sorted linked lists and return it as one sorted linked list.
*
* Analyze and describe its complexity:
* Time (Divide & Conquer):
* - n is total nodes in two lists, k is total lists
* - Pair k lists merged -> k/2 lists, avg 2N/k length, then k/4, k/8, ...
* - So w... | true |
1db2a7aca983245e1aa483474cc6d7cf1725da99 | JavaScript | MohitSojitra/Artistee | /ArtisteeFrontend/src/utils/helper.js | UTF-8 | 745 | 3.140625 | 3 | [] | no_license | let capitalAlphabet = String.fromCharCode(...Array(91).keys()).slice(65);
const SearchByAlphabetAndSymbol = (str) => {
return "#" + str + "]";
};
let alphabetLetter = SearchByAlphabetAndSymbol(capitalAlphabet);
export const searchLetters = alphabetLetter.split("");
export const validateEmail = (email) => {
const... | true |
6da7cccff025c0aa70672bb18d64f64c412f7a64 | JavaScript | yurboisporks/AsteriskBoty | /commands/mute.js | UTF-8 | 832 | 2.859375 | 3 | [] | no_license | exports.run = (config, client, message, args) => {
const modRole = message.guild.roles.find("name", config.ModRole);
if(!modRole){
message.channel.send('The "Moderator" Role does not exist');
} else if (!message.guild.me.hasPermission("MUTE_MEMBERS")){
return message.reply(" I don't Have the permissions to do th... | true |
ba3490a2c8409da994c77c5edf547e041dc05728 | JavaScript | gleclaire/generator-jhipster | /lib/utils/secret-utils.mjs | UTF-8 | 709 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import { randomBytes } from 'crypto';
/**
* Get a random hex string
* @param {number} len the length to use, defaults to 50
*/
export function createSecret(len = 50) {
return randomBytes(len).toString('hex');
}
/**
* Generates a base64 secret from given string or random hex
* @param {string} value the value us... | true |
9d5c548c12d92197a08f163ce1dc3d053687c32c | JavaScript | devAbhijeet/coding-math-experiments | /src/24-3d-points-lines/index2.js | UTF-8 | 1,577 | 3.0625 | 3 | [] | no_license | import "./styles.css";
let canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"),
width = (canvas.width = window.innerWidth),
height = (canvas.height = window.innerHeight);
const fl = 300;
const points = [];
const numPoints = 200;
const centerZ = 2000;
const radius = 1000;
let baseAngle... | true |
3050417a53a633f8862f2e22099c8508fabd8437 | JavaScript | ericksen-github/todo_list | /src/projectFunctions.js | UTF-8 | 2,383 | 2.875 | 3 | [] | no_license | import {ProjectFactory} from "./project.js"
import {taskFunctions} from "./taskFunctions.js"
import {projectsArray} from "./localStorage.js"
const projectFunctions = (() => {
const addProject = () => {
const nameText = document.getElementById("nameTextBox").value;
const descText = document.get... | true |
67d907fedadeb233ec6e3d507b6efddcc6d99057 | JavaScript | sureshkldh/HTML5-Desing-in-Codeigniter | /code/assets/js/custom.js | UTF-8 | 869 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /************** Header sticky *********************/
jQuery(document).ready(function() {
var $window = jQuery(window);
$window.scroll(function(){
if ($window.scrollTop() >= 130) {
//jQuery('.top-header').addClass('hide_div');
jQuery('header').addClass('scrolldown');
} else {
//jQuery('.top-header').removeCl... | true |
fbd28d85c96b4e9a3777f40649e7ab07e503cbc1 | JavaScript | soydulceangelina/basic-algorithms | /encontrar-suma-mas-grande-de-dos.js | UTF-8 | 162 | 3.203125 | 3 | [] | no_license | /**
* Dado un array, encontrar la suma más grande entre dos números
*
* Entrada: array
* Salida: la suma más grande
*/
function sumaMasGrande(arr) {
}
| true |
083b1bce8c4c754d0f42a9230932686d3e5b2725 | JavaScript | faisalabuzaid/student-informations | /js/app.js | UTF-8 | 670 | 3.25 | 3 | [] | no_license | 'use strict';
const Student = function (students){
this.students= students;
};
Student.prototype.addStudent = function (email, mobile, tuition) {
const newStudent = new StudentList(email, mobile, tuition);
this.students.push(newStudent);
};
Student.prototype.saveToLocal = function (){
localStorage.setItem('s... | true |
8ae6f212a13b397d4a3ec9c83b92b1d0e6ed3db5 | JavaScript | DouglasSumita/ExerciciosJS | /exercicios-js/exerciciosSecao5/pedidoLanchonete.js | UTF-8 | 2,070 | 4.65625 | 5 | [] | no_license | /*
O cardápio de uma lanchonete é o seguinte:
Código Descrição do Produto Preço
100 Cachorro Quente R$ 3,00
200 Hambúrguer Simples R$ 4,00
300 Cheeseburguer R$ 5,50
400 Bauru R$ 7,50
500 Refrigerante R$ 3,50
600 Suco R$ 2,80
Implemen... | true |
e9503cc31d837e2f6e2d6f8ef3fcc900648d0189 | JavaScript | davbend/Materiale_SE2 | /Esercizi/Chat/index.js | UTF-8 | 2,694 | 2.703125 | 3 | [] | no_license | var express = require('express');
var app = express();
//app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.json());
app.set('port', process.env.PORT || 3000);
var users =
[
{
username: "aldo",
password: "a"
},
{
username: "pippo",
password: "b"
}
];
... | true |
73e76a1b3309c0e1805a0e87d24ebb93cad95e52 | JavaScript | emilianog94/Frontloops-JavaScript-ES6-Challenges | /Loop1/Step1/script.js | UTF-8 | 1,380 | 4.125 | 4 | [] | no_license | /* Dividir todo en pequeños problemas:
Debo almacenar en una variable todos los botones y el select.
Una vez almacenados, les puedo correr un eventListener que haga listen a:
- Cuando se clickea un botón
- Cuando se selecciona una opción.
Caso 1: Cuando se clickea un botón:
- Se le saca la clase active al resto de ... | true |
743b12d8543ca5b5aa0cc0665edee57e70d9cc8e | JavaScript | malaysiamidwestgames/sambal | /public/js/custom.js | UTF-8 | 646 | 2.859375 | 3 | [
"MIT"
] | permissive | $(function() {
var midwest2015Date = new Date(2015, 4, 22);
var midwest2016Date = new Date(2016, 4, 27);
var todayDate = new Date();
var diffInDay = Math.floor((midwest2015Date - todayDate)/(1000 * 60 * 60 * 24));
var futureDiff = Math.floor((midwest2016Date - todayDate)/(1000 * 60 * 60 * 24));
var topText = dif... | true |
a7496e2646ceb7b10265fed50689c074383515b4 | JavaScript | Maximusbek/ProFrameWork | /pages/homepage.js | UTF-8 | 687 | 2.765625 | 3 | [] | no_license | let homepage = function () {
let input1 = element(by.model('first'));
let input2 = element(by.model("second"));
let go = element(by.css('[ng-click="doAddition()"]'));
this.get = function (url) {
browser.get(url);
}
this.enterFirstNumber = function (num1) {
input1.sendKeys(num... | true |
9f2e2628d26aabb70c8ae2037385fa3deddd980d | JavaScript | weaverjeff/algorithms | /js/exercises/longest-substring-without-repeating-chars/index.js | UTF-8 | 1,721 | 3.671875 | 4 | [
"MIT"
] | permissive | // https://leetcode.com/articles/longest-substring-without-repeating-characters/
let find1 = (s) => {
//O(n^3)
let n = s.length;
let ans = "";
for (let i = 0; i < n; i++) {
for (let j = i + 1; j <= n; j++) {
if (allUnique(s, i, j)) {
if ((j - i) > ans.length) {
... | true |
313a0ca207aa644d9ad8d48a7f36b0d5ce248f94 | JavaScript | aungthano/Warenet | /Warenet.Web/Factories/DateInterceptor.js | UTF-8 | 1,758 | 2.5625 | 3 | [] | no_license | 'use strict';
define(['appconfig'], function (app) {
app.factory('dateInterceptor', function () {
var regexIsoUtc = /^(\d{4}|\+\d{6})(?:-(\d{2}))(?:-(\d{2}))(?:T(\d{2})):(\d{2}):(\d{2})Z$/;
function matchDate(dateString) {
if (dateString.length === 20) {
return dateStr... | true |
a7b43fb1dd57d2fab5105d0d8fc47d642dbbf02c | JavaScript | wix-incubator/graphql-playground | /middleware-server/services/dataService.js | UTF-8 | 1,068 | 2.703125 | 3 | [] | no_license | import fetch from 'node-fetch';
const BASE_URL = 'http://swapi.co/api';
function getJSONFromRelativeURL(relativeURL) {
console.log('GET RELATIVE', relativeURL);
return fetch(`${BASE_URL}${relativeURL}?format=json`)
.then(res => res.json());
}
function getJSONFromAbsoluteURL(absoluteUrl) {
console.log('GET ... | true |
e9860951961330c5f6a0a85075e17f3a8c73d07b | JavaScript | ChoWonmin/Yori-Jori | /src/util/difficulty.js | UTF-8 | 565 | 2.75 | 3 | [] | no_license | const jsonfile = require('jsonfile');
const _ = require('lodash');
const path = '../data/';
const file = path + 'food.json';
const destFile = path + 'food_difficulty.json';
const cookList = jsonfile.readFileSync(file);
let res = {};
_.forEach(cookList , (r,key) => {
const length = r.process.length;
let dif... | true |
8e45d5c52e02990787f5ef2000594ea07ef3b03c | JavaScript | collectrium/ember-range-slider | /addon/utils/scale-strategies.js | UTF-8 | 2,920 | 3.09375 | 3 | [
"MIT"
] | permissive | const { abs, round, floor, log10, pow } = Math;
const scaleStrategies = {
linear: {
getPercentage(min, max, value) {
return (value - min) / (max - min) * 100;
},
getValue(min, max, percentage) {
return (max - min) * (percentage / 100) + min;
},
},
logarithmic: {
getPercentage(_... | true |
a0f5c980bedb9d27a9cab5a79f7f898910a36ba2 | JavaScript | Buzzertech/passport-jwt | /lib/verify_jwt.js | UTF-8 | 896 | 2.546875 | 3 | [
"MIT"
] | permissive | var jwt = require('jsonwebtoken');
var promisifyAll = require('bluebird').promisifyAll;
var redis;
async function verifyTokenFromCache(token, redisOptions){
redis = promisifyAll(require('redis').createClient(redisOptions));
if(token){
try{
const exists = await redis.existsAsync(token); ... | true |
42c4531d8188bb20c4eed5b35faaaa0f0db33327 | JavaScript | Wzijie/music163 | /src/plugs/navRoll.js | UTF-8 | 1,182 | 2.828125 | 3 | [] | no_license |
function navRoll(navSelector){
var nav = document.querySelector(navSelector);
// 同一个元素只能执行一次
if(nav.isExecute === true){
return;
}
nav.isExecute = true;
nav.addEventListener('click', (event) => {
if(event.target.nodeName !== 'LI' && event.target.nodeName !== 'A'){
return;
}
// 获取li
var navList = e... | true |
e79ae33016bfb3b4005db5d03af1f15bdbc0148b | JavaScript | eyeman2/TriviaGame | /assets/javascript/app.js | UTF-8 | 1,454 | 3.40625 | 3 | [] | no_license |
var correct = 0;
var incorrect = 0;
//var unanswered = ;
var timer = 60;
var interValid;
$("#start").on("click", startGame);
function startGame(){
interValid = setInterval(decrement, 1000);
$("#start").hide("fast");
$("#questions").show("fast");
}
function decrement() {
timer--;
$("#... | true |
3e2e4955d613bc77ae80eab7379dbb4f72760686 | JavaScript | newzpanuwat/NodeJS-Basic | /method.js | UTF-8 | 400 | 2.65625 | 3 | [] | no_license | var pi=3.14;
var obj = {}
obj.Attr = 1;
obj.Attr2 = "Hi this is attribute!"
obj.UpdateData = function(){
console.log("Updated Data");
}
obj.DeleteUser = function(){
console.log("Deleted User....");
}
var update = function(){
return "Updating Server...."
}
var add = function(a,b){
return a+b;
}
e... | true |
fd98ed86e9d54c07a7f29c926e5b53a0718e8db4 | JavaScript | ledugani/011-building-a-wizard-interface | /src/App.js | UTF-8 | 3,218 | 2.890625 | 3 | [] | no_license | import React from 'react';
import ClassSelect from './features/class-select';
import CharacterInfo from './features/character-info';
import RollStats from './features/roll-stats';
import initialState from './initial-state';
import './App.css';
class App extends React.Component {
state = initialState
renderCurre... | true |
d81b9f2c76ae0da68c7bd5a8a966e5e91908f20a | JavaScript | Matthew-Mcds/MatthewMcdonald-ExerciseApp | /ExerciseApp/Server/controller.js | UTF-8 | 912 | 2.6875 | 3 | [] | no_license | const express = require('express');
const { EApp, User, Friends,Exersies} = require('./model');
var app = new EApp();
const route = express.Router();
// function to get currently does get
route.get('/',function(req,res){
res.send(app);
})
// post function for new user.
route.post('/users', function(req,res){
... | true |
57630554b482c9f560ca0f9f1d6d5d309cf62071 | JavaScript | vitormeriat/game-crazy-maze | /src/js/GameWins.js | UTF-8 | 498 | 2.90625 | 3 | [
"MIT"
] | permissive | function GameWins(canvas)
{
this.imagem = new Image();
//this.imagem.src = "gameover.png";
this.canvas = canvas;
this.desenharGameWins = function()
{
this.canvas.fillStyle = '#228B22';
this.canvas.fillRect(0, 0, 1440, 1440);
var phrase = "Wins! :)";
this.canvas.font = "bold 34px Arial, sans-serif... | true |
5f31038fa97a887df7581d83a4a71977a4f0ce02 | JavaScript | n-bryant/classnames-helper | /src/getComponentName.js | UTF-8 | 1,334 | 3.21875 | 3 | [] | no_license | import invariant from "invariant";
/**
* Identify the name to use for a component by inspecting a component's static 'displayName' or 'name' properties.
* @param {Function|String} componentOrName A component with a 'name' or 'displayName' property or the component name
* as a string OR an explicit string name for t... | true |
b40c6792197216994ef8053c272703d68576282d | JavaScript | Ethannnrogers/site-scraper | /server.js | UTF-8 | 3,216 | 2.53125 | 3 | [] | no_license | var express = require("express");
var handlebars = require("express-handlebars");
var mongoose = require("mongoose");
var bodyParser = require("body-parser");
var cheerio = require("cheerio");
var request = require("request");
var path = require("path");
var axios = require("axios");
var logger = require("morgan");
v... | true |
3399ad8c0a286ec0cfb91ae78cf30d9b85609566 | JavaScript | hllau/aml-00000-mil | /src/main/webapp/am/System/application_files/script/calendar.js | UTF-8 | 14,448 | 2.5625 | 3 | [
"MIT"
] | permissive | try {
//nothing to do
if (calLang) {}
} catch (e) {
calLang = "en";
}
var en_month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var zh_month=new Array("年1月","年2月","年3月","年4月","年5月","年6月","年7月","年8月","年9月","年10月","年11月","年12月");
var sc_month=new Array("年1月","年2月","年3月","年4月","年... | true |
dc6078b9ddd6d3008a797f0c8eceec2bdfafe34e | JavaScript | shaneweth/trivia-game | /assets/javascript/quizGame.js | UTF-8 | 1,010 | 3.390625 | 3 | [] | no_license | // Timer Variable - Need to set function in order to nest.
var timeLeft = 30;
var elem = document.getElementById('timer-box');
var timerId = setInterval(countdown, 1000);
function countdown() {
if (timeLeft === 0) {
clearTimeout(timerId);
// doSomething will be the action t... | true |
454ba6e98f4befc20aee015482919d2e510c9673 | JavaScript | hao-wang/Montage | /js-test-suite/testsuite/5711aea9692e74d193f0d050aac09929.js | UTF-8 | 1,464 | 2.625 | 3 | [
"MIT"
] | permissive | load("201224b0d1c296b45befd2285e95dd42.js");
load("19d7bc83becec11ee32c3a85fbc4d93d.js");
var valid_strict_funs = [
// directive ends on next line
function () {
"use strict"
;
},
function () {
"use strict"
},
// directive ends on same line
function () { "use strict"; },
function () { "use s... | true |
f76ec51c83893638b9e47067f6c2ad3d959780ff | JavaScript | akdeveloper0791/green_content | /static/js/content/uploadLocal.js | UTF-8 | 3,162 | 2.6875 | 3 | [] | no_license | var contentId;
function uploadFileLocal(file) {
//init upload file dialog
initUploadFileBusyDialg();
//init update state
uploadState.file = file;
uploadViaHttpLocal(file);
return false;
}
function uploadViaHttpLocal(file)
{
var xhr = new XMLHttpRequest();
var isInitial = ... | true |
cb3650dfab0c460e99f78c8b9dfef01cb849d109 | JavaScript | fawadik/hyf-homework | /javascript/javascript2/week1/shortest_word.js | UTF-8 | 255 | 3.40625 | 3 | [] | no_license | const danishWords = ["bil", "plante", "kaffe", "bog", "ø", "planterium"];
function shortestWord (danishWords){
console.log(
danishWords.reduce(function(a, b) {
return a.length <= b.length ? a : b;
})
)
}
console.log(shortestWord(danishWords));
| true |
efa1f0b0897d2d8c5428a0a105d5dff47c728907 | JavaScript | jasonmcaffee/uiDesignTools | /js/mylibs/uiDesignTools/boxShadow/widgets/boxShadowWidget.js | UTF-8 | 4,236 | 2.5625 | 3 | [] | no_license |
/**
* @author Jason McAffee
*/
define([
'mylibs/uiDesignTools/uiDesignTools',
'libs/jquery/jqueryModule',
'mylibs/uiDesignTools/boxShadow/models/boxShadow',
'mylibs/uiDesignTools/gradients/models/colorStop',
'mylibs/uiDesignTools/gradients/widgets/colorStopWidget'
], function(uiDesignTools, $, boxShadow, c... | true |
9944b70297b15e86ed75c1f042a89ca503adb1b1 | JavaScript | zenko93/js | /Task4Spiral.js | UTF-8 | 856 | 3.0625 | 3 | [] | no_license | function spiral (rows, colons){
let mas = [];
let t = 0;
let y1 = 0;
let y2 = colons;
let x1 = 0;
let x2 = rows;
let per = 0;
for (let i = 0; i < rows ; i++) {
mas[i]=[];
for (let j = 0; j < colons; j++) {
mas[i][j]=0;
}
}
// mas[0][25] = 1
... | true |
ac8bb56974957409e8aaf4cca21556c7fc430134 | JavaScript | bauripalash/incov-report | /map/map.js | UTF-8 | 3,738 | 2.6875 | 3 | [] | no_license | // CONSTANTS
REPORT_URL = "https://raw.githubusercontent.com/bauripalash/ncov-19-india/master/data/report.json"; //Data Source
var smap; // The Map Leaflet Object
var gj; // The GeoJSON Layer
var infobox;
var eStateList = Array();
var eCountList = Array();
var dList = Array();
var rList = Array();
var totalInfected;
... | true |
408f45e7755c652bb2e568c408a29712609a1ea7 | JavaScript | ymwizeline/react-certification-2021 | /src/utils/fns.js | UTF-8 | 343 | 2.703125 | 3 | [] | no_license | function random(limit) {
return Math.floor(Math.random() * limit);
}
function formatTitleWithApostrophe(title) {
return title.split(''').join("'");
}
function filterByResultType(data, type) {
return data.filter(({ id: { kind } }) => kind === `youtube#${type}`);
}
export { random, formatTitleWithApostrophe,... | true |
d5e72f9d70692f4369266ad6c63cf9f10ec4d98a | JavaScript | nnnkit/state-update | /src/todo.js | UTF-8 | 376 | 2.859375 | 3 | [] | no_license | {
/* <li>
<input type="checkbox" name="" id="" />
<p></p>
<button></button>
</li> */
}
let li = document.createElement("li");
let input = document.createElement("input");
input.type = "checkbox";
let button = document.createElement("button");
button.textContent = "x";
let p = document.createElement("p");
p.tex... | true |
57e08ff871d831bfe215694a92c4e5c80e7f2d3c | JavaScript | bhagyashreelimaye7/HTML_CSS_Training | /javaScript/dateCounter.js | UTF-8 | 1,383 | 3.03125 | 3 | [] | no_license | (function($){
$(document).ready(function($) {
$("#datepicker").datepicker();
});
})(jQuery);
function start(){
var currentDate = new Date();
var cmonth = currentDate.getMonth()+1;
var cday =currentDate.getDate();
var cyear = currentDate.getFullYear();
var ctime = currentDate.getTime();
... | true |
593e40556b4e28765aa3017f4d3c31e36fdc656c | JavaScript | josefprusa/RepRapCalculator | /temptable.js | UTF-8 | 1,746 | 2.671875 | 3 | [] | no_license | String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: '{' + number + '}'
;
});
};
function createTemperatureLookup(arg,hash){
/* sensible defaults:
r0=10000;
... | true |
d75f75c4633a465d84186f8a73683d42f8493dbb | JavaScript | CarlosRobertoMedeiros/revision-frontend-javascript-conceitos | /06-jsNoBrowser/04-objectWindow.js | UTF-8 | 699 | 3.140625 | 3 | [
"MIT"
] | permissive | /*
Objeto window
Esse objeto sempre é carregado automaticamente, o objeto windows tem várias funções
por exemplo o parseFloat está na biblioteca window
e
Escopo Global
Quando estiver em um escopo global, lembrar que o window sempre carregar as variáveis de js que vem de maneira global
Ou seja, caso eu ten... | true |
6b1c88646707c9a8215212029f5da18cf4bbdf5d | JavaScript | flix/programming-flix | /src/content/Concurrency.js | UTF-8 | 7,724 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import React from 'react'
import ReactGA from "react-ga";
import Code from '../components/Code';
import Section from "../components/Section";
import SubSection from "../components/SubSection";
import PlannedFeature from "../components/PlannedFeature";
import SubSubSection from "../components/SubSubSection";
import Cod... | true |
f1b9c75e0f51a29fa68ad776fe1aee223bbd5f3f | JavaScript | tianhenmei/tianhenmei.github.io | /Lagou/src/common/js/Erase.js | UTF-8 | 8,551 | 2.84375 | 3 | [] | no_license | var Erase = function(config){
this.width = 0;
this.height = 0;
this.canvasID = '';
this.canvas = null;
this.ctx = null;
this.src = '';
this.frame = 60;
this.lineWidth = 30;
this.leave = 0.4;
this.disappearClass = 'disappear';
this.bottomImage = '';
this.touchType = "ontou... | true |
ba26941760a688e9b8fbf70d31db53616e60e447 | JavaScript | triszt4n/devlabs | /middlewares/membership/handOverOwnership.js | UTF-8 | 637 | 2.59375 | 3 | [] | no_license | /**
* Overwrites owner of the project to the developer posted.
*/
const { MEMSHIP_MESSAGES } = require("../../utilities/constants");
module.exports = function (objectRepository) {
return function (req, res, next) {
let project = res.locals.membership._proj;
project._owner = res.locals.membership.... | true |
34c5554a0fdfc1d67f4a3e794e236549cd26b75b | JavaScript | NathanSass/sketchProblems | /graphColoring.js | UTF-8 | 765 | 3.75 | 4 | [] | no_license | /**
https://www.interviewcake.com/question/javascript/graph-coloring
**/
function GraphNode(label) {
this.label = label;
this.neighbors = new Set();
this.color = null;
}
var a = new GraphNode("a");
var b = new GraphNode("b");
var c = new GraphNode("c");
a.neighbors.add(b);
b.neighbors.add(a);
c.neighbors.add(b);... | true |
2996de374cb33cd9142f6300ff4f48ba41e8fe95 | JavaScript | eljurim/curaREMM | /src/Components/Content/index.js | UTF-8 | 6,449 | 2.625 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react'
import filledStar from '../../assets/star-solid.png'
import emptyStar from '../../assets/star-regular.png'
//borrar esto en cuanto se pueda
import doctor from '../../assets/index.jpeg'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import './Doctor.css'
imp... | true |
df04d8a9332b5c90767bfc4da3122f55e26fe1eb | JavaScript | koufongso/Catan | /assets/javascript/class_player.js | UTF-8 | 2,899 | 3.015625 | 3 | [] | no_license |
class player {
constructor(id, resource,color) {
this.id = id;
this.name = "Player " + id;
this.color = color;
this.resource = resource;
this.houseNode = [];
this.roadNode = []; // nodes owned by this player that is a "road node"
this.hands =... | true |
055f1886e81db8f886845a2efda87150254008a3 | JavaScript | lazzzis/sherry | /packages/docs/scripts/util.js | UTF-8 | 1,268 | 3.34375 | 3 | [
"MIT"
] | permissive | function splitFileIntoParts(source, interval) {
const len = source.length
if (len < interval) {
return [source]
}
// find the latest line break
let start = 0, end = interval, result = []
while (true) {
if (start > len - 1) {
break;
}
const { content, newEnd } = findClosestLineBreak(so... | true |
6db6f5bfb8e2ffa325e8cc78bc4a0b1402fd7117 | JavaScript | omergal99/little-games | /js/util-service.js | UTF-8 | 1,780 | 3.3125 | 3 | [] | no_license | 'use strict';
function makeId() {
var length = 4;
var txt = '';
// var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var possible = '0123456789';
var possibleWord = 'ABC';
txt += possibleWord.charAt(Math.floor(Math.random() * possibleWord.length));
for (var i ... | true |
d889b102572b359ab36b35e62957551ede32db03 | JavaScript | hckt/node | /02.server.js | UTF-8 | 844 | 2.6875 | 3 | [] | no_license | /*'use stric'
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hola Mundo\n');
});
server.listen(port, hostname, () => {
console.log(`Servidor Iniciado ht... | true |
06a02dd19ad1f4c3578005a473689083f566622f | JavaScript | ah-0101/openchef | /react-app/src/store/chefs.js | UTF-8 | 2,319 | 2.671875 | 3 | [] | no_license | const GET_CHEFS = 'chefs/getChefs'
const GET_ONE_CHEF = 'chefs/getOneChef'
const UPDATE_CHEF = 'chefs/updateChef'
const getChefs = (chefs) => {
return {
type: GET_CHEFS,
payload: chefs
}
}
const getAChef = (chef) => {
return {
type: GET_ONE_CHEF,
payload: chef,
}
}
con... | true |
f4719fb25cdf75261915ab482de836ee3a865322 | JavaScript | Muxthafa/Javascript-programs | /Maps/birthdayMonth.js | UTF-8 | 721 | 3.328125 | 3 | [] | no_license | let prompt = require("prompt-sync")()
let dict = {};
let bdyMonth = new Map()
let months = ['jan','feb','march','april','may','june','july','aug','sep','oct','nov','dec'];
let years = ['1992','1993'];
for(let i =1;i<=50;i++){
let yearIndex = Math.floor((Math.random()*2));
let monthIndex = Math.floor((Math.rand... | true |
048f1589a1791529067218eef6053d852423a32f | JavaScript | thinkful-ei-cheetah/express-practice-elan | /app.js | UTF-8 | 1,417 | 2.84375 | 3 | [] | no_license | 'use strict';
const express = require('express');
const morgan = require('morgan');
const output = require('./books.js');
const app = express();
app.use(morgan('common'));
app.get('/apps', (req, res) => {
const { sort = '', genres } = req.query;
const filteredSort = sort || sort.charAt(0).toUpperCase() + sort.s... | true |
0413e05e53b70ca89aefcfeb78a07be13acf0833 | JavaScript | kindlyfire/pombot-legacy | /handlers/stop.js | UTF-8 | 1,629 | 3 | 3 | [] | no_license | //
// Stop a personnal pom or leave a group pom
//
module.exports = async ({ bot, message, util }) => {
// Check if the user has a pomodoro already
let pom = await util.getAssignedPom(message.author.id)
// Stop the pom if there is one
if (pom) {
// Get number of users in the pom
// If > 1, we should only remo... | true |
be277925f5f79a7cb80249a567ca21085fefd5fd | JavaScript | devansh1503/Calculator-Mini-Project | /javas.js | UTF-8 | 1,082 | 3.1875 | 3 | [] | no_license | var op1=0;
var op2=0;
var ch="+";
var res=0;
var inp = "";
function asign(i){
if(op1==0 || !inp.includes(ch)){
op1 = op1*10 + i;
inp = inp+i;
document.getElementById("infield").innerHTML = inp;
}
else{
op2 = op2*10 + i;
inp = inp+i;
document.ge... | true |
45330111b88e94c5bc5b2b154e083ad5814d9d1f | JavaScript | StephanYu/hot-or-cold-starter | /js/app.js | UTF-8 | 3,406 | 3.6875 | 4 | [] | no_license |
$(document).ready(function(){
/*--- Global Variable ---*/
var count = 0;
var $userGuess;
var randomNum = getRandomInt(1, 101);
var controlArray = [];
// When a new game starts, a secret number between 1 and 100 should be generated that the user will have to guess. Returns a random integer between... | true |
88a0fa968a4926ce9efbf99ff572463b681911f2 | JavaScript | marchowardbegins/quasar_source | /quasar_site_django/static/js/custom/models/inheritables/saveable.js | UTF-8 | 6,063 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
function Saveable(entity_type, load_completed_callback) {
this.load_completed_callback = load_completed_callback;
this.save_type = entity_type;
this._save_field_keys = [];
this._entity = null;
this.set_to_saveable = function(entity_parent_to_add) {
if (!is_defined(this._en... | true |
24d6d0aeecae0296545e9d6bcf9c146a82302291 | JavaScript | leewalter/graphql-js | /Walter/rollDice.js | UTF-8 | 1,303 | 3.03125 | 3 | [
"MIT"
] | permissive | /* based https://graphql.github.io/graphql-js/passing-arguments/
*/
var express = require('express');
var graphqlHTTP = require('express-graphql');
var { buildSchema } = require('graphql');
// Construct a schema, using GraphQL schema language
var schema = buildSchema(`
type Query {
rollDice(numDice: Int!, numSi... | true |
89e93626cf3427583d744b9a89771fe23f6cac93 | JavaScript | Abhay-Joshi-Git/express-gateway-JWT | /server/customers.js | UTF-8 | 708 | 2.75 | 3 | [] | no_license | const express = require('express');
require('dotenv').config();
const customersData = [
{
id: 1,
name: 'abc',
},
{
id: 2,
name: 'xyz',
}
];
const app = express();
const port = process.env.CUSTOMER_SERVICE_PORT || 3000;
app.get('/customers/:id?', (req, res) => {
con... | true |
cb0b6834d4b85e9a4741254a820861c620de1369 | JavaScript | dustinpfister/test_natural | /token.js | UTF-8 | 315 | 3.265625 | 3 | [] | no_license |
var natural = require('natural'),
// use this constructor
tokenizer = new natural.WordTokenizer(),
content = 'I like the javaScript it is the best.';
tokens = tokenizer.tokenize(content);
// gives me an array of the words
console.log( tokens );
// [ 'I', 'like', 'the', 'javaScript', 'it', 'is', 'the', 'best' ] | true |
ef04cfa6fadbda34a6276a414f791ebcfeceb9dd | JavaScript | BhushanMehta/Filmlist | /src/redux/reducers/films.js | UTF-8 | 716 | 2.828125 | 3 | [] | no_license | const initialState ={
films:[],
loading:false,
error:null
}
export default function films(state=initialState,action) {
console.log('reducer',action,state)
const {type} = action
switch(type) {
case "GET_FILMS_REQUESTED":
return {
...state,
load... | true |
2c4960a2273e120173869569d9fca984ae23e00d | JavaScript | BeginnerDong/YiShengYiGou | /js/include.js | UTF-8 | 5,182 | 2.671875 | 3 | [
"MIT"
] | permissive |
(function(window, document, undefined) {
var Include39485748323 = function() {}
Include39485748323.prototype = {
//倒序循环
forEach: function(array, callback) {
var size = array.length;
for(var i = size - 1; i >= 0; i--){
callback.apply(array[i], [i]);
... | true |
d36574d396c0ee51dafae760ba367880122f344b | JavaScript | sdib/roadtoaspnetcore | /src/MS.Experiences.Web/App/weather/weather.factory.js | UTF-8 | 781 | 2.53125 | 3 | [] | no_license |
function WeatherFactory($http) {
var loadWeatherAsync = function () {
var _data = weather.data;
_data.isLoading = true;
return $http.get('api/weather/5').then(function (response) {
var elements = response.data;
for (var i = 0; i < elements.length; i++) {
... | true |
4c2362312f36bacf7fa8b96ea8e431c46e8c3ee4 | JavaScript | sandie0132/betterPlace | /src/containers/CustomerMgmt/OrgMgmt/OrgBgvDashboard/Insights/Store/reducer.js | UTF-8 | 2,878 | 2.5625 | 3 | [] | no_license | import { updateObject } from '../../../OrgMgmtStore/utility';
import * as actionTypes from './actionTypes';
const initialState = {
getServicesState: 'INIT',
postBgvStatusState: 'INIT',
getCustomBgvStatusState:'INIT',
services: null,
bgvStatus: null,
customBgvStatus:null,
error: null
}
con... | true |
48aec9bea196a578f5c3fd04638d4d8f87238450 | JavaScript | Ignacioqs/EASYBANK | /script.js | UTF-8 | 252 | 2.9375 | 3 | [] | no_license | const hamburgerBtn = document.querySelector("#hamburgerIcon");
let menu = document.querySelector(".navClass");
hamburgerBtn.addEventListener("click", displayMenu);
function displayMenu() {
menu.classList.toggle("showMenu");
console.log("how");
}
| true |
b0df08feeb4b9c3b7420727ba94120a4deeaef27 | JavaScript | ploitte/LearningAngularJS | /js/service/post.js | UTF-8 | 1,519 | 2.53125 | 3 | [] | no_license | myApp.factory("postFactory", function($http, $q, $timeout){
var factory = {
posts: false,
getPosts: function(){
let deferred = $q.defer();
if(factory.posts !== false){
deferred.resolve(factory.posts);
}else{
... | true |
f3a7c41fd88ae43e6dbaaa131d706fec731105f0 | JavaScript | DiegoCV/cat-clicker | /cat_cliker_knockout/index.js | UTF-8 | 8,151 | 2.59375 | 3 | [] | no_license | /*$(function() {
var model = {
generalCount: 0,
isAdmin: false,
currentCat: null,
cats: [{
id: 0,
name: "Boss",
src: "https://live.staticflickr.com/3903/15218475961_963a4c116e_b.jpg",
clickCount: 0
}, {
id: 1,
... | true |
8c73c63b845fdca73ee70488a21e61780ffff22b | JavaScript | jonsamp/react-europe-2020 | /3-testing/react-native-testing-library/App.js | UTF-8 | 1,334 | 2.671875 | 3 | [] | no_license | import React, { useState } from "react";
import { Button, StyleSheet, Text, View, TextInput } from "react-native";
function App(props) {
const { onCountIncreased } = props;
const [count, setCount] = useState(0);
const [inputCount, setInputCount] = useState(0);
function handleAddOne() {
setCount(count + 1)... | true |
7b567de9a8d138f57d5cdd14415ce0c33ff3a7d8 | JavaScript | Behruz0129/landing-jivy-clone | /js/animation.js | UTF-8 | 390 | 2.578125 | 3 | [] | no_license | function imgSlider(anything) {
document.querySelector('.jivy').src = anything
}
function changeColor(color) {
const circle = document.querySelector('.circle');
const span = document.querySelector('h2 span');
const btn = document.querySelector('.textBox a');
circle.style.background = color... | true |
061b20e49bb87c1cad3efd832d5fbda955f8720d | JavaScript | krypt007/celoBackend | /contractKit/account.js | UTF-8 | 4,618 | 2.546875 | 3 | [] | no_license | const web3 = require("web3");
const fs = require("fs");
const web3Instance = new web3();
const contractkit = require("@celo/contractkit");
const NODE_URL = "https://alfajores-forno.celo-testnet.org"; //..TODO: CHANGE THIS TO OUR NODE ADDRESS
const kit = contractkit.newKit(NODE_URL);
const Helper = require("../helper/he... | true |
9d6913261a69607bf0af7b4fdca782a020b4f666 | JavaScript | Benben007/lonefterskatt | /public/scriptLonefterskatt.js | UTF-8 | 1,382 | 2.90625 | 3 | [] | no_license | // Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart', 'table']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChart);
google.charts.setOnLoadCallback(drawTable);
// Callback that creates a... | true |
4b16b2227617de0e49d811aaa5e42c3e6389e059 | JavaScript | Le-Himanshu/h12 | /sketch.js | UTF-8 | 756 | 3.28125 | 3 | [] | no_license | var form;
var game;
var playername;
var gamestate=0;
var bg1,bg2,bg3;
var timer=325;
var form2;
function preload(){
bg1=loadImage("bg1.jpg")
bg2=loadImage("bg2.jpg");
bg3=loadImage("bg3.jpg");
}
function setup(){
createCanvas(displayWidth-20,displayHeight-20)
game=new Game();
game.start();
... | true |
09ebf4f1d5e5309c6186c075e69b78c2740325e4 | JavaScript | HaleyJ13/fsw-105 | /week4/string&array_methods/index.js | UTF-8 | 495 | 4.4375 | 4 | [] | no_license | //string exercise
function capitalizeAndLowerCase(a){
var lower = a.toLowerCase()
var upper = a.toUpperCase ()
console.log (lower + upper)
}
capitalizeAndLowerCase("hello")
function halfString(a){
var halfLength = a.length / 2
console.log(a, halfLength);
console.log(Math.floor(half... | true |
23888c85f36f334d94bfea706e0492412e7495b2 | JavaScript | simonhoye/actionmotorcyclesparamatta | /app/scripts/puddle.js | UTF-8 | 4,216 | 2.75 | 3 | [] | no_license | function PuddleGame() {
this.game = null;
this.successCallback = null;
}
PuddleGame.prototype.start = function(successCallback, lossCallback) {
this.game = new Phaser.Game(1024, 768, Phaser.AUTO, 'puddleGameWindow', { preload: preload, create: create, update: update });
var puddleData;
var mop;
... | true |
094f6a2b3be67529fa32a7a74175f547723499b8 | JavaScript | btoll/howto-algorithm | /again/indices.js | UTF-8 | 625 | 3.359375 | 3 | [] | no_license | /*
const indices = (a, n) => {
const nums = [];
for (let i = 0; i < a.length; i++) {
for (let j = 0; j < a.length; j++) {
if (j != i && (a[j] + a[i] === n)) {
nums.push(j);
}
}
}
return nums.sort();
};
*/
const indices = (a, n) => {
const m ... | true |