Skip to content

Instantly share code, notes, and snippets.

View nandoflorestan's full-sized avatar

Nando Florestan nandoflorestan

View GitHub Profile
@nandoflorestan
nandoflorestan / composing-moron.mjs
Created August 2, 2020 10:10
Instead of starting from a blank page, compose from the suggestion of a moron
/** @prettier */
"use strict";
// Usage: node composing-moron.mjs
const notes = [
"A ",
"B♭",
"B ",
"C ",
"D♭",
@nandoflorestan
nandoflorestan / repo_pattern.py
Created May 28, 2016 11:55 — forked from uris77/repo_pattern.py
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.
@nandoflorestan
nandoflorestan / overlay.html
Created March 31, 2012 11:38
jQuery: Click an image to show it big on a viewport-sized modal overlay
<html>
<head>
<title>jQuery: Click an image to show it big on a viewport-sized modal overlay
</title>
</head>
<body>
<p>
<img class="zoomable" style='width:40%;' src="http://www.tumblr.com/photo/1280/artedaalma/19707693049/1/tumblr_m19h2mwFRQ1rsn8cy" />
</p>
<p>
@nandoflorestan
nandoflorestan / global.js
Created March 23, 2012 19:13
Double-click protection with JQuery, and other useful things, for every page
'use strict'; // http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
$(function() {
// Make the user aware of keyboard shortcuts
$("button[accesskey], a[accesskey]").each(function (i, tag) {
if (tag.accessKey)
tag.title += ' [' +
(tag.accessKeyLabel || tag.accessKey).replace('Shift', '⇧') + ']';
});