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 / rename_all.sh
Last active May 5, 2018 01:30
Batch rename .js to .ts recursively
find . -name '*.js' -print0 | xargs -0 -n1 bash -c 'mv "$0" "$(dirname ${0})/$(basename "${0}" .js).ts"'
@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);
}
@rhalff
rhalff / Description.md
Created February 8, 2018 09:12 — forked from juanje/Description.md
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@rhalff
rhalff / webpack.nginx.conf
Created January 22, 2018 22:32 — forked from SiZapPaaiGwat/webpack.nginx.conf
webpack-dev-server configuration in nginx on development server
upstream ws_server {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.1.2.225;
location / {
proxy_pass http://ws_server/;
// d8 --expose-gc --allow-natives-syntax --track-retaining-path weak-value-retaining-path.js
class SomeKey {
}
class Metadata {
constructor() {
this.large = new LargeObject();
}
}
title: Simple test
Log(console/log)
Alert(dom/alert)
Markdown(template/markdown)
'# Hello Markdown' -> in Markdown
Markdown out -> msg Log
Verifying my Blockstack ID is secured with the address 1Kv2srmvWmf8cvZQNp3wFxeRkM7oEfbXdV https://explorer.blockstack.org/address/1Kv2srmvWmf8cvZQNp3wFxeRkM7oEfbXdV
@rhalff
rhalff / migrate-to-lerna.sh
Last active October 3, 2018 13:04 — forked from JamieMason/migrate-to-lerna.sh
Bash script to migrate multiple projects into one Lerna monorepo (https://lernajs.io)
#!/usr/bin/env bash
set -x
shopt -s extglob dotglob
TEMP_DIR=tmp
USERNAME=psichi
REPOS=(chix)
function clone_repo () {
@rhalff
rhalff / es6-compose.md
Created October 15, 2017 22:11 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reverse().reduce((prevFn, nextFn) =>
    value => nextFn(prevFn(value)),
    value => value
 );