Skip to content

Instantly share code, notes, and snippets.

View arvidkahl's full-sized avatar
🏠
Working from home

Arvid Kahl arvidkahl

🏠
Working from home
View GitHub Profile
@arvidkahl
arvidkahl / recunrar.sh
Created February 21, 2012 13:50
recursive unrar script (with rm) that keeps directory structure intact
#!/bin/bash
for f in `find . -type f -name "*.rar"`
do
echo "Unpacking " $f " into " `dirname $f`
unrar x -y $f `dirname $f`
rm $f
done
(function(){return process.env.port})(true,false)
(function(){return process.env})(true,false)
chroot_runner
chroot_runner
Running node v-0.6.12
App in audit mode by Watcher...
Spark running on port 14904
undefined
@arvidkahl
arvidkahl / keybase.md
Created October 27, 2014 23:20
keybase.md

Keybase proof

I hereby claim:

  • I am arvidkahl on github.
  • I am arvidkahl (https://keybase.io/arvidkahl) on keybase.
  • I have a public key whose fingerprint is 604D 3303 39F0 A698 DD9E F967 FA8C 255B B842 0E88

To claim this, I am signing this object:

@arvidkahl
arvidkahl / count-dom-elements-on-page.js
Created January 27, 2016 17:48
Count DOM Element type occurrences on a page
[].map.call(document.all,function(el){return el.nodeName}).reduce(function(prev,curr){prev[curr]=(prev[curr]||0)+1;return prev},{})
@arvidkahl
arvidkahl / eventbus.js
Last active February 11, 2017 09:32
eventbus.js
// A single, basic Vue.js instance
let EventBus = new Vue();
@arvidkahl
arvidkahl / components-eventbus.js
Created February 11, 2017 09:34
components-eventbus.js
// Two isolated components accessing the same global
let ComponentA = Vue.extend({
  created: function(){
  EventBus.$on(“thatEvent”, ()=>{
  console.log(“Event received”);
  })
  }
});
@arvidkahl
arvidkahl / eventbus-advanced-prototype.js
Created February 12, 2017 08:14
eventbus-advanced-prototype.js
// Create a global Event Bus
var EventBus = new Vue()
// Add to Vue properties by exposing a getter for $bus
Object.defineProperties(Vue.prototype, {
$bus: {
get: function () {
return EventBus;
}
}
@arvidkahl
arvidkahl / eventbus-advanced-events.js
Created February 12, 2017 08:18
eventbus-advanced-events.js
// Emit an Event from a Component using the internal Event Bus
let ComponentWithEventBus = Vue.extend({
mounted: function(){
this.$bus.$emit('status', 'Component mounted')
this.$bus.$on('something', ()=>{
console.log("Something happened");
});
}
});