Skip to content

Instantly share code, notes, and snippets.

View mzbac's full-sized avatar
🦀
I may be slow to respond.

Anchen mzbac

🦀
I may be slow to respond.
  • Australia
  • 04:21 (UTC +10:00)
View GitHub Profile
@mzbac
mzbac / dynamicPagRepeatAngular.html
Created December 11, 2015 00:15 — forked from kmaida/dynamicPagRepeatAngular.html
AngularJS - Dynamic pagination on ng-repeat with search/filtering. Use with ui.bootstrap
<!DOCTYPE HTML>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>Dynamic Pagination w/ Filtering</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Kim Maida">
<!-- JS Libraries -->
In VSC, push F1, then write "extension", select "installer extension" and then, write "eslint" and validate. you will have to relaunch VSC
In VSC code, open the user parameters (settings.json) and write:
{
//disable default javascript validator replaced by eslint
"javascript.validate.enable" : false
}
@mzbac
mzbac / README.md
Created July 26, 2016 10:51 — forked from SamyPesse/README.md
Complete example of code highlight for Draft.js with Prism

How to test it?

Copy the prism.js file under examples/prism/ in Draft.js repository. Run npm install prismjs Then open it in your browser.

(editorState
.getCurrentContent()
.getBlockForKey(selectionState.getStartKey()) === editorState
.getCurrentContent()
.getBlockForKey(selectionState.getEndKey()));
import React, { Component } from 'react';
// Get a component's display name
const getDisplayName = WrappedComponent => {
const component = WrappedComponent.WrappedComponent || WrappedComponent;
return component.displayName || component.name || 'Component';
};
export default ({ theme }) => WrappedComponent => class ConfigDecorator extends Component {
// Statics
insertMedia(type, src, cb) {
let editorState = this.state.editorState
let contentState = editorState.getCurrentContent();
let selectionState = editorState.getSelection();
let afterRemoval = Modifier.removeRange(contentState, selectionState, 'backward');
let targetSelection = afterRemoval.getSelectionAfter();
let afterSplit = Modifier.splitBlock(afterRemoval, targetSelection);
let insertionTarget = afterSplit.getSelectionAfter();
var ModalFixMixin = {
componentDidMount() {
if (document && document.body) {
var orig = document.body.className;
document.body.className = orig + (orig ? ' ' : '') + 'modal-open';
}
},
componentWillUnmount() {
if (document && document.body) {
document.body.className = document.body.className.replace(/ ?modal-open/, '');
TextEditor.js
<div styleName="container">
<Toolbar
editorState={editorState}
onChange={this.onEditorChange}
boundingRect={boundingRect} />
<Editor
editorState={editorState}
onChange={this.onEditorChange}
@mzbac
mzbac / introrx.md
Created September 7, 2016 02:49 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
.public-DraftEditor-content {
height: 40px;
overflow: scroll;
padding-bottom: 10px; /* hide the scrollbar */
}
.public-DraftStyleDefault-block > span {
white-space: nowrap;
}