Skip to content

Instantly share code, notes, and snippets.

View justinabrahms's full-sized avatar

Justin Abrahms justinabrahms

View GitHub Profile
@justinabrahms
justinabrahms / gist:9116933
Last active August 29, 2015 13:56
anti-scraper

So I was writing an article on screen scraping and one of the things that came up is "How do you mitigate against screen scraping?" I think this is actually in interesting question, which brought up the idea of a side project that maybe someone else has time for.

The idea is that to prevent screen scraping, the page being scraped must be mutated as to break a scraper. To do that, you could do things like alter selectors of css resources and html (for instance, changing all ids of "signupButton" to "sarah-goldfarb") or change the structure of the page. Maybe it also mutates the structure of the DOM.

A small node proxy that does this around streams would be particularly cool.

Things you're likely to learn:

  1. More about CSS selector precedence. Which selectors can you easily mutate? Which are harder? Are there examples of selectors which you can't mutate?
  2. What can XPath do? XPath is a mechanism for querying tree structures (notably XML). If you were g

Keybase proof

I hereby claim:

  • I am justinabrahms on github.
  • I am justinabrahms (https://keybase.io/justinabrahms) on keybase.
  • I have a public key whose fingerprint is E0B7 AA7C 81E5 BEC7 991E FA4E 320E 47C9 795A D0D6

To claim this, I am signing this object:

@justinabrahms
justinabrahms / gist:10015289
Last active August 29, 2015 13:58
My PyCon go-to-talk list. Blank indicates I'm considering skipping that block for the hallway track.

April 11 -- Day 1

  • 10:50 -- Computer Science fundamentals for self-taught programmers (my talk)
  • 11:30: Creating bomb-proof data importers
  • 12:10:
  • 1:40/1:55: The Birth & Death of Javascript -- Gary is a fantastic speaker.
  • 2:35:
  • 3:15: Getting Started with SaltStack OR What is Async
  • 4:15/4:30: Maybe Castle Anthrax. Maybe Distributed Computing.
  • 5:10: Python + Geographic Data = BFFs (Support for fellow Portlanders!)
@justinabrahms
justinabrahms / gist:5a29d7e74e0620e23f08
Last active August 29, 2015 14:03
Comparisons of Hay's 2002 translation (bottom) and an older translation on Project Gutenberg (above).

(Classic Translation)

Of my grandfather Verus I have learned to be gentle and meek, and to refrain from all anger and passion.

From the fame and memory of him that begot me I have learned both shamefastness and manlike behaviour. Of

my mother I have learned to be religious, and bountiful; and to forbear, not only to do, but to intend any evil; to content myself with a spare diet, and to

@justinabrahms
justinabrahms / git-stash-grep
Created August 13, 2014 23:56
grep your git stash
#!/bin/bash
for i in `git stash list --format="%gd"`; do
git stash show -p $i | grep -H --label="$i" "$1"
done
@justinabrahms
justinabrahms / gist:bdcbc7a2da010d7aff6e
Last active August 29, 2015 14:06
Choose a random, acceptable keg from John's Marketplace in Portland.
from pyquery import PyQuery
import requests
from random import choice
url = 'http://www.johnsmarketplace.com/Kegs/'
query = 'td table tr'
def main():
def do_sprintly_automated_deploy(role, current_build, build_number):
"""
Find what tickets were in this deploy and mark them as deployed in Sprintly.
"""
if not settings.GITHUB_PERSONAL_TOKEN or not settings.SPRINTLY_API_KEY \
or not settings.SPRINTLY_EMAIL:
print 'Missing required settings for automated deploy.'
return

Code Review

A guide for reviewing code and having your code reviewed.

Peer code reviews are the single biggest thing you can do to improve your code - Jeff Atwood

Purpose

Code review is an important part of a team's development process. It helps to:

  • disseminate knowledge about the codebase/technology/techniques across teams
  • increase awareness of the features being developed
<script type="text/javascript">
$(window).load(function(){
var hash_count = 0;
$('a[href="#"]').each(function(){
if(!$(this).data("events")) hash_count++;
});
$('head').append("&lt;!-- " + hash_count + " links with # as their href --&gt;");
});
</script>