Skip to content

Instantly share code, notes, and snippets.

@phaze9
phaze9 / 05_dom_events.html
Created November 11, 2011 19:44
05_dom_events.html
<div id="the_div">
<ul id="the_list">
<li id="the_item">Click me!</li>
</ul>
</div>
<p id="log"></p>
<script type="text/javascript" charset="utf-8">
function log(string){
@phaze9
phaze9 / 08_inheritance.js
Created November 11, 2011 18:21
08_inheritance.js
// 1. Write a class to support the following code:
var Person = function(name) {
this.name = name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
console.log(thomas.name) // --> "Thomas"
@phaze9
phaze9 / 01_functional_vs_OO.js
Created November 11, 2011 17:04
JavaScript Masterclass Homework
// Exercise 1 - OO || !OO
// Define a data structure for cars (make and color), and a function
// that logs a string like "I'm a red Mercedes" to the console.
// Make two versions: a functional version, and a object-oriented version.
var logCar = function(car) {
console.log("I'm a " + car.color + ' ' + car.make);
}
logCar({ color: 'blue', make: 'BMW' });
@phaze9
phaze9 / 02_add_closure.js
Created November 10, 2011 20:17
02_add_closure.js
// Exercise 2 - Closures
// Wrap the following code in a closure and export only the "countdown" function.
var countdown = function() {
// Code
var index;
function log(){
console.log(index);
}
@phaze9
phaze9 / 04_make_it_better.js
Created November 10, 2011 19:30
04_make_it_better.js
// taken from http://www.dreamincode.net/code/snippet154.htm
//
// Find the weaknesses, and clean up the code.
// Find at least 3 things you can make better!
//
// Test numbers (return true):
// 4111111111111111
// 378282246310005
// 5555555555554444
@phaze9
phaze9 / etc|logrotate.d|lighttpd
Created August 28, 2011 08:31
Lighttpd Logrotate Config
/var/log/lighttpd/*.log {
missingok
copytruncate
rotate 7
compress
notifempty
sharedscripts
postrotate
/etc/init.d/lighttpd reload
endscript
@phaze9
phaze9 / titanium.macapp.bash
Created July 1, 2011 09:05
Titanium Studio Local Packaging Example
/Library/Application\ Support/Titanium/sdk/osx/1.1.0/tibuild.py -d ~/tmp -n -t bundle -a /Library/Application\ Support/Titanium/sdk/osx/1.1.0/ ~/Projects/Titanium\ Studio\ Workspace/MyApp
@phaze9
phaze9 / titanium.tibuild.help
Created July 1, 2011 08:54
Titanium Studio Local Packaging Help
$ /Library/Application\ Support/Titanium/sdk/osx/1.1.0/tibuild.py
Usage: tibuild.py [options] appdir
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-d FILE, --dest=FILE destination folder for output
-v, --verbose turn on verbose logging
-o PLATFORM, --os=PLATFORM
@phaze9
phaze9 / titanium.failure.log
Created July 1, 2011 08:49
Titanium Studio Packaging Failure
trying to get property of non-object
invalid request token