Skip to content

Instantly share code, notes, and snippets.

jlgrall

Block or report user

Report or block jlgrall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View domvm-mobx-demo.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>domvm-MobX Demo</title>
<style>
.section { margin-left: 1em; }
input[type=text] { width: 10em; }
#limit { width: 3em; }
@jlgrall
jlgrall / test.js
Last active Dec 12, 2018
domvm test case: unnecessarily redrawing child vm when parent vm is also redrawing
View test.js
var el = domvm.defineElement,
vw = domvm.defineView;
// State:
var color = "purple",
numbers = [{nb: 0}, {nb: 1}, {nb: 2}, {nb: 3}, {nb: 4}, {nb: 5}];
// Views:
function ListView() {
return function(vm) {
@jlgrall
jlgrall / test_PHPZipMerge_INCONS.php
Created Jul 20, 2016
Test case for inconsistent PHPZipMerge merged zip
View test_PHPZipMerge_INCONS.php
<?php
// Put this file in a subdirectory inside the PHPZipMerge repository, then execute it.
error_reporting(E_ALL);
ini_set('open_basedir', dirname(__DIR__)); // Security: restrict file access to parent directory.
require __DIR__.'/../vendor/autoload.php';
$srcName = 'src.zip';
$src = __DIR__.'/'.$srcName;
if(file_exists($src)) unlink($src);
@jlgrall
jlgrall / i18n-jqueryui-dialogtitle.js
Last active Jan 28, 2016
i18next: Adds support for data-i18n and data-i18n-options to jQuery UI Dialog's title
View i18n-jqueryui-dialogtitle.js
// Adds support for data-i18n and data-i18n-options to jQuery UI Dialog's title:
if( $.fn.dialog ) { // Checks the presence of the dialog component of jQuery UI
var rTitleKey = /\[title\]([^;]*);?/,
// Keep a reference to the original _create function:
dialog_create_orig = $.ui.dialog.prototype._create;
$.ui.dialog.prototype._create = function( ) {
var data_i18n,
i18n_options;
if( !this.options.title ) { // Because as defined in Dialog, the options.title should override the title attribute
var old_data_i18n = this.element.attr( "data-i18n" );
@jlgrall
jlgrall / action.php
Last active Jan 4, 2016
Add basic Meltdown support
View action.php
<?php
/**
* DokuWiki Plugin markdownextra (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
@jlgrall
jlgrall / i18n-jqueryui-button.js
Created Aug 14, 2012
i18next: Adds support for data-i18n and data-i18n-options to jQuery UI Buttons
View i18n-jqueryui-button.js
// Adds support for data-i18n and data-i18n-options to jQuery UI Buttons:
if( $.fn.button ) { // Checks the presence of the button component of jQuery UI
// Keep a reference to the original _create function:
var button_create_orig = $.ui.button.prototype._create;
$.ui.button.prototype._create = function( ) {
button_create_orig.apply( this, arguments );
if( this.type === "button" ) { // Not needed for input, radio or checkbox
var data_i18n = this.buttonElement.attr( "data-i18n" ),
i18n_options = this.buttonElement.data( "i18n-options" );
// If found, apply the attribute and datas to the button label:
@jlgrall
jlgrall / findval.js
Last active Aug 29, 2015
Find an object or a value recursively in a webpage
View findval.js
// https://gist.github.com/jlgrall/0b8871bb0d84dc119630
function findVal(base, matcher, skip, filter, debug) {
"use strict";
// Check the arguments:
var i = 2,
args = arguments;
skip = Array.isArray(args[i]) ? args[i++] : [];
filter = typeof args[i] === "function" ? args[i++] : function() { return true; };
debug = args[i] === true;
You can’t perform that action at this time.