Skip to content

Instantly share code, notes, and snippets.

View luizs81's full-sized avatar
🏠
Working from home

Luiz Gustavo M. Sampaio luizs81

🏠
Working from home
View GitHub Profile
# Garmin Connect Workout Upload API β€” Lessons Learned
Notes from building and debugging a 4-week structured training plan (strength + cycling + running) uploaded via the Garmin Connect workout API. The API frequently accepts structurally valid JSON and returns "success" while silently storing something wrong or degraded. These are the failure modes worth checking for before trusting an upload.
## 1. Reps alone don't create sets
Sending a single step with `endConditionValue: 10` under a `reps` end condition produces one repetition, not "3 sets of 10." To get real sets, wrap the exercise + rest pair in a `RepeatGroupDTO`:
```json
{
@luizs81
luizs81 / signalr-client.js
Last active December 4, 2017 03:02
SignalR Client - JavaScript Implementation
$('#bid-area').hide();
loadJavascript('scripts/jquery.signalR-2.2.2.min.js', () => {
loadJavascript('signalr/hubs', () => {
fetchProduct();
getActivePoints();
getNumberOfBids();
getBidRanking();
});
});
-
github: luizs81
slack: luiz
@luizs81
luizs81 / Vagrantfile
Last active July 29, 2016 14:49
Bootstrap a Vagrant box with Ubuntu Trusty64 for Python development
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@luizs81
luizs81 / increase_swap.sh
Last active July 5, 2016 14:53 — forked from shovon/increase_swap.sh
How to create/increase swap file in Ubuntu
#!/bin/sh
# size of swapfile in megabytes
swapsize=8000
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@luizs81
luizs81 / MergeCSV.bas
Last active October 26, 2022 19:19
Import all CSV files from a folder into one Excel file, but separated sheets
Sub MergeCSV()
'Author: Jerry Beaucaire
'Date: 8/16/2010
'Summary: Import all CSV files from a folder into separate sheets
' named for the CSV filenames
'Update: 2/8/2013 Macro replaces existing sheets if they already exist in master workbook
Dim fpath As String
Dim fCSV As String
Dim wbCSV As Workbook
Dim wbMST As Workbook
@luizs81
luizs81 / currency_helper.php
Last active December 30, 2015 14:59
CodeIgniter helper to format numbers to Japanese currency, using the kanjis for thousand and ten thousand.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('format_yen'))
{
/**
* Returns a number in Japanese currency format
* @param float $value The number to be formated
* @param string $symbol_position Define if should use the pre or post aligned kanji
* @param string $decimal Define what to do with decimal part of number
* @return boolean|string Returns the formated number or FALSE in case of error.