Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
<analyses>
<analysis>
<test>
<testCode>A</testCode>
</test>
<package>
<packageCode>C</packageCode>
</package>
<package>
<packageCode>D</packageCode>
var http = require('http');
var https = require('https');
var websocket = require('websocket');
var util = require('util');
function _log(msg) {
console.log.apply(console, arguments);
console.log('');
}
var PACKAGE = 'rdx/db';
ghGrapQL(`query { viewer { login, repositories(first: 100, privacy: PUBLIC, orderBy: {direction: DESC, field: PUSHED_AT}) { nodes { name } } } }`).then(rsp => {
return rsp.data.viewer.repositories.nodes.map(repo => `${rsp.data.viewer.login}/${repo.name}`)
}).then(repos => {
return repos.map(repo => {
return (rsps) => {
console.log(repo);
return fetch(`https://rawgit.com/${repo}/master/composer.json`).then(rsp => rsp.ok ? rsp.json() : null).then(rsp => rsps.concat([[repo, rsp]]));
}
});
const queue = [];
chrome.browserAction.onClicked.addListener(function(tab) {
var url = 'http://www.example.com/?x=' + String(Math.random()).substr(2);
queue.push(url);
console.log('queue', queue);
chrome.tabs.update({url});
});
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
javascript:
document.addEventListener('mousedown', e => {
if (e.button == 2 && e.target.nodeName == 'SELECT') {
window.sst = setTimeout(function() {
var q = prompt('Search what?', '');
if (q === '') {
[].forEach.call(e.target.options, o => o.style.display = '');
}
else if (q != null) {
[].forEach.call(e.target.options, o => o.style.display = o.textContent.toLowerCase().indexOf(q) >= 0 ? '' : 'none');
<?php
/**
* Converts UTF-8 to XML-safe HTML entities: Изложение => &#1048;&#1079;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1077;
*/
function xmlencode($string) {
$string = (string) $string;
// Replace < and ' and & etc.
$string = htmlspecialchars($string, ENT_XML1 | ENT_QUOTES);
javascript: (function(f, a) {
f = new Blob(['"Date","Description","Amount"\n', [].map.call(queryAllShadow('[data-tag-name="ing-ow-expandable-item"]', queryAllShadow('[data-tag-name="ing-feat-transaction-period"]').reverse()[0]), row => ([
row.closest('.date-item').querySelector('time').getAttribute('datetime'),
row.querySelector('h5').textContent.trim(),
row.querySelector('h5 + strong').textContent.trim().replace(',', '.').replace('−', '-'),
]).map(col => '"' + col.replace(/"/g, '""') + '"').join(',')).join('\n')], {type: 'text/plain'});
a = document.createElement('a');
a.download = 'trans.csv';
a.href = URL.createObjectURL(f);
a.click();
<?php
$utcStart = microtime(true);
// Last modified timestamp
defined('TIMESTAMP') or define('TIMESTAMP', 'D d-M-Y H:i');
// Permissions
defined('ENABLE_DOWNLOAD') or define('ENABLE_DOWNLOAD', false);
defined('ENABLE_SOURCE') or define('ENABLE_SOURCE', false);
@rudiedirkx
rudiedirkx / SendUserInvitationJob.php
Created August 31, 2016 17:50
User invitation jobs
<?php
class SendUserInvitationJob {
protected $user;
protected $tests;
function __construct(User $user, array $tests) {
$this->user = $user;
$this->tests = $tests;
}
# all at once:
vendor/bin/behat
# per feature:
find features/ -type f -name *.feature | xargs -n 1 vendor/bin/behat