Skip to content

Instantly share code, notes, and snippets.

// Modx
class Todo {
id = Math.random();
@observable text;
@observable completed = false;
constructor(text) {
this.text = text;
}
}
module.exports = (server) => {
const db = server.dataSources.myConnectorDb;
const models = ['someModel', 'someOtherModel'];
function cb (models) {
return (err) => {
if(err) {
logger.error(err);
} else {
@rblalock
rblalock / node.sh
Created March 4, 2015 19:14
Show node system processes
ps axl | grep node
@rblalock
rblalock / controller.js
Last active August 29, 2015 14:04
Idea for an uber-simplistic view / data binding in Alloy
var TiBind = require("ti.bind");
var data = [
{ someTitle: "Hello World" }
];
TiBind($, data);
/**
* Structure of an alloy controller
**/
function Controller() {
var $ = this;
}
module.exports = Controller;
/**
/**
* Caching functions class
* @class Cache
*/
var Moment = require("alloy/moment");
var directory;
exports.valid = function (_url) {
var fileName = _url.replace(/[^\w\d]/g, "");
var activity = Ti.Android.currentActivity;
var intent = Ti.Android.createIntent({
action : Ti.Android.ACTION_MAIN,
// you can use className or url to launch the app
// className and packageName can be found by looking in the build folder
// for example, mine looked like this
// build/android/gen/com/appcelerator/test/Test7Activity.java
// className : 'com.appcelerator.test.Test7Activity',
 
// if you use url, you need to make some changes to your tiapp.xml
@rblalock
rblalock / cmd.js
Created April 7, 2014 14:16
Sample type tests
#!/usr/bin/env node
var fs = require('fs'),
esprima = require('esprima'),
estraverse = require('estraverse'),
doctrine = require('doctrine');
function analyze(node) {
var comment, data, params, missing;
var Win = Ti.UI.createWindow({
title: "My Message",
});
var ScrollView = Ti.UI.createScrollView({
height: Ti.UI.FILL,
width: Ti.UI.FILL,
contentHeight: "100%",
contentWidth: "100%",
});
var { fool, barl } = {
foo: "some string",
bar: (function() { /** stuff here **/ })(this)
};
var [foo, [[bar], baz]] = [{ foo: MyObject, bar: () => { /** some craziness **/ } }, [[fool], barl]];