Skip to content

Instantly share code, notes, and snippets.

@borekb
borekb / simple-di.php
Created March 13, 2012 00:02
Simplest
<?php
// třída, funkce, proměnná, prostě cokoliv, co poskytuje něco,
// co chce někdo jiný konzumovat
class Something {
function doWork() {
echo "some work...";
}
}
(function() {
var MyClass;
MyClass = (function() {
})();
}).call(this);
@borekb
borekb / web.xml
Last active December 21, 2015 14:59
Přidání servletu do ukázkové aplikace BlazeDS, aby Flash Builder dokázal načíst podporované služby a metody. Upravit soubor <blazeds>\tomcat\webapps\samples\WEB-INF\web.xml (předpokládá BlazeDS Turnkey edici, ne čistý BlazeDS).
<!-- přidat do elementu web-app, např. za MessageBrokerServlet -->
<servlet>
<servlet-name>RDSDispatchServlet</servlet-name>
<display-name>RDSDispatchServlet</display-name>
<servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
<init-param>
<param-name>useAppserverSecurity</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
@borekb
borekb / README.md
Last active January 19, 2024 14:59
GitHub-style preview for stackedit.io

GitHub-style preview stylesheet for StackEdit.

The stylesheet is based on https://github.com/sindresorhus/github-markdown-css, see comments in github.css to learn what was updated.

How to use:

  1. Click "Raw" for the github.css file below
  2. Copy the URL
  3. Paste it into RawGit
  4. Copy the RawGit URL and add it in StackEdit > Settings > Extensions > UserCustom extension like this:
@borekb
borekb / README.md
Last active August 29, 2016 13:09
GitHub-style preview for Markdown Edit
@borekb
borekb / .editorconfig
Created November 18, 2015 23:57
Default .editorconfig
root = true
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4
[*.{js,json}]
@borekb
borekb / versionpress.php
Created January 15, 2016 14:52
wpdb proxy using ProxyManager
<?php
global $wpdb;
$factory = new \ProxyManager\Factory\AccessInterceptorValueHolderFactory();
$backupFields = array();
$prefixInterceptor = function ($proxy, wpdb $instance, $method, $params) use (&$backupFields) {
$backupFields["last_error"] = $instance->last_error;
$backupFields["last_query"] = $instance->last_query;
@borekb
borekb / clink.lua
Last active April 26, 2020 20:07
cmder `clink.lua` to show number of commits to push. See comment below for description.
@borekb
borekb / README.md
Last active November 28, 2016 22:44
Chrome MRU tabs extension

This has been sent to several freelancers on Fiverr.

I'm looking for an extension that provides MRU (most-recently-used) tab behavior in Chrome on Windows. This is generally hard to achieve as it's not supported natively but I think there's a trick: there's a CLUT extension that implements the MRU behavior (https://chrome.google.com/webstore/detail/clut-cycle-last-used-tabs/cobieddmkhhnbeldhncnfcgcaccmehgn) and I can manually update the Preferences file to change the CLUT's default Alt+S shortcut to Ctrl+Tab. Then it works for a single session. The problem is that after I restart Chrome, the shortcut is back to Alt+S.

So the gig would be about creating an extension (or an extension plus a small Chrome app) that:

  • Expects CLUT to be installed
  • On every Chrome start, or shortly after that, searches the Preferences file for Alt+S and replaces it with Ctrl+Tab.

That's it. If I understand the security constraints correctly, this would need to be a pair of Chrome app that has the filesystem

@borekb
borekb / merge-repos.sh
Last active February 12, 2018 09:14
A script to merge repositories. Used in blog post (CZ) https://borekb.cz/2017/01/monorepo/. Updated version: https://gist.github.com/borekb/b4aa4f97ccd826dce1d4793a0d54fd26
#!/bin/bash
# Merges child repo into target repo. Maintains branches and tags, filters history.
#
# Based on this amazing article: https://gofore.com/merge-multiple-git-repositories-one-retaining-history/
#---------------------------------
# Variables
#---------------------------------