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 / index.html
Created September 1, 2011 06:41
TileGrid Template
<script type="text/javascript">
{literal}
isc.RestDataSource.create({
ID:"menuItemsDS",
fields:
[
{name:"id",primaryKey:"true",type:"integer", hidden:"true"},
{name:"Title",type:"string",title:"نام"},
{name:"Icon",type:"string",title:"شمایل", length:1500},
{name:"Command",type:"string",title:"فرمان",length:500, hidden:"true"},
@martianboy
martianboy / base64glyphs.txt
Created February 23, 2012 11:00
Base64 coded small glyphs for use in CSS
Close: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAQAAAADHm0dAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAAAEgAAABIAEbJaz4AAAAJdnBBZwAAABUAAAAVAHF8yDUAAABtSURBVCjP5ZLBCcAwCEWfHSXDBEeSjJRZMkNXSQ9pS2wgpMdSPYj8h35EqazGtkx+FxUkCndG8WztEqWQTsEoqFNdA+mErdUZ2uB8TZ+jkCnk0d54ASOwE7BBeUy1zqvNDLy6gHYL1avy+yc8APGFa375gR00AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==
@martianboy
martianboy / Form2.vb
Created March 16, 2012 10:05
Threading problem
Public Class Form2
Public Shared Thread_2 As System.Threading.Thread
Public MyDefaultWindowState = FormWindowState.Normal
Private Delegate Sub dlgShowMe()
Public Sub ShowMe()
If Thread_2 IsNot Nothing AndAlso Thread_2.ThreadState = Threading.ThreadState.Running Then
'اگر این فرم باز بود، آن را اکتیو میکند
If Me.InvokeRequired Then
Dim d As New dlgShowMe(AddressOf Me.ShowMe)
@martianboy
martianboy / controller.php
Created August 21, 2012 20:30
Improvments for Reza's Controller class
protected $args = array();
public function __construct($arguments = NULL){
$this->_repository = new \db\model\repository();
$this->_result['error'] = false;
$this->_result['body'] = "Working in construct of controller\n";
$this->_result['message'] = "";
if (is_array($arguments))
$this->args = $arguments;
@martianboy
martianboy / circle.html
Created May 5, 2014 21:00
From triangles to circles: The story of Pi
<!doctype html>
<html lang='fa-IR' dir='rtl'>
<head>
<meta charset='utf-8'>
<title>Ractive test</title>
<style type='text/css'>
@import url(http://fonts.googleapis.com/earlyaccess/droidarabicnaskh.css);
body {
@martianboy
martianboy / front-dev-server.py
Last active August 29, 2015 14:01 — forked from dustingetz/serve.py
A quick http server for static files with no-cache headers that comes handy for front-end development.
#!/usr/bin/env python3
import argparse
from http.server import SimpleHTTPRequestHandler, test
class MyHTTPRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
self.send_header("Pragma", "no-cache")
self.send_header("Expires", "0")
@martianboy
martianboy / Report.ipynb
Last active August 29, 2015 14:01
Dirichlet distribution
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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++];
}
}
@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 / 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>