Skip to content

Instantly share code, notes, and snippets.

View wkrsz's full-sized avatar

Wojtek Kruszewski wkrsz

View GitHub Profile
@wkrsz
wkrsz / APKBUILD
Last active September 27, 2024 11:55
Verification of Ruby optimization flag fix
# Contributor: Carlo Landmeter <[email protected]>
# Contributor: Jakub Jirutka <[email protected]>
# Maintainer: Jakub Jirutka <[email protected]>
pkgname=ruby
# When upgrading, upgrade also each ruby-<name> aport listed in file
# gems/bundled_gems. If some aport is missing or not in the main repo,
# create/move it.
pkgver=3.3.3
_abiver="${pkgver%.*}.0"
pkgrel=2
$ docker build --progress=plain .
#0 building with "desktop-linux" instance using docker driver
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.18kB done
#2 DONE 0.0s

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@wkrsz
wkrsz / application.rb
Created April 14, 2016 07:08
Log request details at Rack level
config.middleware.use "Loggo"
@wkrsz
wkrsz / bootstrap-reload-remote.js
Last active May 3, 2018 08:33
Reload remote bootstrap modal each time it is opened
// http://stackoverflow.com/questions/12286332/twitter-bootstrap-remote-modal-shows-same-content-everytime
$(document).on('hidden.bs.modal', '.modal', function () {
var modalData = $(this).data('bs.modal');
// Destroy modal if has remote source – don't want to destroy modals with static content.
if (modalData && modalData.options.remote) {
// Destroy component. Next time new component is created and loads fresh content
$(this).removeData('bs.modal');
// Also clear loaded content, otherwise it would flash before new one is loaded.
@wkrsz
wkrsz / gist:3d5ff7f908a180b87498
Last active December 11, 2018 07:03
Stop Safari hanging when selecting the address bar or opening a new tab
This shit has been bugging me for too long, so I went on a hunt and found a workaround.
The Symptoms are as follows:
* Clicking the address bar results in a 1-4 second delay
* Opening links in new tabs results in a 1-4 second delay
* +T results in a 1-4 second delay
* `PressAndHold[<pid>]: IMKServer Stall detected` is present in `/var/log/system.log` at the time of the hang.
It appears to be to do with the PressAndHold helper - the thing that shows an IOS style selection of accents when you hold a key down.
The fix may have some unwanted effects, I haven't really noticed any.
@wkrsz
wkrsz / README
Last active March 6, 2018 03:12
Git pre-push hook that shows changes and ask for confirmation when pushing to production repo.
Whenever you push to remote that has "production" in its name,
this hook will show commits and changes and then ask for confirmation.
Copy or symlink to .git/hooks/pre-push.
Deployment by pushing code to remote github repo are very convenient
but prone to accidents. I wanted something that would force me to
review what's being pushed.
My Bash-foo is very limited to suggestions for improvements are very welcome.
@wkrsz
wkrsz / gist:ed2407a0c131e094a333
Created August 22, 2014 12:55
assert_select to test helper output
class ExampleTest < ActionView::TestCase
test "example" do
helper_output = "<p class='error'>Yo!</p>"
parsed = HTML::Document.new(helper_output).root
assert_select parsed, "p.error"
end
end
@wkrsz
wkrsz / simple_form.rb
Created September 15, 2013 12:01
I'm using SimpleForm and I wanted to display validation errors as label tags, which has (arguably) accessibility benefits. Here's how to add a custom error_label component that adds correct "for" attribute.
module SimpleForm
module Components
module ErrorLabel
def error_label
if has_errors?
@builder.label(label_target, error_text, label_html_options)
end
end
end
end