Skip to content

Instantly share code, notes, and snippets.

View fopasten's full-sized avatar

Felipe Joaquín Pastén Cáceres fopasten

  • Universidad Nacional Andres Bello
  • Santiago, Chile
View GitHub Profile
@bzerangue
bzerangue / video-embed.xsl
Created February 24, 2012 20:45
[XSLT] Video Embed XSL Template
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<!--
TO USE TEMPLATE, CALL TEMPLATE LIKE SO...
<xsl:call-template name="video-media">
<xsl:with-param name="width" select="640"/>
@jackiekazil
jackiekazil / rounding_decimals.md
Last active January 17, 2024 12:29
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

#!/usr/bin/env python3.4
import urllib.request
import asyncio
def return_response(url):
return urllib.request.urlopen(url).read()
@asyncio.coroutine
def read_page(loop, url):