Skip to content

Instantly share code, notes, and snippets.

View zaz's full-sized avatar

Zaz Brown zaz

View GitHub Profile
@ejmg
ejmg / org-to-latex-with-biber.md
Created January 23, 2017 07:15
How to use biber with orgmode --> latex

I may be wrong, but to my knowledge org-mode does not natively play well with biber for bibliography/reference purposes. Until I figure out a work around, here's what I've figured out along with what the internet has shown me.

Given that you are using biblatex with biber as your bibliography system, the file is test.org, and you have the necessary configurations (packages, .bib file, etc) you must:

  1. Export orgmode as latex with org-latex-export-to-latex

  2. Then via terminal:

pdflatex test.tex
@zaz
zaz / fizzbuzz.clj
Last active December 17, 2015 04:20
A simple solution to FizzBuzz — Clojure
(defn fizzbuzz?
"Determines what to print for a given number"
[x]
(condp #(zero? (mod %2 %1)) x
15 "fizzbuzz"
3 "fizz"
5 "buzz"
1 x))
(defn fizzbuzz
@zaz
zaz / dijkstra.py
Last active January 2, 2023 21:51
Dijkstra's algorithm — Python. Deprecated: Find the updated version at https://github.com/zaz/dijkstra
# Zaz Brown
# github.com/zaz/dijkstra
"""An efficient algorithm to find shortest paths between nodes in a graph."""
from collections import defaultdict
class Digraph(object):
def __init__(self, nodes=[]):
self.nodes = set()
self.neighbours = defaultdict(set)
self.dist = {}
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active October 6, 2023 09:46
Wait for an element to exist on the page with jQuery
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@econchick
econchick / gist:4666413
Last active December 22, 2023 13:32
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@manuelvanrijn
manuelvanrijn / database.rake
Created January 19, 2012 14:54
Retrieve and convert PostgreSQL database to SQLite database (with ssh)
require 'fileutils'
namespace :db do
desc 'pull the production PostgreSQL database into the development SQLite'
task :pull do
Rake::Task['db:download_pg_dump'].invoke
Rake::Task['db:optimze_pg_dump_for_sqlite'].invoke
Rake::Task['db:recreate_with_dump'].invoke
end