Skip to content

Instantly share code, notes, and snippets.

View ItsAsbreuk's full-sized avatar

Marco Asbreuk ItsAsbreuk

View GitHub Profile
@ItsAsbreuk
ItsAsbreuk / keybase.md
Created September 23, 2019 11:30
Keybase identification

Keybase proof

I hereby claim:

  • I am itsasbreuk on github.
  • I am itsasbreuk (https://keybase.io/itsasbreuk) on keybase.
  • I have a public key ASC3LbCTYNS0wdIpUq2eU_v8oEqMfQfcw6Hc2oI59jkeBAo

To claim this, I am signing this object:

@ItsAsbreuk
ItsAsbreuk / .babelrc
Last active March 10, 2016 11:29
Flattening nested array
{
"presets": ["es2015"]
}
@ItsAsbreuk
ItsAsbreuk / gist:8299370
Created January 7, 2014 13:38
Y.App apache-conf
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias mydomain.com *.mydomain.com
DocumentRoot "/var/www/vhosts/mydomain.com/httpdocs"
<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{HTTP:X-PJAX} ^true$
RewriteRule (.*) /pjaxdir/$1 [L]
# or:
# RewriteRule (.*) processpjax.php?uri=$1 [L]
@ItsAsbreuk
ItsAsbreuk / controller.server.js
Last active December 29, 2015 16:49
mojitopromises
/*jslint anon:true, sloppy:true, nomen:true*/
YUI.add('Foo', function(Y, NAME) {
/**
* The Foo module.
*
* @module Foo
*/
/**
@ItsAsbreuk
ItsAsbreuk / queryPromise.js
Last active December 24, 2015 09:38
queryPromise for node-mysql
/*jshint maxlen:205 */
/*
* SPECIAL NOTE 1:
*
* This code is created as a yui-module inside Mojito.
* If you need it as standalone for any Nodejs-project, you need to require YUI as well.
*
* See: http://yuilibrary.com/yui/docs/yui/nodejs.html
*
@ItsAsbreuk
ItsAsbreuk / gist:6712217
Last active December 23, 2015 23:49
publishAsync method at the prototype of Y.Model, which publishes events with asynchronous defaultFn and preventedFn Promises
// Special thanks to Luke Smiths !! https://github.com/lsmith, who helped me creating this custom publish-method.
// More details https://gist.github.com/lsmith/6664382/db6e9e3342d5a7610d0efc3e4b72b480604ce46a
YModel.prototype.publishAsync = function(type, opts) {
var instance = this,
asyncEvent = this.publish(type, opts);
asyncEvent._firing = new Y.Promise(function (resolve) { resolve(); });
@ItsAsbreuk
ItsAsbreuk / gist:6676361
Last active December 23, 2015 18:29 — forked from lsmith/gist:6664382
/*global SM:true*/
'use strict';
// Publish a very special, promise-compatible event that supports the default
// function behavior to chain on internally created promises before executing
// the after() subs. on() subs can still e.preventDefault(), which will
// reject the promise and thus skip the default behavior and after() subs.
var asyncEvent = eventTarget.publish('foo');
asyncEvent._firing = new Y.Promise(function (resolve) { resolve(); });
@ItsAsbreuk
ItsAsbreuk / directory-structure
Last active December 19, 2015 21:58
Comboloader configuration. For using the comboloader on node.js and serving your own modules. Both through http and https.
You must download the yui3-files (for every version you want to serve) as well as the Gallery-modules.
Yui3 --> http://yuilibrary.com/yui/quick-start/ or https://github.com/yui/yui3
Gallery --> download zip from https://github.com/yui/yui3-gallery
The Gist presumes the next directory-structure on the server:
/usr/local/yui_libraries/
/usr/local/yui_libraries/yui3/
/usr/local/yui_libraries/yui3/3.10.3/...
Y.PieModel = Y.Base.create('pieModel', Y.Model, [], {
initializer: function () {
this.internalModellist = new Y.ModelList();
},
_setModelList: function (newdata) {
return this.internalModellist.reset(newdata);
}
},
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DT Destroy</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body class="yui3-skin-sam">
<button id="btnRebuild">Rebuild it!</button>
<div>build times: <span id="count"></span></div>