text stringlengths 1 1.05M |
|---|
<reponame>fiscoflex/erp
package mx.fiscoflex.contabilida.empresa;
public class ErrorEmpresa {
public static String NOMBRE_ES_REQUERIDO = "E1201";
public static String NOMBRE_ES_MUY_LARGO = "E1202";
public static String RFC_ES_REQUERIDO = "E1203";
public static String RFC_FORMATO_INVALIDO = "E1204";
}
|
#!/bin/bash
nb-clean add-filter --remove-empty-cells
|
for i, num1 in enumerate(nums):
for j, num2 in enumerate(nums):
if (i != j):
for k, num3 in enumerate(nums):
if (j != k) and (i != k):
if num1 + num2 + num3 == 0: # Check if all three numbers add up to 0
print(f"Triplet: {num1}, {num2},... |
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]
function pre_build {
# Any stuff that you need to do before you start building the wheels
# Runs in the root directory of this repository.
pushd protobuf
yum install -y devtoolset-2-libatomic-devel
# Build protoc
./autogen.sh
... |
package ru.job4j.servlets;
import ru.job4j.controller.BookStore;
import ru.job4j.model.Book;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io... |
from typing import List, Tuple, Any
from ordered_set import OrderedSet
def organize_blocks(block_data: List[Tuple[float, float, Any]]) -> Tuple[OrderedSet[Tuple[float, float, Any]], List[float]]:
organized_set = OrderedSet()
cumulative_y_coordinates = []
block_data.sort(key=lambda x: x[0]) # Sort the blo... |
require 'rails_helper'
RSpec.describe Box, :type => :model do
subject(:requester) { Requester.new(first_name: "Jane", last_name: "Doe", street_address: "122 Boggie Woogie Avenue", city: "Fairfax", state: "VA", zip: "22030", ok_to_email: true, ok_to_text: false, ok_to_call: false, ok_to_mail: true, underage: false) }... |
<reponame>valenterry/bamboomigrate
package bamboomigrate
import bamboomigrate.Transform.StepConstraint.OnlySteps
import bamboomigrate.Transform.{ApplyTransformationStep, transformationByAnyStep}
import bamboomigrate.TypelevelUtils.{LazyLeftFolder, LazyLeftScanner, getFieldValue}
import shapeless._
import shapeless.lab... |
from django.core.urlresolvers import reverse
from slacker.django_backend.conf import SLACKER_SERVER
def generate_slack_channel_url(channel_name):
# Using the reverse function to generate the URL for the Slack channel
channel_url = reverse('channel', kwargs={'channel_name': channel_name})
# Combining t... |
<filename>src/lang/lang.js
import English from "./en";
import SimplifiedChinese from "./zh-cn";
export default {
en: {
label: "English",
lang: English
},
zhcn: {
label: "Simplified Chinese",
lang: SimplifiedChinese
}
};
|
#!/bin/bash
# Script to create input files for PTMC runs from template
# Note the variables being added to the array must be in quotes,
# otherwise it will add nothing
source $1
fields=()
vars=()
#echo "Input directory:"; read inpdir
fields+=(INPDIR)
vars+=("$inpdir")
#echo "System:"; read system
fields+=(SYSTEM)... |
<gh_stars>1-10
/**
* EdDSA-Java by str4d
*
* To the extent possible under law, the person who associated CC0 with
* EdDSA-Java has waived all copyright and related or neighboring rights
* to EdDSA-Java.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <https://creativ... |
let regexPattern = "^[a-z]+$";
let inputString = "foo";
if (inputString.match(regexPattern)) {
console.log(true);
} else {
console.log(false);
} |
package me.legit.models.reward;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import me.legit.models.equipment.CustomEquipment;
import me.legit.models.equipment.CustomEquipmentCustomization;
import me.leg... |
BUILD_DATE=`date +%Y-%m-%d-%H.%M.%S`
ArchivePath=Agora-Mac-Tutorial-${BUILD_DATE}.xcarchive
xcodebuild clean -project "Agora-Mac-Tutorial-Objective-C.xcodeproj" -scheme "Agora-Mac-Tutorial-Objective-C" -configuration Release
xcodebuild CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project "A... |
const json = {
"name": "John Doe",
"age": 42,
"address": {
"street": "123 Main Street",
"city": "Boston",
"state": "MA"
}
}
const result = Object.keys(json).map(key => [key, json[key]]);
console.log(result); |
export enum HttpMethod {
GET = "GET",
POST = "POST"
} |
from onnx_tf.common import exception
from onnx_tf.handlers.frontend_handler import FrontendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_op
@onnx_op("TopK")
@tf_op("TopKV2")
class TopK(FrontendHandler):
@classmethod
def args_check(cls, node, **kwargs):
if node.i... |
#!/bin/bash
#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
# Exit on first error, print all commands.
set -ev
# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
docker-compose -f docker-compose.yml up -d
# wait for Hyperledger Fabric to start
# incase of ... |
from setuptools import setup
# # read the contents of your README file
# from pathlib import Path
# this_directory = Path(__file__).parent
# long_description = (this_directory / "README.md").read_text()
setup(
name='concurrentbuffer',
version='0.0.5',
author='<NAME>',
author_email='<EMAIL>',
packa... |
<filename>PlateCodeInqury/wwwroot/js/site.js
$("#getValueBtn").click(() => {
if (checkValidity($("#plateCode").val())) {
const data = {
plateCode: $("#plateCode").val()
}
$.ajax({
type: "POST",
url: "/Home/GetPlateValue",
data: data,
... |
<filename>app/app.js
'use strict';
var app = angular.module('gg', ['ngRoute', 'ngResource']);
app.config(config);
config.$inject = ['$routeProvider', '$locationProvider'];
function config($routeProvider, $locationProvider, $httpProvider){
$locationProvider.hashPrefix('');
$routeProvider.
when('/', {
template... |
export const global = (state = {}, action) => {};
|
#ifndef ODFAEG_CREATOR_RECTANGULAR_SELECTION_HPP
#define ODFAEG_CREATOR_RECTANGULAR_SELECTION_HPP
#include "odfaeg/Graphics/rectangleShape.h"
class RectangularSelection : public odfaeg::graphic::Drawable {
public :
RectangularSelection();
void setRect(int posX, int posY, int posZ, int width, int height, int dep... |
def reverse_list_without_function(list_):
result = []
for i in range(len(list_)-1,-1,-1):
result.append(list_[i])
return result
list_ = [1,2,3,4]
print(reverse_list_without_function(list_)) # => [4, 3, 2, 1] |
#!/bin/bash
#
# Use politeiawwwcli to test the politeiawww API routes
readonly PROP_STATUS_NOT_REVIEWED=2
readonly PROP_STATUS_CENSORED=3
readonly PROP_STATUS_PUBLIC=4
cmd="politeiawwwcli -j"
admin_email=""
admin_password=""
override_token=""
print_json="false"
vote="false"
# expect_success executes the passed in co... |
<gh_stars>1-10
package test.controller;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Context;
import org.noear.solon.core.handle.Result;
/**
* @author noear 2021/8/8 created
*/
@Mapping("/user/")
@Controller
public class UserController {... |
<reponame>Melgo4/ICS4U<filename>Assignment 6/src/zoo/TestZooStats.java<gh_stars>0
package zoo;
public class TestZooStats {
public static void main(String[] args) {
ZooStats checkout = new ZooStats();
checkout.enterItem(new Mammal("Panda Bear",3, 399));
checkout.enterItem(new Reptile("Alligator",5, 1500));
c... |
// Generated by script, don't edit it please.
import createSvgIcon from '../createSvgIcon';
import UnvisibleSvg from '@rsuite/icon-font/lib/status/Unvisible';
const Unvisible = createSvgIcon({
as: UnvisibleSvg,
ariaLabel: 'unvisible',
category: 'status',
displayName: 'Unvisible'
});
export default Unvisible;
|
<gh_stars>1-10
/**
* index页面的widget配置
* @copyright 火星科技 mars3d.cn
* @author 火星吴彦祖 2021-12-30
*/
import { defineAsyncComponent, markRaw } from "vue"
import { WidgetState } from "@mars/common/store/widget"
import { StoreOptions } from "vuex"
const store: StoreOptions<WidgetState> = {
state: {
widgets: [
... |
/*
* Copyright (c) Open Source Strategies, Inc.
*
* Opentaps is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*... |
<gh_stars>0
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
)
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcret... |
from django.http import HttpResponse
def greet_view(request):
message = "Hello, welcome to my website!"
return HttpResponse(message) |
<filename>sources/UEADB/Core/Application.hpp<gh_stars>0
#pragma once
#include <cstdlib>
#include <UEAA/Utils/SharedPointer.hpp>
#include <UEAA/Utils/ReferenceCounted.hpp>
#include <UEADB/Core/TypeDefs.hpp>
namespace UEADB
{
CommandsList ReadCommands (const std::vector <std::string> &cmdArguments);
void PrintCommands (... |
package cyclops.async.reactive.futurestream.react.simple;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import cyclops.async.reactive.futurestream.SimpleReact;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException... |
<filename>open-sphere-base/core/src/main/java/io/opensphere/core/video/VideoContentHandler.java
package io.opensphere.core.video;
import io.opensphere.core.util.Service;
/**
* Content handler for video.
*
* @param <T> The type of content handled.
*/
public interface VideoContentHandler<T> extends Service... |
package org.arquillian.cube.persistence;
import java.io.IOException;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrink... |
<filename>src/components/footer/index.js
import React from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import FooterStyle from './style'
import JsSVG from '../../assets/svgs/js.svg'
import ReactSVG from '../../assets/svgs/react.svg'
import GatsbySVG from '../../assets/svgs/gatsby.svg'
import StyledComponen... |
#!/bin/bash
# set the path for the secrets below to be created in vault or credhub
export concourse_root_secrets_path="/concourse"
export concourse_team_name="team-name"
export concourse_pipeline_name="pcf-nsxt-config"
# VAULT or CREDHUB - targeted secrets management system
export targeted_system="VAULT"
# This scrip... |
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... |
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... |
<gh_stars>1-10
/*******************************************************************************
* Copyright 2020 <NAME> | ABI INC.
*
* 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
*
... |
<gh_stars>1-10
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
class ServiceProvider {
constructor(app) {
this.app = app;
}
/* istanbul ignore next */
register() {
throw new TypeError('Method not implemented.');
}
}
exports.default = ServiceProvider;
//# ... |
<reponame>edivansilvajr/javascript<gh_stars>0
var idade = 12
console.log (`Você tem ${idade} anos.`)
if(idade < 16) {
console.log ('Não vota !')
} else if(idade < 18 || idade > 62) {
console.log ('Voto opcional !')
}else {
console.log ('Voto obtigatorio !')
}
|
<gh_stars>10-100
package io.opensphere.csvcommon.detect.location;
import java.util.List;
import io.opensphere.core.util.MathUtil;
import io.opensphere.csvcommon.common.CellSampler;
import io.opensphere.csvcommon.detect.CellDetector;
import io.opensphere.csvcommon.detect.ValuesWithConfidence;
import io.opensph... |
<reponame>gaeacodes/insight-api-komodo<gh_stars>0
"use strict";
var bitcore = require("bitcore-lib-komodo");
var _ = bitcore.deps._;
var $ = bitcore.util.preconditions;
var Common = require("./common");
var async = require("async");
var getKomodoRewards = require("./get-komodo-rewards");
var moment = require("moment")... |
#!/bin/bash
# package type (subfolder in packager)
# default version to install
DEFAULT=5.6
if [ -z $1 ]; then
TYPE=$DEFAULT
else
TYPE=$1
fi
if [[ $TYPE != "force" ]]; then
OS_VERSION=`sw_vers -productVersion | egrep --color=never -o '10\.[0-9]+'`
if [[ $OS_VERSION == "10.13" ]]; then
echo "****"
ec... |
package local
import (
"errors"
"io/ioutil"
"os/user"
"path/filepath"
goyaml "gopkg.in/yaml.v2"
)
// BoshConfig describes a local ~/.bosh_config file
// See testhelpers/fixtures/bosh_config.yml
type BoshConfig struct {
Target string
Name string `yaml:"target_name"`
Version string `ya... |
require "test/test_helper"
class TypusUserTest < ActiveSupport::TestCase
[ %Q(<EMAIL>\n<script>location.href="http://spammersite.com"</script>),
'admin', '<EMAIL>', '<EMAIL>', '<EMAIL>', '<EMAIL>' ].each do |value|
should_not allow_value(value).for(:email)
end
[ '<EMAIL>', '<EMAIL>', '<EMAIL>', '<EMAIL... |
<filename>lang/py/pylib/06/tempfile/tempfile_tempdir.py
#!/usr/bin/env python
import tempfile
tempfile.tempdir='/I/changed/this/path'
print'gettempdir():',tempfile.gettempdir()
|
#!/bin/bash
# exit when any command fails
set -e
# echo on
set -x
git checkout master
git remote add upstream https://github.com/clelange/cds_paper_bot.git
git fetch upstream
if [[ -n $(git log ..upstream/master) ]]; then
git config --global user.email "${GITMAIL}"
git config --global user.name "${GITNAME}"
... |
<reponame>Ankuraxz/cruzhacks-2021-website<gh_stars>1-10
import * as React from "react";
import Lottie from "react-lottie";
import { ReactComponent as Grid } from "images/components/hero/grid.svg";
import { ReactComponent as Computer } from "images/components/hero/computer.svg";
import { ReactComponent as Mouse } from "... |
def caesar_cipher(message, shift):
encrypted_message = ""
for char in message:
encrypted_message += chr((ord(char)-shift)%256)
return encrypted_message |
import m from 'mithril'
import * as R from 'ramda'
import { labelStyle, showRevDecimal, labelRev, showNetworkError } from './common'
const sampleReturnCode = `new return(\`rho:rchain:deployId\`) in {
return!((42, true, "Hello from blockchain!"))
}`
const sampleInsertToRegistry = `new return(\`rho:rchain:deployId\`)... |
'use strict';
const sleep = require('mz-modules/sleep');
exports.keys = 'my keys';
let times = 0;
exports.onClientError = async (err, socket, app) => {
app.logger.error(err);
await sleep(50);
times++;
if (times === 2) times = 0;
if (!times) throw new Error('test throw');
return {
body: err.rawPacke... |
import React from 'react';
import {Row ,Col ,Tabs , Carousel} from 'antd';
import PCNewsBlock from './pc_news_block';
import PCImageBlock from './pc_news_image_block';
import PCProducts from './pc_products';
const TabPane = Tabs.TabPane;
export default class PCNewsContainer extends React.Component{
render(){
const ... |
<reponame>psyking841/spark-pipeline-toolkit<filename>BatchPipelineToolkit/src/test/scala/com/span/test/spark/batch/CommandLineTest.scala
package com.span.test.spark.batch
import com.span.spark.batch.app.{AppParams, BatchAppBase, BatchAppSettings}
import com.span.spark.batch.datasinks.SinkFactory
import com.span.spark.... |
def longest_word_length(string):
words = string.split()
longest_length = 0
for word in words:
if len(word) > longest_length:
longest_length = len(word)
return longest_length |
package io.dronefleet.mavlink.generator;
import com.squareup.javapoet.JavaFile;
import java.util.List;
import java.util.stream.Collectors;
public class MavlinkGenerator {
private final List<PackageGenerator> packages;
MavlinkGenerator(List<PackageGenerator> packages) {
this.packages = packages;
... |
<gh_stars>1-10
package eu.itdc.internetprovider.service.dto;
import javax.validation.Valid;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Valid
public class SignupRequestDTO {
@NotBlank
@Size(min = 5, max = 20)
private... |
package com.honyum.elevatorMan.activity.worker;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Ad... |
#!/usr/bin/env bash
rm fits/*.RData
mkdir $1
mkdir $1/ACCplots
mkdir $1/ROCplots
mkdir $1/varImpPlots
mv ACCplots/*.png $1/ACCplots/
mv ROCplots/*.png $1/ROCplots/
mv varImpPlots/*.png $1/varImpPlots/
mv accAll.png $1/
mv perfResults.csv $1/
mv rocAll.png $1/
|
/*
* OwO Bot for Discord
* Copyright (C) 2019 <NAME>
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
* For more information, see README.md and LICENSE
*/
const request = require('request');
const secret = require('../../tokens/wsserver.json');
exports.fe... |
import React from 'react';
class Form extends React.Component {
render() {
return (
<form onSubmit={this.props.onSubmit}>
<input type="text" name="textInput" />
<input type="submit" value="Submit" />
</form>
);
}
}
export default Form; |
#!/usr/bin/env bash
scriptdir="$( cd "$(dirname "$0")" ; pwd -P )"
simudir=$scriptdir
source /opt/intel/compilers_and_libraries/linux/mpi/intel64/bin/mpivars.sh
# get number of nodes
IFS=',' read -ra HOSTS <<< "$AZ_BATCH_HOST_LIST"
nodes=${#HOSTS[@]}
echo "Number of nodes: $nodes"
echo "Hosts: $AZ_BATCH_HOST_LIST"
#... |
#!/bin/bash
#
# Copyright 2018 The Outline 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 law or... |
import { Component, NgZone, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { TitleBarComponent } from 'src/app/components/titlebar/titlebar.component';
import { BuiltInIcon, TitleBarIcon, TitleBarIconSlot, TitleBarMenuItem } from 'src/app/components/titlebar/titlebar.ty... |
/*
* Copyright 2019-2021 Expedia, Inc.
*
* 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 ... |
import { createAction } from 'redux-act';
export const Compiling = createAction('Preview - Compiling to bytecode');
export const Compiled = createAction('Preview - Compile successful!');
export const CompileErrors = createAction('Preview - Compile error');
export const Updated = createAction('Preview - Source is updat... |
<gh_stars>0
import { AnnotatedColor } from '@/code/AnnotatedColor';
import Color from 'ts-color-class';
import SunScreenState from './sunscreenstate.js';
const state: SunScreenState = {
lampTypes: [
new AnnotatedColor(
'candle',
'Candle',
new Color([255, 147, 41]),
... |
arr = [12, 15, 8, 10]
arr[:] = [x for x in arr if x % 3 != 0] |
import sys
def start_dev_environment():
print("Starting the development environment...")
def migrate_database():
print("Migrating the database...")
def load_card_data():
print("Loading data for poetry cards...")
def load_poet_data():
print("Loading data for poets...")
def main():
if len(sys.arg... |
import statistics
def calculate_average_without_outliers(numbers, threshold):
mean = statistics.mean(numbers)
std_dev = statistics.stdev(numbers) if len(numbers) > 1 else 0 # Avoid division by zero for single-element lists
filtered_numbers = [num for num in numbers if abs((num - mean) / std_dev) <= thresh... |
<reponame>konojunya/goroutine-sample
package service
import "testing"
func TestScraping(t *testing.T) {
GetUserFromTwitter("konojunya")
}
|
#!/bin/bash
# Utilities for both OSX and Docker Linux
# Python should be on the PATH
# Only source common_utils once
if [ -n "$COMMON_UTILS_SOURCED" ]; then
return
fi
COMMON_UTILS_SOURCED=1
# Turn on exit-if-error
set -e
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
DOWNLOADS_SDIR=downloads
PYPY_URL=https://bitb... |
#!/bin/bash
runner() {
if [ "$1" = "direct" ]; then
go run main.go
elif [ "$1" = "docker" ]; then
docker build -t unfire .
# read dotenv
eval "$(cat .env <(echo) <(declare -x))"
docker run -e APP_PORT=8080 -e TWITTER_CONSUMER_KEY="$TWITTER_CONSUMER_KEY" -e TWITTER_CONSUMER_SECRET="$TWITTER_CONS... |
import ast
from typing import List, Optional
from flake8_plugin_utils import Visitor, is_none
from flake8_pytest_style.config import Config
from flake8_pytest_style.errors import (
AssertInExcept,
RaisesTooBroad,
RaisesWithMultipleStatements,
RaisesWithoutException,
)
from flake8_pytest_style.utils im... |
import Faction from '@mafia/structures/Faction';
import type Game from '@mafia/structures/Game';
const SUPPORTING_FACTIONS = ['Juggernaut', 'Witch', 'Survivor'];
export default class JuggernautFaction extends Faction {
public name = 'Juggernaut';
public winCondition = 'game/factions:nkWinCondition';
public hasWon... |
class ExtendedSet2Command:
def __init__(self, address: Address, data1=None, data2=None):
"""Init the ExtendedSet2Command."""
if data2 in [0, 1]:
raise ValueError("Error creating extended set command: data2 cannot be 0 or 1")
self._address = address
self._data1 = data1
... |
<filename>blitzd/packets/udp/PacketUDP.cpp
#include "Config.h"
#include "PacketUDP.h"
namespace Packets
{
namespace UDP
{
bool PacketUDP::Build()
{
_packet << GetCmd();
return Pack();
}
}
}
|
<filename>app.rb
# frozen_string_literal: true
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'
set :database, { adapter: 'sqlite3', database: 'barbershop.db' }
class Client < ActiveRecord::Base
validates :name, presence: true, length: { in: 3..20}
validates :phone, p... |
#!/bin/bash
set -e
cut -d' ' -f4,5 libsyms.rel | uniq > libsyms.index
|
class CreateProjects < ActiveRecord::Migration[7.0]
def change
create_table :projects do |t|
t.string :name
t.string :url_opensea
t.string :url_discord
t.string :url_twitter
t.string :url_website
t.text :description
t.string :slug
t.string :image_avatar_url
t... |
import jsonRpc from 'simple-jsonrpc-js'; // Hook-up transport for simple-jsonrpc-js
export function PdRpc() {
let rpc = new jsonRpc();
rpc.toStream = (msg) => {
fetch('/rpc', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: msg,
... |
def sum_odd_recurse(num):
if num == 0:
return 0
elif num % 2 != 0:
return num + sum_odd_recurse(num - 1)
else:
return sum_odd_recurse(num - 1)
# driver code
x = 4
print(sum_odd_recurse(x)) # Output: 9 (1+3+5) |
// Controller method for handling page creation and update
public function store(Request $request)
{
// Validate the input data
$validatedData = $request->validate([
'desc_ar' => 'required|string',
'desc' => 'required|string',
'intro' => 'required|string',
'intro_ar' => 'required... |
import React from 'react'
import {Container, Segment, Button} from 'semantic-ui-react'
import {NavLink} from 'react-router-dom'
const OrderCompleteConfirm = props => {
return (
<div>
<br />
<Container>
<Segment>
<div className="cart-topbar">
<div>
<h1>Purch... |
<gh_stars>1-10
import { Exam } from '@prisma/client';
import { injectable, inject } from 'tsyringe';
import { GetExamsByUserIdDTO } from '../dtos/GetExamsByUserId.dto';
import { IExamRepository } from '../repositories/IExamRepository';
@injectable()
export class GetExamsByUserIdService {
constructor(
@inject('Pr... |
/*
* Copyright 2021 Solace Corporation. 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 ... |
<gh_stars>1-10
import os, sys
from PIL import Image
for infile in os.listdir(sys.argv[1]):
outfile = os.path.splitext(infile)[0] + ".transparent.png"
if infile != outfile:
try:
im = Image.open(infile)
im = im.convert("RGBA")
datas = im.getdata()
newData... |
function binarySearch(arr, elem) {
let start = 0;
let end = arr.length - 1;
let middle = Math.floor((start + end) / 2);
while (arr[middle] !== elem && start <= end) {
if (elem < arr[middle]) {
end = middle - 1;
} else {
start = middle + 1;
}
middle = Math.floor((start + end) / 2);
}
return arr[middle] === ... |
def replace_placeholders(words, template):
replaced_template = template
for i in range(len(words)):
placeholder = "{" + str(i) + "}"
replaced_template = replaced_template.replace(placeholder, words[i])
return replaced_template
# Test the function
words = ["program", "Python", "know", "Every... |
#! /bin/bash
echo -e "Hi, please type the word: \c "
read word
echo "The word you entered is: $word"
echo -e "Can you please enter two words?"
read word1 word2
echo "Here is your input: \"$word1\" \"$word2\""
echo -e "How do you fell about bash scripting?"
# read stores the replay in the build-in variable
read... |
// Taussig
//
// Written in 2013 by <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of th... |
<filename>chrome-extension/background.js
const ContextMenuId = 'a';
const createContextMenu = () => {
chrome.contextMenus.create({
title: 'ページをメモ(Googleカレンダーに追加)',
contexts: [
'page',
'selection',
],
id: ContextMenuId,
});
};
chrome.runtime.onInstalled.addListener(createContextMenu);
chrome.runtime.o... |
#!/usr/bin/env bats
load test_helper
setup() {
mkdir -p "$NODENV_TEST_DIR"
cd "$NODENV_TEST_DIR"
}
create_file() {
mkdir -p "$(dirname "$1")"
touch "$1"
}
@test "detects global 'version' file" {
create_file "${NODENV_ROOT}/version"
run nodenv-version-file
assert_success "${NODENV_ROOT}/version"
}
@te... |
#$ -S /bin/bash
#$ -e /net/data/GTEx/eo_files
#$ -o /net/data/GTEx/eo_files
#$ -l mf=15G
#$ -V
mkdir -p /net/data/GTEx/GTEx_Analysis_v7_QTLs/GTEx_Analysis_v7_eQTL_all_associations/whole_blood/regions
cd /net/data/GTEx/GTEx_Analysis_v7_QTLs/GTEx_Analysis_v7_eQTL_all_associations/whole_blood
while read -r line; do
chr... |
#!/bin/bash
# Entry script inside the container
set -e
echo Starting Docker script
echo "node version:"
node --version
echo "npm version:"
npm --version
echo "os info:"
uname -a
echo "Starting tests"
cd /app
npm run test:integration
echo Ending Docker script
|
<gh_stars>0
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.puc_rio.inf.les.med.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
... |
// Set the dimensions and margins of the graph
var width = 450
var height = 450
var margin = 40
// The radius of the pie chart is half the width or half the height (smallest one). I subtract a bit from the radius to make sure it fits within the canvas
var radius = Math.min(width, height) / 2 - margin
// Create svg c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.