Skip to content

Instantly share code, notes, and snippets.

💫
creating

Hannes Diercks Xiphe

💫
creating
Block or report user

Report or block Xiphe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Xiphe
Xiphe / wtf.md
Last active Mar 26, 2019
WTF moments when introducing someone to JS
View wtf.md
  1. (about babel/typescript) so you compile JavaScript to other JavaScript so that can be sent to the browser which compiles it again to machine code?
  2. you can export default function foo() {} in foo.js and then import bar from './foo.js'
@Xiphe
Xiphe / bookmarklet-remove-unreachable-refs.js
Last active May 23, 2017
simple script that gets rid of unreachable references in issues and pull requests
View bookmarklet-remove-unreachable-refs.js
javascript: (function(){var a=null;document.querySelectorAll('a.js-selected-navigation-item').forEach(function(b){'Code'===b.innerText.trim()&&(a=b.href)}),document.querySelectorAll('.discussion-item-ref').forEach(function(b){var c=b.querySelector('.commit-meta a');c&&window.fetch(a+'/branch_commits/'+c.innerText).then(function(d){return d.text()}).then(function(d){d.trim().length||b.remove()})})})();
@Xiphe
Xiphe / jsx-it-markdown+react-jsx.js
Created Jan 16, 2017
seamlessly embedded JSX in markdown files on the fly #hipsterstuff
View jsx-it-markdown+react-jsx.js
'use strict';
const md = require('markdown-it')();
const mdJsxPlugin = require('markdown-it-jsx');
const reactJsx = require('react-jsx');
const React = require('react');
const reactDom = require('react-dom/server');
const originalCreateElement = React.createElement;
@Xiphe
Xiphe / v1.0-karma1.md
Last active Mar 8, 2016
Love and Peace Clause
View v1.0-karma1.md

love and peace

[![love and peace](https://img.shields.io/badge/%F0%9F%92%9B%E2%9C%8C%EF%B8%8F-v1.0--karma1-c28fcc.svg)](https://gist.github.com/Xiphe/aa89d804f8137c963d27)

LOVE AND PEACE

Dieses Produkt wurde in der Überzeugung geschrieben, gestaltet oder anderweitig hergestellt, dass wir die Welt durch Liebe und Frieden zu einem besserem Ort machen können.

@Xiphe
Xiphe / jquery.bridge.js
Created Jul 28, 2015
jquery-ui-like bridge for jquery plugins
View jquery.bridge.js
/** @const */
var PLUGIN_NAME = 'myPlugin';
$.fn[PLUGIN_NAME] = function(options) {
var $els = this;
/* Method call: */
if (typeof options === 'string') {
var methodName = options;
var args = Array.prototype.slice.call(arguments, 1);
View angular-module.md

How to use require in angular 1.x modules

  • embrace module structure (1x require = module is available)
// my/app.js
require('../dep/app');
angular.module('myApp', ['dep']);
require('./value');
View remove_bower.md

Remove /bower_components/ from github diff

Array.prototype.forEach.call(document.querySelectorAll('[title*="/bower_components/"]'), function(node){
  node.parentNode.parentNode.parentNode.remove();
});

Bookmarklet can be found after this link: http://xiphe.net/remove_bower_components_bookmarklet.html

@Xiphe
Xiphe / script.js
Created Apr 3, 2015
Elevator Saga
View script.js
{
init: function(elevators, floors) {
function unique(arr) {
var a = arr.concat();
for(var i=0; i<a.length; ++i) {
for(var j=i+1; j<a.length; ++j) {
if(a[i] === a[j])
a.splice(j--, 1);
}
}
@Xiphe
Xiphe / bower.json
Last active Aug 29, 2015
Moar Jasmine 2.0 matchers
View bower.json
{
"name": "jasmine-moar-matchers",
"authors": [
"Hannes Diercks"
],
"description": "Some additional Jasmine 2.0 Matchers.",
"main": ["toBeInstanceOf.js", "toBeTypeOf.js", "promises.js"],
"keywords": [
"jasmine",
"matcher"
@Xiphe
Xiphe / MyClass.js
Created Jul 9, 2014
Thoughs about angular/di.js@2.0 and DRY
View MyClass.js
/**
* Just a simple example Class
* Main point here is: This is completely independent from di implementations
* We could as well require this file and instantiate the Class on our own
*/
function MyClass(myOtherClass, readFile) {
this.myOtherClass = myOtherClass;
this.readFile = readFile;
this.doThings = function() {};
}
You can’t perform that action at this time.