Skip to content

Instantly share code, notes, and snippets.

@youngsoul
youngsoul / remove_punctuation.py
Created December 8, 2017 17:15
Python 3 way to use translate to remove punctuation from a string
# https://stackoverflow.com/questions/265960/best-way-to-strip-punctuation-from-a-string-in-python
import string
def remove_punctuation(x):
table = str.maketrans({key: None for key in string.punctuation})
return x.translate(table)
# mydoc = Appearance: Deep Amber with medium bubbles and an off-white head settles quick with even lacing. Head upon initial pour rose to about one finger's length.
# print(remove_punctuation(mydoc)
# Appearance Deep Amber with medium bubbles and an offwhite head settles quick with even lacing Head upon initial pour rose to about one fingers length
@petehouston
petehouston / markup
Created October 17, 2014 07:20
[Bootstrap] Text overlay center inside the image
<div class="row" id="box-search">
<div class="thumbnail text-center">
<img src="img/cafe.jpg" alt="" class="img-responsive">
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, quisquam?</p>
</div>
</div>
</div>
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@pvieytes
pvieytes / read_tweets.py
Created May 18, 2011 07:16
Parsing Twitter's user time with Python
import Tweet
import simplejson
import urllib2
def read_tweets(user, num_tweets):
tweets = []
url = "http://api.twitter.com/1/statuses/user_timeline.json?\
screen_name=%s&count=%s&include_rts=true" % (user, num_tweets)
file = urllib2.urlopen(url)
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git