This file contains hidden or 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
| // app.js | |
| var connect = require('connect'); | |
| var auth= require('connect-auth'); | |
| var MyFirstFormStrategy= require('./myFirstFormStrategy'); | |
| function routes(app) { | |
| app.get('/', function(req, res, params) { | |
| req.authenticate(['someName'], function(error, authenticated) { | |
| res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
| res.end('Hello World'); | |
| }); |
This file contains hidden or 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
| // myFirstFormStrategy.js | |
| module.exports= function(options) { | |
| options= options || {}; | |
| var that= {}; | |
| var my= {}; | |
| that.name = options.name || "someName"; | |
| that.authenticate= function(request, response, callback) { | |
| this.success( {id:'1', name:'someUser'}, callback ); | |
| } | |
| return that; |
This file contains hidden or 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 execnet, gevent | |
| # Use boto to get images ip | |
| from boto.ec2.connection import EC2Connection | |
| conn = EC2Connection('secret', 'secret') | |
| my_ami = conn.get_all_instances() | |
| my_instances = my_ami[1].instances | |
| servers = [] | |
| for instance in my_instances: | |
| servers.append(instance.public_dns_name) |
This file contains hidden or 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
| <body class="sore pain horrible"></body> |
This file contains hidden or 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
| $('body').addClass('paleo'); |
This file contains hidden or 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
| .set1 { | |
| font-size: 14px; | |
| } | |
| .set2 { | |
| font-size: 1.1em; | |
| } | |
| .set3 { | |
| font-size: 1.2em; |
This file contains hidden or 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 datetime | |
| print "hello world %s!" % datetime.datetime.now().year |
This file contains hidden or 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 django.db import models | |
| class CategoryManager(models.Manager): | |
| def get_query_set(self): | |
| return super(CategoryManager, self).get_query_set().order_by('name') | |
| class Sub_CategoryManager(models.Manager): | |
| def get_query_set(self): | |
| return super(Sub_CategoryManager, self).get_query_set().order_by('parent__name', 'name') |
This file contains hidden or 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 MainModel(models.Model): | |
| # some code | |
| objects=CategoryManager() | |
| # rest of code here |
This file contains hidden or 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 Profile(models.Model): | |
| user = models.ForeignKey(User) | |
| # ... other fields | |
| status_of_user = models.BooleanField(default=False) | |
| token = models.CharField(max_length=300, blank=True, null=True) |