Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Dempsey rdempsey

  • McLean, VA
View GitHub Profile
View metaclasses_at_work.py
import unittest
def foo(x, y, z):
return (x != y and x != z or x and z)
def get_test_args():
x = y = z = [True, False]
from itertools import product, repeat
input_args = list(product(x, y, z))
expected_args = [
View style.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View buildingtheclassifier.py
# building the classifier
from sklearn.ensemble import RandomForestClassifier
# I find it easiest to just define all the features you'll be using in a list. In
# our case it's just the fuzzy scores that we generated using fuzzywuzzy.
features = [
'name_ratio',
'name_token_sort_ratio',
'name_partial_ratio',
'street_ratio',
View scraper.py
import sys
import requests
from arango import create
from bs4 import BeautifulSoup
HEADERS = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5)",
View selenium-webdriver-cheatsheet.md

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@igor-alexandrov
igor-alexandrov / settings.rb
Created Dec 11, 2011
Multiple configuration files in SettingsLogic
View settings.rb
class Settings < Settingslogic
source "#{Rails.root}/config/application.yml"
if Rails.env == 'development'
namespace 'development-' + Socket.gethostname.gsub(/\W/, '-').gsub(/[-]{2,}/, '-')
else
namespace Rails.env
end
# load local settings