Skip to content

Instantly share code, notes, and snippets.

View dviramontes's full-sized avatar
〰️
failing forward

David Viramontes dviramontes

〰️
failing forward
View GitHub Profile
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@jimmyjacobson
jimmyjacobson / a_string_is_not_an_error.md
Last active December 27, 2021 20:49
A String is not an Error

A String is not an Error

Why Error Handling?

  • Default behavior for programs is to terminate on an error, or enter the debugger
  • Terrible user experience

Why Handle Errors?

  • Gracefully Handle Errors (retry connections, re-prompt for user input, etc)
  • Non Local Control Flow (Display error messages and screens)

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

(require '[clojure.data.fressian :as fress])
(require '[clojure.java.io :as io])
(import 'java.util.zip.GZIPInputStream)
(defn fress-seq* [reader]
(let [x (try (fress/read-object reader) (catch Exception e :eof))]
(if (= :eof x)
(do (.close reader) nil)
(cons x
@preziotte
preziotte / index.html
Last active August 29, 2015 14:04
Five Rotating Icosahedrons
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background-color: #36393B;
}
svg {
position: absolute;
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 13:42
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@rwaldron
rwaldron / exponentiation.md
Last active August 29, 2015 14:01
Exponentiation Operator: **

Exponentiation Operator

Performs exponential calculation on operands. Same algorithm as Math.pow(x, y)

  • Commonly used in albegra, geometry, physics and robotics.
  • Nice to have "inline" operator

Prior Art

  • Python
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@creationix
creationix / app.js
Last active December 30, 2015 07:29
Generate a tree of events using process.addAsyncListener
var http = require('http');
var send = require('send');
var urlParse = require('url').parse;
var count = 2;
var server = http.createServer(function (req, res) {
if (!--count) server.close(); // Only allow two connection and then exit.
send(req, urlParse(req.url).pathname)
.root(__dirname)
.pipe(res);