Skip to content

Instantly share code, notes, and snippets.


Colin Bartlett cbartlett

View GitHub Profile
coot / viewport.vim
Last active Nov 20, 2020
View portion of a buffer, mapped through BufWriteCmd file to the original buffer.
View viewport.vim
" Author: Marcin Szamotulski, © 2012-2020
" License: Vim-License, see :help license
fun! ViewPort(cmd, s_line, e_line, ...) " {{{1
if !has("autocmd")
echohl WarningMsg
echom "[ViewPort]: requires +autocmd feature"
echohl Normal
mlent / social-sharing-buttons.html
Last active Aug 21, 2022
Social sharing buttons
View social-sharing-buttons.html
<a href=" OF YOUR POST via @YOUR_USERNAME&url=HTTPS://YOUR_WEBSITE.COM" onclick=", 'twitter-share', 'width=550,height=235'); return false;">
Share on Twitter
<a href=" CONTENT" onclick=", 'hn-share', 'width=550,height=350'); return false;">
Share on Hacker News
egmontkob /
Last active Nov 30, 2022
Hyperlinks in Terminal Emulators
yehgdotnet / gist:6353e367cb1178017980d2437417d6a5
Created Nov 24, 2016
.htaccess (allow only cloudflare IP range) Raw
View gist:6353e367cb1178017980d2437417d6a5
<Files 403.shtml>
order allow,deny
allow from all
deny from all
allow from
mlynch / info.plist
Last active Oct 13, 2022
Disable App Transport Security in iOS 9
View info.plist
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
And add this XML right before the end of the file inside of the last </dict> entry:
case "$(sw_vers -productVersion)" in
alias flush_dns="sudo dscacheutil -flushcache"
alias flush_dns="sudo killall -HUP mDNSResponder"
alias flush_dns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
pixeltrix /
Last active Nov 21, 2022
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
biomancer / dep_detect.rb
Last active Mar 20, 2017
Dirty simple order dependencies detector
View dep_detect.rb
## This script can be used to detect simple order dependencies if one of tests is failing when some other test(or tests, independently) is being run before it.
## Script will not give reliable results if the dependency is complex - e.g. two specific tests must be run before for affected one to fail.
## Script will refine results with each rspec run: more runs will result smaller UNSAFE lists. Files from previous script runs are used too
## Ensure that you have config.order = 'random' in RSpec.configure block .
## Running rspec with different seeds to collect data
RSPEC_RUN_COUNT = 5 #set to 0 to analyze already existing rspec_*.txt files
View Create iOS Icons.jsx
// Photoshop Script to Create iPhone Icons from iTunesArtwork
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: