Skip to content

Instantly share code, notes, and snippets.

View bbrewer97202's full-sized avatar

Ben Brewer bbrewer97202

View GitHub Profile
@bbrewer97202
bbrewer97202 / index.html
Created February 20, 2014 18:36
Simple Facebook,Twitter and Google+ social sharing calls
<!doctype html>
<html>
<head>
<title>Social share page title</title>
<meta name="description" content="Social share page description" />
<meta property="og:title" content="Social share og:title value" />
<meta property="og:description" content="Social share og:description value" />
<meta property="og:image" content = "http://www.thunderfarm.com/socialshare/socialshare.jpg" />
</head>
<body>
@bbrewer97202
bbrewer97202 / q.js-promises-chain.html
Last active August 29, 2015 14:08
Chained promises with q.js
<!doctype html>
<html>
<head>
<title></title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/q.js/1.0.1/q.min.js"></script>
</head>
<body>
<script type="text/javascript">
//watch browser console for notification of what is happening
@bbrewer97202
bbrewer97202 / webpack.config.js
Last active August 29, 2015 14:08
webpack jshint-loader custom reporter example with filename and color formatting
var chalk = require('chalk');
module.exports = {
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "jshint-loader"
}
@bbrewer97202
bbrewer97202 / child.html
Created January 7, 2015 00:37
Responsive Iframe demo
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<style type="text/css">
body, html {
@bbrewer97202
bbrewer97202 / Preferences.sublime-settings
Created October 29, 2015 17:32
Sample custom Sublime Text Settings
{
"always_show_minimap_viewport": true,
"caret_extra_width": 2,
"color_scheme": "Packages/User/SublimeLinter/Hyrule (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Consolas",
"font_size": 15,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
@bbrewer97202
bbrewer97202 / index.html
Last active May 19, 2016 17:40
15 puzzle in javascript
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="container" id="container"></div>
<style type="text/css">
@bbrewer97202
bbrewer97202 / index.js
Created October 20, 2016 17:15
Graphicsmagick gm convert svg string buffer to sized jpg with 300 DPI setting
var gm = require('gm');
var source = '<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2550 3300" enable-background="new 0 0 2550 3300" xml:space="preserve"><g><path fill="#53381A" stroke="#1C1308" d="M807.6,1092.5L527.3,1067c-636.9-25.5-509.5,0-458.6,509.5c51,203.8,0,331.2,254.8,331.2 L807.6,1092.5z"/><path fill="#8A5B28" stroke="#1C1308" d="M909.5,1143.5H629.2c-636.9-25.5-509.5,0-458.6,509.5c51,203.8,25.5,305.7,305.7,229.3 L909.5,1143.5z"/><path fill="#454F2E" stroke="#1C1308" d="M807.6,990.6c127.4-254.8,76.4-305.7,458.6-254.8c509.5,127.4,509.5,152.9,891.6,152.9 c254.8,25.5,509.5,101.9,254.8,407.6l-280.2,509.5H450.9L807.6,990.6z"/><path fill="#76894C" stroke="#1C1308" d="M323.5,1703.9v178.3l1146.4,458.6v-178.3L323.5,1703.9z M807.6,990.6 c127.4-254.8,76.4-305.7,382.1-203.8c509.5,152.9,254.8,152.9,789.7,152.9c254.8,25.5,458.6,101.9,254.8,407.6L1954,1856.8 L527.3,1627.5L807.6,990.6z"/
@bbrewer97202
bbrewer97202 / index.js
Created January 4, 2017 16:50
validation of x-hub-signature header facebook
const crypto = require('crypto');
const jsesc = require('jsesc');
//inside express route handler
const xHubSignature = req.headers['x-hub-signature'];
if (this.validateSignature(xHubSignature, req.body)) {
console.log('valid signature');
}
/**
@bbrewer97202
bbrewer97202 / DockerFile
Last active April 9, 2024 22:34
Boilerplate for node app Dockerfile
# create .dockerignore with node_modules, dist, etc
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json /app
RUN npm install
COPY . /app
RUN npm run build
FROM node:18.20.1-bullseye-slim AS production