Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Heikki Lotvonen hlotvonen

🏠
Working from home
View GitHub Profile
@hlotvonen
hlotvonen / Unicode Private Use Area codes for Glyphs
Created May 20, 2020
You can use these codes to insert Private Use Area codes into Glyphs font editor (Glyph -> Add Glyphs...).
View Unicode Private Use Area codes for Glyphs
uniE000
uniE001
uniE002
uniE003
uniE004
uniE005
uniE006
uniE007
uniE008
uniE009
View cellWithMasking.jsx
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
Hide contact fields from profile in admin interface & remove personal options from profile page in admin interface
View gist:5624060
// ****************************************************
// 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
Make a custom post type
View gist:5624056
// ****************************************************
// 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 Dec 17, 2015
Change title's placeholder text for custom post type "projekti"
View gist:5624052
// ****************************************************
// 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
Add custom dashboard menu page for editing a page
View gist:5624043
// ****************************************************
// 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 Dec 17, 2015
Snippet for a div to be 100% - 100px of browser window height
View 100browserheight.js
$(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;