Skip to content

Instantly share code, notes, and snippets.

View ivoputzer's full-sized avatar
:octocat:

Ivo von Putzer Reibegg ivoputzer

:octocat:
View GitHub Profile
@ivoputzer
ivoputzer / dom-content-loaded.js
Created November 3, 2017 11:09
different dom ready implementations in vanilla javascript
function ready (fn) {
if (typeof fn !== 'function') return
if (document.readyState === 'complete') return fn()
document.addEventListener('DOMContentLoaded', fn, false)
}
@ivoputzer
ivoputzer / bufferFrom.js
Created June 8, 2017 18:07
bufferFrom.js
function bufferFrom (stream, fn, {concat} = Buffer) {
return buffer = []
, stream.on('data', (data) => buffer.push(data))
.on('end', () => fn(concat(buffer)))
}
@ivoputzer
ivoputzer / index.js
Last active February 17, 2017 20:44
es6 flagged template strings require
const _require = ([module]) => require(module)
// usage
const {join, resolve} = _require `path`
$ telnet 104.20.23.46 80
Trying 104.20.23.46...
Connected to 104.20.23.46.
Escape character is '^]'.
HEAD /dist/v7.4.0/node-v7.4.0-darwin-x64.tar.gz HTTP/1.1
Host: nodejs.org
Accept: */*
HTTP/1.1 200 OK
@ivoputzer
ivoputzer / stream.util.js
Created October 28, 2016 10:36
stream-data to buffer and string
const {Readable, PassThrough} = require('stream')
const {createReadStream} = require('fs')
const {ok, equal} = require('assert')
describe('toString', function(){
it('converts a fs-stream to buffer', done => {
let stream = createReadStream('/dev/null')
toString(stream, function(string){
@ivoputzer
ivoputzer / mkdirp.js
Last active September 6, 2016 12:52
[ES6] recursive mkdir-sync in node.js
#!/usr/bin/env node
const {mkdirSync:mkdir} = require('fs')
const {dirname} = require('path')
function mkdirp(path, mode = 0777){
try {
mkdir(path, mode)
} catch({errno}) {
if (-2 !== errno) return // enoent
@ivoputzer
ivoputzer / usage.md
Last active July 28, 2016 09:52
viscosity vnp cli helper for osx

usage

viscosity connect <vnp-name>
viscosity disconnect <vpn-name>
@ivoputzer
ivoputzer / cover-letter.md
Last active February 26, 2020 20:35
cover letter

Cover Letter

My name is Ivo and I am an Italian agile software developer who loves coding and solving problems in a simple yet creative fashion. During my years of web development I have grown a strong passion for fronted development which led me to a good understanding of its underlaying technologies. I love hacking the hell out of web apps and getting a grasp of cutting edge technologies in order to keep up with time and deliver the best user experience possible.

While user experience still plays a big role in what I enjoy doing, I've learnt how important it is to write stable yet maintainable and scalable backend solutions. Even though I started out with PHP, I soon naturally came closer to the NodeJS environment while still embracing more "elegant" technologies such as Ruby or Java either adopting frameworks or by implementing architectures from scratch.

I discovered the Agile Manifesto and eXtreme Programming back while joining XPeppers in 2013 and I’ve tried my best to apply either values and prin

@ivoputzer
ivoputzer / osx
Created June 19, 2016 17:49
vysheng/tg telegram-cli install osx
cd ~/Downloads
git clone --recursive https://github.com/vysheng/tg.git
cd tg
brew install libconfig readline lua python libevent jansson openssl
brew link --force openssl
brew link --force readline
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include"
export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib"
./configure --disable-liblua && make
@ivoputzer
ivoputzer / http.logger.js
Created May 11, 2016 14:50
simple http logger nodejs
const http = require('http')
http.createServer((req, res) => {
console.log('-- url:', req.url)
console.log('-- verb:', req.method)
let body = []
req.on('data', function(chunk) {
body.push(chunk)
}).on('end', function() {
console.log('-- body:', Buffer.concat(body).toString())