text stringlengths 1 1.05M |
|---|
require 'spec_helper'
describe PayCallSms::IncomingMessageParser do
let(:parser){ PayCallSms::IncomingMessageParser.new }
describe '#from_http_push_params' do
let(:http_params) { {'msgId' => 'a1234', 'sender' => '0541234567', 'recipient' => '972529992090', 'content' => 'kak dila'} }
let(:reply) { parser.f... |
class ReactiveFramework {
var displayNameSubject: String?
func acceptDisplayName(_ displayName: String) {
displayNameSubject = displayName
// Notify subscribed observers about the new display name
notifyObservers()
}
func toggleLike(button: Button, title: String, messag... |
package com.example.mypc.esports2.fragment.registe;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget... |
str_1 = "I"
str_2 = "love"
concatenated_str = str_1 + " " + str_2 |
# Load the necessary libraries
from sklearn.datasets import load_iris
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
# Load the Iris dataset
data = load_iris()
# Create the feature matrix and label ... |
<reponame>slfotg/cross-flips
module.exports = {
basePath: "/cross-flips",
trailingSlash: true
} |
<filename>export.js
// const csv = require("csv");
const fs = require("fs");
const converter = require("json-2-csv");
// Gets a single comment
const getComment = async (octokit, values, issueNumber) => {
return new Promise((resolve, reject) => {
const issueOptions = octokit.issues.listComments.endpoint.merge({
... |
# -*- coding: utf-8 -*-
import app.inspector.engines.interface as interface
import snowflake.connector
SNOWFLAKE_DEFINITIONS_QUERY = """
SELECT
LOWER(c.table_schema) AS "table_schema",
c.table_schema_id AS "schema_object_id",
LOWER(c.table_name) AS "table_name",
c.table_id AS "table_object_id... |
<filename>python_modules/libraries/dagster-airflow/dagster_airflow/operators/python_operator.py
"""The dagster-airflow operators."""
from dagster_airflow.operators.util import invoke_steps_within_python_operator
from dagster_airflow.vendor.python_operator import PythonOperator
class DagsterPythonOperator(PythonOperat... |
#!/usr/bin/env bash
# Detect whether the installed version of Go can build this version of
# ZNBaseDB.
#
# To bump the required version of Go, edit the appropriate variables:
required_version_major=1
minimum_version_minor=11
go=${1-go}
if ! raw_version=$("$go" version 2>&1); then
echo "unable to detect go version... |
file='table_log.txt'
for i in no 0.0 0.1 0.5; do
python log_to_table.py ../stress_test.log $i >> $file
echo '' >> $file
done
|
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
if [[ -n "${TEST_WORKSPACE:-}" ]]; then # Running inside bazel
echo "Validating bazel rules..." >&2
elif ! command -v bazel &> /dev/null; then
echo "Install bazel at https://bazel.build" >&2
exit 1
else
(
set -o xtrace
bazel test --test_output=... |
<reponame>ztepsic/jarvis
#include <ESP8266WiFi.h>
class DeviceInfo {
public:
static String getSerial(){
//return String(ESP.getFlashChipId(), HEX);
return String(ESP.getChipId(), HEX);
}
static String getHost() {
return WiFi.hostname();
}
};
|
/**
* Bar.js
*/
//Simple d3.js barchart example to illustrate d3 selections
//other good related tutorials
//http://www.recursion.org/d3-for-mere-mortals/
//http://mbostock.github.com/d3/tutorial/bar-1.html
var w = 850
var h = 400
var bars = function(data)
{
max = d3.max(data, function(d)
{
ret... |
<filename>client/src/services/api.js
import axios from "axios";
export function setTokenHeader(token) {
if (token) {
axios.defaults.headers.common["Authorization"] = `Bearer ${token}`;
} else {
delete axios.defaults.headers.common["Authorization"];
}
}
export function apiCall(method, path,... |
#!/bin/bash
dieharder -d 201 -g 23 -S 2202957605
|
./gradlew clean
./gradlew :lce:build -PreleaseBuild
./gradlew :lce-rxjava3:build -PreleaseBuild
# Disabling parallelism and daemon sharing is required by the vanniktech maven publish plugin.
# Without those, the artifacts will be split across multiple (invalid) staging repositories.
./gradlew uploadArchives -PreleaseB... |
def squares_n_numbers(n):
# Initialize result
result = []
# Iterate up to n + 1
for i in range(1, n + 1):
result.append(i * i)
# Return result array
return result |
#!/usr/pkg/bin/bash
# $Id$
#[20:11:23] KICK: bag@faeroes needs approval to kick grobe0ba@iceland out of library
WHO="$(echo "${LINE}" | cut -d' ' -f7)"
REQ="$(echo "${LINE}" | cut -d' ' -f2)"
for p in $(xargs < ./kickers);
do
if [ "$(echo "${REQ}" | cut -d'@' -f1)" == "${p}" ];
then
if [[ "${WHO}" != "${OW... |
//============================================================================
// Name :
// Author : Avi
// Revision : $Revision: #14 $
//
// Copyright 2009-2020 ECMWF.
// This software is licensed under the terms of the Apache Licence version 2.0
// which can be obtained at http://www.apache.org/license... |
public static int median(int a, int b, int c)
{
int max = Math.max(a, Math.max(b, c));
int min = Math.min(a, Math.min(b, c));
int mid = (a + b + c) - (max + min);
return mid;
} |
// ==UserScript==
// @name icode
// @namespace Violentmonkey Scripts
// @match *://icode.baidu.com/**/reviews/*/files
// @grant none
// ==/UserScript==
window.addEventListener('load', function () {
var _timer = setInterval(function () {
if (check()) {
hide()
append()
clearInterval(_timer)
}... |
<gh_stars>0
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import praw
import time
import re
import requests
import bs4
def authenticate():
print('Authenticating...\n')
reddit = praw.Reddit('zctabot', user_agent = 'web:zcta-bot:v0.1 (by /u/zcta119)')
print('Authenticated as {}\n'.for... |
#!/usr/bin/env bats
# Debugging
teardown() {
echo "Status: $status"
echo "Output:"
echo "================================================================"
for line in "${lines[@]}"; do
echo $line
done
echo "================================================================"
}
# Global constants
SERVICE_VHOST_PR... |
import numpy as np
def validate_ibound(ibound, botm, top, min_thickness, tolerance):
# Validation 1: Check ibound based on valid bottom elevations
condition1 = np.array_equal(ibound[:, 2, 2].astype(bool), ~np.isnan(botm[:, 2, 2]))
# Validation 2: Check ibound based on layer thickness
condition2 = (ibo... |
arr=($(xargs))
echo ${arr[@]:3:5}
|
<gh_stars>1-10
"""
Author: <NAME>
This script uses sph2pipe to turn all the wv1 files into wav files. Apparently wv1 and wv2 files are the same, just recorded with different mics
This script uses multiprocessing
"""
from IPython.display import Audio
from glob import glob
from tqdm import tqdm
import librosa
import os
... |
package com.pivovarit.collectors;
import java.util.Spliterator;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Stream... |
#!/bin/sh
set -e
BUILD_DIR=$(mktemp -d)
ROOT_DIR=$(git rev-parse --show-toplevel)
SRC_VERSION="1.5.0"
cp -r "$ROOT_DIR"/src/openebs/"$SRC_VERSION" $BUILD_DIR
cp -r "$ROOT_DIR"/stacks/openebs $BUILD_DIR
cd $BUILD_DIR
# Remove test templates
find "$SRC_VERSION" -type d -name tests -print0 | xargs -0 rm -rf
# Creat... |
"""Main application logic
"""
import datetime
import logging
import os
from flask import Flask, render_template, redirect, url_for, request
from flask_login import LoginManager, login_required, login_user, logout_user, current_user
from flask_restful import Resource, Api
import MySQLdb
import predictor
import recomme... |
package ai.net;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ai.exception.BopomofoException;
public class HtmlReader {
/**
* 用教育部國語辭典查詢單... |
const { generateDiscordCloudwatchLogUrls, listECSTasks, sendDiscordNotification, getCommitHashes } = require('./helpers')
const { BaseReporter } = require('@jest/reporters')
const child_process = require('child_process')
const userName = 'jest-reporter'
let g_taskArns, g_commitHashes // g_ are global variables
async ... |
#!/bin/sh
bin/bootstrap.sh
source config.sh
STACK_NAME="${STACK_NAME_PREFIX}-cmr-stac-api"
STACK_DEPLOY_BUCKET=${STACK_NAME}
echo "Deploying to stack $STACK_NAME"
## Make sure bucket is available
if ! aws s3api head-bucket --profile nonprodadmin --bucket "${STACK_DEPLOY_BUCKET}" 2>/dev/null ; then
echo "Creatin... |
<filename>index.js
/**
* @file Manages main entry point.
*/
/** @module Month */
module.exports = require('./src');
|
/**
* Copyright (C) 2018 <NAME>
* This source code is licensed under the MIT License as described in the file LICENSE.
*/
import * as Class from '@singleware/class';
import { Format } from '../format';
/**
* Number validator class.
*/
export declare class Number extends Class.Null implements Format {
/**
... |
<gh_stars>1-10
#include "catch.hpp"
#include "test_helpers.hpp"
#include "duckdb/storage/storage_info.hpp"
using namespace duckdb;
using namespace std;
TEST_CASE("Update big table of even and odd values", "[update][.]") {
unique_ptr<QueryResult> result;
DuckDB db(nullptr);
Connection con(db), con2(db);
// create... |
require 'test_helper'
class ZimsControllerTest < ActionController::TestCase
setup do
@zim = zims(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:zims)
end
test "should get new" do
get :new
assert_response :success
end
test "shoul... |
<gh_stars>0
class User < ApplicationRecord
has_many :events
validates :password, confirmation: true
validates :password_confirmation, presence: true
has_secure_password
end
|
#!/usr/bin/env bash
# set -x
SKIPPED_CODE=43
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if [[ -z "$SNABB_PCI0" ]]; then
echo "SNABB_PCI0 not defined"
exit $SKIPPED_CODE
fi
if [[ -z "$SNABB_PCI1" ]]; then
echo "SNABB_PCI1 not defined"
exit $SKIPPED_CODE
fi... |
#!/usr/bin/env bash
set -o errexit #abort if any command fails
me=$(basename "$0")
help_message="\
Usage: $me [-c FILE] [<options>]
Deploy generated files to a git branch.
Options:
-h, --help Show this help information.
-v, --verbose Increase verbosity. Useful for debugging.
-e, --allo... |
package com.surveyapp.backend.persistence.repositories;
import com.surveyapp.backend.persistence.domain.backend.Token;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface TokenRepository extends CrudRepository<Token, String>{
T... |
#!/bin/bash
dieharder -d 1 -g 22 -S 1111216179
|
import { Application, NextFunction, Request, Response } from "express";
import { NextApplication } from ".";
import { NextContextBase } from "./NextContext";
import { precisionRound } from "./utils";
export class NextProfilerOptions {
constructor(public debug: boolean = true) { }
}
export class NextDebug {
pub... |
#GCC_OUTDIR=~/opt/riscv
DFU_UTIL_SRCDIR=../gd32-dfu-utils/src
STM_FLASH_SRC_DIR=../stm32flash-code
OPENOCD_SRC_DIR=../riscv-openocd/src
#GCC_ARCHIVE=toolchain-gd32v-darwin_x86_64-9.2.0-unofficial.tar.gz
GCC_ARCHIVE=riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin.tar.gz
OPENOCD_ARCHIVE=tool-openocd-riscv-dar... |
#!/bin/bash
# psp-packages by fjtrujy
## Download the source code.
REPO_URL="https://github.com/pspdev/psp-packages"
REPO_FOLDER="psp-packages"
BRANCH_NAME="master"
if test ! -d "$REPO_FOLDER"; then
git clone --depth 1 -b $BRANCH_NAME $REPO_URL && cd $REPO_FOLDER || { exit 1; }
else
cd $REPO_FOLDER && git fetch orig... |
#!/bin/bash
./start_cpp11.sh -v ~/dev/quansight/conda-recipes:/opt/app-root/src/code -v /opt/miniconda_pkg:/opt/miniconda_pkg
|
# Initialize the environment variables ORDERER_ADDRESS & MSP ID
source ./set-env.sh
# Peer Need to be launched under its own Identity
export CORE_PEER_MSPCONFIGPATH=./fabric-ca/client/acme/acme-peer1/msp
#peer node start -o $ORDERER_ADDRESS
peer node start |
export function isUserLinkSame(link: IUserLinkStat, value: string, windowsOptions?: Partial<IShortcutOptions>) {
if (!link.exists) {
return false;
}
if (isWindows) {
if (windowsOptions) {
return windowsOptions.target === value;
} else {
return false; // No options provided for Windows
... |
'use strict';
var test = require('ava');
var SriStatsWebpackPlugin = require('..');
test('receives the algorithm', function(t) {
var plugin = new SriStatsWebpackPlugin({
algorithm: 'sha256'
});
t.is(plugin.getAlgorithm(), 'sha256', 'algorithm did not match expected');
});
|
<gh_stars>10-100
package com.telenav.osv.data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import org.joda.time.DateTime;
import com.telenav.osv.data.frame.database.entity.FrameEntity;
import com.telenav.osv.data.loc... |
#!/bin/bash
# Postgres
# the `lsb_release` prints linux-mint's codename
# of which pg has no idea, so
U='UBUNTU_CODENAME='
DISTRO=`cat '/etc/os-release' | grep "$U"`
if [ ! -z "$DISTRO" ]; then
DISTRO="${DISTRO/$U/}"
else
DISTRO=`lsb_release -cs`
fi
echo "DISTRO: '$DISTRO'"
SRC="deb http://apt.postgresql.org/pu... |
#!/bin/csh
# generated by BIGNASim metatrajectory generator
#$ -cwd
#$ -N BIGNaSim_curl_call_BIGNASim56697e538eb6b
#$ -o CURL.BIGNASim56697e538eb6b.out
#$ -e CURL.BIGNASim56697e538eb6b.err
# Launching CURL...
# CURL is calling a REST WS that generates the metatrajectory.
curl -i -H "Content-Type: application/json" -X... |
#!/bin/sh
#
# Run the first time to setup keys
#
set -e
sudo chown packager:packager ~/.abuild/
abuild-keygen -a -i
|
<filename>interview-bookmark/linked-lists/problems/kth-to-last.java
// Return Kth to Last: Implement an algorithm to find the kth to last element of a singly linked list.
int LinkedListSize(LinkedlistNode head){
int len = 0;
while (head != null) {
len++;
head = head.next;
}
return len;
}
LinkedListSiz... |
<gh_stars>0
#pragma once
#include <fstream>
#include <memory>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <opengl.hpp>
namespace gl {
class Shader {
public:
Shader(GLenum type);
Shader(const std::string& filename, GLenum type = GL_FALSE);
Shader(const Shader& other) =... |
#!/bin/bash
for bashfile in ./bashfiles/${1}/*
do
echo ${bashfile}
${bashfile}
done
|
#!/bin/bash
echo "\n----------- 开始进入指定文件夹 --------------\n";
cd package/lean/
# 添加主题
rm -rf luci-theme*
git clone https://github.com/esirplayground/luci-theme-atmaterial-ColorIcon
git clone https://github.com/Aslin-Ameng/luci-theme-Light
svn checkout https://github.com/kenzok8/openwrt-packages/trunk/luci-theme-opentopd... |
<filename>samples/server/petstore/go-api-server/go/api_store.go
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/... |
package gv
package isi
package view
import language.{ postfixOps }
import collection.{ IndexedSeq }
object IndexedSeqConcatenation {
def Catchall[T]: PartialFunction[Int, T] = PartialFunction.empty
def apply[T](seqs: Traversable[IndexedSeq[T]]): IndexedSeq[T] = new IndexedSeq[T] {
private[this] final val g... |
#! /bin/sh
log() {
printf "\nCalled as: $0: $cmdargs\n\n"
printf "Start time: "; /bin/date
printf "Running as user: "; /usr/bin/id
printf "Running on node: "; /bin/hostname
printf "Node IP address: "; /bin/hostname -I
printf "\nEnvironment:\n\n"
#printenv | sort
}
# load data from the input file
awk '
... |
#ifndef _BGM_H_
#define _BGM_H_
#define BGM_BASE 0x1000585
#define BGM_COUNT 85
u32 SetBGM(u32 original);
#endif // _BGM_H_
|
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
package com.microsoft.appcenter.distribute;
import android.support.annotation.VisibleForTesting;
import com.microsoft.appcenter.AppCenter;
/**
* Distribute constants.
*/
public final class DistributeConstants {
... |
const input = process.argv.slice(2).join(" ");
const words = input.split(" ");
console.log(`Number of words in the text: ${words.length}`); |
<filename>website/apps/invite_remixer/jinja_tags.py
import uuid
from django.utils.safestring import mark_safe
from jinja2 import Markup, contextfunction
from canvas import template
from apps.invite_remixer.urls import absolute_invite_url
from canvas.templatetags.jinja_base import global_tag, render_jinja_to_string
re... |
package service_test
import (
. "cf/commands/service"
"cf/configuration"
"cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
testapi "testhelpers/api"
testassert "testhelpers/assert"
testcmd "testhelpers/commands"
testconfig "testhelpers/configuration"
testreq "testhelpers/requirements"
testte... |
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# bookmark favourite paths
# ------------------------------------------------------------------------------
#
# TODO: add dir lock
usage() {
cat >&2 << EOF
Usage: ${0##*/} [OPTIONS] <command>
${0##*/} [OPTIONS] add ... |
#!/usr/bin/env sh
sudo apt-get update
sudo apt-get install -y \
libhdf5-dev \
pkg-config \
libfreetype6-dev \
libpng12-dev \
python-dev \
python-pip
sudo pip install Cython
sudo pip install --upgrade -r /home/vagrant/pyexperiment/docker/requirements.txt
echo "export PYTHONPATH='.'" >> /... |
package com.plarpc.test;
import com.plarpc.api.PlaRpcServerApi;
import com.plarpc.implementation.PlaRpcServerImpl;
import java.io.IOException;
public class ServerMain {
public static void main(String[] args) throws IOException, InterruptedException {
Test test = new TestImpl();
PlaRpcServerApi<Te... |
package org.jeecg.modules.bim.service.impl;
import org.jeecg.modules.bim.entity.BimModel;
import org.jeecg.modules.bim.mapper.BimModelMapper;
import org.jeecg.modules.bim.service.IBimModelService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
... |
package com.yoavfranco.wikigame.HTTP;
import android.os.AsyncTask;
import com.yoavfranco.wikigame.HTTP.WikiGameInterface.WikiError;
import com.yoavfranco.wikigame.utils.Consts;
import com.yoavfranco.wikigame.utils.Utils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import j... |
#!/bin/sh
logit "\n"
info "2 - Docker Daemon Configuration"
# 2.1
check_2_1="2.1 - Do not use lxc execution driver"
get_command_line_args docker | grep lxc >/dev/null 2>&1
if [ $? -eq 0 ]; then
warn "$check_2_1"
else
pass "$check_2_1"
fi
# 2.2
check_2_2="2.2 - Restrict network traffic between containers"
get_c... |
<filename>gulpfile.js<gh_stars>1-10
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var header = require('gulp-header');
var banner = [
'// x.coffee -- JavaScript/CoffeeScript implementation of Knuth\'s Algorithm X',
'// (c) 2015- <NAME> & contributors',
'// x.coffee is licensed under the MIT li... |
<filename>src/main/java/com/util/FileUtils.java
package com.util;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
public class FileUtils {
public static List readyFileLines(String filePath) {
List<String> lines =... |
<gh_stars>0
package io.smallrye.mutiny.operators;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.reactivestreams.Su... |
<gh_stars>0
package com.koval.resolver.processor.documentation.core;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.when;
import org.junit.jupiter.api.BeforeEach;
import org.j... |
<?php
function everySecondChar($str) {
$result = "";
// Iterate through the string
for ($i = 0; $i < strlen($str); $i+=2) {
$result .= $str[$i];
}
return $result;
}
$string = 'This is a string.';
$result = everySecondChar($string);
echo $result;
?>
Output: Ti saisrn |
<reponame>invinst/CPDB<gh_stars>10-100
from django import forms
from document.models import Document
class DocumentRequestStatusForm(forms.Form):
id = forms.IntegerField(required=True)
status = forms.ChoiceField(required=True, choices=[
('pending', 'pending'),
('requesting', 'requesting'),
... |
public class LicenseAnalyzer {
public static int countLicenseOccurrences(String sourceCode) {
int count = 0;
int index = 0;
while (index < sourceCode.length()) {
int start = sourceCode.indexOf("/*", index);
if (start == -1) {
break;
}
... |
import { Component } from '@angular/core';
@Component({
selector: 'iai-inspiration',
templateUrl: './inspiration.component.html',
styleUrls: ['./inspiration.component.scss']
})
export class InspirationComponent { } |
<gh_stars>1-10
export default [
'Aabraham',
'Aada',
'Aadan',
'Aadolf',
'Aafje',
'Aage',
'Aali',
'Aalis',
'Aaliyah',
'Aamadu',
'Aamina',
'Aaminah',
'Aaminata',
'\'Aamir',
'Aamir',
'Aamu',
'Aapeli',
'Aapo',
'Aarenf',
'Aarne',
'Aaro',
'Aarón',
'Aaron',
'Aart',
'Aarthi',
... |
#!/bin/bash
# Copyright 2019 Google LLC
#
# 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 agreed to ... |
// Package kcp - A Fast and Reliable ARQ Protocol
//
// Acknowledgement:
// <EMAIL> for inventing the KCP protocol
// xtaci@github for translating to Golang
package kcp
//go:generate go run github.com/nilhost/overnet/common/errors/errorgen
|
<reponame>radi-js/radi
import flatten from '../../utils/flatten';
import isComponent from '../../component/utils/isComponent';
import Component from '../../component/Component';
import r from '../index.js';
import Listener from '../../listen/Listener';
/**
* @param {function} value
* @returns {object}
*/
const filt... |
<filename>frontend/src/component/Donate.tsx<gh_stars>1-10
import React, { useEffect, useState } from 'react';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import AcUnitIcon from '@material-ui/icons/AcUnit';
import { fetchServers, Person } from '../api';
import Button... |
#include<iostream>
#include<vector>
using namespace std;
auto add_vectors(vector<int> v1, vector<int> v2)
{
vector<int> result;
size_t size1 = v1.size();
size_t size2 = v2.size();
size_t min_size = min(size1, size2);
size_t max_size = max(size1, size2);
for(int i = 0; i < min_size; i++)
{... |
<reponame>briwa/isoisoiso<gh_stars>0
import Phaser from 'phaser-ce';
import Hero from 'src/app/chars/hero';
import SomeDude from 'src/app/chars/commoners/some-dude';
import Merchant from 'src/app/chars/merchants/basic';
import SpriteHuman from 'src/app/sprites/human';
import MapPlain from 'src/app/maps/plain';
class... |
<filename>core/modules/editor/operations/text/redo.js
/*\
title: $:/core/modules/editor/operations/text/redo.js
type: application/javascript
module-type: texteditoroperation
Text editor operation to tell the browser to perform an redo
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use... |
<reponame>Devsart/pokedex-rn-ts
/* eslint-disable prettier/prettier */
import AsyncStorage from '@react-native-community/async-storage';
interface Pokemon {
evolucao: string,
name: string,
uri: string,
}
class LocalStorage {
async getItem(name: string): Promise<Pokemon> {
return await Asy... |
#!/bin/sh
# Simple release archive build script for Unix systems.
# I typically build the library with a cross compiler.
# Set the name of the archive and the directory the
# files go into
export dir_name=clib2-1.`cat c.lib_rev.rev`
# Start with a clean slate
rm -rf $dir_name
# Create the directory, copy all the li... |
/**
* Copyright © 2014-2021 The SiteWhere Authors
*
* 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... |
<filename>src/events/ReadyEvent.js
module.exports = class Ready {
constructor(client) {
this.client = client;
this.name = "ready";
this.once = true;
}
async run() {
console.log('[BOT] O client do LabVerde ta on');
}
}
|
'use strict';
export interface Rotation {
x: number;
y: number;
angle: number;
}
|
def count_vowels_consonants(text):
vowels = 0
consonants = 0
# Loop through each character in the text
for char in text:
# Check if it is a vowel
if char in ('a', 'e', 'i', 'o', 'u'):
vowels += 1
# Check if it is a consonant
elif char.isalpha():
... |
fn handle_protected_execution(
handler_data: &HandlerData,
trampoline: Trampoline,
ctx: *mut Ctx,
func: *const Func,
param_vec: *const u64,
return_vec: *mut u64,
) -> RuntimeResult<()> {
if CURRENT_EXECUTABLE_BUFFER.get() == ptr::null() {
return Err("CURRENT_EXECUTABLE_BUFFER is null... |
package com.maufonseca.haste.presentation.home;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.It... |
# Function to be optimized
def func(x):
return x**2
# Set the budget to \100
budget = 100
# Initialize the best value with budget + 1
best_value = budget + 1
# Initialize the best parameter with 0
best_parameter = 0
# Iterate through all possible parameters within the budget
for x in range(0, budget):
# Ca... |
import play.libs.ws.*;
public class WSUtils {
//metodo helper que devuelve el token de sesion de un usuario
public static String getSessionCookie(String login,String password) {
//si no logea bien, devolvera un token null
String sessionCookie=null;
//hacemos el post de login
WS... |
<filename>verify/wavelet-tree.yosupo-range-kth-largest.test.cpp<gh_stars>1-10
#define PROBLEM "https://judge.yosupo.jp/problem/range_kth_smallest"
#include <bits/stdc++.h>
using namespace std;
#include "data-structure/wavelet-tree.hpp"
int main() {
int N, Q;
cin >> N >> Q;
vector<int> A(N);
map<int, int> M;
for... |
#!/usr/bin/env bash
# lint code in lib directory
echo "pylint --rcfile=.pylintrc src/genomehubs -f parseable -r n" &&
pylint --rcfile=.pylintrc src/genomehubs -f parseable -r n &&
# check codestyle
echo "pycodestyle src/genomehubs --max-line-length=120" &&
pycodestyle src/genomehubs --max-line-length=120 &&
# check do... |
let str = "The quick brown fox jumps over the lazy dog.";
let longestWord = "";
let arr = str.split(" ");
arr.forEach(function(word) {
if (word.length > longestWord.length) {
longestWord = word;
}
});
console.log("Longest Word: " + longestWord); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.