Skip to content

Instantly share code, notes, and snippets.

@softwaregravy
softwaregravy / Comparison Espressif ESP MCUs.md
Created March 29, 2023 01:40 — forked from sekcompsci/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "factory_bot", "~> 5.0"
gem "activerecord"
gem "sqlite3"
end
@softwaregravy
softwaregravy / main.rb
Created March 14, 2020 20:13 — forked from coorasse/main.rb
CanCanCan Issue
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '5.1.0' # use correct rails version
@softwaregravy
softwaregravy / delete_old_app_version.sh
Created March 13, 2012 20:30
Delete old beanstalk application versions
elastic-beanstalk-describe-application-versions -a APPLICATION_NAME | sed '1,2d' | sed '/CURR_APP_VERSION/d' | cut -d '|' -f 6 | xargs -L 1 elastic-beanstalk-delete-application-version -a APPLICATION_NAME -l
@softwaregravy
softwaregravy / irb.rb
Created March 11, 2012 23:29
Override IRB Prompt
require 'irb'
module IRB
class << self
alias :orig_init_config :init_config
def init_config(ap_path)
begin
puts "loading init config: #{Rails.env}"
# Set up the prompt to be slightly more informative
<html>
<body>
<script type="text/javascript">
var lat = 40.733722;
var lon = -73.990683;
var id = "1234567890";
var api_endpoint = "api-sandbox.thinknear.com";
var link_endpoint = "m2-s.thinknear.com";
var api_key = "YOUR API KEY";
var app_id = "YOUR APP ID";
@softwaregravy
softwaregravy / factories.rb
Created October 13, 2011 16:58
User Factory
Factory.define :user do |user|
user.sequence(:email) {|n| "1test#{n}@sample.com"}
user.password 'secret'
user.password_confirmation 'secret'
end
@softwaregravy
softwaregravy / business_spec.rb
Created October 13, 2011 16:52
Business spec refactoring
# before
let (:user) { Factory(:user) }
# after
before :all do
@user = Factory(:user)
end
after :all do
@user.destroy
@softwaregravy
softwaregravy / time_period_spec.rb
Created October 13, 2011 16:38
Time Period Refactor
# before
describe "<=>" do
it "first compares days" do
l = TimePeriod.create(:start_day => 1, :start_time => 10.hours.to_i, :duration => 1.hours.to_i)
r = TimePeriod.create(:start_day => 2, :start_time => 10.hours.to_i, :duration => 1.hours.to_i)
(l <=> r).should == -1
(r <=> l).should == 1
end
end
module DayMap
day_array = []
Date::DAYNAMES.each_with_index{|d, i| day_array << [d, i]}
reverse_day_array = []
Date::DAYNAMES.each_with_index{|d, i| reverse_day_array << [i, d]}
DAY_MAP = Hash[day_array]
REVERSE_MAP = Hash[reverse_day_array]
class << self