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
a=[] | |
while STDIN.readline.chomp!="42" | |
a.push($_) | |
end | |
a.each { |s| puts 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
import hashlib | |
def register(request): | |
if request.method == 'POST': | |
request_post = request.POST | |
registration_form = RegistrationFormUniqueEmail(request_post) | |
hashstring=hashlib.sha1(str(request.POST.get('csrf_token'))) ## This is going to be unique ! A unique has | |
if request.session.get('sesionform')!=hashstring: | |
if registration_form.is_valid(): | |
username = registration_form.cleaned_data['username'] | |
email = registration_form.cleaned_data['email'] |
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 django.db import models | |
from django.forms import ModelForm | |
from django.contrib.auth.models import User | |
class ReportTypes(models.Model): | |
def __unicode__(self): | |
return self.report_name | |
report_name = models.CharField(max_length=100) | |
report_element_json_list = models.TextField(max_length=1000) | |
report_belongs_to_lab = models.ForeignKey(User) |
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 django import forms | |
class NewReportTypeForm(forms.ModelForm): | |
def __init__(self, *args, **kwargs): | |
self.report_belongs_to_lab = kwargs.pop('report_belongs_to_lab', None) | |
super(NewReportTypeForm, self).__init__(*args, **kwargs) | |
def save(self, commit=True): | |
instance = super(NewReportTypeForm, self).save(commit=False) | |
if self.report_belongs_to_lab: | |
instance.report_belongs_to_lab = self.report_belongs_to_lab |
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 add_new_report_type(request): | |
if request.method=='POST': | |
new_report = ReportTypes() | |
new_report_type_form = NewReportTypeForm(data=request.POST,instance=new_report,report_belongs_to_lab=request.user) #ReportTypes() | |
if new_report_type_form.is_valid(): | |
new_report_type_form.save() | |
return HttpResponse("Done") | |
else : | |
return HttpResponse("Ditch") |
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 django.contrib.auth.models import User, check_password | |
class EmailAuthBackend(object): | |
""" | |
Email Authentication Backend | |
Allows a user to sign in using an email/password pair rather than | |
a username/password pair. | |
""" | |
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
<?php | |
session_start(); | |
require_once("response.php");//response.php is the kookoo xml preparation class file | |
$r = new Response(); | |
$r->setFiller("yes"); | |
$recore_wav="update"; | |
if(isset ($_REQUEST['event']) && $_REQUEST['event']== "NewCall" ) | |
{ | |
$_SESSION['caller_number']=$_REQUEST['cid']; | |
$_SESSION['kookoo_number']=$_REQUEST['called_number']; |
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
package com.starcamping.boundary.rest; | |
import java.io.IOException; | |
import java.net.URISyntaxException; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.UUID; |
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
## Installing Virtual Environment and Eggifying your source code for OERPub | |
Go to your Repo : cd <repo_name> | |
and then : | |
virtualenv --no-site-packages . | |
./bin/easy_install -U ZopeSkel | |
./bin/paster create --list-templates | |
./bin/paster create -t nested_namespace <repo_name> | |
This will create and empty egg for your repo ! |
OlderNewer