Skip to content

Instantly share code, notes, and snippets.

View omidnasri's full-sized avatar
🏢
PTFCH

Omid Nasri omidnasri

🏢
PTFCH
View GitHub Profile
@omidnasri
omidnasri / check-ftp.php
Created April 12, 2019 19:57 — forked from fordnox/check-ftp.php
Check ftp connection with PHP
<?php
$host = 'example.com';
$password = 'pass';
$username = 'username';
try {
$result = checkFtp($host, $username, $password);
} catch(Exception $e) {
$result = $e->getMessage();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
namespace Lib.Common
{
public class FtpClient
@omidnasri
omidnasri / SlackClient.cs
Created February 26, 2019 20:18 — forked from jogleasonjr/SlackClient.cs
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{
@omidnasri
omidnasri / active.md
Created February 6, 2019 07:40 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
$('#id').find('[data-name="' + js_var + '"]');
@omidnasri
omidnasri / Logger.cs
Created January 16, 2018 20:05 — forked from koldev/Logger.cs
Simple C# Logger class for writing log entries to console and/or file
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
public sealed class Logger
{
[Flags]
public enum Targets
{
@omidnasri
omidnasri / README-Template.md
Created November 17, 2017 10:36 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@omidnasri
omidnasri / gist:4008c480352d1955114a718e1d9f8687
Created December 19, 2016 18:23 — forked from smonteverdi/gist:2822016
jQuery: Display favicon next to external link
$("a[href^='http']").each(function() {
$(this).css({
background: "url(http://www.google.com/s2/u/0/favicons?domain=" + this.hostname +
") left center no-repeat",
"padding-left": "20px"
});
});
@omidnasri
omidnasri / gist:1d894550c5d582ffa8c0e64d8a5e73f6
Created December 19, 2016 18:19 — forked from Balya/gist:c29a7620efdebd5470d820f241c6090b
jQuery: Display favicon next to external link
jQuery(document).ready(function() {
jQuery("article a[href*='//']:not([href*='" + document.location.hostname + "']):not(:has(*))").each(function() {
jQuery(this).css({
background: "url(http://www.google.com/s2/favicons?domain=" + this.hostname + ") left center no-repeat",
"padding-left": "22px"
});
});
});