Skip to content

Instantly share code, notes, and snippets.

View justincarlson's full-sized avatar

Justin R Carlson justincarlson

  • Iowa
View GitHub Profile
@justincarlson
justincarlson / img_overlay_mock.html
Created November 20, 2021 21:07
Sudo Overlay mode HTML so srcset can be used.
<div class="image-wrapper">
<div class="image-container">
<img src="https://www.tyndellphotographic.com/assets/images/products-large/8844cf7c81c27a17ab0d721d38b4aeff.jpg" alt="Sample image">
</div>
</div>
<style type="text/css">
.image-wrapper {
background-color: #fff;
height: 500px;

Keybase proof

I hereby claim:

  • I am justincarlson on github.
  • I am justin_carlson (https://keybase.io/justin_carlson) on keybase.
  • I have a public key ASDrgz25LvQ92CXw6L0nmg1DRTDgSpBBQcHlwmkk98pesQo

To claim this, I am signing this object:

-- table settings
declare @decorate int = 0
declare @tableName varchar(200) = 'Foo'
declare @database varchar(200) = 'Bar'
-- scripts vars
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
@justincarlson
justincarlson / GetImageSharpness.php
Created March 14, 2019 02:46
Estimate an Imagick image's sharpness based on average color similarity between pixels in a grid.
<?php
**
* Estimate image sharpnes based on color
* similarity in pixels in a grid.
*
* @param Imagick $img
* @return float
*/
function GetImageSharpness($img)
@justincarlson
justincarlson / ScaleToJpg.php
Created March 14, 2019 01:37
PHP Imagick example image scaling to minimize blur and defects.
<?php
function ScaleToJpg($src,$width,$height,$dest) {
$im = new \Imagick($src);
$im->setImageCompression(\Imagick::COMPRESSION_JPEG);
$im->setImageCompressionQuality(100);
$im->stripImage();
$im->setInterlaceScheme(\Imagick::INTERLACE_PLANE);
$size = $im->getImageGeometry();
@justincarlson
justincarlson / blur-eval.php
Last active March 14, 2019 01:40
Example PHP Code that tries to detect image sharpness and displays point of max contrast.
<?php
// Sample code to evaluate the sharpness of an image in PHP
// @author https://pastebin.com/u/ossifrage
// Note: this code has not been thoroughly tested, and does not
// perform any kind of input validation. Please don't run this
// on your website and then complain when someone uses it to
// break your server.