Skip to content

Instantly share code, notes, and snippets.

View dobladez's full-sized avatar

Fernando Dobladez dobladez

View GitHub Profile
@dobladez
dobladez / deepGet.js
Last active January 3, 2016 15:18
In JavaScript: access deep object properties avoiding NPE checks
/**
* Provide a cleaner way to access deep object properties avoiding null pointers
*
* So, instead of doing this:
*
* var x = (obj && obj.prop && obj.prop[subprop] && obj.prop[subprop][lastprop]) || "default";
*
* you can do:
*
* var x = get(obj, "prop", "subprop", subprop, lastprop) || "default";
@dobladez
dobladez / gist:5014457
Created February 22, 2013 16:04
My attempt at deploying lein app to VirtualBox via Pallet
(ns coral-deploy.pallet8
"Node defintions"
(:require
[pallet.api :as api]
[pallet.configure :as configure]
[pallet.actions :as action]
[pallet.crate.automated-admin-user :as admin-user]
[pallet.compute.vmfest :as vbox]
[pallet.crate.java :as java]
[pallet.crate.lein :as lein]
@dobladez
dobladez / gist:4998935
Last active December 14, 2015 00:29
Babysteps trying to get started with Pallet and VirtualBox
;;; My project.clj:
(defproject projectname "0.1.0-SNAPSHOT"
  :description "FIXME Pallet project for projectname"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.cloudhoist/pallet "0.7.3"]
                 [org.cloudhoist/pallet-jclouds "1.4.3"]
                 [org.cloudhoist/pallet-vmfest "0.3.0-alpha.2"]
                 [org.virtualbox/vboxjws "4.2.6"]