Skip to content

Instantly share code, notes, and snippets.

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

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
Iterator-based code
View gist:5628390
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 Dec 18, 2015
PyQt5 PKGBUILD
View 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 Dec 19, 2015
pdftk-bin & libgcj14
View libgcj14_PKGBUILD
# 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 \
View rust-kate-highlighting.patch
--- /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">
View noconverge.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View matlab.desktop
#!/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
View dkami.py
#!/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
View assignment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View knee.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.