- add route for
new_user_path
- create a
UsersController
with new action - create
new.html.erb
- generate user model with
password_digest
string field - uncomment
gem 'bcrypt'
in Gemfile and addhas_secure_password
in User model - add
create
action in UsersController - implement logic for creating a user
- set
session[:user_id]
in create action
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
#!/usr/bin/ruby | |
#usage: youtube-to-mp3 <youtube-url> | |
#example: youtube-to-mp3 http://www.youtube.com/playlist?list=PL398CE05652474A1E | |
#desc: downloads a single youtube vid or a playlist, then converts to mp3. | |
# Requires youtube-dl and ffmpeg | |
url = ARGV[0] | |
system("youtube-dl -citA #{url}") |
- Add
gem 'rails_12factor'
to your Gemfile. This will add error logging and the ability for your app to serve static assets. bundle
- Run
RAILS_ENV=production rake db:create db:migrate db:seed
- Run
rake secret
and copy the output - From the command line:
export SECRET_KEY_BASE=output-of-rake-secret
- To precompile your assets, run
rake assets:precompile
. This will create a folderpublic/assets
that contains all of your assets. - Run
RAILS_ENV=production rails s
and you should see your app.
Remember to clobber your assets (rake assets:clobber
) and re-precompile (rake assets:precompile
) if you make changes.
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
#/usr/bin/env python3 | |
import time | |
import threading | |
import functools | |
import tqdm | |
def long_running_function(*args, **kwargs): |
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
#!/usr/bin/env python3 | |
# Gambling Statistics Problem: | |
# If you play roulette every day and quit whenever you're ahead by x amount, | |
# do you make money in the long run? | |
# Answer: | |
# No. | |
import random | |
STARTING_BALANCE = 100000 |
In Jekyll set a variable for the mail, e.g. in the _config.yml
email: name@mail.com
then use it in your page
Reach me under: {{ site.email | mailObfuscate }}
which will generate the following HTML
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
import os | |
import pickle | |
import warnings | |
import numpy as np | |
import pandas as pd | |
from sklearn.model_selection import train_test_split | |
from tensorflow.keras.callbacks import EarlyStopping | |
from tensorflow.keras.layers import Dense | |
from tensorflow.keras.layers import Dropout |