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 { SafeAny } from "@dvtl/types"; | |
/** | |
* Create a finite-state-machine (FSM) transitioning function by declaring the | |
* relationships between states. | |
* | |
* The FSM is modeled as a set of states and transitions between those states. | |
* | |
* The returned `transition` function is statically typed to ensure only valid | |
* transitions between states can occur. |
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
// tslint:disable:no-invalid-this | |
import memoizeOne from "memoize-one"; | |
import { EditorState, Plugin, Transaction, PluginSpec } from "prosemirror-state"; | |
import { Schema } from "prosemirror-model"; | |
declare module "prosemirror-state" { | |
// tslint:disable-next-line:no-any | |
interface PluginSpec<S extends Schema = any> { | |
replaceTransaction?: | |
| ((tr: Transaction, oldState: EditorState, newState: EditorState) => undefined | null | false | Transaction) |
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 function after( | |
$pos: ResolvedPos, | |
predicate: (node: Node, pos: number) => boolean | |
): { $pos: ResolvedPos; node: Node; parent: Node } | null { | |
let result: { $pos: ResolvedPos; node: Node; parent: Node } | null = null; | |
$pos.doc.nodesBetween($pos.pos, $pos.doc.content.size, (node, pos, parent) => { | |
if (pos < $pos.pos) { | |
// Don't recurse into nodes that are completely before the position we're | |
// interested in. | |
if (pos + node.nodeSize < $pos.pos) { |
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
interface StateOne { | |
type: "one"; | |
prevName?: string; | |
} | |
interface StateTwo { | |
type: "two"; | |
name?: string; | |
} |
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 | |
import numpy.ma | |
import random | |
import timeit | |
def using_del(numbers, indices): | |
numbers = numbers[:] | |
offset = 0 | |
for i in indices: |
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
author 'Bradley Ayers' | |
description 'Enables user job "start on" stanzas to be honored at boot' | |
task | |
start on starting rc-sysinit | |
script | |
cat /etc/passwd | while read line | |
do | |
user=`echo $line | cut -d: -f1` |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE busconfig PUBLIC | |
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | |
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | |
<busconfig> | |
<!-- Only the root user can own the Upstart name --> | |
<policy user="root"> | |
<allow own="com.ubuntu.Upstart" /> | |
</policy> |
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
description "PostgreSQL 9.1 Server" | |
author "PostgreSQL" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
respawn | |
pre-start script | |
if [ -d /var/run/postgresql ]; then | |
chmod 2775 /var/run/postgresql | |
else |
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
sudo apt-get remove gcc-4.4 | |
sudo dpkg -i initramfs-tools-bin_0.99ubuntu8_amd64.deb | |
sudo dpkg -i initramfs-tools_0.99ubuntu8_all.deb | |
sudo dpkg -i --force-breaks friendly-recovery_0.2.18_all.deb | |
sudo dpkg -i libc-bin_2.13-20ubuntu5_amd64.deb | |
sudo dpkg -i libc6_2.13-20ubuntu5_amd64.deb | |
sudo /etc/init.d/apache2 start | |
sudo dpkg -i gcc-4.6-base_4.6.1-9ubuntu3_amd64.deb | |
sudo dpkg -i libgmp10_5.0.1+dfsg-7ubuntu2_amd64.deb | |
sudo dpkg -i libmpfr4_3.0.1-5_amd64.deb |
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
def fill_page_with_image(path, canvas): | |
""" | |
Given the path to an image and a reportlab canvas, fill the current page | |
with the image. | |
This function takes into consideration EXIF orientation information (making | |
it compatible with photos taken from iOS devices). | |
This function makes use of ``canvas.setPageRotation()`` and | |
``canvas.setPageSize()`` which will affect subsequent pages, so be sure to |
NewerOlder