Skip to content

Instantly share code, notes, and snippets.

@shiftkey
shiftkey / magic.md
Created January 9, 2014 22:10
Git: reverting a revert using the reflog

Recovering from a bad revert

Open up Git Shell for your repository and type this command:

git reflog

This will show a list of recent actions that Git has performed against your repository:

@shiftkey
shiftkey / howto-manually-add-trust-cert-to-rubygems.md
Created December 1, 2016 01:20
SSL issue with rubygems on Windows - explainer and workaround

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

@shiftkey
shiftkey / program.cs
Created August 17, 2016 05:08
a quick and simple implementation of Pausable
static void Main(string[] args)
{
var range = Observable.Interval(TimeSpan.FromSeconds(1));
var sampler = new Subject<bool>();
var sendWhileTrue = range.CombineLatest(sampler, Tuple.Create)
.Where(tuple => tuple.Item2)
.Select(tuple => tuple.Item1)
.DistinctUntilChanged();
@shiftkey
shiftkey / SQLitePCL.raw_basic.targets
Created October 29, 2014 03:22
custom build script for SQLitePCL.raw
<?xml version="1.0" encoding="utf-8"?>
<!--Automatically generated-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="check_cpu_0c72a276-f4be-4f0e-bd92-2a1989a25230" BeforeTargets="ResolveAssemblyReferences" Condition=" ( ($(Platform.ToLower()) != 'x86') AND ($(Platform.ToLower()) != 'x64') ) ">
<Warning Text="$(Platform) is not supported. The Platform configuration must be x86 or x64" />
</Target>
<Target Name="InjectReference_87384a6c-0435-42c0-a1fd-2ef989adce4b" BeforeTargets="ResolveAssemblyReferences">
<!--platform.net45.pinvoke_sqlite3.x86-->
<ItemGroup Condition=" '$(Platform.ToLower())' == 'x86' ">
<Reference Include="SQLitePCL.raw">
@shiftkey
shiftkey / .gitconfig
Created September 16, 2012 11:14
Sample .gitconfig with aliases for fun and profit
[alias]
st = status
co = checkout
ci = commit
br = branch
df = diff
lp = log -p
com = checkout master
fe = fetch origin
hr = reset origin/master --hard
https://github.com/octokit/octokit.net/issues/new?body=%23%23%23%20Story%20%2F%20Task%0A%0A%23%23%23%20Value%0A%0A%23%23%23%20Acceptance%20Criteria%0A%20-%20%5B%20%5D%20%0A%0A%23%23%23%20Notes
@shiftkey
shiftkey / gist:6eb57144d06275bdfdb0
Created January 5, 2016 03:27
tags sorted by popularity
Library -- 1
Command-line -- 1
Version -- 1
AD -- 1
Active Directory -- 1
Semantic Versioning -- 1
Player -- 1
actormodel -- 1
akka -- 1
concurrency -- 1
@shiftkey
shiftkey / gist:8681919
Created January 29, 2014 04:37
Re-testing http://blogs.msdn.com/b/vancem/archive/2006/10/01/779503.aspx on a modern machine (VM inside a MBP)
# .NET Framework 2.0
Data units of msec resolution = 0.365714 usec
10 typeof(string) : count: 1000000 26.349 +- 4% msec
10 typeof(string).TypeHandle : count: 1000000 27.436 +- 4% msec
10 anObj.GetType() == type : count: 1000000 35.330 +- 2% msec
10 Type.GetTypeHandle(obj).Equals(tHnd) : count: 1000000 28.136 +- 3% msec
10 anObj.GetType() == typeof(string) : count: 1000000 2.254 +- 7% msec
10 (anObj is string) : count: 1000000 8.841 +- 4% msec
@shiftkey
shiftkey / HttpClientWithProxyAdapter.cs
Created January 13, 2014 16:00
Wireup a HttpClient with proxy support in Octokit.net
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
@shiftkey
shiftkey / Program.cs
Last active January 2, 2016 08:59
A quick and dirty demonstration of Window in Rx
using System;
using System.Reactive.Linq;
namespace SlidingWindow
{
class Program
{
static void Main(string[] args)
{
var random = new Random();