Skip to content

Instantly share code, notes, and snippets.

💅
writing JavaScript

Max Stoiber mxstbr

💅
writing JavaScript
Block or report user

Report or block mxstbr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View grab.js
// Benötigt PhantomJS. Benutzung: $ phantomjs grab.js
var page = require('webpage').create();
page.viewportSize = {
width: 10000, // A0: 9933
height: 15000 // A0: 14043
};
page.open('http://localhost/~peter/map/map.html', function(){
setTimeout(function(){
View keybase.md

Keybase proof

I hereby claim:

  • I am mxstbr on github.
  • I am mxstbr (https://keybase.io/mxstbr) on keybase.
  • I have a public key whose fingerprint is DF86 64CE 0ECF A8CA F8EB 3919 DAE5 1ACA D765 65B6

To claim this, I am signing this object:

View ES2015 JavaScript Primer.md

We're excited to have you attend one of our workshops! Here's a JavaScript (re)fresher to help you get up-to-speed on some features of the language we'll be using.

Let and Const

JavaScript has always had var:

var name = 'Ryan'
@mxstbr
mxstbr / README.md
Last active Sep 1, 2017
Syntax highlighting ESNext (inc. JSX) for Keynote presentations
View README.md

Syntax Highlighting ESNext (inc. JSX)

To get syntax highlighting for ESNext (including JSX), you need to have pygments-lexer-babylon installed:

pip install pygments pygments-lexer-babylon

Now when you run pygmentize on a .jsx file it'll automatically use the new lexer! 🎉

View keybase.md

Keybase proof

I hereby claim:

  • I am mxstbr on github.
  • I am mxstbr (https://keybase.io/mxstbr) on keybase.
  • I have a public key whose fingerprint is 78D3 829B 9CE0 7924 2C15 4E38 673F 4304 C9E3 A511

To claim this, I am signing this object:

View log-resolvers.js
import createLogger from 'graphql-log';
let list = [];
const logExecutions = createLogger({
logger: (name) => {
list.push(name);
fs.writeFileSync('resolvers.js', JSON.stringify(list, null, 2));
},
});
@mxstbr
mxstbr / idea.md
Last active Nov 4, 2017
Code splitting react-router routes with webpack 2
View idea.md

NOTE: Sokra confirmed I had a misunderstanding, Webpack is still a static build tool and the below won't work. It's still a nice concept though...

With webpack 1, code splitting react-router routes is quite tedious. It requires us to repeat the getComponent function over and over again. (See here for an explanation how it works with webpack 1)

Example:

<Router history={history}>
  <Route
    path="/"
@mxstbr
mxstbr / send-email.js
Created Nov 13, 2017
A send email util for Postmark
View send-email.js
import postmark from 'postmark';
const debug = require('debug')('send-email');
const stringify = require('json-stringify-pretty-compact');
let client;
if (process.env.POSTMARK_SERVER_KEY) {
client = new postmark.Client(process.env.POSTMARK_SERVER_KEY);
} else {
console.log(
'\nℹ️ POSTMARK_SERVER_KEY not provided, debug mode enabled. Will log emails instead of actually sending them.'
You can’t perform that action at this time.