Skip to content

Instantly share code, notes, and snippets.

View al1b's full-sized avatar
😄
Happy

Ali Bahraminezhad al1b

😄
Happy
View GitHub Profile
@al1b
al1b / compiler-settings.cs
Created May 29, 2019 09:24
Simple implemention of ICompilerSettings
class CompilerSettings : ICompilerSettings
{
private readonly CompilerLanguage _compilerLang;
private readonly string _rootDirectory = new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath;
private string _compilerPath => _compilerLang == CompilerLanguage.CSharp
? @"roslyn\csc.exe"
: @"roslyn\vbc.exe";
public CompilerSettings(CompilerLanguage compiler = CompilerLanguage.CSharp)
{
_compilerLang = compiler;
@al1b
al1b / compiler-settings.cs
Created May 29, 2019 08:33
RoslynCodeDomProvider CSharpCodeProvider
/// <summary>
/// Creates an instance using the given ICompilerSettings
/// </summary>
/// <param name="compilerSettings"></param>
public CSharpCodeProvider(ICompilerSettings compilerSettings = null) {
_compilerSettings = compilerSettings == null ? CompilationSettingsHelper.CSC2 : compilerSettings;
}
@al1b
al1b / linkdin-tahoma.js
Created November 13, 2016 17:09
Linkedin Tahoma Font - Grease Monkey Script
// ==UserScript==
// @name Linkedn
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Automatically change font to Tahoma for rtl contents in LinkendIn.
// @author Ali Bahraminezhad - https://github.com/Dev-P
// @match https://*.linkedin.com/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@al1b
al1b / blocking-page.js
Last active August 17, 2017 07:31
Replace Simple Blocking Page
// ==UserScript==
// @name Simple Blocking Page
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Replace payvandha.ir with a simpler page.
// @author You
// @grant none
// @include *
// ==/UserScript==
/*
Author: Ali Bahraminezhad
Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any).
https://www.hackerrank.com/challenges/library-fine
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
/*
Author: Ali Bahraminezhad
Description: You are given a square map of size . Each cell of the map has a value denoting its depth. We will call a cell
of the map a cavity if and only if this cell is not on the border of the map and each cell adjacent to it has strictly smaller depth.
Two cells are adjacent if they have a common side (edge).
https://www.hackerrank.com/challenges/cavity-map
*/
@al1b
al1b / bing-wall.py
Created July 14, 2016 18:19
A Python script to download today picture of Bing.com and set it as Windows Desktop wallpaper.
import re, os, tempfile
import urllib.request
from urllib.parse import urlparse
def getBing():
url = 'http://bing.com/'
response = urllib.request.urlopen(url)
data = response.read()
@al1b
al1b / MVA.py
Created June 17, 2016 12:36
Python script to extract video urls and subtitles from Microsoft Virtual Academy.
__author__ = "Ali Bahraminezhad - antipattern.ir"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Ali Bahraminezhad"
import re
import os
import tempfile
import json