Skip to content

Instantly share code, notes, and snippets.

View alahijani's full-sized avatar

Ali Lahijani alahijani

  • Irvine, California
View GitHub Profile
@alahijani
alahijani / Euclid.idr
Last active March 31, 2021 12:55
Proof of Euclid's Lemma in Idris - Number Theory Algorithms
module Euclid
import Syntax.PreorderReasoning
%default total
Divides : (divisor, dividend : Nat) -> Type
Divides d n = (q : Nat ** (n = q * d))
data Direction = LTR | RTL
@alahijani
alahijani / targum.js
Last active April 15, 2020 23:39
Transliterate various middle eastern Abjads to Arabic
(function (window, document) {
function transliterate(s, table) {
return Array.from(s).map(function (c) {
return table.hasOwnProperty(c) ? table[c] : c
}).join('')
}
var toArabic = {
'א': 'ا',
'ב': 'ب',
@alahijani
alahijani / git-tfs-output.txt
Created May 17, 2014 00:20
Started a git tfs clone with-branches, but git-tfs started repeating itself after a while. In this fragment a centain sequence of lines is repeated 5 times.
C5772 = 1a6c8c3fcc1ed3ad636f19a907384bd6871df2ad
C5921 = e62b5f77f6e738d4fc9b50b09de0b53dce84e8c9
C5923 = 4620da34ef3f573dd00e06541d8cb00c3b0f8124
C5958 = 864b7d9b776aa32af7cd22988396f3a3d8b29996
C5960 = 351c16da24d14a21a02b39fe4e08146e11441c1d
C5992 = caf3029a45fd37d37adc8dbf0adaddf5f1838272
C6027 = a6799e2375bc5a802856c34b50a91a7dc0d91c48
C6032 = bfc8d3cdb1c7a4c7d3a6855490167ee2c291964d
C6049 = 2d6645daa94ba80dc994a438381b00ac996f60c7
C6051 = d9fd9b67336f36ddb02ac3add4d5e9bf6279ca75
@alahijani
alahijani / he2ar.js
Last active December 22, 2015 16:19
Transliterate Hebrew, Syriac --> Arabic
function transliterate(str, table) {
var result = '';
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i);
result += table[c];
}
return result
}
var toArabic = {
@alahijani
alahijani / ArrayList.java
Created December 8, 2012 12:58
ArrayList with E[] instead of Object[]
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.RandomAccess;
/**
* Resizable-array implementation of the <tt>List</tt> interface. Implements
* all optional list operations, and permits all elements, including