Skip to content

Instantly share code, notes, and snippets.

View corychainsman's full-sized avatar

Cory Chainsman corychainsman

View GitHub Profile
@hwangbible
hwangbible / example.js
Last active March 31, 2026 18:26
Scriptablify - lets you require('modules') in Scriptable app!
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: magic;
// Defaults to the latest version and no automatic update; if the file exists, just use it
const moment = await require('moment');
// Use any SemVer options to specify a version you want
// Refer to the calculator here: https://semver.npmjs.com/
const lodash = await require('lodash@^3.9.1');
@amomchilov
amomchilov / DownloadProgressIndicatorDemo.swift
Last active July 9, 2024 17:56 — forked from mminer/DownloadProgressIndicatorDemo.swift
Displays a progress indicator on a file in the Finder.
import Cocoa
let path = "/Users/You/Pick/Any/Random/File/On/Your/System.txt"
let destination = URL(fileURLWithPath: path)
let progress: Progress = {
let p = Progress(parent: nil, userInfo: [
.fileOperationKindKey: Progress.FileOperationKind.downloading,
.fileURLKey: destination,
])
@veltman
veltman / README.md
Last active April 3, 2025 15:41
Sunburst to icicle #2

Transitioning between a sunburst and an icicle chart while preserving the chart dimensions by interpolating the difference in perimeter between the inner section and outer section until the difference is near zero.

Chrome currently has a rendering bug once the arcs' radii get really extreme, so this stops at about an 8-pixel difference.

@harej
harej / npg_gap_analysis.py
Last active June 9, 2016 21:20
Generates list of items and properties used on NPG-related Wikidata entries and assesses existence of labels in other languages
# Step 1: Get list of any Wikidata item with NPG ID and anything that is a subclass of chemical hazard
# Step 2: Iterate through each item for invoked items and properties
# (for claim in claims; for subclaim in claim: 'Q' + str(subclaim['mainsnak']['data-value']['value']['numeric-id'])
# and subclaim['mainsnak']['property'] where claim[0]['datatype'] == 'wikibase-item')
# Step 3: De-duplicate to generate exhaustive list of each item/property of interest to NIOSH
# Step 4: Check labels: en, es, zh, fr, de
# Step 5: Prepare HTML table that lists each item/property of interest, highlighting cells where values are missing
# Step 6: Take percentages of coverage in each language; save to a timestamped log
import requests
@ofstudio
ofstudio / meta.hbs
Created January 6, 2015 13:43
Meta tags snippet for Ghost Themes
{{!-- Tested on Ghost 0.5.7. --}}
{{!-- IMPORTANT! Some things are more likely to work in a different way in future versions of Ghost. Check the documentation --}}
{{#is "index, tag, author"}} {{!-- Meta for index, tag and author contexts --}}
{{#is "index"}}
<title>{{@blog.title}}</title>
<meta name="description" content="{{@blog.description}}"/>
<meta property="og:title" content="{{@blog.title}}"/>
<meta itemprop="name" content="{{@blog.title}}"/>
{{/is}}
{{#is "tag"}}
@jegtnes
jegtnes / Gulpfile.js
Created June 1, 2014 10:43
The Gulpfile I created for the blogpost http://jegtnes.co.uk/blog/using-gulp-with-uncss-in-ghost-for-tiny-assets/, detailing how to use UnCSS and Gulp for Ghost.
var gulp = require('gulp');
var sass = require('gulp-sass'); // skip this if you're working with vanilla CSS
var rename = require('gulp-rename');
var cmq = require('gulp-combine-media-queries');
var uncss = require('gulp-uncss');
var download = require('download');
var cssmin = require('gulp-cssmin');
var clean = require('gulp-clean');
var xml2js = require('gulp-xml2js');
@mindrones
mindrones / README.md
Last active August 29, 2015 13:58 — forked from mbostock/.block
Wrapping Long Labels (fork)

Fork of Wrapping Long Labels.

The difference is that we do a join to create the tspans, so that they have their own __data__, in case we want to use it. Here I color them based on their text length.

@swarminglogic
swarminglogic / watchfile.sh
Last active January 1, 2025 19:07
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl