Skip to content

Instantly share code, notes, and snippets.

View javorosas's full-sized avatar

Javier Rosas javorosas

View GitHub Profile
@javorosas
javorosas / postJson.m
Last active September 29, 2015 00:56
Send NSDictionary as JSON via POST using NSURLSession
// 1. Populate an NSDictionary with the data you want to send
NSDictionary *exampleData = @{
@"first": @"Javier",
@"last": @"Rosas",
@"address": @"742 Evergreen Terrace"
};
// 2. Serialize your data to JSON format and store it in an NSData object
NSErrpr *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:exampleData options:0 error:&error];
#include <RTCZero.h>
const byte button = 5;
bool ledIsOn = false;
volatile bool shouldBeSleeping = false;
volatile bool isResetPressed = false;
bool wasResetPressed = false;
int millisLastTimeResetWasPressed = 0;
@javorosas
javorosas / index.html
Created July 18, 2016 23:43
Google sign in example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Login</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="764821343773-cjpf8lnubnnmjrupiu8oen4vsacgcq9n.apps.googleusercontent.com">
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
@javorosas
javorosas / impuestos_compuestos.md
Last active November 11, 2019 18:47
Factura con impuestos compuestos usando Facturapi

Ejemplo para crear una factura con impuestos compuestos.

NOTA: withholding es un boleano para marcar el impuesto como retención.

{
  "customer": {
    "legal_name": "John Wick",
    "tax_id": "WXKE800401B12"
 },
@javorosas
javorosas / uploadCsd.js
Created October 22, 2020 15:45
[Facturapi] Subir certificados de sello digital (CSD)
const run = async () => {
const Facturapi = require('facturapi')
const fs = require('fs');
const path = require('path');
const facturapi = new Facturapi('sk_user_LLAVE_DE_USUARIO');
const cerStream = fs.createReadStream(path.join(__dirname, 'cer.cer'));
const keyStream = fs.createReadStream(path.join(__dirname, 'key.key'));
console.log({ keyBuffer });