Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
| (defn keyword->pg-enum | |
| "Convert a keyword value into an enum-compatible object." | |
| [enum-type kw] | |
| (doto (org.postgresql.util.PGobject.) | |
| (.setType enum-type) | |
| (.setValue (name kw)))) | |
| (def ->status | |
| "Convert a keyword status into a something_status enum object" | |
| (partial keyword->pg-enum "something_status")) |
| - What do Etcd, Consul, and Zookeeper do? | |
| - Service Registration: | |
| - Host, port number, and sometimes authentication credentials, protocols, versions | |
| numbers, and/or environment details. | |
| - Service Discovery: | |
| - Ability for client application to query the central registry to learn of service location. | |
| - Consistent and durable general-purpose K/V store across distributed system. | |
| - Some solutions support this better than others. | |
| - Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state. | |
| - Centralized locking can be based on this K/V store. |
| /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| * Anchor Smooth Scroll - Smooth scroll to the given anchor on click | |
| * adapted from this stackoverflow answer: http://stackoverflow.com/a/21918502/257494 | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
| angular.module('yourapp').directive('anchorSmoothScroll', function($location) { | |
| 'use strict'; | |
| return { | |
| restrict: 'A', | |
| replace: false, |
| (ns reagent-test.core | |
| (:require [reagent.core :as reagent :refer [atom]] | |
| [datascript :as d] | |
| [cljs-uuid-utils :as uuid])) | |
| (enable-console-print!) | |
| (defn bind | |
| ([conn q] | |
| (bind conn q (atom nil))) |
SSL is an important security and privacy feature for all websites. Its details are outlined in this wikipedia [article] ("http://en.wikipedia.org/wiki/Secure_Sockets_Layer"). At Scibler, we use SSL certificates, encrypting all traffic to and fro from our servers. SSL is a public-key based asymmetric encryption scheme for symmetric key exchange. Symmetric keys are used for payload encryption. On our servers, we use embedded jetty (ring jetty adapter), with the clojure [ring] (https://github.com/ring-clojure) library to handle the http specific functionality.
This is a tutorial about installing SSL certificates on jetty webservers. SSL certificates are X.509 certificates that can be self-signed (authorized by Scibler) or can be signed by trusted third-parties. Trusted third-party certificates are the ones that a Internet user and browsers trust the most. Trusted third-party certification authorities issue certificates per domain and charge a nominal yearly fee.
####Pre-Requisites
- The Java JDK has to be
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
-
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
| // simple example of the cake pattern | |
| // abstract DAO trait | |
| trait Repository[A, B]{ | |
| // saves an entity, returns an ID | |
| def save(entity: A): B | |
| // more features.. | |
| } | |
| trait RdbmsRepository extends Repository[MyUserCaseClass, Long]{ |
| import java.security.SecureRandom; | |
| import javax.crypto.spec.PBEKeySpec; | |
| import javax.crypto.SecretKeyFactory; | |
| import java.math.BigInteger; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.spec.InvalidKeySpecException; | |
| /* | |
| * PBKDF2 salted password hashing. | |
| * Author: havoc AT defuse.ca |
| // Collecting all unique affected app version for a given data set | |
| var jsonStats = [ | |
| {app_versions: ['1.2','1.2.3']}, | |
| {app_versions: null}, | |
| {app_versions: ['1.2','1.3']} | |
| ]; | |
| var app_versions = _.uniq(_.flatten(_.compact(_.map(jsonStats, function(day){return day.app_versions })))); | |
| // ["1.2", "1.2.3", "1.3"] | |
| // Bye bye stupid for loops! |