text stringlengths 1 1.05M |
|---|
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<header>My Header</header>
<p>This is my first website! It's pretty cool.</p>
</body>
</html> |
function findFirstFalsey(arr) {
for (let i = 0; i < arr.length; i++) {
if (!arr[i]) {
return arr[i];
}
}
return undefined;
} |
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# usage
# -----------------------------------------------------------------------------
_usage_function() {
read -r -d '' _usage_string <<EOF
Usage:
./bootstrap.sh [-h|--help]
./bootstrap.sh [-n|--name <name>]
... |
#!/bin/bash
set -o nounset
DELETE_TAG=
build_number=
if [[ $# -eq 1 ]]; then
build_number=$1
elif [[ $# -ne 0 ]]; then
exit 1
fi
branch=pie
aosp_version=PQ3A.190505.002
aosp_version_real=PQ3A.190505.002
aosp_tag=android-9.0.0_r37
aosp_forks=(
device_common
device_google_crosshatch
device_google_crosshatc... |
import java.util.*;
public class BalancedParentheses {
public static boolean isBalanced(String exp)
{
Stack<Character> stack = new Stack<Character>();
for (int i = 0; i < exp.length(); i++)
{
if (exp.charAt(i) == '[' || exp.charAt(i) == '{' || exp.charAt(i) ... |
<filename>src/containers/Main/VrtConversion.tsx
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import BigNumber from 'bignumber.js';
import MainLayout from 'containers/Layout/MainLayout';
import { useWeb3React } from '@web3-react/core';
import { Row, Col } from 'antd';
impor... |
#创建镜像
docker create --name influx-data -v /data/jmx tutum/influxdb
docker run -d --volumes-from influx-data -p 8083:8083 -p 8086:8086 --expose 2003 --expose 8084 -e PRE_CREATE=grafana -e GRAPHITE_DB="grafana" -e GRAPHITE_BINDING=':2003' -e GRAPHITE_PROTOCOL="tcp" --name influxdb tutum/influxdb
docker run -d --link i... |
echo $1
cd mapping
#### test directory
if [ ! -d "$1" ]; then
mkdir $1
fi
cd $1
### making first duplicate sample
if [ ! -d "1" ]; then
mkdir 1
fi
cd 1
### making first duplicate sample
if [ ! -f "$1_1_cutNs.bam" ]; then
echo "File $1_1_cutNs.bam doens't exist for sample $1_1" >> ../../../error_log.txt
exit 1
f... |
package main
import (
"fmt"
"log"
"sort"
"strconv"
"strings"
"github.com/dmies/adventOfGo/filehandler"
)
// PackageDimensions defines the length, width and height of an package
type PackageDimensions struct {
length int
width int
height int
}
func (p PackageDimensions) getSurface() int {
length := p.leng... |
import { Router } from "express";
const router = Router();
import response from "../../assets/response";
import status from "../../assets/status";
import textPack from "../../assets/textPack.json";
import Performance from "../../assets/tests/performance";
import logger from "../../assets/logger";
router.get("/", asyn... |
<reponame>tanshuai/reference-wallet<gh_stars>10-100
# pyre-ignore-all-errors
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
from copy import deepcopy
from datetime import datetime
from typing import Optional
from tests.wallet_tests.resources.seeds import prototypes
from wallet.stora... |
def check_cache(cache_info, current_mtime, max_age):
reloaded = False
if 'mtime' in cache_info and 'data' in cache_info:
cached_mtime = cache_info['mtime']
if current_mtime - cached_mtime > max_age:
# Data needs to be reloaded
cache_info['mtime'] = current_mtime
... |
<filename>src/emails/emails.repository.ts<gh_stars>0
import {EntityRepository, Repository} from "typeorm";
import {Emails} from "./entities/Emails";
@EntityRepository(Emails)
export class EmailsRepository extends Repository<Emails>{
}
|
#!/bin/bash
# Copyright (C) 2020 Private Internet Access, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
<filename>src/main/java/malte0811/controlengineering/blockentity/bus/LineAccessBlockEntity.java
package malte0811.controlengineering.blockentity.bus;
import blusunrize.immersiveengineering.api.wires.ConnectionPoint;
import blusunrize.immersiveengineering.api.wires.LocalWireNetwork;
import blusunrize.immersiveengineeri... |
from functools import wraps
class Proxy:
def __init__(self, wrapped):
self._wrapped = wrapped
def _wrapper(self, func):
@wraps(func)
def wrapper(*args, **kwargs):
return getattr(self._wrapped, func.__name__)(*args, **kwargs)
return wrapper
# No additional imple... |
#!/bin/bash
export DISPLAY=":0"
export ALFRED_ROOT="`pwd`"
source activate alfred
model_dir=$1
for split in valid_seen valid_unseen
do
python -u models/eval/eval_seq2seq.py \
--model_path ${model_dir}/best_seen.pth \
--eval_split $split \
--data data/json_feat_2.1.0 \
--model models.model.seq2seq_... |
<gh_stars>0
/**
Add index signature to interface
*/
export declare type Indexify<O extends object> = {
[P in keyof O]: O[P];
};
/**
Constructs a index signature to interface
*/
export declare const indexify: <O extends object>(object: O) => Indexify<O>;
|
import IO.UserFileIO;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
* User: swyna
* Date: Jun 3, 2011
* Time: 1:46:50 AM
* To change this template use File | Settings | File Templates.
*/
public class Userlist {
private static ArrayList<String[]> users;
private static int currentUser;
... |
import * as AssertionError from "assertion-error";
import * as ts from "ts-morph";
import { Expression } from "./Expression";
export class ClassProperty {
constructor(private _node: ts.ClassInstancePropertyTypes) {}
/** Provides the initializer for the property if there is one. */
get initializer(): Expression ... |
<reponame>hangmann/Temperature-Management-and-Prediction<gh_stars>1-10
package view;
import javax.media.opengl.GL;
/**
* User: christoph
* Date: 2/24/12
* Time: 12:49 PM
*/
public class V_TemperatureGrid {
private int mSubdivision, mProportionalSize;
private int mSensorGridWidth, mSensorGridHeight;
private in... |
<reponame>longshine/calibre-web<gh_stars>1-10
package lx.calibre.repository;
import java.util.Collection;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import javax.persiste... |
<filename>InteractiveProgramming/pong.py
# SimpleGUI PONG!
import simplegui
class Sprite:
"""A sprite is a video element, so it needs some things
like position, size, color (basic in pong), and if it
moves, a velocity"""
def __init__(self):
self._x_pos = 0
self._y_pos = 0
self._... |
import SwiftUI
struct ContentView: View {
@State private var number1: Double = 0
@State private var number2: Double = 0
@State private var operatorIndex = 0
let operators = ["+", "-", "*", "/"]
var body: some View {
VStack {
TextField("Number 1", value: $number1, formatter: NumberFormatter())
TextFiel... |
set -x
env_prefix=oss
module_suffix=so
if [ -n "$1" ]
then
env_prefix=$1
fi
if [ "$env_prefix" != "oss" ]
then
module_suffix=zip
fi
shift
echo "no cluster on "$env_prefix
RLTest --clear-logs --module ../redisgears.so --env $env_prefix $@
echo "cluster mode, 1 shard"
RLTest --clear-logs --module ../redisgears.$mo... |
<reponame>jogoes/caradverts
package testutil
import java.time.LocalDate
import java.util.UUID
import java.util.concurrent.ThreadLocalRandom
import model.{CarAdvert, FuelType}
object CarAdvertFactory {
val minDay = LocalDate.of(1970, 1, 1).toEpochDay
val maxDay = LocalDate.of(2050, 12, 31).toEpochDay
def next... |
<reponame>UlissesMattos/ExeLogicaCWI<filename>MedidaDeDados/script.js<gh_stars>0
var valor = 8678677;
if (valor < 1024) {
return console.log(`${valor.toFixed(2)} B`);
} else if (valor >= 1024 && valor < 1048576) {
valor/=1024;
return console.log(`${valor.toFixed(2)} KB`);
} else if (valor >= 1048576 && ... |
function generatePassword(length=8) {
let password = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";
for (let i = 0; i < length; i++) {
let randNum = Math.floor(Math.random() * characters.length);
password += characters.charAt(randNum);
}
return pas... |
class DataStructure:
def __init__(self):
self.data_elements = []
def add_element(self, element):
self.data_elements.append(element)
@property
def datatype(self):
if not self.data_elements:
return "No data"
else:
data_types = {type(element) for el... |
import asyncio
class TaskRunner:
def __init__(self, tasks):
self.tasks = tasks
async def _run(self, coros):
results = await asyncio.gather(*coros)
return results
async def run_tasks(self):
results = await self._run(self.tasks)
return results
# Example usage
async ... |
<gh_stars>0
#!/bin/env ruby
# encoding: utf-8
require 'redmine'
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
require 'wiki_controller_patch'
require 'wiki_page_patch'
require_dependency 'redmine_wikicipher/hooks'
require_dependency 'redmine_wikicipher/macros'
require_dependency 'redmine/wiki_formatting/texti... |
/* ********************************************************
* This file provides the funciton prototypes for
* configuration and use of pwm module which is present on
* tm4c129encpdt
*
* Author: <NAME>
* Date created: 13th Dec 2020
* Last modified: 8th Jan 2021
*
* ******************************************... |
#!/bin/bash -e
# used pip packages
pip_packages="pillow jupyter numpy matplotlib torch torchvision webdataset pyyaml"
target_dir=./docs/examples
# populate epilog and prolog with variants to enable/disable conda
# every test will be executed for bellow configs
prolog=(enable_conda)
epilog=(disable_conda)
test_body() ... |
<gh_stars>0
import {Bud, factory} from '@repo/test-kit/bud'
describe('bud.alias', function () {
let bud: Bud
beforeAll(async () => {
bud = await factory()
})
it('is a function', () => {
expect(bud.alias).toBeInstanceOf(Function)
})
it('is configurable by bud.alias', async () => {
bud.alias({... |
import mock from "jest-mock";
import expect from "expect";
export default function(history, done) {
const spy = mock.fn();
const unlisten = history.listen(spy);
expect(spy).not.toHaveBeenCalled();
unlisten();
done();
}
|
# Copyright 2018 The Simons Foundation, Inc. - All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by appli... |
<?php
$data = array("name" => "John", "age" => "20");
$url = "https://example.com/form";
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_crea... |
#!/bin/bash
yellow=`tput setaf 3`
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
cracked=1
figlet cracker
function ctrlc(){
echo -e "\n${red}Ctrl-C caught. Quiting!${reset}"
exit 1
}
trap "ctrlc" 2
if [ $# -ne 2 ]
then
echo "${red}Usage: $0 7zipfile wordlist $reset";
exit 1
fi
while read word
do
... |
<reponame>ilaborie/catnip<gh_stars>1-10
import { html, TemplateResult } from "lit-html";
import { Constant, InstructionInstance } from "../models/input";
export const renderConstantPool = (constants: string): TemplateResult =>
html`
<details>
<summary>Constant Pool</summary>
<div class="constants">$... |
from __init__ import *
from copy import copy
from bs4 import BeautifulSoup
import jieba
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--tp", default="train", help="the type of generated data type")
parser.add_argument("--data_dir", default="../DuReader/data/preprocessed/", help="train/dev/tes... |
# -*- encoding: utf-8 -*-
# this is required because of the use of eval interacting badly with require_relative
require 'razor/acceptance/utils'
confine :except, :roles => %w{master dashboard database frictionless}
test_name 'C791 Set Node Power State with invalid path for JSON file'
step 'https://testrail.ops.puppetl... |
#!/bin/sh
# Install libdb4.8 (Berkeley DB).
export LC_ALL=C
set -e
if [ -z "${1}" ]; then
echo "Usage: ./install_db4.sh <base-dir> [<extra-bdb-configure-flag> ...]"
echo
echo "Must specify a single argument: the directory in which db4 will be built."
echo "This is probably \`pwd\` if you're at the root of th... |
package tests.bibliotecaUFMA;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import bibliotecaUFMA.DataControlClass;
import bibliotecaUFMA.biblioteca;
class DataControlTest {
DataControlClass control;
biblioteca b;
@BeforeEach
void... |
# platform = multi_platform_all
# packages = sudo
echo 'nobody ALL=/bin/ls, (!bob alice) /bin/dog !arg, /bin/cat' > /etc/sudoers
echo 'jen ALL, !SERVERS = ALL' >> /etc/sudoers
echo 'jen !fred ALL, !SERVERS = /bin/sh' >> /etc/sudoers
echo 'nobody ALL=/bin/ls, (bob !alice) /bin/dog, /bin/cat !arg' > /etc/sudoers.d/foo... |
fn process_image(physical_size: (u32, u32)) -> Vec<u8> {
let new_width = physical_size.0 as i32 * 2; // Double the width
let new_height = physical_size.1 as i32 * 2; // Double the height
// Assuming image data is represented as a vector of bytes
let modified_image_data: Vec<u8> = vec![0; (new_width * n... |
<reponame>nilslice/crates.io
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_email_key; |
/*
* Copyright (C) 2018 SoftBank Robotics Europe
* See COPYING for the license
*/
package com.softbankrobotics.sample.returntomapframe.localization.gotoorigin;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import an... |
def sortList(lst):
for i in range(len(lst)):
for j in range(i+1, len(lst)):
if lst[i] > lst[j]:
lst[i], lst[j] = lst[j], lst[i]
return lst |
<gh_stars>0
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Problem
{
public static boolean containsPairEqualToK(int[] numbers, int k)
{
for (int i = 0; numbers.length - 1 > i; ++i)
{
for (int j = i + 1; numbers.length > j; ++j)
{
if (numbers[i] + numbers[j] == k)... |
<filename>sudokuSolver.cpp
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
bool populateBoard(signed char* board, int* mask, string input);
short checkHorizontal(signed char* board, char pos);
short checkVertical(signed char* board, char pos)... |
package com.intercpter;
public class Log {
public void before(){
System.out.println("Log start !");
}
}
|
<gh_stars>0
package com.jiulong.eureka.service.impl;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 测试熔断
*
*/
@Component
public class StoreI... |
<gh_stars>1-10
call log('view_medgen_uid', 'MedGenUID:ConceptID');
select ' MedGen PubMed table is 80M+ rows, this will take a few minutes ' as fyi;
drop table if exists view_medgen_uid;
CREATE TABLE view_medgen_uid
select distinct UID as MedGenUID,
CUI as ConceptID from medgen... |
<filename>test/desktopbrowsers.test.js
describe("desktopbrowsers",function(){
var $item;
var item;
before(function(){
$(document.body).append("<div id='desktopbrowsers'></div>");
$item=$("#desktopbrowsers");
item=$item.get(0);
});
function fakeMouseEvent(evt,target,x,y){
... |
<reponame>Gisson/jkargs
import ist.meic.pa.annotations.KeywordArgs;
public class KeyVisited extends KeyPlaces {
int visited;
@KeywordArgs("visited=0,second")
public KeyVisited(Object... args) {}
public String toString() {
return String.format("visited: %s, places: %s, %s, %s",
visited, first, second, third... |
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// AFNetworking
#define COCOAPODS_POD_AVAILABLE_AFNetworking
#define COCOAPODS_VERSION_MAJOR_... |
def odd_elements(arr):
odd_arr = []
for num in arr:
if num % 2 != 0:
odd_arr.append(num)
return odd_arr
odd_elements([2, 4, 3, 5, 6, 7, 8, 9, 10]) |
<reponame>Eldius/minecraft-manager-go
package config
import (
"fmt"
"os"
"path/filepath"
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
)
func init() {
_ = os.MkdirAll(GetWorkspaceFolder(), os.ModePerm)
}
/*
GetWorkspaceFolder returns the workspace folder
~/.minecraft-manager/workspace
*/
func Get... |
<filename>app/src/main/java/com/example/wesense_wearos/beans/Combine_u_ut.java
package com.example.wesense_wearos.beans;
public class Combine_u_ut {
private User u;
private User_Task ut;
public Combine_u_ut(User u, User_Task ut) {
this.u = u;
this.ut = ut;
}
public User... |
require 'net/http'
require 'json'
# Make an API request
uri = URI('http://example.com/api/endpoint')
response = Net::HTTP.get(uri)
# Parse the response
res = JSON.parse(response)
# Iterate through the objects
arr = res.map do |obj|
# Return each string from the data
obj['string']
end
puts arr |
<reponame>infamousSs/zod
package com.infamous.zod.ftp.model;
import java.util.Objects;
import lombok.Getter;
public class FTPUserName {
private @Getter final String m_username;
public FTPUserName(String userName) {
if (userName == null || userName.isEmpty()) {
throw new IllegalArgumentEx... |
// +build daemon
package utils
import (
"os"
"syscall"
)
// IsFileOwner checks whether the current user is the owner of the given file.
func IsFileOwner(f string) bool {
if fileInfo, err := os.Stat(f); err == nil && fileInfo != nil {
if stat, ok := fileInfo.Sys().(*syscall.Stat_t); ok && int(stat.Uid) == os.Get... |
#!/bin/bash
cargo build --target wasm32-unknown-unknown
wasm-pack build
#### hack !!!!
echo "---------------------"
echo " UGLY HACK ... (due to incorrect usage of webpack or wasm_bindgen?)"
echo "---------------------"
cd pkg
mv sandbox_bg.js sandbox_bg.js.tmp
echo "import {update_message} from '../index.js';" ... |
JSONAPI.configure do |config|
# Keying
config.json_key_format = :camelized_key
# Pagination
config.default_paginator = :offset
config.default_page_size = 10
config.maximum_page_size = 20
# Caching
config.resource_cache = Rails.cache
# Metadata
config.top_level_meta_include_record_count = true
c... |
#include "global.h"
#include "LowLevelWindow_X11.h"
#include "RageLog.h"
#include "RageException.h"
#include "archutils/Unix/X11Helper.h"
#include "PrefsManager.h" // XXX
#include "RageDisplay.h" // VideoModeParams
#include "DisplayResolutions.h"
#include "LocalizedString.h"
#include "RageDisplay_OGL_Helpers.h"
using ... |
<reponame>wnbx/snail
package com.acgist.snail.downloader.http;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import org.junit.jupiter.api.Test;
import com.acgist.snail.context.ProtocolContext;
import com.acgist.snail.con... |
package quarksjob
import (
"context"
"fmt"
"path/filepath"
"github.com/pkg/errors"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
crc "sigs.k8s.io/controller-runtime/pkg/... |
<reponame>diegoperezl/cf4j
package es.upm.etsisi.cf4j.util.optimization;
import es.upm.etsisi.cf4j.data.DataModel;
import es.upm.etsisi.cf4j.qualityMeasure.QualityMeasure;
import es.upm.etsisi.cf4j.recommender.Recommender;
import org.apache.commons.math3.util.Pair;
import java.lang.reflect.InvocationTargetException;
... |
public class StringComparison {
public static void main(String[] args) {
String str1 = "Stackoverflow";
String str2 = "Overflow";
String result = "";
for (int i=0; i<str1.length(); i++) {
boolean found = false;
for (int j=0; j<str2.length(); j++) {
... |
<filename>client/nuxt-web/mi/node_modules/videojs-contrib-media-sources/test/html.test.js
import document from 'global/document';
import window from 'global/window';
import QUnit from 'qunit';
import sinon from 'sinon';
import videojs from 'video.js';
import HtmlMediaSource from '../src/html-media-source';
import {
g... |
export default {
autoCheckPermissions: true,
ringBack: "incallmanager_ringback.mp3", // tên file nhạc chờ
ringTone: "incallmanager_ringtone.mp3", // tên file nhạc chuông
busyTone: "_DTMF_", // tên file nhạc máy bận
hangupTone: "incallmanager_busytone.mp3", // tên file nhạc hangup
vibrateRingingP... |
<html>
<head>
<title>Name and Email Form</title>
</head>
<body>
<form>
<h1>Name and Email Form</h1>
<div>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</div>
<div>
<label for="email">Email:</label>
<input type="email" n... |
/*Shop Management System Project Source Code
Developed using concepts of file handling and oops concepts
Username: Admin
Password: <PASSWORD>
*/
#include<iostream>
#include<fstream>
#include<conio.h>
#include<process.h> // exit() fuction
#include<string.h> // strcmp() and strcpy() fun... |
<filename>idseq_pipeline/commands/host_indexing_functions.py
import os
import multiprocessing
from .common import *
MAX_STAR_PART_SIZE = 3252010122
# data directories
# from common import ROOT_DIR
DEST_DIR = ROOT_DIR + '/idseq/indexes' # generated indexes go here
# arguments from environment variables
INPUT_FASTA_S... |
<gh_stars>0
package com.qht.biz;
import com.qht.dto.MyCollectlistDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.qht.entity.Collect;
... |
package com.example.demo.config;
import lombok.Data;
import org.springframework.stereotype.Component;
@Data
@Component
public class MassageDto {
private String id;
private String massage;
private Long timeRequest;
private Long timeResponse;
}
|
<gh_stars>1-10
/*
* Copyright 2022 <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
#!/usr/bin/env bash
##
## Copyright (c) 2017-19, Lawrence Livermore National Security, LLC.
##
## Produced at the Lawrence Livermore National Laboratory.
##
## LLNL-CODE-738930
##
## All rights reserved.
##
## This file is part of the RAJA Performance Suite.
##
## For details about use and distribution, please read RA... |
function isPrime(n) {
if(n<2) return false;
for(let i=2; i<n; i++) {
if(n%i===0) {
return false;
}
}
return true;
}
//Driver
let n = 7;
console.log(isPrime(n)); |
def animate(self, canvas: Canvas, y: int, x: int, frame: Frame, negative: bool) -> None:
if negative:
frame.display_negative(canvas, y, x)
else:
frame.display(canvas, y, x) |
<reponame>anticipasean/girakkafunc
package cyclops.container.immutable.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import cyclops.function.companion.Comparators;
import cy... |
#!/usr/bin/env bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -euo pipefail
CUSTOM_REGISTRY_URL="http://localhost:4873"
NEW_VERSION="$(node -p "require('./packages/docusaurus/pac... |
package migrate
import (
"context"
"database/sql"
"encoding/base64"
"encoding/json"
"errors"
"reflect"
"github.com/go-gorp/gorp"
"github.com/ovh/cds/engine/api/application"
"github.com/ovh/cds/engine/api/database/gorpmapping"
"github.com/ovh/cds/engine/api/project"
"github.com/ovh/cds/engine/api/secret"
... |
#! /bin/bash
STATUS=$(curl localhost:4444/wd/hub/status | ../../bin/json.js value.ready 2> /dev/null)
if [ "$STATUS" == "true" ];then
echo "ready"
else
echo "starting"
docker run -d -p 4444:4444 --shm-size=2g selenium/standalone-chrome:3.8.1-erbium
fi
|
package io.opensphere.controlpanels.layers.tagmanager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.List;
i... |
<reponame>pinnackl/paper-paypal-component<filename>app/server.js<gh_stars>1-10
var paypal = require('../modules/paypal/index');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var http = require('http').Server(app);
app.use(bodyParser());
app.use("/src", express.stati... |
import numpy as np
data = [[1, 2, 3], [4, 5, 6, 7], [8, 9, 10], [11, 12, 13]]
time_steps = 3
names = ["Profile1", "Profile2", "Profile3", "Profile4"]
profiles = []
totals = []
averages = []
counter = 0
for profile in data:
if len(profile) == time_steps:
profiles.append(profile)
totals.append(np.s... |
package io.github.rcarlosdasilva.weixin.model.response.menu.bean.complate;
import java.util.List;
import com.google.gson.annotations.SerializedName;
public class MediaCollection {
@SerializedName("list")
private List<Media> media;
/**
* 多媒体列表.
*
* @return list of {@link Media}
*/
... |
import pandas as pd
# read in the data
data = pd.read_csv('customer_data.csv')
# define the features and targets
X = data.drop(['likelihood_of_return'], axis=1)
y = data[['likelihood_of_return']]
# split data into training and test sets
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y... |
const { get } = require("../request");
const cheerio = require("cheerio");
// Path matching
test("Html file in root folder", () => {
// expect.assertions(1);
return get("/heading").then(data => {
const $ = cheerio.load(data);
expect(
$("h1")
.text()
.trim()
).toBe("title");
});
... |
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { QualityRoutingModule } from './quality-routing.module';
import { AddEditQualityComponent } from './add-edit-quality/add-edit-quality.component';
import { QualityComponent } from './quality.component';
import { FormsModule... |
<reponame>day20180721/Guli
package com.littlejenny.gulimall.product.app;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.littlejenny.common.validgroup.AddGroup;
import com.littlejenny.common.validgroup.UpdateGroup;
import com.littlejenny.common.validgroup.UpdateStatusGroup;
import org... |
/*!
* Clustery.js 基于Clusterize.js修改而来
* Clusterize.js 基于DOM, 参数rows传入列表数组或者库自行根据已有的DOM结构解析
* Clustery.js 基于数据, 参数rows必须传入数组, 不再是操作DOM结构, 而是返回
* 操作列表的数据
*
* @author darkzone
*/
/*! Clusterize.js - v0.16.1 - 2016-08-16
* http://NeXTs.github.com/Clusterize.js/
* Copyright (c) 2015 <NAME>; Licensed GPL... |
'use strict';
describe('commons-filters-spec:', function () {
//prepare module for testing
beforeEach(angular.mock.module('users.commons.filters'));
beforeEach(angular.mock.module('commons.labels.filters'));
beforeEach(angular.mock.module('pascalprecht.translate'));
describe('userInfo-spec:', fun... |
package com.jinke.calligraphy.database;
import hallelujah.cal.CalligraphyVectorUtil;
import hallelujah.cal.SingleWord;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.databas... |
const path = require('path')
const actionStatus = require('action-status')
const execa = require('execa')
const mockedEnv = require('mocked-env')
const publish = require('../publish')
const readJSON = require('../read-json')
const {mockFiles} = require('./__utils')
jest.mock('action-status')
jest.mock('execa')
jest.mo... |
import React from 'react';
import { GeneralStepper } from 'v2/components';
import { useStateReducer, isWeb3Wallet } from 'v2/utils';
import { ITxReceipt, ISignedTx, IFormikFields, ITxConfig } from 'v2/types';
import { translateRaw } from 'v2/translations';
import { ROUTE_PATHS } from 'v2/config';
import { ConfirmTran... |
<gh_stars>0
SELECT dex.backfill_usd_amount(now() - interval '3 days', now() - interval '20 minutes') ;
REFRESH MATERIALIZED VIEW CONCURRENTLY dex.view_token_prices ;
|
def max_subarray_sum(arr):
curr_max = global_max = arr[0]
for i in range(1, len(arr)):
curr_max = max(arr[i], curr_max + arr[i])
if curr_max > global_max:
global_max = curr_max
return global_max |
using System;
using System.Collections.Generic;
namespace IronPython.Runtime {
public class CustomPythonDictionary {
private Dictionary<string, int> storage;
public CustomPythonDictionary() {
storage = new Dictionary<string, int>();
}
public void __setitem__(string key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.