Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am yannickoo on github.
  • I am yannickoo (https://keybase.io/yannickoo) on keybase.
  • I have a public key ASBaUEzoKVriBw7juG_suEiBJaxjdv5OAvpezgg-z8zHdAo

To claim this, I am signing this object:

Z:\Users\xxx\Music\Collection\$validate($if2(%albumartist%,%artist%),)\%title%
@yannickoo
yannickoo / code.js
Created October 23, 2014 14:08
Display ticket IDs in Jira's subtask table
(function($){
$('head').append('<style>.bookmarklet-issue-id {color: #fff; background: #3b73af; padding: 1px 2px; border-radius: 5px;}</style>');
$('.subtask-table-container tbody > tr.issuerow').each(function() {
var $this = $(this);
var $id = $this.data('issuekey');
var $firstRow = $this.children('td:first');
$firstRow.after('<td><pre class="bookmarklet-issue-id">' + $id + '</pre></td>');
});
}(jQuery));
@yannickoo
yannickoo / script.js
Created September 13, 2014 19:58
Putting a Drupal website into maintenance mode via JS
jQuery.get(Drupal.settings.basePath + 'admin/config/development/maintenance', function (data, status) {
if (status == 'success') {
var token = jQuery(data).find('[name="form_token"]').val();
var build = jQuery(data).find('[name="form_build_id"]').val();
var payload = {
'form_id': 'system_site_maintenance_mode',
'form_token': token,
'form_build_id': build,
'maintenance_mode': 0
};
@yannickoo
yannickoo / mymodule.module
Created July 17, 2014 16:20
Extends Drupal's field cardinality select list 20 values.
<?php
/**
* Implements hook_form_alter().
*/
function mymmodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'field_ui_field_edit_form') {
$form['field']['cardinality']['#options'] = array('-1' => t('Unlimited')) + drupal_map_assoc(range(1, 20));
}
}
@yannickoo
yannickoo / script.js
Last active August 29, 2015 14:03
Scale videos so that they are fit into a container
$('video.fit').each(function() {
var $this = $(this);
var $container = $this.parent();
var containerWidth = $container.width();
var containerHeight = $container.height();
$this[0].addEventListener('loadedmetadata', function() {
var videoWidth = $this[0].videoWidth;
var videoHeight = $this[0].videoHeight;
@yannickoo
yannickoo / script.js
Last active August 29, 2015 14:03
Open all links in new tab
$('a').on('click', function () {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href)) {
$(this).click(function (e) {
e.preventDefault();
e.stopPropagation();
window.open(this.href, '_blank');
});
}
});
@yannickoo
yannickoo / mymodule.admin.inc
Last active August 29, 2015 14:03
Drupal batch example
<?php
/**
* @file
* Administrative tasks for My module.
*/
/**
* Page callback for Batch example form.
*/
@yannickoo
yannickoo / mymodule.module
Created July 12, 2014 11:12
Allows switching theme via $_GET parameter.
<?php
/**
* Implements hook_custom_theme().
*/
function mymodule_products_custom_theme() {
$themes = list_themes();
if (isset($_GET['theme']) && $_GET['theme'] && isset($themes[$_GET['theme']]) && $themes[$_GET['theme']]->status) {
return $_GET['theme'];
{
"color_scheme": "Packages/Theme - Soda/Soda Dark/Widget - Soda Dark.stTheme",
"detect_slow_plugins": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 15.0,
"ignored_packages":
[
"LaTeX",
"Git",