Use this to add events to your objects without needing any libaries.
Simple function can be imported or copy pasted. In your object constructor
assign your event functions to the return value of the createCustomEvent()
.
Simple example:
// | |
// ImageLoadingOp.h | |
// PersonList | |
// | |
// Created by Marcio Valenzuela on 10/20/09. | |
// Copyright 2009 Personal. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> |
class Job < ActiveRecord::Base | |
belongs_to :catergory | |
# UPLOAD a file for the logo | |
def upload | |
uploaded_io = params[:job][:logo] | |
File.open(Rails.root.join('public', 'images', uploaded_io.original_filename), 'w') do |file| | |
file.write(uploaded_io.read) | |
end | |
end |
(function($){ | |
$.fn.extend({ | |
formatInput: function(custom_settings) { | |
this.data("settings", $.extend({ | |
regex:".*", | |
format_number: true, | |
max_length: false, | |
errback: null | |
}, custom_settings); | |
return this.each(function() { |
$.each(arrayFromPHP, function (i, elem) { | |
console.log(elem.User); | |
console.log(elem.EmailAddress); | |
$("<option/>").clone() | |
.val(elem.Emailaddresses) | |
.text(elem.User) | |
.appendTo("#emailaddresses"); | |
}); |
module Jekyll | |
require 'coffee-script' | |
class CoffeeScriptConverter < Converter | |
safe true | |
priority :normal | |
def matches(ext) | |
ext =~ /coffee/i | |
end |
//all of this is within a pretty long method for handling key events | |
var groupChoices = { | |
65 : 'a', 66 : 'b', 67 : 'c', | |
68 : 'd', 69 : 'e', 70 : 'f', | |
71 : 'g', 72 : 'h', 73 : 'i', | |
74 : 'j', 75 : 'k', 96 : '0', | |
97 : '1', 98 : '2', 99 : '3', | |
100 : '4', 101 : '5', 102 : '6', | |
103 : '7', 104 : '8', 105 : '9' |
// * document is the JavaScript document object | |
// * bind adds an event listener to the document object | |
// * pageinit is the event that document object should listen for | |
// * the anonymous function is the callback that getsw executed when the | |
// document recieves the pageinit event. | |
$(document).bind("pageinit", function(){ | |
// Now the pageinit event was triggered | |
// again lets attach an event listener to the document element #listitem2 | |
// This time the event to listen for is the swipeleft event | |
// The convinience function swipeleft is the same a s bind("swipeleft",...) |
/** | |
* # Simple Router | |
* A JavaScript router class. | |
* | |
* #### Examples | |
* var appRouter, func, | |
* Router = require("Router"); | |
* | |
* appRouter = new Router(); | |
* appRouter.get("/", indexMethod); |
class ReadlineLoop | |
constructor: -> | |
@rl = readline.createInterface | |
input: process.stdin | |
output: process.stdout | |
@rl.on("line" , @onLine) | |
.on("close", @onClose) | |
onLine: => # ... | |
onClose: => # ... |