This is a gist used in the following blog posts:
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 AWS Client VPN for Linux is only provided for Ubuntu as a .deb package. I need it for Fedora. This was tested on Fedora 33. | |
https://docs.aws.amazon.com/vpn/latest/clientvpn-user/client-vpn-connect-linux.html | |
Get the vpn client deb package. | |
``` | |
curl https://d20adtppz83p9s.cloudfront.net/GTK/latest/awsvpnclient_amd64.deb -o awsvpnclient_amd64.deb | |
``` | |
Install `alien` to convert the deb package to rpm. |
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
curl -XDELETE 'localhost:9200/test' | |
curl -XPUT 'localhost:9200/test/doc/1' -d ' | |
{ | |
"sentence" : "Hi!", | |
"value" : 1 | |
} | |
' |
emacs --daemon
to run in the background.
emacsclient.emacs24 <filename/dirname>
to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
- Undo -
C-/
- Redo -
C-?
- Change case: 1. Camel Case :
M-c
2. Upper Case :M-u
- Lower Case :
M-l
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
# Rails 4 | |
require 'action_view/helpers/asset_url_helper' | |
module ActionView | |
module Helpers | |
module AssetUrlHelper | |
def accept_encoding?(encoding) | |
request = self.request if respond_to?(:request) | |
return false unless request |
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
class Article < ActiveRecord::Base # Product class is similar | |
belongs_to :user | |
has_many :media, as: :ownable | |
with_options through: :media, source: :representable do |assn| | |
assn.has_many :videos, source_type: 'Video' | |
assn.has_many :images, source_type: 'Image' | |
end | |
end |
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
RSpec::Core::RakeTask.module_eval do | |
def pattern | |
dir = EngineName.root # replace with you the name of your engine | |
extras = [] | |
if File.directory?( dir ) | |
extras << File.join( dir, 'spec', '**', '*_spec.rb' ).to_s | |
end | |
[@pattern] | extras | |
end | |
end |