This file contains hidden or 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
template <class T> | |
struct MyArray { | |
private: | |
T * arr; | |
size_t size; | |
public: | |
using type = T; | |
MyArray(size_t size) : | |
size(size), |
This file contains hidden or 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
//ThoughtsOnRESTAPI.swift | |
//Thoughts On how a good REST API library should look like | |
/* | |
object mapping : entity <-> json | |
can do it by reflection? | |
hierarchical configuration: | |
- auth header (for all requests) | |
- require status code, method verb etc (one config for each request) | |
- parameter and payload |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# forked from http://playbear.github.io/2015/09/30/net-music-comment/ | |
import requests | |
import json | |
import os | |
import base64 | |
from Crypto.Cipher import AES |
This file contains hidden or 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
extension LazySequenceType { | |
public func reduceWhile<T>( | |
initial: T, | |
@noescape combine: (T, Self.Generator.Element) -> T, | |
@noescape criteria: (T) -> Bool | |
)-> T { | |
var generator = self.generate() | |
var now = initial |
This file contains hidden or 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
''' | |
Haskellized python code | |
License: WTFPL | |
''' | |
qsort1 = (lambda arr:arr if (len(arr)<2) else qsort1(filter(lambda x:x <= arr[0],arr[1:])) + [arr[0]] + qsort1(filter(lambda x:x > arr[0],arr[1:]))) | |
qsort2 = (lambda arr:arr if (len(arr)<2) else qsort2([x for x in arr[1:] if x <= arr[0]]) + [arr[0]] + qsort2([x for x in arr[1:] if x > arr[0]])) | |
bsort = (lambda arr:arr if (len(arr)<2) else (lambda mid:bsort(filter(lambda x:x <= mid,arr))+bsort(filter(lambda x:x > mid,arr)))((max(arr)+min(arr))/2)) | |
merge = lambda a,a1,a2: a+a2 if not a1 else a+a1 if not a2 else merge(a+[a1[0]],a1[1:],a2) if a1[0] < a2[0] else merge(a+[a2[0]],a1,a2[1:]) | |
msort = lambda a:a if (len(a)<2) else merge([],msort(a[:len(a)/2]),msort(a[len(a)/2:])) |
NewerOlder