View CSSInliner.java
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 org.jsoup.Jsoup; | |
import org.jsoup.nodes.Document; | |
import org.jsoup.nodes.Element; | |
import org.jsoup.select.Elements; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Set; | |
import java.util.StringTokenizer; | |
import java.util.logging.Level; |
View example.sol
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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.13; | |
/// @notice The canonical ERC20 interface | |
interface IERC20 { | |
function balanceOf(address account) external view returns (uint256); | |
function transfer(address recipient, uint256 amount) external returns (bool); | |
function transferFrom( |
View TransientStorage.sol
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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity =0.8.12; | |
type TransientStorageProxy is address; | |
library TransientStorage { | |
function init() internal returns (TransientStorageProxy proxy) { | |
// initCode == bytecode from `yarn compile-tsp` | |
bytes | |
memory initCode = hex'602980600d600039806000f3fe366020811460135760408114602057600080fd5b600035b360005260206000f35b602035600035b450'; |
View render-text.jsx
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 { render, unmountComponentAtNode } from 'react-dom'; | |
export function renderText(component) { | |
const _el = document.createElement('div'); | |
document.body.appendChild(_el); | |
render(component, _el); | |
const text = _el.innerText; | |
unmountComponentAtNode(_el); | |
document.body.removeChild(_el); | |
return text; |
View PreventLeaveRoute.jsx
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 React, { Component, PropTypes } from 'react'; | |
/** | |
* Only ever render one of these per page | |
* | |
* TODO: improve with react-side-effect to better handle multiple instances of this being rendered at once so we can | |
* nest the component in forms | |
*/ | |
export default class PreventLeaveRoute extends Component { | |
static contextTypes = { |
View promise-cancellable.js
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
/** | |
* Returns a promise that has a cancelled method that will cause the callbacks not to fire when it resolves or rejects | |
* @param promise to wrap | |
* @returns new promise that will only resolve or reject if cancel is not called | |
*/ | |
export default function cancellable(promise) { | |
var cancelled = false; | |
const toReturn = new Promise((resolve, reject) => { | |
promise.then(() => { |
View prevent-duplicate-async.test.ts
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 { expect } from 'chai'; | |
import preventDuplicateAsync from '../src/util/prevent-duplicate-async'; | |
function testPromise<T>(): { promise: Promise<T>; resolve: (T) => void; reject: (Error) => void; } { | |
let rslv, rjct; | |
const promise = new Promise<T>((resolve, reject) => { | |
rslv = resolve; | |
rjct = reject; |
View swagger-definitions.ts
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 IDataType { | |
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; | |
readOnly?: true; | |
writeOnly?: true; | |
} | |
interface IStringType extends IDataType { | |
type: 'string'; | |
format?: 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'uuid' | 'email' | 'uri' | 'hostname' | 'ipv4' | 'ipv6'; |
View swapfile.config
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
commands: | |
000_dd: | |
test: test ! -e /swapfile | |
command: dd if=/dev/zero of=/swapfile bs=1M count=2048 && chmod 600 /swapfile | |
001_mkswap: | |
command: mkswap /swapfile | |
ignoreErrors: true | |
002_swapon: | |
command: swapon /swapfile | |
ignoreErrors: true |
View SearchBuilder.java
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
package com.fastmodelsports.social.lambda.util.es; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonObject; | |
public abstract class SearchBuilder { | |
public static JsonArray sortOn(final String attribute, final boolean desc) { | |
final JsonObject sort = new JsonObject(), | |
attr = new JsonObject(); |
NewerOlder