Skip to content

Instantly share code, notes, and snippets.

View donrestarone's full-sized avatar
🤖
Building products

Don Restarone donrestarone

🤖
Building products
View GitHub Profile
@donrestarone
donrestarone / blender-for-3d-printing.md
Last active November 4, 2021 14:21
a blender 2.8 setup + cheatsheet for 3D Printing
@donrestarone
donrestarone / install-android-studio-ubuntu.sh
Last active September 24, 2021 19:11
install android studio on ubuntu
# install the 32 bit binaries first
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
# download android studio and extract it
# after extraction, navigate to android-studio-ide-193.6626763-linux/android-studio/bin
chmod +x studio.sh
./studio.sh
# after install, create a throw-away project and hit control + shift + a for search, look up AVD manager and install some emulators
# after that, click on Tools > Desktop Entry to create a shortcut in the launcher
@donrestarone
donrestarone / sitemap.rb
Created February 3, 2021 13:48
a simple example of sitemap_generator in a rails application
SitemapGenerator::Sitemap.default_host = "https://your-domain.com"
SitemapGenerator::Sitemap.create do
add blog_index_path
add new_visitor_inquiry_path
add services_path
add about_index_path
end
@donrestarone
donrestarone / dynamic-favicons.html.erb
Last active February 3, 2021 13:36
dynamically render favicons for a variety of sizes
<%= favicon_link_tag asset_path('your logo path') %>
<% %w(32 128 76 120 152 167 180 192 196).each do |size| %>
<%= favicon_link_tag "/icons/your-logo.png", rel: 'apple-touch-icon', type: 'image/png', sizes: "#{size}x#{size}" %>
<% end %>
<% %w(16 32).each do |size| %>
<%= favicon_link_tag "/icons/your-logo.png", rel: 'icon', type: 'image/png', sizes: "#{size}x#{size}" %>
<% end %>
@donrestarone
donrestarone / meta_tags_controller.rb
Created February 3, 2021 13:30
a simple rails controller that implements meta tags
class HomeController < ApplicationController
def index
@page_title = "Your Page Title Here"
@page_description = "Your Page Description Here"
@page_keywords = "comma, separated, keywords, here"
set_meta_tags(
og: {
image: 'your::aws::s3:image_path',
title: @page_title,
description: @page_description
@donrestarone
donrestarone / _tweet.html.erb
Created December 25, 2020 15:20
turbo frame partial rails 6
<%= turbo_frame_tag dom_id(tweet) do %>
<div class="card m-4">
<div class="card-body">
<%= tweet.content %>
</div>
<div class="card-footer bg-transparent border-success">
<%= link_to 'Show', tweet, class: 'btn btn-sm btn-primary text-white' %>
<%= link_to 'Edit', edit_tweet_path(tweet), class: 'btn btn-sm btn-warning text-white', remote: true %>
<%= link_to 'Destroy', tweet, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger text-white' %>
</div>
@donrestarone
donrestarone / index.html.erb
Created December 25, 2020 15:19
turbo stream with rails 6
<p id="notice"><%= notice %></p>
<h1>Tweets</h1>
<table>
<thead>
<tr>
<th colspan="3"></th>
</tr>
</thead>
@donrestarone
donrestarone / tweet.rb
Created December 25, 2020 15:18
hotwire demo rails 6
class Tweet < ApplicationRecord
has_rich_text :content
after_create_commit {broadcast_prepend_to "tweets"}
after_update_commit {broadcast_replace_to "tweets"}
after_destroy_commit {broadcast_remove_to "tweets"}
end
@donrestarone
donrestarone / index.css
Created December 23, 2020 23:57
css fix for react-zoom-pan-pinch rendering invisible pan area
/* fix not rendering on chrome/safari */
.react-transform-component {
width: unset !important;
height: unset !important;
}
.react-transform-element {
width: unset !important;
height: unset !important;
}