Skip to content

Instantly share code, notes, and snippets.

View matthiaswenz's full-sized avatar
:octocat:

Matthias Wenz matthiaswenz

:octocat:
  • Germany
  • 04:55 (UTC +02:00)
View GitHub Profile
🚴‍♂️ 2055km █████████████▊░░░░░░
⛷ 454km ███░░░░░░░░░░░░░░░░░
🚶‍♂️ 394km ██▌░░░░░░░░░░░░░░░░░
‍🏃‍♂️ 52km ▏░░░░░░░░░░░░░░░░░░░
2954km total
🚴‍♂️ 5204km ████████████████▏░░░
🚶‍♂️ 847km ██▌░░░░░░░░░░░░░░░░░
‍🏃‍♂️ 170km ▍░░░░░░░░░░░░░░░░░░░
⛷ 137km ▍░░░░░░░░░░░░░░░░░░░
6357km total
@matthiaswenz
matthiaswenz / server.js
Last active April 14, 2021 05:53
iOS Safari Referrer-Policy verification
// Run with $ node server.js
var http = require('http');
var server = http.createServer(function (req, res) {
referrerPolicy = "strict-origin-when-cross-origin"; // Replace with corresponding test value
res.writeHead(200, { 'Content-Type': 'text/html', 'Referrer-Policy': referrerPolicy });
res.write('<html><body>');
res.write('<h1>Test page</h1>');
res.write('<ul>');
res.write('<li><a href="https://github.com">Cross-origin request</a></li>');
#!/usr/bin/env bash
# Download supplementary MIPS toolchains which have been removed from Android NDK r17 to fix Android RN builds
# Underlying issue is https://github.com/facebook/react-native/issues/19321
set -e
NDK_BUNDLE_TOOLCHAINS=$ANDROID_HOME/ndk-bundle/toolchains
MIPS64_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin
MIPS_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mipsel-linux-android-4.9/prebuilt/darwin-x86_64/bin
@matthiaswenz
matthiaswenz / NotificationUtil.java
Last active September 1, 2015 14:46
Android Notifications 2.3 - 6.0
public class NotificationUtil {
public static Notification createNotification(Context context, PendingIntent pendingIntent, String title, String text, int iconId) {
Notification notification;
if (isNotificationBuilderSupported()) {
notification = buildNotificationWithBuilder(context, pendingIntent, title, text, iconId);
} else {
notification = buildNotificationPreHoneycomb(context, pendingIntent, title, text, iconId);
}
return notification;
}
@matthiaswenz
matthiaswenz / plugin.xml
Last active August 29, 2015 14:23
Simple IntelliJ plugin descriptor
<idea-plugin version="2">
<id>com.example.yourPluginID</id>
<name>A simple demo plugin</name>
<description>This is just a simple demo plugin with no other purpose</description>
<version>1.0</version>
<vendor url="http://www.ranterle.de">ranterle</vendor>
<idea-version since-build="135.1"/>
<depends>com.intellij.modules.java</depends>
@matthiaswenz
matthiaswenz / SignInAction.java
Created June 18, 2015 13:33
Base Action subclass for IntelliJ plugin
public class SignInAction extends AnAction {
@Override
public void actionPerformed(AnActionEvent event) {
Project project = event.getProject();
// do your sign in work...
}
@Override
public void update(AnActionEvent e) {
e.getPresentation().setEnabledAndVisible(!isAuthenticated());
@matthiaswenz
matthiaswenz / gist:e221fc854e193cc82edd
Created November 27, 2014 19:06
Find apps supporting your URL scheme in Android
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData("mycustomscheme://test");
PackageManager manager = context.getPackageManager();
List<ResolveInfo> resolvedActivites = manager.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
if (!resolvedActivities.isEmpty()) {
// ... someone responds to the scheme
} else {
// ... nobody does
}