Skip to content

Instantly share code, notes, and snippets.

View Ashung's full-sized avatar

Ashung Hung Ashung

  • Shenzhen,China
View GitHub Profile
@Ashung
Ashung / font-subset.html
Created December 5, 2019 07:56
Font Subset
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Font Subset</title>
<script src="https://cdn.jsdelivr.net/npm/opentype.js@latest/dist/opentype.min.js"></script>
</head>
<body>
<div>
<p><label for="text">Choose a font file:</label></p>
@Ashung
Ashung / code.js
Last active March 31, 2024 04:52
Figma Snippets
let layer = figma.currentPage.selection[0];
let vectorPaths = layer.vectorPaths.map(item => {
return {windingRule: 'NONZERO', data: item.data}
})
layer.vectorPaths = vectorPaths
layer.exportAsync({
format: 'SVG'
}).then(uint8Array => {
@Ashung
Ashung / config.json
Last active March 6, 2023 23:08
Subset font use opentype.js
{
"fonts": ["./src/NotoSerifSC-Bold.otf"],
"texts": " 0123456789:年月日时分秒公元农历腊零初一二三四五六七八九十廿甲乙丙丁戊己庚辛壬癸子丑寅卯辰巳午未申酉戌亥立春雨水惊蛰春分清明谷雨立夏小满芒种夏至小暑大暑立秋处暑白露秋分寒露霜降立冬小雪大雪冬至小寒大寒"
}
@Ashung
Ashung / meta.json
Last active July 24, 2019 03:33
Sketch metadata
{
"commit" : "de199738bddcc38c4a5af7eee0589554d43d0bde",
"pagesAndArtboards" : {
"1E94526E-CDAC-42A5-8321-0601A47E57B9" : {
"name" : "xxx",
"artboards" : {
"C31F4E02-07EC-4CC5-91D0-C5E9C7222763" : {
"name" : "xxx"
}
}
@Ashung
Ashung / convert_sketch_file_other_version.py
Last active November 29, 2022 14:54
A python script for convert Sketch file to other version. Support Sketch file version greater than 43.
#!/usr/bin/python
# The MIT License
#
# Copyright 2017 Ashung.hung@gmail.com
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
@Ashung
Ashung / sketch_file_for_git_workflow.sh
Last active April 2, 2019 04:57
Sketch file for Git, use as CLI, macOS Finder services, Automator App.
#!/usr/bin/env bash
sketchtool=/Applications/Sketch.app/Contents/Resources/sketchtool/bin/sketchtool
for f in "$@"
do
# Sketch file
if [ -f "${f}" -a ${f##*.} = "sketch" ]
then
@Ashung
Ashung / sketch_diff.sh
Last active January 21, 2020 12:26
Diff Sketch file with Kaleidoscope.
#!/usr/bin/env bash
sketchtool=/Applications/Sketch.app/Contents/Resources/sketchtool/bin/sketchtool
#echo $(python --version)
function extractSketchFile () {
sketchFile=$1
folder=${sketchFile%.sketch}