Skip to content

Instantly share code, notes, and snippets.

View jogaco's full-sized avatar
🎯
Focusing

J. Garcia jogaco

🎯
Focusing
View GitHub Profile
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active June 12, 2024 03:08
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

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!






\

@davidcelis
davidcelis / nginx.conf
Last active June 15, 2018 13:11
Nginx configuration to redirect HTTP traffic to HTTPS (Puma)
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;
}
@mattheworiordan
mattheworiordan / application.rb
Created March 28, 2014 09:05
CloudFlare IP Middleware for Rails to ensure HTTP_CF_CONNECTING_IP is used and the clients IP is correct within Rails
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
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

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.

Purchase the cert

@lordofthelake
lordofthelake / apache-badbots.conf
Last active June 2, 2022 03:48
Fail2ban configuration
# 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 $
#
@beaudierman
beaudierman / gist:5444977
Created April 23, 2013 16:11
How to install MySQL 5.6 on Ubuntu 12.04
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.
@hbrandl
hbrandl / RailsFlashToHeaders.md
Last active November 2, 2023 11:57 — forked from linjunpop/README.md
Rails flash messages with AJAX requests & twitter-bootstrap
@pat
pat / gist:5174559
Created March 16, 2013 01:53
Combined delta updates
# 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})
@timwasson
timwasson / Twitter Bootstrap dynamic image modal
Created February 22, 2013 21:08
For users of the fantastic Twitter Bootstrap, this will dynamically create a modal dialog for an image when you've got an <a> with the class of "modal-dialog". The image should have a data-attribute of "data-full-size". The image's alt attribute is used for the modal title. This is quick and dirty, but hopefully useable.
//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
@cpuguy83
cpuguy83 / loading_spinner.coffee
Last active August 30, 2020 13:49
Simple loading spinner for long requests with turbolinks and bootstrap modal
@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>