Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# create temp files for html and pdf output
tin=$(tempfile) || exit
tout=$(tempfile) || exit
trap "rm -f -- '$tin'" EXIT
trap "rm -f -- '$tout'" EXIT
# write stdin to input temp file
echo "$(</dev/stdin)" > "$tin"
CSS:
@import url('https://fonts.googleapis.com/css2?family=Asul:wght@700&family=Open+Sans&display=swap');
@import url('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
@page{
size:A4;
margin:5cm 2cm 2cm 2cm;
@top-center{
content:element(MyHeader);
CSS:
section:first-of-type{
position:absolute;
bottom:0;
}
section:nth-of-type(2){
break-before:always;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Firstname Lastname - CV</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Asul:wght@700&family=Open+Sans&display=swap');
@import url('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
@azettl
azettl / getBookmarks.php
Created October 9, 2018 19:24
Get the Bookmarks from a PDF
<?php
$sPdfContent = file_get_contents("filename.pdf");
$sRegexPattern = "/R\/[A-Za-z0-9\s\/\[\.\]]*\/Title\(([A-Za-z0-9\.\s\:]*)\)[\/Prev|>>]/";
preg_match_all($sRegexPattern, $sPdfContent, $aBookmarkMatches);
$aBookmarkTitles = $aBookmarkMatches[1];
foreach($aBookmarkTitles as $sBookmarkTitle) {
echo $sBookmarkTitle . '<br />';
String.prototype.getParams = function (search) {
var params = null;
var paramsObject = new Object();
if(search && search != ""){
params = this.substr(this.indexOf(search) + search.length + 1, this.length);
return params.substr(0, ((params.indexOf("&") == "-1") ? params.length : params.indexOf("&")));
}
String.prototype.getParams = function (search) {
var params = null;
var paramsObject = new Object();
if(search && search != ""){
params = this.substr(this.indexOf(search) + search.length + 1, this.length);
return params.substr(0, ((params.indexOf("&") == "-1") ? params.length : params.indexOf("&")));
}
String.prototype.splitColor = function(){
var color = this.replace("#", "");
if(color.indexOf(',') == -1 && color.indexOf(' ') == -1){
if(color.length == 6){
return [color.substr(0,2), color.substr(2,2), color.substr(4,2)];
}else if(color.length == 3){
return [color.substr(0,1), color.substr(1,1), color.substr(2,1)];