Skip to content

Instantly share code, notes, and snippets.

View fmal's full-sized avatar
:octocat:
:octocat:‎ ‎‎‎ ‎ ‎:octocat:

Filip Malinowski fmal

:octocat:
:octocat:‎ ‎‎‎ ‎ ‎:octocat:
View GitHub Profile
@fmal
fmal / Makefile
Created January 16, 2020 22:29 — forked from fangel/Makefile
Font subsetting using pyftsubset + sfnt2woff-zopfli
# The following variables determine which directories to look for input fonts,
# and which directory to place the output fonts in.
INDIR = input
INPUT_EXT = woff
OUTDIR = output
SUBSET_FILE = subset.txt
SUBSET_FLAGS = --layout-features='' --obfuscate-names --glyphs="space"
ZOPFLI_ITERATIONS = 15
ifneq ($(shell echo $$ITERATIONS),)
.title-actions > .monaco-toolbar > .monaco-action-bar > .actions-container > .action-item > .action-label.icon.explorer-action {
display: none !important;
}
.editor-actions > .monaco-toolbar > .monaco-action-bar {
display: none !important;
}
<script>
window.Promise || document.write('<script src="https://unpkg.com/[email protected]/dist/es6-promise.min.js"><\/script>');
window.fetch || document.write('<script src="https://unpkg.com/[email protected]/fetch.js"><\/script>');
</script>
@fmal
fmal / Simple event system
Created April 14, 2016 23:17 — forked from alexreardon/Simple event system
Simple event system
let _callbacks = {};
const events = {
on(name, cb) {
_callbacks[name] = _callbacks[name] || [];
_callbacks[name].push(cb);
},
dispatch(name, data) {
setTimeout(function() {
(_callbacks[name] || []).forEach(cb => cb(data));
});
@fmal
fmal / Enhance.js
Created February 13, 2016 15:46 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@fmal
fmal / State.js
Created December 11, 2015 00:35
Angular state service
/**
* State
* @ngdoc service
* @name State
* @description
* this service handles all app state.
* you can also use it as a basic pub/sub with the publish() and subscribe() functions
* this is able to function and synchronize over multiple Tabs.
* all State is persistet to localStorage
* **#######################################################################**
@fmal
fmal / what-forces-layout.md
Created October 11, 2015 22:04 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@fmal
fmal / disallow-new.js
Last active August 30, 2015 16:00 — forked from mattdesl/disallow-new.js
avoiding new in classes
// Allows:
// funkyParser()
module.exports = function createFunkyParser(opt) {
return new FunkyParser(opt)
}
function FunkyParser(opt) {
// make params optional
opt = opt || {}
// Underline
@mixin underline($color, $width) {
background:
linear-gradient(
to top,
$color,
$color #{$width}em,
transparent #{$width}em,
transparent
) repeat-x;

##Usage

First, require the component.

var Media = require('pivotal-ui-react.media').Media;

Next, in your jsx, use the component. The default media displays a media object (images, video, audio) to the left or right of a content block.