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
from datetime import timedelta | |
#Input date is a datetime instance | |
""" | |
>>> get_days_in_week(datetime(2013,06,17)) | |
[datetime.datetime(2013, 6, 17, 0, 0), datetime.datetime(2013, 6, 18, 0, 0), datetime.datetime(2013, 6, 19, 0, 0), datetime.datetime(2013, 6, 20, 0, 0), datetime.datet ime(2013, 6, 21, 0, 0), datetime.datetime(2013, 6, 22, 0, 0), datetime.datetime(2013, 6, 23, 0, 0)] | |
>>> get_days_in_week(datetime(2013,06,17)) |
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
#s3_object_key is the file path relative to the your S3 URL where you want to store the file | |
Eg. | |
s3_object_key = '%s/%s' %(settings.USER_PROFILE_PICTURE_DIR, filename) | |
#file is the file that you have create locally either in ephermal storage (Like the Heroku Dyno) or permanent storage like your local file system | |
#Write to local storage | |
Eg. |
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
//Creating the data to be sent, note the escaped quotes that are required | |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3); | |
nameValuePairs.add(new BasicNameValuePair("\A\"", "\"/api/v1/a/1/\"")); | |
nameValuePairs.add(new BasicNameValuePair("\"B\"", "\"/api/v1/b/1/\"")); | |
nameValuePairs.add(new BasicNameValuePair("\"C\"", "\"Hello from Android\"")); |
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
$('.tweet').each(function(index, element){ | |
var tweet = $(element).find('.entry-content').html().replace(new RegExp('<strong></strong><strong></strong>', 'gm'),' ').replace(new RegExp('<(/){0,1}strong>', 'gm'), '').replace(new RegExp('"', 'gm'),''); | |
var date = $(element).find('.published').attr('title'); | |
console.log(tweet+' <my-deliminator> ' +date); | |
}); |
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
To get all entities of one kind: | |
http://api.crunchbase.com/v/1/<plural-namespace> | |
Namespace can be: | |
companies | |
people | |
financial-organizations | |
products |
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
def calculate_score(votes, item_hour_age, gravity=1.8): | |
return (votes - 1) / pow((item_hour_age+2), gravity) |
NewerOlder