Skip to content

Instantly share code, notes, and snippets.

@kentaromiura
kentaromiura / Gruntfile.js
Last active December 19, 2015 07:19
Grunt rule to compile any html inside javascript it matches any files that ends in .element.html, so if you have for example x-foo.element.html it generates x-foo.js Really useful for using the declarative element syntax, eg: http://jsfiddle.net/kentaromiura/uJqy9/ instead of the register api. Requires: grunt, btoa.
module.exports = function(grunt) {
var log = function(){
grunt.log.write(Array.prototype.slice.apply(arguments).join('') + '\n')
},
btoa = require('btoa')
// Project configuration.
grunt.initConfig({
(function(){var s = document.createElement('style'); s.innerText = ".quick-chat-history-message-alias-container{border-top:1px solid silver;}\n.quick-chat-history-header{background-color:whitesmoke;padding-top:0.2em;}"; document.documentElement.appendChild(s)})()
@kentaromiura
kentaromiura / Monad.js
Last active December 11, 2015 02:38
Monad.js
(function(a){var b={},c=function(d){var e=b[d];if(!e){e=b[d]={};var f=e.exports={};a[d].call(f,c,e,f,window)}return e.exports};window.Monad=c("0")})({0:function(a,b,c,d){function e(a){if(a instanceof e)return a;this.value=function(){return a}}e.prototype.bind=function(a){var b=this.value();return a===e||b===null||b===undefined?this:typeof a=="function"?new e(a(b)):this},b.exports=e}})
@kentaromiura
kentaromiura / EnemyStats.js
Created November 1, 2015 13:56
EnemyStats plugin for RPGMaker MV
/* Version 0.1.0 @kentaromiura
TODO: remove access to 'private' properties
TODO: find out if there's already an emitter
TODO: text now overlaps, check how to get the Sprite height/width properties
for the enemy to move the text in another position
TODO: make the text floating up and down (optional)
TODO: add a % bar below the text (optional)
*/
/*:
@kentaromiura
kentaromiura / kenta.AOP.js
Created October 11, 2011 16:50
AOP for Mootools
/*
---
name: kenta.AOP
description: AOP for MooTools 1.3
version: 1.1
license: MIT-style license.
@kentaromiura
kentaromiura / kenta.AOP.Profile.js
Created October 10, 2011 16:27
Class Profiler for Mootools 1.3.x
/*
---
name: kenta.AOP.Profile.js
description: Profiling for MooTools 1.3
version: 1.0
license: MIT-style license.
@kentaromiura
kentaromiura / kenta.Private.js
Created March 4, 2011 18:26
private pattern mutator for Mootools 1.3.x
/*
---
name: kenta.Private
description: Private mootator for MooTools 1.3.x
license: MIT-style license.
copyright: Carlesso Cristian http://mykenta.blogspot.com
Class.Mutators.Profile = function(uniqueID){
var imp = this.implement;
this.implement = function(key, value){
if($type(key) =='string' && $type(value) == 'function'){
var me = this;
var profile = function(){
var start = $time();
@kentaromiura
kentaromiura / Class.Mutators.Private.js
Created August 6, 2010 09:04
Private mootator for mooTools 1.2.4
Class.Mutators.Private = function(private) {
var Private = {};
var me = this;
var imp = me.implement;
imp.apply(me, ['~', function() {
var uid = $uid(this);
private = null;
delete Private[uid];
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
*{
margin:0;padding:0;border:0;
}
body {
font-size:1em;
}