Skip to content

Instantly share code, notes, and snippets.

View mahdavipanah's full-sized avatar
💻
Wired in

Hamidreza Mahdavipanah mahdavipanah

💻
Wired in
View GitHub Profile
@mahdavipanah
mahdavipanah / .eslintrc.json
Created August 10, 2018 14:03
My ESLint Config
{
"env": {
"node": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"linebreak-style": [
"error",
@mahdavipanah
mahdavipanah / Format XML [Spicher].md
Last active January 5, 2018 21:07
XML in C - Goli

Format XML

Description du format

Le format XML [https://fr.wikipedia.org/wiki/Extensible_Markup_Language] est un format générique
qui permet l'échange de données structurées. De nombreux formats spécialisés, tels que SVG ou
HTML, correspondent à une utilisation particulière de XML. Les langages de programmation de
@mahdavipanah
mahdavipanah / add_xattribute.c
Last active January 4, 2018 01:15
XML in C - Golbarg
xattribute_t* add_xattribute(xelement_t* e, const char* name, const char* value){
// either element already has some attributes or not
// in both situations we have to create a new attribute to add
// we call it "atr" and first we initate it
xattribute_t* atr = (xattribute_t*)malloc(sizeof(xattribute_t));
atr->name = strdup(name);
atr->value = strdup(value);
atr->next = NULL;
// Now we check if element has no attribute
@mahdavipanah
mahdavipanah / convertToBase.js
Last active July 24, 2017 16:17
Data Structures and Algorithms with JavaScript - Michael McMillan
/**
* Converts a number to another base.
*
* @param {Number} num A number to get converted. If it's float, it's integer part will get converted.
* @param {Number} [base=2] Number's new base.
*
* @returns {String} String representation of number in new base.
*
* @throws {TypeError} First parameter must be a number.
* @throws {RangeError} First Parameter must be >= 0.
@mahdavipanah
mahdavipanah / image_rgb_parts.m
Created March 8, 2017 16:11
Matlab Image Processing
main_image = imread('image.jpg');
red_part = uint8(zeros(size(main_image)));
red_part(:, :, 1) = main_image(:, :, 1);
green_part = uint8(zeros(size(main_image)));
green_part(:, :, 2) = main_image(:, :, 2);
blue_part = uint8(zeros(size(main_image)));
blue_part(:, :, 3) = main_image(:, :, 3);
@mahdavipanah
mahdavipanah / matrix_multiply.py
Created January 17, 2017 08:46
Python matrix multiplication
def matrix_multiply(a, b):
c = [[] for _ in range(len(a))]
for i in range(len(a)):
for j in range(len(a)):
sum = 0
for k in range(len(a)):
sum += a[i][k] * b[k][j]
c[i].append(sum)
return c
@mahdavipanah
mahdavipanah / array_operation_macro.asm
Last active November 26, 2016 15:16
AVR Assembly examples
.include "m32def.inc"
.macro array_operation
push r16
push xl
push xh
push yl
push yh
push zl
push zh
@mahdavipanah
mahdavipanah / producer_consumer.py
Created November 13, 2016 11:06
Solving producer-consumer problem in python using semaphores
"""
Solving producer-consumer problem using semaphores
"""
import threading
# Buffer size
N = 10
# Buffer init
@mahdavipanah
mahdavipanah / csslearn-sololearn.md
Last active August 28, 2016 13:15
My notes in learning css via sololearn.com

Inline css styles should be placed in <head>

font-family

The font-family property specifies the font for an element. There are two types of font family names:

  • font family: a specific font family (like Times New Roman or Arial)
  • generic family: a group of font families with a similar look (like Serif or Monospace)

Separate each value with a comma to indicate that they are alternatives.

If the name of a font family is more than one word, it must be in quotation marks: "Times New Roman".