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
# Set up a development environment on an Ubuntu flavored linux distribution | |
# install and sets up: | |
# rbenv, nvm, mysql, postgres, redis | |
# vscode, slack, docker, chormium, tilix, heroku, postman, beekeeper, skype, kazam, peek and more | |
# setup an rsa key | |
# Usage: | |
# install ansible 2.7+ - latest | |
## sudo apt-add-repository ppa:ansible/ansible && sudo apt update && sudo apt install ansible | |
# run the playbook: | |
## ansible-playbook webdev.yaml -K -e "email=<[email protected]>" |
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
=begin | |
expected output is a 2d array | |
irb(main):001:0> TicketGenerator.new.generate | |
=> [[nil, 10, 27, 31, 45, 54, 60, nil, nil], [nil, nil, 29, 32, nil, 58, 61, 77, nil], [5, 11, nil, nil, nil, nil, 64, nil, 88]] | |
irb(main):002:0> TicketGenerator.new.generate | |
=> [[2, nil, nil, nil, nil, 51, 68, 71, 82], [nil, 19, 23, 34, 45, 57, 69, 73, nil], [nil, nil, nil, 35, nil, nil, nil, 75, 83]] | |
irb(main):003:0> | |
=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
# Encryptor - is a library responsible for ecnrypting and decrypting values | |
# Inspired from - https://gist.github.com/wteuber/5318013 | |
require 'openssl' | |
class Encryptor | |
SECRET_KEY = Rails.application.secrets.secret_key_base | |
def self.encrypt(text) | |
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt |
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
/* | |
Adapted from the idea of tailwindcss. I really liked the project and enjoyed using it. | |
But I wanted a simpler light weight solution. I really liked the idea of having things in a constants | |
thus avoid spilling the value throughout the application! With the indtroduction of css varialbes I found this to be | |
very elegent and productive. | |
Prefered usage with in conjunction of normailize.css | |
http: //necolas.github.io/normalize.css/ | |
*/ | |
:root { |
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
<template> | |
<div class=""> | |
<input name="utf8" type="hidden" value="✓"> | |
<input type="hidden" name="authenticity_token" :value="csrf"> | |
</div> | |
</template> | |
<script> | |
export default { | |
data: function() { |
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
<div id="posts-index-view"> | |
<posts-index-view> | |
</posts-index-view> | |
</div> | |
<%= stylesheet_pack_tag 'posts/index' %> | |
<%= javascript_pack_tag 'posts/index' %> |
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 generator extends from NamedBase base class which makes sure | |
# alleast a name must be provided to the generator | |
class VueGenerator < Rails::Generators::NamedBase | |
source_root File.expand_path('../templates', __FILE__) | |
# if you remember all the public methods will be executed in the defined order | |
# this method will create a JavaScript file using the javascript.erb template | |
# in the location defined as the next params | |
# we will look into the content of the templates next |
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
<div id="<%= vue_component_kebab_name %>"> | |
<%= vue_component_snippet %> | |
</div> | |
<%= stylesheet_pack_tag_snippet %> | |
<%= javascript_pack_tag_snippet %> |
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
Description: | |
Create Vue files corresponding to the Rails views | |
Example: | |
rails generate vue [namespace]/[controller]/action | |
This will create: | |
app/javascript/packs/[namespace]/[controller]/action.js | |
app/javascript/views/[namespace]/[controller]/action.vue | |
app/views/[namespace]/[controller]/action.html.erb |
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
<!-- this is the same id we reffered in the vue file --> | |
<!-- for consisteny, I also follow a convention in this --> | |
<!-- {folder-paths}-{action}-view --> | |
<div id="devise-registrations-new-view"> | |
<!-- we talked about passing the validation error to vue --> | |
<!-- here is how easy it is to do this --> | |
<devise-registrations-new-view :errors="<%= resource.errors.full_messages %>"> | |
</devise-registrations-new-view> | |
</div> |
NewerOlder