Skip to content

Instantly share code, notes, and snippets.

@flying-sheep
flying-sheep / gist:5627847
Created May 22, 2013 14:16
Firefox Generator/Iterator glossary

Glossary

Iterator
Object with .next(), .send(obj) and .close() methods.

It is iterable via for...of and for...in loops. Both ways act the same, i.e. call .next() repeatedly until it throws a StopIteration.

Generator expression
Iterator created via e.g. (x*2 for (x of array)).

@flying-sheep
flying-sheep / gist:5628390
Created May 22, 2013 15:15
Iterator-based code
function parseTable(title, lines) {
let options = new TableOptions(lines.next());
...
yield '<table>';
for (let line of lines) {
if (line.startsWith(macros.tableEnd))
break;
...
@flying-sheep
flying-sheep / PKGBUILD
Last active December 18, 2015 14:48
PyQt5 PKGBUILD
pkgbase=pyqt5
pkgname=('pyqt5-common' 'pyqt5' 'python2-pyqt5')
pkgver=5.0
pkgrel=1
arch=('i686' 'x86_64')
url="http://riverbankcomputing.co.uk/software/pyqt/intro"
license=('GPL')
makedepends=('python-sip>=4.14.7' 'python2-sip>=4.14.7' 'python-dbus' 'python2-dbus'
'phonon' 'mesa' 'python2-opengl' 'qt5-tools' 'qt5-webkit')
source=("http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-$pkgver/PyQt-gpl-$pkgver.tar.gz")
@flying-sheep
flying-sheep / libgcj14_PKGBUILD
Last active December 19, 2015 14:08
pdftk-bin & libgcj14
# Please report PKGBUILD bugs at
# https://github.com/ystein/archlinux-aur-packages
# Maintainer: Yannik Stein <yannik.stein [at] gmail.com>
pkgname='libgcj14'
pkgver=4.8.1_6
pkgrel=1
pkgdesc="Dynamically load and interpret java class files. Built from binary \
executables available in Debian repositories. Please report PKGBUILD bugs at \
--- /usr/share/apps/katepart/syntax/rust.xml 2013-07-04 04:22:11.000000000 +0200
+++ /home/phil/.kde4/share/apps/katepart/syntax/rust.xml 2013-07-05 21:24:49.000000000 +0200
@@ -7,7 +7,7 @@
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
]>
-<language name="Rust" version="0.7" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
+<language name="Rust" version="0.8" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
<highlighting>
<list name="fn">
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Icon=matlab
Name=MATLAB
Comment=Start MATLAB - The Language of Technical Computing
Exec=env -u _JAVA_OPTIONS matlab -desktop -nosplash -r "cd('%d'); edit '%f'"
Categories=Development;
MimeType=text/x-matlab;
StartupWMClass=sun-awt-X11-XFramePeer
#!/usr/bin/env python3
import re
from contextlib import closing
from epub import create_epub, DEFAULT_STYLESHEET
import requests
import requests_cache
from bs4 import BeautifulSoup
from smartypants import smartypants
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.