Posts with #initialize

#initialize

Public posts on X that use #initialize.

Related hashtags

  1. Jesus Castello@matugm
    The initialize method is part of the object-creation process in Ruby & it allows you to set the initial values ... Read more: #Ruby #OOP #Initialize
    001
  2. 映画『イニシャライズ』公式@initialize2025
    ◤チケットについてのご案内◢ ご予約いただいた方には、当日会場にてこちらのチケットをお渡しいたします。皆様のご来場を心よりお待ちしております。 耕祭 - kou sai - 6/14(日) 📍静岡県浜松市 卸本町アルラ ▼試写予約はこちら #イニシャライズ #initialize #耕祭
    Download
    047560
  3. David Sinclair✓@davidasinclair
    There are two camps. Those who read scientific papers & understand that resveratrol 🍷 is a proven SIRT1 activator that works in clinical trials…and those who don’t 🙉 1/9…
    Download
    71123901274K
  4. Adam Fleischhacker PhD, MBA✓@preposterior
    @davidasinclair
    @davidasinclair Disqualify this study as evidence for resveratrol; data likely fabricated. Assume BP follows normal distribution: mean 137, SD 13. Simulate randomizing 472 patients, check p-value. Repeat 1,000 times for p-value distribution. Paper's Table 1 p-values unlikely.
    Download
    21403.5K
  5. Adam Fleischhacker PhD, MBA✓@preposterior
    @preposterior
    Sample R Code: library(tidyverse) library(infer) # generate 472 blood pressure observations # from distribution: bp ~ Normal(137,13) ## Run 1000 simulations of creating randomized ## groups to observe the p-value distribution. pValue = c() #initialize p-value for(i in 1:1000) { # 1000 simulations n = 472 patientDF = tibble( patientID = 1:n, patientBP = rnorm(n,137,13), patientGroup = rbinom(n,1,0.5) ) # perform t-test t_test_results <- patientDF %>% t_test(patientBP ~ patientGroup, order = c("0", "1")) # store results pValue = c(pValue,t_test_results$p_value) } # Plot distribution of p-values ggplot(data = tibble(pValue = pValue)) + geom_histogram(aes(x = pValue), binwidth = 0.05, color = "black", fill = "gray") + xlab("p-value") + ylab("Count") + ggtitle("Histogram of p-values")
    0082.9K
  6. Nate Berkopec✓@nateberkopec
    What is your least favorite part about Ruby?
    12413134
  7. Robert Pankowecki@pankowecki
    Now we have a DSL for a simple setter 🤦🏻‍♂️
    Petrik ruby.social/@p8 @four54
    Always wanted to have this in Rails:
    507
  8. Josh Cheek@josh_cheek
    In JS, if you return some other object from the constructor, the `new` keyword returns that instead. In Ruby, it'd be like if `.new` returned whatever came back from `#initialize`
    Download
    313
  9. postmodern@postmodern_mod3
    Starting to like Ruby 2.x prepend more and more. Latest use: defining an #initialize method that get's called even when the class forgets to call super in their own #initialize.
    001
  10. Erik Berlin✓@sferik
    @sferik
    @JEG2 Explanation: attr_* methods should be adjacent to other instance methods and #initialize should be the first instance method.
    203
  11. Eric w/ one wild life@MutualArising
    Just spent about an hour defining #new instead of #initialize on a #ruby object and debugging it in case you are wondering how my brain is holding up doing knowledge work these days (after programming in ruby nearly every day for ohhhhh 7+ years now)
    107
  12. Luca Guidi@jodosha
    @jodosha
    Dependencies are collaborators (or roles) that an object depends to (uses). Having them in `#initialize` plays well with Dependency Injection (DI) #DesignPattern.
    014
  13. Luca Guidi@jodosha
    #Ruby opinion: use class methods as default for #initialize keyword argument. Do NOT use class methods directly from instance methods. 1/
    Download
    3646
  14. Chris Hoffman@yarmiganosca
    The good news is that now if I need to write some code for turning JSON into a complex object hierarchy, I have oodles of fun techniques for making said builder just astoundingly un-extensible. So there's that.
    101
  15. Chris Hoffman@yarmiganosca
    @yarmiganosca
    The big one is always "parse" the remaining JSON inside of your ThingNode constructors. What you don't want to do is build the child node objects outside ThingNode and then pass those to its constructor. That might lead to people being to efficiently build on top of your code.
    100
  16. Chris Hoffman@yarmiganosca
    @yarmiganosca
    (The ideal (using Ruby as the context) is to make #initialize take other Node objects, but also offer a convenience ::from_parsed_json constructor that makes the child nodes and passes them to #initialize).
    100
  17. Paula McKinley@pmknyc
    Day 9, 01/11/19: Working on how to use **optional** arguments to an #initialize method for a Ruby Class. Fun reading blogs and documentation. Alas, my code still triggering the fail **option** in RSpec tests. Sleep **option** now. Try again tomorrow. #100DaysOfCode
    Download
    003
  18. Show more posts