Skip to content

Instantly share code, notes, and snippets.

View hlotvonen's full-sized avatar
🏠
Working from home

Heikki Lotvonen hlotvonen

🏠
Working from home
View GitHub Profile
@hlotvonen
hlotvonen / gist:310ab9cd41ba99bf9bb23abd2a04c033
Last active September 12, 2024 12:04
Ways to substitute specific words with OpenType
# Goal: substitute each letter in the word "while" with the corresponding alternate.
# Option 0 — does not work, error "many-to-many substitution not available"
lookup whileAttrCalt-0 useExtension {
ignore sub @AllLetters w' h i l e;
ignore sub w' h i l e @AllLetters;
sub w' h' i' l' e' by w.alt2 h.alt2 i.alt2 l.alt2 e.alt2;
} whileAttrCalt-0;
@hlotvonen
hlotvonen / Unicode Private Use Area codes for Glyphs
Created May 20, 2020 15:08
You can use these codes to insert Private Use Area codes into Glyphs font editor (Glyph -> Add Glyphs...).
uniE000
uniE001
uniE002
uniE003
uniE004
uniE005
uniE006
uniE007
uniE008
uniE009
import React from 'react';
import store from '../models/CanvasStore';
import {observer} from 'mobx-react'
const Cell = observer((props) => {
const [glyphPath, svgWidth, svgHeight, svgBaseline, glyphOffsetX, glyphFontSizeModifier, rotationAmount, flipGlyph, glyphInvertedColor]
= store.canvas[props.y][props.x]
let transform = {
transform: `scale(${flipGlyph}, -1) rotate(${rotationAmount}deg)`
@hlotvonen
hlotvonen / gist:5624060
Created May 21, 2013 23:18
Hide contact fields from profile in admin interface & remove personal options from profile page in admin interface
// ****************************************************
// Hide contact fields from profile in admin interface
// ****************************************************
add_filter( 'user_contactmethods', 'update_contact_methods',10,1);
function update_contact_methods( $contactmethods ) {
unset($contactmethods['aim']);
unset($contactmethods['jabber']);
unset($contactmethods['yim']);
@hlotvonen
hlotvonen / gist:5624056
Created May 21, 2013 23:17
Make a custom post type
// ****************************************************
// Make a custom post type
// ****************************************************
function projektiRegister()
{
$labels = array(
'name' => _x('Lisää projekti', 'post type general name'),
'singular_name' => _x('Lisää projekti', 'post type singular name'),
'add_new' => _x('Lisää uusi projekti', 'portfolio item'),
'all_items' => __( 'Kaikki projektit' ),
@hlotvonen
hlotvonen / gist:5624052
Last active December 17, 2015 14:19
Change title's placeholder text for custom post type "projekti"
// ****************************************************
// Change title's placeholder text for custom post type "projekti"
// ****************************************************
function change_default_title_event( $title ){
$screen = get_current_screen();
if ( 'projekti' == $screen->post_type ) {
$title = 'Projektin otsikko...';
}
@hlotvonen
hlotvonen / gist:5624043
Created May 21, 2013 23:15
Add custom dashboard menu page for editing a page
// ****************************************************
// Add custom dashboard menu page for editing a page
// ****************************************************
add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page(){
add_menu_page( 'Me ja In English osiot', 'Muokkaa Me ja In English osioita', 'edit_pages', 'post.php?post=13&action=edit', '', '', 15 );
}
@hlotvonen
hlotvonen / 100browserheight.js
Last active December 17, 2015 00:19
Snippet for a div to be 100% - 100px of browser window height
$(document).ready(function() {
// for a div to be 100% - 100px of browser window height
var windowheight = $(window).height();
var newheight = windowheight - 100;
$("#landing-section").height(newheight);
});
// with window resize
$(window).resize(function() {
var windowheight = $(window).height();
var newheight = windowheight - 100;