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 / 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;