Skip to content

Instantly share code, notes, and snippets.

View rhalff's full-sized avatar

Robbert Halff rhalff

  • Robbert Halff
  • Netherlands
View GitHub Profile
@rhalff
rhalff / fancy-tabs-demo.html
Created August 28, 2019 21:59 — forked from ebidel/fancy-tabs-demo.html
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script>
function execPolyfill() {
(function(){
// CustomElementsV1.min.js v1 polyfill from https://github.com/webcomponents/webcomponentsjs/tree/v1/src/CustomElements/v1.
/*
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@rhalff
rhalff / example.dart
Created February 15, 2019 02:05 — forked from sma/example.dart
A flutter example demonstrating a custom painter drawing selectable rects
class RectsExample extends StatefulWidget {
@override
_RectsExampleState createState() => _RectsExampleState();
}
class _RectsExampleState extends State<RectsExample> {
int _index = -1;
@override
Widget build(BuildContext context) {
@rhalff
rhalff / .Xresources
Created December 5, 2018 19:16 — forked from rawsh/.Xresources
.Xresources theme for rofi and terminal
! *----------------------------*
! | Dotfiles - .Xresources |
! *----------------------------*
! This files contains configuration for:
! * terminal colours
! * urxvt
! * rofi
@rhalff
rhalff / .gvimrc
Created November 19, 2018 18:46 — forked from ryanflorence/.gvimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Font
:set guifont=Source\ Code\ Pro:h14
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hide pointless junk at the bottom, doesn't work in .vimrc for some reason?
:set laststatus=0
:set noshowmode "don't show --INSERT--
:set noruler "don't show line numbers/column/% junk
@rhalff
rhalff / i3-config
Created October 7, 2018 14:53 — forked from bijanebrahimi/i3-config
Run terminator as a drop-down tiling terminal in i3-wm using scratchpad
# Add this to your i3 config (~/.config/i3/config) and restart i3 (Super+Shift+R)
exec --no-startup-id "terminator -m"
for_window [class="Terminator" title="^((?!Terminator Preferences).)*$"] move scratchpad, move position 0 0, resize set 1366 768;
bindsym F1 [class="Terminator"] scratchpad show;
@rhalff
rhalff / forkStream.js
Created September 22, 2018 13:19 — forked from jtbonhomme/forkStream.js
This gist shows how to fork a nodejs stream into 2 streams
var spawn = require('child_process').spawn;
var pass = require('stream').PassThrough;
var a = spawn('echo', ['hi user']);
var b = new pass;
var c = new pass;
a.stdout.pipe(b);
a.stdout.pipe(c);
@rhalff
rhalff / asymmetric.go
Created July 8, 2018 02:32 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
@rhalff
rhalff / autobind.ts
Created May 5, 2018 21:30 — forked from rasmuskl/autobind.ts
TypeScript autobind decorator
function autobind<TFunction extends Function>(constructor: TFunction):TFunction {
const newConstructor = function(...args) {
constructor.apply(this, args);
for (const property in this) {
if (typeof this[property] !== typeof Function) {
continue;
}
this[property] = this[property].bind(this);
}
@rhalff
rhalff / class_decorator.ts
Created April 12, 2018 09:32 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@rhalff
rhalff / class_decorator.ts
Created April 12, 2018 09:32 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}