Skip to content

Instantly share code, notes, and snippets.

@micwehrle
micwehrle / cross-origin-local-storage.js
Created September 2, 2021 05:33 — forked from buren/cross-origin-local-storage.js
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;

Keybase proof

I hereby claim:

  • I am micwehrle on github.
  • I am micwehrle (https://keybase.io/micwehrle) on keybase.
  • I have a public key ASCyXYnY99NfgJ8NBPHm7t87FMxS4p9qJfxrmRTBqseZSQo

To claim this, I am signing this object:

import { ClientConfig } from '../Core/types';
import Http from '../utils/Http';
import Url from '../utils/Url';
import { ResourceResult, AutofiServices } from './types';
import Resource from './AbstractResource';
export interface MetricOpts extends ClientConfig {
autofiService: string;
metadata: any;
processInterval: number;
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Git autocomplete stuff. Nifty.
source ~/.git-completion.bash
# Aliases
alias pull='git fetch -v; git merge origin/`echo $(__git_ps1 "%s")`'
alias push='git push origin HEAD'
alias gits='git status'

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file:

@micwehrle
micwehrle / pre-commit.sh
Created October 24, 2017 03:57 — forked from dahjelle/pre-commit.sh
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done
.wrapper {
height: 100vh;
width: 100vw;
background-color: green;
}
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@micwehrle
micwehrle / remove-container-by-image.sh
Created November 16, 2015 04:08
Remove docker containers based on image name
#!/bin/bash
IMAGE=$1
docker ps -a | awk '{ print $1,$2 }' | grep $IMAGE | awk '{print $1 }' | xargs -I {} docker rm {}
@micwehrle
micwehrle / flashpolicy.xml
Created August 5, 2012 06:05 — forked from mattcg/flashpolicy.xml
A simple Flash socket policy server for NodeJS.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket://socks.example.com -->
<cross-domain-policy>
<!-- This is a master socket policy file -->
<!-- No other socket policies on the host will be permitted -->
<site-control permitted-cross-domain-policies="master-only"/>