Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Schinckel schinckel

View GitHub Profile
View LICENSE.md

MIT License

Copyright (c) 2019-2020 Matthew Schinckel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@schinckel
schinckel / pyproject.toml
Created December 18, 2019 05:37
Invalid requirements.txt generation
View pyproject.toml
[tool.poetry]
name = "foo"
version = "0.1.0"
description = ""
authors = ["Matthew Schinckel <matt@schinckel.net>"]
[tool.poetry.dependencies]
django = [
{version = "==1.11.26", python = "~2.7"},
{version = "*", python = ">=3.6"}
View pyproject.toml
[tool.poetry]
name = "poetry-2.7"
version = "0.1.0"
description = ""
authors = ["Matthew Schinckel <matt@schinckel.net>"]
[tool.poetry.dependencies]
[tool.poetry.dev-dependencies]
View textmate_environment_variables.rb
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
View textmate_environment_variables.rb
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
@schinckel
schinckel / data.sql
Created February 22, 2015 00:24
Ten pin bowling score calculation
View data.sql
-- Game 1
INSERT INTO bowling.frame VALUES
(1, 1, 1, 7, 2, NULL),
(1, 1, 2, 3, 7, NULL),
(1, 1, 3, 6, 4, NULL),
(1, 1, 4, 10, NULL, NULL),
(1, 1, 5, 10, NULL, NULL),
(1, 1, 6, 10, NULL, NULL),
(1, 1, 7, 9, 1, NULL),
(1, 1, 8, 10, NULL, NULL),
View Boiled Chocolate Cake
Boil together:
* 125g butter
* 1 cup water
* 1 1/2 cups sugar
* 2 tablespoons cocoa
* 1/2 teaspon bicarb soda
Simmer 5 mins.
@schinckel
schinckel / install.sh
Last active August 9, 2017 18:01 — forked from bradrydzewski/install.sh
Drone.io Install Postgres9.4
View install.sh
#!/bin/bash
# remove existing 9.3 installation
sudo /etc/init.d/postgresql stop
sudo apt-get --force-yes -fuy remove --purge postgresql postgresql-9.1 postgresql-client
# install 9.4
sudo apt-get install python-software-properties
sudo add-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main 9.4'
sudo apt-get update
View get-django-view-class
from django.views.generic.base import View
def get_class(func):
if not getattr(func, 'func_closure', None):
return
for closure in func.func_closure:
contents = closure.cell_contents
if not contents:
@schinckel
schinckel / selectable.js
Created April 2, 2013 11:39
Knockout extension: selectable observableArray
View selectable.js
/*
Provide an observableArray with some smarts related to selection
of an item, or items within it.
If 'multiple' is passed in, then it is a multiply selectable
array, and has two new attributes: ``selectedItems`` and ``selectedIndexes``.
If 'multiple' is not passed in, then it new attributes of
``selectedItem`` and ``selectedIndex`` are created.