Skip to content

Instantly share code, notes, and snippets.

@ekoneko
ekoneko / rvdata2Parser
Last active May 25, 2022 22:09
for packing or unpacking rvdata2 script files
#! /usr/bin/env ruby
require 'zlib'
class RvParser
attr_accessor :type
attr_reader :target
def initialize(target)
@target = target
@type = isRvdata? ? 'unpack' : isExport? ? 'pack' : 'other'
@ekoneko
ekoneko / tinymce configuration 中文注释
Last active August 29, 2015 14:00
tinymce configuration 中文注释
tinymce.init({
auto_focus: "content", //焦点ID
directionality: 'ltr', // ltr 文本流从左到右 rtl从右到左,默认ltr
browser_spellcheck: true, // 使用浏览器拼写检查 默认false
language_url: '/languages/fi.js', // 编辑器语言地址
nowrap: true, // 编辑器内容禁止换行,默认为false
@ekoneko
ekoneko / 解析文档注释
Created May 30, 2014 05:56
解析文档注释
/**
* 从代码中匹配出文档注释
*/
(function () {
'use strict';
/**
* 读取文件返回数据
*
* @ param path
@ekoneko
ekoneko / angular-seed
Created September 25, 2014 16:57
angular
(function () {
'use strict';
/**
* init app
*/
var app = angular.module('inde-system', ['ngRoute', 'pascalprecht.translate', 'ngAnimate']);
/**
* expose provide & configure
module.exports = (function () {
var fs = require('fs'),
tplReplace,
stateTpl = " .state('{{stateName}}', {url: '/{{stateRoute}}',templateUrl: 'tpl/{{stateFile}}'})";
tplReplace = function (template, data) {
return template.replace(/\{\{(\w+)\}\}/g, function () {
return data[arguments[1]];
});
};
@ekoneko
ekoneko / sass function
Last active August 29, 2015 14:13
sass function
@mixin linear-gradient($direction, $color-stop1, $color-stop2)
background-image: linear-gradient($direction, $color-stop1, $color-stop2)
background-image: -webkit-linear-gradient($direction, $color-stop1, $color-stop2)
background-image: -moz-linear-gradient($direction, $color-stop1, $color-stop2)
background-image: -o-linear-gradient($direction, $color-stop1, $color-stop2)
@mixin keyframes($animationName)
@-webkit-keyframes #{$animationName}
@content
@-moz-keyframes #{$animationName}
/**
* Fire an event handler to the specified node. Event handlers can detect that the event was fired programatically
* by testing for a 'synthetic=true' property on the event object
* @param {HTMLNode} node The node to fire the event handler on.
* @param {String} eventName The name of the event without the "on" (e.g., "focus")
*/
function fireEvent(node, eventName) {
// Make sure we use the ownerDocument from the provided node to avoid cross-window problems
var doc;
if (node.ownerDocument) {
@ekoneko
ekoneko / 摇一摇
Created January 7, 2016 10:19
mobile motion test
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="count" style="font-size:2em;font-weight=bold;"></div>
</body>
<script>
@ekoneko
ekoneko / paste image
Created February 24, 2016 10:11
html5 get ctrl + v image
paste = (e) => {
var file, remoteImages;
if (typeof e.clipboardData.types === 'undefined' || e.clipboardData.types.length === 0 || e.clipboardData.types[0] !== 'Files') {
return;
}
file = e.clipboardData.items[0].getAsFile();
render(file);
e.stopPropagation();
@ekoneko
ekoneko / async-generator.js
Created July 23, 2016 16:41
async generator
/**
* 一个异步生成器的简单函数实现
* 演示参照下方exec
*/
var async = function (makeGenerator) {
return function () {
var generator = makeGenerator();
var continuer = function (result, value) {
if (result && result.done) {
return;