Headings from h1
through h6
are constructed with a #
for each level:
# h1 Heading
## h2 Heading
### h3 Heading
#!/usr/bin/python | |
from PIL import Image | |
from pyexiv2 import ImageMetadata | |
def is16to9(img): | |
img.size | |
return img.size[0] * 9 == img.size[1] * 16 | |
def cropTo16to9(img): |
# Test for scaling function. Python 2.7. | |
# http://www.nerdydork.com/django-custom-upload-handler-to-compress-image-files.html | |
def scale_dimensions(width, height, longest_side): | |
if width > longest_side: | |
ratio = longest_side * 1. / width | |
return (int(width * ratio), int(height * ratio)) | |
elif height > longest_side: | |
ratio = longest_side * 1. / height | |
return (int(width * ratio), int(height * ratio)) | |
return (width, height) |
The first step is to remove older version of PostGIS if any.
sudo apt-get purge postgis
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
# Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
# Original author: udfalkso | |
# Modified by: Shwagroo Team and Gun.io | |
import sys | |
import os | |
import re | |
import hotshot, hotshot.stats | |
import tempfile | |
import StringIO |
""" | |
The MIT License (MIT) | |
Copyright (c) 2011 Numan Sachwani | |
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: |
var crypto = require('crypto'); | |
exports.hashObject = function (object) { | |
var hash = crypto.createHash('md5') | |
.update(JSON.stringify(object, function (k, v) { | |
if (k[0] === "_") return undefined; // remove api stuff | |
else if (typeof v === "function") // consider functions | |
return v.toString(); | |
else return v; | |
})) |
When [Markdown][markdown] appeared more than 10 years ago, it aimed to make it easier to express ideas in an easy-to-write plain text format. It offers a simple syntax that takes the writer focus away from the formatting, thus giving her time to focus on the actual content.
The market abunds of editors to be used for help with markdown. After a few attempts, I settled to Sublime and its browser preview plugin, which work great for me and have a small memory footprint to accomplish that. To pass the results around to other people, less technical, a markdown file and a bunch of images is not the best approach, so converting it to a more robust format like PDF seems like a much better choice.
[Pandoc][pandoc] is the swiss-army knife of converting documents between various formats. While being able to deal with heavy-weight formats like docx and epub, we will need it for the more lightweight markdown. To be able to generate PDF files, we need LaTeX. On OSX, the s
import { Injectable } from 'angular2/core'; | |
import { Storage } from './storage'; | |
import { CurrentUser } from '../interfaces/common'; | |
@Injectable() | |
export class Authentication{ | |
private _storageService : Storage; | |
private _userKey : string = "CURRENT_USER"; | |
constructor(storageService : Storage){ |
import {TranslateLoader} from "ng2-translate/ng2-translate"; | |
import {Observable} from "rxjs/Observable"; | |
import {Response, Http} from "angular2/http"; | |
export class TranslateLSLoader implements TranslateLoader { | |
constructor(private http: Http, private prefix: string = 'i18n', private suffix: string = '.json') {} | |
/** | |
* Gets the translations from the localStorage and update them with the ones from the server | |
* @param lang |