Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
height: 34px; | |
width: 100%; | |
border-radius: 3px; | |
border: 1px solid transparent; | |
border-top: none; | |
border-bottom: 1px solid #DDD; | |
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(() => { | |
if (window.tinysort === undefined) { | |
var script = document.createElement('script'); | |
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/tinysort/2.3.0/tinysort.min.js'; | |
script.onload = function() { | |
sortGoodreads(); | |
}; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} else { | |
sortGoodreads(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A very classy shadow. */ | |
.classy-shadow { | |
box-shadow: -1px 0 0 0 #d1d1d1, | |
-1px 0 0 0 #e5e5e5, | |
1px 0 0 0 #d1d1d1, | |
2px 0 0 0 #e5e5e5, | |
0 -1px 0 0 #e7e7e7, | |
0 2px 0 0 rgba(240, 240, 240, 0.3), | |
0 1px 0 0 #b0b0b0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LSystem(object): | |
def __init__(self, axiom, rules): | |
self.axiom = axiom | |
self.rules = rules | |
self.string = self.axiom | |
self.generation = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.help-hover').popover({ | |
trigger: 'hover' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function roundToSignificantFigures(num, sigFigs, truncationFunc) { | |
if (num == 0) { | |
return 0; | |
} | |
// We use base 5 because it makes for pretty numbers without intervals | |
// quite as large as base 10. | |
var d = Math.ceil(Math.log(num < 0 ? -num: num) / Math.log(5)); | |
var power = sigFigs - d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Via: http://palewi.re/posts/2009/03/03/django-recipe-dump-your-queryset-out-as-a-csv-file/ | |
import csv | |
from django.db.models.loading import get_model | |
def dump2csv(qs, outfile_path): | |
""" | |
Takes in a Django queryset and spits out a CSV file. | |
Usage:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import permissions | |
class IsOwner(permissions.BasePermission): | |
""" | |
Custom permission to only allow owners of an object to edit it. | |
""" | |
def has_permission(self, request, view): | |
return request.user and request.user.is_authenticated() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
class AlterOrderWithRespectTo(migrations.AlterOrderWithRespectTo): | |
""" | |
Represents a change with the order_with_respect_to option. | |
""" |
NewerOlder