From: https://github.com/FallibleInc/security-guide-for-developers
- Use HTTPS everywhere.
- Store password hashes using
Bcrypt(no salt necessary -Bcryptdoes it for you).
| #!/usr/bin/env python | |
| """ | |
| Monitor the Federal Reserve Interest rates and email | |
| an alert if the risk-free rate exceeds a certain percentage | |
| """ | |
| from bs4 import BeautifulSoup | |
| import requests | |
| import os | |
| # This is a percent value |
From: https://github.com/FallibleInc/security-guide-for-developers
Bcrypt (no salt necessary - Bcrypt does it for you).| CREATE TABLE author(author_id integer PRIMARY KEY, name text, age integer); | |
| INSERT INTO author VALUES(1, "Alice", 25); | |
| INSERT INTO author VALUES(2, "Bob", 32); | |
| INSERT INTO author VALUES(3, "Charlie", 29); | |
| CREATE TABLE posts(id integer PRIMARY KEY, author_id integer, post_name text); | |
| INSERT INTO posts VALUES(1, 1, "foo"); | |
| INSERT INTO posts VALUES(2, 1, "bar"); | |
| INSERT INTO posts VALUES(3, 1, "baz"); | |
| INSERT INTO posts VALUES(4, 2, "quz"); |
| /* Coolors Exported Palette - coolors.co/1be7ff-6eeb83-e4ff1a-e8aa14-ff5714 */ | |
| $color1: #1be7ff; | |
| $color2: #6eeb83; | |
| $color3: #e4ff1a; | |
| $color4: #e8aa14; | |
| $color5: #ff5714; | |
| /* Coolors Exported Palette - coolors.co/247ba0-70c1b3-b2dbbf-f3ffbd-ff1654 */ |
| // Randomly shuffles an array in-place using Fisher-Yates algorithm | |
| // http://stackoverflow.com/a/12646864 | |
| Array.prototype.shuffle = function() { | |
| for (var i = this.length - 1; i > 0; i--) { | |
| var j = Math.floor(Math.random() * (i + 1)); | |
| var temp = this[i]; | |
| this[i] = this[j]; | |
| this[j] = temp; | |
| } | |
| return this; |
| function alertModal(title, body) { | |
| // Display error message to the user in a modal | |
| $('#alert-modal-title').html(title); | |
| $('#alert-modal-body').html(body); | |
| $('#alert-modal').modal('show'); | |
| } |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Payment</th> | |
| <th>Issue Date</th> | |
| <th>Amount</th> | |
| <th>Period</th> | |
| </tr> | |
| </thead> | |
| <tbody> |
| // Floobits: | |
| // https://floobits.com/Kortaggio/prototypes | |
| // Inheritance Diagram: | |
| // https://docs.google.com/drawings/d/1PTgRq2UPD0LilvZOFIpTWUsgzGo1iN7XdL7X6BXvA-U/edit?usp=sharing | |
| // Hi guys! Today I'm going to tell you about prototypes in JavaScript. | |
| // Before I get started, I want to ask you a question: | |
| // How many of you have: | |
| // - started a business? |
| # Interview Cake question #33 | |
| # I have an array where every number in the range 1..n appears once except | |
| # for one number which appears twice. Write a function for finding the number | |
| # that appears twice. | |
| from __future__ import print_function | |
| # Since the list is already sorted, we can binary search for the repeated | |
| # number. This runs with O(log n) additional time and O(1) additional space. | |
| def which_appears_twice(the_list): | |
| lower_bound = 0 |
| # Interview Cake question #30 | |
| # Write an efficient function that checks whether any permutation of an input | |
| # string is a palindrome. | |
| from __future__ import print_function | |
| # Strategy: XOR every character with each other. Runtime is O(n). | |
| def is_palindrome(message): | |
| # Hash all the chars to prevent the result from colliding with | |
| # the ascii value of a different, but valid character when xoring. | |
| hashed_chars = map(hash, list(message)) |