Skip to content

Instantly share code, notes, and snippets.

View emregulcan's full-sized avatar
☠️

Emre GULCAN emregulcan

☠️
View GitHub Profile
@JonCole
JonCole / Redis-BestPractices-General.md
Last active December 2, 2025 10:45
Redis Best Practices

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

@aaronjwood
aaronjwood / BinarySearchTree.cs
Created February 15, 2016 05:57
Binary search tree implementation in C#
using System;
using System.Diagnostics;
namespace BinarySearchTree
{
class Node
{
public int value;
public Node left;
public Node right;
@mgp25
mgp25 / uploadPhoto.php
Created November 26, 2015 23:29
Example: Upload photo to Instagram using https://github.com/mgp25/Instagram-API
<?php
require '../src/Instagram.php';
/////// CONFIG ///////
$username = '';
$password = '';
$debug = false;
$photo = ''; // path to the photo
$caption = null; // caption
//////////////////////
$i = new Instagram($username, $password, $debug);
public class CrossDomainHandler : DelegatingHandler
{
const string Origin = "Origin";
const string AccessControlRequestMethod = "Access-Control-Request-Method";
const string AccessControlRequestHeaders = "Access-Control-Request-Headers";
const string AccessControlAllowOrigin = "Access-Control-Allow-Origin";
const string AccessControlAllowMethods = "Access-Control-Allow-Methods";
const string AccessControlAllowHeaders = "Access-Control-Allow-Headers";
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
@gregrickaby
gregrickaby / infinite-scroll-masonry-imagesloaded.php
Last active June 14, 2023 13:01
Infinite Scroll + Masonry + ImagesLoaded
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@bradwilson
bradwilson / Cacheability.cs
Created January 23, 2014 20:53
Using chaining to create cached results in ASP.NET Web API v2
public enum Cacheability
{
NoCache,
Private,
Public,
}
@salcode
salcode / gist:6912619
Last active November 8, 2023 01:11
jQuery function to remove all "data-" attributes from a given element
// Note: This is an improved version provided by @laurentmuller in the comments below.
// removes all data attributes from a target element
// example: removeDataAttributes('#user-list');
function removeDataAttributes(target) {
var $target = $(target);
// Loop through data attributes.
$.each($target.data(), function (key) {
// Because each key is in camelCase,
@MrScruffy04
MrScruffy04 / OptimizationExtensions.cs
Last active April 22, 2016 04:18
Allows one to minify JS and CSS within a Razor View. See usage at the bottom of the source.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Optimization;
using Microsoft.Ajax.Utilities;
namespace System.Web.Mvc
{
public static class OptimizationExtensions
@netmilk
netmilk / apiary.md
Created October 8, 2013 14:08
Super simple example API Blueprint for testing REST APIs demo

FORMAT: X-1A

Machines API

The Example API for Dredd API Blueprint testing tool

Group Machines

Machines collection [/machines]

@atestu
atestu / knockout-loading.js
Last active December 18, 2015 14:39
Manage loading states in Knockout.JS! This simple trick allows you to show loading states (spinners, etc) before your data is loaded. This is very useful when you're using APIs.
var YourViewModel = function () {
var self = this;
self.thing = ko.observable('');
$.get('api/call', function (data) {
self.thing(data);
// thing is loaded,
self.loaded.thing(true);