Skip to content

Instantly share code, notes, and snippets.

View ralph's full-sized avatar

Ralph von der Heyden ralph

View GitHub Profile
@ralph
ralph / test1-output.txt
Last active August 23, 2024 08:33
I am trying to convince typescript that an item cannot be `null` / `undefined` when using a filter, but typescript does not trust me. Am I missing something? Is typescript stupid, or am I? 🤔 The only way I could get this working is by force-casting a type with `as`. Can you suggest a more elegant way?
src/test.ts:10:39 - error TS18049: 'item' is possibly 'null' or 'undefined'.
10 strings.forEach((item) => console.log(item.id, item.label))
~~~~
src/test.ts:10:48 - error TS18049: 'item' is possibly 'null' or 'undefined'.
10 strings.forEach((item) => console.log(item.id, item.label))
~~~~
@ralph
ralph / heroku_restart.sh
Last active July 17, 2020 08:42 — forked from mattheworiordan/restart.sh
Heroku scheduled restarts
#!/bin/bash
# Set up the Heroku scheduler to run this command every hour.
# Source: https://gist.github.com/ralph/b1b4023e0c03aa8c68f8219cd089de46
utc_hour=`date -u +'%H' | sed 's/^0*//'`
modulo="${RESTART_EVERY_X_HOURS:-6}"
n=$(($utc_hour % $modulo))
echo $n
[alias]
# less typing, more winning:
aa = add --all --intent-to-add
ap = add --patch
br = branch
ci = commit
co = checkout
cp = cherry-pick
df = diff
l = log -1

Innovatives Wissensformat sucht Entwickler

Für einen großen öffentlich-rechtlichen Rundfunksender entwickeln wir ein innovatives Wissenschaftsformat: Wir verwandeln Sensordaten live in Text. Und zwar über 40 Tage. Wir lösen damit nicht nur die Erzählweise klassischer Medien auf. Es ist ein journalistisches Abenteuer.

Wir sind preisgekrönte Journalisten und begeisterte Open-Source-Entwickler. Um die Software bis zum produktiven Einsatz zu bringen, suchen wir für den Zeitraum März bis Oktober 2017 noch freelance Verstärkung für unser Entwickler-Team.

Warum solltest Du unbedingt mitmachen?

  • Wir entwickeln sowohl Software als auch Hardware
@ralph
ralph / index2.atom
Last active September 28, 2015 14:26
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed Trololo</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
run:
rbenv install ./2.2.2-railsexpress
or edit install.sh to include the RUBY_VERSION you want to install and run the script.
@ralph
ralph / diff.js
Created June 20, 2014 16:41
diff-match-patch without the match and patch in javascript
/**
* Diff Match and Patch
*
* Copyright 2006 Google Inc.
* http://code.google.com/p/google-diff-match-patch/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@ralph
ralph / list-link.js
Last active August 29, 2015 14:02 — forked from spiegela/list-link.js
/* Put your CSS here */
html, body {
margin: 20px;
}
.color {
height: 200px;
width: 200px;
}
@ralph
ralph / e
Created October 17, 2012 14:30
ruby compatible line number selection in vim
#!/bin/sh
vim `echo $* | sed -E -e 's/\:([0-9]+)/ +\1/g'`