Skip to content

Instantly share code, notes, and snippets.

@fjsj
fjsj / hn_seach.js
Last active September 21, 2015 14:35 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
total = 0, shown = 0,
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments);
// This traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.className === klass) {
@fjsj
fjsj / has_missing_migrations.py
Last active May 21, 2017 04:51 — forked from nealtodd/gist:a8f87b0d95e73eb482c5
Django management command to detect missing migration files.
import sys
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connections
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from django.db.utils import OperationalError
SELECT
sum(idx_blks_read) as idx_read,
sum(idx_blks_hit) as idx_hit,
(sum(idx_blks_hit) - sum(idx_blks_read)) / sum(idx_blks_hit) as ratio
FROM
pg_statio_user_indexes;