Skip to content

Instantly share code, notes, and snippets.

View Xiphe's full-sized avatar
🏥
Dealing with Life

Hannes Diercks Xiphe

🏥
Dealing with Life
View GitHub Profile
@Xiphe
Xiphe / day1_1.js
Last active December 8, 2023 22:50
Advent Of Code 2023 in JS without keywords and reassignments
`1abc2
pqr3stu8vwx
a1b2c3d4e5f
treb7uchet`
.split("\n")
.reduce(
(sum, line) =>
sum +
parseInt(
(line + line)
@Xiphe
Xiphe / autoedit.zsh
Last active July 6, 2023 07:17
Scripts for automating my video-cutting stuff
#!/bin/zsh
zmodload zsh/datetime
# INPUTS
INPUT_FILE=$1
START_TIME=$2
if [ -n "$3" ]; then
CUT_END=$3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Xiphe
Xiphe / wtf.md
Last active March 26, 2019 12:41
WTF moments when introducing someone to JS
  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 07:13
simple script that gets rid of unreachable references in issues and pull requests
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 January 16, 2017 23:54
seamlessly embedded JSX in markdown files on the fly #hipsterstuff
'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;

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 / v1.0-karma1.md
Last active March 8, 2016 16:47
Love and Peace Clause

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.

{
"Handwriting": [
"Patrick Hand SC",
"Grand Hotel",
"Calligraffitti",
"Coming Soon",
"Crafty Girls",
"Homemade Apple",
"Just Another Hand",
"Montez",
@Xiphe
Xiphe / auto_ignore_sass.rb
Last active December 30, 2015 00:39
Create .gitignore for parsed sass files. When using css, less and sass side by side and all css files are in the same folder (even the ones created by sass) this is a way to prevent the generated files from being checked in into your repository.
##### automatically create a .gitignore containing all created css files inside the css folder.
# Absolute path to css dir
abs_css_dir = File.absolute_path(css_dir) + '/'
# .gitignore File instance
gitignore_file = File.open(css_dir + '/.gitignore', 'a+')
gitignore_lines = gitignore_file.readlines
# banner for gitignore file.
gitignore_banner = <<-eos