Skip to content

Instantly share code, notes, and snippets.

@frankmeola
frankmeola / loan_repayments.html
Created April 17, 2017 01:04
Self Explaining Code
<!DOCTYPE html>
<html>
<head>
<title>Self Explaining Code Sample</title>
<!-- Google Fonts -->
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<!-- CSS Reset -->
<link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
@frankmeola
frankmeola / backend.py
Created April 9, 2017 16:05
Version based cache expiration example
from flask import Flask, Response
import json, datetime
app = Flask(__name__)
@app.route("/")
def hello():
versionFile = open('versionInfo.txt', 'r')
version = int(versionFile.read())
data = {
@frankmeola
frankmeola / state_based_example.js
Last active August 29, 2015 14:25
JavaScript Performance Analysis And The Mutating Interface: Part Two
var timer = stopwatch();
timer = timer.start();
setTimeout(function(){
timer = timer.stop();
console.log(timer.getElapsed().getMilliseconds());
}, 1500);
@frankmeola
frankmeola / instrumented_examples.js
Last active August 29, 2015 14:25
JavaScript Performance Analysis And The Mutating Interface: Part One
var loadData = function(){
var getDataTimer = stopwatch();
getDataTimer.start();
$http.get('/getMyData')
.success(function(data, status, headers, config) {
getDataTimer.stop();
console.log('Get data time in ms ', getDataTimer.getElapsed())
@frankmeola
frankmeola / REPL-SlugExperiment.fsx
Created April 30, 2014 02:33
Sculpt your code in a REPL blog post code
#load "Sculpt.fs"
open Sculpt.Experimentation
open System
let toSlug (filename:string) =
let replace (old:string) (n:string) (statement:string) =
statement.Replace(old, n)
let singleSpace (statement:string) =
System.Text.RegularExpressions.Regex.Replace(statement, @"[\s]+", " ")
@frankmeola
frankmeola / LinqContiguousExtensions.cs
Created March 17, 2014 02:29
Contiguous items list ranges
using System;
using System.Collections.Generic;
namespace ContiguousItems
{
public static class LinqContiguousExtensions
{
public static IEnumerable<T> SkipUntil<T>(this IEnumerable<T> source, Predicate<T> predicate)
{
@frankmeola
frankmeola / XMLMinifier.cs
Last active August 24, 2022 10:11
A simple XML minifier in C#.
using System.IO;
using System.Text;
using System.Xml;
namespace XMLMinifier
{
/// <summary>
/// Config object for the XML minifier.
/// </summary>
public class XMLMinifierSettings