Note: I'm currently taking a break from this course to focus on my studies so I can finally graduate
|# Use this script to test that your Telegram bot works.|
|# Install the dependency|
|# $ gem install telegram_bot|
|# Run the bot|
|# $ ruby bot.rb|
Command-line arguments in Python show up in
sys.argv as a list of strings (so you'll need to import the
For example, if you want to print all passed command-line arguments:
import sys print(sys.argv) # Note the first argument is always the script filename.
Command-line options are sometimes passed by position (e.g.
myprogram foo bar) and sometimes by using a "-name value" pair (e.g.
myprogram -a foo -b bar).
position: absolute; top: 50%; transform: translateY(-50%);
Translate is processed at the end, meaning it is based on the final element height. This means it works with any element, even dynamic heights. Of course it only works on relatively new browsers, but translate is well accepted and on the path to being ubiquitous. The style is also easy to understand and isn't hacky.
Inspired by this article. Neat tricks for speeding up integer computations.
cin.sync_with_stdio(false); disables synchronous IO and gives you a performance boost.
If used, you should only use
cin for reading input
(don't use both
scanf when sync is disabled, for example)
or you will get unexpected results.
Multiply by a power of 2
x = x << 1; // x = x * 2
|Playing around with slightly various ways to simulate uniq in Python.|
|The different strategies are timed.|
|Only m1() and m2() do not change the order of the data.|
|`in` is the input file, `out*` are output files.|
|infile = 'in' # Change filename to suit your needs.|
Lesson 1: Affordances and Signifiers
Don't solve the problem given (as it's stated), figure out what the real underlying problem is.
To understand design, you have to be a good observer and question things. Travel with a camera and take photos. Don't use flash, use natural lighting when possible.
Affordances are the relationships (read: possible actions) between an object and an entity (most often a person). For example, a chair affords sitting for a human. Affordances enable interactions between entities and objects (similarly, anti-affordances prevent or reduce interactions). The presence of an affordance is determined by the properties of the object and of the abilities of the entity who's interacting with the object.
Signifiers are signals, communication devices. These signs tell you about the possible actions; what to do, and where to do it. Signifiers are often visible, but invisible (secret) signifiers do exist, like clicking a YT video to play
The program below can take one or more plain text files as input. It works with python2 and python3.
Let's say we have two files that may contain email addresses:
foo bar ok firstname.lastname@example.org sup hey...email@example.com,wyd hello world!
A summary of the Rails Guides on Routes, plus other tips.
The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.
# Redirects /orders/report to orders#report. get 'orders/report', to: 'orders#report'