A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
# Import necessary libraries | |
from __future__ import division | |
import numpy as np | |
import pandas as pd | |
# Load dataset and store dataframe in variable 'df' | |
# 25 randomly selected income values w/ a range of $50k – $250k | |
df = pd.read_csv('http://bit.ly/2eaP6ny', header = None) | |
df = df |
This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin it without our permission, will be mighty good friends of ourn, cause we don’t give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that’s all we wanted to do.
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
require "fileutils" | |
root_dir = "/Users/jason/Downloads/images" | |
Dir.chdir(root_dir) | |
puts Dir.pwd | |
Dir.glob("**/*.{jpg}").each do |fname| | |
tfname = fname.split("/").last | |
if fname.match("[small|large|normal]_") | |
tfname = fname.split("_").last | |
end | |
p1,p2 = tfname[0,1],tfname[1,1] |
$ = jQuery | |
$.fn.lineHeight or= -> | |
if height = @data('lineHeight') | |
return height | |
# Create a hidden div with the same font | |
# properties, then measure its height | |
$shadow = $('<span />') | |
$shadow.css({ |
mysqldump --skip-triggers --compact --no-create-info --complete-insert -u [db_user] -p [db_name] | sed '/schema_migrations/d' | gzip -c | ssh [remote_user]@[remote_host] 'cat > [remote_file].sql.gz' |
mysqldump [database] | pv | gzip -c > [file].sql.gz |
let timer; | |
const delay = (func, ms = 500) => { | |
clearTimeout(timer); | |
timer = setTimeout(func, ms); | |
} | |
export default delay; |
# Gemfile | |
gem 'redis', '~> 3.0.1' |