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
expr = "28+30+++39+32" | |
filter(bool, expr.split("+")) | |
filter(None, expr.split("+")) | |
bool(None) == bool('') == bool() == False |
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 os | |
import sys | |
def get_curr_worker(): | |
return 1 | |
def is_worker_turn(f): | |
def _is_worker_turn(*args, **kwargs): | |
if args[0] == get_curr_worker(): | |
return f(*args, **kwargs) |
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
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <iostream> | |
#define DELIM ' ' | |
bool is_match(char * str, char * substr) | |
{ | |
while (*substr++ == *str++); |
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
#include <iostream> | |
#include <cstdlib> | |
class A { | |
private: | |
int a; | |
char b; | |
float c; | |
public: |
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
function Vector2D(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
Vector2D.prototype.toString = function () { | |
return this.x +"i" + " + " + this.y + "j"; | |
} | |
Vector2D.prototype.add = function (v) { |
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
<html> | |
<head> | |
<style> | |
div { | |
background: url("me.png"); | |
width:60px; | |
height:60px; | |
border-radius:100px; | |
border:4px solid #204A87; | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) { | |
int a = 5, b = 9; | |
a = a + b; | |
b = a - b; | |
a = a - b; | |
printf("%d %d\n", a, b); |
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 os | |
import sys | |
class A(): | |
def say(self): | |
return "hello world" | |
@classmethod | |
def shout(cls): | |
return "hello class world" |
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
-module(ring). | |
-export([benchmark/2]). | |
%% run benchmark for N processes and M messages. | |
benchmark(N, M) -> | |
Pids = makering(N), | |
for(1, M, fun() -> spawn(fun() -> start(message, Pids) end) end). | |
%% setting up the process ring for sending | |
%% messages & return the Pids array |
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
class A(): | |
def say(self): | |
return "hello world" | |
@classmethod | |
def shout(cls): | |
return "hello class world" | |
@staticmethod | |
def scream(): |
OlderNewer