This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Firebase auth scheme | |
// https://auth.nuxtjs.org/guide/scheme.html#schemes | |
import firebase from 'firebase/app' | |
import 'firebase/auth' | |
const DEFAULTS = { | |
appName: undefined, | |
token_type: 'Bearer', | |
userinfo_endpoint: `https://identitytoolkit.googleapis.com/v1/accounts:lookup`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function RUTDV(rut) | |
rut = Replace("0000" & rut, ".", "", 1) | |
If InStr(1, rut, "-") > 0 Then rut = Left(rut, InStr(1, rut, "-") - 1) | |
rut = Right(rut, 8) | |
suma = 0 | |
For i = 1 To 8 | |
suma = suma + Val(Mid(rut, i, 1)) * Val(Mid("32765432", i, 1)) | |
Next i | |
dv = 11 - (suma Mod 11) | |
If dv = 10 Then dv = "k" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
using System.Text; | |
/// <summary> | |
/// Helper methods for working with <see cref="Guid"/>. | |
/// </summary> | |
public static class GuidUtility | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/15769948/round-a-python-list-of-numbers-and-maintain-the-sum | |
from decimal import Decimal, ROUND_HALF_UP | |
def round_amounts(amounts, original_amount, decimal_places): | |
amounts = [Decimal(str(amount)) for amount in amounts] | |
places = Decimal(10) ** -decimal_places | |
rounded_list = ( | |
[amount.quantize(places, ROUND_HALF_UP) for amount in amounts]) |