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
sw() { | |
if [[ -n "$1" ]]; then | |
SWITCH_WIN=$(kitten @ ls | jq ".[] | select(.wm_name == \"$1\") | .tabs | .[]| select(.is_active) | .windows |.[]| select(.is_active) | .id" | head -n1) | |
if [[ -n "$SWITCH_WIN" ]]; then | |
kitten @ focus-window -m "id:${SWITCH_WIN}" | |
else | |
kitten @ launch --type os-window \ | |
--os-window-title "kitty: $1" \ | |
--os-window-name "$1" | |
fi |
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
/** | |
* 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
use bytes::Bytes; | |
use futures::Future; | |
pub async fn retry_with_data<F, Fut, V, E>(data: Vec<Bytes>, f: F) -> Result<V, E> | |
where | |
F: Fn(Vec<Result<Bytes, std::io::Error>>) -> Fut, | |
Fut: Future<Output = Result<V, E>>, | |
{ | |
retry(|| async { | |
let data = data |
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
/// Parse a line of text, counting anything that doesn't match a directive as plain text. | |
fn parse_inline(input: &str) -> IResult<&str, Vec<Expression>> { | |
let mut output = Vec::new(); | |
let mut current_input = input; | |
while !current_input.is_empty() { | |
let mut found_directive = false; | |
for (current_index, _) in current_input.char_indices() { | |
// println!("{} {}", current_index, current_input); |
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
#!/usr/bin/env node | |
const rushLib = require('@microsoft/rush-lib'); | |
const execa = require('execa'); | |
const path = require('path'); | |
const { default: Dag } = require('dag-map'); | |
const { Transform } = require('stream'); | |
const { EventEmitter } = require('events'); | |
const chalk = require('chalk'); | |
const yargs = require('yargs'); |
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 fs from 'fs'; | |
import postcss from 'postcss'; | |
const { readFile, unlink, writeFile } = fs.promises; | |
const main = async () => { | |
let [sourcemap, postcssConfigPath, input, output] = process.argv.slice(2); | |
let { default: postcssConfig } = await import(postcssConfigPath); | |
if (sourcemap === 'true') sourcemap = true; |
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 lang="typescript"> | |
import debounce from 'just-debounce-it'; | |
import compare from 'just-compare'; | |
import type { | |
LoadableModel, | |
LoadableScenario, | |
Value, | |
} from '@carevoyance/reactive-data'; | |
import type { Graph } from '@carevoyance/reactive-data'; | |
import { |
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
<Tabs> | |
<Tab id="settings" name="Settings">Content</Tab> | |
<Tab id="sharing" name="Sharing">Content2</Tab> | |
</Tabs> |
NewerOlder