text stringlengths 3 1.05M |
|---|
const getAllTimePost = require('./getAllTimePost');
/**
* @param {('tags' | 'keywords' | 'categories')} type
*/
const getTagsAndCategories = (type) => {
/** @type {string[][]} */
const initialBox = [];
switch (type) {
case 'keywords': getAllTimePost()
.filter((post) => post.frontMatter.type === 'ill... |
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["pages-category-category-module"],{
/***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/category/category.page.html":
/*!*****************************************************************************************!*\
!*** ./node_modules/raw-loader/... |
// 获取全局应用程序实例对象
const app = getApp()
// 创建页面实例对象
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
size: 20,
subtitle: '请在此输入搜索内容',
movies: [],
search: '',
loading: false,
hasMore: false
},
handleLoadMore () {
if (!this.data.hasMore) return
this.setData({ subtitle: '加载中...', ... |
/**
* @class Oskari.mapframework.bundle.featuredata2.FeatureDataBundleInstance
*
* Main component and starting point for the "featuredata2" functionality.
*
* See Oskari.mapframework.bundle.featuredata2.FeatureDataBundle for bundle definition.
*
*/
Oskari.clazz.define("Oskari.mapframework.bundle.featuredata2.Fea... |
import itertools as itt
from collections import OrderedDict
class SemanticError(Exception):
@property
def text(self):
return self.args[0]
class Attribute:
def __init__(self, name, typex):
self.name = name
self.type = typex
def __str__(self):
return f'[attrib] {self.na... |
const lookupChar = require('../3. Char Lookup.js');
let expect = require('chai').expect;
let mocha = require('mocha');
describe('Test lookupChar', function () {
it('first parameter is non-string, should return undefined ', function () {
expect(lookupChar(1, "string")).to.equal(undefined);
});
it('b... |
module.exports = {
preset: 'ts-jest',
roots: ['<rootDir>/src', '<rootDir>/test'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
transform: {
'\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(css|less)$': '<rootDir>test/styleMock.js'
},
coverageReporters: ['json-summary', 'text', 'lcov'],
coveragePathIgnorePatterns: ['/... |
/// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* @path ch15/15.4/15.4.4/15.4.4.18/15.4.4.18-7-c-i-1.js
* @description Array.prototype.forEach - element to be retrieved is own data property on an Array-like object
*/
function testcase() {
var kValue = { };
var testResult = fa... |
from django.shortcuts import render
# Create your views here.
def show_user_chat(request):
context = {}
return render(request,'userchats/show.html',context) |
$(function(){
var break1 = 1000;
var dataURL = 'https://docs.google.com/spreadsheets/d/1TC-h9T0NDX3NYeruEdfROaN894dm-VtKh0SKZO-9ets/pubhtml';
Tabletop.init({
key: dataURL,
callback: processData,
simpleSheet: true
});
if ( $(window).width() < break1 ) {
$('#listings').css('marginTop', $('header').outerHe... |
from .call_stack import Thread
from .object import Object
from .path import Path
class Choice(Object):
text: str
index: int
source_path: str
target_path: Path
thread_at_generation: Thread
original_thread_index: int
is_invisible_default: bool
def __init__(self):
super().__init_... |
var Bluebird = require('bluebird');
var Chalk = require('chalk');
var Cli = require('structured-cli');
var ConfigFile = require('../../lib/config');
var Sandbox = require('sandboxjs');
var SuperagentProxy = require('superagent-proxy');
var UserAuthenticator = require('../../lib/userAuthenticator');
var _ = require('lod... |
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./utils.cjs.production.min.js');
} else {
module.exports = require('./utils.cjs.development.js');
} |
/**
* Controller for handling basic camera events on a Landmarker.
*
* A landmarker in general has complex state - what landmarks are selected,
* what mesh is being used, lighting arrangements, and so on. The camera's
* behavior however is simple - in response to certain mouse and touch
* interactions, the camera... |
//>>built
define("dojo/cldr/nls/zh-hant/indian",{"field-second":"\u79d2","field-year-relative+-1":"\u53bb\u5e74","field-week":"\u9031","field-month-relative+-1":"\u4e0a\u500b\u6708","field-day-relative+-1":"\u6628\u5929","months-format-narrow":"1 2 3 4 5 6 7 8 9 10 11 12".split(" "),"field-day-relative+-2":"\u524d\u592... |
import Vue from 'vue'
import App from './App'
import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import {config} from './setting'
Vue.use(VueResource)
Vue.use(VueRouter)
Vue.http.options.emulateJSON = true
var router = new VueRouter()
var Home = Vue.extend({
template: '<p>我是首页</p>',
cr... |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview
* settings-slider wraps a cr-slider. It maps the slider's values from a
* linear UI range to a range of real values. When |value| ... |
from account.models import Account
from django.db import models
from time import time
def get_upload_file_name(instance, filename):
return "uploaded_files/%s" % filename
# TODO: OneToOne may be better instead of using username
class SolverListModel(models.Model):
username = models.CharField(max_length=30, nu... |
var nodebb = require('../nodebb'),
Groups = nodebb.Groups;
var config = require('../config');
(function (utils) {
//for visit control
utils.canMark = function (tid, uid, callback) {
config.getSettings(function(err,setting){
Groups.isMember(uid, setting.group, callback);
})
};
}(module.exports));
|
from wss_tools.utils.io import output_xml
def test_output_xml(tmpdir):
filename = str(tmpdir.join('simple.xml'))
xmldict = {'foo': 'bar'}
output_xml(xmldict, filename)
with open(filename) as f:
lines = f.readlines()
assert len(lines) == 2
assert lines[0] == '<?xml version="1.0" ?>\n'... |
// theme.js
export const blueTheme = {
body: "#EDF9FE",
text: "#001C55",
highlight: "#A6E1FA",
dark: "#00072D",
secondaryText: "#7F8DAA",
imageHighlight: "#0E6BA8",
compImgHighlight: "#E6E6E6",
jacketColor: "#0A2472",
headerColor: "#0E6BA877",
};
export const brownTheme = {
body: "#FFFEFD",
text:... |
"""
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.
"""
import bisect
import logging
import math
import pickle
import random
import warnings
from pathlib import Path
import lmdb
import numpy as np... |
import { expect } from 'chai';
import { fromJS } from 'immutable';
import { reducer as maintainersReducer, MaintainersActions, MaintainersTypes } from '../maintainers.redux';
describe('Maintainers: redux', () => {
const state = fromJS({
items: [],
});
describe('reducer', () => {
it('should return init... |
// console.log("main.js loaded");
var uni = (function () {
var template = $("body").data("template");
switch (template) {
case 'grd':
// Active Template Class
$("body").addClass(template);
// $("body").addClass("scroll-nav");
// console.log("Template: "+template);
break;
case 'pos':
$(... |
from flask import Flask, render_template, request, redirect, url_for
import mysql.connector
from flask_classful import FlaskView
from orders_class import OrderView
from products_class import ProductView
from stocks_class import StocksView
from info_class import InfoView
mydb = mysql.connector.connect(
host="localho... |
import React from 'react';
import CharacterSheet from '../character-sheet';
import Player from './Player';
import Clipboard from '../utils/Clipboard';
import TestUtils from '../utils/TestUtils';
import CharacterData from '../model/CharacterData';
describe('CharacterSheet', () => {
let component;
let componentR... |
import React from 'react';
import { WebView } from 'react-native-webview';
function WebScreen({ route }) {
const { url } = route.params;
return <WebView source={{ uri: url }} />;
}
export default WebScreen;
|
"""Create Notepad using Tkinter."""
from tkinter import *
from tkinter import messagebox
from tkinter.constants import END, NONE
def YesClick():
global Name
Name = str(FileName.get()) + ".txt"
save = open(str(Name), "a")
save.write(text_area.get("1.0", END))
text_area.delete("1.0", END)
new_w... |
class Tree {
constructor(children = []) {
this.children = children;
}
}
function treeToString(tree) {
let elemsStr = '';
tree.children.forEach(function (elem) {
elemsStr += nodeToString(elem);
});
return "{" + elemsStr + "}";
}
class Node {
constructor(label, resID, childre... |
const { validateUserRegister } = require("../middleware/auth");
const User = require("../models/user");
const express = require("express");
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const config = require("config");
const userRouter = express.Router();
// Registers user
userRouter.post("... |
import {
handleChangePage,
handleSetPageSize,
exportConfig,
buildActiveFilters,
removeFilters
} from './TableToolbarHelper';
const mockGeneralFilters = {
rule_presence: "true",
sort: "-public_date",
};
const mockGeneralChip = {
key: 'rule_presence',
multiValue: [ 'true' ],
cat... |
import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries, drop_schemas, create_schemas
def drop_tables(cur, conn):
"""
Drops all the existing tables.
"""
for query in drop_table_queries:
cur.execute(query)
conn.commit()
print('Tables Drop... |
class Computer{
mood = 0;
library = ['apple', 'hello', 'aloha', 'seed', 'christ', 'computer', 'men', 'like', 'kill', 'fruit', 'bottle', 'water', 'meat', 'master',
'mistress', 'cream', 'child', 'wild', 'element', 'class', 'number', 'count', 'input', 'output'];
makeMoodGood(){
this.mood++;
}
makeMoodBa... |
/**
* Chat system
*
* @param {SocketClient} client
*/
function Chat(client)
{
this.client = client;
this.currentMessage = new Message();
this.messages = [];
this.room = null;
this.$scope = null;
this.feed = null;
this.talk = this.talk.bind(thi... |
let fs = require('fs'),
request = require('request-promise'),
cheerio = require('cheerio')
let geojson = JSON.parse(fs.readFileSync('./data/all.gjson', 'utf8')),
details = JSON.parse(fs.readFileSync('./data/details.json', 'utf8')),
keys = {}
details.forEach((d,di)=>{
keys[d.title] = di
})
geojson.features.forEa... |
const parseId = (size, matchedStr) => {
const id = parseInt(matchedStr, 10)
if (id < 0 || id >= size || id !== id) {
return undefined
}
return id
}
export default parseId
|
/****************************************************************************
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation... |
// modules are defined as an array
// [ module function, map of requireuires ]
//
// map of requireuires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the requireuire for previous bundles
(function outer (modules, cache, entry) {
//... |
const path = require("path");
const { VueLoaderPlugin } = require("vue-loader");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { ModuleFederationPlugin } = require("webpack").container;
module.exports = (env = {}) => ({
mode: "develop... |
/*! For license information please see 2.661418fb.chunk.js.LICENSE.txt */
(this.webpackJsonpcast=this.webpackJsonpcast||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(189)},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(v... |
$(document).ready(function() {
/*
$('.btn-add').click(function(event) {
var collectionHolder = $('#' + $(this).attr('data-target'));
var prototype = collectionHolder.attr('data-prototype');
var form = prototype.replace(/__name__/g, collectionHolder.children().length);
collectionHolder.... |
from .shapenet import ShapeNet
from .modelnet import ModelNet
|
module.exports = function(config){
config.set({
basePath : './',
files : [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/common/**/*.js',
'app/view*/**/*.js'
],
... |
function calcSpaceGridLAB(){
var numberOfSteps = 20;
var numberOfParticles = 20;
var radStep = 1.0/numberOfParticles;
var lightStep = 100/numberOfSteps;
var tmpLABColor = new classColor_LAB(0,0,0);
var tmpLABColorTest = new classColor_LAB(0,0,0);
positionsLAB=[];
labABMax = 0;
for (var i = 1; ... |
var classgui_1_1Element =
[
[ "Type", "classgui_1_1Element.html#a1d44588cdbf972bb9a472a09313342f1", [
[ "LABEL", "classgui_1_1Element.html#a1d44588cdbf972bb9a472a09313342f1a6f434c508ad901b8667ed22f713e52bb", null ],
[ "WINDOW", "classgui_1_1Element.html#a1d44588cdbf972bb9a472a09313342f1a70e2a9fa5d5ec49d... |
define(["exports", "../../@polymer/polymer/polymer-element.js", "../hax-body-behaviors/lib/HAXWiring.js", "../lrn-vocab/lrn-vocab.js"], function (_exports, _polymerElement, _HAXWiring, _lrnVocab) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.GlossaryTerm = void 0;... |
"""Views padrões para serem herdadas pelas apps que desejarem utilizar
as customizações implementadas.
"""
import logging
import secrets
import string
from datetime import date, datetime
from locale import normalize
import pytz
from django.conf import settings
from django.contrib import messages
from django.contrib.au... |
const db = require("../dbConfig");
const yup = require("yup");
let userSchema = yup.object().shape({
name: yup.string().required(),
password: yup.string().required(),
email: yup.string().email(),
role: yup.string().required()
});
function getAllUsers() {
return db("users");
}
async function registerUser(cr... |
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
import pykka
from mopidy import core
from mopidy.local import actor, json
from mopidy.models import Track, Album, Artist
from tests import path_to_data_dir
# TODO: update tests to only use backend, not core. we need a ... |
import React, { Component } from 'react';
import { Collapse, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';
import { Link } from 'react-router-dom';
import './NavMenu.css';
export class NavMenu extends Component {
static displayName = NavMenu.name;
constructor(props) {
super... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models as m
from django.utils.translation import ugettext_lazy as _
import hashlib
import json
from jsonfield import JSONField
from wechatpy.crypto import WeChatWxaCrypto
from wechatpy.exceptions import InvalidSignatureException
fr... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... |
const request = require("supertest");
const db = require("../data/db-config");
const server = require("../server.js");
const token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo3LCJ1c2VybmFtZSI6ImNoYW5nZWQiLCJpYXQiOjE1NjcwMTE3MzQsImV4cCI6MTU2NzQ0MzczNH0.6MakRCXd48-ToNWHRBDErLIQC5uxJK68a3QuYbWq2B0";
descri... |
// Protractor Jasmine end-to-end (e2e) test.
//
// See https://github.com/angular/protractor/blob/master/docs/getting-started.md
//
var EventsPage = require('./events_page').EventsPage;
var page = new EventsPage();
describe('event tabs', function () {
beforeEach(function () {
page.get();
});
it(... |
const cTable = require('console.table');
const inquirer = require('inquirer');
const express = require('express');
const app = express();
// Express middleware
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
const db = require('../../db/connection');
//view all roles, table with job title, r... |
import copy
import hail
from hail.utils.java import escape_str, escape_id, dump_json, parsable_strings
from hail.expr.types import *
from hail.typecheck import *
from .base_ir import *
from .matrix_writer import MatrixWriter, MatrixNativeMultiWriter
def _env_bind(env, k, v):
env = env.copy()
env[k] = v
r... |
import pandas as pd
import sqlite3
chunksize = 50000
conn = sqlite3.connect('data/db.sqlite')
cols = list(pd.read_csv('data/friends.csv',
chunksize=10).get_chunk().columns)[1:]
tp = pd.read_csv('data/friends.csv', chunksize=chunksize,
usecols=cols, iterator=True)
print('Starting...')
... |
import React from "react"
import styles from "./auth.module.scss"
import AppStoreAction from "../common/app-store-action"
export default ({ children }) => {
return (
<div className={styles.AuthLayout}>
{children}
<AppStoreAction className={styles.AppStoreAction} />
</div>
)
}
|
# Make a movie
import os
import numpy as np
import h5py
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mokas_colors import getPalette
from skimage import measure
class loadHdf5:
def __init__(self, fname, baseGroup, limits=None):
self.fname = fname
self.baseGroup = baseGrou... |
var tcpServer;
var commandWindow;
/**
* Listens for the app launching then creates the window
*
* @see http://developer.chrome.com/apps/app.runtime.html
* @see http://developer.chrome.com/apps/app.window.html
*/
chrome.app.runtime.onLaunched.addListener(function() {
if (commandWindow && !commandWindow.contentWi... |
import axios from "axios";
import React from "react";
import WaveSurfer from "wavesurfer.js";
import RegionsPlugin from "wavesurfer.js/dist/plugin/wavesurfer.regions.min.js";
import TimelinePlugin from "wavesurfer.js/dist/plugin/wavesurfer.timeline.min.js";
import { Helmet } from "react-helmet";
import { withRouter } f... |
define(["module","text"],function(module){"use strict";function preProcessTemplate(e,r,a){return r=r.replace(/<%=\s+rp\(['"]([^'"]*)["']\)\s+%>/g,function(r,a){var t=e[a];return t?STATIC_URL_PLACEHOLDER+"/static/hashed/"+t[0]:(console.warn("Unresolved rp: "+a),a)}),a&&(r=r.replace(/<!-+\s+DEBUG_ONLY\s+-+>((?!END_DEBUG_... |
export * from './math';
export * from './matrix';
export * from './classes';
|
"""
Adapted from: https://raw.githubusercontent.com/ilastik/ilastik/1.3.3-legacy/bin/train_headless.py
Note: This script does not make any attempt to be efficient with RAM usage.
(The entire label volume is loaded at once.) As a result, each image volume you
train with must be significantly smaller than th... |
$.do = {};
$.do.common = {};
$.do.config = {};
|
from django.utils.functional import Promise
from .couch import get_document_or_404
from .view_utils import reverse
def flatten_list(elements):
return [item for sublist in elements for item in sublist]
def flatten_non_iterable_list(elements):
# actually iterate over the list and ensure element to avoid conv... |
/*
function diagonalDifference(a, b, c){
var mediaLtoR = a[0] + b[1] + c[2]
var mediaRtoL = a[2] + b[1] + c[0]
console.log(Math.abs(mediaLtoR - mediaRtoL))
}
diagonalDifference([11, 2, 4],[4, 5, 6],[10, 8, -12])
*/
// function diagonalDifference(matrix){
// const length = matrix.lengt... |
import React from 'react';
import '../styles/grid-controller-page.css';
import GridControllerButton from './GridControllerButton';
// Since this component is simple and static, there's no parent container for it.
class GridControllerPanel extends React.Component {
constructor(props, context) {
super(props, conte... |
from debinterface import interfaces
from possum_common import *
class PossumNetwork(dbus.service.Object):
def __init__(self, bus_name):
dbus.service.Object.__init__(self, bus_name, '/network')
@dbus.service.method('possum.network')
@log_dbus_invoke
def echo_test(self, echo_dict):
... |
/**
* @fileoverview no variable named h
* @author yankang
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var rule = require("../../../lib/rules/not-support-component")... |
import Observer from './Observer';
class Component extends Observer {
constructor(state, selector) {
super();
this.state = state;
this.stateData = state.getState();
this.selector = selector;
}
markup() {
return ``;
}
render() {
const markup = this.m... |
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createClassNames } from '../core/utils';
var cx = createClassNames('Hits');
var Hits = function Hits(_ref) {
var hits = _ref.hits,
className = _ref.className,
HitComponent = _ref.hitComponent;
... |
from solutions import square_circumference_and_area
import unittest
import random
class TestSquareCircumferenceAndArea(unittest.TestCase):
def test_1(self):
side = 1
expected = (4, 1)
actual = square_circumference_and_area(side)
self.assertEqual(expected, actual)
def test_ra... |
# import random
# def run_ransac(data, estimate, is_inlier, sample_size, goal_inliers, max_iterations, stop_at_goal=True):
# best_ic = 0
# best_model = None
# data = list(data)
# for i in range(max_iterations):
# s = random.sample(data, int(sample_size))
# m = estimate(s)
# ic... |
(window.webpackJsonp=window.webpackJsonp||[]).push([[99],{293:function(e,o,s){!function(e){"use strict";var o="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),s="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),a=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i... |
import KudosModel from '../models/kudos.model';
const kudosData = [
{
givenByUserId: 1,
receivedByUserId: 2,
comments: 'Good job on the last project! Thanks for the hard work.',
},
{
givenByUserId: 1,
receivedByUserId: 4,
comments: 'Handled the production issue very well last week.',
},... |
# Unit test check_input_predict
# ==============================================================================
import pytest
import numpy as np
import pandas as pd
from skforecast.utils import check_predict_input
def test_check_input_predict_exception_when_fitted_is_False():
'''
Test exception is raised when... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
This module provides a wrapper for Optax optimizers so that they can be used with
NumPyro inference algorithms.
"""
from typing import Tuple, TypeVar
import optax
from numpyro.optim import _NumPyroOptim
_Params = TypeVar("_Para... |
'use strict';
import zaehlung from './birds.js'
let meinmarker;
let map = L.map('map').setView([52.4728, 13.404], 14.35);
let OpenStreetMap_DE = L.tileLayer('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="https://www.openstreetmap.o... |
import React, {Component, Fragment} from "react";
import { __ } from "../../layouts/utilities/i18n";
import { Button, ButtonGroup, Classes, Dialog, Intent } from "@blueprintjs/core";
import {withRouter} from "react-router";
import {compose} from "recompose";
import {Query, withApollo} from "react-apollo";
import gql fr... |
function hideTabsContent(tabs, contents) {
for (let i = 0; i < tabs.length; i += 1) {
tabs[i].classList.remove('form-choice-button-selected');
}
for (let i = 0; i < contents.length; i += 1) {
contents[i].classList.remove('show');
contents[i].classList.add('hide');
}
}
function showTabContent(tabNum... |
// usage: run from http://localhost:8080/admin/test
// TODO: turn this script into a proper integration test and move it outside of the app
var followModel = require('../../../models/follow.js');
exports.makeTests = function (p) {
var testVars = {};
return [
[
'fetchUserSubscriptions',
function f... |
/*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,fun... |
document.addEventListener("DOMContentLoaded", () => {
const SwalModal = (icon, title, html) => {
Swal.fire({
icon,
title,
html,
});
};
const SwalConfirm = (
icon,
title,
html,
confirmButtonText,
method,
para... |
var base58 = require('./base58');
var Crypto = require('./crypto-js/crypto');
var conv = require('./convert');
var address_types = {
prod: 0,
testnet: 111
};
var p2sh_types = {
prod: 5,
testnet: 196
};
var Address = function (bytes) {
if (typeof bytes === 'string') {
bytes = Address.decodeStrin... |
from __future__ import annotations
import multiprocessing as mp
import multiprocessing.synchronize
import threading
from contextlib import contextmanager
from functools import partial
from typing import Dict, List, Optional, Tuple
from pathlib import Path
import torch
from multiaddr import Multiaddr
import hivemind
... |
const CustomError = require("../extensions/custom-error");
module.exports = function getSeason(date) {
if (!date){
return 'Unable to determine the time of year!';
} else if (date.toDateString() == "Invalid Date"){
throw Error;
}
let month = date.getMonth()
if (month == 0 || month == 1 || month == ... |
const CustomError = require("../extensions/custom-error");
module.exports = function repeater(str, options) {
str = String(str);
let addiction = String(options.addition);
let additionSeparator = options.additionSeparator ? options.additionSeparator : "|";
let separator = options.separator ? options.separator :... |
from django import forms
from .models import GuitareModel
class GuitareForm(forms.ModelForm):
class Meta:
model = GuitareModel
fields = '__all__'
widgets = {
'nom_guitare': forms.TextInput(attrs={'class': 'form-control'}),
'type_guitare': forms.Select(attrs={'class'... |
"""SQLAlchemy models and database architecture"""
from flask_sqlalchemy import SQLAlchemy
DB = SQLAlchemy()
# Creates a 'user' Table
class User(DB.Model):
# id primary key column for 'user'
id = DB.Column(DB.BigInteger, primary_key=True)
# username column for 'user'
username = DB.Column(DB.String, n... |
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Product extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*... |
const request = require('supertest')
const app = require('../config/app')
describe('CORS Middleware', () => {
test('Should enable CORS', async () => {
app.get('/test_cors', (req, res) => { res.send('') })
const res = await request(app).get('/test_cors')
expect(res.headers['access-control-allow-origin']).... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
import sensor_msgs.msg
import csv
f = open('imu_data.csv', mode='w')
writer = csv.writer(f,delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
writer.writerow(['date','x','y','z','w'])
lastsec = 0
def callback(d):
global writer
global l... |
/**
* Copyright(c) Microsoft Corporation.All rights reserved.
* Licensed under the MIT License.
*/
class LabelExampleResponse {
/**
* @property {string} UtteranceText
*/
/**
* @property {integer} ExampleId
*/
constructor({UtteranceText /* string */,ExampleId /* integer */} =... |
import os
import argparse
import json
import datetime
from google.cloud import pubsub_v1
import tkinter as tk
import tkinter.ttk as ttk
class GcpGui(tk.Frame):
"""Basic Message Visualizer gui"""
def __init__(self, project_id, subscription_id, master=None):
tk.Frame.__init__(self, master)
self.... |
import time
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
class fbnet(nn.Module):
def __init__(self, in_channels, hidden_channels, output_channels):
super().__init__()
self.fc = nn.Sequential(nn.Linear(in_channels, hidden_channels),
... |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var engine, world, backgroundImg;
var canvas, angle, tower, ground, cannon;
var CannonBall;
function preload() {
backgroundImg = loadImage("./assets/background.gif");
towerImage... |
import pymysql
import datetime
# data-share
db_dataShare = pymysql.connect("127.0.0.1", "root", "123456")
# 获取游标
dataShare_cursor = db_dataShare.cursor()
# 循环日期
start = '2018-12-25'
end = '2019-05-17'
date_start = datetime.datetime.strptime(start, '%Y-%m-%d')
date_end = datetime.datetime.strptime(end, '%Y-%m-%d')
... |
// @flow
//
// Copyright (c) 2019-present, GM Cruise LLC
//
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
import React, { useCallback } from "react";
... |
/* eslint prefer-arrow-callback:0 */
import { Meteor } from "meteor/meteor";
import { expect } from "meteor/practicalmeteor:chai";
import { sinon } from "meteor/practicalmeteor:sinon";
import { ExampleApi, RISKY_TEST_CARD } from "./exampleapi";
const paymentMethod = {
processor: "Generic",
storedCard: "Visa 4242"... |