Skip to content

Instantly share code, notes, and snippets.

View amkherad's full-sized avatar

Ali Kherad amkherad

View GitHub Profile
@atifaziz
atifaziz / NameObjectCollectionBase.cs
Created October 29, 2008 09:16
A modern implementation of NameValueCollection
#region Imports
using System;
using System.Diagnostics;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
#endregion
@tagawa
tagawa / sessionStorage.js
Created June 6, 2012 06:31
sessionStorage polyfill
/*
* Based on: http://www.quirksmode.org/js/cookies.html
* and https://github.com/wojodesign/local-storage-js/blob/master/storage.js
* and https://gist.github.com/350433
* License: http://www.opensource.org/licenses/MIT
*/
(function(window) {
'use strict';
window.sessionStorage = window.sessionStorage || {
@sabarasaba
sabarasaba / gist:3080590
Created July 10, 2012 02:19
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active February 24, 2026 06:43
Beginner Friendly: Using Multiple SSH keys

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

@bzamecnik
bzamecnik / wordpress_com_nginx_proxy_to_subpath.md
Created June 21, 2018 12:48
Nginx proxy for Wordpress.com on custom domain with subpath.
@fabiolimace
fabiolimace / UUIDv6.sql
Last active June 9, 2026 11:57
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@amkherad
amkherad / DataContext.cs
Last active July 16, 2020 18:01
EntityFrameworkConfigurationsApplier
public class DataContext : DbContext {
private static readonly Lazy<Action<ModelBuilder>> EntityConfigurationApplier =
new Lazy<Action<ModelBuilder>>(
() => EntityConfigurationsApplier.CreateAutoApplierBuilder(typeof(DataContext))
);
protected override void OnModelCreating(
ModelBuilder modelBuilder
)
{
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active July 22, 2026 06:31
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr