Skip to content

Instantly share code, notes, and snippets.

View tomasperezv's full-sized avatar
🤖
Focusing

Tomás Pérez tomasperezv

🤖
Focusing
View GitHub Profile
/**
* Using Reflect for reading the property value without triggering a recursive call.
*/
get(obj: Object, key: string): Object {
const originalValue = Reflect.get(target, key);
...
}
/**
* Registering access operations.
*/
get(objectTarget: Object, key: string): Object {
const originalValue = Reflect.get(objectTarget, key);
_registerAccess(key, typeof originalValue !== undefined);
...
}
const proxyHandler = {
/**
* Intercepts access operations on properties and methods.
*/
get(obj: Object, key: string): Object {
...
},
/**
* Intercepts set operations over properties and methods.
/**
* Encapsulate the operation of creating a Proxy object assuring compatibility
* across different versions of Node.js and browsers.
*/
initializeProxy(handler: ProxyHandler, proto: Object): Proxy {
let proxy;
if (typeof Proxy.create !== 'undefined') {
proxy = Proxy.create(handler, proto);
} else {
proxy = new Proxy(proto, handler);
@tomasperezv
tomasperezv / cross-compile-pidgin-plugin.sh
Created October 31, 2015 12:26 — forked from nablaa/cross-compile-pidgin-plugin.sh
Cross-compile Pidgin plugins for Windows using Linux
#!/bin/bash
# Script to cross-compile Pidgin plugins on Linux for Windows.
# Tested to work on Ubuntu 12.04
PLUGIN_SRC_FILE="$1"
PLUGIN_NAME=$(basename "${PLUGIN_SRC_FILE}")
PLUGIN_NAME="${PLUGIN_NAME%.*}"
PLUGIN_DLL="${PLUGIN_NAME}.dll"
@tomasperezv
tomasperezv / disable-notifications.txt
Created November 15, 2014 19:46
Linux Awesome wm + Spotify track notifications
Method 1: spotify --ui.track_notifications_enabled=false
Method 2: echo "ui.track_notifications_enabled=false" >> ~/.config/spotify/Users/[USERNAME]-user/prefs

Keybase proof

I hereby claim:

  • I am tomasperezv on github.
  • I am tomasperezv (https://keybase.io/tomasperezv) on keybase.
  • I have a public key whose fingerprint is 5127 EF6A 842A 4C7E 4902 B091 D554 4A5D 5AB6 DE15

To claim this, I am signing this object:

@tomasperezv
tomasperezv / gist:742389292fb9d84a0c3a
Created June 12, 2014 22:28
Profiling nodejs with dtrace
dtrace -n 'profile-97/execname == "node" && arg1/{
@[jstack(150, 8000)] = count(); } tick-60s { exit(0); }' > stacks.out
deb http://ftp.au.debian.org/debian stable main contrib non-free
deb-src http://ftp.au.debian.org/debian stable main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
#!/bin/sh
#
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed)
#
# This script will:
# * Download the latest live ISO image of SmartOS
# * Create a VirtualBox VM, or update an existing VM with the latest ISO
# * Configure the VM with a zones disk, and boot it!
#
#