This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
from types import ModuleType, ClassType | |
def can_reload_methods(klass): | |
klass.__CAN_RELOAD_METHODS__ = True | |
return klass | |
def reloadd(m): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% test enum_distribution(model, column_name, expected, allow_other=False, fudge=0.1) %} | |
SELECT | |
COALESCE(expected.enum_val, actual.enum_val) AS enum_val, | |
expected.fraction AS expected_fraction, | |
actual.fraction AS actual_fraction | |
FROM ( | |
{% for enum_val, expected_fraction in expected.items() -%} | |
SELECT '{{enum_val}}' AS enum_val, {{expected_fraction}} AS fraction | |
{%- if not loop.last %} UNION ALL {% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For info on usage, development and debugging, | |
// see https://docs.google.com/a/landtech.co/document/d/1eB2oH3d7mpDfK8gxTiYphxPgBM7EDu5MeUNKrQwYIrQ/ . [private] | |
const Painter = require('./render/painter'), | |
Style = require('./style/style'), | |
EXTENT = require('./data/extent'), | |
Evented = require('./util/evented'), | |
TileCoord = require('./source/tile_coord'), | |
mat4 = require('@mapbox/gl-matrix').mat4, | |
Source = require('./source/source'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* EXAMPLE: | |
var workerCode = function(){ | |
"use strict;" //this will become the first line of the worker | |
CalculateSomething(a,b,c,d){ | |
var v = a+b+c+d; //trivial calculation | |
main.DisplayResult(v,"hello"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, TYPE_CHECKING, Dict | |
import prefect | |
from prefect import Task, Flow | |
from prefect.triggers import all_successful | |
from prefect.tasks.control_flow.conditional import CompareValue | |
from prefect.engine import signals | |
if TYPE_CHECKING: | |
from prefect.engine import state # noqa | |
from prefect import core # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { STRIPE_PUBLIC_KEY } = process.env, | |
axios = require("axios"), | |
qs = require("querystring").stringify, | |
{ JSDOM } = require("jsdom"); | |
module.exports.simulateAction = async function( | |
intentId, | |
clientSecret, | |
mode = "setup_intent" | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pandas as pd | |
import numpy as np | |
_dummy_data_anova2 = pd.DataFrame(np.random.rand(30,4) + [[0., 1., 0.2, 0.8]], | |
columns=pd.MultiIndex.from_tuples([ | |
('a0','b0'),('a0','b1'),('a1','b0'),('a1','b1')], | |
names=['factor_a', 'factor_b']), | |
index=range(30)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def pso(func, lb, ub, ieqcons=[], f_ieqcons=None, args=(), kwargs={}, | |
func_takes_multiple=False, swarmsize=100, omega=0.5, phip=0.5, phig=0.5, | |
maxiter=100, minstep=1e-8, minfunc=1e-8, debug=False, info=True): | |
""" | |
Perform a particle swarm optimization (PSO) | |
Parameters | |
========== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Worker = (function(){ | |
var nativeWorker = Worker; | |
var BlobWorker = function(){ | |
this.queuedCallList = []; | |
this.trueWorker = null; | |
this.onmessage = null; | |
} | |
BlobWorker.prototype.postMessage = function(){ | |
if(this.trueWorker) |
NewerOlder