Skip to content

Instantly share code, notes, and snippets.

View ruinunes's full-sized avatar
🎯
Focusing

Rui Nunes ruinunes

🎯
Focusing
View GitHub Profile
@ruinunes
ruinunes / gist:59f351ebcf2ab0e33bdb3cbd048ae1ca
Created January 30, 2019 23:54
Crop an image in PrawnPdf
bounding_box([bounds.width * 0.5, cursor], width: 200, height: 113) do
image_width = 200
image_height = 113
crop_size = 20
save_graphics_state do
soft_mask do
fill_color 0, 0, 0, 0
fill_rectangle [crop_size, image_height - crop_size], image_width - crop_size * 2, image_height - crop_size * 2
end
image "#{IMAGES_PATH}/cat.jpg", at: [bounds.left, bounds.top], width: image_width, height: image_height
@ruinunes
ruinunes / settings.json
Created September 27, 2019 10:13
vscode settings
{
"editor.codeLens": false,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"window.zoomLevel": 0,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"workbench.startupEditor": "newUntitledFile",
"typescript.check.npmIsInstalled": false,
@ruinunes
ruinunes / array_sequential_numbers.js
Last active February 19, 2020 10:14
Prefill an array with sequential numbers
Array(8).fill().map((_, b) => ({ value: ++b, label: String(b) }))
@ruinunes
ruinunes / prevent-submit.coffee
Created February 19, 2020 10:20
Prevent submit coffescript behaviour
$(document).on 'keypress', '[data-behaviour="prevent-submit"]', (ev) ->
ev.preventDefault() if ev.keyCode == 13 && ev.target.tagName != 'TEXTAREA'
@ruinunes
ruinunes / gist:9aae71a7fb71477afe40a89c683a8453
Created February 19, 2020 10:24
Convert .mov to .gif with ffmpeg and gifsicle
ffmpeg -i some_movie.mov -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > some_movie.gif