Skip to content

Instantly share code, notes, and snippets.

{
"public_identifier": "eden-marco",
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/eden-marco/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20230724%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20230724T012638Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8d1f5d80d376442e9e101280e6b1eeff9084be53ffa73aa78f2bb074087899ae",
"background_cover_image_url": null,
"first_name": "Eden",
"last_name": "Marco",
"full_name": "Eden Marco",
"follower_count": null,
"occupation": "Customer Engineer at Google",
"headline": "Customer Engineer @ Google Cloud | Best-selling Udemy Instructor | Backend dev with passion for GenAI",
@martin1007
martin1007 / observe infinite loop
Created August 18, 2018 20:16
R Shiny infinite loop
After two numbers are inputed, the program is supposed to multiply them and output in the third row of dataframe.
However, program goes to infinite loop. Also, multiplication should not truncate or round up/down the double numbers.
Please advise how to solve it. Thank you
library(shiny)
library(rhandsontable)
create_df <- function(){
GM<-data.frame(matrix(0.0, ncol = 5, nrow = 3))
@martin1007
martin1007 / format_issue
Created August 18, 2018 19:46
R Shiny number formatting issues in rhandsontable
I created a simple table using rhandsotable library and no matter how I format it,
number always gets rounded down or up to closest integer.
For example, if I type in 1.02, the result shown is 1. For 3.05, result shown is 3.
Please kindly advise how to solve this issue. Thank you.
library(shiny)
library(rhandsontable)
@martin1007
martin1007 / gist:ad2705d380ec5c1e2522950abbd4c684
Created July 9, 2018 21:12
Django need to extract data from db based on prefix
MODELS.PY
from django.db import models
from django.forms import ModelForm
class Assumptions(models.Model):
Worst = models.FloatField(null=True, blank=True, default=None)
Base = models.FloatField(null=True, blank=True, default=None)
Best = models.FloatField(null=True, blank=True, default=None)
@martin1007
martin1007 / gist:ea010ae1238fff63ba47e2840642065e
Last active July 9, 2018 18:01
Django multiple formsets in one view not scaling
VIEWS.PY
from django.shortcuts import render
from .forms import modelformset_factory, AssumptionsForm
from .models import Assumptions
model_names = ['A', 'B']
def get_assumptions(request):
@martin1007
martin1007 / gist:6474f3a7f14540bae729e8b4d31f8ca2
Last active July 8, 2018 06:57
Django modelformset_factory working with 2 formsets
VIEWS.PY
from django.shortcuts import render
from .forms import modelformset_factory, AssumptionsForm
from .models import Assumptions
def get_assumptions(request):
AssumptionsFormset = modelformset_factory(
@martin1007
martin1007 / gist:71e07c27aeeb265fa9d55eea3f33aebe
Last active July 8, 2018 06:57
Django modelformset_factory not scaling
VIEWS.PY
from django.shortcuts import render
from .forms import modelformset_factory, AssumptionsForm
from .models import Assumptions
model_names = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
def get_assumptions(request):