Skip to content

Instantly share code, notes, and snippets.

View diegommarino's full-sized avatar

Diego Marino diegommarino

  • Dublin, Ireland
View GitHub Profile
@lrdiv
lrdiv / nextlot.scpt
Created December 6, 2015 07:19
Scripting iTerm 2
(* Note: `cdnr` and `cdnem` are custom aliases for this project *)
tell application "iTerm"
(* Creates a new window for our project *)
set newWindow to (create window with default profile)
select first window
tell the current window
(* cd to rails directory and start server *)
activate current session
@rrgayhart
rrgayhart / stubbing.md
Last active July 26, 2024 14:01
Webmock vs VCR for Testing External Calls

This is an excellent post that explains a little bit behind the difficulty in testing external services https://robots.thoughtbot.com/how-to-stub-external-services-in-tests How to Stub External Services in Tests

One simple option is to use Webmock

Here is an example of using Webmock in a similar way to what VCR does - which is recording and reading from a file

stub_request(:any, "www.example.com").
@obfusk
obfusk / break.py
Last active December 7, 2024 13:12
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@actionshrimp
actionshrimp / ToggleGStatus
Created September 9, 2013 09:49
A vim-fugitive status window toggle (mapped to F3). Seems to work nicely
function! ToggleGStatus()
if buflisted(bufname('.git/index'))
bd .git/index
else
Gstatus
endif
endfunction
command ToggleGStatus :call ToggleGStatus()
nmap <F3> :ToggleGStatus<CR>
@danlucraft
danlucraft / extract.rb
Last active March 26, 2025 09:22
Extract annotations from PDFs with pdf-reader gem
require 'pdf-reader'
require './markup_receiver'
doc = PDF::Reader.new(ARGV[0])
$objects = doc.objects
def is_note?(object)
object[:Type] == :Annot && [:Text, :FreeText].include?(object[:Subtype])
end