I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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
upstream puma { | |
server unix:///var/www/app/shared/tmp/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
listen 80 default deferred; | |
server_name example.com; | |
rewrite ^/(.+) https://example.com/$1 permanent; | |
} |
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
module RailsAppName | |
class Application < Rails::Application | |
# .... your settings | |
require "#{Rails.root}/lib/cloud_flare_middleware" | |
config.middleware.insert_before(0, Rack::CloudFlareMiddleware) | |
# ... your settings | |
end | |
end |
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
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
# Fail2Ban configuration file | |
# | |
# List of bad bots fetched from http://www.user-agents.org | |
# Generated on Sun Feb 11 01:09:15 EST 2007 by ./badbots.sh | |
# | |
# Author: Yaroslav Halchenko | |
# | |
# $Revision: 668 $ | |
# |
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
I recently had to install MySQL 5.6 on Ubuntu 12.04 from a .deb package on the MySQL website. It seems that either the package has been updated recently or nobody uses this method to install so I ended up running into endless problems. Through trial and error I found the following method works for me. | |
Install libaio-dev: | |
sudo apt-get install libaio-dev | |
Now install your package(mine was enterprise edition, community may have a different filename): | |
sudo dpkg -i mysql-advanced-5.6.10-debian6.0-x86_64.deb | |
This will install your files to the /opt directory, instead of the more common /etc directory. No worries, all we need to do is point our system at this new directory. |
Rails flash messages with AJAX requests & twitter-bootstrap 2.3
Forked from https://gist.github.com/linjunpop/3410235 Based on Stackoverflow answer: http://stackoverflow.com/a/10167659/656428
License: MIT
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
# Usage: UserAndRelationshipDelta.perform_async user.id | |
# | |
class UserAndRelationshipDelta | |
include Sidekiq::Worker | |
def perform(user_id) | |
# Set delta flags | |
User.update_all({delta: true}, {id: user_id}) | |
Relationship.update_all({delta: true}, {user_id: user_id}) |
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
//Sample HTML to use | |
<a class="modal-dialog"><img src="thumb.png" alt="Image Title" data-full-size="full-size.png"></a> | |
// Look for modal pop-ups | |
var modalPops = $("a.modal-dialog"); | |
//If there's modals, inject all the necessary code. | |
if(modalPops.length) { | |
//First add the data attributes |
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
@PageSpinner = | |
spin: (ms=500)-> | |
@spinner = setTimeout( (=> @add_spinner()), ms) | |
$(document).on 'page:change', => | |
@remove_spinner() | |
spinner_html: ' | |
<div class="modal hide fade" id="page-spinner"> | |
<div class="modal-head card-title">Please Wait...</div> | |
<div class="modal-body card-body"> | |
<i class="icon-spinner icon-spin icon-2x"></i> |