Skip to content

Instantly share code, notes, and snippets.

View adrianthedev's full-sized avatar
🚀
Building Avo https://avohq.io

Adrian Marin adrianthedev

🚀
Building Avo https://avohq.io
View GitHub Profile
@JoshAntBrown
JoshAntBrown / template_render.js
Last active May 15, 2024 06:27
Template Renderer
class TemplateRenderer {
constructor(template) {
this.template = template
}
render(data) {
const clone = document.importNode(this.template.content, true)
this.#processNodes(clone, data)
return clone
}
@coderberry
coderberry / tailwind_grid_helper.rb
Created September 6, 2023 19:12
Tailwind Grid Helper
module TailwindHelper
# Create a responsive grid. This is necessary in order to make every cell the same size (height & width)
#
# @example
# <%= responsive_grid(total_cells: 3, gap: 3, cols: { xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }, "pt-4") do %>
# <% 3.times do %>
# <%= content_tag(:div, "Cell", class: "h-32 w-full bg-gray-200") %> <-- important to ensure the cell is the same size
# ...
# <% end %>
# <% end %>
@harry-wood
harry-wood / installing libxml on mac for ruby.md
Last active May 25, 2024 17:50
Installing libxml on mac for ruby.md

Installing/debugging libxml on mac for ruby/rails

Install xcode command line tools (or check if they're already installed)

xcode-select --install

Do we have libxml installed already?

xsltproc --version
# frozen_string_literal: true
class SalesListOrganizationCsvDownload < Avo::BaseAction
self.name = "CSV Download"
self.may_download_file = true
self.confirm_button_label = "Download"
def handle(**args)
_models, _fields, _current_user, resource = args.values_at(:models, :fields, :current_user, :resource)
@davidteren
davidteren / nerd_fonts.md
Last active July 30, 2024 02:50
Install Nerd Fonts via Homebrew [updated & fixed]
@swanson
swanson / .irbrc
Last active March 3, 2024 17:14
.irbrc color coding Rails console by environment
# Add color coding based on Rails environment for safety
if defined? Rails
banner = if Rails.env.production?
"\e[41;97;1m #{Rails.env} \e[0m "
else
"\e[42;97;1m #{Rails.env} \e[0m "
end
# Build a custom prompt
@JamesYang76
JamesYang76 / Time Zone.md
Last active June 1, 2024 11:42
Time Zone for rails

Time zones

There are trhee diffrent time zones in rails

  • System - The server time zone
  • Application - Rails application use own time zone
  • Database - Default is UTC, but do not change it

Cautions

  • config.time_zone should be set when an app dose not support multiple time zones
  • Do not use Date/Time API using system time zone
  • Date could be incorrect by being converted from datetime or time to date
@BigelowInc
BigelowInc / reserved_words.py
Created July 21, 2016 20:41 — forked from ishahid/reserved_words.py
Reserved words to exclude when creating usernames (or any other resource).
# A list of possible reserved words
reserved_words = [
# Companies
'amazon', 'apache', 'apple', 'atlassian', 'facebook', 'github', 'google',
'htc', 'microsoft', 'mozilla', 'nokia', 'rim', 'samsung', 'sony', 'toshiba',
'twitter', 'wikipedia',
# Operating systems
'android', 'centos', 'debian', 'dos', 'fedora', 'ios', 'linux', 'mac',
@sagalbot
sagalbot / gulpfile.js
Last active April 13, 2018 05:03
Laravel Elixir + Vueify + Hot Reload. This will get you up and running with Browserify HMR + Vueify + BrowserSync in no time.
var elixir = require('laravel-elixir');
var gutil = require('gulp-util');
// If 'gulp watch' is run
if (gutil.env._.indexOf('watch') > -1) {
// Enable watchify for faster builds
elixir.config.js.browserify.watchify.enabled = true