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.
| class MyClassWrapper(object): | |
| def __init__(self, f, myarg): | |
| self.myarg = myarg | |
| self.args = '' | |
| self.kwargs = '' | |
| self.func = f | |
| def __call__(self, *args, **kwargs): | |
| self.args = args |
| $('.fs-about').click(function(event) { | |
| var aboutRect, eleRect; | |
| event.preventDefault(); | |
| eleRect = this.getBoundingClientRect(); | |
| aboutRect = { | |
| top: eleRect.bottom, | |
| left: eleRect.right - $('#about').outerWidth() | |
| }; | |
| $(this).addClass('selected'); | |
| $('#about').show().offset({ |
| import base64 | |
| import cStringIO | |
| from django.core.files.uploadedfile import InMemoryUploadedFile | |
| # ... | |
| if request.POST.get('file') and request.POST.get('name'): | |
| file = cStringIO.StringIO(base64.b64decode(request.POST['file'])) | |
| image = InMemoryUploadedFile(file, | |
| field_name='file', |
| -- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group | |
| -- http://www.postgresql.jp/document/9.2/html/tutorial-window.html | |
| CREATE TABLE empsalary ( | |
| depname varchar(10) not null | |
| , empno integer not null | |
| , salary integer not null | |
| ); | |
| INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200); |
| web: run-program gunicorn arena.wsgi | |
| celery_beat: run-program celery -A arena beat -l info | |
| celery1: run-program celery -A arena worker -Q default -l info --purge -n default_worker | |
| celery2: run-program celery -A arena worker -Q feeds -l info --purge -n feeds_worker |
| @zed = @zed ? {} | |
| @zed.info = do -> | |
| #private | |
| name = "" | |
| getName = -> name | |
| setName = (value) -> name = value | |
| age = 0 | |
| getAge = -> age |
| # A class-based template for jQuery plugins in Coffeescript | |
| # | |
| # $('.target').myPlugin({ paramA: 'not-foo' }); | |
| # $('.target').myPlugin('myMethod', 'Hello, world'); | |
| # | |
| # Check out Alan Hogan's original jQuery plugin template: | |
| # https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
| # | |
| (($, window) -> |
| // Intercepting HTTP calls with AngularJS. | |
| angular.module('MyApp', []) | |
| .config(function ($provide, $httpProvider) { | |
| // Intercept http calls. | |
| $provide.factory('MyHttpInterceptor', function ($q) { | |
| return { | |
| // On request success | |
| request: function (config) { | |
| // console.log(config); // Contains the data about the request before it is sent. |