Skip to content

Instantly share code, notes, and snippets.

View hatsumatsu's full-sized avatar
🛸

Martin Wecke hatsumatsu

🛸
View GitHub Profile
@hatsumatsu
hatsumatsu / gist:7e6ebd9cc3ea60906cca
Last active August 29, 2015 13:58
JS path module for Port F
// module path
var path = ( function() {
var settings = {};
var init = function() {
debuglog( 'site.path.init()' );
settings.element = $( 'a[href^="' + globals.blogurl + '"]' )
.not( '#wpadminbar a' );
@hatsumatsu
hatsumatsu / gist:4f2eea5af08f4554d4e0
Last active May 17, 2016 16:21
JS viewport module for Port F
// module viewport
var viewport = ( function() {
var settings = {
width: 0,
height: 0,
documentHeight: 0,
nowLoop: Date.now(),
fps: ( 1000 / 60 ),
( function ( $ ) {
$.fn.redraw = function() {
return this.each( function() {
var redraw = this.offsetHeight;
} );
};
}( jQuery ) );
@hatsumatsu
hatsumatsu / gist:88501947ae35c32b76ff
Last active August 29, 2015 14:05
JS posts module for Port F
// module posts
var posts = ( function() {
var settings = {}
settings.infinityOffset = 300;
settings.request = null;
settings.queryData = {
function position() {
var wrapper = $( '.wrapper' );
var image = $( '.image' );
var imageHeight = image.height();
var imageWidth = image.width();
var imageRatio = imageHeight / imageWidth;
var linkHeight = link.height();
var linkWidth = link.width();
@hatsumatsu
hatsumatsu / gist:bd58fc3e1652ea0e2bc7
Last active August 29, 2015 14:15
photoswipe module
// lightbox module
// we are using photoSwipe
// https://github.com/dimsemenov/PhotoSwipe
var lightbox = ( function() {
var init = function() {
console.log( 'site.lightbox.init()' );
bindEventHandlers();
if( $( '.imagelist' ).length > 0 ) {
/**
* Wrap oembed in <div>
* @param string $html original markup
* @param string $url URL
* @param array $attributes config
* @param int $id post ID
* @return string modified markup
*/
function wrap_oembed( $html, $url, $attributes, $id ) {
$class = '';
/**
* Modify markup of inline images added via the visual editor
* to follow the srcset responsive image pattern
* @param string $html original image markup
* @param int $id attachment ID
* @param string $alt alt text
* @param string $title image title
* @return string modified markup
*/
function responsive_image_embed( $html, $id, $alt, $title ) {
@hatsumatsu
hatsumatsu / fontforge keyboard shortcuts
Created April 18, 2015 21:56
/Applications/FontForge.app/Contents/Resources/opt/local/share/fontforge/hotkeys/default
CharView.Popup.Menu.Add Anchor:Ctl+0
FontView.Popup.Menu.FontView.Menu.Metrics.Set Vertical Advance...:No Shortcut
FontView.Popup.Menu.New Outline Window:Ctl+H
FontView.Popup.Menu.Cut:Ctl+X
FontView.Popup.Menu.Copy:Ctl+C
FontView.Popup.Menu.Copy Reference:Ctl+G
FontView.Popup.Menu.Copy Width:No Shortcut
FontView.Popup.Menu.Paste:Ctl+V
FontView.Popup.Menu.Clear:No Shortcut
FontView.Popup.Menu.Copy Fg To Bg:Ctl+Shft+C
@hatsumatsu
hatsumatsu / get_site_title()
Created April 21, 2015 14:14
get_site_title()
/**
* Template tag:
* Get <title> text
* Use as <title><?php echo get_site_title( '-' ); ?></title>
* @param string $separator String separator
* @return string title text
*/
function get_site_title( $separator = ' – ' ) {
global $wp_query;