Skip to content

Instantly share code, notes, and snippets.

View aryehof's full-sized avatar

Aryeh Hoffman aryehof

View GitHub Profile
@aryehof
aryehof / puppeteer-dom-screenshot.js
Created August 21, 2017 14:28
Puppeteer example screenshoting the logo on chromestatus.com
// full example of screenshoting a DOM element
// using https://github.com/GoogleChrome/puppeteer
const PADDING = 16; // px
const SELECTOR = 'header aside'; // css selector for the element
// make sure we hit the desktop breakpoint
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 2});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@aryehof
aryehof / puppeteer-singlepage-pdf.js
Created August 21, 2017 14:30
Get a single-page PDF screenshot out of puppeteer
// via https://news.ycombinator.com/item?id=15031256
// using https://github.com/GoogleChrome/puppeteer
const puppeteer = require('puppeteer');
function sleep(ms){
return new Promise(resolve=>{
setTimeout(resolve,ms)
})
}
@aryehof
aryehof / ronj-autohotkey.ahk
Created October 12, 2017 07:39 — forked from ronjouch/ronj-autohotkey.ahk
Collection of AutoHotkey scripts I use
; Variables definition
; -----------------------------------------------------------------------------
EnvGet, userProfile, USERPROFILE
Software := userProfile . "\Dropbox\software\"
; Launch or toggle program, http://lifehacker.com/5468862/create-a-shortcut-key-for-restoring-a-specific-window
; -----------------------------------------------------------------------------
ToggleWinMinimize(WindowTitle)
{
SetTitleMatchMode,2
@aryehof
aryehof / useHexo.md
Created January 28, 2018 12:31 — forked from btfak/useHexo.md
How to use Hexo and deploy to GitHub Pages
@aryehof
aryehof / Stream generator example
Last active February 2, 2020 21:01
stream/generator example
// from https://dart.dev/tutorials/language/streams
@aryehof
aryehof / uao.md
Created December 29, 2023 07:29 — forked from sgyyz/uao.md
uao command - unzip your project and import to intellij automatically
  1. import project into idea command
$ curl -L "https://gist.githubusercontent.com/chrisdarroch/7018927/raw/9a6d663fd7a52aa76a943fe8a9bc6091ad06b18d/idea" -o /usr/local/bin/idea
$ chmod +x /usr/local/bin/idea
  1. unzip and open project command
$ curl -L "https://gist.githubusercontent.com/sgyyz/adfa4f05af3d81cf0e17e19cf7044c85/raw/b6b9e871d5a4f5435a09d00b0a52e3db0b90699a/uao.sh" -o /usr/local/bin/uao.sh
$ chmod +x /usr/local/bin/uao.sh
$ ln -sf /usr/local/bin/uao.sh /usr/local/bin/uao
@aryehof
aryehof / .pryrc
Created April 4, 2024 11:04 — forked from justin808/.pryrc
Updated .pryrc with option to remove pry-byebug
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# # pick either:
# # using byebug, but has issues with Zeitwerk
# gem 'pry-byebug' # Integrates pry with byebug
#
# # using default ruby debuggger
# gem 'pry-stack_explorer'