This file contains hidden or 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 com.itextpdf.text.BadElementException; | |
import com.itextpdf.text.Image; | |
import com.itextpdf.text.pdf.codec.Base64; | |
import org.w3c.dom.Element; | |
import org.xhtmlrenderer.extend.FSImage; | |
import org.xhtmlrenderer.extend.ReplacedElement; | |
import org.xhtmlrenderer.extend.ReplacedElementFactory; | |
import org.xhtmlrenderer.extend.UserAgentCallback; | |
import org.xhtmlrenderer.layout.LayoutContext; | |
import org.xhtmlrenderer.pdf.ITextFSImage; |
This file contains hidden or 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.slf4j.Logger; | |
/** | |
* @author Hardy Ferentschik | |
*/ | |
public final class LoggerFactory { | |
public static Logger make() { | |
Throwable t = new Throwable(); | |
StackTraceElement directCaller = t.getStackTrace()[1]; | |
return org.slf4j.LoggerFactory.getLogger(directCaller.getClassName()); |
This file contains hidden or 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
// JavaScript | |
function loadScript(src, callback) { | |
var head = document.getElementsByTagName('head')[0], | |
script = document.createElement('script'); | |
done = false; | |
script.setAttribute('src', src); | |
script.setAttribute('type', 'text/javascript'); | |
script.setAttribute('charset', 'utf-8'); | |
script.onload = script.onreadstatechange = function() { | |
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { |
This file contains hidden or 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
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<!--notappendassemblyidinreleasefilename--> | |
<appendAssemblyId>false</appendAssemblyId> | |
<descriptors> | |
<descriptor>src/main/assemble/package.xml</descriptor> | |
</descriptors> | |
</configuration> | |
<executions> |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
/*background: #f06;*/ | |
/*background: linear-gradient(45deg, #f06, yellow);*/ | |
min-height: 100%; |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
/*background: #f06;*/ | |
/*background: linear-gradient(45deg, #f06, yellow);*/ | |
min-height: 100%; |
This file contains hidden or 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
<p style="border:1px solid red; width:200px; padding:20px;"> | |
T | |
<span style="background-color:#C0C0C0; position:relative;"> | |
这段文字从左向右排列,红 XX 和 蓝 XX 和黄 XX 都是绝对定位元素,它的包含块是相对定位的SPAN。 可以通过它们绝对定位的位置来判断它们包含块的边缘。 | |
<em style="position:absolute; color:red; top:0; left:0;">XX</em> | |
<em style="position:absolute; color:yellow; top:20px; left:0;">XX</em> | |
<em style="position:absolute; color:blue; bottom:0; right:0;">XX</em> | |
</span> | |
</p> |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
This file contains hidden or 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
#!/bin/bash | |
# Run cputhrottle for a list of applications in order to limit their CPU usage. | |
# This script needs `pidof` and `cputhrottle` installed, which can be installed from homebrew. | |
# NOTE: This script was tested on MacOS only. | |
if [[ $EUID > 0 ]]; then | |
echo "Please run this script as root/sudo" | |
exit 1 | |
fi |
This file contains hidden or 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 subprocess | |
html = '<p><strong>Hello</strong> <em>Bob</em> <code>How</code> are you!</p>' | |
def setClipboardData(html): | |
# print(html) | |
p_hex = subprocess.Popen( | |
('hexdump', '-ve', '1/1 "%.2x"'), | |
stdin=subprocess.PIPE, | |
stdout=subprocess.PIPE |
OlderNewer