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
<!-- This is missing a bunch of the code that interacts with tippy to position the element, but | |
hopefully it makes sense --> | |
<script> | |
// The popup tracker makes sure that "outside click" handling doesn't trigger when a click occurs | |
// in a child dropdown, and the child dropdown's popup is fixed. | |
function makePopupTracker(parent) { | |
let contained: HTMLElement[] = []; | |
return { | |
contains(target) { | |
return contained.some((e) => e.contains(target)); |
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
<script> | |
import tippy from 'tippy.js'; | |
import 'tippy.js/animations/shift-away.css'; | |
import 'tippy.js/dist/tippy.css'; | |
import { createEventDispatcher, tick } from 'svelte'; | |
import { scale } from 'svelte/transition'; | |
import { cubicIn, cubicOut } from 'svelte/easing'; | |
import Icon from './Icon.svelte'; | |
import Button from './Button.svelte'; | |
import { faChevronDown } from '@fortawesome/pro-solid-svg-icons/faChevronDown'; |
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 { writable, Readable } from 'svelte/store'; | |
import { produce, enableAllPlugins } from 'immer'; | |
enableAllPlugins(); | |
export interface ImmerStore<T> { | |
update: (updateFn: (draft: T) => T | void) => T; | |
subscribe: Readable<T>['subscribe']; | |
} |
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 babelServerConfig = { | |
extensions: ['.js', '.mjs', '.html', '.ts'], | |
babelHelpers: 'bundled', | |
exclude: ['node_modules/@babel/**'], | |
presets: [ | |
[ | |
'@babel/preset-env', | |
{ | |
modules: false, | |
targets: { node: 12 }, |
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
/** | |
* This is intended to be used with the svelte `use` syntax. It examines all | |
* child elements of the element that match `selector`, and calls the callback | |
* when the child element with the highest percentage overlap with the visible | |
* part of the container changes. | |
* <div use:mostVisibleElement={{ cb: setActive }}><section><section></div> | |
*/ | |
export default function mostVisibleElement( | |
container: Element, | |
{ selector, cb } |
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
export default function ( | |
Component: typeof SvelteComponent, | |
events?: { [svelteEvent: string]: string } | |
) { | |
return class { | |
$element: Element[]; | |
initialProps: { [key: string]: any }; | |
component: SvelteComponent; | |
constructor($element) { | |
'ngInject'; |
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
<div class="px-2 flex flex-col"> | |
<!-- Selected: adds bg-gray-200, removes bg-gray-100 --> | |
<!-- First row: Removes mt-1 --> | |
<div class="bg-gray-200 rounded-md px-2"> | |
<span>Content</span> | |
<!-- Selected: adds bg-gray-100, removes bg-gray-200 --> | |
<span class="ml-auto bg-gray-100">5</span> | |
</div> |
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
input length = 60; | |
def xx = -GetEventOffset(Events.EARNINGS); | |
def yy = Sum(HasEarnings(type = EarningTime.AFTER_MARKET), length)[-length + 1] > 0; | |
plot x = xx + yy * .5; | |
x.AssignValueColor( if x <= 1 then Color.LIGHT_RED else Color.DARK_GRAY); |
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
use actix_service::{Service, Transform}; | |
use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; | |
use futures::future::{ok, FutureResult}; | |
use futures::{Future, Poll}; | |
use slog::info; | |
// There are two step in middleware processing. | |
// 1. Middleware initialization, middleware factory get called with | |
// next service in chain as parameter. | |
// 2. Middleware's call method get called with normal request. |
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 { abc } from './redundant_export'; | |
abc(1, 2, 3); |