Skip to content

Instantly share code, notes, and snippets.

View Export MUBI lists.js
$('#multi-films .film-grid').children().map(function() {
var $this = $(this),
rank = $this.find('.list-film-position').text().trim(),
title = $this.find('.film-title').text().trim(),
dirYear = $this.find('.director-year').text().trim(),
re = dirYear.match(/^(.+), (\d+)$/),
dir = re ? re[1] : dirYear,
year = re ? re[2] : '';
return [rank, title, year, dir].join('\t');
}).get().join('\n');
View create_function_plv8_cuid.sql
-- original code: https://github.com/ericelliott/cuid
-- Add the "plv8" extension
create extension if not exists "plv8";
-- Add the "pgcrypto" extension
create extension if not exists "pgcrypto";
\dx
-- Connect a database
View revert-migration.py
from django.db.migrations.recorder import MigrationRecorder
>>> MigrationRecorder.Migration.objects.all()
>>> MigrationRecorder.Migration.objects.latest('id')
Out[5]: <Migration: Migration 0050_auto_20170603_1814 for model>
>>> MigrationRecorder.Migration.objects.latest('id').delete()
Out[4]: (1, {u'migrations.Migration': 1})
View TNG-ideal-types.md

Star Trek TNG Ideal Types

Can be found in different ratios per episode.

  • Inexplicable being of pure energy.
  • Q acting the bellend.
  • Someone is horny.
  • Counsellor Troy's mum.
  • Holodeck rubbish.
  • Data learns something.
View makeScale.scd
// "http://coleingraham.com/2014/09/26/an-approach-to-custom-scales-in-supercollider/"
s.boot;
(
~makeScale = { |ratios|
Scale(
(0..ratios.size-1),
ratios.size,
Tuning((ratios.ratiomidi % 12).sort)
View prettier-diff.sh
$ PATH=$(npm bin):$PATH; git diff-tree --no-commit-id --name-only -r HEAD | xargs prettier --write
View artists-example.xml
<?xml version="1.0" encoding="UTF-8"?>
<artists>
<artist>
<images>
<image height="450" type="primary" uri="" uri150="" width="600" />
<image height="771" type="secondary" uri="" uri150="" width="600" />
</images>
<id>1</id>
<name>The Persuader</name>
<realname>Jesper Dahlbäck</realname>
View docker-postgres-restore.sh
$ docker exec -i $CONTAINER pg_restore --dbname=$DATABASE --verbose --clean -U $USER < pg_dump --format custom $DATABASE
View Elasticsearch install and uninstall.txt
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
View .style.yapf
# .style.yapf
#
# DESCRIPTION
# Configuration file for the python formatter yapf.
#
# This configuration is based on the generic
# configuration published on GitHub.
#
# AUTHOR krnd
# VERSION v1.0