Skip to content

Instantly share code, notes, and snippets.

View falahati's full-sized avatar
🥱
I may be slow to respond

Soroush falahati

🥱
I may be slow to respond
View GitHub Profile
@falahati
falahati / FunctionExtensions.ts
Created August 11, 2020 16:53
Typescript type-safe debounce and throttle extension methods
export { };
type GenericFunction = (...params: any[]) => any;
type PromisifiedFunction<T extends GenericFunction> = (...params: Parameters<T>) => Promise<ReturnType<T>>;
declare global {
// tslint:disable-next-line:interface-name
interface Function {
leadingDebounce<T extends GenericFunction>(this: T, wait: number): PromisifiedFunction<T>;
trailingDebounce<T extends GenericFunction>(this: T, wait: number): PromisifiedFunction<T>;
@falahati
falahati / RestartManagerSession.cs
Last active January 24, 2022 14:55
Restart-Manager Wrapper for C#
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.ServiceProcess;
namespace RestartManager
{
@falahati
falahati / gist:8974e0bf0ae40448f352bad24aa74635
Created June 18, 2018 22:52 — forked from tobedoit/gist:4146942
Wordpress: remove the "Dashboard" and redirect for non-admin user
/* Remove the "Dashboard" from the admin menu for non-admin users **********************************
** http://wordpress.stackexchange.com/questions/52752/hide-dashboard-from-non-admin-users ******* */
/* !관리자 아닌 회원 알림판 제거 & 리다이렉트 *********************************************************** */
function custom_remove_dashboard () {
global $current_user, $menu, $submenu;
get_currentuserinfo();
if( ! in_array( 'administrator', $current_user->roles ) ) {
reset( $menu );
$page = key( $menu );
@falahati
falahati / Nullable.cs
Last active February 20, 2017 01:09
C#: This is a copy of System.Nullable<T> class that can be used for both reference types and value types
internal class Nullable<T>
{
public static Nullable<T> Null = new Nullable<T>();
private readonly bool _hasValue;
private Nullable()
{
_hasValue = false;
}
@falahati
falahati / BlankStream.php
Last active February 20, 2017 01:10
A simple stream class with no storing logic behind it. Usable to get the information that are going to be written to the stream
class BlankStream
{
public static $methods = false;
public $method = false;
static function GeneratePath($callBack)
{
$args = array();
if (func_num_args() > 1)
{
$args = func_get_args();
@falahati
falahati / autoexec.cfg
Last active August 29, 2015 14:04
Counter Strike: Global Offensive Configuration File
// ------------------------------------------------------------------------------------------ //
// ABOUT
// By DarkPlayer (IR) for CSGO
// http://steamcommunity.com/id/darkplayer
//
// BASED ON
// "Samer Sultan"'s Config: https://github.com/samersultan/csgo/blob/master/autoexec.cfg
// "Budi"'s Config: https://gist.github.com/nickbudi/3916475
// SPEED SHOOT By "Mayron": http://csgo.gamebanana.com/scripts/7645
// VOICE SCALE By "Josh": http://css.gamebanana.com/scripts/6384