This file contains hidden or 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
" https://gist.github.com/steveclarke/ba73c6b2e198f14f1b729ad6825c04ca | |
" Leader is <space> | |
let mapleader = ' ' | |
nnoremap <Space> <Nop> | |
" nobody wants that bell! | |
set visualbell | |
set incsearch |
This file contains hidden or 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
# frozen_string_literal: true | |
class ApplicationComponent < ViewComponent::Base | |
private | |
# Reference: https://www.youtube.com/watch?v=YVYRus_2KZM&t=302s | |
def fetch_or_fallback(allowed_values, given_value, fallback) | |
if allowed_values.include?(given_value) | |
given_value | |
else |
This file contains hidden or 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
{% comment %} | |
Place at bottom of DOM, before </body> | |
{% endcomment %} | |
{% comment %} | |
Article structured data | |
https://developers.google.com/search/docs/data-types/articles | |
{% endcomment %} | |
{% if template contains 'article' %} |
This file contains hidden or 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
def original_method(a, b) | |
puts "Called with #{a} and #{b}" | |
if block_given? | |
puts "Calling the block" | |
yield | |
end | |
end | |
def wrapper1(*args) # WRONG: doesn't pass the block | |
puts "Hi I'm wrapper1" |
- Website: https://stimulusjs.org/
- GitHub repo: https://github.com/stimulusjs/stimulus
- Handbook: https://stimulusjs.org/handbook/introduction
- Discourse: https://discourse.stimulusjs.org/
initialize
: once, when the controller is first instantiatedconnect
: anytime the controller is connected to the DOM
###rpush - https://github.com/rpush/rpush
Follow the steps in rpush to add the gem to your rails project
####PushNotificationDevice
rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration
This file contains hidden or 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
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 4.0" | |
gem "railties", "~> 4.0" | |
gem "tzinfo" | |
# Let's use thin |
This file contains hidden or 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
.search { | |
/* Roundness */ | |
border: 1px solid #BABABA; | |
border-radius: 20px; | |
height: 35px; | |
width: 300px; | |
padding: 8px; | |
background: white; |
NewerOlder