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
// This is an incomplete example but has the gist of it | |
successCB = (blob) => { | |
let objectURL = URL.createObjectURL(blob); | |
let a = document.createElement("a"); | |
a.href = objectURL; | |
a.download = 'MyPDF'; | |
document.body.appendChild(a); | |
a.click(); | |
setTimeout(()=>{a.remove()}, 1000); |
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
// This example uses ReactJS but can be substituted for something else. Uses html2canvas and FileSaver. | |
// This example saves a leaflet map | |
saveMap = () => { | |
let mapNode = ReactDOM.findDOMNode(this.refs.leafletMap) | |
html2canvas(mapNode, { | |
useCORS: true, | |
onrendered: (canvas) => { | |
canvas.toBlob((blob) => { | |
FileSaver.saveAs(blob, "MyMap.png"); |
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
// http://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc | |
// https://technet.microsoft.com/en-us/library/ee309278(office.12).aspx | |
import Dropzone from 'react-dropzone'; | |
import Button from 'react-bootstrap/lib/Button'; | |
const acceptedMimeTypes = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"; | |
... |
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 os | |
# Uninstall node and all node packages (will require `npm install` on your projects again) | |
os.system('brew uninstall node') | |
os.system('sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules') | |
os.system('sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*') | |
# Install brew, node, npm | |
os.system('/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"') | |
os.system('brew install node') |
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 re | |
import glob | |
def main(): | |
outputFile = 'output.tsv' | |
files = glob.glob('*.html') | |
print "Extracting from %s files" %(len(files)) | |
data = [] |
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
def main(): | |
packet = "|dc|ef|09|b0|e8|ba|ac|bc|32|91|f2|93|08|00|45|00|00|68|d8|73|40|00|40|06|4a|cd|c0|a8|01|07|95|38|c0|67|f5|62|0b|b9|3a|03|1d|1d|8f|c2|52|1d|80|18|10|15|64|61|00|00|01|01|08|0a|4e|2a|51|99|00|e4|c8|7e|03|00|00|34|2f|e0|00|00|00|00|00|43|6f|6f|6b|69|65|3a|20|6d|73|74|73|68|61|73|68|3d|67|6c|6f|77|63|6c|6f|75|64|5c|66|72|65|64|0d|0a|01|00|08|00|0b|00|00|00|" | |
packet = ''.join(packet.split('|')) | |
print packet.decode("hex") | |
if __name__ == '__main__': | |
main() |
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 tornado.web | |
import tornado.escape | |
import tornado.ioloop | |
def main(): | |
application = tornado.web.Application([ | |
(r'/data', DataHandler), | |
(r'/ping', PingHandler) | |
]) |
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
# http://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository | |
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch |
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
# IE users need: https://get.adobe.com/reader/ | |
from PyPDF2 import PdfFileWriter, PdfFileReader | |
output = PdfFileWriter() | |
ipdf = PdfFileReader(open('old.pdf', 'rb')) | |
for i in xrange(ipdf.getNumPages()): | |
page = ipdf.getPage(i) | |
output.addPage(page) |
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
<!-- The missing piece for: https://github.com/stimulsoft/Samples-JS/tree/master/Node.js/04.%20Start%20SQL%20Adapters%20from%20Http%20Server --> | |
<html> | |
<head> | |
<link href="stimulsoft.viewer.office2013.css" rel="stylesheet"> | |
</head> | |
<body> | |
<h4>Hello World</h4> | |
<script src="stimulsoft.reports.js" type="text/javascript"></script> |