Skip to content

Instantly share code, notes, and snippets.

View juristr's full-sized avatar

Juri Strumpflohner juristr

View GitHub Profile
@juristr
juristr / gist:15e5bf322f7c06be64bb
Created November 26, 2014 15:30
Requirejs - model-factory
/*jshint unused: vars */
require.config({
paths: {
sinon: '../../bower_components/sinon/lib/sinon',
'sass-bootstrap': '../../bower_components/sass-bootstrap/dist/js/bootstrap',
metisMenu: '../../bower_components/metisMenu/dist/metisMenu',
jquery: '../../bower_components/jquery/dist/jquery',
'angular-ui-router': '../../bower_components/angular-ui-router/release/angular-ui-router',
'angular-translate-loader-partial': '../../bower_components/angular-translate-loader-partial/angular-translate-loader-partial',
'angular-translate': '../../bower_components/angular-translate/angular-translate',
@juristr
juristr / gist:fee92f837c4c5d32847a
Last active August 29, 2015 14:10
Render some JSON

Disclaimer: I'm not a Java expert, so please provide me some enhanced version if mine is suboptimal!

What I want to achieve is to render the following "static" JSON:

{
  "errors": [
    { "name": "Server said this field is required" },
    { "name": "Oh...and this one failed as well" }
 ]
@juristr
juristr / gist:9b10ffb06488eecd8d25
Last active August 29, 2015 14:27
GitHub Issue Badges

Classifying good PRs/Issues

As I briefly highlighted in my blog post about how to properly create a GitHub PR, a good bug report or PR contains an automated test that reproduces the issue.

OSS tip: If you want a bug fixed faster, submit a PR with a failing test rather than an issue.

— Sindresaurus (@sindresorhus) March 21, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Especially newcomers might not know about this. Kent C. Dodds does already invest a lot in trying to get newcomers to submit PRs.

@juristr
juristr / README.md
Last active May 30, 2018 08:37
Plunker - Angular v5 configuration

Plunker with Angular v5

Unfortunately when you create a new Plunker demo, the files are imported in a way from NPM to always take the latest version. This is good in a way and bad in another as now with the release of Angular version 6 & RxJS 6 most Plunkers simply break.

Option 1: Upgrade your Plunks

The best option is to upgrade and give your users/readers the latest and greatest stuff Angular version 6 and RxJS version 6 provide.

Option 2: Patch your Plunks

@juristr
juristr / index.html
Created June 27, 2018 12:58
Geolocation tests
<html>
<body>
<button id="gpsStart">Start</button>
<button id="gpsStop">Stop</button>
<button id="checkStatus">Status</button>
<div id="log"></div>
<script>
(function () {
var old = console.log;
@juristr
juristr / FileOpener2.java
Last active September 3, 2018 08:47
patch of FileOpener2.java
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
@juristr
juristr / mutation-observer.ts
Created September 5, 2019 12:16
rxjs toolbox
// https://twitter.com/niklas_wortmann/status/1167361268732370944
const observeOnMutation = (target, config): Observable<MutationRecord[]> => {
return new Observable((observer) => {
const mutation = new MutationObserver((mutaitons, instance) => {
observer.next(mutations);
});
mutation.observe(target, config);
const teardown = () => {
@juristr
juristr / uses.md
Last active August 29, 2022 13:08
juri uses

How I setup my computer

Here's the things I usually install on my computer (currently a Macbook Pro 16")

MacOS customization

Here are some of the defaults I usually customize.

  • Configure trackpad
  • click with tap
@juristr
juristr / README.md
Created January 21, 2020 13:38
Generate empty node app with Nx

You could generate an empty workspace like

$ npx create-nx-workspace expresswrkspace

and choose "empty" when being asked for a preset.

Then add node support with

@juristr
juristr / launch.json
Created May 12, 2020 20:35
VSCode launch utils
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",