Skip to content

Instantly share code, notes, and snippets.

@stephenash
stephenash / README.md
Created October 22, 2014 21:00
Django on ElasticBeanstalk - HTTP to HTTPS redirects

I needed a way to have my Django ElasticBeanstalk application automatically redirect HTTP requrests to HTTPS. Rick Christianson wrote a post [1] about how to do this by overwriting the wsgi.conf file with one that was slightly modified to support the HTTP to HTTPS redirect.

Building off the shoulders of giants, I wanted to do the same, but not have to keep a copy of the config file in my local source directory. Christianson even points out in his post that if ElasticBeanstalk ever changes it's template for the wsgi.conf file, those updates would not be overwritten and you wouldn't get their benefits. To get around that problem, I used sed to insert the new lines into the wsgi.conf file.

References

  1. http://rickchristianson.wordpress.com/2013/11/02/updating-wsgi-automatically-in-amazon-aws/
  2. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands
@zhuochun
zhuochun / README.md
Last active June 14, 2023 17:46
List all posts, tags and categories in Jekyll. https://github.com/zhuochun/md-writer

List all posts, tags and categories in Jekyll.

Octopress users: if you found " is escaped in the generated JSON file, please change them to \". Refer to this issue.

#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@dkd903
dkd903 / Install_Sublime_Text_3.sh
Last active April 6, 2018 19:10
Install Sublime Text 3 editor on Fedora Linux & Red Hat Linux - 32 Bit Edition. More at: http://digitizor.com/?p=15885
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 14, 2024 04:49
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!






\

@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active May 11, 2024 22:07
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@hoetmaaiers
hoetmaaiers / handlebars-helpers.md
Last active September 16, 2017 16:25
Handlebars Helpers

Pluralize or singular string based on a number

Handlebars.registerHelper('pluralize', function(number, singular, plural) {
    if (number === 1) {
        return singular;
    } else {
        return (typeof plural === 'string' ? plural : singular + 's');
    }
});
@markselby
markselby / async-gists.js
Last active February 19, 2020 10:26
Load GitHub Gists asynchronously and optionally specify which file to show. This allows you to keep related files in a single gist but show them individually on your pages. The async loading prevents your page rendering from stalling.
function loadGists() {
var els = $('code[gist]'), gists = {}, code = [], stylesheets = [];
// Get elements referencing a gist and build a gists hash referencing the elements that use it
els.each(function(idx, rawEl) {
var el = $(rawEl), gist = el.attr('gist');
rawEl.gist = gist;
rawEl.file = el.attr('file');
gists[gist] = gists[gist] || { targets: [] };
gists[gist].targets.push(el);
});