Skip to content

Instantly share code, notes, and snippets.

@mssola
mssola / singleton.rb
Created August 2, 2013 07:44
Different ways to create the Singleton pattern in Ruby.
##
# This files shows some possible implementations of the Singleton pattern
# in Ruby. I'm not a huge fan of the Singleton pattern, but it's nice
# in some cases. In this file I'm going to implement a simple logger.
#
##
# The first implementation that can come to our minds is to create a class
# that holds an instance as a class variable that can be accessed through
@gokulkrishh
gokulkrishh / media-query.css
Last active May 7, 2025 06:24
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@nanusdad
nanusdad / expressjs_with_godaddy_certs.md
Last active November 15, 2024 10:25
Express JS with GoDaddy SSL Certificates

How to use GoDaddy SSL certs with Express JS

  • Node requires each certificate in the CA chain to be passed separately in an array.
  • GoDaddy provides a cerficate file (gd_bundle.crt) probably looks like this:
-----BEGIN CERTIFICATE-----
MIIE3jCCA...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
@yahonda
yahonda / ruby31onrails.md
Last active April 15, 2025 20:01
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@ksss
ksss / rbsg.md
Last active September 11, 2022 07:10

[PoC] Proposal of RBS generation method using Rack architecture

RBS generation problem

RBS is an easy language to generate code for because of its simple syntax and lack of dependencies between files. In addition, there are currently a large number of required type definitions, so code generation for RBS is considered to be highly important.

Various attempts have been made to generate RBS code, including generation from JSON files and analysis of static and dynamic Ruby code. However, each method has its advantages and disadvantages, and not all problems have been solved.