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
# Django settings for DjangoProjects project. | |
import os | |
#if this value exsist you are on appfog. | |
if 'VCAP_SERVICES' in os.environ: | |
DEBUG = False | |
#othewhise it's localhost | |
else: | |
DEBUG = True |
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
curl -L -d headers YOUR_URL |
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
class Language(models.Model): | |
name = models.CharField(max_length=100, default='') | |
fb_id = models.CharField(max_length=100, default='0') | |
def __unicode__(self): | |
return str(self.fb_id) | |
class UserProfile(models.Model): | |
user = models.OneToOneField(User) | |
name = models.CharField(max_length=100, default='') |
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 joinObjects(objects, field): | |
''' | |
takes a list of objects and merge them. | |
objects are dicts | |
if objects have same keys, values are joined into a list. | |
[{'id':1,'tag':'ciao1'}, | |
{'id':2,'tag':['ciao1',ciao3]}, | |
{'id':1,'smt':'else2'}, | |
{'id':2,'tag':'ciao2'}] | |
becomes |
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
//This function archives all the read mail that are not in the inbox | |
function markArchivedAsRead() { | |
//i add "has:nouserlabels" beacuse i have filter that skip the emails form the inbox and place them in lables. for that case i want to keep the emails as unread. | |
var threads = GmailApp.search('label:unread has:nouserlabels -label:inbox'); | |
GmailApp.markThreadsRead(threads); | |
}; | |
//this funciton cleans the inbox | |
function cleanInbox() { | |
// for all the inbox mail that are not starred and are read, it archives them |
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
//labels: change the names accordingly to your needs. | |
//those labels have to be in the gmail. | |
var l_morning = GmailApp.getUserLabelByName("Delay/Morning"); | |
var l_midday = GmailApp.getUserLabelByName("Delay/Midday"); | |
var l_tonight = GmailApp.getUserLabelByName("Delay/Tonight"); | |
var l_tomorrow = GmailApp.getUserLabelByName("Delay/Tomorrow"); | |
var l_nextweek = GmailApp.getUserLabelByName("Delay/Nextweek"); | |
var me = "YOUR EMAIL GOES HERE"; | |
//array of all the labels: DO IT |
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 datetime | |
import random | |
#user id | |
userId=122 | |
sessionId = 143 #141 #142 #143 | |
# this is needed to keep track of the new ids we create and use them in the indicator_measure | |
ids = [] | |
id = int(datetime.utcnow().strftime("%s")) |
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
http://127.0.0.1:8080/clubs?size=2 | |
{ | |
"nexPage": "E-ABAIICJ2oSZGV2fmZpbmUtcHJpZGUtNzMzchELEgRDbHViGICAgICAgIAJDIgCABQ=", | |
"total": 4, | |
"items": [ | |
{ | |
"description": "desc", | |
"id": 4785074604081152, |
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
{ | |
"results":[{"name":"item1"},{"name":"item2"},{"name":"item3"},{"name":"item4"},{"name":"item5"},{"name":"item6"},{"name":"item7"},{"name":"item8"}], | |
"total":8 | |
} |
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
angular.module('gcCoachApp') | |
.controller('GcCourseFormCtrl', function ($scope, gcResourceCourses, $stateParams, gettext, $timeout) { | |
//... | |
$scope.editFn = function (course) { | |
$scope.edit = true; | |
//this is to overcome the problem in conversion. | |
//in this way we fake the conversion. | |
//we fill in the data that are shown in the form. | |
$scope.course._endDate = new Date(course.endDate); | |
$scope.course._startDate = new Date(course.startDate); |
OlderNewer