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
# 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=<your@email.com>" |
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
<script> | |
// .vue files typically have 3 section | |
// 1.template - markup, 2.script - js, 3.style - css | |
// we are importing the csrf component it has two hidden input fields | |
// for csrf token and utf encoding | |
// creating a component helps us reuse it in multiple forms | |
import CSRF from 'components/shared/csrf.vue'; | |
export default { |
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
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d | |
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance | |
files: | |
"/etc/nginx/conf.d/websockets.conf" : | |
content: | | |
upstream backend { | |
server unix:///var/run/puma/my_app.sock; | |
} |
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
<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
<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
# 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 |
NewerOlder