Skip to content

Instantly share code, notes, and snippets.

View martianboy's full-sized avatar
👽

Abbas Mashayekh martianboy

👽
  • Rechat
  • Toronto, Canada
View GitHub Profile
@martianboy
martianboy / sample.html
Created February 8, 2018 10:35
Outlook CSV validation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#byte_content {
@martianboy
martianboy / gitlab.css
Created October 6, 2016 20:43
استایل کامنت‌های فارسی برای گیت‌لب با فونت وزیر
body {
font-family: "Source Sans Pro", "Helvetica Neue", Vazir, Helvetica, Arial, sans-serif
}
.diff-file .notes_holder {
font-family: "Source Sans Pro", "Helvetica Neue", Vazir, Helvetica, Arial, sans-serif
}
ul.notes .timeline-icon {
float: right;
@martianboy
martianboy / persian-alphabetic-comparator.js
Last active October 5, 2016 14:01
تابع مقایسه رشته فارسی با رعایت ترتیب الفبایی حروف.
function persian_alphabetic_compare(s1, s2) {
const persian_alphabet_fix_map = {
'ؤ': 1608.5,
'ئ': 1609.5,
'پ': 1577,
'ة': 1607.5,
'ژ': 1586.5,
'ک': 1603,
'چ': 1580.5,
'گ': 1603.5,
@martianboy
martianboy / trello.css
Created August 26, 2016 20:05
A simple & non-obtrusive (I hope!) RTL stylesheet for Trello with Vazir font.
pre {
direction: ltr;
}
body, button, html, input, select, textarea {
font-family: "Helvetica Neue", Vazir, Arial, Helvetica, sans;
}
.comment-container {
line-height: 1.5em;
@martianboy
martianboy / retryable.js
Created March 4, 2016 08:03
Retryable Promise
function retryable(fn, n) {
return fn().then(
undefined,
function(err) {
if (n > 0)
return retryable(fn, n - 1);
throw err;
}
)
@martianboy
martianboy / isbn.js
Last active October 8, 2015 20:14
Iranian ISBN Validator and Converter.
'use strict';
var isbn_groups = {
'964': [
[0, 14, 2],
[150, 249, 3],
[300, 549, 3],
[970, 989, 3],
[2500, 2999, 4],
[5500, 8999, 4],
@martianboy
martianboy / directive.js
Created February 26, 2015 22:03
directive.js
"use strict";
webioxApp.directive("fineuploaderCopy", ["$parse", function ($parse) {
return {
strict: "A",
require: "?ngModel",
scope: {
model: "=ngModel"
},
link: function (scope, element, attrs, ngModel) {
@martianboy
martianboy / read-dir-files.cpp
Last active August 29, 2015 14:11
Read contents of files inside a directory
//
// main.cpp
// cpp-read-files
//
// Created by Abbas Mashayekh on 10/1/1393 AP.
// Copyright (c) 1393 Abbas Mashayekh. All rights reserved.
//
#include <iostream>
#include <dirent.h>
@martianboy
martianboy / normalize.py
Last active August 29, 2015 14:06
Normalize input file with Hazm Normalizer, replace in-place.
from hazm import Normalizer
from zipfile import ZipFile
import argparse
import binascii
import re
import os
import shutil
parser = argparse.ArgumentParser(description='Normalizes input text files.')
@martianboy
martianboy / generators.js
Last active August 29, 2015 14:04
Testing higher-order functions with es6 generators
/* This will run async without creating intermediate arrays. */
function* makeGeneratorFromArray(array){
var nextIndex = 0;
while(nextIndex < array.length) {
yield array[nextIndex++];
}
}