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
var start = performance.now(); | |
var end = performance.now(); | |
console.log('Doing stuff took ' + (end-start) + 'ms'); |
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
du -hs /path/to/directory |
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
npm ls |
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
######################### | |
# .gitignore file for Xcode4 and Xcode5 Source projects | |
# | |
# Apple bugs, waiting for Apple to fix/respond: | |
# | |
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
# | |
# Version 2.6 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# |
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 urllib2 | |
import BeautifulSoup | |
request = urllib2.Request("http://www.gpsbasecamp.com/national-parks") | |
response = urllib2.urlopen(request) | |
soup = BeautifulSoup.BeautifulSoup(response) | |
for a in soup.findAll('a'): | |
if 'national-park' in a['href']: | |
print 'found a url with national-park in the link' |
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 os | |
import sys | |
walk_dir = sys.argv[1] | |
print('walk_dir = ' + walk_dir) | |
# If your current working directory may change during script execution, it's recommended to | |
# immediately convert program arguments to an absolute path. Then the variable root below will | |
# be an absolute path as well. Example: |
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
In [1]: df1 = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'], | |
...: 'B': ['B0', 'B1', 'B2', 'B3'], | |
...: 'C': ['C0', 'C1', 'C2', 'C3'], | |
...: 'D': ['D0', 'D1', 'D2', 'D3']}, | |
...: index=[0, 1, 2, 3]) | |
...: | |
In [2]: df2 = pd.DataFrame({'A': ['A4', 'A5', 'A6', 'A7'], | |
...: 'B': ['B4', 'B5', 'B6', 'B7'], | |
...: 'C': ['C4', 'C5', 'C6', 'C7'], |
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
df[df['A'].isin([3, 6])] |
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 pandas | |
df = pandas.DataFrame(data) | |
# Randomly sample 70% of your dataframe | |
df_0.7 = df.sample(frac=0.7) | |
# Randomly sample 7 elements from your dataframe | |
df_7 = df.sample(n=7) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<link rel="stylesheet" type="text/css" href=""> | |
</head> | |
<body> | |
<script type="text/javascript" src=""></script> | |
</body> |