Skip to content

Instantly share code, notes, and snippets.

View xenophy's full-sized avatar

Xenophy.CO.,LTD xenophy

View GitHub Profile
@xenophy
xenophy / test.js
Created May 3, 2011 04:47
Jasmin Driver for hantomjs support Jasmine 1.0.2
if (phantom.state.length === 0) {
if (phantom.args.length !== 1) {
console.log('Usage: run-jasmine.js URL');
phantom.exit();
} else {
phantom.state = 'run-jasmine';
phantom.open(phantom.args[0]);
}
} else {
window.setInterval(function () {
@xenophy
xenophy / main.cp
Created May 3, 2011 17:12
load qt_ja/pm use QTranslator.
#include <QtGui>
#include "mainwindow.h"
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
QString displayLanguage = QLocale::system().name();
QTranslator *translator = new QTranslator(&app);
translator->load(QString("qt_%1").arg(displayLanguage), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(translator);
@xenophy
xenophy / gist:955812
Created May 4, 2011 19:10
Mac OS X, Append Application Menu.
QAction* quitAction = new QAction(tr("終了(&Q)"), this);
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
quitAction->setMenuRole(QAction::ApplicationSpecificRole);
QMenu* fileMenu = this->menuBar()->addMenu(tr("ファイル(&F)"));
fileMenu->addSeparator();
fileMenu->addAction(quitAction);
@xenophy
xenophy / main.cpp
Created May 4, 2011 21:33
MacOS X translator in resource file.
#include <QtGui>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
// コーデック設定
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
// アプリケーションオブジェクト生成
QApplication app(argc, argv);
@xenophy
xenophy / gist:1185261
Created September 1, 2011 02:07
Next JS Class System Private Function
// private
function _foo = function() {
};
module.exports = NX.define('My.Bar', {
@xenophy
xenophy / gist:1236813
Created September 23, 2011 05:35
Next JS Module Transaction Example
me.beginTrans(function() {
me.query('INSERT INTO db1 VALUES(6, 7)', function(err) {
if(err) {
me.rollback(function() {
fn();
});
} else {
me.commit(function() {
fn();
});
@xenophy
xenophy / gist:1239163
Created September 24, 2011 09:39
mongodb operation - Next JS 0.8.3
module.exports = {
useTable: 'users',
getUsers : function(fn) {
var me = this;
me.find({}).toArray(function(err, docs) {
fn(docs);
});
}
};
@xenophy
xenophy / gist:1357164
Created November 11, 2011 04:03
Next JS Module Dynamic Bind
module.exports = {
execute: function() {
var me = this;
me.bind('mod1', function() {
me.mod1.foo(function(ret) {
me.dump(ret);
@xenophy
xenophy / gist:1491909
Created December 18, 2011 00:25
alert 'ABC' JavaScript Obfuscator Sample.
var _0xaaef=["\x6F","\x61","\x3D","\x69","\x68","\x5F","\x72","\x63","\x65","\x66","\x24","\x74","\x5D","\x78","\x38","\x5B","\x6D","\x41","\x53","\x43","\x64","\x72","\x67","\x6E",""],_0x1c81=[_0xaaef[-~-~[]*-~-~[]*-~-~[]-~{}]+_0xaaef[-~-~[]*-~-~[]-~{}-~{}]+_0xaaef[+[]]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]-~{}+-~-~[]+-~-~[]-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]-~{}-~{}+-~-~[]-~{}+-~-~[]-~{}-~{}]+_0xaaef[-~-~[]*-~-~[]]+_0xaaef[-~[]]+_0xaaef[-~-~[]*-~-~[]-~{}-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]-~{}-~{}+-~-~[]-~{}+-~-~[]-~{}-~{}]+_0xaaef[+[]]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]+-~-~[]-~{}+-~-~[]-~{}+-~-~[]-~{}-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]],_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]-~{}+-~-~[]-~{}+-~-~[]-~{}-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]+-~-~[]-~{}+-~-~[]+-~-~[]+-~-~[]+-~-~[]]+_0xaaef[-~-~[]-~{}]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]+-~-~[]-~{}-~{}+-~-~[]-~{}+-~-~[]+-~-~[]+-~-~[]]+_0xaaef[-~-~[]*-~-~[]*-~-~[]+-~-~[]+-~-~[]-~{}-~{}+-~-~[]+-~-~[]+-~-~[]+-~-~[]
@xenophy
xenophy / gist:1496945
Created December 19, 2011 12:12
SPEC Code Plan1 | Vergina - JavaScript unit and integration testing framework
spec('ExtJS', [
function(t) {
t.diag("case1");
t.ok('Ext', 'ExtJS is here');
t.ok('Ext.Window', '.. indeed');