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
Logging is used for 3 primary goals | |
* debugging | |
* tracing - understanding execution flow of the program in real life | |
* checking inputs | |
There are better tools available for all these three tasks for most usecases | |
Lets see each case. | |
Debugging - When a bug is reported the first order of business is to write a test case that fails and this failure clearly indicates that the bug is present - the code is then modified till this test passes (and no other ones fail) - no need for logging |
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
super basic java | |
- braces | |
- define scope | |
- no masking/shadowing but new variables are welcome | |
"public void kewl() | |
{ | |
int x = 7; | |
{ | |
int x = 8; //Illegal masking |
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
code design guidelines | |
- when designing libraries its better to leave threads out but not always | |
- realize that your users may have varying threading strategies and your lib should not prescribe or assert one lest it resists reuse | |
- typical novice problems | |
- http://joostdevblog.blogspot.in/2015/01/what-most-young-programmers-need-to.html | |
- liar variables, methods, classes | |
- muddy classes | |
- oversized classes | |
- code in comments |
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
* https://www.python.org/ | |
* https://www.python.org/about/gettingstarted/ | |
* Install postgres using this | |
$ brew install postgres | |
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents | |
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
* Install pgAdmin3 | |
* http://www.postgresql.org/ftp/pgadmin3/release/v1.20.0/osx/ |
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
New startups use Python – MonkeyLearn, Roomstorm | |
Established startups use Python – Hipmunk, Buffer, Mattermark | |
Unicorns use Python – Instagram, Pinterest, Spotify, Uber | |
Food startups use Python – Chewse, Yelp | |
Dev tools use Python – Sentry, Keen IO | |
Tech titans use Python – Dropbox, PayPal, Google | |
Creatives use Python – YouTube, edX, Walt Disney Animation Studios | |
Defense contractors use Python – Northrop Grumman | |
Corporate giants use Python – Walmart | |
Media news sites use Python – Pitchfork, BuzzFeed |
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
- General | |
[ ] The code works | |
[ ] The code is easy to understand | |
[ ] Follows coding conventions | |
[ ] Names are simple and if possible short | |
[ ] Names are spelt correctly | |
[ ] Names contain units where applicable | |
[ ] Enums are used instead of int constants where applicable | |
[ ] There are no usages of 'magic numbers' | |
[ ] All variables are in the smallest scope possible |
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 android.graphics.*; | |
import android.net.Uri; | |
public class BitmapFileLoader | |
{ | |
public static Bitmap loadFromUri(Uri fileUri, float maxWidth, float maxHeight) | |
{ | |
BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; | |
BitmapFactory.decodeFile(fileUri.getPath(), options); |
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
OK, I didn’t tell you the most important part—how do you know whether to hire someone? | |
In principle, it’s simple. You’re looking for people who are | |
Smart, and | |
Get things done. | |
That’s it. That’s all you’re looking for. Memorize that. Recite it to yourself before you go to bed every night. You don’t have enough time to figure out much more in a short interview, so don’t waste time trying to figure out whether the candidate might be pleasant to be stuck in an airport with, or whether they really know ATL and COM programming or if they’re just faking it. | |
People who are Smart but don’t Get Things Done often have PhDs and work in big companies where nobody listens to them because they are completely impractical. They would rather mull over something academic about a problem rather than ship on time. These kind of people can be identified because they love to point out the theoretical similarity between two widely divergent concepts. For example, they will say, “Spreadsheets are really just a special case of prog |
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
class PrototypeStore(dict): | |
def __setattr__(self, name, value): | |
self[name] = value | |
def __getattr__(self, name): | |
return self[name] | |
class PrototypeMeta(type): | |
def __new__(metacls, cls_name, bases, attrs): | |
cls = type.__new__(metacls, cls_name, bases, attrs) |
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 jsonpickle | |
import domain | |
""" | |
Based on the premise that any object can be identified by its class name and | |
a the value of a unique attribute (primary key) which is here reffered to as the identity | |
""" | |
def make_attribute_key(obj,attribute): | |
""" |
NewerOlder