text stringlengths 3 1.05M |
|---|
const assert = require('assert')
const mineflayer = require('mineflayer')
const squid = require('flying-squid')
const { once } = require('events')
let bot
let bot2
let server
before(async () => {
server = squid.createMCServer({
port: 8666,
version: '1.12',
gameMode: 1,
'view-distance': 2,
'onlin... |
#!/usr/bin/env python
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True)
... |
#! /usr/bin/env python3
"""
usage: bactopia-stats [-h] STR STR
bactopia-stats - Ouput files to be used by Bactopia-WDL
positional arguments:
STR Directory where Bactopia outputs are.
STR Sample name used in Bactopia run
optional arguments:
-h, --help show this help message and exit
"""
import ... |
from PIL import Image
import numpy as np
import os
from torch.utils.data import Dataset
import math
import cv2
import torchvision
import torch
depth_dir_train_file = os.getcwd() + '/data/cyf/{}_{}_train.txt'
label_dir_train_file = os.getcwd() + '/data/cyf/{}_label_train.txt'
depth_dir_val_file = os.getcwd() + '/da... |
require(["sbt/dom", "sbt/connections/controls/files/FileGrid"], function(dom, FileGrid) {
var grid = new FileGrid({
type : "myPinnedFolders"
});
dom.byId("gridDiv").appendChild(grid.domNode);
grid.update();
}); |
#!/usr/bin/env node
'use strict';
// Import everything we need
const fs = require('fs');
const hljs = require('highlight.js');
const express = require('express');
const mustache = require('mustache');
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
const request = require('request').default... |
//================================================================
// RS_CustomCrypto.js
// ---------------------------------------------------------------
// The MIT License
// Copyright (c) 2015 biud436
// ---------------------------------------------------------------
// Free for commercial and non commercial use.
/... |
import React from 'react'
import Helmet from 'react-helmet'
import { DiscussionEmbed } from "disqus-react";
import MemberCard from '../components/member_card';
export default function BlogTemplate ({data}) {
const {markdownRemark: post} = data;
const disqusShortname = "sosc";
const disqusConfig = {
i... |
define(['ui-utils'], function($) {
return function($dom, params, cbs) {
var data = {},
$fields = $.element('div'),
$buttons = $.element('div'),
$hiddens = $.element('div'),
$submit,
id;
for (id in params.fields) {
$field = $.el... |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactSelect, { components } from 'react-select';
import customStyles from './select-styles';
import './react-select.scss';
const ValueContainer = ({ children, ...props }) => {
if (props.isMulti) {
return (
<components.Valu... |
#!/usr/bin/env python3
"""
Example usage of the Netdescribe library.
Performs discovery, and sends JSON-formatted output to either standard out or a file,
depending on whether the --file parameter is supplied.
"""
# Copyright [2021] [James Fleming <james@electronic-quill.net]
#
# Licensed under the Apache Licens... |
'use strict';
/* global describe it before after*/
/* eslint no-unused-expressions: 0 */
var expect = require('chai').expect;
var sinon = require('sinon');
var os = require('os');
var cp = require('child_process');
var q = require('q');
var fs = require('fs');
var path = require('path');
var util = require('util');
va... |
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Default AssignmentExpression (which can be recognized as an "anonymous"
function declaration) is... |
require('../lib/config');
const { setIntervalAsync, clearIntervalAsync } = require('set-interval-async/dynamic');
const { ELASTIC_MAX_RESULTS } = process.env;
const { client } = require('../lib/elastic');
const { logger } = require('./logger');
const index = 'posts';
const type = 'post';
/**
* Indexes the text and... |
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
from __future__ import print_function
import argparse
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torchvision import datasets, transforms
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--batc... |
thDebug = true;
thymol.ready(function () {
thymol.configurePreExecution( function() {
thymol.applicationContext.createVariable("onedate", thymol.objects.thDatesObject.create(1992,10,12) );
thymol.applicationContext.createVariable("twodate", thymol.objects.thDatesObj... |
import React from 'react';
import PropTypes from 'prop-types';
import List from '@material-ui/core/List';
import ListSubheader from '@material-ui/core/ListSubheader';
import Paper from '@material-ui/core/Paper';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles((theme) => ({
paper: {... |
#import twitch
from twitchio.ext import commands
import read_oauth
#import asyncio
import langdetect
import googletrans
class Bot(commands.Bot):
def __init__(self, nick, irc_token, initial_channels):
super().__init__(irc_token=irc_token, nick=nick, prefix='',
initial_channels=ini... |
import fs from 'fs'
import matter from 'gray-matter'
import Navbar from '../../components/navbar.jsx'
import Link from 'next/link'
import BlogList from '../../components/blog.list.jsx'
import BlogCard from '../../components/blog.card.jsx'
import Title from '../../components/title.jsx'
import Head from 'next/head'
func... |
/* istanbul instrument in package npmtest_grunt_ngmin */
/*jslint
bitwise: true,
browser: true,
maxerr: 8,
maxlen: 96,
node: true,
nomen: true,
regexp: true,
stupid: true
*/
(function () {
'use strict';
var local;
// run shared js-env code - init-before
(function () {
... |
const webpackBaseConfig = require('./webpack.base.config')
const merge = require('webpack-merge')
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = merge(webpackBaseConfig, {
mode: 'development',
devtool: 'cheap-module-source-m... |
import express from 'express'
import restaurants from './restaurants'
import authentication from './authentication'
import { ensureLoggedIn } from '../middlewares'
const routes = express.Router()
routes.use('/', authentication)
routes.use(ensureLoggedIn)
routes.get('/', (req, res) => res.redirect('/restaurants'))
... |
var searchData=
[
['height',['height',['../class_o_i_s_1_1_mouse_state.html#a00dc821257ffa2a08664199e9a7d55b8',1,'OIS::MouseState::height()'],['../class_o_i_s_1_1_multi_touch_state.html#ae0d1e067b6d93a1e9a372a12d6687d26',1,'OIS::MultiTouchState::height()']]]
];
|
Function.prototype.bind = function () {
if (arguments.length < 2 && (typeof arguments[0]==='undefined')) {
return this;
}
var _slice = Array.prototype.slice;
var __method = this, args = _slice.call(arguments,0), context = args.shift();
return function() {
return __method.apply(conte... |
const path = require('path')
const test = require('ava')
const { copy, ensureDir } = require('fs-extra')
const { isPlainObject, sortBy } = require('lodash')
const tempy = require('tempy')
const globAssets = require('../dist/glob-assets')
const sortAssets = (assets) => sortBy(assets, (asset) => (isPlainObject(asset) ? ... |
(window.webpackJsonp=window.webpackJsonp||[]).push([[285],{3136:function(l,a,e){"use strict";e.r(a),e.d(a,"icon",(function(){return c}));e(11),e(2),e(5),e(8),e(3),e(9);var t=e(0),n=e.n(t);function r(){return(r=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var t in e)Object.protot... |
(function(win,undefined){
var doc = document.body.ownerDocument;
var body = document.body;
var reg = /^\s*([\.|#])?([^\d].+)/;
var selectorTypes = ['tag', 'class', 'id'];
var cache = {};
var parseSelector = function(selector){
var matches = reg.exec(selector);
var type = matches[1] === '.' ? 1 : mat... |
/*
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'pastefromword', 'lv', {
confirmCleanup: 'Teksts, kuru vēlaties ielīmēt, izskatās ir nokopēts no Word. Vai vēlaties to iztīr... |
const { rollup, watch } = require('rollup')
const path = require('path')
const fs = require('fs-extra')
const noop = require('no-op')
const getRollupOptions = require('./getRollupOptions')
module.exports = function bundleRC(opts) {
const options = normalizeOpts(opts, {
cwd: '',
output: 'dist',
entry: '.... |
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. 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 requir... |
/**
* jQuery Plugin - Jribbble v1.0.0
* A jQuery plugin to fetch shot and player data from the Dribbble API,
* http://dribbble.com/api
*
* Copyright (c) 2011 Tyler Gaw
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
*... |
from bokeh.models import FactorRange
from bokeh.models import PrintfTickFormatter
from bokeh.plotting import figure, reset_output
from bokeh.transform import dodge
from bokeh.layouts import column
from bokeh.io import output_file, export_svgs, show
from sv_util.bokeh_style_helper import *
from sv_util.settings import *... |
import random
import spicii_dice
import ask_user as au
class Game:
# Attributes
__bank_roll = 1000
__current_wager = 0
__lost = False
__point = 0
__odds_amount = 0
__keep_playing = True
def __init__(self, __bank_roll=1000): # We may add an option to choose initial money l... |
/**
* @file Dubai 迪拜大厦
* @author Auto Generated by IconPark
*/
/* tslint:disable: max-line-length */
/* eslint-disable max-len */
import {IconWrapper} from '../index';
export default IconWrapper(
'Dubai',
true,
(h, props) => (
<svg
width={props.size}
height={props.size}
... |
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.undefined = mod.exports;
}
})(this, function... |
from __future__ import absolute_import
from django import forms
from allauth.account.forms import BaseSignupForm
from . import app_settings, signals
from .adapter import get_adapter
from .models import SocialAccount
class SignupForm(BaseSignupForm):
def __init__(self, *args, **kwargs):
self.sociallogi... |
import m from 'mithril';
import _ from 'underscore';
import userVM from '../vms/user-vm';
import h from '../h';
const I18nScope = _.partial(h.i18nScope, 'projects.faq');
const faqBox = {
controller: function(args) {
const mode = args.mode === 'sub' && args.isEdit ? args.isReactivate ? 'sub_reactivate' : '... |
/*
* Author: Inzamam Rahaman, Matt Evers
*/
requirejs.config({
paths: {
"worldwind" : "http://worldwindserver.net/webworldwind/worldwind.min.js",
"jquery" : "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min",
"OpenStreetMapApp" : "OpenStreetMapApp"
}
});
requirejs(['jque... |
const MongoClient = require('mongodb').MongoClient;
const pf = require('./helpers/promiseFactory');
// Connection URL
const url = 'mongodb://localhost:27017';
// Database Name
const dbName = 'bot-158645511';
const selfId = 486809653;
const botId = 158645511;
// Use connect method to connect to the server
MongoClie... |
import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import { dbCompanies } from '/db/dbCompanies';
import { dbLog } from '/db/dbLog';
import { dbViolationCases } from '/db/dbViolationCases';
import { returnCompanyStones } from '/server/functions/miningMachine/returnCompanyStones';
impo... |
var fs = require('fs');
var config = getConfig();
/**
* This callback handle the response request by getActiveWindow function
* @callback getActiveWindowCallback
* @param {app: string, window: string} window
*/
/**
* Get the active window
* @param {getActiveWindowCallback} callback - The callback that handles the... |
/* @generated */
// prettier-ignore
if (Intl.RelativeTimeFormat && typeof Intl.RelativeTimeFormat.__addLocaleData === 'function') {
Intl.RelativeTimeFormat.__addLocaleData({"data":{"mas-TZ":{"nu":["latn"],"year":{"0":"this year","1":"next year","future":{"other":"+{0} y"},"past":{"other":"-{0} y"},"-1":"last year"},... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libuv(AutotoolsPackage):
"""Multi-platform library with a focus on asynchronous IO"""
... |
import React from "react";
import Loader from "react-loader-spinner";
import { connect } from "react-redux";
import { login } from "../../../actions/loginActions";
import Avatar from "@material-ui/core/Avatar";
import Button from "@material-ui/core/Button";
import CssBaseline from "@material-ui/core/CssBaseline";
impor... |
(function() {
'use strict';
angular
.module('app.router')
.provider('routerHelper', routerHelperProvider);
routerHelperProvider.$inject = ['$stateProvider', '$urlRouterProvider'];
function routerHelperProvider($stateProvider, $urlRouterProvider) {
this.$get = RouterHelper;
... |
const template = (
<div id="main">
<button onchange={() => console.log("bound")}>Change Bound</button>
<button onChange={[id => console.log("bound", id), id]}>Change Bound</button>
<button onclick={() => console.log("delegated")}>Click Delegated</button>
<button onClick={[id => console.log("deleg... |
import React from 'react'
import Head from 'next/head'
import Prismic from "prismic-javascript";
import {accessToken, apiEndpoint} from "prismic-configuration";
import {getMenu, getPageSections} from "utils/api";
import {CONSTANTS} from "utils/CONSTANTS";
function Error(props) {
return (
<div className='no... |
//=============================================================================
// Community Plugins - Ultra Mini Lighting system
// umc_Lighting.js
// Version: 1.47
/*=============================================================================
Forked from Terrax Lighting
========================================... |
/* eslint-disable no-undef */
import { random } from '../../helpers';
describe('Generate random number', () => {
it('should generate a number between 0 and 2', () => {
const number = random(2);
expect(number >= 0 && number <= 2).toBe(true);
});
it('should generate 0', () => {
expect(random(0)).toBe(... |
import urllib.request, json
from .models import Quote
def get_quotes():
try:
with urllib.request.urlopen('http://quotes.stormconsultancy.co.uk/random.json') as url:
web_data = url.read()
json_data = json.loads(web_data)
if json_data.get('id'):
author = json_data.get('author')
q... |
const mongoose = require('mongoose')
/*
* Logging model for usage statistics and metrics
*/
const LogSchema = new mongoose.Schema({
userId: {
type: mongoose.Schema.Types.ObjectId
},
category: {
type: String,
required: true
},
type: {
type: String,
required: true
},
data: {
type... |
module.exports = function(app){
require('./airlineReviewMainPageController.js')(app);
};
|
define([], function () {
return {
"RefinersConfigurationGroupName": "Configuration des filtres",
"ShowBlankLabel": "Ne rien afficher si aucun résultat",
"WebPartTitle": "Titre de web part",
"StylingSettingsGroupName": "Options d'affichage",
"AppliedRefinersLabel": "Filtre(s) appliqué(s)",
"Pla... |
define(["exports", "@kinkajou/kinkajou/Kinkajou", "@kinkajou/svg-icon/SvgIcon"], function (_exports, _Kinkajou, _SvgIcon2) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.CameraRear = void 0;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symb... |
import torch
import torchvision.transforms as transforms
import torch.nn.functional as F
import torchvision.transforms.functional as tf
from .verification import evaluate
from datetime import datetime
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
from PIL import Image
import bcolz
import... |
# --------------------------------------------------------
# Tensorflow Phrase Detection
# Licensed under The MIT License [see LICENSE for details]
# Written by Bryan Plummer based on code from Ross Girshick
# --------------------------------------------------------
"""Transform a roidb into a trainable roidb by addin... |
// This tracks all the processes that we spawn from this file.
// Used to clean up processes when exiting this program.
const p = {};
const { spawn } = require("child_process");
const { resolve, dirname } = require('path');
const fs = require('fs');
// Output the chainspec of a node.
export async function generateCha... |
#!/usr/bin/python3
import pytest
def test_setCoreParams(Constants, bzx):
bzx.setCoreParams(
Constants["ONE_ADDRESS"], # protocolTokenAddress
Constants["ONE_ADDRESS"], # priceFeeds
Constants["ONE_ADDRESS"] # swapsImpl
)
assert bzx.protocolTokenAddress() == Constants["ONE_ADDRESS"... |
import React, { useState, createContext, useContext } from 'react';
import Portal from '@reach/portal';
const ModalContext = createContext({
isOpen: false,
openKeys: [],
open: () => null,
close: () => null
});
const ModalElementsMap = new Map();
const BASE_Z_INDEX = 999999;
const ModalProvider = (props)... |
import React, { Component } from 'react'
export default class SettingsMenu extends Component {
render() {
// eslint-disable-next-line react/prop-types
const { pages = [], onChange, page } = this.props
return (
pages.map((pageItem) => {
const { name, title } = pageItem
return (
... |
$('#signupForm').submit(function (event) {
if (!Validator.validateDate("birthDay")) {
event.preventDefault();
return false;
}
Validator.disableDateSubComponents("birthDay");
$('#submit').prop("disabled", true);
$('#submit').html("Subiendo formulario...");
});
$("#signupForm"... |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.lang['zh']={"editor":"RTF 編輯器","editorPanel":"RTF 編輯器面板","common":{"editorHelp":"按下 ALT 0 取得說明。","browseServer":"瀏覽伺服器","url":"URL","protocol":"通訊協定","upload":"上傳","... |
# -*- coding: utf-8 -*-
#
# R3 prototyping documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 23 21:19:35 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... |
from typing import Optional
import logging
import ailment
from ...calling_conventions import SimRegArg
from ...sim_type import SimTypeFunction
from ...engines.light import SimEngineLightAILMixin, SpOffset
from ..typehoon import typeconsts, typevars
from ..typehoon.lifter import TypeLifter
from .engine_base import Si... |
import { clone } from './common';
const getEmptyCoords = (board) => board.reduce((emptyCoords, row, yCoord) => {
const emptyCoordsInRow = row.reduce((emptyCoords, cell, xCoord) =>
(cell ? emptyCoords : emptyCoords.concat([[xCoord, yCoord]])), []
);
return emptyCoords.concat(emptyCoordsInRow);
}, []);
const... |
import React from 'react'
import PropTypes from 'prop-types'
import { StaticQuery, graphql } from 'gatsby'
import Navigation from './navigation'
const Layout = ({ children }) => (
<StaticQuery
query={graphql`
query SiteTitleQuery {
site {
siteMetadata {
title
}
... |
$(document).ready(function () {
// This facilitates smooth scrolling using jQuery easing
$('a.smooth-scroll[href*="#"]:not([href="#"])').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(th... |
var x = NaN;
{
var __result1 = ! isNaN(Math.exp(x));
var __expect1 = false;
}
|
const router = require("express").Router();
router.use("/users", require("./users"));
router.use("/products", require("./products"));
router.use("/productInfos", require("./productInfos"));
router.use("/order", require("./order"));
router.use('/checkout', require('./checkout'));
router.use((req, res, next) => {
cons... |
window.PlayAudio = (elementName) => {
document.getElementById(elementName).play();
}
window.blazorCulture = {
get: () => window.localStorage['BlazorCulture'],
set: (value) => window.localStorage['BlazorCulture'] = value
}; |
mycallback( {"ELECTION CODE": "G2010", "EXPENDITURE PURPOSE DESCRIP": "Merch Fees", "BENEFICIARY CANDIDATE OFFICE": "", "PAYEE ZIP": "85072", "MEMO CODE": "", "PAYEE STATE": "AZ", "PAYEE LAST NAME": "", "PAYEE CITY": "Phoenix", "PAYEE SUFFIX": "", "CONDUIT STREET 2": "", "CONDUIT STREET 1": "", "PAYEE FIRST NAME": "", ... |
module.exports = {
"39.0.2171.65": [
"0.20.0",
"0.20.1",
"0.20.2",
"0.20.3",
"0.20.4",
"0.20.5",
"0.20.6",
"0.20.7",
"0.20.8"
],
"40.0.2214.91": [
"0.21.0",
"0.21.1",
"0.21.2"
],
"41.0.2272.76": [
"0.21.3",
"0.22.1",
"0.22.2",
"0.22.3",
"0.23.0",
"0.24.0"
],
"42.0.2311.107": [... |
import { asyncRoutes, constantRoutes } from '@/router/index'
const state = {
routes: []
}
const mutations = {
// 设置修改state中routes的函数
setRoutes(state, newRoutes) {
state.routes = [...constantRoutes, ...newRoutes]
}
}
const actions = {
filterRoutes(store, menus) {
const routes = asyncRoutes.filter(rout... |
from runpandas.types.acessors.moving import _InactivityAssessor # noqa
from runpandas.types.acessors.metrics import MetricsAcessor # noqa
from runpandas.types.acessors.session import _SessionAcessor # noqa
|
const express = require('express'),
bodyParser = require('body-parser'),
fileType = require('file-type'),
converters = require('./converters'),
search = require('./search'),
auth = require('./auth_middleware'),
app = express();
app.post('/searchFile', auth, (req, res) => {
if (!req.files.resultsFile) ret... |
import os, sys
import string, cgi, time, socket, traceback
from subprocess import Popen, PIPE, STDOUT
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
import fcntl
import posix
def CheckXineramaEnabled():
# grep -i \""Xinerama\"" /var/log/Xorg.0.log
... |
'use strict';
var _regeneratorRuntime = require('babel-runtime/regenerator')['default'];
var _Object$assign = require('babel-runtime/core-js/object/assign')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
Object.defineProperty(exports, '__esModule', {
... |
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b)... |
module.exports = {
displayName: 'clients-assets',
preset: '../../../jest.preset.js',
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../../cover... |
# qubit number=3
# total number=48
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... |
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
qunit: {
all: ['test/javascripts/tests/**/*.html']
},
watch: {
all: {
files: [
'test/javascripts/tests/*... |
const users = [];
// Join user to chat
function userJoin(id, username, room)
{
const user = { id, username, room };
users.push(user);
return user;
}
// Get current user
function getCurrentUser(id)
{
return users.find(user => user.id === id);
}
// User leaves chat
function userLeave(id)
{
const index =... |
var contentLib = require('/lib/xp/content');
var portalLib = require('/lib/xp/portal');
var thymeleaf = require('/lib/thymeleaf');
var validator = require('./util/validator');
function handleGet(req) {
var contentId = req.params.contentId;
if (!contentId && portalLib.getContent()) {
contentId = porta... |
let materias= document.querySelectorAll('#div_materias a');
let materias2 = document.querySelectorAll("#MateriasId div div a");
console.log(materias2);
for(var cont=0;cont<materias.length;cont++){
materias[cont].setAttribute('onclick',`mudarConteudo(${cont-1})`);
}
for(var cont=0;cont<materias2.length;cont++){
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
import hashlib
import json
import logging
import math
import operator
import os.path
import re
import Levenshtein
from collections import defaultdict
from dirtyfields import DirtyFieldsMixin
from django.db.models.functions imp... |
// Static files to cache
const staticFiles = [
'/',
'/app.js',
'https://fonts.googleapis.com/css?family=Roboto&display=swap',
'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css',
'https://code.jquery.com/jquery-3.4.1.min.js',
'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/boot... |
import expect from "expect"
import validateHelper, { expectNoErrorsOrWarnings } from "./validate-helper.js"
describe("validation plugin - semantic - security", function() {
this.timeout(10 * 1000) // For the slow validateHelper startup ( via swagger-ui )
it("should return an error when an operation references a n... |
import React from 'react';
import * as Yup from 'yup';
import flat from 'flat';
import { get } from 'lodash';
import { object } from 'q3-ui-helpers';
import ErrorResponseAdapter from '../helpers/ErrorResponseAdapter';
export const getValues = (value) =>
Array.isArray(value)
? value.map((o) => get(o, 'value', o))... |
#!/usr/bin/env node
const program = require('commander');
const config = require('../src/config');
// Commands
const init = require('../src/init');
const pull = require('../src/pull');
const push = require('../src/push');
// Version
program.version('1.1.2');
// Init
program.command('init').action(cmd => init());
/... |
#shopping_cart.py
def to_usd(store_price): # The name and price of each shopping cart item, price being formatted as US dollars and cents (e.g. $1.50)
return '${:,.2f}'.format(store_price)
def find_product(item_id, item_products):
matching_products = [p for p in item_products if str(p["id"]) == str(item_id)... |
from pyscreenshot import backends, FailedBackendError
import time
import pyscreenshot as ImageGrab
def show():
im = []
for x in backends():
try:
print('grabbing by ' + x)
im.append(ImageGrab.grab(bbox=(500, 400, 800, 600), backend=x))
except FailedBackendError as e:
... |
const path = require('path');
const argv = require('yargs').argv;
const CDN_ASSETS_URL = '';
const dirs = require('./site.config').dirs;
const env = argv.config.indexOf('prod.conf') > -1 ? 'prod' : 'dev';
const dllPath = env === 'dev' ? '/' + dirs.dist : '/' + dirs.server;
const publicPath = env === 'dev' ? '/' : '/' +... |
import React from "react";
import { Menu, Item, Separator, theme, animation } from "react-contexify";
import addBranch from "../actions/addBranch";
import displayModel from "../actions/displayModel";
function RepoMenu(props) {
const { setDialogContent, showDialog } = props;
const onClick = generateContent => ({ p... |
import BlogList from "@/components/BlogList.vue";
import { TestUtility } from "./TestUtility";
describe("BlogList", () => {
let component;
const initialProps = {
color: "gray"
};
const shallow = propsData =>
TestUtility.shallow(BlogList, {
propsData: {
...initialProps,
...propsD... |
#!/usr/bin/env node
import meow from "meow";
import colors from "colors";
import syzer from "./lib/syzer";
import syzerUpdate from "./lib/syzerUpdate";
const guide = colors.yellow(`
Usage:
$ syzer
${colors.grey("//shows the latest versions.")}
$ syzer --update ${colors.grey("or")} syzer -u
${colors.grey... |
import React from "react";
import Modal from "./Modal";
import logo from "../../images/logo.png";
import offline from "../../images/offline.svg";
//import logo from "../../images/logo.svg"
import { StaticQuery, Link, graphql } from "gatsby";
import { getDateFromDkDate } from "../helpers/date_utils";
import { navigate ... |
/* YUI 3.9.0pr1 (build 202) Copyright 2013 Yahoo! Inc. http://yuilibrary.com/license/ */
if (typeof _yuitest_coverage == "undefined"){
_yuitest_coverage = {};
_yuitest_coverline = function(src, line){
var coverage = _yuitest_coverage[src];
if (!coverage.lines[line]){
coverage.calledL... |
n, m = list(map(int, input().split()))
scores = []
for _ in range(n):
scores.append(list(map(int, input().split())))
direcs = [(0, 1), (0, -1), (-1, 0), (1, 0)]
from decimal import Decimal, ROUND_HALF_UP
def cal(x, y):
tmp = [scores[x][y]]
for direc in direcs:
n_x, n_y = x + direc[0], y + direc[1]
if 0 <= n_x... |
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: tr... |