The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
| #Copyright (c) 2012 Vipin Nair <swvist@gmail.com> | |
| #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: | |
| #The above copyright notice and this permission notice shall be included in all |
| import base64 | |
| import os | |
| from tastypie.fields import FileField | |
| from django.core.files.uploadedfile import SimpleUploadedFile | |
| class Base64FileField(FileField): | |
| """ | |
| A django-tastypie field for handling file-uploads through raw post data. | |
| It uses base64 for en-/decoding the contents of the file. | |
| Usage: |
| #! /usr/bin/env python | |
| ''' | |
| This is more of a personal reference as I use json very often. | |
| The httplib2 examples are VERY good, and you should refer to them: | |
| http://code.google.com/p/httplib2/wiki/Examples | |
| ''' | |
| from httplib2 import Http | |
| try: |
| # This method finds related articles using Jaccard index (optimized for PostgreSQL). | |
| # More info: http://en.wikipedia.org/wiki/Jaccard_index | |
| class Article < ActiveRecord::Base | |
| def related(limit=10) | |
| Article.find_by_sql(%Q{ | |
| SELECT | |
| a.*, | |
| ( SELECT array_agg(t.name) FROM taggings tg, tags t |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2
(by @andrestaltz)
So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
| -- Table: sales | |
| -- DROP TABLE sales; | |
| CREATE TABLE sales | |
| ( | |
| period date NOT NULL, | |
| sales numeric(10,0), | |
| ) |
extension_id=jifpbeccnghkjeaalbbjmodiffmgedin # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc"
unzip -d "$extension_id-source" "$extension_id.zip"Thx to crxviewer for the magic download URL.