Skip to content

Instantly share code, notes, and snippets.

View davidteren's full-sized avatar
👋
Hey, nice to meet you.

David Teren davidteren

👋
Hey, nice to meet you.
View GitHub Profile
@davidteren
davidteren / simple_spy.rb
Created March 22, 2021 10:38
Dev util to show the filename (path), line number, object type and value in the Rails console.
# = SimpleSpy
# Dev util to show the filename (path), line number, object type
# and value in the Rails console.
# === Examples:
# spy val = Object.new
#
# "----------------------------------------------------------------------
# properties.rb:13:in `<main>'+
@davidteren
davidteren / ruby_phonelib_validation_example_za.rb
Last active March 22, 2021 07:24
Example for using the phonelib gem.
# Using the 'phonelib' gem as it's based on Googles libphonenumber library.
# https://github.com/daddyz/phonelib
require 'phonelib'
require 'active_support'
# Set South Africa as the default country
Phonelib.default_country = "ZA"
Phonelib.extension_separate_symbols = ["x", ";"]
@davidteren
davidteren / nerd_fonts.md
Last active June 10, 2024 02:54
Install Nerd Fonts via Homebrew [updated & fixed]
@davidteren
davidteren / ci.yml
Created May 18, 2020 16:34
GitHub Workflow - Linter & Test CI
name: CI
on: [push, pull_request]
jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
@davidteren
davidteren / index.html.erb
Last active March 22, 2021 08:25
For Article on Medium medium.com/p/46f24daf1b26
<div>
<nav x-data="{ open: false }" @keydown.window.escape="open = false" class="bg-gray-800">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0">
<h3 class="text-gray-300 text-lg ">MyApp</h3>
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline">
@davidteren
davidteren / Rails, Puma & Nginx.md
Last active June 7, 2024 14:34
Example setup for Puma with Nginx in a Rails app

In the apps config/puma.rb file:

Change to match your CPU core count
# Check using this on the server => grep -c processor /proc/cpuinfo
workers 4

# Min and Max threads per worker
threads 1, 6

app_dir = File.expand_path('../..', FILE)