Skip to content

Instantly share code, notes, and snippets.

@philfreo
philfreo / html2pdf.py
Created June 21, 2013 22:50
A Flask view that returns HTML or generates a PDF
import mimerender
mimerender.register_mime('pdf', ('application/pdf',))
mimerender = mimerender.FlaskMimeRender(global_charset='UTF-8')
def render_pdf(html):
from xhtml2pdf import pisa
from cStringIO import StringIO
pdf = StringIO()
pisa.CreatePDF(StringIO(html.encode('utf-8')), pdf)
@bhays
bhays / Typeahead-BS3-css
Created August 2, 2013 13:54
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
@fractaledmind
fractaledmind / Skim Page Splitter
Last active May 31, 2019 17:08
This little program uses the Mac app Skim to split scanned PDFs that have two pages layed out on a single PDF page in landscape mode.
(* SPLIT TWO-PAGE PDFS
--Stephen Margheim
-- 11/2/13
-- open source
VERSION 3.0
--Version 3 adds a feature for OCR'd PDFs. If your PDF has been OCR'd, the script now automatically crops the individual pages so that the text field is centered.
This little program uses the Mac app Skim to split scanned PDFs that have two pages layed out on a single PDF page in landscape mode:
@jacrook
jacrook / font_variables.scss
Last active June 16, 2024 18:15
Sass Css Font Stack Variables
//////////////////////////////////////////////////////////////
// Font Variables (http://cssfontstack.com/)
//////////////////////////////////////////////////////////////
//
// Serif font-stacks
//
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default;
@fadhlirahim
fadhlirahim / installing_supervisor_macosx.md
Last active December 31, 2023 14:45
Setting up supervisord in Mac OS X

Installation

Installing Supervisor on OS X is simple:

sudo pip install supervisor

This assumes you have pip. If you don't:

@subchen
subchen / copy-pre-code.html
Last active May 24, 2019 06:31
zero-clipboard demo
<style>
.zero-clipboard {
position: relative;
}
.btn-clipboard {
position: absolute;
top: 0;
right: 0;
z-index: 10;
display: block;
@redoPop
redoPop / anki_mobile_card.html
Created February 7, 2015 19:22
HTML used by AnkiMobile to render card templates; a reference for creating advanced Anki card templates with special HTML/CSS. When used by AnkiMobile, the card's HTML replaces the `<!-- (Card contents) -->` comment in this gist, with the shared styles dropped inline inside a `<style>` tag.
<!doctype html>
<html class=" webkit safari mobile iphone js">
<head>
<meta name="viewport" content="width=device-width;">
<style id="ss"></style>
<style>
body {
text-align: center;
font-size: 1em;
-webkit-transform: translate3d(0,0,0);
@deanishe
deanishe / anki.py
Last active August 29, 2015 14:19
Demonstration of Alfred Script Filter interaction model for entering flash cards
#!/usr/bin/python
# encoding: utf-8
#
# Copyright © 2015 Dean Jackson <[email protected]>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-04-20
#
@natcl
natcl / ImportPhoto.scpt
Last active November 11, 2020 18:56
OSX Folder Action to automatically import files added to a folder in Photos.app
property imageFiles : {"jpg", "pef", "dng", "jpeg"}
on adding folder items to theWatchedFolder after receiving theDetectedItems
repeat with theItem in theDetectedItems
set theItemPath to POSIX path of theItem
set ImageFile to POSIX file theItemPath
tell application "System Events"
if name extension of theItem is in imageFiles then
tell application "Photos"
set DestinationAlbumName to "Inbox"
@ericmjl
ericmjl / merger.py
Created June 5, 2015 16:50
A Python script for merging PDF files together.
"""
Author: Eric J. Ma
Purpose: To merge PDFs together in an automated fashion.
"""
import os
from PyPDF2 import PdfFileReader, PdfFileMerger