Skip to content

Instantly share code, notes, and snippets.

View ahmadajmi's full-sized avatar

Ahmad Ajmi ahmadajmi

View GitHub Profile
@ahmadajmi
ahmadajmi / Evaluating Combinations
Created October 2, 2011 05:15
Evaluating Combinations
(define (Square x) (* x x) )
| | |_ multiple |_ it by |_ itself
| |_something
To |
|_ Procedure name
(define (<name> <formal parameters>) <body>)
@ahmadajmi
ahmadajmi / gist:1257091
Created October 2, 2011 05:19
Parameter vs Arguments
(define (Suare x) (* x x))
(Square 3)
; the paremeter is x the argument is 3
@ahmadajmi
ahmadajmi / gist:1257092
Created October 2, 2011 05:21
The substitution model for procedure application
; Applicative Order
(f 5)
(sum-of-squares (+ a 1) (* a 2))
(sum-of-squares (+ 5 1) (* 5 2))
(+ (square 6) (square 10)
(+ (* 6 6) (* 10 10))
(+ 36 100)
136
; Normal Order
33 projects that make developing django apps awesome
http://elweb.co/programacion/33-projects-that-make-developing-django-apps-awesome/
Enter Django Development
http://blog.eood.cn/enter_django_python_development
virtualenv 1.6.4
http://pypi.python.org/pypi/virtualenv
@ahmadajmi
ahmadajmi / gist:1380845
Created November 20, 2011 20:29
Some URLS
http://kukuklok.com/
http://gettingstartedwithdjango.com/resources/index.html
http://readthedocs.org/docs/djangocon-2011-notes/en/latest/from_designer_to_djangoer.html
http://code.google.com/edu/languages/google-python-class/introduction.html
http://docs.python.org/tutorial/datastructures.html
https://code.djangoproject.com/wiki/DjangoResources
http://www.ece.uci.edu/~chou/py02/python.html
http://hameedullah.com/2009/04/28/step-by-step-guide-to-use-sign-in-with-twitter-with-django/
http://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Insertion_sort
@ahmadajmi
ahmadajmi / gist:1391230
Created November 24, 2011 12:19
return the URL of the favicon
from urlparse import urlparse, urljoin
def get_fav_icon(url):
"""
return the URL of the favicon
"""
base_url = '%s://%s' % urlparse(url)[:2]
favicon_url = urljoin(base_url, 'favicon.ico')
print favicon_url
;; Division by zero in Scheme for fun
(define (checkZeroValue a n)
(if (= n 0)
(print "n is zero")
(/ a n)))
(define divisionByZero
(lambda (a n)
(checkZeroValue a n)))
;; Check if x < -2 or x > 2
;; If True return x exponent
;; If False print "bla bla bla"
;; In Logic Form ::
;; :: If p or q then r
;; :: Therefore, if not r, then not p and not q
(define logicalForm
(lambda (x)
(if (or (< x (- 2)) (> x 2))
# A grid function that draws a grid
# based on the example at http://www.greenteapress.com/thinkpython/html/thinkpython004.html
def grid(x, y):
def beem():
print '+ - - - -',
def post():
print '| ',
# Django settings for ontwik project.
import os
import dj_database_url
PROJECT_ROOT = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (