Data URI manipulation made easy.
This isn't very robust, and will reject a number of valid data URIs. However, it meets the most useful case: a mimetype, a charset, and the base64 flag.
(function (){ | |
jQuery.fn.highlight = function (text, o) { | |
return this.each( function(){ | |
var replace = o || '<span class="highlight">$1</span>'; | |
$(this).html( $(this).html().replace( new RegExp('('+text+'(?![\\w\\s?&.\\/;#~%"=-]*>))', "ig"), replace) ); | |
}); |
Deploy Django-Nginx-uwsgi pada web faction | |
referensi: http://community.webfaction.com/questions/10242/installing-nginx-uwsgi | |
APPNAME="tracker" | |
/home/narayana/webapps/tracker | |
bin | |
start | |
stop |
""" | |
This fabric file makes setting up and deploying a django application much | |
easier, but it does make a few assumptions. Namely that you're using Git, | |
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have | |
Django installed on your local machine and SSH installed on both the local | |
machine and any servers you want to deploy to. | |
_note that I've used the name project_name throughout this example. Replace | |
this with whatever your project is called._ |
# Installing OpenCV python libs on mac to work with virtualenv | |
# OpenCV 2.4.3 | |
# Python 2.7.3 installed with brew | |
# assuming you have virtualenv, pip, and python installed via brew | |
# assuming $WORKON_HOME is set to something like ~/.virtualenvs | |
# using homebrew - make sure we're current | |
brew update |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<div class="selected"></div> | |
<svg id="chart" width="600" height="300"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script type="text/javascript"> |
from django.db.models import OuterRef | |
weapons = Weapon.objects.filter(unit__player_id=OuterRef('id')) | |
units = Unit.objects.filter(player_id=OuterRef('id')) | |
qs = Player.objects.annotate(weapon_count=SubqueryCount(weapons), | |
rarity_sum=SubquerySum(units, 'rarity')) |