Skip to content

Instantly share code, notes, and snippets.

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)
{
"formdata": [
{
"participant": "520b355f538f270002615f6d",
"created": "2013-08-14T07:55:45.022999",
"content": {
"sex": "m",
"academic_degree": "ba",
"job_description": "Autor",
"education": "abi",
@cessor
cessor / mongodbquery
Last active January 4, 2016 21:09
Kalauer...
var pipeline = [
{$match: { 'scored': true }},
{$unwind:'$trials'},
{$project: {
'trials.snippet': 1,
'trials.condition': 1}
},
{$group: {
_id: {
'condition': '$trials.condition',
def both(a,b):
return equals('$and', [a,b])
def exists(fieldname):
d = {}
d[str(fieldname)] = {'$exists': True }
return d
def equals(fieldname, value):
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!"
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:
@cessor
cessor / Reverse Recurse (Javascript)
Last active August 29, 2015 14:01
Reverse Recurse
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 [];
@cessor
cessor / gist:e7f4a1a04b0c8de9e391
Created May 19, 2014 14:57
Oneline Brainfuck Subset Parser
print''.join(map(chr,reduce(lambda x,y: x
+[x[-1]+y],[l.count('+')-l.count('-') for
l in """++++++++++++++-+-+-+-+-+-+-+-+-+-
+++++++++++++++++++++++++++++++++++++++++
++++++++++++.++++++++++++++++++++++++++++
+++++++.----.++++++++++++++++++++.-.-----
------.---.+++++++++++++++.---------.----
-----------------------------------------
-------------------------------.+++++++++
+++++++++++++++++++++++++++++++++++++++++
@cessor
cessor / gist:8778805d6f76aa464a9a
Created May 19, 2014 15:05
FizzBuzz in 114 Characters Python
from itertools import compress;print[''.join(compress(('Fizz', 'Buzz'),(i%3==0,i%5==0)))or i for i in range(1,60)]
@cessor
cessor / gist:9422f8bec79a37b38d36
Created May 26, 2014 22:44
grid computing golf
l=[_(int,raw_input().split())for _ in[map]*10];print max(_(sum,l+zip(*l)))