Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
@guyhughes
guyhughes / BoldKeywords.vba
Last active August 29, 2015 14:09
Quick VBA macro to bold keywords.
Sub BoldKeywords()
Dim triggers As Variant
' ------------------------------------------
' BEGIN EDIT-ME PART
' Help for non-geeks: each item is delimited by a comma, even at the end of a line
' each line break inside the array declaration needs an underscore at the end
' If you use apostrophes, they must be escaped, e.g. "Canada\'s"
' ------------------------------------------
'
' Formats tweet from clipboard and inserts it
' Assumptions:
' - Tweet text in clipboard, with user & tweet separated by a line break.
' - No trailing spaces; uses Trim().
'
@guyhughes
guyhughes / keybase.md
Created May 12, 2015 02:54
Keybase proof

Keybase proof

I hereby claim:

  • I am guyhughes on github.
  • I am guyhughes (https://keybase.io/guyhughes) on keybase.
  • I have a public key whose fingerprint is 0EC3 C170 5835 30B0 1E20 9320 3630 26BB DB4B 35B7

To claim this, I am signing this object:

@guyhughes
guyhughes / install-weechat.sh
Last active August 29, 2015 14:21
homebrew weechat
# install all the extensions, ftw
# thanks to http://aaronfranks.com/posts/weechat-on-osx/
# hey future self, if you don't do this, then you don't get to use weechat /scripts
# ... or complain about them not working
sudo brew install weechat --with-perl --with-python --with-lua --with-ruby
aptitude versions '~i' | grep -B1 -P '\W(?!(stable|testing))\Wunstable' | awk '{print $2}' | grep -E ':$' | sed 's/://'
@guyhughes
guyhughes / bol-fdm-vimscript.vim
Last active August 29, 2015 14:23
Vim move foldmarkers to BOL
%s:^"\s*\(.\{-1,}\)\("\=\)\({{{[1-4]\=\)$:"\3 \1:
@guyhughes
guyhughes / lazy-moment.js
Created August 17, 2015 18:03
momentjs humanized durations
// Uses moment js to parse human durations
// Author: Guy Hughes
// Date: 2015-08-17
function getPeriod(input) {
// returns an object {start: xxxx, end: xxxx}
// WARN: moment() methods modify object by reference
var start, end;
switch (input) {
case "Tomorrow":
start = moment().add(1,'day');
@guyhughes
guyhughes / bootstrap-datetimepickers-pairs.js
Created August 17, 2015 18:10
Bootstrap DateTimePicker pairs for duration
// http://eonasdan.github.io/bootstrap-datetimepicker
// setup a pair of datepickers
// Author: Guy Hughes
// Date: 2015-07-11
function addDatePickerPair(dpStart,dpEnd) {
// dpStart, dpEnd = /\#[A-z0-9]+/
// parameters are an ID for a single element
$(dpStart).on("dp.change", function (e) {
$(dpEnd).data("DateTimePicker").minDate(e.date);
@guyhughes
guyhughes / monday-starts-the-week-moment.js
Created August 17, 2015 18:10
Make monday the beginning of the week in moment.js persistently
// set Monday to beginning of week
moment.locale('en', {week: {dow:1}});
@guyhughes
guyhughes / bootstrap-3-tooltip-title-override.js
Created August 18, 2015 17:43
Bootstrap 3 Tooltip Title Override - Don't use "title" attribute - Works with Bootstrap-Select
// Bootstrap 3 Tooltip Title Override
// Author: Guy Hughes
// Date: 2015-08-15
// Licence: GNU GPL v3.0 http://www.gnu.org/licenses/gpl-3.0.txt
$.fn.tooltip.Constructor.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
//title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)