Skip to content

Instantly share code, notes, and snippets.

@wicky-andrian
wicky-andrian / Forms.md
Created June 19, 2020 20:04 — forked from jnewman12/Forms.md
Forms, form_for, link_to lesson

Forms, form_for, and link_to


Lesson Objectives

  1. Understand forms and the ways we write them
  2. Understand the difference between form_tag and form_for
  3. Understand link_to and how we can use it to dynamically link our application together
@SunDi3yansyah
SunDi3yansyah / README.md
Last active November 29, 2018 17:51
Find Gems on Repository with Scraping

Find Gems on Repository with Scraping

Get Gems from Local

~/ruby via 💎 v2.5.3 
➜ gem list --no-versions

then put in array gems.rb

@SunDi3yansyah
SunDi3yansyah / ftp.rb
Last active November 13, 2018 11:37
Download File on FTP Server with Ruby
# Ref: https://ruby-doc.org/stdlib-2.5.3/libdoc/net/ftp/rdoc/Net/FTP.html
require 'net/ftp'
Net::FTP.open('ftp.gnu.org') do |ftp|
ftp.login
ftp.chdir('gnu/wget')
nlst = ftp.nlst('*.tar.gz')
nlst.map {|file_name| ftp.gettextfile(file_name) }
end
@wicky-andrian
wicky-andrian / ssh permissions 0644 for are too open.md
Last active March 12, 2021 20:24
SSH permissions 0644 for '/home/username/.ssh/id_rsa' are too open.
some problem if you have new system, try to deploy on github with old ssh, when you add ssh on terminal (command line) Ubuntu.
wicky@code: eval $(ssh-agent)
Agent pid 7xxx
wicky@code: ssh-add ~/.ssh/id_rsa  #note id_rsa only name not name.pub but only name
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/wicky/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
@SunDi3yansyah
SunDi3yansyah / README.md
Last active October 20, 2018 18:37
[PHP] Sami Api Documentation

Sami Environment

With Phar:

$ curl -O http://get.sensiolabs.org/sami.phar
$ mv sami.phar /bin/sami
$ chmod u+x /bin/sami

Use

@wicky-andrian
wicky-andrian / rails css inline style background-image
Created September 17, 2018 14:07
rails css inline style background-image
<header class="masthead text-center text-white d-flex" style="background-image: url(<%= asset_path 'header.jpg' %>) !important;">
<div class="container my-auto">
<div class="row">
<div class="col-lg-10 mx-auto">
<h1 class="text-uppercase">
<strong>Your Favorite Source of Free Bootstrap Themes</strong>
</h1>
<hr>
@wicky-andrian
wicky-andrian / LICENCE SUBLIME TEXT
Created September 14, 2018 18:11
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@db0sch
db0sch / regenerate_credentials.md
Last active October 31, 2023 20:30
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@wicky-andrian
wicky-andrian / active storage in css inline for background-image
Last active July 14, 2018 10:40
active storage in css inline for background-image
```
<style media="screen">
body { background-image: url('<%= image_tag @sets.collect(&:background_website).detect(&:attached?) %>') !important;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
</style>

Use what you know about Ruby, Rails, MVC, sessions, etc. to create the following pieces of functionality:

  1. A user who already exists in the database can log in using a username/password combination that they enter in a form. They should know that they are logged in because something like "Welcome, Rachel!" should appear at the top of every page they visit.

  2. A user who already exists in the database and is already logged in should be able to log out. They should know that they are logged out because their welcome message will no longer appear at the top of every page they visit.

  3. Users should have many jobs, and a job should belong to a user. Therefore, when a user visits any jobs listing, they should only see jobs associated with them. They should not be able to see, edit, or delete any jobs that are not associated with their account.

  4. A user who does not exist in the database should be able to create an account through a form that gathers any necessary user information. Once they create an a