Skip to content

Instantly share code, notes, and snippets.

View KevinGutowski's full-sized avatar

Kevin Gutowski KevinGutowski

View GitHub Profile
@KevinGutowski
KevinGutowski / README.md
Last active August 24, 2017 18:01
D3.UNCONF Submission

Learn about the relationship between Hue, Saturation, Brightness, and Color Contrast. Minimum contrast level is set to 4.5 (AA).

@KevinGutowski
KevinGutowski / index.html
Last active August 28, 2017 00:39
D3 Unconf Badge
<head>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="script.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<svg width="1050" height="1500"></svg>
</body>
@KevinGutowski
KevinGutowski / index.html
Created August 28, 2017 00:04
Test D3 Badge Placement
<div style="width:1500px; height:1500px; background-color:pink"></div>
@KevinGutowski
KevinGutowski / .block
Last active October 23, 2017 03:02
d3 v4 realtime line chart
license: mit
@KevinGutowski
KevinGutowski / MC Example.tex
Last active December 8, 2017 03:07
Latex Template for Gradescope Multiple Choice
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{wasysym}
% Multiple choice question
\newcommand{\mcqb}{{\Large$\Circle$}}
\newcommand{\mcqs}{\solution{\mcqb}{\Large$\CIRCLE$}}
% Multiple option question.
\newcommand{\moqb}{{\Large$\Square$}}
@KevinGutowski
KevinGutowski / MC_Formatting.tex
Last active September 1, 2020 19:32
Gradescope MC Latex Formatting
\usepackage{wasysym}
% ---- Convenience commands -----
% Choose one option (bubbles)
\newcommand{\chooseone}{{\Large$\Circle$\ \ }}
% Choose all options that apply (boxes)
\newcommand{\choosemany}{{\Large$\Square$\ \ }}
@KevinGutowski
KevinGutowski / ChangeFontSize.js
Created December 18, 2018 07:12
Change font size programmatically
var sketch = require('sketch')
var document = sketch.getSelectedDocument()
var textLayer = document.selectedLayers.layers[0]
var font = textLayer.sketchObject.font()
var newFont = NSFont.fontWithDescriptor_size(font.fontDescriptor(), 12)
textLayer._object.setFont(newFont)
document.sketchObject.inspectorController().reload() //don't forget to reload the inspector!
@KevinGutowski
KevinGutowski / FontSpike.js
Last active December 19, 2018 18:15
Testing to see if I can build an Opentype Panel
framework("CoreText");
const document = require("sketch").getSelectedDocument();
const textLayer = document.selectedLayers.layers[0];
const font = textLayer.sketchObject.font()
const descriptor = font.fontDescriptor().fontDescriptorByAddingAttributes({
[NSFontFeatureSettingsAttribute]: [
{
[NSFontFeatureTypeIdentifierKey]: kLowerCaseType,
@KevinGutowski
KevinGutowski / panel.js
Last active September 27, 2020 14:08
Creating a Sketch NSPanel
export function runPanel() {
let threadDictionary = NSThread.mainThread().threadDictionary()
let identifier = "co.yourIdentifier"
// If there is already a panel, prevent the plugin from running again
if (threadDictionary[identifier]) return
threadDictionary.panelOpen = true
setupPanel(threadDictionary, identifier)
}
@KevinGutowski
KevinGutowski / SetAttribtuesWhileEditing.js
Last active January 27, 2019 02:19
Attempting to set font attributes during selection
const Sketch = require('sketch')
framework("CoreText");
let myTextLayer = Sketch.getSelectedDocument().selectedLayers.layers[0]
let textLayer = myTextLayer.sketchObject
if (textLayer.isEditingText() == 0) {
console.log("select some text")
} else {