Skip to content

Instantly share code, notes, and snippets.

View nilshartmann's full-sized avatar
🐿️
https://graphql.schule

Nils Hartmann nilshartmann

🐿️
https://graphql.schule
View GitHub Profile
@nilshartmann
nilshartmann / getEventTarget.js
Last active December 31, 2022 16:56
React and Web Component ()
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// If encapsulated in a Web Component
// use the Event path
if(nativeEvent.path && nativeEvent.path[0]) {
return nativeEvent.path[0];
}
// Normalize SVG <use> element events #4963
@nilshartmann
nilshartmann / main.jsx
Created February 28, 2017 10:52
Access React Component using 'ref'
import React from 'react';
import ReactDOM from 'react-dom';
class Input extends React.Component {
constructor() {
super();
this.state = {
greeting: ''
}
}
@nilshartmann
nilshartmann / add_bb.sh
Last active August 29, 2015 14:26
Bash function that creates a private BitBucket Repository for your current local Git repository
# Creates a private BitBucket repository with one call from bash
# --------------------------------------------------------------------------------
#
# Uses the BitBucket REST API to create a new private, non-forkable repository
# for the local Git repository your currently staying in.
# The content of your local repository gets pushed after the repository is created.
#
# Prequisites:
# - you must have curl installed
# - your local repo must not have a remote already connect to a bitbucket repo
@nilshartmann
nilshartmann / gist:fb68c34a461d922cd86c
Created July 1, 2015 08:37
Using babel browser.js to compile ES6 and JSX code
<!DOCTYPE html>
<html>
<head>
<script src="./react-0.13.3.min.js"></script>
<script src="./browser.min.js"></script>
</head>
<body>
<div id="mount"></div>
</body>