Skip to content

Instantly share code, notes, and snippets.

Avatar

Sullivan SENECHAL soullivaneuh

View GitHub Profile
@soullivaneuh
soullivaneuh / index.js
Created September 28, 2018 12:47
Prevent PageUp and PageDown press in textarea moving website out of the window
View index.js
// @see http://www.competa.com/blog/chrome-bug-pageup-pagedown-textarea-moves-website-window/
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=890248
document.querySelector('textarea').addEventListener('keydown', event => {
if (event.key === 'PageUp' || event.key === 'PageDown') {
const cursorPosition = event.key === 'PageUp' ? 0 : event.target.textLength;
event.preventDefault();
event.target.setSelectionRange(cursorPosition, cursorPosition);
}
});
@soullivaneuh
soullivaneuh / setup.sh
Created October 12, 2019 18:35
Gitlab runner deploy auto-setup and register
View setup.sh
#!/usr/bin/env bash
set -e
# Usage: bash setup.sh
# This script is supposed to be ran with root user.
# @see https://dockerswarm.rocks/gitlab-ci/
# GitLab runner setup
register_token=${GITLAB_TOKEN:?}
register_host=${GITLAB_HOST:-https://gitlab.com}
runner_image='gitlab/gitlab-runner:latest'
View keybase.md

Keybase proof

I hereby claim:

  • I am soullivaneuh on github.
  • I am soullivaneuh (https://keybase.io/soullivaneuh) on keybase.
  • I have a public key whose fingerprint is 0446 0CD2 28DF 9E0D 42F0 7643 992E B6FA FD4E 6361

To claim this, I am signing this object:

View Controller.php
/**
* @Route("/for", name="for")
*/
public function forAction(Request $request)
{
return $this->render(
$request->query->has('embed')
? 'default/for_embed.html.twig'
: 'default/for_include.html.twig'
);
View example.html.twig
{% extends 'layout_modal.html.twig' %}
{% trans_default_domain 'front' %}
{% set attr = {
'data-backdrop': 'static',
'data-show': 'true'
} %}
{% block id 'ticket-feedback-modal' %}
@soullivaneuh
soullivaneuh / docker-console
Created September 15, 2016 09:37
Docker console script sample
View docker-console
#!/usr/bin/env bash
if [ "$#" -ge 1 ]; then
docker exec -u $(whoami) -it project_console_1 "$@"
else
docker exec -u $(whoami) -it project_console_1 bash
fi
@soullivaneuh
soullivaneuh / .styleci.yml
Created July 9, 2016 10:20
Fixer with options for StyleCI example
View .styleci.yml
enabled:
function_declaration:
single_line: true
@soullivaneuh
soullivaneuh / gist:79b09f030965b2e41305
Created January 4, 2016 11:02
strace docker-compose gitlab-ci
View gist:79b09f030965b2e41305
$ strace docker-compose up -d
execve("/usr/local/bin/docker-compose", ["docker-compose", "up", "-d"], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
writev(2, [{"strace: exec: No such file or di"..., 39}, {"\n", 1}], 2strace: exec: No such file or directory
) = 40
writev(2, [{"", 0}, {NULL, 0}], 2) = 0
getpid() = 38
exit_group(1) = ?
+++ exited with 1 +++
@soullivaneuh
soullivaneuh / gist:3cee5f17166c856a01fc
Created January 4, 2016 11:00
ldd docker-compose gitlab-ci
View gist:3cee5f17166c856a01fc
$ ldd /usr/local/bin/docker-compose
/lib64/ld-linux-x86-64.so.2 (0x7fcdef76c000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fcdef76c000)
libz.so.1 => /lib/libz.so.1 (0x7fcdef556000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fcdef76c000)
@soullivaneuh
soullivaneuh / GmapAddressType.php
Created September 18, 2012 08:59
Gmap Address Type
View GmapAddressType.php
<?php
namespace Your\UtilsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\Common\Persistence\ObjectManager;
/**