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
def subsets(not_selected, selected=[]): | |
if not not_selected: | |
return [selected] | |
else: | |
current_element = not_selected[0] | |
return ( | |
subsets(not_selected[1:], selected) + \ | |
subsets(not_selected[1:], selected + [current_element]) | |
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Sample minimal config file. Copy this to ~/.offlineimaprc and edit to | |
# get started fast. | |
[general] | |
accounts = Gmail | |
[Account Gmail] | |
localrepository = Gmail-Local | |
remoterepository = Gmail-Remote |
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
def add(self, other): # overloading + operator | |
return self.__class__(self.a + other.a, self.b + other.b) | |
def sub(self, other): # overloading - operator | |
return self.__class__(self.a - other.a, self.b - other.b) | |
def constructor(self, a = 0, b = 0): # to be constructor | |
self.a = a | |
self.b = b |
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
-module(star_pattern). | |
-export([print/2]). | |
for(N, N, Symbol) -> io:format("~s", [Symbol]); | |
for(X, N, Symbol) -> | |
io:format("~s",[Symbol]), | |
for(X, N-1, Symbol). | |
print(Symbol, Times) -> |
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
document.querySelectorAll('._5pcr.fbUserPost') | |
.forEach((element) => { | |
if(element.innerHTML.match(/sarahah/)) { | |
element.style.visibility = 'hidden'; | |
} | |
}) |
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
a = {} | |
# add a key-value pair | |
a['name'] = 'ishan' | |
# lets see whats in there | |
print(a) | |
# {'name': 'ishan'} | |
# add more key-value pairs |
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
a = {} | |
a['name'] = 'ishan' | |
console.log(a) | |
// { name: 'ishan' } | |
// or the other way | |
a.age = 24 | |
console.log(a) | |
// { name: 'ishan', age: 24 } |
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
def qsort(l): | |
if not l: | |
return [] | |
else: | |
pivot, tail = l[0], l[1:] | |
return qsort([x for x in tail if x < pivot]) + [pivot] + qsort([x for x in tail if x >= pivot]) |
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
-module(timer). | |
-export([start/2, cancle/1]). | |
start(Time, Fun) -> | |
spawn(fun() -> timer(Time, Fun) end)). | |
cancle(Pid) -> Pid ! cancle. | |
timer(Time, Fun) -> | |
receive |