Skip to content

Instantly share code, notes, and snippets.

View cjharkins's full-sized avatar
🏠
Working from home

Cory Harkins cjharkins

🏠
Working from home
  • Asurion
  • Nashville, TN
View GitHub Profile
@cjharkins
cjharkins / css_colors.js
Created September 8, 2017 13:44 — forked from bobspace/css_colors.js
All of the CSS Color names as an array in javascript.
// CSS Color Names
// Compiled by @bobspace.
//
// A javascript array containing all of the color names listed in the CSS Spec.
// The full list can be found here: http://www.w3schools.com/cssref/css_colornames.asp
// Use it as you please, 'cuz you can't, like, own a color, man.
var CSS_COLOR_NAMES = ["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory"
@cjharkins
cjharkins / placeholder-jspdf.js
Created January 29, 2020 16:19
Placeholder jspdf A
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF()
doc.save(filename)
}
@cjharkins
cjharkins / App.js
Last active December 1, 2020 09:56
jspdf-app.js
import React, {useState} from 'react';
import logo from './logo.svg';
import './App.css';
import pdf from './utils/pdf'
function App() {
const [searching, setSearching] = useState(false)
const [movieList, setMovieList] = useState([])
const [searchText, setSearchText] = useState('')
@cjharkins
cjharkins / jsdpf-2.js
Created January 29, 2020 16:30
jspdf-2
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({
orientation: 'l',
unit: 'pt',
format: 'a4'
})
doc.save(filename)
}
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = { // NEW CODE
height: 595.28,
width: 841.89
}
doc.save(filename)
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = {...}
const pageMargin = 50 // NEW CODE
// NEW CODE
const liveArea = {
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = {...}
const pageMargin = 50
const liveArea = {...}
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
const xPositions = [] // NEW CODE
// NEW CODE
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
// NEW CODE
 doc.line(pageMargin, pageMargin + 3.5, liveArea.width , pageMargin + 3.5)
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
// NEW CODE
// ROWS
data.forEach((row, rIndex) => {