Skip to content

Instantly share code, notes, and snippets.

View arikon's full-sized avatar

Sergey Belov arikon

  • Yandex
  • Tivat, Montenegro
View GitHub Profile
@arikon
arikon / i-jquery__my-plugin.js
Created February 1, 2014 16:35
jQuery plugin with bem-core
// If you are using borschik to expand links (bem make and enb do this for you)
// you could use this hack for any jQuery plugin found in the wild
modules.define('i-jquery__my-plugin', ['jquery'], function(provide, $){
var jQuery = $,
window = {jQuery: jQuery};
/*borschik:include:path/to/jquery-plugin.js*/
provide($);
});
@arikon
arikon / q-progress.js
Created November 24, 2013 13:44
deffered.notify() / promise.progress() test
var Q = require('q');
Q.thenResolve()
.then(function() {
var d = Q.defer(),
step = 0;
var interval = setInterval(function() {
d.notify('step ' + ++step);
}, 1000);
@arikon
arikon / bundle.deps.js
Created November 19, 2012 10:58
depsByTech
exports.deps = [
// regular deps
];
exports.depsByTechs = {
js: {
// deps for js tech of current block
bemhtml: [
// bemhtml deps for js tech of current block
]
@arikon
arikon / stylus.js
Created September 21, 2012 23:00
Stylus plugin to resolve relative paths to images on @import
#!/usr/bin/env node
var S = require('stylus'),
FS = require('fs'),
URL = require('url'),
PATH = require('path');
var path = PATH.resolve('bundle.styl');
S(FS.readFileSync(path, 'utf8'))
.set('filename', path)
exports.match = function(file) {
if (isSvn(file)) return;
if (/blocks.*?/.test(file.self)) {
file.match = matchBlocksLevel;
return file.match(file);
}
};
function isSvn(file) {
return (file.self == '.svn' || /\/\.svn\//.test(file.path));
@arikon
arikon / cmd.js
Created September 23, 2011 11:50
require('../lib/coa').Cmd()
.name('cmd')
.title('Command test')
.helpful()
.cmd()
.name('command')
.title('Do command work')
.helpful()
.act(function() {
console.log('Doing command work...');
var Q = require('q');
require('../lib/coa').Cmd()
.name(process.argv[0])
.helpful()
.opt()
.name('reject').title('Returns rejected promise')
.long('reject')
.flag()
.act(function(opts) {
console.log('** doing --reject act');
var sys = require('sys'),
libxml = require('o3-xml');
var snippetXml = '<snippet><name>Sergey Belov</name><phone>+71111111111</phone><car>Ford Mondeo</car></snippet>',
snippetDoc = libxml.parseFromString(snippetXml),
xml = '<root><group><doc id="123"/></group></root>',
doc = libxml.parseFromString(xml);
// throws exception
doc.documentElement.selectSingleNode('group/doc').appendChild(snippetNode.documentElement);
diff --git a/include/cO3.h b/include/cO3.h
index 4f8ee4c..c3121d7 100644
--- a/include/cO3.h
+++ b/include/cO3.h
@@ -406,6 +406,7 @@ struct cO3 : cScr {
// unzip the downloaded module, validates it and put the dll in place
bool unpackModule(const Str& name, iStream* zipped, bool update=false )
{
+ /*
using namespace zip_tools;
<?xml version="1.0" encoding="windows-1251"?>
<root>
<!-- Save this file with windows-1251 encoding! -->
<hello>Привет, товарищ!</hello>
</root>