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
using System.Windows.Media; | |
public static class ColorBrightnessExtension | |
{ | |
public static Color Dark(this Color color) | |
{ | |
return color.ChangeColorBrightness(-0.1f); | |
} | |
public static Color Darker(this Color color) |
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
{ | |
"formdata": [ | |
{ | |
"participant": "520b355f538f270002615f6d", | |
"created": "2013-08-14T07:55:45.022999", | |
"content": { | |
"sex": "m", | |
"academic_degree": "ba", | |
"job_description": "Autor", | |
"education": "abi", |
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
var pipeline = [ | |
{$match: { 'scored': true }}, | |
{$unwind:'$trials'}, | |
{$project: { | |
'trials.snippet': 1, | |
'trials.condition': 1} | |
}, | |
{$group: { | |
_id: { | |
'condition': '$trials.condition', |
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 both(a,b): | |
return equals('$and', [a,b]) | |
def exists(fieldname): | |
d = {} | |
d[str(fieldname)] = {'$exists': True } | |
return d | |
def equals(fieldname, value): |
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 requests_landing_for(plane) | |
return check_identity_of(plane) if capacity_not_reached? | |
raise "No more planes can land!" | |
def requests_landing_for(plane) | |
if there_is_enough_space? | |
return check_identity_of(plane) | |
raise "No more planes can land!" | |
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 operator | |
def countWords(fileName): | |
mydict = {} | |
fobj = open(fileName, 'r') | |
for line in fobj: | |
zuordnung = line.split() | |
for word in zuordnung: | |
if mydict.has_key(word): | |
mydict[word] = mydict.get(word)+1 | |
else: |
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
Javascript | |
========== | |
function reverse(string) { | |
if(string.length > 0) { | |
var head = string.slice(0,1); | |
var tail = string.slice(1); | |
return reverse (tail) + head; | |
} else { | |
return []; |
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
print''.join(map(chr,reduce(lambda x,y: x | |
+[x[-1]+y],[l.count('+')-l.count('-') for | |
l in """++++++++++++++-+-+-+-+-+-+-+-+-+- | |
+++++++++++++++++++++++++++++++++++++++++ | |
++++++++++++.++++++++++++++++++++++++++++ | |
+++++++.----.++++++++++++++++++++.-.----- | |
------.---.+++++++++++++++.---------.---- | |
----------------------------------------- | |
-------------------------------.+++++++++ | |
+++++++++++++++++++++++++++++++++++++++++ |
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 itertools import compress;print[''.join(compress(('Fizz', 'Buzz'),(i%3==0,i%5==0)))or i for i in range(1,60)] |
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
l=[_(int,raw_input().split())for _ in[map]*10];print max(_(sum,l+zip(*l))) |
OlderNewer