Skip to content

Instantly share code, notes, and snippets.

View pieterbeulque's full-sized avatar

Pieter Beulque pieterbeulque

View GitHub Profile
var ids = [1, 2, 3, 4],
details = [],
fetch = function (id) {
var dfd = new $.Deferred();
new Request({ id: id }, function (res) {
dfd.resolve(res);
});
return dfd.promise();
if (!document.querySelector('[ui-view]')) {
console.warn('No root [ui-view] found');
}
a {
border: 1px solid green;
color: red;
}
.hero {
color: white;
}
.hero a {
// app.translate('foo.bar') renders this.translations.foo.bar
// app.translate('foo.bar', 'baz') renders this.translations.foo.bar, replacing any ${} syntax with 'baz'
// app.translate('foo.bar', { hello: 'world' }) renders this.translations.foo.bar, replacing ${hello} with 'world'
translate (key, replace) {
if (!this.translations) {
return '';
}
let translation = this.translations;
@pieterbeulque
pieterbeulque / application.js
Last active November 18, 2015 10:55
fd-angular-meta SEO title helper
import { Inject } from 'fd-angular-core';
import { Page, Root } from 'mr-angular-pages';
import { Meta } from 'fd-angular-meta';
import TMPL from './application.html!';
@Page({
templateUrl: TMPL
})
export class ApplicationPage {
get longTitle () {
@pieterbeulque
pieterbeulque / publishing-js-pkg-on-npm.md
Created January 20, 2016 13:55
Publishing JS packages on NPM

Publishing JS packages on NPM

Make sure you have an NPM & Travis account.

NPM

  • npm init
  • update package.json (ref)
  • commit & push
  • npm publish
@pieterbeulque
pieterbeulque / front-end-bootcamp.md
Created September 8, 2017 08:05
Reading List 🤓
@pieterbeulque
pieterbeulque / stopwatch.php
Created January 25, 2018 09:19
Easily measure PHP performance timing
<?php
/**
* Little helper class to help you measure server performance
*
* Usage:
* $stopwatch = new Stopwatch();
* $stopwatch->start('My expensive operation');
* // Do expensive operation
* $stopwatch->stop();
*

Keybase proof

I hereby claim:

  • I am pieterbeulque on github.
  • I am pieterbeulque (https://keybase.io/pieterbeulque) on keybase.
  • I have a public key ASBhNe1utNm-tf4j41If7y2ZryWF6Az2iUyK2UK42Xkxsgo

To claim this, I am signing this object:

const ask = async (question) => Promise.resolve('Answer ' + question);
const questions = [1, 2, 3];
const answers = await questions.reduce(async (accumulator, nextQuestion) => {
const allAnswers = await accumulator;
const answer = await ask(nextQuestion);
return Promise.resolve([...allAnswers, answer]);
}, Promise.resolve([]));