Skip to content

Instantly share code, notes, and snippets.

View cameronism's full-sized avatar

Cameron Jordan cameronism

View GitHub Profile
✔ ~/.vim/bundle
$ for d in *; do pushd $d >/dev/null; git remote show -n origin | awk '/Fetch/{ print $3 }'; popd>/dev/null; done
https://github.com/mattn/emmet-vim.git
https://github.com/KabbAmine/gulp-vim.git
https://github.com/phildawes/racer.git
https://github.com/rust-lang/rust.vim.git
https://github.com/scrooloose/syntastic.git
https://github.com/leafgarland/typescript-vim.git
https://github.com/bling/vim-airline
git://github.com/altercation/vim-colors-solarized.git
There are only two hard problems in distributed systems:
2. Guaranteed order of messages
1. Exactly-once delivery
2. Guaranteed order of messages
*adapted from <https://twitter.com/mathiasverraes/status/632260618599403520>*
set -g mouse on
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
set -g @batt_color_full_charge '#[fg=colour64]' #green
set -g @batt_color_high_charge '#[fg=colour64]' #green
set -g @batt_color_medium_charge '#[fg=colour136]' #orange
set -g @batt_color_low_charge '#[fg=colour160]' #red
@cameronism
cameronism / LICENSE
Created October 12, 2016 01:30
Extension functions on JDBC Connection and ResultSet
Copyright 2016 Cameron Jordan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@cameronism
cameronism / dev-tools-ftw.js
Created February 12, 2017 22:38
streamline photopass downloads
// 1. pay for all your photos
// 2. scroll through the entire album and ensure all previews have loaded
// 3. open dev tools
var stopDownloadPlease = false;
var downloadPlease = () => { setTimeout(() => {$(".icon-button.download").click(); setTimeout(() => { $(".arrow-next .icon.ng-binding.wdw.size-l.rotate-0").click(); if (!stopDownloadPlease) { downloadPlease() }; }, 4000)}, 700) };
downloadPlease();
// 4. watch downloads folder until duplicates start showing up (or some other way to make sure you got them all)
// 5. `stopDownloadPlease = true;`
@cameronism
cameronism / Demo.cs
Created May 11, 2017 16:48
ShallowValueComparer
void Main()
{
// http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode
Demo(new { }, new { });
Demo(null, new { });
Demo(new { }, null);
Demo(new { a = 1 }, new { a = 1 });
//new { _1 = HashInt(1), _2 = HashInt(2) }.Dump();
Demo(new { a = 1 }, new { a = 2 });
@cameronism
cameronism / .luacheckrc
Created August 12, 2017 17:33
pico-8 luacheck configuration file (luacheckrc)
std = {
-- these globals can be set and accessed.
globals = { "_init", "_draw", "_update", "_update60" },
-- these globals can only be accessed.
read_globals = {
--[[
copy(
`-- from ${location.href} ${(new Date()).toISOString()}\n` +
[].slice.call($('#WikiaMainContent').find('ul>li>a,.mw-headline'))
@cameronism
cameronism / jsondiff.cs
Last active March 14, 2018 04:36
JObject based JSON diff
void Main()
{
var pairs = new (object, object)[]
{
(new {}, new {}),
(new { a = 1 }, new { a = "1" }),
(new { a = "1", b = 2 }, new { a = 1 }),
(new { a = "1", c = 2 }, new { a = 1, c = 2 }),
(new { a = "1", c = new {} }, new { a = 1, c = new {} }),
(new { a = new { a = 1 } }, new { a = new {} }),
@cameronism
cameronism / TakeDescending.cs
Created February 27, 2019 01:48
Take top n items from IEnumerable<> efficiently
public static IReadOnlyCollection<T> TakeDescending<T, TKey>(IEnumerable<T> source, Func<T, TKey> keySelector, int count)
where TKey : IComparable<TKey>
{
var index = 0;
var keys = new TKey[count];
var values = new T[count];
TKey min = default;
var minIndex = 0;
foreach (var item in source)
#include <iostream>
#include <Windows.h>
#include <string>
#include <codecvt>
// https://stackoverflow.com/questions/14762456/getclipboarddatacf-text
std::wstring GetClipboardText()
{
// Try opening the clipboard
if (!OpenClipboard(nullptr))