Skip to content

Instantly share code, notes, and snippets.

View bencentra's full-sized avatar

Ben Centra bencentra

View GitHub Profile
@bencentra
bencentra / esignature.html
Last active January 30, 2023 14:13
Example of using HTML5 canvas with both mouse and (single) touch input
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<title>E-Signature</title>
@bencentra
bencentra / spinner.html
Last active January 7, 2023 12:58
A game show/board game style spinner, made with SVG and JavaScript. Add some data to the "Slice" objects and make something useful out of it.
<!DOCTYPE HTML>
<html>
<head>
<title>SVG Spinner</title>
<style type="text/css">
* {
font-family: Arial, sans-serif;
}
#wrapper {
width: 400px;
@bencentra
bencentra / server.js
Created February 13, 2017 15:08
An HTTPS server for static content (Node.js)
/*
This module creates an HTTPS web server and serves static content
from a specified directory on a specified port.
To generate a new cert:
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
To remove the passphrase requirement:
@bencentra
bencentra / DatabaseUtils.php
Last active February 14, 2022 14:45
Revised version of db_utils.php, refactored as a PHP class.
<?php
/*
* DatabaseUtils.php - A class of simple database utilities.
*
* Performs CRUD operations using PDO (MySQL) prepared statements.
*
* Author: bencentra (https://gist.github.com/bencentra/92228e1f4139436c4153)
*/
@bencentra
bencentra / frontend_guild_2.md
Last active August 23, 2018 15:46
Updated blog post draft

Creating the "Frontend Guild"

I love working at Constant Contact. But like any engineering group, technology can easily lag over time, drift between teams, and generally become a hassle. This time last year I wanted to do something about it, specifically for frontend tooling since that's what I work with every day.

Your team trying to keep up with tech debt

Your team trying to keep up with tech debt

Fast forward one year - I've been leading a group of fellow engineers that we call the Frontend Guild. Together we're making tech debt reduction and tooling improvements a full-time effort, not an afterthought. We still have a long way to go, but our work is already impacting teams across the company. Keeping up with changing technology is tough, but we're more ready for it than ever.

@bencentra
bencentra / frontend_guild.md
Last active August 6, 2018 14:37
Blog post draft about the Frontend Guild at Constant Contact

Creating the "Frontend Guild"

I love working at Constant Contact. But like any engineering group, technology can easily lag over time, drift between teams, and generally become a hassle. This time last year I wanted to do something about it, specifically for front-end tooling (since that's what I work with every day).

Your team trying to keep up with tech debt

Your team trying to keep up with tech debt

After talking with some fellow engineers, we identified some key issues:

  • How do we keep frontend tech up-to-date? We're not talking about hopping on the latest framework hotness. We mean tools and techniques that can simplify writing and shipping JavaScript - ES2015+, Babel, Webpack, modular code, etc.
@bencentra
bencentra / canvas.html
Created June 12, 2017 02:45
HTML5 canvas starter file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Canvas</title>
<style>
#canvas {
border: 1px solid black;
}
</style>
@bencentra
bencentra / db_utils.php
Last active January 16, 2017 22:22
A bunch of database functions for prepared statements with PDO. Assumes a global $pdo object created in separate 'dbInfo.inc' file.
<?php
// Include the database connection info
require_once("path/to/dbInfo.inc");
/*
* Database methods
*/
function db_select($sql, $data)
{
@bencentra
bencentra / .bash_profile
Created November 6, 2016 16:54
My .bash_profile
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# export PS1="\h:\W \u\$"
export PS1="[\u] \W $ "
# Git autocommlete
source ~/.git-completion.bash
# Setting PATH for Python 3.5
@bencentra
bencentra / .editorconfig
Last active March 14, 2016 21:53
Common .editorconfig file
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8