Skip to content

Instantly share code, notes, and snippets.

var months = 'فروردین اردیبهشت خرداد تیر مرداد شهریور مهر آبان آذر دی بهمن اسفند'.split(' ');
var result = [];
$("#wpTextbox1").val().replace(/علیهالسلام/g, 'علیه‌السلام').split('\n').forEach(function (x) {
var p = x.split(' ');
result.push('<holiday day="' + p.splice(-1)[0].replace(/[۰-۹]/g, function (x) { return String.fromCharCode(x.charCodeAt(0) - '۰'.charCodeAt(0) + '0'.charCodeAt(0)); }) + '" month="' + (months.indexOf(p.splice(-1)[0]) + 1) + '" year="1394">' + p.join(' ') + '</holiday>');
});
result.join('\n');

Keybase proof

I hereby claim:

  • I am ebraminio on github.
  • I am ebrahim (https://keybase.io/ebrahim) on keybase.
  • I have a public key whose fingerprint is EE83 C31D DD17 A4AB D26B CC8D A26B C87F 3FAC C264

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
# Genereated from https://raw.github.com/wikimedia/pywikibot-core/master/pywikibot/userinterfaces/transliteration.py
import json
def dictgen():
dict = {}
for char in u"ÀÁÂẦẤẪẨẬÃĀĂẰẮẴẶẲȦǠẠḀȂĄǍẢ":
dict[char] = u"A"
for char in u"ȀǞ":
dict[char] = u"Ä"
@ebraminio
ebraminio / gist:515856764c30d12a9f6f
Last active December 27, 2015 09:27
async job queue
// ES6
[1, 2, 3]
.map(x => () => new Promise((resolve, reject) => { console.log(x); setTimeout(resolve, 1000); }))
.reduce((promise, next) => promise.then(next), Promise.resolve())
.then(() => console.log('Async Job Queue done'));
// jQuery
[1, 2, 3].map(function (val) {
return function () {
console.log(val);
#! /usr/bin/env python3
# python3 script to retrieve Iran and Afghnistan provinces' capital cities coordinates.
# Written by Ebrahim Byagowi
import json
import re
import requests
query_result = requests.get('https://query.wikidata.org/sparql', {
"query": """
@ebraminio
ebraminio / List MORT fonts.cc
Last active July 9, 2016 21:50
Which fonts on Mac (10.11.5) have got "mort" or "morx" table?
#include <stdio.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include <hb.h>
#include <hb-ft.h>
#include <dirent.h>
@ebraminio
ebraminio / main.cc
Created November 20, 2016 15:08
Minimal code to repro hb_coretext memory leak
#include <stdlib.h>
#include <stdio.h>
#include <hb.h>
int main(int argc, char **argv) {
FILE *f = fopen("/Library/Fonts/Tahoma.ttf", "rb");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
@ebraminio
ebraminio / cuda.cu
Last active December 19, 2016 15:13
CUDA capabilities gist
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "device_functions.h"
#include <stdio.h>
void print(char*, int[], int);
__global__ void square(int *a) { // our computation logic, will be run on GPU
a[threadIdx.x] *= a[threadIdx.x];
@ebraminio
ebraminio / kernel.cu
Last active December 19, 2016 17:24
All Sums
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define __CUDACC__
#include "device_functions.h"
#include <stdio.h>
#include <stdlib.h>
void print(char*, int[], int);
@ebraminio
ebraminio / pillowdrawtext.ipynb
Created January 30, 2017 07:13
Pillow Draw Text
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.