en en en en id en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en sk es en en en en en en en en fr en en en en en en en en en en en en en en en en en en en en en en en en ko en en en en en en en fa en en en en en en en en en en pt en en en en en en en
As I stumble through the world of linux, I've decided to log new tricks I learn because I often forget. I decided to share the log because…. eh, why not.
Formatting Numerical Input with Rails
Kubuntu 16.04 GUI Audio Controls not working
Polymorphic Associations The Smart Way: Using Global Ids
Get Firefox to display warning message when exiting multiple tabs
jaehoo on Kubuntu 16.04 GUI Audio Contro…
BennyBeat on How to download a file from so…
fastrapidleech.com on How to download a file from so…
neanderslob on How to download a file from so…
Adding a devise user or admin in a Heroku app
February 18, 2015February 18, 2015 neanderslobadd, devise, heroku, rails, ruby, ruby on rails, userLeave a comment
To add a devise user on a Heroku site we combine two commands
Command 1: With devise a person can enter the following into their rails console to create a user: User.new(:email => "user@name.com", :password => 'password', :password_confirmation => 'password')
Command 2: To run commands in the Heroku terminal, simply go into local directory of the corresponding app and type heroku run [whatever you want to run]
So if we put those together we get the following, assuming that your user model is in fact called User:
Change your directory to your app: cd ~/yourapp
Enter into the rails console on Heroku with the following: heroku run rails c
Run the create user code: U=User.new(:email => "user@name.com", :password => 'password', :password_confirmation => 'password')
Finally, if you want to do this for a separate admin model, simply replace User in the instructions above with Admin (provided of course that’s what your separate admin model is called; if not adjust accordingly).
That’s it! You should be good to go!
Adding a devise user or admin in a Heroku app
Excluding directory from grep
February 14, 2015 neanderslobbash, exclude, grep, linux, notes, terminalLeave a comment
For some reason, I can never remember how to do this.
If you ever want to grep for something but leave out a particular directory, use the --exclude-dir=DIR
So if I wanted to search the current directory for the string img, but don’t want to look in the directories tmp or log.
grep -r --exclude-dir=log --exclude-dir=tmp "img" ./
Excluding directory from grep
Styling Fields Dynamically Added With Cocoon
February 5, 2015 neanderslobcocoon, dynamic, fields, jQuery, nested, rails, ruby, ruby on railsLeave a comment
I recently ran into a situation where I realized that the nice slick J-Query styling that I’d given to my select menus hadn’t carried over to my dynamically added fields.  This is because, my javascript ran $('select').customSelect(); when the page loaded but at no point after. I therefore needed to figure out how to trigger that function once a dynamic field was added.
After quite a bit of searching around (on the order of hours) and several dead ends, I finally learned that cocoon has many different actions that can be used with on() In my case, all I needed was the following:
And I was good to go.
Styling Fields Dynamically Added With Cocoon
Create a free website or blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.