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
function pdf_merge { | |
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" | |
read "output_file?Name of output file > " | |
"$join_py" -o $output_file $@ && open $output_file | |
} |
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
extends layout | |
block content | |
.row | |
.col-md-8 | |
h1="Create a PDF" | |
form.form-horizontal.well(method="post", action="/pdf") | |
.form-group | |
label.col-md-2.control-label File Name | |
.col-md-10 | |
.input-group |
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
doctype html | |
html | |
head | |
title= title | |
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/flatly/bootstrap.min.css') | |
link(rel='stylesheet', href='/stylesheets/style.css') | |
body | |
block content |
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
const express = require('express') | |
const router = express.Router() | |
const PDFDocument = require('pdfkit') | |
router.post('/', (req, res) => { | |
const doc = new PDFDocument() | |
let filename = req.body.filename | |
// Stripping special characters | |
filename = encodeURIComponent(filename) + '.pdf' | |
// Setting response to 'attachment' (download). |
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
... | |
var index = require('./routes/index'); | |
var users = require('./routes/users'); | |
var pdf = require(‘./routes/pdf’); // <-- add this line | |
... | |
app.use('/', index); | |
app.use('/users', users); | |
app.use('/pdf', pdf); // <-- add this line | |
... |
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 } from 'react'; | |
// Returns an empty "loader" div if empty, | |
// Return unchanged WrappedComponent if not empty | |
const LoaderHOC = (WrappedComponent) => { | |
return class LoaderOC extends Component { | |
render() { | |
return (!this.props.question) | |
? <div className='loading'></div> | |
: <WrappedComponent {...this.props} /> |
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 LoaderHOC from './LoaderHOC' | |
// ... | |
class ContactsApp extends Component { | |
// ... | |
} | |
export default LoaderHOC(ContactsApp); |
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 } from 'react' | |
import './App.css' | |
import { getUser } from './api/github' | |
const renderLine = (user, key) => <li key={key}><b>{key}</b>: {user[key]}</li> | |
class App extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { user: {} } |
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
const rest = require('rest') | |
const mime = require('rest/interceptor/mime') | |
export default rest.wrap(mime) |
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 request from './request' | |
const getUser = user => request(`https://api.github.com/users/${user}`) | |
export { getUser } |