Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
@mjhea0
mjhea0 / comprehensions.md
Created March 27, 2016 14:23 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

@mjhea0
mjhea0 / packt_scraper.py
Created February 4, 2016 01:00 — forked from TrishGillett/packt_scraper.py
Checking the Packt Publishing free ebook of the day with Selenium
# -*- coding: utf-8 -*-
"""
author: Trish Gillett (discardthree@gmail.com, @discardthree on github)
Basic scraper to check the Packt Publishing Free ebook of the day.
This version uses selenium because when I tried getting the source via the
requests package it sometimes seemed to return the source for a version of
the website that was different from the one that was live.
Adapted from this code which was used by Estela Alvarez (supita@gmail.com)
to demo webscraping at a Montreal Pyladies meeting:
@mjhea0
mjhea0 / SimpleHTTPServerWithUpload.py
Created November 10, 2015 05:02 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""

CSS

Group

  • Have each table summarize the blog post.
  • Watch video.
  • After video Have each table chose a website and seperate it's homepage into these 3 things.

Base

  • Core styles for site
@mjhea0
mjhea0 / criteria.txt
Last active October 31, 2015 16:07 — forked from gigamonkey/criteria.txt
Hiring criteria: looking for the ability to …
Write a program that does what it’s supposed to do
Write idiomatic code
Debug a program that you wrote
Debug a program someone else wrote
Debug the interaction between a system you wrote and one you didn’t
File a good bug report
Modify a program you didn’t write
Test a program you wrote
Test a program you didn’t write
Learn a new programming language
@mjhea0
mjhea0 / The Technical Interview Cheat Sheet.md
Last active March 10, 2016 00:01 — forked from tsiege/The Technical Interview Cheat Sheet.md
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.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@mjhea0
mjhea0 / LICENSE
Last active May 22, 2016 03:18 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
var uri = process.env.MONGOLAB_URI || 'mongodb://localhost/test';
mongoose.connect(uri, function (err, res) {
if (err) {
console.log(err);
}
console.log ('success!');
});
from django.views.generic import View
from django.shortcuts import get_object_or_404
from .decorators import json
from .models import RoomModel
from django.http import HttpResponse
class RoomView(View):
"""Room view class that implements the primary HTTP verbs (POST, GET, PUT, DELETE).
<snippet>
<content><![CDATA[
var ${2:${1/.*\/([^\.]+)[\.]?(.*)/$1/g}} = require('${1:lib}');
]]></content>
<tabTrigger>req</tabTrigger>
<scope>source.js</scope>
</snippet>