Skip to content

Instantly share code, notes, and snippets.

View yourivdlans's full-sized avatar

Youri van der Lans yourivdlans

View GitHub Profile
@yourivdlans
yourivdlans / Gemfile.lock
Created February 4, 2021 15:30
Shopify test app gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.4)
actionpack (= 6.0.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
@yourivdlans
yourivdlans / dokku.sh
Created January 20, 2021 11:58
Dokku add ssh key from Github key
curl https://github.com/[username].keys | dokku ssh-keys:add username
# This policy ensures all queries and fields are disallowed by default
# Ensuring a whitelisting strategy
#
# Each Pundit policy should implement a field? method
# Which accepts a field to test if it is allowed to be used
class GraphqlPolicy
FALSE_PROC = ->(_obj, _args, _ctx) { false }
TRUE_PROC = ->(_obj, _args, _ctx) { true }
RULES = {
@yourivdlans
yourivdlans / steps.sh
Last active April 24, 2019 12:06
Rails 6 + Shoulda matchers + minitest-matchers_vaccine
gem install rails -v 6.0.0.beta3
rails _6.0.0.beta3_ new shoulda-matchers_test
bin/rails g scaffold User username:string
rails db:migrate RAILS_ENV=test
# Add the following gems to the test group
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git' # Required for Rails 6 (https://github.com/thoughtbot/shoulda-matchers/pull/1193)
gem 'minitest-matchers_vaccine'
# Add some validation to the user model, see user.rb
@yourivdlans
yourivdlans / shell
Last active March 6, 2019 12:32
Minitest spec rails parallel testing fails
gem install rails -v 6.0.0.beta2
rails _6.0.0.beta2_ new parallel-testing
cd parallel-testing
bin/rails g scaffold User username:string
echo "gem 'minitest-spec-rails'" >> Gemfile
bundle
bin/rails db:migrate
# Replace testcase with the one provided in this gist
bin/rails test
@yourivdlans
yourivdlans / gist:2136c85b4687f0582054c03dcb87a371
Created May 14, 2018 09:07
ruby-packer error when running a compiled rails app
$ ./a.out s
Traceback (most recent call last):
8: from /__enclose_io_memfs__/local/bin/rails:29:in `<main>'
7: from /__enclose_io_memfs__/local/bin/rails:29:in `load'
6: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/exe/rails:10:in `<top (required)>'
5: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/exe/rails:10:in `require'
4: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/cli.rb:7:in `<top (required)>'
3: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/app_loader.rb:48:in `exec_app'
2: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/app_loader.rb:48:in `loop'
1: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/app_loader.rb:53:in `block in exec_app'
@yourivdlans
yourivdlans / form-horizontal.html
Last active April 10, 2017 11:04
Webarch horizontal form
<div class="page-content">
<div class="content">
<div class="page-title">
<h3>Object - <span class="semi-bold">Test</span></h3>
</div>
<div class="row">
<div class="col-md-12">
<div class="grid simple">
<div class="grid-body no-border">
<br>
@yourivdlans
yourivdlans / gist:cf98cf662610c3d92880ec19d68c1e62
Created January 27, 2017 14:14
Mailchimp repeatable section
{
"template":{
"id":248797,
"sections":{
"repeat_1:0:left_column_title":"Product 1",
"repeat_1:0:right_column_title":"Product 2",
"repeat_1:1:left_column_title":"Product 3",
"repeat_1:1:right_column_title":"Product 4)"
}
}
@yourivdlans
yourivdlans / dropbox_video_select.js
Created September 26, 2013 07:53
I wanted to create a share link to some video's in my dropbox folder. But clicking on 70+ video's is very tedious. Run this in the console to select the video's from the month september, first scroll the video's into view so they a lazily loaded. Change / expand the div id to broaden the selection.
jQuery('#p-m_201309 span').each(function(){
span = jQuery(this)
if ( span.find('.video-overlay').length > 0 ) {
span.trigger('click')
}
})
@yourivdlans
yourivdlans / backup_mysql_databases.sh
Last active September 28, 2015 04:37
Shell script to backup all mysql databases to seperate files
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER=""
PASSWORD=""
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR=""