Skip to content

Instantly share code, notes, and snippets.

View omidnasri's full-sized avatar
🏢
PTFCH

Omid Nasri omidnasri

🏢
PTFCH
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

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
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
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 Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

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 => user.followers > 1000)
@scottrippey
scottrippey / jQuery.antiforgerytoken.js
Created August 22, 2012 18:21
ASP.NET MVC AntiForgeryToken + AJAX = jQuery to the rescue
// Setup CSRF safety for AJAX:
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if (options.type.toUpperCase() === "POST") {
// We need to add the verificationToken to all POSTs
var token = $("input[name^=__RequestVerificationToken]").first();
if (!token.length) return;
var tokenName = token.attr("name");
@ajaxray
ajaxray / cookies.min.js
Created November 26, 2012 09:32
Small JavaScript class to help create, read and delete cookie. [compressed]
/**
* Cookies - [compressed] A small class to manipulate cookies from javascript
* Uncompressed version: https://gist.github.com/gists/4139367
*/
window.Cookies={set:function(e,t,n,r){if(n){var i=new Date;i.setTime(i.getTime()+n*24*60*60*1e3);var s="; expires="+i.toGMTString()}else var s="";var o=r||"/";document.cookie=e+"="+t+s+"; path="+o},get:function(e){var t=e+"=";var n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" ")i=i.substring(1,i.length);if(i.indexOf(t)==0)return i.substring(t.length,i.length)}return null},"delete":function(e){this.set(e,"",-1)}}
@razvanstan
razvanstan / [jQuery] find element by data attribute
Created June 17, 2013 04:47
[jQuery] find element by data attribute
$('#id').find('[data-name="' + js_var + '"]');
@azat-co
azat-co / jquery-api.md
Last active November 2, 2022 19:33
The list of most commonly used jQuery API functions

Here is the list of most commonly used jQuery API functions:

  • find(): Selects elements based on the provided selector string
  • hide(): Hides an element if it was visible
  • show(): Shows an element if it was hidden
  • html(): Gets or sets an inner HTML of an element
  • append() Injects an element into the DOM after the selected element
  • prepend() Injects an element into the DOM before the selected element
  • on(): Attaches an event listener to an element
  • off() Detaches an event listener from an element
@jogleasonjr
jogleasonjr / SlackClient.cs
Last active October 20, 2023 15:54
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
{
@eternnoir
eternnoir / gist:9777420
Last active May 3, 2022 05:25
Ftp Client With C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
namespace Lib.Common
{
public class FtpClient
@koldev
koldev / Logger.cs
Created September 23, 2014 10:36
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
{
@ivandnepr90
ivandnepr90 / FtpHelper.php
Created November 21, 2014 14:35
Ftp helper
<?php
/**
* Created by JetBrains PhpStorm.
* User: dn211290sia
* Date: 25.10.14
* Time: 10:00
* To change this template use File | Settings | File Templates.
*/
namespace Common\Utility\GeneralPurpose;