Skip to content

Instantly share code, notes, and snippets.

View make-delete-ancient-branches.sh
#!/bin/bash
#
# generates a script that will delete merged branches
# that were last updated prior to 2016-10-01
#
function list_ancient_branches() {
git branch -r --merged | \
grep -v HEAD | \
View adobe-muse-example.html
<div id="hightower-availability">
</div>
<script type="text/javascript">
(function(h,t,w,r){if(h[r]){return}var z={};z.q=[];var m="renderWidget".split(",");
var f=function(a){return function(){z.q.push([a,arguments]);}};
for(var i=0;i<m.length;i++){z[m[i]]=f(m[i])}h[r]=z;
var s=t.createElement("script"),x=t.getElementsByTagName("script")[0];s.async=1;
s.src=w;x.parentNode.insertBefore(s,x);})
(window,document,"https://app.gethightower.com/assets/embed/v1/availability.js","Hightower")
@niallsmart
niallsmart / ie-display-json.reg
Created Mar 4, 2015
Get Internet Explorer to display JSON inline (via http://stackoverflow.com/questions/2483771)
View ie-display-json.reg
Windows Registry Editor Version 5.00
;
; Tell IE to open JSON documents in the browser.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
@niallsmart
niallsmart / copy-checklist.js
Last active Jan 13, 2022
Copy Trello checklist to clipboard
View copy-checklist.js
copy($(".checklist-item:not(.checklist-item-checked)").map(function() {
var e = $(this),
item = e.find(".checklist-item-details-text").text()
if (e.hasClass("checklist-item-state-complete")) {
item = item + " (DONE)"
}
return item
}).get().join("\n"))
@niallsmart
niallsmart / totp.rb
Last active Aug 29, 2015
TOTP tester using rotp gem
View totp.rb
require 'rotp'
require 'qrencoder'
random = "m5qckrq57y2s6232"
totp = ROTP::TOTP.new(random)
qr_string = totp.provisioning_uri("niall.smart@gethightower.com")
qr_code = QREncoder.encode(qr_string)
qr_code.png(pixels_per_module: 4, margin: 1).save("qr_code.png")
@niallsmart
niallsmart / alfred_search_gmail.scpt
Last active Aug 29, 2015
Alfred workflow to search Gmail
View alfred_search_gmail.scpt
alfred_script("foo")
on alfred_script(q)
search_gmail("niall.smart@gmail.com", q)
end alfred_script
on search_gmail(account, searchString)
View check-url-status.sh
#!/bin/bash
while read url; do
output=`curl -sI "$url" 2>&1 | head -1`
if ! echo $output | grep '200 OK' >/dev/null; then
echo $url
echo $output
fi
done
@niallsmart
niallsmart / restore_deal_comments_proposals
Last active Aug 29, 2015
Set last comment/last proposal on restored deals
View restore_deal_comments_proposals
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.logger.level = Logger::DEBUG
deal_ids = [11929, 11930, 11928, 11927, 12166, 11933, 11934, 12369, 11984, 11931, 11924, 11922, 11921, 11920, 11919, 11926, 11923];
Deal.where(id: deal_ids).find_each do |deal|
deal.update_column :last_comment_id, deal.comments.last.try(:id)
deal.update_column :last_proposal_id, deal.proposals.last.try(:id)
deal.update_column :last_dying_update_id, deal.updates.where(type: 'DealDyingUpdate').last.try(:id)
deal.update_column :last_executed_update_id, deal.updates.where(type: 'DealExecutedUpdate').last.try(:id)
@niallsmart
niallsmart / twc-traceroute
Last active Aug 29, 2015
TWC Traceroute (columbia.edu)
View twc-traceroute
# columbia.edu
Tracing route to [128.59.105.24]
over a maximum of 30 hops:
1 440ms 370ms 430ms 68.173.144.1
2 440ms 510ms 590ms 68.173.214.57
3 920ms 310ms 270ms 184.152.112.91
4 470ms 300ms 330ms 107.14.19.22
5 510ms 360ms 340ms 66.109.6.163
6 360ms 320ms 430ms 154.54.13.81
@niallsmart
niallsmart / circleci-fix-5866
Last active Aug 29, 2015
Fix for CircleCI build failure 5866
View circleci-fix-5866
commit d83cdc36a40fc090c02bc0e1df1eaf8687bd3ea4
Author: Brent Wheeldon <brent.wheeldon@gmail.com>
Date: Fri Jul 18 09:33:57 2014 -0400
Don’t hide popovers in feature tests, this makes them really flaky.
diff --git a/app/assets/javascripts/common/directives/ht_deal_changed_popover_factory.coffee b/app/assets/javascripts/common/directives/ht_deal_changed_popover_factory.coffee
index a324389..19b88eb 100644
--- a/app/assets/javascripts/common/directives/ht_deal_changed_popover_factory.coffee
+++ b/app/assets/javascripts/common/directives/ht_deal_changed_popover_factory.coffee