Skip to content

Instantly share code, notes, and snippets.

View MBAustin's full-sized avatar

Matthew Austin MBAustin

  • University of British Columbia
  • Vancouver, BC
View GitHub Profile
{%- macro mathjax(url='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML') -%}
<!-- Load mathjax -->
<script src="{{url}}"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
out=`basename $CONDA_PREFIX`
unset PS1
PS1="\w ${out} \u\n% "
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, key) for key, value, in enums.iteritems())
enums['reverse_mapping'] = reverse
return type('Enum', (), enums)
/**
* Plot selected lines on map
*/
private void plotLines() {
StationManager stationManager = StationManager.getInstance();
Station stationObject = stationManager.getSelected();
if (stationObject != null) {
for (Line line : stationObject.getLines()) {
int color = line.getColour();
Set<Branch> setOfLineBranches = line.getBranches();
import re, sys, time
from PyQt4 import QtCore, QtGui, QtWebKit
from bs4 import BeautifulSoup
#comment out this line to see QT warnings:
# QtCore.qInstallMsgHandler(lambda *args: None)
# QtWebKit.QWebSettings.PluginsEnabled = True
debug = True
finished = False
@MBAustin
MBAustin / my_scraper.py
Last active November 18, 2016 05:34
My Scraper
import re, sys, time
from PyQt4 import QtCore, QtGui, QtWebKit
from bs4 import BeautifulSoup
#comment out this line to see QT warnings:
# QtCore.qInstallMsgHandler(lambda *args: None)
# QtWebKit.QWebSettings.PluginsEnabled = True
debug = True
finished = False
@MBAustin
MBAustin / example.py
Created November 18, 2016 00:39
Example
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
class WebPage(QtWebKit.QWebPage):
def __init__(self):
super(WebPage, self).__init__()
self.mainFrame().loadFinished.connect(self.handleLoadFinished)
def start(self, urls):
print('starting')
import re, sys, time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from bs4 import BeautifulSoup
import threading
mutex = QMutex()
lock = threading.RLock()
import re, sys, time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from bs4 import BeautifulSoup
class Render(QWebPage):
def __init__(self, url):
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from bs4 import BeautifulSoup
qInstallMsgHandler(lambda *args: None)
class Render(QWebPage):
def __init__(self, url):