Skip to content

Instantly share code, notes, and snippets.

View code-review-for-the-worlds-best-method-naming-scheme
// Unless this is being accessed beyond this class
// and by packages outside of the scope of this project,
// e.g. This project being imported as a library, you
// should make this private.
public int countX(String str) {
return getNumOfX(str, 0);
// Rather than having two separate methods
// take advantage of Java polymorphism and use
View Mr-Robot.js
let ejsdata = {
View Bad Lambda
const pg = require('pg')
const connectionString = '...' // Commented out for security
module.exports.query = (event, context, callback) => {
const client = new pg.Client(connectionString)
client.query('select * from users limit 1', (err, res) => {
if (err) {
View polymorphism-notes.clj
;; Abstractions with multimethods, protocols, records
;; multimethods
;; useful for overloading based on dispatching
;; vnice
(ns ware-creatures)
(defmulti full-moon-behavior (fn [were-creature] (:were-type were-creature)))
;; Typical multimethods look like so...
(defmethod full-moon-behavior :wolf ;; dispatching value is a keyword
admay / automata.html
Last active Sep 12, 2016
CSS + JS to create a cellular automata
View automata.html
<!DOCTYPE html>
.row div {
height: 8px;
display: inline-block;
width: 8px;