Skip to content

Instantly share code, notes, and snippets.

View karlhorky's full-sized avatar

Karl Horky karlhorky

View GitHub Profile
@karlhorky
karlhorky / signature.scpt
Last active April 28, 2023 17:16
Add HTML Signature to Outlook 2016 on macOS without Attachment Bug
#!/usr/bin/osascript
-- To fix error with Outlook 2016 HTML signature images showing up as attachments
-- Ref: http://mydesignpad.com/how-to-create-an-attractive-html-email-signature-for-microsoft-outlook-2016-for-mac/#comment-36065
-- To use, add your signature name (under `name`) and signature (under `content`) and paste and run this code in Script Editor
tell application id "com.microsoft.Outlook"
make new signature with properties {name:"Google Signature", content:"<table><tr><td><img src='https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png' width='120' height='44'></td></tr></table>"}
end tell
@karlhorky
karlhorky / convert-markdown-references-to-inline.md
Created July 24, 2017 09:41
Regular expression: Change Markdown reference links to inline

This regex will allow search and replace to change Markdown links using references (matching ][...] pattern) to inline links.

It will leave the document otherwise untouched.

Search:

\]\[([^\]]+)\]([\s\S]+\1\]: (http.+))$
@karlhorky
karlhorky / webpack-dev-server-show-all-modules.js
Created April 17, 2017 21:49
Show all hidden modules in webpack-dev-server output
const WebpackDevServer = require('webpack-dev-server');
const webpackOptions = require('../config/webpack/webpack.dev');
const compiler = webpack(webpackOptions);
const devServer = new WebpackDevServer(compiler, {
quiet: false, // Turn on logging (false is the default)
stats: {
maxModules: Infinity, // Does the same thing as --display-modules webpack command line option (shows all hidden modules)
},
{
profile:false,
module:{
loaders:[
{
test:[
Function:shouldBeHandledByLoader
],
loader:'react-hot'
},
@karlhorky
karlhorky / request-local-storage-singleton.js
Created February 16, 2017 10:39
request-local-storage global singleton
// Before
module.exports = {
getNamespace: getNamespace,
getCountNamespaces: getCountNamespaces,
startRequest: startRequest,
bind: bind,
patch: patch
};
// After (singleton in global namespace)
@karlhorky
karlhorky / react-server-route-groups.js
Last active February 13, 2017 16:58
react-server route groups (for translated path fragments)
// Beware! Not tested.
// open source library: `react-server-route-groups`
// - function to generate routes based on array of things (in our case, translations)
export default function ({groups, pages}) {
return groups.reduce((acc, group) => {
return {
// All previous routes
...acc,
@karlhorky
karlhorky / .gitconfig
Last active July 18, 2023 01:28 — forked from gnarf/..git-pr.md
Fetch and delete refs to GitHub pull request branches
[alias]
fetch-pr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; } ; f"
delete-prs = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
@karlhorky
karlhorky / pr.md
Last active January 9, 2025 09:01 — forked from piscisaureus/pr.md
Fetch all GitHub pull requests to local tracking branches

NOTE

You may not need local branches for all pull requests in a repo.

To fetch only the ref of a single pull request that you need, use this:

git fetch origin pull/7324/head:pr-7324
git checkout pr-7324
# ...
@karlhorky
karlhorky / Loop-react-motion.js
Created July 20, 2016 16:20 — forked from bsansouci/Loop-react-motion.js
Example Loop component React-Motion
let Loop = React.createClass({
getInitialState() {
return {
isMovingToEnd: true
};
},
endValue(currVals) {
let {endValueProp, isDone, startValue} = this.props;
let {isMovingToEnd} = this.state;