Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Dobladez dobladez

View GitHub Profile
@dobladez
dobladez / deepGet.js
Last active Jan 3, 2016
In JavaScript: access deep object properties avoiding NPE checks
View deepGet.js
/**
* 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 Feb 22, 2013
My attempt at deploying lein app to VirtualBox via Pallet
View gist:5014457
(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 Dec 14, 2015
Babysteps trying to get started with Pallet and VirtualBox
View gist:4998935
;;; 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"]