(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // REQUIRES: | |
| // moment.js - http://momentjs.com/ | |
| // USAGE: | |
| // {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n] | |
| // EXAMPLES: | |
| // {{ someDate | moment: 'format': 'MMM DD, YYYY' }} | |
| // {{ someDate | moment: 'fromNow' }} |
| en: | |
| errors: &errors | |
| messages: | |
| bad_uri: is an invalid url | |
| bad_protocol: must start with %{protocols} | |
| activemodel: | |
| errors: | |
| <<: *errors | |
| activerecord: | |
| errors: |
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.
First let's check something.
brew info postgresqlThe top of what gets printed as a result is the most important:
| function createUser(username, callback) { | |
| var connection = DatabaseClient.connect(); | |
| var users = connection.call('collection', 'users'); | |
| var query = users.call('query', {username: username}); | |
| return query.then(function(existing){ | |
| if(existing) throw new Error("User already exists: " + username); | |
| else return users.call('create', {username: username}); | |
| }).fin(function(connection){ return connection.call('close'); }); | |
| } |
| #!/usr/bin/env zsh | |
| # -*- encoding: utf-8 -*- | |
| # Copyright (c) 2015 by Peter Hillerström | |
| # License: MIT License | |
| # This can be sourced from zsh dotfiles. If you don't care about other | |
| # functions than `about`, put them inside the about function. | |
| # Output can be piped to GNU `fmt -s` command for nice formatting. | |
| about() { |
| <!doctype html> | |
| <!-- Adapted from https://gist.github.com/tfausak/2222823 --> | |
| <html> | |
| <head> | |
| <title>Mobile-ready web app</title> | |
| <!-- CONFIGURATION --> |
| import csv | |
| from django.http import HttpResponse | |
| def export_as_csv_action(description="Export selected objects as CSV file", fields=None, exclude=None, header=True): | |
| """ | |
| This function returns an export csv action | |
| 'fields' and 'exclude' work like in django ModelForm | |
| 'header' is whether or not to output the column names as the first row | |
| """ | |
| def export_as_csv(modeladmin, request, queryset): |