This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE: | |
# rails runner rails-models-to-typescript-schema.rb > app/javascript/types/schema.d.ts | |
Rails.application.eager_load! | |
models = ActiveRecord::Base.descendants.reject { |i| i.abstract_class? } | |
belongs_to = true | |
has_many = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
Various search databases and backends as alternatives to Elasticsearch.
- Sonic - github.com/valeriansaliou/sonic - lightweight & schema-less search backend
- Tantivy - github.com/quickwit-oss/tantivy - full-text search engine library inspired by Apache Lucene
- Toshi - github.com/toshi-search/Toshi - search engine built on top of Tantivy
- Bayard - github.com/mosuka/bayard - search engine built on top of Tantivy
- Meilisearch - github.com/meilisearch/meilisearch - fast and full-featured search engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following comments fill some of the gaps in Solargraph's understanding of | |
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but | |
# ignored at runtime. | |
# | |
# You can put this file anywhere in the project, as long as it gets included in | |
# the workspace maps. It's recommended that you keep it in a standalone file | |
# instead of pasting it into an existing one. | |
# | |
# @!parse | |
# class ActionController::Base |
$ rails new my-i8n --webpack
Gemfile
gem 'i18n-js'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/concern' | |
module StringEnums | |
extend ActiveSupport::Concern | |
class_methods do | |
def string_enum(enums_hash) | |
enum_name = enums_hash.keys.first.to_s | |
define_singleton_method(enum_name.pluralize) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.remote.webelement import WebElement | |
import os.path | |
# JavaScript: HTML5 File drop | |
# source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676 | |
# param1 WebElement : Drop area element | |
# param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0. | |
# param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0. | |
# return WebElement : File input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Raven.config(dsn, { | |
dataCallback(data) { | |
const normalize = filename => filename.split('/www/', 2)[1] | |
data.exception.values[0].stacktrace.frames.forEach(frame => { | |
frame.filename = normalize(frame.filename) | |
}) | |
data.culprit = data.exception.values[0].stacktrace.frames[0].filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
WHAT: A very simple example of redux + redux-simple-router using Typescript. | |
WHY: The official example found here: https://github.com/rackt/redux-simple-router/tree/1.0.2/examples/basic has problems: | |
1) it is spread over many files making it very hard to "skim" | |
2) it is organized by function, not by feature. (Example: learning "how to manipulate redux state" is spread over 5 files in 4 folders) | |
3) there are no comments explaining what's going on/why. | |
WHO: by JasonS@Novaleaf.com |
NewerOlder