View find_deviation.js
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 find_deviation(v, d) | |
{ | |
if (v.length <= 0) return 0; | |
start = 0; | |
medians = []; | |
arr_length = v.length; | |
loop_time = arr_length/d; | |
for(var i=0; i< loop_time; i++){ | |
temp_arr = v.slice(start, start+d); | |
find_max = Math.max.apply(null, temp_arr); |
View find_deviation.cpp
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 <vector> | |
#include <algorithm> | |
using namespace std; | |
int find_deviation(vector<int> &, int); | |
int main(int argc, char const *argv[]) | |
{ |
View moving_balls.cpp
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 <SFML/Graphics.hpp> | |
#include "Box2D/Box2D.h" | |
static const float SCALE = 30.f; | |
void create_balls_and_move_them() | |
{ | |
// define the world; | |
b2Vec2 gravity(b2Vec2(0.f,9.8f)); // check if it dont work | |
b2World world(gravity); |
View singleton_object.cpp
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 <string> | |
using namespace std; | |
class Car | |
{ | |
static Car* single_instance_declared; | |
string _name; | |
string _engine; | |
int _wheels; |
View binary_tree_1.cpp
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> | |
struct Node | |
{ | |
int content; | |
Node* left; | |
Node* right; | |
Node(int,Node*,Node*); | |
static void add_child(Node* parent, Node* child); | |
}; |
View naive_string_match.c
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 <string.h> | |
#include <stdlib.h> | |
int string_match(char* str, char* pattern) | |
{ | |
size_t str_len = strlen(str); | |
size_t pattern_len = strlen(pattern); | |
size_t len_diff = str_len - pattern_len; |
View Makefile
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
# If KERNELRELEASE is defined, we've been invoked from the | |
# kernel build system and can use its language. | |
ifneq ($(KERNELRELEASE),) | |
obj-m := hello.o | |
# Otherwise we were called directly from the command | |
# line; invoke the kernel build system. | |
else | |
KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
PWD := $(shell pwd) | |
default: |
View daemon_c.c
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> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
int main(int argc, char* argv[]) | |
{ |
View simple_server.c
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> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#define PORT 7890 |
View word_count.c
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> | |
#include <string.h> | |
int word_count(const char* str) | |
{ | |
size_t word_count = 0; | |
size_t char_counter = 0; | |
size_t str_length = strlen(str); |
OlderNewer