Activity
Posted in How do I transfer user data on delete
1. Identify the users you want to delete
2. Identify the employee
3. Transfer id
4. then delete user
depending on the table, you could use SQL to a large update provided you're able to find the users
UPDATE employees LEFT OUTER JOIN user ON "{your condition}" SET employee.foreign_key = user.foreign_key WHERE {condition}
I know it's not an exact answer but might point you in the right diraction
Posted in How do I generate dynamic classes?
https://github.com/digitaledgeit/sass-spacing
I'm play around with it some more and see if I can come up with a robust solution.
Posted in How do I generate dynamic classes?
div class='mt-10'></div> div class='mt-7'></div> div class='mt-3'></div>
This should create a div that has a margin-top of 10px, 7px, 3px and I imagine the CSS will look like this:
.mt-{x} { margin-top: x; }
Any help appreciated?
Posted in Open Closed Principle Discussion
You could use normal JS with the setInterval method. Something like this:
function timer(seconds){ clearInterval(countdown); displayRemainingTime(seconds); const then = Date.now() + seconds * 1000; countdown = setInterval(() => { const secondsLeft = Math.round((then - Date.now()) / 1000); if(secondsLeft < 0) { clearInterval(countdown); return; } displayRemainingTime(secondsLeft); }, 1000) } function displayTimeLeft(){ //update dom }
I did something like this as part of a Javascript 30 course by Wes Bos. Recommend checking it out
William
<div class="input-group">
<div class="input-group-addon">€</div>
<%= f.text_field :field, class: 'form-control' %>
<div class="input-group-addon">.00</div>
</div>
Let me try and put my own perspective
1 - Solid understanding of programming and computer science fundamentals. What do they want me to know?
Cracking the coding interview book
2 - Data Structure (list, stack, array, tree).
Cracking the coding interview book
Cracking the coding interview book
Cracking the coding interview book
Another topic that companies are asking for Senior Position (one day in the future)
5 - API design technique. What would it be?
Depends what the API does but I have built a few in the past and I wish I approached things differently. Here's a book I've been meaning to read http://apionrails.icalialabs.com/
6 - Strong familiarity with principles of database design and architecture.
Refactoring Ruby, Code Complete etc...
7 - Familiarity with OWASP and/or other web security practices.
Not sure but Handbrake is a useful gem for spotting security problems. That's I learned about security.
8 - Knowledge of optimization tactics such as query optimization and caching
Rails Performance is a great course that covers Rails Performance in-depth https://www.railsspeed.com/ and Chris has a few videos on here as well.
Hope that helps,
William
Posted in 'bcrypt' gem install Error
Posted in 'bcrypt' gem install Error
sudo apt-get install ruby-dev
Are you on a mac? You may also need the command line tools.
brew doctor can help in these situations.
For competitive reasons, if an orders id is present in the form via inspect element, the competitor is able to guess how many transactions have been done.
That is the main reason.
Perfect. I will stick with friendly id. Another question just to follow on from that. What about hiding the id in forms.
In this case the the id attribute has the id of the order. I am looking at gem called obfuscate id but it seems deprecated. This is a Rails 5 app.
What would be the best practice in this case?
What is the best way to generate SEO friendly urls?
The Rails default is to put the id in the URL e.g articles/2
I want to be able to have a url like this
articles/article-heading
Previously I have used the to_param method to generate a custom url as well as a gem called Friendly_id
I am just wondering if anyone has any other suggesstions on best practices