Skip to content

Instantly share code, notes, and snippets.

View gist:282804
# lint Python modules using external checkers.
#
# This is the main checker controlling the other ones and the reports
# generation. It is itself both a raw checker and an astng checker in order
# to:
# * handle message activation / deactivation at the module level
# * handle some basic but necessary stats'data (number of classes, methods...)
#
[MASTER]
View gist:278962
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from django.db import models
View gist:254892
In [1]: '' in 'abc'
Out[1]: True
In [2]: [] in [1, 2, 3,] #If empty sequence in sequence is True, why is this false?
Out[2]: False
In [3]: '' in [1, 2, 3,]
Out[3]: False
In [4]: x = 'abc'
View flickr_photo_detail_finder.py
ids = ['4153869960',
'4160152863',
'4165131655',
'4164906099',
'4165892330',
'4165146115']
import urllib
import json
View gist:236886
<Location />
SetHandler /path/to/umoja.wsgi
</Location>
View gist:171016
def merge(url):
full_url=[]
for i, el in enumerate(url):
if i%2==0:
full_url.append(el)
full_url = ''.join(full_url)
return full_url
def combineflatten(seq):
items= tuple(item for item in seq if not isinstance(item, tuple))
View gist:148368
scala> None == None
res3: Boolean = true
scala> None == 10
<console>:5: warning: comparing non-null values of types object None and Int using `==' will always yield false
None == 10
^
res4: Boolean = false
scala> None > 10
View gist:148365
php> echo(false)
php> echo(true)
1
php> echo(null)
php>
View gist:147958
Clojure 1.0.0-
user=> nil
nil
user=> (== 10 10)
true
user=> (== nil 10)
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (== 10 nil)
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (> nil 10)
View gist:147953
Hugs> Nothing
Nothing
Hugs> Nothing == Nothing
True
Hugs> Nothing > 10
ERROR - Cannot infer instance
*** Instance : Num (Maybe a)
*** Expression : Nothing > 10
Hugs> Nothing < 10
You can’t perform that action at this time.