Skip to content

Instantly share code, notes, and snippets.

View mikekunze's full-sized avatar

Mike Kunze mikekunze

View GitHub Profile
@mikekunze
mikekunze / app.coffee
Created July 26, 2012 22:59
Basic coffee-script express web server for reportGenerator
express = require 'express'
routes = require './routes'
http = require 'http'
app = express()
app.configure ()->
app.set 'port', (process.env.PORT or 3000)
app.set 'views', __dirname + '/views'
app.set 'view engine', 'jade'
@mikekunze
mikekunze / notify-service.coffee
Created July 14, 2012 16:02
Nagios notify-email custom script
#!/usr/bin/env coffee
#
# incoming argv is order sensitive
#
# [0] - coffee
# [1] - /opt/bin/notify-service.coffee
# [2] - hostname
# [3] - service
# [4] - IP address
# [5] - notification type [ PROBLEM, RECOVERY, OK ]
@mikekunze
mikekunze / getBloggerPosts.coffee
Created February 17, 2012 21:37
Get Blogger Posts with NodeJS
require 'iced-coffee-script'
mongoose = require 'mongoose'
httpAgent = require 'http-agent'
async = require 'async'
mongoConnect = 'mongodb://username:[email protected]:27367/db'
mongoose.connect mongoConnect
@mikekunze
mikekunze / ExampleApplication.coffee
Created February 15, 2012 03:05
Creating a bang.js application
CoreApplication = require '../lib/CoreApplication.coffee'
class ExampleApplication extends CoreApplication
__appName: 'example'
__appVersion: 1.0
__appPath: __dirname
__controllers: [ '/example' ]
constructor: (cb) ->
@mikekunze
mikekunze / login.js
Created January 5, 2012 02:55
extjs login controller
Ext.define('bang.controller.login', {
extend: 'Ext.app.Controller',
views: ['loginPanel'],
init: function() {
remotejs.logMessage('[Client] - Initialized login controller');
this.control({
'loginPanel button[action=login]': {
click: function(button) {
@mikekunze
mikekunze / login.js
Created January 5, 2012 02:41
remotejs ajax login app
{
main: function() {
Ext.bang.util.app.getController('login').init();
remotejs.logMessage('[Client] - launching bang app');
Ext.create('bang.view.loginPanel');
}
}
@mikekunze
mikekunze / bang.js
Created January 5, 2012 02:08
main client application for bang.js,
Ext.namespace('Ext.bang.views');
Ext.namespace('Ext.bang.util');
Ext.bang.util.run = function(provider, response) {
var object = Ext.JSON.decode(response.result);
object.main();
};
Ext.bang.util.startup = function() {
{
main: function() {
Ext.Loader.setConfig({
enabled: true
});
Ext.bang.util.app = Ext.create('Ext.app.Application', {
name: 'bang',
appFolder: 'bang',
@mikekunze
mikekunze / async.example.js
Created October 10, 2011 19:41
Pseudo AsyncNess
// npm install async
// installs to ./node_modules
var db; // Pretend this is a valid async DB connection
var async = require('async');
var bigArray = []; // Pretend this is full of data
var returnResults = []; // Pretend this is empty
@mikekunze
mikekunze / qsurvey-mongoose.js
Created September 19, 2011 23:50
Quick Survey Mongoose
mongoose.connect('mongodb://localhost/serveyus');
var schema = mongoose.Schema,
ObjectID = schema.ObjectId;
mongoose.model('owner', new schema({
username: { type: String },
description: { type: String },
email: { type: String },
password: { type: String }
});